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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
da9a8c6d48759f15e1450f894323928733f34c9c | 0bcdd692bafb36ade19dcf6dfeace1a1ae9b05bd | /src/main/java/unnamed/sync/SyncableByteArray.java | c15053661da9abee336baf12d86430e33514ae91 | [
"MIT"
] | permissive | awesommist/Unnamed | 45a09b6b2a8202ef6730890502f3e8e1c6223652 | abf3ce44d900f8740639f1950a1995781707038c | refs/heads/master | 2021-01-10T13:21:25.766726 | 2015-11-05T21:00:22 | 2015-11-05T21:00:22 | 45,004,669 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,481 | java | package unnamed.sync;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraft.nbt.NBTTagCompound;
public class SyncableByteArray extends SyncableObjectBase implements ISyncableValueProvider<byte[]> {
private byte[] value;
public SyncableByteArray() {
value = new byte[0];
}
public SyncableByteArray(byte[] val) {
value = val;
}
@Override
public void readFromStream(DataInputStream stream) throws IOException {
int length = stream.readInt();
value = new byte[length];
for (int i = 0; i < length; i++) {
value[i] = stream.readByte();
}
}
@Override
public void writeToStream(DataOutputStream stream) throws IOException {
if (value == null) {
stream.writeInt(0);
} else {
stream.writeInt(value.length);
for (byte element : value) {
stream.writeByte(element);
}
}
}
@Override
public void readFromNBT(NBTTagCompound nbt, String name) {
nbt.getByteArray(name);
}
@Override
public void writeToNBT(NBTTagCompound nbt, String name) {
nbt.setByteArray(name, value);
}
@Override
public byte[] getValue() {
return value;
}
public void setValue(byte[] newValue) {
if (newValue != value) {
value = newValue;
markDirty();
}
}
} | [
"avoronnie@gmail.com"
] | avoronnie@gmail.com |
85c53ec62a13e87e61689648d30466a35737de63 | 60c87e28ffb644c45501a20c779077000c77b640 | /src/main/java/org/jeecgframework/web/system/service/NoticeAuthorityUserServiceI.java | 583bfc2bbf5aff3f010c5920445edcdd96f47bee | [] | no_license | chenzhenguo/nx | 3fa76e5e05f7425882382cdfbb1816e2e485f38b | cf19205ea35a7718bc0b71b370b330353df5d956 | refs/heads/master | 2021-07-22T02:23:45.199383 | 2017-11-01T13:21:51 | 2017-11-01T13:21:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,026 | java | package org.jeecgframework.web.system.service;
import java.io.Serializable;
import org.jeecgframework.core.common.service.CommonService;
import org.jeecgframework.web.system.pojo.base.TSNoticeAuthorityUser;
public abstract interface NoticeAuthorityUserServiceI extends CommonService
{
public abstract <T> void delete(T paramT);
public abstract <T> Serializable save(T paramT);
public abstract <T> void saveOrUpdate(T paramT);
public abstract boolean doAddSql(TSNoticeAuthorityUser paramTSNoticeAuthorityUser);
public abstract boolean doUpdateSql(TSNoticeAuthorityUser paramTSNoticeAuthorityUser);
public abstract boolean doDelSql(TSNoticeAuthorityUser paramTSNoticeAuthorityUser);
public abstract boolean checkAuthorityUser(String paramString1, String paramString2);
}
/* Location: D:\用户目录\我的文档\Tencent Files\863916185\FileRecv\nx.zip
* Qualified Name: ROOT.WEB-INF.classes.org.jeecgframework.web.system.service.NoticeAuthorityUserServiceI
* JD-Core Version: 0.6.2
*/ | [
"liufeng45gh@163.com"
] | liufeng45gh@163.com |
b4a17025c477f2097bcae5c856dd80aa363d362b | e1570c4f236aaf7a68aacec2b4222ecc80d2632a | /Quote/src/com/codingz/quote/controller/CheckAvailability.java | 681c1a68f6a4acf9da61eea9b464a38cb0d3ca4d | [] | no_license | Bencup/QuoteSocial-project | cfd658b414ea81319c8f03db4e8d9d4555338fa8 | d405ef3e498523f18f8037913a9d1d2a1f4f03ea | refs/heads/master | 2021-01-21T21:39:47.385029 | 2018-08-23T07:54:42 | 2018-08-23T07:54:42 | 47,304,533 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,652 | java | package com.codingz.quote.controller;
import java.io.*;
import java.sql.*;
import javax.servlet.ServletException;
import javax.servlet.http.*;
public class CheckAvailability extends HttpServlet {
private static final long serialVersionUID = -734503860925086969L;
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
String connectionURL = "jdbc:mysql://localhost:3306/hi";
Connection connection = null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection(connectionURL, "root", "");
String uname = request.getParameter("uname");
PreparedStatement ps = connection.prepareStatement("select username from user where username=?");
ps.setString(1,uname);
ResultSet rs = ps.executeQuery();
if (!rs.next()) {
out.println("<font color=green><b>"+uname+"</b> is avaliable");
}
else{
out.println("<font color=red><b>"+"***"+uname+"</b> is already in use</font>");
}
out.println();
} catch (Exception ex) {
out.println("Error ->" + ex.getMessage());
} finally {
out.close();
}
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
}
| [
"12comsci@gmail.com"
] | 12comsci@gmail.com |
8d4cf1dffeb792aa46c33440410177e05c0020ca | 999aaad9d581f269c91bcb0a95a3e3dd4a17f559 | /common/src/main/java/com/indielist/domain/ApplicationSetting.java | 68130d78fe2f146f26d99dbf42a2e512b7ddf6c5 | [
"MIT"
] | permissive | cointify/indielist | 1f9f8d822fef09940abf742e0d4f22dbb69cafdc | d25efedf1045e9642033d793c2a02c44cfad9a09 | refs/heads/master | 2021-01-19T18:10:59.984106 | 2015-01-29T20:22:47 | 2015-01-29T20:22:47 | 29,069,923 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 148 | java | package com.indielist.domain;
import javax.persistence.Entity;
/**
* @author jsingh on 15-01-10.
*/
@Entity
public class ApplicationSetting {
}
| [
"xxxv.coin@gmail.com"
] | xxxv.coin@gmail.com |
33c2a235796d58d140b164ee9b3a8340a4c899de | bd9452d401e8bf90d6ba8747fc3caebd30e66e25 | /NPO/src/Business/Organization/OrganizationDirectory.java | 58ff51155987ae9801e8276df0e475eb7ebf91e6 | [] | no_license | sreevatsan1991/sreevatsan | d8bef2c93dd44995df6fd53b753759e377ab4c1f | 65283d9b8d00b5fe4fb16f5993a2148a27a6f3fc | refs/heads/master | 2021-05-01T22:43:12.818207 | 2016-12-30T01:25:01 | 2016-12-30T01:25:01 | 77,550,225 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,150 | 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 Business.Organization;
import Business.Organization.BloodDonation.BloodDistributorOrganization;
import Business.Organization.BloodDonation.BloodLabOrganization;
import Business.Organization.BloodDonation.BloodRecipientOrganization;
import Business.Organization.BloodDonation.BloodDonorOrganization;
import Business.Organization.BloodDonation.BloodDonationAdminOrganization;
import Business.Organization.FoodDonation.FoodAssistOrganization;
import Business.Organization.FoodDonation.FoodDistributorOrganization;
import Business.Organization.FoodDonation.FoodDonationAdminOrganization;
import Business.Organization.FoodDonation.FoodDonorOrganization;
import Business.Organization.FoodDonation.FoodRecipientOrganization;
import Business.Organization.FundDonation.FundAssistOrganization;
import Business.Organization.FundDonation.FundDistributorOrganization;
import Business.Organization.FundDonation.FundDonationAdminOrganization;
import Business.Organization.FundDonation.FundDonorOrganization;
import Business.Organization.FundDonation.FundRecipientOrganization;
import Business.Organization.Organization.Type;
import Business.Organization.VoluntaryDonation.VoluntaryAssistOrganization;
import Business.Organization.VoluntaryDonation.VoluntaryDistributorOrganization;
import Business.Organization.VoluntaryDonation.VoluntaryDonationAdminOrganization;
import Business.Organization.VoluntaryDonation.VoluntaryDonorOrganization;
import Business.Organization.VoluntaryDonation.VoluntaryRecipientOrganization;
import java.util.ArrayList;
/**
*
* @author Malick
*/
public class OrganizationDirectory {
private ArrayList<Organization> organizationList;
public OrganizationDirectory() {
organizationList = new ArrayList();
}
public ArrayList<Organization> getOrganizationList() {
return organizationList;
}
public Organization createOrganization(Type type){
Organization organization = null;
if (type.getValue().equals(Type.BloodDonationAdmin.getValue())){
organization = new BloodDonationAdminOrganization();
organizationList.add(organization);
}
else if (type.getValue().equals(Type.FoodDonationAdmin.getValue())){
organization = new FoodDonationAdminOrganization();
organizationList.add(organization);
}
else if (type.getValue().equals(Type.FundDonationAdmin.getValue())){
organization = new FundDonationAdminOrganization();
organizationList.add(organization);
}
else if (type.getValue().equals(Type.VoluntaryDonationAdmin.getValue())){
organization = new VoluntaryDonationAdminOrganization();
organizationList.add(organization);
}
else if (type.getValue().equals(Type.BloodDonor.getValue())){
organization = new BloodDonorOrganization();
organizationList.add(organization);
}
else if (type.getValue().equals(Type.BloodRecipient.getValue())){
organization = new BloodRecipientOrganization();
organizationList.add(organization);
}
else if (type.getValue().equals(Type.BloodLab.getValue())){
organization = new BloodLabOrganization();
organizationList.add(organization);
}
else if (type.getValue().equals(Type.BloodDistributor.getValue())){
organization = new BloodDistributorOrganization();
organizationList.add(organization);
}
else if (type.getValue().equals(Type.FoodDonor.getValue())){
organization = new FoodDonorOrganization();
organizationList.add(organization);
}
else if (type.getValue().equals(Type.FoodRecipient.getValue())){
organization = new FoodRecipientOrganization();
organizationList.add(organization);
}
else if (type.getValue().equals(Type.FoodDistributor.getValue())){
organization = new FoodDistributorOrganization();
organizationList.add(organization);
}
else if (type.getValue().equals(Type.FoodAssist.getValue())){
organization = new FoodAssistOrganization();
organizationList.add(organization);
}
else if (type.getValue().equals(Type.VoluntaryDonor.getValue())){
organization = new VoluntaryDonorOrganization();
organizationList.add(organization);
}
else if (type.getValue().equals(Type.VoluntaryRecipient.getValue())){
organization = new VoluntaryRecipientOrganization();
organizationList.add(organization);
}
else if (type.getValue().equals(Type.VoluntaryDistributor.getValue())){
organization = new VoluntaryDistributorOrganization();
organizationList.add(organization);
}
else if (type.getValue().equals(Type.VoluntaryAssist.getValue())){
organization = new VoluntaryAssistOrganization();
organizationList.add(organization);
}
else if (type.getValue().equals(Type.FundDonor.getValue())){
organization = new FundDonorOrganization();
organizationList.add(organization);
}
else if (type.getValue().equals(Type.FundRecipient.getValue())){
organization = new FundRecipientOrganization();
organizationList.add(organization);
}
else if (type.getValue().equals(Type.FundDistributor.getValue())){
organization = new FundDistributorOrganization();
organizationList.add(organization);
}
else if (type.getValue().equals(Type.FundAssist.getValue())){
organization = new FundAssistOrganization();
organizationList.add(organization);
}
return organization;
}
public void removeOrganization(Organization o){
organizationList.remove(o);
}
} | [
"athinarayanan.s@husky.neu.edu"
] | athinarayanan.s@husky.neu.edu |
f7b8542d281b247511393a3540e308b4b9936c18 | beb903bcbce21195107987e602658f138f2ea48b | /vanstone-centralserver-common/src/main/java/com/vanstone/centralserver/common/weixin/wrap/msg/CCMsg4Text.java | c37fb8e63db8aa0e540425d22233cad22105dc17 | [] | no_license | soltex/centralserver | 6a47db0e5c9fe33d3ed89cb31c7b2869fffebb35 | 12a1c8b7638a54551b7a8ae19f7cc767ce21cdd2 | refs/heads/master | 2016-09-05T23:56:41.543299 | 2016-01-11T09:47:16 | 2016-01-11T09:47:16 | 26,172,552 | 1 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,095 | java | /**
*
*/
package com.vanstone.centralserver.common.weixin.wrap.msg;
import java.util.LinkedHashMap;
import java.util.Map;
import com.vanstone.centralserver.common.JsonUtil;
/**
* 发送文本消息
{
"touser":"OPENID",
"msgtype":"text",
"text":
{
"content":"Hello World"
}
}
* @author shipeng
*
*/
public class CCMsg4Text extends AbstractCustomerServiceMsg {
/**文本消息内容*/
private String content;
public CCMsg4Text() {
this.setMsgtype(AbstractMsg.COMMON_TYPE_TEXT);
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
@Override
public String toJson() {
Map<String, Object> map = new LinkedHashMap<String, Object>();
map.put("touser", this.getTouser());
map.put("msgtype", this.getMsgtype());
Map<String, Object> textMap = new LinkedHashMap<String, Object>();
textMap.put("content", this.getContent());
map.put("text", textMap);
return JsonUtil.object2PrettyString(map,false);
}
}
| [
"shipengpipi@126.com"
] | shipengpipi@126.com |
c45d55429f0e1869e2e306fc56efe106464238cc | 1663ed65c85005fd812af5128a0f279fcf1922a9 | /ex_4_Graphs/ex_1_UndirectedGraphs/Graph.java | 4f8d8513584e53407ef037bda0b1b4094c3d67c8 | [] | no_license | weiyang00/Algorithms_4th | ed8ed5c10d302bbd205f6e0e997b515e741651e4 | d88a57446d9f22d4bcfc56ce7299b1a2dc342c7e | refs/heads/master | 2020-03-12T09:14:36.403138 | 2019-01-08T07:29:44 | 2019-01-08T07:29:44 | 130,548,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,611 | java | package ex_4_Graphs.ex_1_UndirectedGraphs;
import StdLib.In;
import ex_1_Fundamentals.ex_3_BagQueueStack.Bag;
import ex_1_Fundamentals.ex_3_BagQueueStack.Stack;
public class Graph {
private final int V; // 顶点数目
private int E; // 边的数目
private Bag<Integer>[] adj; // 邻接表
public Graph(int V) {
this.V = V;
this.E = 0;
adj = (Bag<Integer>[]) new Bag[V]; // 创建邻接表
for (int v = 0; v < V; v++) { // 将所有链表初始化为空
adj[v] = new Bag<Integer>();
}
}
public Graph(In in) {
this(in.readInt()); // 读取V并将图初始化
int E = in.readInt();//读取E
for (int i = 0; i < E; i++) {
int v = in.readInt(); //读取一个顶点
int w = in.readInt(); //读取另一个顶点
addEdge(v, w); // 添加一条连接它们的边
}
}
/**
* Exercise 4.1.3
*
* @param G
*/
public Graph(Graph G) {
this(G.V());
E = G.E();
for (int v = 0; v < G.V(); v++) {
Stack<Integer> reverse = new Stack<>();
for (int w : G.adj[v]) {
reverse.push(w);
}
for (int w : reverse) {
adj[v].add(w);
}
}
}
public int V() {
return V;
}
public int E() {
return E;
}
public void addEdge(int v, int w) {
adj[v].add(w); // 将W添加到v的链表中
adj[w].add(v); // 将v添加到w的链表中
E++;
}
public Iterable<Integer> adj(int v) {
return adj[v];
}
@Override
public String toString() {
String s = V + " vertices, " + E + " edges\n";
for (int v = 0; v < V; v++) {
s += v + ": ";
for (int w : this.adj(v)) {
s += w + " ";
}
s += "\n";
}
return s;
}
}
| [
"179709020@qq.com"
] | 179709020@qq.com |
6c1b37a6dccf9d09ee7e06689d4ed369b0b55663 | afa0c7bc52e2ced150e24a1dc373279fe7fbf776 | /src/main/java/servlets/Manager/TicketsManager.java | 30d6a3a7ad1c322ca7cba038cf4bfdd57fb5560b | [] | no_license | kolya19951/tickets_last | 7724c2f3af5a6377395930f61d1a381a6e402150 | 6c78ff7442132255c72a2a989660d6898a8006f1 | refs/heads/master | 2021-01-10T08:32:20.864105 | 2015-10-02T10:35:56 | 2015-10-02T10:35:56 | 43,547,397 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,767 | java | package servlets.Manager;
import Model.Entity.Ticket;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
@WebServlet("/tickets_manager")
public class TicketsManager extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
HttpSession session = request.getSession();
if(session.isNew()) {
session.setAttribute("lang", "gb");
}
String lang = (String) session.getAttribute("lang");
long seat_id = Long.parseLong(request.getParameter("seat_id"));
String client = request.getParameter("client");
Ticket ticket = new Ticket(seat_id, client);
long id = ticket.record();
response.setContentType("text/xml");
response.setHeader("Cache-Control", "no-cache");
response.getWriter().write("<tickets><ticket><id>" + id + "</id></ticket></tickets>");
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
HttpSession session = request.getSession();
if(session.isNew()) {
session.setAttribute("lang", "gb");
}
String lang = (String) session.getAttribute("lang");
RequestDispatcher dispatcher = request.getRequestDispatcher("/admin_tickets.jsp");
dispatcher.forward(request, response);
}
} | [
"kolya.simotyuk@gmail.com"
] | kolya.simotyuk@gmail.com |
a427cdb587d9ed5c3e715b36c6d782ed41a4db14 | 20ab305409120f5b5441023f754435b4d1938748 | /src/main/java/org/blockartistry/mod/ThermalRecycling/machines/entity/NoInventoryComponent.java | 3a4d23e69a9cfb80c5aa81b548f5ce6414466381 | [
"MIT"
] | permissive | WeCodingNow/ThermalRecycling | 360b7f152324856856bde414500686e7eb2f206c | c0b2cbe652e580aa4d563540350b96ba6e27d5dc | refs/heads/master | 2021-05-28T15:24:28.814563 | 2015-05-15T22:46:48 | 2015-05-15T22:46:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,178 | java | /*
* This file is part of ThermalRecycling, licensed under the MIT License (MIT).
*
* Copyright (c) OreCruncher
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.blockartistry.mod.ThermalRecycling.machines.entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
public class NoInventoryComponent implements IMachineInventory {
@Override
public int getSizeInventory() {
return 0;
}
@Override
public ItemStack getStackInSlot(int p_70301_1_) {
return null;
}
@Override
public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) {
return null;
}
@Override
public ItemStack getStackInSlotOnClosing(int p_70304_1_) {
return null;
}
@Override
public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {
}
@Override
public String getInventoryName() {
return "container.empty";
}
@Override
public boolean hasCustomInventoryName() {
return false;
}
@Override
public int getInventoryStackLimit() {
return 0;
}
@Override
public void markDirty() {
}
@Override
public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
return false;
}
@Override
public void openInventory() {
}
@Override
public void closeInventory() {
}
@Override
public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
return false;
}
@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
return null;
}
@Override
public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_,
int p_102007_3_) {
return false;
}
@Override
public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_,
int p_102008_3_) {
return false;
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
}
@Override
public boolean addStackToOutput(ItemStack stack) {
return false;
}
@Override
public void dropInventory(World world, int x, int y, int z) {
}
@Override
public boolean isStackAlreadyInSlot(int slot, ItemStack stack) {
return false;
}
}
| [
"tedjkaiser@gmail.com"
] | tedjkaiser@gmail.com |
8b01a27b8b5b77216a62d3dea8d79f21b910b9eb | 4b8a8bd3ef169d7a9c7d6d4a7737e43fa3fec9d2 | /plugins/cordova-plugin-code-push/src/android/CodePushPackageManager.java | 51dd928cb98f3bf6f13ecfbbac8e8727992e5dc2 | [
"MIT"
] | permissive | chihu-team/chihu2 | 6069c641693dc7f3034f15b97c5dd93b242b7c5d | cc5f1cd83cadc0f300091d404268d9fea585f934 | refs/heads/master | 2021-06-01T18:28:36.929237 | 2020-07-11T09:16:45 | 2020-07-11T09:16:45 | 95,654,980 | 74 | 30 | MIT | 2020-07-11T09:17:26 | 2017-06-28T09:57:14 | JavaScript | UTF-8 | Java | false | false | 4,540 | java | package com.microsoft.cordova;
import android.content.Context;
import org.json.JSONException;
import java.io.File;
import java.io.IOException;
/**
* Handles update package management.
*/
public class CodePushPackageManager {
public static final String CODEPUSH_OLD_PACKAGE_PATH = "/codepush/oldPackage.json";
public static final String CODEPUSH_CURRENT_PACKAGE_PATH = "/codepush/currentPackage.json";
private Context context;
private CodePushPreferences codePushPreferences;
public CodePushPackageManager(Context context, CodePushPreferences codePushPreferences) {
this.context = context;
this.codePushPreferences = codePushPreferences;
}
public void revertToPreviousVersion() {
/* delete the failed update package */
CodePushPackageMetadata failedUpdateMetadata = this.getCurrentPackageMetadata();
if (failedUpdateMetadata != null) {
if (failedUpdateMetadata.packageHash != null) {
this.codePushPreferences.saveFailedUpdate(failedUpdateMetadata.packageHash);
}
File failedUpdateDir = new File(this.context.getFilesDir() + failedUpdateMetadata.localPath);
if (failedUpdateDir.exists()) {
Utilities.deleteEntryRecursively(failedUpdateDir);
}
}
/* replace the current file with the old one */
File currentFile = new File(this.context.getFilesDir() + CodePushPackageManager.CODEPUSH_CURRENT_PACKAGE_PATH);
File oldFile = new File(this.context.getFilesDir() + CodePushPackageManager.CODEPUSH_OLD_PACKAGE_PATH);
if (currentFile.exists()) {
currentFile.delete();
}
if (oldFile.exists()) {
oldFile.renameTo(currentFile);
}
}
public void cleanDeployments() {
File file = new File(this.context.getFilesDir() + "/codepush");
if (file.exists()) {
Utilities.deleteEntryRecursively(file);
}
}
public void cleanOldPackage() throws IOException, JSONException {
CodePushPackageMetadata oldPackageMetadata = this.getOldPackageMetadata();
if (oldPackageMetadata != null) {
File file = new File(this.context.getFilesDir() + oldPackageMetadata.localPath);
if (file.exists()) {
Utilities.deleteEntryRecursively(file);
}
}
}
public CodePushPackageMetadata getOldPackageMetadata() {
String currentPackageFilePath = this.context.getFilesDir() + CODEPUSH_OLD_PACKAGE_PATH;
return CodePushPackageMetadata.getPackageMetadata(currentPackageFilePath);
}
public CodePushPackageMetadata getCurrentPackageMetadata() {
String currentPackageFilePath = this.context.getFilesDir() + CODEPUSH_CURRENT_PACKAGE_PATH;
return CodePushPackageMetadata.getPackageMetadata(currentPackageFilePath);
}
public String getCachedBinaryHash() {
return this.codePushPreferences.getCachedBinaryHash();
}
public void saveBinaryHash(String binaryHash) {
this.codePushPreferences.saveBinaryHash(binaryHash);
}
public boolean isFailedUpdate(String packageHash) {
return this.codePushPreferences.isFailedUpdate(packageHash);
}
public void clearFailedUpdates() {
this.codePushPreferences.clearFailedUpdates();
}
public void savePendingInstall(InstallOptions options) {
this.codePushPreferences.savePendingInstall(options);
}
public InstallOptions getPendingInstall() {
return this.codePushPreferences.getPendingInstall();
}
public void clearPendingInstall() {
this.codePushPreferences.clearPendingInstall();
}
public void markInstallNeedsConfirmation() {
this.codePushPreferences.markInstallNeedsConfirmation();
}
public void clearInstallNeedsConfirmation() {
this.codePushPreferences.clearInstallNeedsConfirmation();
}
public boolean installNeedsConfirmation() {
return this.codePushPreferences.installNeedsConfirmation();
}
public boolean isBinaryFirstRun() {
return this.codePushPreferences.isBinaryFirstRun();
}
public void clearBinaryFirstRunFlag() {
this.codePushPreferences.clearBinaryFirstRunFlag();
}
public void saveBinaryFirstRunFlag() {
this.codePushPreferences.saveBinaryFirstRunFlag();
}
}
| [
"k849996781@vip.qq.com"
] | k849996781@vip.qq.com |
8f22ba321667b59af395471a8d4a5fbfbb519b4e | 138f2431905129c2aa3fa9e6e4351895293bab43 | /carm/src/com/sickkids/caliper/service/ImageFileRenamePolicy.java | 5701e88a86c10406f58eeddb79b0f486e511deaf | [] | no_license | kwonyounggu/Dev | 6c195098ef066843f6aa706eb8f0122b995bbf1c | 96c3fa31adb32b62e7bacd9ee9f1a41ec7e30199 | refs/heads/master | 2021-05-04T11:58:18.628367 | 2017-12-04T19:01:12 | 2017-12-04T19:01:12 | 29,596,967 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,035 | java | package com.sickkids.caliper.service;
import java.io.File;
import com.oreilly.servlet.multipart.FileRenamePolicy;
import com.sickkids.caliper.common.Utils;
public class ImageFileRenamePolicy implements FileRenamePolicy
{
//implement the rename(File f) method to satisfy the
// FileRenamePolicy interface contract
public File rename(File f)
{
// Get the parent directory path as in h:/home/user or /home/user
String parentDir = f.getParent();
// Get filename without its path location, such as 'index.txt'
String fname = f.getName();
// Get the extension if the file has one
String fileExt = "";
int i = -1;
if ((i = fname.indexOf(".")) != -1)
{
fileExt = fname.substring(i);
fname = fname.substring(0, i);
}
// add the timestamp
fname = fname + "_"+Utils.getDateTimeForFileName();
// piece together the filename
fname = parentDir + System.getProperty("file.separator") + fname + fileExt;
File temp = new File(fname);
return temp;
}
}
| [
"kwon.younggu@gmail.com"
] | kwon.younggu@gmail.com |
31b57bdf8f9609ac82b96bf6e1e047168979a936 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_df0387fd856380bbefdbc708d0258dfae2c971a0/TableScrollPane/2_df0387fd856380bbefdbc708d0258dfae2c971a0_TableScrollPane_s.java | 7f730da9c5d54ca3e6195aa543f8677832f3b437 | [] | 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,856 | java | package net.karlmartens.ui.widget;
import java.awt.Color;
import java.awt.Point;
import java.awt.event.KeyListener;
import java.awt.event.MouseListener;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.TreeSet;
import javax.swing.JTable;
import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;
import net.karlmartens.platform.util.UiThreadUtil;
import com.jidesoft.grid.AutoFilterTableHeader;
import com.jidesoft.grid.CachedTableModel;
import com.jidesoft.grid.CellStyleTable;
import com.jidesoft.grid.ColumnStripeTableStyleProvider;
import com.jidesoft.grid.FilterableTableModel;
import com.jidesoft.grid.JideTable;
import com.jidesoft.grid.MultiTableModel;
import com.jidesoft.grid.SortableTable;
import com.jidesoft.grid.SortableTableModel;
import com.jidesoft.grid.TableModelWrapperUtils;
import com.jidesoft.grid.TableSelectionListener;
final class TableScrollPane extends com.jidesoft.grid.TableScrollPane {
private static final long serialVersionUID = 1L;
TableScrollPane(MultiTableModel model) {
super(new FilterableTableModel(new CachedTableModel(model)), true);
UiThreadUtil.assertSwingThread();
setAutoscrolls(true);
setAllowMultiSelectionInDifferentTable(true);
setCellSelectionEnabled(true);
setColumnSelectionAllowed(true);
setRowSelectionAllowed(true);
setHorizontalScrollBarCoversWholeWidth(true);
setVerticalScrollBarCoversWholeHeight(true);
setKeepCornerVisible(false);
setNonContiguousCellSelectionAllowed(true);
setWheelScrollingEnabled(true);
initHeaderTableOptions();
initSeriesTableOptions();
}
public void addTableSelectionListener(TableSelectionListener listener) {
((JideTable)getMainTable()).getTableSelectionModel().addTableSelectionListener(listener);
((JideTable)getRowHeaderTable()).getTableSelectionModel().addTableSelectionListener(listener);
}
public void removeTableSelectionListener(
TableSelectionListener listener) {
((JideTable)getMainTable()).getTableSelectionModel().removeTableSelectionListener(listener);
((JideTable)getRowHeaderTable()).getTableSelectionModel().removeTableSelectionListener(listener);
}
public void addKeyListener(KeyListener listener) {
getMainTable().addKeyListener(listener);
getRowHeaderTable().addKeyListener(listener);
}
public void removeKeyListener(KeyListener listener) {
getMainTable().removeKeyListener(listener);
getRowHeaderTable().removeKeyListener(listener);
}
public void addMouseListener(MouseListener listener) {
getMainTable().addMouseListener(listener);
getRowHeaderTable().addMouseListener(listener);
}
public void removeMouseListener(MouseListener listener) {
getMainTable().removeMouseListener(listener);
getRowHeaderTable().removeMouseListener(listener);
}
public int[] getSelectionIndices() {
UiThreadUtil.assertSwingThread();
// retrieve selected indices
final int mCount = getMainTable().getSelectedRowCount();
final int hCount = getRowHeaderTable().getSelectedRowCount();
final int[] selected = new int[mCount + hCount];
System.arraycopy(getMainTable().getSelectedRows(), 0, selected, 0, mCount);
System.arraycopy(getRowHeaderTable().getSelectedRows(), 0, selected, mCount, hCount);
Arrays.sort(selected);
// Convert to model index and remove duplicates
final TreeSet<Integer> actualSelected = new TreeSet<Integer>();
for (int index : selected) {
actualSelected.add(TableModelWrapperUtils.getActualRowAt(getModel(), index));
}
// Convert to int array
final Integer[] is = actualSelected.toArray(new Integer[] {});
final int[] result = new int[is.length];
for (int i=0; i<is.length; i++) {
result[i] = is[i].intValue();
}
return result;
}
public int getRowAt(int x, int y) {
final Point mPoint = new Point(x - getMainTable().getX(), y - getMainTable().getY());
int rowIndex = getMainTable().rowAtPoint(mPoint);
if (rowIndex < 0) {
final Point hPoint = new Point(x - getRowHeaderTable().getX(), y - getRowHeaderTable().getY());
rowIndex = getRowHeaderTable().rowAtPoint(hPoint);
}
if (rowIndex < 0)
return -1;
return TableModelWrapperUtils.getActualRowAt(getModel(), rowIndex);
}
public void scrollToRow(int index) {
final int rowIndex = TableModelWrapperUtils.getRowAt(getModel(), index);
if (rowIndex < 0)
return;
scrollToRow(rowIndex);
}
@Override
protected JTable createTable(TableModel model, boolean sortable) {
final SortableTableModel sortableModel = (SortableTableModel) model;
sortableModel.setAutoResort(false);
final SortableTable table = new SortableTable(model);
Enumeration<TableColumn> columns = table.getColumnModel().getColumns();
while (columns.hasMoreElements())
columns.nextElement().setMaxWidth(600);
final AutoFilterTableHeader header = new AutoFilterTableHeader(table);
header.setAutoFilterEnabled(true);
header.setShowFilterName(false);
header.setShowFilterNameAsToolTip(true);
header.setShowFilterIcon(true);
table.setTableHeader(header);
return table;
}
private void initHeaderTableOptions() {
final CellStyleTable headerTable = (CellStyleTable) getRowHeaderTable();
headerTable.setTableStyleProvider(new ColumnStripeTableStyleProvider(
new Color[] { new Color(253, 253, 244) }));
}
private void initSeriesTableOptions() {
final JideTable mainTable = (JideTable) getMainTable();
mainTable.getTableHeader().setReorderingAllowed(false);
mainTable.setClickCountToStart(2);
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
eea392312cd870d9f6e0eb955f3dd45cb4ca641e | cebbb3eb50323299a9fc0bcb007dfc8ec4c33493 | /sidi-app-ptof/src/main/java/it/istruzione/ptof/beans/PlessiDTO.java | 517ee43b5a13513aa59ffa6c284574398c4109fd | [] | no_license | sronca/sic | 386641239d827f7c1ae055b4a4f45933c6fd5daf | 2d725e1c4d7e9b38956386450ebcbc767cf2f7c9 | refs/heads/master | 2021-05-04T21:50:41.739660 | 2018-02-02T16:08:10 | 2018-02-02T16:08:10 | 119,974,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,437 | java | package it.istruzione.ptof.beans;
public class PlessiDTO extends BaseDTO {
/**
* codiceMecUtente, comune , denominazione sono usati nei req rf19 in poi
*/
private String codiceMecUtente, comune , denominazione , email, indirizzo, key, telefono , plessoScuola;
public String getDenominazione() {
return denominazione;
}
public void setDenominazione(String denominazione) {
this.denominazione = denominazione;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getIndirizzo() {
return indirizzo;
}
public void setIndirizzo(String indirizzo) {
this.indirizzo = indirizzo;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getTelefono() {
return telefono;
}
public void setTelefono(String telefono) {
this.telefono = telefono;
}
public String getPlessoScuola() {
return plessoScuola;
}
public void setPlessoScuola(String plessoScuola) {
this.plessoScuola = plessoScuola;
}
public String getCodiceMecUtente() {
return codiceMecUtente;
}
public void setCodiceMecUtente(String codiceMecUtente) {
this.codiceMecUtente = codiceMecUtente;
}
public String getComune() {
return comune;
}
public void setComune(String comune) {
this.comune = comune;
}
}
| [
"s.ronca@prismaprogetti.it"
] | s.ronca@prismaprogetti.it |
cadba4fb99949040c5de7a7c445ea6b2cbeb511c | 2243096cd2d8c1c2d0b28013bb4dc93b4c42e80a | /src/main/java/org/example/servlets/domain/User.java | e316c58240c0a7f9d81a29673421f9e309aad999 | [] | no_license | Error4ik/SimpleJavaWebApp | 5b9d5bf02971d570b87704b55e4cf8c750184132 | c142006b3cd53a72d57d7cac4acadd887f4e248f | refs/heads/master | 2023-08-14T22:26:18.712487 | 2021-10-01T10:21:03 | 2021-10-01T10:21:03 | 410,667,152 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,063 | java | package org.example.servlets.domain;
import java.util.Date;
import java.util.Objects;
import java.util.UUID;
public class User {
private UUID id;
private String name;
private String surname;
private int age;
private String email;
private Date date;
public User() {
}
public User(UUID id, String name, String surname, int age, String email) {
this.id = id;
this.name = name;
this.surname = surname;
this.age = age;
this.email = email;
this.date = new Date();
}
public void setId(UUID id) {
this.id = id;
}
public UUID getId() {
return id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
User user = (User) o;
return age == user.age
&& Objects.equals(id, user.id)
&& Objects.equals(name, user.name)
&& Objects.equals(surname, user.surname)
&& Objects.equals(email, user.email);
}
@Override
public int hashCode() {
return Objects.hash(id, name, surname, age, email);
}
@Override
public String toString() {
return String.format(
"User {id = %s, name = %s, surname = %s, age = %s, email = %s}", id, name, surname, age, email);
}
}
| [
"Aleksei_Voronin1@epam.com"
] | Aleksei_Voronin1@epam.com |
8d817764ed89bdbbbece6e2ecb208b89eaee341d | 3caee08cfa9a213303b0f0c8849585fe45377840 | /mr_user_feather_last/target/base-maven-plugin-pack/files/src/main/java/my/group/mr_user_feather_last/MyReducer.java | 0e746a26d9abcaa9f56f3ebcb8fc6d08ecfced11 | [] | no_license | francliu/hadoop | fc3f4c6db20fd4c670eea31350c6bd2e1aebe5ce | 11e48dc701e074ed7cad8d982175839b8e4ecbf8 | refs/heads/master | 2021-01-10T11:46:41.814833 | 2016-01-25T08:31:43 | 2016-01-25T08:31:43 | 50,336,931 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,291 | java | package my.group.mr_user_feather_last;
import com.aliyun.odps.data.Record;
import com.aliyun.odps.mapred.Reducer;
import com.aliyun.odps.mapred.Reducer.TaskContext;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.Iterator;
/**
* Reducer模板。请用真实逻辑替换模板内容
*/
public class MyReducer implements Reducer {
private Record result;
public void setup(TaskContext context) throws IOException {
result = context.createOutputRecord();
}
public static double classify(double num){
double value = 1;
if(num<5)value = 1;
else if(num<=10)value = 2;
else if(num<=50)value = 3;
else if(num<=100)value = 4;
else value = 5;
return value;
}
public void reduce(Record key, Iterator<Record> values, TaskContext context) throws IOException {
double sum_tranfer_num = 0,sum_comment_num=0,sum_praise_num=0;
double max_tranfer_num = 0,max_comment_num=0,max_praise_num=0;
double min_tranfer_num = 50,min_comment_num=50,min_praise_num=50;
double max_interactive_level =0,min_interactive_level=0,mean_interactive_level=0;
long cnt=1;
double sum_level = 0;
double level_mean =0;
while (values.hasNext()) {
Record val = values.next();
double a,b,c;
a = val.getDouble(0);b = val.getDouble(1);c = val.getDouble(2);
sum_tranfer_num += a;
sum_comment_num += b;
sum_praise_num += c;
double level_max = val.getDouble(12);
double level_min = val.getDouble(13);
level_mean = val.getDouble(14);
sum_level +=level_mean;
if(max_tranfer_num<a)max_tranfer_num=a;
if(max_comment_num<b)max_comment_num=b;
if(max_praise_num<c)max_praise_num=c;
if(min_tranfer_num>a)min_tranfer_num=a;
if(min_comment_num>b)min_comment_num=b;
if(min_praise_num>c)min_praise_num=c;
if(min_interactive_level>level_min)min_interactive_level=level_min;
if(max_interactive_level<level_max)max_interactive_level=level_max;
cnt++;
}
double means_transfer_num = classify(sum_tranfer_num/cnt);
double means_comment_num = classify(sum_comment_num/cnt);
double means_praise_num =classify (sum_praise_num/cnt);
mean_interactive_level = classify(sum_level/cnt);
DecimalFormat f = new DecimalFormat("#.000");
result.set(0,key.get(0).toString());
result.set(1, max_tranfer_num);
result.set(2, min_tranfer_num);
result.set(3,means_transfer_num);
result.set(4, sum_tranfer_num);
result.set(5, max_comment_num);
result.set(6, min_comment_num);
result.set(7, means_comment_num);
result.set(8, sum_comment_num);
result.set(9, max_praise_num);
result.set(10, min_praise_num);
result.set(11,means_praise_num);
result.set(12, sum_praise_num);
result.set(13,max_interactive_level);
result.set(14,min_interactive_level);
result.set(15,mean_interactive_level);
result.set(16,level_mean);
context.write(result);
}
public void cleanup(TaskContext arg0) throws IOException {
}
}
| [
"liujianfei@ict.ac.cn"
] | liujianfei@ict.ac.cn |
9ac6acda6f4bcd8122500f76607667d292b5979a | f05f7c7d757402f476228bef4d73b9588c652c03 | /src/main/java/com/wujiuye/ip2location/table/elasticsearch/ElasticsearchLocationTable.java | 8c62181904f1bb8ff8f0948ffe8ae2cf9e99a9a1 | [
"Apache-2.0"
] | permissive | jwcjlu/ip2location-java-high-qps | f843af6aaa14efabc3264e6a12972f41f1591ae4 | a349c56d30ac4fd206538fb99ce7c633c54847e7 | refs/heads/master | 2023-03-17T22:50:51.154882 | 2020-02-27T07:18:38 | 2020-02-27T07:18:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,347 | java | /**
* Copyright [2019-2020] [wujiuye]
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wujiuye.ip2location.table.elasticsearch;
import com.wujiuye.ip2location.correct.RecordCorrect;
import com.wujiuye.ip2location.correct.elasticsearch.ElasticsearchIPLocationRecordCorrect;
import com.wujiuye.ip2location.entity.IP2LocationEntity;
import com.wujiuye.ip2location.exception.Ip2LocationDatabaseException;
import com.wujiuye.ip2location.extend.SearchExtendService;
import com.wujiuye.ip2location.extend.elasticsearch.ElasticsearchSearchExtendService;
import com.wujiuye.ip2location.operation.elasticsearch.IP2LocationElasticsearchOperation;
import com.wujiuye.ip2location.proxy.elasticsearch.IP2LocationElasticsearchOperationProxy;
import com.wujiuye.ip2location.table.LocationTable;
import java.util.List;
/**
* @author wujiuye
* @version 1.0 on 2019/10/28 {描述:
* <p>
* }
*/
public class ElasticsearchLocationTable implements LocationTable {
private IP2LocationElasticsearchOperation elasticsearchOperation;
private ElasticsearchSearchExtendService searchExtendService;
public ElasticsearchLocationTable(IP2LocationElasticsearchOperation elasticsearchOperation) {
this.elasticsearchOperation = elasticsearchOperation;
this.searchExtendService = new ElasticsearchSearchExtendService(elasticsearchOperation);
}
@Override
public void dropTable() {
throw new IllegalAccessError("not suppor drop table by es!");
}
/**
* 在需要更新ip库的时候,完成数据的批量写入
*
* @param records 批量记录
* @return
* @throws Ip2LocationDatabaseException
*/
@Override
public int insertBatch(List<IP2LocationEntity> records) throws Ip2LocationDatabaseException {
return elasticsearchOperation.batchPut(null, null, records);
}
/**
* 完成查询路基,根据ip转为number后的值查询出对应记录
*
* @param ipNumer ip转为整形后的数值
* @return
* @throws Ip2LocationDatabaseException
*/
@Override
public IP2LocationEntity selectOne(Long ipNumer) throws Ip2LocationDatabaseException {
return elasticsearchOperation.filterOne(null, null, ipNumer);
}
@Override
public SearchExtendService getSearchExtendService() {
return this.searchExtendService;
}
/**
* 获取数据修正器
*
* @return
*/
@Override
public RecordCorrect getRecordCorrect() {
if (elasticsearchOperation instanceof IP2LocationElasticsearchOperationProxy) {
return new ElasticsearchIPLocationRecordCorrect(((IP2LocationElasticsearchOperationProxy) elasticsearchOperation).getProxy());
}
return new ElasticsearchIPLocationRecordCorrect(elasticsearchOperation);
}
}
| [
"jiuye.wu@ichestnuts.com"
] | jiuye.wu@ichestnuts.com |
0280d49873a2d41f527a00ad11c8e540c2a28b02 | 4fae46cd30e0e3c42562d61dc2efd3837df55b13 | /yesway-pay-order-service/src/main/java/cn/yesway/pay/order/dao/OrdersDao.java | c3323c1c8b68dd9aa4a2bfd1a67072b325dc6eec | [] | no_license | Pancratius/fzt-pay | 2b4937e185038909b6d6fde1a9b168a92ce91738 | 7414615604f9f29860e97c5c07dfd148e009257a | refs/heads/master | 2021-10-21T14:01:31.799564 | 2019-03-04T10:28:32 | 2019-03-04T10:28:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 620 | java | package cn.yesway.pay.order.dao;
import java.util.List;
import cn.yesway.pay.order.entity.Orders;
public interface OrdersDao {
int deleteByPrimaryKey(String orderid);
int insert(Orders record);
int insertSelective(Orders record);
List<Orders> selectByPrimaryKey(String outTradeNo);
int updateByPrimaryKeySelective(Orders record);
int updateByPrimaryKey(Orders record);
Orders orderQuery(String outTradeNo);
int closeOrder(String outTradeNo);
int queryOrdersCount(String outTradeNo);
int updateStatusByCode(Orders record);
} | [
"fengzt@sqbj.com"
] | fengzt@sqbj.com |
5954abbdb6e6b8eb04c0367c1959305aa15f48bc | 92072d9b83ff679cae10c8ccf626e574a67fb616 | /CrowdAssist/app/src/main/java/th/ac/kmitl/it/crowdassist/model/GeneralRequestModel.java | b7e97e8155364c8adc07a9ff20b5799e6c5f7c6c | [] | no_license | dsjin/Crowd-Assist | 84fa0b7532beb0357ad6b98ef02eb5df41aa4c93 | 0028cededed67fde8372c64bc75d9e0fc06766a4 | refs/heads/master | 2020-03-22T23:04:16.963534 | 2019-01-08T10:56:23 | 2019-01-08T10:56:23 | 140,787,543 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 713 | java | package th.ac.kmitl.it.crowdassist.model;
import java.io.Serializable;
public class GeneralRequestModel extends Request implements Serializable {
private String type;
private String description;
private String title;
public GeneralRequestModel() {
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
| [
"57070053@kmitl.ac.th"
] | 57070053@kmitl.ac.th |
693d84426955fc07b3883125ed762ff56be9dd0c | 671ab0d5b12674ab5bae2661815a25a83ade54d1 | /medo-payment/medo-payment/medo-payment-service/src/main/java/medo/payment/messaging/PaymentSucceed.java | 9e231418935cc13828932e1f211dda2116ce0ede | [] | no_license | Beaver-Company/medo | 255150433cc52352816166fd7bd03c074b4ace33 | 440ab708c7b90a646480882bf905c682798f4c11 | refs/heads/master | 2023-02-15T03:21:17.937700 | 2020-11-17T23:59:55 | 2020-11-17T23:59:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 142 | java | package medo.payment.messaging;
import medo.payment.domain.PaymentDomainEvent;
public class PaymentSucceed implements PaymentDomainEvent {}
| [
"chubalh@live.com"
] | chubalh@live.com |
5724feda0580cec1117e0e30786266fd7b44247c | 879fc1926b0318887bfd6dfd6edec55fdbccbee8 | /kodilla-advanced-tests/src/main/java/com/kodilla/parametrized_tests/homework/GamblingMachine.java | e7be318e01d488dce42262cf6e66bc41af3d9e1e | [] | no_license | KHManiszewska/Kodilla_tester | 3dc1a6355fa37b316502a78e56f45e7b7bf80215 | c0dc9737c61f8cb2f849c9cde760a99e7635a743 | refs/heads/master | 2023-04-23T06:38:51.358841 | 2021-04-27T18:41:14 | 2021-04-27T18:41:14 | 327,604,976 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,264 | java | package com.kodilla.parametrized_tests.homework;
import java.util.HashSet;
import java.util.Random;
import java.util.Set;
public class GamblingMachine {
public static int howManyWins(Set<Integer> givenNumbers, Set<Integer> drawNumbers) throws InvalidNumbersException {
// validateNumbers(userNumbers);
// Set<Integer> computerNumbers = generateComputerNumbers();
int count = 0;
for (Integer number : givenNumbers) {
if (drawNumbers.contains(number)) {
count++;
}
}
return count;
}
public static boolean validateNumbers(Set<Integer> numbers) throws InvalidNumbersException {
if (numbers.size() != 6) {
throw new InvalidNumbersException("Wrong numbers provided");
}
if (numbers.stream().anyMatch(number -> number < 1 || number > 49)) {
throw new InvalidNumbersException("Wrong numbers provided");
}
return true;
}
public static Set<Integer> generateComputerNumbers() {
Set<Integer> numbers = new HashSet<>();
Random generator = new Random();
while(numbers.size() < 6) {
numbers.add(generator.nextInt(49) + 1);
}
return numbers;
}
}
| [
"k.maniszewska@icloud.com"
] | k.maniszewska@icloud.com |
ac65f0f0c4a4498e12b72b86d89e1e46ff3e5380 | 7ced18434550a75e94cfda633da9f4503df84cc1 | /spring-cofig-exampe/config-server/src/main/java/com/cloud/configserver/config/WebSecurityConfig.java | 3ea670552d41ff66127f1448eacd4b8070e43cb2 | [] | no_license | pradeep531988/springboot-microservices-concepts | 1807ae06fc576529c152ed684fd2f990e67d7d2a | 09c8c83d670e8d989358f76b31d7f50ff9a3c557 | refs/heads/master | 2020-04-17T23:09:01.973405 | 2019-01-26T18:09:56 | 2019-01-26T18:09:56 | 167,023,474 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,149 | java | package com.cloud.configserver.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@EnableWebSecurity
@Configuration
public class WebSecurityConfig extends WebSecurityConfigurerAdapter{
/*
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.anyRequest().authenticated()
// .and()
//.formLogin()
.and()
.httpBasic();
http
.authorizeRequests()
.anyRequest().authenticated()
.and()
.httpBasic();
}*/
@Override
protected void configure(HttpSecurity http) throws Exception{
// http.authorizeRequests().antMatchers("/").permitAll();
// http.csrf().disable().authorizeRequests().anyRequest().permitAll();
http.authorizeRequests().anyRequest().permitAll();
}
}
| [
"pradeep.inbox@rediffmail.com"
] | pradeep.inbox@rediffmail.com |
fa76b3464ded9cdb3c6499e75cae6b12f0907468 | 766bdaa31a13a046a3db29cb2f12144b54c71204 | /src/main/java/com/example/shoppinglist/service/impl/ProductServiceImpl.java | 8c368fc4be106bc0915997902b42eae1c6c8cd06 | [] | no_license | SimonaShaleva/shoppinglist | 7cbba3bb489d516932287679d13aed106bbf5484 | 14366d75a408722a50cac02c6d2a18b04d621c10 | refs/heads/master | 2023-03-12T22:27:52.332951 | 2021-02-24T08:10:25 | 2021-02-24T08:10:25 | 339,995,688 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,399 | java | package com.example.shoppinglist.service.impl;
import com.example.shoppinglist.model.entity.CategoryNameEnum;
import com.example.shoppinglist.model.entity.Product;
import com.example.shoppinglist.model.service.ProductServiceModel;
import com.example.shoppinglist.model.view.ProductViewModel;
import com.example.shoppinglist.repository.ProductRepository;
import com.example.shoppinglist.service.CategoryService;
import com.example.shoppinglist.service.ProductService;
import org.modelmapper.ModelMapper;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class ProductServiceImpl implements ProductService {
private final ProductRepository productRepository;
private final CategoryService categoryService;
private final ModelMapper modelMapper;
public ProductServiceImpl(ProductRepository productRepository, CategoryService categoryService, ModelMapper modelMapper) {
this.productRepository = productRepository;
this.categoryService = categoryService;
this.modelMapper = modelMapper;
}
@Override
public void addProduct(ProductServiceModel productServiceModel) {
Product product = modelMapper.map(productServiceModel, Product.class);
product.setCategory(categoryService.findByCategoryNameEnum(productServiceModel.getCategory()));
productRepository.save(product);
}
@Override
public BigDecimal findTotalPrice() {
if (productRepository.findTotalSum() == null) {
return BigDecimal.ZERO;
}
return productRepository.findTotalSum();
}
@Override
public List<ProductViewModel> findByCategoryName(CategoryNameEnum category) {
List<ProductServiceModel> list = productRepository
.findByCategory_CategoryNameEnum(category)
.stream().map(product -> modelMapper.map(product, ProductServiceModel.class))
.collect(Collectors.toList());
return list.stream()
.map(productServiceModel -> modelMapper.map(productServiceModel, ProductViewModel.class))
.collect(Collectors.toList());
}
@Override
public void buyProductById(Long id) {
productRepository.deleteById(id);
}
@Override
public void buyAll() {
productRepository.deleteAll();
}
}
| [
"SimonaShaleva@github.com"
] | SimonaShaleva@github.com |
0ba958d2e0c3678477a8263f2d4e322af7857a62 | e8278d96c3fb2b8d1f3a24c69221b7dc42cf528b | /test.amil.api/src/main/java/com/test/amil/api/business/GameLogBusinessImpl.java | 63a7a93a5800c8b46cf5180d270c81cb8aa9cfa8 | [] | no_license | tucs-nash/pre-dojo | fb3b2bfdec94c87b9c710d4444eabda0651470df | b6bddd7a3aff72cbbbf5e7fb3613bbb54ed1b7c6 | refs/heads/master | 2020-12-25T11:16:26.262109 | 2016-07-01T16:49:59 | 2016-07-01T16:49:59 | 62,338,758 | 0 | 0 | null | 2016-06-30T19:59:21 | 2016-06-30T19:59:20 | null | ISO-8859-1 | Java | false | false | 5,459 | java | package com.test.amil.api.business;
import java.io.FileNotFoundException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Properties;
import com.test.amil.api.business.interfaces.GameLogBusiness;
import com.test.amil.api.core.model.Match;
import com.test.amil.api.core.model.PlayerResult;
import com.test.amil.api.core.utils.AppUtils;
/**
* Lendo log do jogo e aplicando as regras para geração do Ranking
* @author tbdea
*/
public class GameLogBusinessImpl implements GameLogBusiness {
private String matchStartPropBegin;
private String matchStartPropEnd;
private String matchClosePropBegin;
private String matchClosePropEnd;
private String killedKeyword;
private String weaponKeyword;
private String worldKeyword;
private String byWorldKeyword;
public GameLogBusinessImpl(Properties props) {
this.matchStartPropBegin = props.getProperty("amil.log.match.start.begin");
this.matchStartPropEnd = props.getProperty("amil.log.match.start.end");
this.matchClosePropBegin = props.getProperty("amil.log.match.close.begin");
this.matchClosePropEnd = props.getProperty("amil.log.match.close.end");
this.killedKeyword = props.getProperty("amil.log.killed.keyword");
this.weaponKeyword = props.getProperty("amil.log.weapon.keyword");
this.worldKeyword = props.getProperty("amil.log.world.keyword");
this.byWorldKeyword = props.getProperty("amil.log.by.keyword");
}
/**
* Lendo e gerando resultado por linha do arquivo
* @param filePath
* @return
* @throws ParseException
* @throws FileNotFoundException
*/
public void processLogRow(String logLine, Match match) throws ParseException, FileNotFoundException {
String[] splitTimeAction = logLine.split("-");
Date time = AppUtils.convertStringToDateTime(AppUtils.applyingValueHandling(splitTimeAction[0]));
String action = AppUtils.applyingValueHandling(splitTimeAction[1]);
if (action.startsWith(matchStartPropBegin) && action.endsWith(matchStartPropEnd)) {
String code = action.replace(matchStartPropBegin, "").replace(matchStartPropEnd, "");
match.setMatchStart(time);
match.setMatchCode(AppUtils.applyingValueHandling(code));
} else if (action.startsWith(matchClosePropBegin) && action.endsWith(matchClosePropEnd)) {
match.setMatchEnd(time);
} else {
readingAction(match, action, time);
}
}
/**
* Verificar o vencedor
* @param player
*/
public void checkWinnerAndAwards(Match match) {
PlayerResult winner = null;
for(PlayerResult player : match.getPlayers().values()) {
checkPlayerSequenceWithoutDying(player);
player.setAwardOneMinute(checkOneMinuteAward(new ArrayList<Date>(player.getKills())));
if (winner == null || winner.getOrderParam() < player.getOrderParam()) {
winner = player;
}
}
winner.setAwardDeathless(winner.getDeaths().size() == 0);
match.setWinner(winner);
}
/**
* Verifica sequência de mortes sem morrer do jogador
* @param player
*/
private void checkPlayerSequenceWithoutDying(PlayerResult player) {
if(player.getBiggestSequenceWithoutDying() < player.getSequenceWithoutDying()) {
player.setBiggestSequenceWithoutDying(player.getSequenceWithoutDying());
player.setSequenceWithoutDying(0);
}
}
/**
* Verificar o prêmio de um minuto
* @param kills
* @return
*/
private boolean checkOneMinuteAward(List<Date> kills) {
if(kills.size() < 5) {
return false;
}
Date start = kills.get(0);
Date fifthKill = kills.get(4);
long diff = fifthKill.getTime() - start.getTime();
if(diff > 60000) {
kills.remove(0);
return checkOneMinuteAward(kills);
}
return true;
}
/**
* Analisando a ação para resgatar os resultados
* @param players
* @param utils
* @param action
* @param time
* @param killedKeyword
* @param worldKeyword
* @param byWorldKeyword
* @param weaponKeyword
*/
private void readingAction(Match match, String action, Date time) {
String[] splitAction = action.split(killedKeyword);
String killerNick = AppUtils.applyingValueHandling(splitAction[0]);
String deathInformation = AppUtils.applyingValueHandling(splitAction[1]);
String deadNick = null;
if (killerNick.equals(worldKeyword)) {
deadNick = AppUtils.applyingValueHandling(deathInformation.substring(0, deathInformation.indexOf(byWorldKeyword)));
} else {
String[] splitDeathInformation = deathInformation.split(weaponKeyword);
PlayerResult killer = getPlayerResultByNickname(match, killerNick);
killer.getKills().add(time);
killer.addSequenceWithoutDying();
killer.addWeapons(AppUtils.applyingValueHandling(splitDeathInformation[1]));
deadNick = AppUtils.applyingValueHandling(splitDeathInformation[0]);
}
PlayerResult dead = getPlayerResultByNickname(match, deadNick);
dead.getDeaths().add(time);
checkPlayerSequenceWithoutDying(dead);
}
/**
* Resgata o jogador pelo seu nickname
* @param players
* @param nickname
* @return
*/
private PlayerResult getPlayerResultByNickname(Match match, String nickname) {
PlayerResult player = match.getPlayers().get(nickname);
if(player == null) {
player = new PlayerResult(nickname);
match.addPlayer(nickname, player);
}
return player;
}
}
| [
"tbdea@DESKTOP-LIMACFJ"
] | tbdea@DESKTOP-LIMACFJ |
80d68796740c7ff2bb7befb03c192c9385093a6b | 8601cdbd6180ee3e75d2fbeda7e36beb8853ff5a | /src/main/java/me/xdark/vrtvm/interpreter/NopHandler.java | e2e1b49d2cdd1df9e88932543a7951381efb79c3 | [] | no_license | RavageZombies/vrtvm | 3f883b7cf074937d417639be057f2d786fe7a6c3 | 133a304200a106a5ef392ce02cc94ed2d3babe6e | refs/heads/master | 2022-11-16T04:36:05.116545 | 2020-07-06T16:32:35 | 2020-07-06T16:32:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 306 | java | package me.xdark.vrtvm.interpreter;
import me.xdark.vrtvm.VMContext;
import org.objectweb.asm.tree.AbstractInsnNode;
public final class NopHandler implements InstructionInterpreter<AbstractInsnNode> {
@Override
public void process(VMContext ctx, AbstractInsnNode insn) {
// no-op
}
}
| [
"19853368+xxDark@users.noreply.github.com"
] | 19853368+xxDark@users.noreply.github.com |
44cb8631e3cb3bec01138b9a1b6ab2e5904151d1 | 9bd561fa82ee048327be195f9b592c58a2ca1daf | /app/src/main/java/com/example/mobiledevproject/fragment/MyFragment.java | 48a6377e24f0799dd5545156cfe91aa034f2359b | [] | no_license | alexsivan97/MobileDevProject | 4fa2a93afbe0463899e739cb55c417330f06855b | 2cb7b06ad0ba8c9b1fea5362383a93b20ae922d5 | refs/heads/master | 2020-09-30T13:25:41.025806 | 2019-12-17T00:35:18 | 2019-12-17T00:35:18 | 227,295,794 | 0 | 0 | null | 2019-12-11T06:46:23 | 2019-12-11T06:46:22 | null | UTF-8 | Java | false | false | 1,410 | java | package com.example.mobiledevproject.fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import com.example.mobiledevproject.R;
import com.example.mobiledevproject.model.User;
import butterknife.BindView;
import butterknife.ButterKnife;
public class MyFragment extends Fragment {
User user;
@BindView(R.id.tv_my_username)
TextView tvMyUsername;
@BindView(R.id.tv_my_userdescription)
TextView tvMyUserdescription;
public MyFragment() {
// Required empty public constructor
}
public static MyFragment newInstance(User user) {
MyFragment fragment = new MyFragment();
fragment.user = user;
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_my, container, false);
ButterKnife.bind(this,view);
setUserInfo();
return view;
}
private void setUserInfo(){
tvMyUsername.setText(this.user.getUserName());
}
}
| [
"fuyu0824@pku.edu.cn"
] | fuyu0824@pku.edu.cn |
abb7900184da62f17ae53e6b4adcc0fc8d2fc88e | e1b2ae4a27d68e5a6665f1d8964ef636bc111caf | /app/src/main/java/es/ujaen/labtelema/data/UserData.java | c3e6af68c99412bdf8e0f7f99146def9d676c821 | [] | no_license | mclj0004/uja_ssmm1819_practica01_g04 | e136030f2d297207e95563f8269d78dc5873b291 | 37c449e687f83af85c79c5a985ff0ee33cf8d93f | refs/heads/master | 2020-03-31T12:30:10.111211 | 2018-11-02T10:20:55 | 2018-11-02T10:20:55 | 150,238,476 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,358 | java | package es.ujaen.labtelema.data;
public class UserData {
private String userName;
private String password;
private String domain;
private short port;
/**
* Constructor por defecto
*/
public UserData(){
userName="user";
password="123456";
domain="labtelema.ujaen.es";
port=80;
}
/**
* Constructor con parámetros
* @param userName Nombre de usuario
* @param password clave
* @param domain dominio o ip del servidor
* @param port puerto del servidor
*/
public UserData(String userName, String password, String domain, short port) {
this.userName = userName;
this.password = password;
this.domain = domain;
this.port = port;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getDomain() {
return domain;
}
public void setDomain(String domain) {
this.domain = domain;
}
public short getPort() {
return port;
}
public void setPort(short port) {
this.port = port;
}
}
| [
"mclj0004@red.ujaen.es"
] | mclj0004@red.ujaen.es |
18adf8f042571237df18bac8f9b8eef3245288a7 | a732527c12a83522daebba3f824d6a1b7879b35e | /src/test/java/study/datajpa/repository/MemberJpaRepositoryTest.java | b6fae5a9312b0d0d1f93bf95130b108b7617622c | [] | no_license | Hoyaspark/Spring-Study-Optimization-JPA | a65fe08177fda25f50b179516d2c63715fbd17ad | 6e2185094ad4a2106fd2403c4d0f7b4ac971730e | refs/heads/master | 2023-08-18T13:58:52.462114 | 2021-10-15T14:47:45 | 2021-10-15T14:47:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,723 | java | package study.datajpa.repository;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.transaction.annotation.Transactional;
import study.datajpa.entity.Member;
import java.util.Arrays;
import java.util.List;
import static org.assertj.core.api.Assertions.*;
@SpringBootTest
@Transactional
class MemberJpaRepositoryTest {
@Autowired
MemberJpaRepository memberJpaRepository;
@Test
public void findByUsernameAndAgeGreaterThen() {
Member memberA = Member.createMemberEntity()
.username("memberA")
.age(20)
.build();
Member memberB = Member.createMemberEntity()
.username("memberA")
.age(30)
.build();
memberJpaRepository.saveAll(Arrays.asList(memberA, memberB));
List<Member> result = memberJpaRepository.findByUsernameAndAgeGreaterThen("memberA", 25);
assertThat(result.get(0)).isSameAs(memberB);
}
@Test
public void namedQueryTest() {
Member memberA = Member.createMemberEntity()
.username("memberA")
.age(20)
.build();
Member memberB = Member.createMemberEntity()
.username("memberA")
.age(30)
.build();
memberJpaRepository.saveAll(Arrays.asList(memberA, memberB));
// List<Member> result = memberJpaRepository.findByUsername("memberA");
// assertThat(result.size()).isEqualTo(2);
}
@Test
void findByPageTest() throws Exception {
//given
Member memberA = Member.createMemberEntity()
.username("memberA")
.age(10)
.build();
Member memberB = Member.createMemberEntity()
.username("memberB")
.age(10)
.build();
Member memberC = Member.createMemberEntity()
.username("memberC")
.age(10)
.build();
Member memberD = Member.createMemberEntity()
.username("memberD")
.age(10)
.build();
memberJpaRepository.saveAll(Arrays.asList(memberA,memberB,memberC,memberD));
int age = 10;
int offset = 0;
int limit = 3;
//when
List<Member> result = memberJpaRepository.findByPage(age, offset, limit);
Long totalCount = memberJpaRepository.totalCount(age);
//then
assertThat(result.size()).isEqualTo(limit);
assertThat(totalCount).isEqualTo(4);
}
@Test
void bulkUpdateTest() throws Exception {
//given
Member memberA = Member.createMemberEntity()
.username("memberA")
.age(10)
.build();
Member memberB = Member.createMemberEntity()
.username("memberB")
.age(19)
.build();
Member memberC = Member.createMemberEntity()
.username("memberC")
.age(20)
.build();
Member memberD = Member.createMemberEntity()
.username("memberD")
.age(21)
.build();
Member memberE = Member.createMemberEntity()
.username("memberE")
.age(40)
.build();
memberJpaRepository.saveAll(Arrays.asList(memberA, memberB, memberC, memberD, memberE));
//when
int result = memberJpaRepository.bulkAgePlus(20);
//then
assertThat(result).isEqualTo(3);
}
} | [
"hodubackspace@gmail.com"
] | hodubackspace@gmail.com |
8423ae55204de6ce4a3c5ca3e56fa75868ea5cc7 | dd2a6b67939e4a20d9ab1f2390772a3c23c0e4b8 | /RemoteCore-spigot/src/main/java/com/github/tacticaldevmc/remotecore/commands/main/sub/user/UserRankSubCommand.java | 3e0b917e92ffd722ef48cb1fff758ae8df4b81ff | [] | no_license | TacticalDevMC/RemoteCore | 7ec833512313b3c2f81ae66b16fd399786324ce0 | 14bfed086c7aabff7e74df36284f96d608b34dbe | refs/heads/main | 2022-12-29T10:19:51.307817 | 2020-10-20T15:22:46 | 2020-10-20T15:22:46 | 293,339,152 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,697 | java | package com.github.tacticaldevmc.remotecore.commands.main.sub.user;
import com.github.tacticaldevmc.remotecore.RemoteCoreSpigot;
import com.github.tacticaldevmc.remotecore.messages.enums.RemoteMessages;
import com.github.tacticaldevmc.remotecore.player.RemoteOfflinePlayer;
import com.github.tacticaldevmc.remotecore.player.RemotePlayer;
import com.github.tacticaldevmc.remotecore.player.ranks.RankData;
import com.github.tacticaldevmc.remotecore.settings.interfaces.ISettings;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
/**
* @AUTHOR: TacticalDev
* Copyright © 2020, Joran Huibers, All rights reserved.
*/
public class UserRankSubCommand {
String prefix = RemoteCoreSpigot.getInstance().getRemotePrefix();
public boolean run(ISettings settings, RemotePlayer user, String[] args) {
String name = args[3];
RankData rank = new RankData(name);
if (!rank.exists()) {
user.sendMessage(RemoteMessages.RANK_NOT_EXISTS, name);
return false;
}
Player target = Bukkit.getPlayer(args[1]);
RemotePlayer base = new RemotePlayer(target);
if (target == null) {
OfflinePlayer targetOffline = Bukkit.getOfflinePlayer(args[1]);
RemoteOfflinePlayer baseOffline = new RemoteOfflinePlayer(targetOffline);
baseOffline.setRank(rank.getName().join());
user.sendMessage(RemoteMessages.MAIN_USER_RANK_SET, targetOffline.getName());
return false;
}
base.setRank(rank.getName().join());
user.sendMessage(RemoteMessages.MAIN_USER_RANK_SET, target.getName());
return false;
}
}
| [
"joran.huibers@gmail.com"
] | joran.huibers@gmail.com |
0d2986630e6d4dd08cd30a7298280e0035b68481 | cf84bf23935428796f6d3a4139f20f92bab7d9a6 | /Java/Java-Spring/DojoSurvey/src/main/java/com/ghazal/dojo/ServletInitializer.java | a34c598a16010f36bc7e53ea97a05954191d17cf | [] | no_license | Ghazalsal/Java-Stack | b45580a7ff64250dbffda32d4d4467ca44c5c065 | 5554d0fe5e653b35d6930657f555e92a691da7c2 | refs/heads/master | 2023-06-11T19:54:47.184205 | 2021-07-03T07:27:41 | 2021-07-03T07:27:41 | 375,278,836 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 409 | java | package com.ghazal.dojo;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(DojoSurveyApplication.class);
}
}
| [
"g_antar_n@hotmail.com"
] | g_antar_n@hotmail.com |
40c296ec07c1eea2bd21964cebab29b26e1cd3f2 | 0c50c4bb815d277369a41b010f5c50a17bbd1373 | /Board/app/src/main/java/de/cisha/android/board/video/model/FuzzyEloRange.java | ec1bfcb3307305f2cd10427a249415571e778612 | [] | no_license | korkies22/ReporteMoviles | 645b830b018c1eabbd5b6c9b1ab281ea65ff4045 | e708d4aa313477b644b0485c14682611d6086229 | refs/heads/master | 2022-03-04T14:18:12.406700 | 2022-02-17T03:11:01 | 2022-02-17T03:11:01 | 157,728,106 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 465 | java | //
// Decompiled by Procyon v0.5.30
//
package de.cisha.android.board.video.model;
import android.content.res.Resources;
public class FuzzyEloRange implements EloRangeRepresentation
{
private int _stringResId;
public FuzzyEloRange(final int stringResId) {
this._stringResId = stringResId;
}
@Override
public String getRangeString(final Resources resources) {
return resources.getString(this._stringResId);
}
}
| [
"cm.sarmiento10@uniandes.edu.co"
] | cm.sarmiento10@uniandes.edu.co |
d4f01e8ffea58052159bc2c7688b375960cc2708 | b97a2385059daed51b13b097721bebb438313ecd | /app/src/main/java/com/storyshu/storyshu/widget/dialog/LocationDialog.java | f1d4eb60214ec040cd73c4a5a0095c47a85142bc | [] | no_license | Luomingbear/StoryShu | 4e181379ed1956a713dbaa315020380d10c5ea9e | 0dd5cb47290b87e3c22caabdaaa9c115855538c9 | refs/heads/master | 2021-01-11T10:06:07.888777 | 2017-12-06T06:45:25 | 2017-12-06T06:45:25 | 77,517,737 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,850 | java | package com.storyshu.storyshu.widget.dialog;
import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.Display;
import android.view.WindowManager;
import com.amap.api.services.core.PoiItem;
import com.storyshu.storyshu.R;
import com.storyshu.storyshu.adapter.poi.PoiAdapter;
import com.storyshu.storyshu.utils.SysUtils;
import java.util.List;
/**
* 选择位置的弹窗
* Created by bear on 2017/3/29.
*/
public class LocationDialog extends IBaseDialog {
private static final String TAG = "LocationDialog";
private RecyclerView recyclerView;
private OnLocationChooseListener onLocationChooseListener;
/**
* 设置数据并且显示
*
* @param poiList
*/
public void setDataAndShow(final List<PoiItem> poiList, OnLocationChooseListener locationChooseListener) {
this.onLocationChooseListener = locationChooseListener;
PoiAdapter poiAdapter = new PoiAdapter(getContext(), poiList);
Log.i(TAG, "setDataAndShow: 位置是!!!!!+" + poiList);
poiAdapter.setPoiItemClickListener(new PoiAdapter.OnPoiItemClickListener() {
@Override
public void onClick(int position) {
if (onLocationChooseListener != null)
onLocationChooseListener.onClick(poiList.get(position));
dismiss();
}
});
recyclerView.setAdapter(poiAdapter);
show();
}
public void setOnLocationChooseListener(OnLocationChooseListener onLocationChooseListener) {
this.onLocationChooseListener = onLocationChooseListener;
}
/**
* 位置选择的回调
*/
public interface OnLocationChooseListener {
void onClick(PoiItem poiItem);
}
public LocationDialog(Context context) {
super(context);
}
public LocationDialog(Context context, int themeResId) {
super(context, themeResId);
}
public LocationDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
super(context, cancelable, cancelListener);
}
@Override
public int getLayoutRes() {
return R.layout.choose_poi_layout;
}
@Override
public void initView() {
recyclerView = (RecyclerView) findViewById(R.id.choose_location_list);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
}
@Override
public void Create() {
Display display = SysUtils.getScreenDisplay(getContext());
WindowManager.LayoutParams params = getWindow().getAttributes();
params.width = (int) (display.getWidth() * 0.85f);
params.height = (int) (display.getHeight() * 0.85f);
getWindow().setAttributes(params);
}
}
| [
"luomingbear@163.com"
] | luomingbear@163.com |
9dc774c142efc56f205f57ff55b76ec244d91dc4 | b54ac9066b9066447026899ed7745a79ee7d92e2 | /chapter03/MyPageSliding/app/src/main/java/com/example/nhnent/mypagesliding/MainActivity.java | 6d223a819c65939ec6084a25a33e0d40a7f20589 | [] | no_license | saintpablo94/myandroid | 35c191848e9091529fe3d4733971e3d0af9dc0fc | 7d02ece2fd60b7527a60e43a1d413c5f64bc8005 | refs/heads/master | 2020-12-31T07:55:41.701821 | 2016-01-28T14:02:55 | 2016-01-28T14:02:55 | 49,318,348 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,857 | java | package com.example.nhnent.mypagesliding;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.LinearLayout;
public class MainActivity extends AppCompatActivity {
boolean isPageOpen = false;
LinearLayout sildingPanel;
Button button;
Animation translateLeftAnim;
Animation translateRightAnim;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
translateLeftAnim = AnimationUtils.loadAnimation(this, R.anim.translate_left);
translateLeftAnim.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
button.setText("닫기");
isPageOpen = true;
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
translateRightAnim = AnimationUtils.loadAnimation(this, R.anim.translate_right);
translateRightAnim.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
sildingPanel.setVisibility(View.INVISIBLE);
button.setText("열기");
isPageOpen = false;
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
sildingPanel = (LinearLayout) findViewById(R.id.slidingPanel);
button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(isPageOpen){
sildingPanel.startAnimation(translateRightAnim);
}else {
sildingPanel.setVisibility(View.VISIBLE);
sildingPanel.startAnimation(translateLeftAnim);
}
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"saint.pablo94@gmail.com"
] | saint.pablo94@gmail.com |
99fe7fde4a5e189fa9cddcae9ed9122836af3bd9 | 8274209cf30e1ee9229efc88bc0e352cdcbb797e | /SisaAplication/app/src/main/java/sisa/ufrpe/br/sisaandroid/PostAsyncTask.java | ca75436a5df7a7bfe7da8e116901f4afd647a22b | [] | no_license | r4ddek/androidSISA | c5af85ecf48e23ec78026c05b4f1fb26f0832a5f | 35d66392857822657d842fa3bf252fb5a6cbd659 | refs/heads/master | 2021-01-22T23:33:24.777792 | 2017-03-21T02:13:45 | 2017-03-21T02:13:45 | 85,648,409 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,789 | java | package sisa.ufrpe.br.sisaandroid;
import android.os.AsyncTask;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
public class PostAsyncTask extends AsyncTask<JSONObject, Void, String> {
String url;
JSONObject jsonObject;
OkHttpClient client;
MediaType JSON;
String postResponse;
public ResultadoAsync delegate = null;
public PostAsyncTask(String url, JSONObject jSON) {
this.url = url;
this.jsonObject = jSON;
}
private String post(String url, String json) throws IOException {
RequestBody body = RequestBody.create(JSON, json);
Request request = new Request.Builder()
.url(url)
.post(body)
.build();
Response response = client.newCall(request).execute();
return response.body().string();
}
@Override
protected String doInBackground(JSONObject... params) {
client = new OkHttpClient();
JSON = MediaType.parse("application/json; charset=utf-8");
try {
postResponse = post(url, jsonObject.toString());
Log.d("DEVOLVEU: ", postResponse);
}catch (Exception e){
e.printStackTrace();
}
return postResponse;
}
@Override
protected void onPostExecute(String postResponse) {
System.out.println(postResponse);
delegate.processFinish(postResponse);
}
} | [
"leonardofs@snu.ac.kr"
] | leonardofs@snu.ac.kr |
a30c0c4f3d99cbc909eb1a0ed6be6970e1b918e8 | 4eca12201d2628c2d0e5ccc007cb212531f4ba0d | /src/test/java/com/aaluni/spring5recipeapp/converters/IngredientToIngredientCommandTest.java | 747a1bcba13a08f63f0210d4b138a96977159947 | [] | no_license | arindamaluni/spring5-recipe-app-aaluni | f6785013a47d6b026abfeb86d263e3eed601a011 | 204851a5b14ff8ca2258cd4002a6a0e83f1133b0 | refs/heads/master | 2022-06-02T18:24:42.259248 | 2020-05-08T17:57:52 | 2020-05-08T17:57:52 | 256,959,599 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,827 | java | package com.aaluni.spring5recipeapp.converters;
import org.junit.Before;
import org.junit.Test;
import com.aaluni.spring5recipeapp.commands.IngredientCommand;
import com.aaluni.spring5recipeapp.domain.Ingredient;
import com.aaluni.spring5recipeapp.domain.Recipe;
import com.aaluni.spring5recipeapp.domain.UnitOfMeasure;
import java.math.BigDecimal;
import static org.junit.Assert.*;
/**
* Created by jt on 6/21/17.
*/
public class IngredientToIngredientCommandTest {
public static final Recipe RECIPE = new Recipe();
public static final BigDecimal AMOUNT = new BigDecimal("1");
public static final String DESCRIPTION = "Cheeseburger";
public static final Long UOM_ID = new Long(2L);
public static final Long ID_VALUE = new Long(1L);
IngredientToIngredientCommand converter;
@Before
public void setUp() throws Exception {
converter = new IngredientToIngredientCommand(new UnitOfMeasureToUnitOfMeasureCommand());
}
@Test
public void testNullConvert() throws Exception {
assertNull(converter.convert(null));
}
@Test
public void testEmptyObject() throws Exception {
assertNotNull(converter.convert(new Ingredient()));
}
@Test
public void testConvertNullUOM() throws Exception {
//given
Ingredient ingredient = new Ingredient();
ingredient.setId(ID_VALUE);
ingredient.setRecipe(RECIPE);
ingredient.setAmount(AMOUNT);
ingredient.setDescription(DESCRIPTION);
ingredient.setUom(null);
//when
IngredientCommand ingredientCommand = converter.convert(ingredient);
//then
assertNull(ingredientCommand.getUom());
assertEquals(ID_VALUE, ingredientCommand.getId());
// assertEquals(RECIPE, ingredientCommand.get);
assertEquals(AMOUNT, ingredientCommand.getAmount());
assertEquals(DESCRIPTION, ingredientCommand.getDescription());
}
@Test
public void testConvertWithUom() throws Exception {
//given
Ingredient ingredient = new Ingredient();
ingredient.setId(ID_VALUE);
ingredient.setRecipe(RECIPE);
ingredient.setAmount(AMOUNT);
ingredient.setDescription(DESCRIPTION);
UnitOfMeasure uom = new UnitOfMeasure();
uom.setId(UOM_ID);
ingredient.setUom(uom);
//when
IngredientCommand ingredientCommand = converter.convert(ingredient);
//then
assertEquals(ID_VALUE, ingredientCommand.getId());
assertNotNull(ingredientCommand.getUom());
assertEquals(UOM_ID, ingredientCommand.getUom().getId());
// assertEquals(RECIPE, ingredientCommand.get);
assertEquals(AMOUNT, ingredientCommand.getAmount());
assertEquals(DESCRIPTION, ingredientCommand.getDescription());
}
} | [
"aaluni@gmail.com"
] | aaluni@gmail.com |
d2334dfbc8c735599a12596cd97b5e3820053ca0 | bb051a1bca7a17fe5c611cd5bcc84758e3ef196d | /src/androidTest/java/ru/gelin/android/sendtosd/fs/FsRootsTest.java | 9939178dd0ab99457560c694f21488734d549dd0 | [] | no_license | jaimet/send-to-sd | 901b5ab581bebbc72208e396e54e9438c92eeac1 | d8ae088677beb26c147bb8631ca314b03793b1c0 | refs/heads/master | 2023-07-12T03:34:04.191226 | 2020-12-31T07:17:15 | 2020-12-31T07:17:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 592 | java | package ru.gelin.android.sendtosd.fs;
import android.support.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.List;
import static org.junit.Assert.assertTrue;
@RunWith(AndroidJUnit4.class)
@SmallTest
public class FsRootsTest {
@Test
public void testGetRoots() {
FsRoots fsRoots = new FsRoots(true);
List<File> roots = fsRoots.getPaths();
System.out.println("Roots:" + roots);
assertTrue(roots.contains(new File("/")));
}
}
| [
"dnelubin@gmail.com"
] | dnelubin@gmail.com |
99280928eacfa0c008eba16b238116ba96eaacf3 | 1ec7b27045f0001b7ac8018f1922659288ed184e | /2 - Java - Desenvolvimento Básico/6 - Datas/ExercicioDateFormat.java | 4ec546c0f0b145f350cd96fc6733a7978046d254 | [] | no_license | GustavoReisss/Fullstack-Developer-Santander-Bootcamp | 8ddb97ba276b5764e7cb6b3dfe15d803763b807c | eb81308560e28c7ff54e5c79c58dc85a8ede2452 | refs/heads/main | 2023-06-18T19:17:35.157793 | 2021-07-22T17:43:35 | 2021-07-22T17:43:35 | 388,544,110 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 435 | java | import java.text.SimpleDateFormat;
import java.util.Date;
//Converta a Data atual no formato DD/MM/YYYY HH:MM:SS:MMM
public class ExercicioDateFormat {
public static void main(String[] args) {
Date momento = new Date();
SimpleDateFormat formatoDesejado = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss:SSS");
String dataAtual = formatoDesejado.format(momento);
System.out.println(dataAtual);
}
}
| [
"gustavo.reis20000@gmail.com"
] | gustavo.reis20000@gmail.com |
0927690cc3d5daef350d9a8cd989944db871d0e9 | 66f5b9d0a6ef4c21ebdb2f0bcd82f21594129a60 | /Pokecube Core/src/main/java/pokecube/modelloader/client/render/tabula/model/TabulaModelRenderer.java | b950fb12b73308f25e688646aa770d6975d2eb19 | [] | no_license | MartijnTielemans/Pokecube | 4fee4dd4512fd821c52a91a4ec314b11a8dd1acd | 3618d37ca56d9c3df2e3022782fba42bb8e6f751 | refs/heads/master | 2021-05-31T03:22:47.590067 | 2016-02-28T13:41:14 | 2016-02-28T13:41:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,500 | java | package pokecube.modelloader.client.render.tabula.model;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RendererLivingEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.FMLClientHandler;
import pokecube.core.client.render.entity.RenderPokemobs;
import pokecube.core.database.PokedexEntry;
import pokecube.core.interfaces.IMoveConstants;
import pokecube.core.interfaces.IPokemob;
import pokecube.modelloader.client.render.model.IModelRenderer;
import pokecube.modelloader.client.render.model.IPartTexturer;
import pokecube.modelloader.client.render.tabula.TabulaPackLoader;
import pokecube.modelloader.client.render.tabula.TabulaPackLoader.TabulaModelSet;
import pokecube.modelloader.client.render.tabula.components.ModelJson;
import pokecube.modelloader.client.render.tabula.model.tabula.TabulaModel;
import pokecube.modelloader.client.render.tabula.model.tabula.TabulaModelParser;
public class TabulaModelRenderer<T extends EntityLiving> extends RendererLivingEntity<T> implements IModelRenderer<T>
{
private String phase = "";
public TabulaModelSet set;
private boolean statusRender = false;
public TabulaModelRenderer(TabulaModelSet set)
{
super(Minecraft.getMinecraft().getRenderManager(), null, 0);
this.set = set;
}
@Override
public void doRender(T entity, double d, double d1, double d2, float f, float partialTick)
{
PokedexEntry entry = null;
if (entity instanceof IPokemob) entry = ((IPokemob) entity).getPokedexEntry();
else return;
float f2 = this.interpolateRotation(entity.prevRenderYawOffset, entity.renderYawOffset, partialTick);
float f3 = this.interpolateRotation(entity.prevRotationYawHead, entity.rotationYawHead, partialTick);
float f4;
if (entity.isRiding() && entity.ridingEntity instanceof EntityLivingBase)
{
EntityLivingBase entitylivingbase1 = (EntityLivingBase) entity.ridingEntity;
f2 = this.interpolateRotation(entitylivingbase1.prevRenderYawOffset, entitylivingbase1.renderYawOffset,
partialTick);
f4 = MathHelper.wrapAngleTo180_float(f3 - f2);
if (f4 < -85.0F)
{
f4 = -85.0F;
}
if (f4 >= 85.0F)
{
f4 = 85.0F;
}
f2 = f3 - f4;
if (f4 * f4 > 2500.0F)
{
f2 += f4 * 0.2F;
}
}
f4 = this.handleRotationFloat(entity, partialTick);
if (set == null)
{
System.err.println(entry);
set = TabulaPackLoader.modelMap.get(entry.baseForme);
}
TabulaModel model = set.model;
IModelParser<TabulaModel> parser = set.parser;
if (model == null || parser == null) { return; }
GlStateManager.pushMatrix();
GlStateManager.disableCull();
TabulaModelParser pars = ((TabulaModelParser) parser);
ModelJson modelj = pars.modelMap.get(model);
if (!statusRender) modelj.texturer = set.texturer;
else modelj.texturer = null;
if (set.animator != null)
{
phase = set.animator.modifyAnimation(entity, partialTick, phase);
}
boolean inSet = false;
if (modelj.animationMap.containsKey(phase) || (inSet = set.loadedAnimations.containsKey(phase)))
{
if (!inSet) modelj.startAnimation(phase);
else modelj.startAnimation(set.loadedAnimations.get(phase));
}
else if (modelj.isAnimationInProgress())
{
modelj.stopAnimation();
}
GlStateManager.rotate(180f, 0f, 0f, 1f);
GlStateManager.rotate(entity.rotationYaw + 180, 0, 1, 0);
set.rotation.rotations.glRotate();
GlStateManager.translate(set.shift.x, set.shift.y, set.shift.z);
GlStateManager.scale(set.scale.x, set.scale.y, set.scale.z);
parser.render(model, entity);
GlStateManager.enableCull();
GlStateManager.popMatrix();
}
@Override
protected ResourceLocation getEntityTexture(T entity)
{
return RenderPokemobs.getInstance().getEntityTexturePublic(entity);
}
@Override
public void setPhase(String phase)
{
this.phase = phase;
}
@Override
public void renderStatus(T entity, double d0, double d1, double d2, float f, float partialTick)
{
IPokemob pokemob = (IPokemob) entity;
byte status;
if ((status = pokemob.getStatus()) == IMoveConstants.STATUS_NON) return;
ResourceLocation texture = null;
if (status == IMoveConstants.STATUS_FRZ)
{
texture = FRZ;
}
else if (status == IMoveConstants.STATUS_PAR)
{
texture = PAR;
}
if (texture == null) return;
FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture);
float time = (((Entity) pokemob).ticksExisted + partialTick);
GL11.glPushMatrix();
float speed = status == IMoveConstants.STATUS_FRZ ? 0.001f : 0.005f;
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glLoadIdentity();
float var5 = time * speed;
float var6 = time * speed;
GL11.glTranslatef(var5, var6, 0.0F);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
float var7 = status == IMoveConstants.STATUS_FRZ ? 0.5f : 1F;
GL11.glColor4f(var7, var7, var7, 0.5F);
var7 = status == IMoveConstants.STATUS_FRZ ? 1.08f : 1.05F;
GL11.glScalef(var7, var7, var7);
preRenderStatus();
doRender(entity, d0, d1, d2, f, partialTick);
postRenderStatus();
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glLoadIdentity();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glPopMatrix();
}
boolean blend;
boolean light;
int src;
int dst;
private void preRenderStatus()
{
blend = GL11.glGetBoolean(GL11.GL_BLEND);
light = GL11.glGetBoolean(GL11.GL_LIGHTING);
src = GL11.glGetInteger(GL11.GL_BLEND_SRC);
dst = GL11.glGetInteger(GL11.GL_BLEND_DST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
statusRender = true;
}
private void postRenderStatus()
{
if (light) GL11.glEnable(GL11.GL_LIGHTING);
if (!blend) GL11.glDisable(GL11.GL_BLEND);
GL11.glBlendFunc(src, dst);
statusRender = false;
}
@Override
public IPartTexturer getTexturer()
{
return set.texturer;
}
@Override
public boolean hasPhase(String phase)
{
ModelJson modelj = null;
if (set != null) modelj = set.parser.modelMap.get(set.model);
return set.loadedAnimations.containsKey(phase) || (modelj != null && modelj.animationMap.containsKey(phase));
}
}
| [
"elpatricimo@gmail.com"
] | elpatricimo@gmail.com |
556bcb34b75e17793327a575caaba3068d3bd4a7 | 183b6dfa3828059ba1a558c4eb03704144879912 | /Flow2/Week1/04Friday/OrmJPQL/src/main/java/tests/EntityTester.java | 50fcc9c7be41cf731a61cb627e07089b4fcbc5f6 | [] | no_license | MartinFrederiksen/CPH-3Sem | 8c32343a246940157dc61802c9d351ed522ac4ac | 7ab37614bb48e9bf0c33400d6f73647843124ba8 | refs/heads/master | 2022-06-22T22:56:07.834018 | 2019-11-02T14:21:24 | 2019-11-02T14:21:24 | 219,153,808 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,365 | java | package tests;
import Entities.Semester;
import Entities.Student;
import facades.Facade;
import javax.persistence.Persistence;
/**
*
* @author Joe
*/
public class EntityTester {
public static void main(String[] args) {
Facade f = new Facade(Persistence.createEntityManagerFactory("pu"));
//1.
System.out.println(f.getAllStudents());
//2.
System.out.println(f.getAllStudentsByName("anders"));
//3.
//System.out.println(f.addStudent(new Student(9L), "John", "Johnny"));
//4.
System.out.println(f.assignStudentToSemester(9L, 1L));
//5.
//Forstår ikke helt denne opgave
//6.
System.out.println(f.getStudentByLastname("and"));
//7.
System.out.println(f.getStudentCount());
//8.
System.out.println(f.getStudentCountBySemName("CLcos-v14e"));
//9.
//f.addStudent(new Student(21L), "Test", "test");
System.out.println(f.getStudentCountAllSem());
//10
//Kan ikke gennemskue den query der skal bruges her så jeg ikke bare gør det med java men med JPQL
//11
System.out.println(f.getStudentInfo());
//12
System.out.println(f.getStudentInfoById(9L));
}
}
| [
"zyjinxx@hotmail.com"
] | zyjinxx@hotmail.com |
b2128af91e8eee6b1d0810f1a45fb550b669b097 | 303d7f1ad2583358fcc02147419dfe0af66ff8ac | /app/src/main/java/refactor/lib/colordialog/ColorDialogPermissionDead.java | 904ec77bd9d55a313153bb66cf54fa5c6e8d27c9 | [] | no_license | BruceAnda/cana-android | f49c0c82a2c5d381c0f196611e0c65e7e952e660 | 4b158007adfc2653253a9ff6fba4d3042374afb2 | refs/heads/master | 2021-01-19T14:27:35.977255 | 2017-11-14T09:31:32 | 2017-11-14T09:31:32 | 100,904,122 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 13,630 | java | package cn.refactor.lib.colordialog;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.RoundRectShape;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import cn.ac.ict.canalib.R;
import cn.refactor.lib.colordialog.util.DisplayUtil;
/**
* 作者 : andy
* 日期 : 15/11/7 17:26
* 邮箱 : andyxialm@gmail.com
* 描述 : Dialog
*/
public class ColorDialogPermissionDead extends Dialog implements View.OnClickListener {
private TextView mBtnPositive, mBtnNagative;
private ImageView mContentIv;
private Bitmap mContentBitmap;
private View mBtnGroupView, mDividerView, mBkgView, mDialogView;
private TextView mTitleTv, mContentTv, mPositiveBtn, mNegativeBtn;
private Drawable mDrawable;
private AnimationSet mAnimIn, mAnimOut;
private int mResId, mBackgroundColor, mTitleTextColor, mContentTextColor;
private OnPositiveListener mPositiveListener;
private OnNegativeListener mNegativeListener;
private CharSequence mTitleText, mContentText, mPositiveText, mNegativeText;
private float mTitleTextSize, mContentTextSize, mPositiveTextSize, mNegativeTextSize;
private boolean mIsShowAnim;
public ColorDialogPermissionDead(Context context) {
this(context, 0);
}
public ColorDialogPermissionDead(Context context, int theme) {
super(context, R.style.color_dialog);
init();
}
private void callDismiss() {
super.dismiss();
}
private void init() {
mAnimIn = AnimationLoader.getInAnimation(getContext());
mAnimOut = AnimationLoader.getOutAnimation(getContext());
initAnimListener();
}
@Override
public void setTitle(CharSequence title) {
mTitleText = title;
}
@Override
public void setTitle(int titleId) {
setTitle(getContext().getText(titleId));
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
View contentView = View.inflate(getContext(), R.layout.layout_colordialog_permission_dead, null);
setContentView(contentView);
mBtnPositive = (TextView) findViewById(R.id.btn_negative);
mBtnNagative = (TextView) findViewById(R.id.btn_positive);
mBtnPositive.setOnClickListener(this);
mBtnNagative.setOnClickListener(this);
mDialogView = getWindow().getDecorView().findViewById(android.R.id.content);
mBkgView = contentView.findViewById(R.id.llBkg);
mTitleTv = (TextView) contentView.findViewById(R.id.tvTitle);
mContentTv = (TextView) contentView.findViewById(R.id.tvContent);
mContentIv = (ImageView) contentView.findViewById(R.id.ivContent);
mPositiveBtn = (TextView) contentView.findViewById(R.id.btnPositive);
mNegativeBtn = (TextView) contentView.findViewById(R.id.btnNegative);
mDividerView = contentView.findViewById(R.id.divider);
mBtnGroupView = contentView.findViewById(R.id.llBtnGroup);
mPositiveBtn.setOnClickListener(this);
mNegativeBtn.setOnClickListener(this);
mTitleTv.setText(mTitleText);
//mTitleTv.setTextSize(TypedValue.COMPLEX_UNIT_SP, mTitleTextSize);
mTitleTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTitleTextSize);
mContentTv.setText(mContentText);
//mContentTv.setTextSize(TypedValue.COMPLEX_UNIT_SP, mContentTextSize);
mContentTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, mContentTextSize);
mPositiveBtn.setText(mPositiveText);
//mPositiveBtn.setTextSize(TypedValue.COMPLEX_UNIT_SP, mPositiveTextSize);
mPositiveBtn.setTextSize(TypedValue.COMPLEX_UNIT_PX, mPositiveTextSize);
mNegativeBtn.setText(mNegativeText);
//mNegativeBtn.setTextSize(TypedValue.COMPLEX_UNIT_SP, mNegativeTextSize);
mNegativeBtn.setTextSize(TypedValue.COMPLEX_UNIT_PX, mNegativeTextSize);
if (null == mPositiveListener && null == mNegativeListener) {
mBtnGroupView.setVisibility(View.GONE);
} else if (null == mPositiveListener && null != mNegativeListener) {
mPositiveBtn.setVisibility(View.GONE);
mDividerView.setVisibility(View.GONE);
mNegativeBtn.setBackgroundDrawable(getContext().getResources().getDrawable(R.drawable.sel_def_gray));
} else if (null != mPositiveListener && null == mNegativeListener) {
mNegativeBtn.setVisibility(View.GONE);
mDividerView.setVisibility(View.GONE);
mPositiveBtn.setBackgroundDrawable(getContext().getResources().getDrawable(R.drawable.sel_def_gray));
}
if (null != mDrawable) {
mContentIv.setBackgroundDrawable(mDrawable);
}
if (null != mContentBitmap) {
mContentIv.setImageBitmap(mContentBitmap);
}
if (0 != mResId) {
mContentIv.setBackgroundResource(mResId);
}
setTextColor();
setBackgroundColor();
setContentMode();
}
@Override
protected void onStart() {
super.onStart();
startWithAnimation(mIsShowAnim);
}
@Override
public void dismiss() {
dismissWithAnimation(mIsShowAnim);
}
private void startWithAnimation(boolean showInAnimation) {
if (showInAnimation) {
mDialogView.startAnimation(mAnimIn);
}
}
private void dismissWithAnimation(boolean showOutAnimation) {
if (showOutAnimation) {
mDialogView.startAnimation(mAnimOut);
} else {
super.dismiss();
}
}
private void initAnimListener() {
mAnimOut.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
mDialogView.post(new Runnable() {
@Override
public void run() {
callDismiss();
}
});
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
}
private void setBackgroundColor() {
if (0 == mBackgroundColor) {
return;
}
int radius = DisplayUtil.dp2px(getContext(), 6);
float[] outerRadii = new float[]{radius, radius, radius, radius, 0, 0, 0, 0};
RoundRectShape roundRectShape = new RoundRectShape(outerRadii, null, null);
ShapeDrawable shapeDrawable = new ShapeDrawable(roundRectShape);
shapeDrawable.getPaint().setColor(mBackgroundColor);
shapeDrawable.getPaint().setStyle(Paint.Style.FILL);
mBkgView.setBackgroundDrawable(shapeDrawable);
}
private void setTextColor() {
if (0 != mTitleTextColor) {
mTitleTv.setTextColor(mTitleTextColor);
}
if (0 != mContentTextColor) {
mContentTv.setTextColor(mContentTextColor);
}
}
private void setContentMode() {
boolean isImageMode = (null != mDrawable | null != mContentBitmap | 0 != mResId);
boolean isTextMode = (!TextUtils.isEmpty(mContentText));
if (isImageMode && isTextMode) {
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mContentTv.getLayoutParams();
params.gravity = Gravity.BOTTOM;
mContentTv.setLayoutParams(params);
mContentTv.setBackgroundColor(Color.BLACK);
mContentTv.getBackground().setAlpha(0x28);
mContentTv.setVisibility(View.VISIBLE);
mContentIv.setVisibility(View.VISIBLE);
return;
}
if (isTextMode) {
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mContentTv.getLayoutParams();
params.gravity = Gravity.NO_GRAVITY;
mContentTv.setLayoutParams(params);
mContentIv.setVisibility(View.GONE);
mContentTv.setVisibility(View.VISIBLE);
return;
}
if (isImageMode) {
mContentTv.setVisibility(View.GONE);
mContentIv.setVisibility(View.VISIBLE);
return;
}
}
@Override
public void onClick(View v) {
int id = v.getId();
if (R.id.btnPositive == id) {
mPositiveListener.onClick(this);
} else if (R.id.btnNegative == id) {
mNegativeListener.onClick(this);
} else if (R.id.btn_negative == id) {
listener.cancel(this);
} else if (R.id.btn_positive == id) {
listener.determine(this);
} else {
}
}
public ColorDialogPermissionDead setAnimationEnable(boolean enable) {
mIsShowAnim = enable;
return this;
}
public ColorDialogPermissionDead setAnimationIn(AnimationSet animIn) {
mAnimIn = animIn;
return this;
}
public ColorDialogPermissionDead setAnimationOut(AnimationSet animOut) {
mAnimOut = animOut;
initAnimListener();
return this;
}
public ColorDialogPermissionDead setColor(int color) {
mBackgroundColor = color;
return this;
}
public ColorDialogPermissionDead setColor(String color) {
try {
setColor(Color.parseColor(color));
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
return this;
}
public ColorDialogPermissionDead setTitleTextColor(int color) {
mTitleTextColor = color;
return this;
}
public ColorDialogPermissionDead setTitleTextColor(String color) {
try {
setTitleTextColor(Color.parseColor(color));
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
return this;
}
public ColorDialogPermissionDead setContentTextColor(int color) {
mContentTextColor = color;
return this;
}
public ColorDialogPermissionDead setContentTextColor(String color) {
try {
setContentTextColor(Color.parseColor(color));
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
return this;
}
public ColorDialogPermissionDead setPositiveListener(CharSequence text, OnPositiveListener l) {
mPositiveText = text;
mPositiveListener = l;
return this;
}
public ColorDialogPermissionDead setPositiveListener(int textId, OnPositiveListener l) {
return setPositiveListener(getContext().getText(textId), l);
}
public ColorDialogPermissionDead setNegativeListener(CharSequence text, OnNegativeListener l) {
mNegativeText = text;
mNegativeListener = l;
return this;
}
public ColorDialogPermissionDead setNegativeListener(int textId, OnNegativeListener l) {
return setNegativeListener(getContext().getText(textId), l);
}
public ColorDialogPermissionDead setContentText(CharSequence text) {
mContentText = text;
return this;
}
public ColorDialogPermissionDead setContentTextSize(float size) {
mContentTextSize = size;
return this;
}
public ColorDialogPermissionDead setTitleTextSize(float size) {
mTitleTextSize = size;
return this;
}
public ColorDialogPermissionDead setPositiveTextSize(float size) {
mPositiveTextSize = size;
return this;
}
public ColorDialogPermissionDead setNegativeTextSize(float size) {
mNegativeTextSize = size;
return this;
}
public ColorDialogPermissionDead setContentText(int textId) {
return setContentText(getContext().getText(textId));
}
public ColorDialogPermissionDead setContentImage(Drawable drawable) {
mDrawable = drawable;
return this;
}
public ColorDialogPermissionDead setContentImage(Bitmap bitmap) {
mContentBitmap = bitmap;
return this;
}
public ColorDialogPermissionDead setContentImage(int resId) {
mResId = resId;
return this;
}
public CharSequence getContentText() {
return mContentText;
}
public CharSequence getTitleText() {
return mTitleText;
}
public CharSequence getPositiveText() {
return mPositiveText;
}
public CharSequence getNegativeText() {
return mNegativeText;
}
public interface OnPositiveListener {
void onClick(ColorDialogPermissionDead dialog);
}
public interface OnNegativeListener {
void onClick(ColorDialogPermissionDead dialog);
}
private ImageView ivClose;
private Button btnStart;
private OnClickListener listener;
public ColorDialogPermissionDead setListener(OnClickListener listener) {
this.listener = listener;
return this;
}
public interface OnClickListener {
void cancel(ColorDialogPermissionDead dialog);
void determine(ColorDialogPermissionDead dialog);
}
}
| [
"2668645098@qq.com"
] | 2668645098@qq.com |
354e11b0fce990240a771a858af8a5b032622dfd | ff951473fb6203beb3ca97cf1cb02d69c223af3e | /Sep-Selenium/src/main/java/sep16_Actions_Mouse_KeyBoard_FooterLinks_JavaScriptDom/ActionsExDoubleClick.java | 4a5ac8ba69a5529f9089798df2eaee28ad3c17d9 | [] | no_license | santoshonlinetraining/AugSepOctBatch | 3f9a4f6a549656290995896a7ba7422c9925ca72 | e04e6074d64d8b0e0b6c9934106b6e6f9fde89e3 | refs/heads/master | 2023-08-15T08:49:59.811640 | 2021-10-20T04:35:02 | 2021-10-20T04:35:02 | 419,179,460 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,244 | java | package sep16_Actions_Mouse_KeyBoard_FooterLinks_JavaScriptDom;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
public class ActionsExDoubleClick {
//Enter a work in CAPS and select the same
public static void main(String[] args) throws InterruptedException {
WebDriver driver;
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "C:\\Santosh\\Automation\\Workspace_new\\Sep-Selenium\\drivers\\chrome\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("https://www.bigbasket.com");
Actions act = new Actions(driver);
WebElement search = driver.findElement(By.xpath("//input[@id='input']"));
//Double click on the webelemebt
act.moveToElement(search).click().sendKeys("TOMATO").doubleClick().build().perform();
Thread.sleep(5000);
//Right click on the web page
act.moveToElement(search).contextClick().build().perform();
}
}
| [
"santsoh.onlinetraining@gmail.com"
] | santsoh.onlinetraining@gmail.com |
33687afe4311dc6ed97c6439c9d8133d042ed1bf | 1d876ec0aa48985530f516ca88ecc218352b9ede | /solutions/test120_129/test124.java | 49d24de26b988f5f16022ea9665c1b951c9548ed | [] | no_license | WOQUQ/LeetcodeSolution | a324f9954c5b48b16f5acc96cbc4b878036ec0b0 | aa87411d3116eb53e3ecea12e3b0e05256a8e1d2 | refs/heads/master | 2020-09-30T00:47:37.087025 | 2020-07-08T03:10:58 | 2020-07-08T03:10:58 | 227,159,693 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 546 | java | package test120_129;
public class test124 {
int _max = Integer.MIN_VALUE;
public int maxPathSum(TreeNode root) {
findMax(root);
return _max;
}
private int findMax(TreeNode root){
if(root == null) return 0;
int leftMax = Math.max(0, findMax(root.left));
int rightMax = Math.max(0, findMax(root.right));
_max = Math.max((leftMax + rightMax + root.val), _max);
int rootMax = Math.max(leftMax, rightMax) + root.val;
return rootMax;
}
}
| [
"zhuozhiquq@gmail.com"
] | zhuozhiquq@gmail.com |
e01f4fc0ece1177f4612698419aade3336027e0e | 49363e391331bef73ed320d182179e3242a9f622 | /rice-middleware/it/kew/src/test/java/org/kuali/rice/kew/doctype/KewDocumentTypeBaseTest.java | d687b3a381cb476c9482dfa1bbe0e7cf774cac71 | [
"Artistic-1.0",
"MIT",
"LGPL-2.1-or-later",
"LGPL-3.0-only",
"EPL-1.0",
"LicenseRef-scancode-warranty-disclaimer",
"CPL-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-jdom",
"BSD-3-Clause",
"LicenseRef-scancode-freemarker",
"ECL-2.0"
] | permissive | iu-uits-es/rice | 56ee4fdac1fb6da6d0bde4fb60aefd70ff7f7368 | efa98ec305cf3e89c448ab641bd89f0f3bafb2a6 | refs/heads/iu-contrib-2.4 | 2021-07-11T07:26:59.818277 | 2021-03-10T17:49:27 | 2021-03-10T17:49:27 | 30,314,952 | 2 | 0 | ECL-2.0 | 2021-03-10T17:49:28 | 2015-02-04T18:47:50 | Java | UTF-8 | Java | false | false | 9,686 | java | /*
* Copyright 2006-2014 The Kuali Foundation
*
* Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
*
* 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.kuali.rice.kew.doctype;
import org.apache.commons.lang.StringUtils;
import org.junit.Test;
import org.kuali.rice.kew.api.KewApiConstants;
import org.kuali.rice.kew.doctype.bo.DocumentType;
import org.kuali.rice.kew.engine.node.ProcessDefinitionBo;
import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
import org.kuali.rice.kew.rule.bo.RuleAttribute;
import org.kuali.rice.kew.test.KEWTestCase;
import org.kuali.rice.krad.data.DataObjectService;
import org.kuali.rice.krad.data.PersistenceOption;
import org.kuali.rice.krad.service.KRADServiceLocator;
import java.sql.Timestamp;
import java.util.Date;
import static org.junit.Assert.assertTrue;
/**
* Test utilities (and common tests) for KEW module Document type object persistence
*
* Created by fraferna on 9/3/14.
*/
public abstract class KewDocumentTypeBaseTest extends KEWTestCase {
protected DocumentType setupDocumentType(boolean persist){
DocumentType documentType = new DocumentType();
documentType.setActionsUrl("/test");
documentType.setActive(true);
documentType.setActualApplicationId("tst");
documentType.setActualNotificationFromAddress("blah@iu.edu");
documentType.setApplyRetroactively(true);
documentType.setAuthorizer("TestAuthorizer");
documentType.setBlanketApprovePolicy("GoodPolicy");
documentType.setBlanketApproveWorkgroupId("TestGroup");
documentType.setCurrentInd(true);
documentType.setDescription("testing descr");
documentType.setCustomEmailStylesheet("blah@iu.edu");
documentType.setDocumentId("1234");
documentType.setLabel("doc type stuff");
documentType.setName("gooddoctype");
documentType.setReturnUrl("returnUrl");
documentType.setPostProcessorName("PostProcessMe");
documentType.setDocTypeParentId(null);
if (persist) {
return getDataObjectService().save(documentType, PersistenceOption.FLUSH);
}
return documentType;
}
protected DocumentTypePolicy setupDocumentTypePolicy(DocumentType documentType) throws Exception{
DocumentTypePolicy dtp = new DocumentTypePolicy();
dtp.setDocumentType(documentType);
dtp.setInheritedFlag(true);
dtp.setPolicyName("DISAPPROVE");
dtp.setPolicyStringValue("somevalue");
dtp.setPolicyValue(true);
return getDataObjectService().save(dtp, PersistenceOption.FLUSH);
}
protected ApplicationDocumentStatusCategory setupApplicationDocumentStatusCategory(DocumentType documentType){
ApplicationDocumentStatusCategory applicationDocumentStatusCategory = new ApplicationDocumentStatusCategory();
applicationDocumentStatusCategory.setCategoryName("TestCategory");
applicationDocumentStatusCategory.setDocumentType(documentType);
return getDataObjectService().save(applicationDocumentStatusCategory, PersistenceOption.FLUSH);
}
protected DocumentTypeAttributeBo setupDocumentTypeAttributeBo(DocumentType documentType){
DocumentTypeAttributeBo documentTypeAttributeBo = new DocumentTypeAttributeBo();
documentTypeAttributeBo.setDocumentType(documentType);
documentTypeAttributeBo.setOrderIndex(1);
documentTypeAttributeBo.setLockVerNbr(1);
RuleAttribute ruleAttribute = setupRuleAttribute();
documentTypeAttributeBo.setRuleAttribute(ruleAttribute);
return getDataObjectService().save(documentTypeAttributeBo, PersistenceOption.FLUSH);
}
protected ProcessDefinitionBo setupProcessDefinitionBo(DocumentType documentType){
ProcessDefinitionBo processDefinitionBo = new ProcessDefinitionBo();
processDefinitionBo.setDocumentType(documentType);
processDefinitionBo.setInitial(true);
processDefinitionBo.setName("testing");
return getDataObjectService().save(processDefinitionBo, PersistenceOption.FLUSH);
}
protected DocumentRouteHeaderValue setupDocumentRouteHeaderValueWithRouteHeaderAssigned(String documentTypeId) {
DocumentRouteHeaderValue routeHeader = new DocumentRouteHeaderValue();
routeHeader.setDocumentId(KewDocumentTypeJpaTest.TEST_DOC_ID);
routeHeader.setAppDocId("Test");
routeHeader.setApprovedDate(null);
routeHeader.setCreateDate(new Timestamp(new Date().getTime()));
routeHeader.setDocContent("test");
routeHeader.setDocRouteLevel(1);
routeHeader.setDocRouteStatus(KewApiConstants.ROUTE_HEADER_ENROUTE_CD);
routeHeader.setDocTitle("Test");
routeHeader.setDocumentTypeId(documentTypeId);
routeHeader.setDocVersion(KewApiConstants.DocumentContentVersions.CURRENT);
routeHeader.setRouteStatusDate(new Timestamp(new Date().getTime()));
routeHeader.setDateModified(new Timestamp(new Date().getTime()));
routeHeader.setInitiatorWorkflowId("someone");
return getDataObjectService().save(routeHeader, PersistenceOption.FLUSH);
}
private RuleAttribute setupRuleAttribute(){
RuleAttribute ruleAttribute = new RuleAttribute();
ruleAttribute.setApplicationId("TST");
ruleAttribute.setDescription("Testing");
ruleAttribute.setLabel("New Label");
ruleAttribute.setResourceDescriptor("ResourceDescriptor");
ruleAttribute.setType("newType");
ruleAttribute.setName("Attr");
return getDataObjectService().save(ruleAttribute, PersistenceOption.FLUSH);
}
private ApplicationDocumentStatus setApplicationDocumentStatus(DocumentType documentType, ApplicationDocumentStatusCategory category){
ApplicationDocumentStatus applicationDocumentStatus = new ApplicationDocumentStatus();
applicationDocumentStatus.setDocumentType(documentType);
applicationDocumentStatus.setCategory(category);
applicationDocumentStatus.setSequenceNumber(1);
applicationDocumentStatus.setStatusName("someStatus");
return getDataObjectService().save(applicationDocumentStatus, PersistenceOption.FLUSH);
}
@Test
public void testDocumentTypePersistAndFetch() throws Exception{
DocumentType dt = setupDocumentType(true);
assertTrue("DocumentType Persisted correctly", dt != null && StringUtils.isNotBlank(dt.getDocumentTypeId()));
DocumentTypePolicy dtp = setupDocumentTypePolicy(dt);
assertTrue("DocumentTypePolicy persisted correctly", dtp != null && StringUtils.isNotBlank(
dtp.getDocumentType().getDocumentTypeId()));
dt.getDocumentTypePolicies().add(dtp);
ApplicationDocumentStatusCategory appDocStatusCategory = setupApplicationDocumentStatusCategory(
dt);
assertTrue("ApplicationDocumentStatusCategory persisted correctly", appDocStatusCategory != null);
dt.getApplicationStatusCategories().add(appDocStatusCategory);
ApplicationDocumentStatus appDocStatus = setApplicationDocumentStatus(dt, appDocStatusCategory);
assertTrue("Application Document Status persisted correctly", appDocStatus != null &&
StringUtils.isNotBlank(appDocStatus.getDocumentTypeId()));
dt.getValidApplicationStatuses().add(appDocStatus);
DocumentTypeAttributeBo documentTypeAttributeBo = setupDocumentTypeAttributeBo(dt);
assertTrue("DocumentTypeAttributeBo persisted correctly", documentTypeAttributeBo != null &&
StringUtils.isNotBlank(documentTypeAttributeBo.getId()));
dt.getDocumentTypeAttributes().add(documentTypeAttributeBo);
ProcessDefinitionBo processDefinitionBo = setupProcessDefinitionBo(dt);
assertTrue("ProcessDefinitionBo persisted correctly", processDefinitionBo != null &&
StringUtils.isNotBlank(processDefinitionBo.getProcessId()));
dt.addProcess(processDefinitionBo);
dt = KRADServiceLocator.getDataObjectService().save(dt, PersistenceOption.FLUSH);
dt = fetchDocumentType(dt);
assertTrue("Document Type fetched correctly", dt != null && StringUtils.isNotBlank(dt.getDocumentTypeId()));
assertTrue("App doc status grabbed for doc type", dt.getValidApplicationStatuses() != null
&& dt.getValidApplicationStatuses().size() == 1);
assertTrue("Document type policy fetched correctly", dt.getDocumentTypePolicies() != null &&
dt.getDocumentTypePolicies().size() == 1);
assertTrue("ApplicationDocStatusCategory fetched correctly", dt.getApplicationStatusCategories() != null &&
dt.getApplicationStatusCategories().size() == 1);
assertTrue("DocumentTypeAttributeBo fetched correctly", dt.getDocumentTypeAttributes() != null &&
dt.getDocumentTypeAttributes().size() == 1);
assertTrue("ProcessDefinitionBo fetched correctly", dt.getProcesses() != null && dt.getProcesses().size() == 1);
}
protected abstract DataObjectService getDataObjectService();
protected abstract DocumentType fetchDocumentType(DocumentType dt);
}
| [
"burnumd+github@gmail.com"
] | burnumd+github@gmail.com |
b269045e79b5828225c64e04ccaa7a9d1cd45008 | 9f5d55215380bcac5c1be66efb1420877b81b6c3 | /src/main/java/ru/tenderhack/model/DeliveryOption.java | b4e73d7cc52e546c1acf5c7022e742ac6e96d2cd | [] | no_license | kirillnepomiluev/tenderHach1DevFull | d1a4a124ba4abef6c61c7cb1451b15d146484013 | 981b6b661b7b26a2e621618872f0a69e9172f240 | refs/heads/master | 2021-01-05T00:58:19.077379 | 2020-02-16T14:19:31 | 2020-02-16T14:19:31 | 240,821,482 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 101 | java | package ru.tenderhack.model;
public class DeliveryOption {
private int days;
private int cost;
}
| [
"nepomiluev.kirill@gmail.com"
] | nepomiluev.kirill@gmail.com |
46fd322d9773173ff89f238759f2d803c30c0643 | f1bc741271198cce380d915db0e0b6d6138ca6d2 | /J2ME_GPS/src/Main/Setting.java | ff1adff3da0c9e58bb11394efecb29d27640f1ee | [] | no_license | mrevan/Rolling-In-Banff | 277d2d84009162f43fecfb019448fc66f85b112c | 3e6c753bbeff178b4409d50013aa37a192d26bca | refs/heads/master | 2020-12-24T16:16:33.687264 | 2009-08-20T23:05:21 | 2009-08-20T23:05:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,172 | java | package Main;
import javax.microedition.lcdui.*;
/**
*
* @author lam
*/
public class Setting implements CommandListener,ItemStateListener{
private Form settingForm;
private Command exitCommand;
private Command backCommand;
private Command okCommand;
private Gauge volume;
private Gauge difficulty;
private StringItem difficultyStr = new StringItem("Current:","normal");
public Setting(){
exitCommand = new Command("Exit", Command.EXIT, 0);
okCommand = new Command("OK",Command.OK,0);
backCommand = new Command("Back",Command.BACK,0);
}
public void showSettingMenu(){
if(settingForm == null){
settingForm = new Form("setting Form");
volume = new Gauge("Volume",true,6,3);
volume.setLayout(Item.LAYOUT_CENTER);
settingForm.append(volume);
difficulty = new Gauge("Difficulty",true,2,1);
difficulty.setLayout(Item.LAYOUT_CENTER);
settingForm.append(difficulty);
settingForm.append(difficultyStr);
settingForm.addCommand(backCommand);
settingForm.addCommand(exitCommand);
settingForm.setCommandListener(this);
settingForm.setItemStateListener(this);
}
TouristMIDlet.getDisplay().setCurrent(settingForm);
}
public void commandAction(Command c, Displayable d) {
if (c.getCommandType() == Command.EXIT )
TouristMIDlet.getInstance().notifyDestroyed();
if (c.getCommandType() == Command.BACK)
TouristMIDlet.getInstance().getMenu().showMainMenu();
}
public int getVolume(){
return volume.getValue();
}
public int getDifficulty(){
return difficulty.getValue();
}
public void itemStateChanged(Item item) {
if(item == difficulty){
int diff = difficulty.getValue();
if(diff == 0 )
difficultyStr.setText("easy");
else if (diff == 1)
difficultyStr.setText("normal");
else
difficultyStr.setText("difficult");
}
}
}
| [
"xuyuanxu2@gmail.com"
] | xuyuanxu2@gmail.com |
922159fbdf622521abb1a62d05c7b1f3bd2aba40 | e20e1bae01370af4e2bb238e17f452e87b1df481 | /src/main/java/com/axmor/model/Comment.java | 47b9307b8437c47f341c239b5fe10b8cc0a95e76 | [
"MIT"
] | permissive | GromovAV/issuetracker | b1a0541fa3dad405fe0821f339d19ec33003bb52 | 67faedcf095f5df37d218229704a20023be1fb8e | refs/heads/master | 2020-04-19T22:30:02.808998 | 2019-02-14T15:28:31 | 2019-02-14T15:28:31 | 168,470,316 | 0 | 0 | null | 2019-01-31T05:49:19 | 2019-01-31T05:49:19 | null | UTF-8 | Java | false | false | 1,279 | java | package com.axmor.model;
import java.util.Date;
public class Comment {
private int id;
private int issueId;
private Date commentDate;
private String author;
private String text;
private Status status;
private boolean changeStatus;
public Status getStatus() {
return status;
}
public void setStatus(Status status) {
this.status = status;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Date getCommentDate() {
return commentDate;
}
public void setCommentDate(Date commentDate) {
this.commentDate = commentDate;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public int getIssueId() {
return issueId;
}
public void setIssueId(int issueId) {
this.issueId = issueId;
}
public boolean isChangeStatus() {
return changeStatus;
}
public void setChangeStatus(boolean changeStatus) {
this.changeStatus = changeStatus;
}
}
| [
"47201812+GromovAV@users.noreply.github.com"
] | 47201812+GromovAV@users.noreply.github.com |
490d50519757527a958328fe973430c859442b39 | 6e46f9210806d7b2a97bf50f182ccfdce55b830f | /src/com/rdec/services/UserService.java | be2e4748b64fd83d5dbd4ff42081cdf558428a47 | [] | no_license | praj-raj/Product_Processing_System | 5cc7264dd7046bd7acaecd8a1de2067209e381fd | f6d76080ef5dc53d58a7b07cd3f6b21a4a7430cc | refs/heads/master | 2020-07-22T05:58:10.495659 | 2019-09-08T10:11:08 | 2019-09-08T10:11:08 | 206,524,339 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 812 | java | package com.rdec.services;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.List;
import com.rdec.models.Card;
import com.rdec.models.Product;
import com.rdec.models.User;
public interface UserService {
public String addUser(User user);
public User loginUser(User user);
public String setLoginStatus(User user);
public String addProduct(Product product);
public List<Product> getProduct();
public List<String> getCatagery();
public String updateUser(User user);
public String deleteUser(User user);
public String addCard(Card card);
public List<Card> getCard(int uid);
public String deleteProduct(Product product);
public String delCart(int id);
//public User getUserbyName(String name);
public User getUserbyId(int id);
public List<User> getAllUser();
}
| [
"prajwalrajput1@gmail.com"
] | prajwalrajput1@gmail.com |
7a5525488d3bc2a1187d77f5cb8a86303e7775d2 | 48364c2bd5f5807a1475a547f0cf62e2e1ce18b4 | /src/main/java/org/satya/intern/java_mail_API/SendMailBySite.java | eb289a533c4921a921781806c2f755639f031aab | [
"Apache-2.0"
] | permissive | SATYAKRISHNAVINJAMURI/JavaMailAPI | 27e7b34123456986ba20302a8fdd63a4a7d0edd0 | fb30a18793791bd3a61820142303d86ff9f24dfd | refs/heads/master | 2020-03-17T21:59:14.418588 | 2018-05-22T20:54:48 | 2018-05-22T20:54:48 | 133,976,086 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,454 | java | package org.satya.intern.java_mail_API;
import java.io.IOException;
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
public class SendMailBySite {
public static void main(String[] args) throws IOException {
final Properties prop = new Properties();
prop.load(new SendMailBySite().getClass().getClassLoader().getResourceAsStream("config.resources"));
//Get the session object
Properties props = new Properties();
props.put("mail.smtp.host", prop.getProperty("HOST_SERVER"));
props.put("mail.smtp.auth", "true");
Session session = Session.getDefaultInstance(props,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(prop.getProperty("USER_NAME"), prop.getProperty("PASSWORD"));
}
});
//Compose the message
try {
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(prop.getProperty("USER_NAME")));
message.addRecipient(Message.RecipientType.TO,new InternetAddress(prop.getProperty("PASSWORD")));
message.setSubject("javatpoint");
message.setText("This is simple program of sending email using JavaMail API");
//send the message
Transport.send(message);
System.out.println("message sent successfully...");
}
catch (MessagingException e) {e.printStackTrace();}
}
} | [
"satyakrishnavinjamuri868@gmail.com"
] | satyakrishnavinjamuri868@gmail.com |
f643c229b12e04bf376ebee86969ec171a35a7e4 | 5d8a9621a730b9c604430245d7c170d640581135 | /jiehang-product-parent/product-service/src/main/java/cn/itsource/jiehang/controller/ProductController.java | eb066f79ba1e2576ccf86a9c1689a5fbc62390d3 | [] | no_license | TianXin110201/jiehang-parent | 7dd44ecccb765542309c32f42e2c7d4155c6d742 | 5b67afd1733b280904cc495ad5b0652b6ee9b7b9 | refs/heads/master | 2020-05-22T07:05:01.566685 | 2019-05-17T00:42:54 | 2019-05-17T00:42:54 | 186,257,491 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,580 | java | package cn.itsource.jiehang.controller;
import cn.itsource.jiehang.query.ProductQuery;
import cn.itsource.jiehang.service.IProductService;
import cn.itsource.jiehang.domain.Product;
import cn.itsource.jiehang.util.AjaxResult;
import cn.itsource.jiehang.util.PageList;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
public class ProductController {
@Autowired
public IProductService productService;
/**
* 保存和修改公用的
* @param product 传递的实体
* @return Ajaxresult转换结果
*/
@RequestMapping(value="/product",method= RequestMethod.POST)
public AjaxResult save(@RequestBody Product product){
try {
if(product.getId()!=null){
productService.updateById(product);
}else{
productService.save(product);
}
return AjaxResult.me();
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.me().setMessage("保存对象失败!"+e.getMessage());
}
}
/**
* 删除对象信息
* @param id
* @return
*/
@RequestMapping(value="/product/{id}",method=RequestMethod.DELETE)
public AjaxResult delete(@PathVariable("id") Long id){
try {
productService.removeById(id);
return AjaxResult.me();
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.me().setMessage("删除对象失败!"+e.getMessage());
}
}
//获取
@RequestMapping(value = "/product/{id}",method = RequestMethod.GET)
public Product get(@PathVariable("id") Long id)
{
return productService.getById(id);
}
/**
* 查看所有信息
* @return
*/
@RequestMapping(value = "/product/list",method = RequestMethod.GET)
public List<Product> list(){
return productService.list();
}
/**
* 分页查询数据
*
* @param query 查询对象
* @return PageList 分页对象
*/
@RequestMapping(value = "/product/page",method = RequestMethod.POST)
public PageList<Product> json(@RequestBody ProductQuery query)
{
IPage<Product> productIPage = productService.page(new Page<>(query.getPage(), query.getSize()));
return new PageList<>(productIPage.getTotal(),productIPage.getRecords());
}
}
| [
"tx@itsource"
] | tx@itsource |
533cada929a2e3618105ba0a2101e5ef15aa6a00 | ac135c116f96eec9a31bf3b53f46c1ff742d581c | /account-email/src/main/java/com/kilogate/account/email/AccountEmailServiceImpl.java | da13f62609e00b6b2428e94c2639eaf86df2cfbd | [] | no_license | kilogate/account | fbfbd35f06fc617f25cab4302ccb2b9733698e29 | 09c321578f1acdc176633a53912e6e78f4b3cc73 | refs/heads/master | 2021-01-09T06:41:37.164419 | 2017-02-07T02:47:11 | 2017-02-07T02:47:11 | 81,055,660 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,422 | java | package com.kilogate.account.email;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
/**
* Created by kilogate on 2017/2/4.
*/
public class AccountEmailServiceImpl implements AccountEmailService {
private JavaMailSender javaMailSender;
private String systemEmail;
public void sendMail(String to, String subject, String htmlText) throws AccountEmailException {
try {
MimeMessage msg = javaMailSender.createMimeMessage();
MimeMessageHelper msgHelper = new MimeMessageHelper(msg);
msgHelper.setFrom(systemEmail);
msgHelper.setTo(to);
msgHelper.setSubject(subject);
msgHelper.setText(htmlText, true);
javaMailSender.send(msg);
} catch (MessagingException e) {
e.printStackTrace();
throw new AccountEmailException("Failed to send email.", e);
}
}
public JavaMailSender getJavaMailSender() {
return javaMailSender;
}
public void setJavaMailSender(JavaMailSender javaMailSender) {
this.javaMailSender = javaMailSender;
}
public String getSystemEmail() {
return systemEmail;
}
public void setSystemEmail(String systemEmail) {
this.systemEmail = systemEmail;
}
} | [
"fengquanwei@58ganji.com"
] | fengquanwei@58ganji.com |
10b373d96d65b69ab777bbbef567b96797e9adac | 7b27edd07290c813efd9a1bbb08b2cbb06ab798f | /src/Interview_question/String_Occurence_unique.java | 5a161b9414bbf4ec3f03c2f61950b274081103fc | [] | no_license | rp21india/java_programs | b72cdd4f3fab8ada06b450dcf27470d3e0eb204f | 7df27b94499855a536afc844990950015e010a8a | refs/heads/master | 2020-03-28T09:51:41.191299 | 2018-09-08T20:53:30 | 2018-09-08T20:53:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,266 | java | package Interview_question;
import java.util.*;
public class String_Occurence_unique {
static final int MAX_CHAR = 256;
static void getOccuringChar(String str) {
// Create an array of size 256 i.e. ASCII_SIZE
int count[] = new int[MAX_CHAR];
int len = str.length();
// Initialize count array index
for (int i = 0; i < len; i++)
count[str.charAt(i)]++;
// Create an array of given String size
char ch[] = new char[str.length()];
for (int i = 0; i < len; i++) {
ch[i] = str.charAt(i);
int find = 0;
for (int j = 0; j <= i; j++) {
// If any matches found
if (str.charAt(i) == ch[j])
find++;
}
if (find == 1)
System.out.println("Number of Occurrence of " +
str.charAt(i) + " is:" + count[str.charAt(i)]);
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("ente string");
String str=sc.nextLine();
// String str = "geeksforgeeks";
getOccuringChar(str);
}
}
| [
"39995590+rp21india@users.noreply.github.com"
] | 39995590+rp21india@users.noreply.github.com |
05583a174398d02d426b7e6af2cad375c554d95d | c4c264cb3b5282b9e7effea5cc2357b974926c37 | /doitExample/src/firstExam/Operator.java | 0c8ae0e534c307f0833e27166f523c8ea2f85051 | [] | no_license | dongpani/doitjavaex | bee9962f99fde5886e1395655fd932eaacb37291 | efa7f16b74c38243d4fa2ec8f39b96464ed107e6 | refs/heads/master | 2020-11-28T21:09:36.851661 | 2019-12-25T07:24:41 | 2019-12-25T07:24:41 | 229,920,719 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 920 | java | package firstExam;
public class Operator {
public static void main(String[] args) {
int num = 10;
int num2 = 2;
char operator = '+';
/*
if(operator == '+') {
System.out.println(num + num2);
}else if(operator == '-') {
System.out.println(num - num2);
}else if(operator == '*') {
System.out.println(num * num2);
}else if(operator == '/') {
System.out.println(num / num2);
}else {
System.out.println("�ùٸ� �����ڰ� �ƴմϴ�.");
}
*/
switch (operator) {
case '+':
System.out.println(num + num2);
break;
case '-':
System.out.println(num - num2);
break;
case '*':
System.out.println(num * num2);
break;
case '/':
System.out.println(num / num2);
break;
default:
System.out.println("�ùٸ� �����ڰ� �ƴմϴ�.");
break;
}
}
}
| [
"power@DESKTOP-IPICNTI"
] | power@DESKTOP-IPICNTI |
64ad7b11b522ab888d53fa31a45b88befbf6e752 | ecc4f0f104f9287c0644fbf5433dbca62072cc13 | /src/main/java/com/example/demo/security/UserDetailsServiceImpl.java | 9b119a034ea142aec84db7acaaf6a866612130a1 | [] | no_license | yuxiRen/eCommerce | 2b2d8769a3c7f5397e20ba0fc608bb3521fefcf8 | 5c67db80af4d4bf1754c8095ec83cc8c14f24a61 | refs/heads/master | 2023-02-03T13:58:57.038761 | 2020-12-16T08:36:08 | 2020-12-16T08:36:08 | 317,756,895 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,074 | java | package com.example.demo.security;
import com.example.demo.model.persistence.User;
import com.example.demo.model.persistence.repositories.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import java.util.Collections;
@Service
public class UserDetailsServiceImpl implements UserDetailsService {
@Autowired
private UserRepository userRepository;
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
User appUser = userRepository.findByUsername(username);
if (appUser == null) {
throw new UsernameNotFoundException(username);
}
return new org.springframework.security.core.userdetails.User(appUser.getUsername(), appUser.getPassword(), Collections.emptyList());
}
}
| [
"rita.ren.yuxi@gmail.com"
] | rita.ren.yuxi@gmail.com |
06729960d7ea75159541438550824c30f8fff58d | 71dd2ee7514241cbebc2a50104dd06182b5c83e6 | /src/com/wz/option/addMusicMTY.java | 935f0d7f4b3339c2b9697fbaf4b8a41d9b62b813 | [] | no_license | gzbitzxx/WZMusicDevelopment | 26b1b11ad9b77419409734abbf078f0b3acd5c22 | c368a5e8094db4a8a2c01a719a25e3606dad27ea | refs/heads/master | 2021-07-11T09:06:13.922657 | 2017-10-15T13:52:04 | 2017-10-15T13:52:04 | 104,417,254 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 804 | java | package com.wz.option;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.wz.dto.MusicTypeDto;
import com.wz.test.MusicTypeCRUD;
public class addMusicMTY extends BaseServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
// 实例化
MusicTypeCRUD musicType = new MusicTypeCRUD();
List <MusicTypeDto> types=musicType.getMusicType();
request.setAttribute("types", types);
request.getRequestDispatcher("Admin/Music/AddMusic.jsp").forward(request, response);
}
}
| [
"1123195494@qq.com"
] | 1123195494@qq.com |
cddcc6be66a83128089d74ee37f3237c84734b6e | 641c06862760db5daf7c72d9b8e8edb69dd4a294 | /src/main/java/com/zxw/wx/controller/LoginController.java | a00f697eacfc79c881641f2f38320ce6187db963 | [] | no_license | zhangxuewei1263944101/QiYeWeiXin | a234b25af58c32aa7f46d57d0f73ca015487122b | fbdf1ffb4e4cb7840403fa96d79b8708065d19f9 | refs/heads/master | 2022-09-28T01:36:05.809087 | 2019-12-04T09:58:03 | 2019-12-04T09:58:03 | 225,822,076 | 10 | 7 | null | 2021-06-04T02:21:08 | 2019-12-04T08:55:42 | Java | UTF-8 | Java | false | false | 1,923 | java | package com.zxw.wx.controller;
import com.zxw.wx.entity.User;
import com.zxw.wx.entity.common.AppConstant;
import com.zxw.wx.entity.common.BaseRes;
import com.zxw.wx.entity.dto.WeiXinUserInfoDTO;
import com.zxw.wx.service.WeiXinService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpSession;
import java.io.UnsupportedEncodingException;
@Controller
public class LoginController {
@Autowired
private WeiXinService weiXinService;
@RequestMapping({"", "login"}) //这里为空或者是login都能进入该方法
public String tiaoZhuan() {
return "login";
}
/**
*加载二维码
* @return
*/
@RequestMapping(value = "getErWeiMa",method = RequestMethod.GET)
@ResponseBody
private BaseRes getErWeiMa() throws UnsupportedEncodingException {
BaseRes res = new BaseRes(0);
res.setData(weiXinService.loginGetErWeiMa());
return res;
}
/**
* 根据扫码返回的code去查询用户的id
* 根据用户的id查询用户的信息
* 根据得到的用户信息(可根据手机号)和本地数据库进行比对,如果存在即可登录或者做一些其他的操作
* @param session
* @param code
* @return
*/
@RequestMapping(value = "existUser",method = RequestMethod.GET)
private String getCode(HttpSession session,String code) {
BaseRes res = new BaseRes(0);
String userId = weiXinService.getUserID(code);
WeiXinUserInfoDTO weiXinUserInfoDTO = weiXinService.getUserInfo(userId);
session.setAttribute("user_session",weiXinUserInfoDTO);
return "index";
}
}
| [
"1263944101@qq.com"
] | 1263944101@qq.com |
d5c8e106157ba4b0481aaf5da6350e660e1acbcf | 024888210a320d9c68e3ab05840c59205fc5b8aa | /src/main/java/com/mikey/shredhub/api/dao/ShredderDAOImpl.java | 567079ee3ece3b24e10d4a350f17d56d1297c8d7 | [] | no_license | sslash/api | 80188f2e717365fd1a5ba846ecbfb667ba107cb1 | f28310f89174aaa66497d79fe0ceb6b165c193f6 | refs/heads/master | 2019-01-23T02:48:29.022591 | 2013-04-05T09:37:12 | 2013-04-05T09:37:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,140 | java | package com.mikey.shredhub.api.dao;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import com.mikey.shredhub.api.domain.GuitarForShredder;
import com.mikey.shredhub.api.domain.Shredder;
@Service
public class ShredderDAOImpl implements ShredderDAO {
private static final Logger logger = LoggerFactory.getLogger(ShredderDAOImpl.class);
private static final String GET_SHREDDER_ID_BY_NAME = "SELECT id FROM Shredder WHERE Username=?";
public static final String SHREDDER_SQL = "sr.Id AS sr_id, sr.Username, " +
"sr.BirthDate, sr.Email, sr.Password, sr.Description AS sr_description, " +
"sr.Country, sr.TimeCreated AS sr_timeCreated, sr.ProfileImage, " +
"sr.ExperiencePoints, sr.ShredderLevel, gs.guitar AS guitarName, " +
"gs.ImgPath AS guitarImgPath, gs.Digs as guitarDigs, es.equiptment";
@Autowired
private JdbcTemplate jdbcTemplate;
public void addShredder(Shredder shredder) {
String sql = "INSERT INTO Shredder VALUES (DEFAULT,?,?,?,?,?,?,DEFAULT, ?)";
jdbcTemplate.update(sql, shredder.getUsername(),
shredder.getBirthdate(), shredder.getEmail(),
shredder.getPassword(), shredder.getDescription(),
shredder.getCountry(), shredder.getProfileImagePath());
shredder.setId(queryForIdentity(shredder.getUsername()));
insertGuitarsForShredder(shredder.getId(), shredder.getGuitars());
insertEquiptmentForShredder(shredder.getId(), shredder.getEquiptment());
insertUserRole(shredder.getId());
}
private void insertUserRole(int id) {
jdbcTemplate.update("INSERT INTO UserRole VALUES (DEFAULT, ?, DEFAULT)", id);
}
private void insertGuitarsForShredder(int id, List<GuitarForShredder> list) {
for ( GuitarForShredder g : list) {
jdbcTemplate.update("INSERT INTO GuitarForShredder VALUES(?,?)",
g.getName(), id);
}
}
private void insertEquiptmentForShredder(int id, List <String> equiptment) {
for ( String g : equiptment) {
jdbcTemplate.update("INSERT INTO EquiptmentForShredder VALUES(?,?)",
g, id);
}
}
private int queryForIdentity(String username) {
return jdbcTemplate.queryForInt(GET_SHREDDER_ID_BY_NAME, username);
}
public Shredder getShredderByUsernameAndPassword(final String username,
final String password) {
String sql = "SELECT "+SHREDDER_SQL+" FROM Shredder sr, GuitarForShredder " +
"gs, EquiptmentForShredder es WHERE sr.id = gs.ShredderId and sr.id = es.ShredderId AND Username=?";
try {
List<Shredder> res = jdbcTemplate.query(sql, new Object [] {username}, new ShredderMapper());
Shredder toRet = res.get(0);
if ( !password.equals(toRet.getPassword()))
return null;
return toRet;
} catch (DataAccessException e) {
System.err.println("failed to get user: " + e.getMessage() + " " + e.getLocalizedMessage());
return null;
}
}
// This one and the one below is totally equal. Could do something with that..
public List<Shredder> getAllShredders(int page) {
String sql = "SELECT " + SHREDDER_SQL + " FROM Shredder sr, GuitarForShredder " +
"gs, EquiptmentForShredder es WHERE sr.id = gs.ShredderId and sr.id = es.ShredderId "
+ " ORDER BY timeCreated DESC LIMIT 20 OFFSET " + page*20;
try {
return jdbcTemplate.query(sql, new ShredderMapper());
} catch (DataAccessException e) {
System.out.println("getAllShredders: " + e.getMessage());
return new ArrayList<Shredder>();
}
}
public List<Shredder> getFansForShredderWithId(int id) {
try {
String sql = "SELECT "+SHREDDER_SQL+" FROM Shredder sr, GuitarForShredder " +
"gs, EquiptmentForShredder es WHERE sr.id = gs.ShredderId and sr.id = es.ShredderId " +
"AND sr.Id IN (SELECT FaneeId FROM Fan WHERE FanerId=?)";
return jdbcTemplate.query(sql, new Object [] {id}, new ShredderMapper());
} catch (DataAccessException e) {
System.out.println("getFansForShredderWithId " + e.getMessage());
return new ArrayList<Shredder>();
}
}
public void createFanRelation(int faner, int fanee) {
String sql = "INSERT INTO Fan VALUES(?,?,DEFAULT)";
int res = jdbcTemplate.update(sql, faner, fanee);
}
public Shredder getShredderById(int id) {
System.out.println("get shredder by id: " + id);
try {
String sql = "SELECT "+SHREDDER_SQL+" FROM Shredder sr, GuitarForShredder " +
"gs, EquiptmentForShredder es WHERE sr.id = gs.ShredderId " +
"and sr.id = es.ShredderId AND sr.Id=?";
List<Shredder> shredderList = jdbcTemplate.query(sql, new Object [] {id}, new ShredderMapper());
Shredder sh = shredderList.get(0);
// Simple solution to get fanees. Could have done it in one sql as well
sh.setFanees(this.getFansForShredderWithId(id));
return sh;
} catch (DataAccessException e) {
System.out.println("getShredderById: " + e.getMessage());
return null;
}
}
public void persistShredder(Shredder shredder) {
jdbcTemplate.update("UPDATE Shredder SET Username=?, Birthdate=?,Email=?,Password=?" +
",Description=?,Country=?,ProfileImage=?,ExperiencePoints=?, ShredderLevel=?" +
"WHERE Id=?", shredder.getUsername(), shredder.getBirthdate(), shredder.getEmail(),
shredder.getPassword(), shredder.getDescription(), shredder.getCountry(), shredder.getProfileImagePath(),
shredder.getLevel().getXp(), shredder.getLevel().getLevel(), shredder.getId());
// TODO: Persist guitar for shredder
}
// TODO: Add restriction to check if the result is a fanee
public List<Shredder> getPotentialFaneesForShredder(Shredder shredder) {
StringBuilder sql = new StringBuilder("SELECT Distinct ON (sr.id)"+SHREDDER_SQL+
" FROM Shredder sr, GuitarForShredder " +
"gs, EquiptmentForShredder es WHERE sr.id = gs.ShredderId and sr.id = es.ShredderId " +
"and sr.id != ").append(shredder.getId()).append(" and (sr.Country LIKE '%")
.append(shredder.getCountry()).append("%' ");
// Add guitars
for ( GuitarForShredder g : shredder.getGuitars() ) {
sql.append("OR gs.guitar like '").append(g.getName()).append("' ");
}
// Add equiptment
for ( String e : shredder.getEquiptment() ) {
sql.append("OR es.Equiptment like '").append(e).append("' ");
}
sql.append(")");
// Add not fanee restriction
sql.append(" AND sr.id NOT IN ( SELECT faneeId FROM Fan WHERE fanerId = " + shredder.getId() + ") LIMIT 20" );
logger.debug("getPotentialFaneesForShredder() SQL: " + sql.toString());
try {
List<Shredder> res = jdbcTemplate.query(sql.toString(), new ShredderMapper());
return res;
} catch (DataAccessException e) {
return new ArrayList<Shredder>();
}
}
public boolean addDiggForGuitar(String id, String guitarName) {
int shredderId = Integer.parseInt(id);
String SQL = "UPDATE GuitarForShredder SET Digs = Digs+? WHERE ShredderId=? AND Guitar=?";
try{
jdbcTemplate.update(SQL, 1, shredderId, guitarName);
return true;
}catch(DataAccessException e) {
return false;
}
}
}
| [
"michaelgunnulfsen@gmail.com"
] | michaelgunnulfsen@gmail.com |
2071aea392cf538d6c2afffe71de701f3232ba16 | 1d1d5cc1faedbdafb7acc4fa952e17f281eb1ae9 | /shopcontrol/src/main/java/com/wlc/shopcontrol/HelloControler.java | a30d9cceccdd2662cfa649f11cfd97368a9cc48c | [] | no_license | wanglclx/SpringCloudDemo | 5cd06c654bd2b218e22ded13e52d3ed7c17d2df9 | c6e6400495064e5cc3dc408cb71ab09e754db29e | refs/heads/master | 2022-07-15T16:33:25.546845 | 2020-05-11T12:45:00 | 2020-05-11T12:45:00 | 263,031,199 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 584 | java | package com.wlc.shopcontrol;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author: wlc
* @Date: 2020/4/15 11:02
* @Description:
**/
@RestController
public class HelloControler {
@Autowired
HelloService helloService;
@GetMapping(value = "/getName")
public String getName(@RequestParam String name) {
return helloService.mcdsService(name);
}
}
| [
"13698625385@163.com"
] | 13698625385@163.com |
0f8562dea80b0395a90981761acd4ad1d7b95070 | 81f92ff24aa3b637c49d265875a417a09b7b1ae1 | /src/eratos_sieve/SieveBoolArr.java | 382e345ab9241e13b057a138961b58900f490264 | [] | no_license | Ironlenny/Eratos_Sieve | 1c70e4727b0eaab568287a25925404886f7f81b4 | 64a64023ae771ac23098dbf5d72f4165d8fa7350 | refs/heads/master | 2021-01-19T02:19:03.119729 | 2016-11-10T23:48:54 | 2016-11-10T23:48:54 | 73,417,042 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,082 | java | package eratos_sieve;
import java.util.ArrayList;
public class SieveBoolArr {
private ArrayList<Integer> primes = new ArrayList<Integer>();
private boolean markedNums[];
private int newPrime = 2;
private int maxNum;
private boolean insert (int insert) {
if (markedNums[insert]) {}
else {
markedNums[insert] = true;
}
return true;
}
private boolean findPrime (int test) {
boolean pass = false;
if (test > maxNum) {}
else if (!markedNums[test]) {
primes.add(test);
newPrime = test;
pass = true;
}
else {
pass = findPrime (test + 1);
}
return pass;
}
public SieveBoolArr () {
this.maxNum = 100;
primes.add(newPrime);
markedNums = new boolean[maxNum + 1];
}
public SieveBoolArr (int maxNum) {
this.maxNum = maxNum;
primes.add(newPrime);
markedNums = new boolean[maxNum + 1];
}
public ArrayList<Integer> solve () {
int num = 0;
int seq = 2;
do {
num = seq++ * newPrime;
} while ((num <= maxNum) && (insert (num)));
if (findPrime (newPrime + 1)) {
solve();
}
return primes;
}
}
| [
"ironlenny@gmail.com"
] | ironlenny@gmail.com |
e4cf5cc8a7b8fa8e25f38e2d98ff5a1e7da1a0a2 | 5ed9a99dcb57ad87d518cde8e0d57faeeabf8619 | /src/visualization/shapes/shapes3d/FlatSurface.java | 0b4863471d6521cd2079202c08dd674df33e1f08 | [] | no_license | dolatkhahamir/ulib | 54386693a99c51036c57b24cc8094851eb8d24d1 | 8b7c84fb608619368e8bb3e9a72f22816f6998af | refs/heads/master | 2023-03-04T22:08:42.333028 | 2021-02-18T15:01:12 | 2021-02-18T15:01:12 | 340,083,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,022 | java | package visualization.shapes.shapes3d;
import jmath.datatypes.functions.Arc3D;
import jmath.datatypes.tuples.Point3D;
import jmath.functions.utils.Sampling;
import visualization.canvas.CoordinatedScreen;
import java.awt.*;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
@SuppressWarnings("unused")
public final class FlatSurface extends Shape3D {
private Color color;
private final Color fixedColor;
private boolean isFilled;
private float thickness;
public FlatSurface(CoordinatedScreen canvas, Color color, boolean isFilled, float thickness, Point3D... points) {
super(canvas);
this.points.addAll(Arrays.asList(points));
this.thickness = thickness;
this.fixedColor = color;
this.isFilled = isFilled;
this.color = color;
}
public FlatSurface(CoordinatedScreen canvas, Color color, Point3D... points) {
this(canvas, color, true, 2, points);
}
public FlatSurface(CoordinatedScreen canvas, Color color, boolean isFilled, float thickness, List<Point3D> points) {
this(canvas, color, true, 2, points.toArray(new Point3D[] {}));
}
public Color getFixedColor() {
return fixedColor;
}
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
public boolean isFilled() {
return isFilled;
}
public void setFilled(boolean filled) {
isFilled = filled;
}
public float getThickness() {
return thickness;
}
public void setThickness(float thickness) {
this.thickness = thickness;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof FlatSurface)) return false;
FlatSurface flatSurface = (FlatSurface) o;
return Objects.equals(getPoints(), flatSurface.getPoints());
}
@Override
public int hashCode() {
return Objects.hash(getPoints());
}
@Override
public void render(Graphics2D g2d) {
if (!isVisible)
return;
Polygon poly = new Polygon();
for (var p : points)
poly.addPoint(cs.screenX(p.x), cs.screenY(p.y));
g2d.setColor(color);
g2d.setStroke(new BasicStroke(thickness));
if (isFilled) {
g2d.fillPolygon(poly);
} else {
g2d.drawPolygon(poly);
}
super.render(g2d);
}
public static FlatSurface flatSurface(CoordinatedScreen canvas, Color color, double l, double u, double delta, Arc3D arc) {
final var numOfPoints = (int) ((u - l) / delta) + 1;
var ps = new Point3D[numOfPoints];
var sample = Sampling.multiThreadSampling(arc, l, u, delta, 10);
AtomicInteger counter = new AtomicInteger();
sample.forEach(e -> ps[counter.getAndIncrement()] = e);
return new FlatSurface(canvas, color, ps);
}
}
| [
"ahdscience.ce@gmail.com"
] | ahdscience.ce@gmail.com |
63135030f712deb1ef19e6aea406480d71b37c36 | 1bd8cb2df8aa90a1c57e963c689ddcaa98096962 | /Visualizer/tk/exgerm/visualiser/view/painters/VisEdgePainter.java | 3295c070da00639ffa511e229054390548ebced3 | [
"Apache-2.0"
] | permissive | delicb/ExGerm | de5f2c8e9edd2222bfa3c33e3fbec70a4d9b5d54 | d9bc39d4cd4e32b1beb367da1c1d28480c1fe9e5 | refs/heads/master | 2016-09-06T04:59:25.738360 | 2013-08-26T16:50:52 | 2013-08-26T16:50:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,769 | java | package tk.exgerm.visualiser.view.painters;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.GeneralPath;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import tk.exgerm.visualiser.model.VisEdge;
import tk.exgerm.visualiser.model.VisNode;
import tk.exgerm.visualiser.view.VisElementPainter;
public class VisEdgePainter extends VisElementPainter {
protected Shape line;
protected Shape curve;
public VisEdgePainter(VisEdge element) {
super(element);
}
@Override
public boolean isElementAt(Point2D pos) {
if(curve != null)
return ( curve.contains(pos.getX(), pos.getY()) );
return false;
}
private void makeCurve(VisNode node){
GeneralPath gp = new GeneralPath();
gp.moveTo((int) node.getPosition().getX()
+ (int) (node.getSize().width / 2),
(int)node.getPosition().getY()
+ (int) (node).getSize().height / 2);
gp.curveTo((int) node.getPosition().getX()
+ (int) (node.getSize().width)/2 + 200,
(int)node.getPosition().getY()
+ (int) (node).getSize().height/2,
(int) node.getPosition().getX()
+ (int) (node.getSize().width)/2,
(int)node.getPosition().getY()
+ (int) (node).getSize().height/2 - 250,
(int) node.getPosition().getX() + (int) (node.getSize().width)/2,
(int)node.getPosition().getY()+ (int) (node).getSize().height/2) ;
gp.closePath();
curve = gp;
}
private void makeLine(VisEdge e){
Line2D linee = new Line2D.Double((int) e.getSource().getPosition().getX()
+ (int) (e.getSource().getSize().width / 2), (int) e
.getSource().getPosition().getY()
+ (int) (e.getSource().getSize().height / 2), (int) e
.getDestination().getPosition().getX()
+ (int) (e.getDestination().getSize().width / 2), (int) e
.getDestination().getPosition().getY()
+ (int) (e.getDestination().getSize().height / 2));
line = linee;
}
@Override
public void paint(Graphics2D g) {
VisEdge e = (VisEdge) element;
g.setColor((Color) e.getPaint());
g.setStroke(e.getStroke());
if(e.getSource() == e.getDestination()){
VisNode node = e.getSource();
makeCurve(node);
g.draw(curve);
if (((VisEdge) this.element).isDirected()) {
GeneralPath tri = new GeneralPath();
tri.moveTo(0, 0);
tri.lineTo(50, 0);
tri.lineTo(70,-10);
tri.lineTo(70, 10);
tri.lineTo(50, 0);
tri.closePath();
AffineTransform transform = new AffineTransform();
transform.rotate(-Math.PI/2 + Math.PI/30);
tri.transform(transform);
g.translate((int) node.getPosition().getX()
+ (int) (node.getSize().width / 2),
(int)node.getPosition().getY()
+ (int) (node).getSize().height / 2);
g.draw(tri);
g.translate(-((int) node.getPosition().getX()
+ (int) (node.getSize().width / 2)),
-((int)node.getPosition().getY()
+ (int) (node).getSize().height / 2));
}
}
else{
makeLine(e);
g.draw(line);
if (((VisEdge) this.element).isDirected()) {
Point p2 = (Point) e.getDestination().getPosition();
Point p1 = (Point) e.getSource().getPosition();
double x1 = p1.x;
double y1 = p1.y;
double x2 = p2.x;
double y2 = p2.y;
double x = Math.abs(x1-x2);
double y = Math.abs(y1-y2);
double alpha = Math.atan(x/y);
GeneralPath tri = new GeneralPath();
tri.moveTo(0, 0);
tri.lineTo(50, 0);
tri.lineTo(70,-10);
tri.lineTo(70, 10);
tri.lineTo(50, 0);
tri.closePath();
AffineTransform transform = new AffineTransform();
double angle = alpha;
if( (e.getDestination().getPosition().getX() < e.getSource().getPosition().getX()) && (e.getDestination().getPosition().getY() < e.getSource().getPosition().getY())){
angle = -alpha + Math.PI/2;
}
if( (e.getDestination().getPosition().getX() > e.getSource().getPosition().getX()) && (e.getDestination().getPosition().getY() > e.getSource().getPosition().getY())){
angle = -alpha - Math.PI/2;
}
if( (e.getDestination().getPosition().getX() < e.getSource().getPosition().getX()) && (e.getDestination().getPosition().getY() > e.getSource().getPosition().getY())){
angle = alpha - Math.PI/2;
}
if( (e.getDestination().getPosition().getX() > e.getSource().getPosition().getX()) && (e.getDestination().getPosition().getY() < e.getSource().getPosition().getY())){
angle = alpha + Math.PI/2;
}
if( e.getDestination().getPosition().getX() == e.getSource().getPosition().getX() ){
if(e.getDestination().getPosition().getY() < e.getSource().getPosition().getY()){
angle = Math.PI/2;
}
if(e.getDestination().getPosition().getY() > e.getSource().getPosition().getY()){
angle = - Math.PI/2;
}
}
if( e.getDestination().getPosition().getY() == e.getSource().getPosition().getY() ){
if(e.getDestination().getPosition().getX() < e.getSource().getPosition().getX()){
angle = 0;
}
if(e.getDestination().getPosition().getX() > e.getSource().getPosition().getX()){
angle =- Math.PI;
}
}
transform.setToRotation(angle);
tri.transform(transform);
g.translate((int) e.getDestination().getPosition().getX()
+ (int) (e.getDestination().getSize().width / 2), (int) e
.getDestination().getPosition().getY()
+ (int) (e.getDestination().getSize().height / 2));
g.draw(tri);
g.translate(-((int) e.getDestination().getPosition().getX()
+ (int) (e.getDestination().getSize().width / 2)), -((int) e
.getDestination().getPosition().getY()
+ (int) (e.getDestination().getSize().height / 2)));
}
}
}
}
| [
"bojan@delic.in.rs"
] | bojan@delic.in.rs |
50a230751f8b873587160cc011b9705720b96d36 | 171167f7e54fb0e5b43735e77a342994a93b1c5b | /warlord-much/src/main/java/com/suood/algorithm/skiplist/AbstractSortedSet.java | 821f4da54a50376a80f346ea89a96ea544722700 | [] | no_license | suood/warlord | 87e9c4c1e1ce1aa5c191a7561c7ced824ac576c1 | 49f11510af4c340990cadd49d692ad7d8c912e27 | refs/heads/master | 2022-12-22T01:21:48.197704 | 2021-11-24T01:27:29 | 2021-11-24T01:27:29 | 8,881,683 | 3 | 2 | null | 2022-12-12T21:42:45 | 2013-03-19T15:16:30 | Java | UTF-8 | Java | false | false | 707 | java | package com.suood.algorithm.skiplist;
import java.util.AbstractSet;
import java.util.Comparator;
import java.util.Iterator;
import java.util.SortedSet;
abstract class AbstractSortedSet<E>
extends AbstractSet<E>
implements SortedSet<E> {
public E first() {
return null;
}
public E last() {
return null;
}
public Iterator<E> iterator() {
return null;
}
public SortedSet<E> headSet(E toElement) {
return null;
}
public SortedSet<E> tailSet(E fromElement) {
return null;
}
public SortedSet<E> subSet(E fromElement, E toElement) {
return null;
}
public Comparator<? super E> comparator() {
return null; // uses natural ordering
}
} | [
"mysq1@gmail.com"
] | mysq1@gmail.com |
68baed3f888d86e2dc798d18e20a27a7dd116e20 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/13/13_19c6fac79b7d7ee4374582136eb9dba4a281e819/WaterFeature/13_19c6fac79b7d7ee4374582136eb9dba4a281e819_WaterFeature_s.java | 30e66d809a973b3b5956200630ddb443c834361a | [] | 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 | 2,138 | java | /*******************************************************************************
* Copyright (c) 2013 RiverBaSim - River Basin scenario Simulator
*
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Luis Oliva - Created class and main functionalities
******************************************************************************/
package riverbasim;
import java.util.HashMap;
import repast.simphony.engine.environment.RunEnvironment;
/**
* This class represents the data structure describing a feature of water
* (e.g., amount, solid concentration...). It is used internally to implement
* a basic structure to store historical data about a feature, thus allowing
* decoupling agents logic with regards to the order of execution of their behaviors
* @author Luis
*
*/
public class WaterFeature {
private HashMap<Integer,Double> feature;
public WaterFeature(Number tick, Double amount){
this.feature = new HashMap<Integer, Double>();
this.feature.put(0, amount);
this.feature.put(tick.intValue(), amount);
this.feature.put(tick.intValue()+1, amount);
}
public WaterFeature(){
this.feature = new HashMap<Integer, Double>();
}
public HashMap<Integer,Double> getFeature(){
return this.feature;
}
public Double get(Integer tick){
return this.feature.get(tick);
}
public void put(Integer tick, Double amount){
this.feature.put(tick, amount);
}
public String toString(){
/*
Set<Integer> keys = this.feature.keySet();
Iterator<Integer> itr = keys.iterator();
String result = "";
while (itr.hasNext()){
Integer tick = itr.next();
result += tick+":"+this.feature.get(tick)+"|";
}
return result;
*/
Double tick = RunEnvironment.getInstance().getCurrentSchedule().getTickCount();
String result = this.feature.get(tick.intValue()).toString();
return result;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
e2001357119160c9b86faf943df543c0a482d796 | 7df2f1af2b7fcc3548470caeb010ed81894ff9cc | /1.1/app/src/main/java/com/bluemouse/kid/bluemouse/Bubble/BubbleDrawable.java | 34b2f4df03ac2a8bcd51061d47fad63133de5abb | [] | no_license | privateaccout/BlueMouse | e9f066af9437983fef6ddf84247181442abc020c | efc4a2c9041abcc27c00b5c0d28a5c3aa696ab30 | refs/heads/master | 2021-01-19T13:56:10.373485 | 2017-02-19T04:21:32 | 2017-02-19T04:21:32 | 82,434,367 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,280 | java | package com.bluemouse.kid.bluemouse.Bubble;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.Drawable;
/**
* Created by lgp on 2015/3/24.
*/
public class BubbleDrawable extends Drawable {
private RectF mRect;
private Path mPath = new Path();
private BitmapShader mBitmapShader;
private Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private float mArrowWidth;
private float mAngle;
private float mArrowHeight;
private float mArrowPosition;
private int bubbleColor;
private Bitmap bubbleBitmap;
private ArrowLocation mArrowLocation;
private BubbleType bubbleType;
private boolean mArrowCenter;
private BubbleDrawable(Builder builder) {
this.mRect = builder.mRect;
this.mAngle = builder.mAngle;
this.mArrowHeight = builder.mArrowHeight;
this.mArrowWidth = builder.mArrowWidth;
this.mArrowPosition = builder.mArrowPosition;
this.bubbleColor = builder.bubbleColor;
this.bubbleBitmap = builder.bubbleBitmap;
this.mArrowLocation = builder.mArrowLocation;
this.bubbleType = builder.bubbleType;
this.mArrowCenter = builder.arrowCenter;
}
@Override
protected void onBoundsChange(Rect bounds) {
super.onBoundsChange(bounds);
}
@Override
public void draw(Canvas canvas) {
setUp(canvas);
}
@Override
public int getOpacity() {
return PixelFormat.TRANSLUCENT;
}
@Override
public void setAlpha(int alpha) {
mPaint.setAlpha(alpha);
}
@Override
public void setColorFilter(ColorFilter cf) {
mPaint.setColorFilter(cf);
}
private void setUpPath(ArrowLocation mArrowLocation, Path path) {
switch (mArrowLocation) {
case LEFT:
setUpLeftPath(mRect, path);
break;
case RIGHT:
setUpRightPath(mRect, path);
break;
case TOP:
setUpTopPath(mRect, path);
break;
case BOTTOM:
setUpBottomPath(mRect, path);
break;
}
}
private void setUp(Canvas canvas) {
switch (bubbleType) {
case COLOR:
mPaint.setColor(bubbleColor);
break;
case BITMAP:
if (bubbleBitmap == null)
return;
if (mBitmapShader == null) {
mBitmapShader = new BitmapShader(bubbleBitmap,
Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
}
mPaint.setShader(mBitmapShader);
setUpShaderMatrix();
break;
}
setUpPath(mArrowLocation, mPath);
canvas.drawPath(mPath, mPaint);
}
private void setUpLeftPath(RectF rect, Path path) {
if (mArrowCenter) {
mArrowPosition = (rect.bottom - rect.top) / 2 - mArrowWidth / 2;
}
path.moveTo(mArrowWidth + rect.left + mAngle, rect.top);
path.lineTo(rect.width() - mAngle, rect.top);
path.arcTo(new RectF(rect.right - mAngle, rect.top, rect.right,
mAngle + rect.top), 270, 90);
path.lineTo(rect.right, rect.bottom - mAngle);
path.arcTo(new RectF(rect.right - mAngle, rect.bottom - mAngle,
rect.right, rect.bottom), 0, 90);
path.lineTo(rect.left + mArrowWidth + mAngle, rect.bottom);
path.arcTo(new RectF(rect.left + mArrowWidth, rect.bottom - mAngle,
mAngle + rect.left + mArrowWidth, rect.bottom), 90, 90);
path.lineTo(rect.left + mArrowWidth, mArrowHeight + mArrowPosition);
path.lineTo(rect.left, mArrowPosition + mArrowHeight / 2);
path.lineTo(rect.left + mArrowWidth, mArrowPosition);
path.lineTo(rect.left + mArrowWidth, rect.top + mAngle);
path.arcTo(new RectF(rect.left + mArrowWidth, rect.top, mAngle
+ rect.left + mArrowWidth, mAngle + rect.top), 180, 90);
path.close();
}
private void setUpTopPath(RectF rect, Path path) {
if (mArrowCenter) {
mArrowPosition = (rect.right - rect.left) / 2 - mArrowWidth / 2;
}
path.moveTo(rect.left + Math.min(mArrowPosition, mAngle), rect.top + mArrowHeight);
path.lineTo(rect.left + mArrowPosition, rect.top + mArrowHeight);
path.lineTo(rect.left + mArrowWidth / 2 + mArrowPosition, rect.top);
path.lineTo(rect.left + mArrowWidth + mArrowPosition, rect.top + mArrowHeight);
path.lineTo(rect.right - mAngle, rect.top + mArrowHeight);
path.arcTo(new RectF(rect.right - mAngle,
rect.top + mArrowHeight, rect.right, mAngle + rect.top + mArrowHeight), 270, 90);
path.lineTo(rect.right, rect.bottom - mAngle);
path.arcTo(new RectF(rect.right - mAngle, rect.bottom - mAngle,
rect.right, rect.bottom), 0, 90);
path.lineTo(rect.left + mAngle, rect.bottom);
path.arcTo(new RectF(rect.left, rect.bottom - mAngle,
mAngle + rect.left, rect.bottom), 90, 90);
path.lineTo(rect.left, rect.top + mArrowHeight + mAngle);
path.arcTo(new RectF(rect.left, rect.top + mArrowHeight, mAngle
+ rect.left, mAngle + rect.top + mArrowHeight), 180, 90);
path.close();
}
private void setUpRightPath(RectF rect, Path path) {
if (mArrowCenter) {
mArrowPosition = (rect.bottom - rect.top) / 2 - mArrowWidth / 2;
}
path.moveTo(rect.left + mAngle, rect.top);
path.lineTo(rect.width() - mAngle - mArrowWidth, rect.top);
path.arcTo(new RectF(rect.right - mAngle - mArrowWidth,
rect.top, rect.right - mArrowWidth, mAngle + rect.top), 270, 90);
path.lineTo(rect.right - mArrowWidth, mArrowPosition);
path.lineTo(rect.right, mArrowPosition + mArrowHeight / 2);
path.lineTo(rect.right - mArrowWidth, mArrowPosition + mArrowHeight);
path.lineTo(rect.right - mArrowWidth, rect.bottom - mAngle);
path.arcTo(new RectF(rect.right - mAngle - mArrowWidth, rect.bottom - mAngle,
rect.right - mArrowWidth, rect.bottom), 0, 90);
path.lineTo(rect.left + mArrowWidth, rect.bottom);
path.arcTo(new RectF(rect.left, rect.bottom - mAngle,
mAngle + rect.left, rect.bottom), 90, 90);
path.arcTo(new RectF(rect.left, rect.top, mAngle
+ rect.left, mAngle + rect.top), 180, 90);
path.close();
}
private void setUpBottomPath(RectF rect, Path path) {
if (mArrowCenter) {
mArrowPosition = (rect.right - rect.left) / 2 - mArrowWidth / 2;
}
path.moveTo(rect.left + mAngle, rect.top);
path.lineTo(rect.width() - mAngle, rect.top);
path.arcTo(new RectF(rect.right - mAngle,
rect.top, rect.right, mAngle + rect.top), 270, 90);
path.lineTo(rect.right, rect.bottom - mArrowHeight - mAngle);
path.arcTo(new RectF(rect.right - mAngle, rect.bottom - mAngle - mArrowHeight,
rect.right, rect.bottom - mArrowHeight), 0, 90);
path.lineTo(rect.left + mArrowWidth + mArrowPosition, rect.bottom - mArrowHeight);
path.lineTo(rect.left + mArrowPosition + mArrowWidth / 2, rect.bottom);
path.lineTo(rect.left + mArrowPosition, rect.bottom - mArrowHeight);
path.lineTo(rect.left + Math.min(mAngle, mArrowPosition), rect.bottom - mArrowHeight);
path.arcTo(new RectF(rect.left, rect.bottom - mAngle - mArrowHeight,
mAngle + rect.left, rect.bottom - mArrowHeight), 90, 90);
path.lineTo(rect.left, rect.top + mAngle);
path.arcTo(new RectF(rect.left, rect.top, mAngle
+ rect.left, mAngle + rect.top), 180, 90);
path.close();
}
private void setUpShaderMatrix() {
float scale;
Matrix mShaderMatrix = new Matrix();
mShaderMatrix.set(null);
int mBitmapWidth = bubbleBitmap.getWidth();
int mBitmapHeight = bubbleBitmap.getHeight();
float scaleX = getIntrinsicWidth() / (float) mBitmapWidth;
float scaleY = getIntrinsicHeight() / (float) mBitmapHeight;
scale = Math.min(scaleX, scaleY);
mShaderMatrix.postScale(scale, scale);
mShaderMatrix.postTranslate(mRect.left, mRect.top);
mBitmapShader.setLocalMatrix(mShaderMatrix);
}
@Override
public int getIntrinsicWidth() {
return (int) mRect.width();
}
@Override
public int getIntrinsicHeight() {
return (int) mRect.height();
}
public static class Builder {
public static float DEFAULT_ARROW_WITH = 25;
public static float DEFAULT_ARROW_HEIGHT = 25;
public static float DEFAULT_ANGLE = 20;
public static float DEFAULT_ARROW_POSITION = 50;
public static int DEFAULT_BUBBLE_COLOR = Color.RED;
private RectF mRect;
private float mArrowWidth = DEFAULT_ARROW_WITH;
private float mAngle = DEFAULT_ANGLE;
private float mArrowHeight = DEFAULT_ARROW_HEIGHT;
private float mArrowPosition = DEFAULT_ARROW_POSITION;
private int bubbleColor = DEFAULT_BUBBLE_COLOR;
private Bitmap bubbleBitmap;
private BubbleType bubbleType = BubbleType.COLOR;
private ArrowLocation mArrowLocation = ArrowLocation.LEFT;
private boolean arrowCenter;
public Builder rect(RectF rect) {
this.mRect = rect;
return this;
}
public Builder arrowWidth(float mArrowWidth) {
this.mArrowWidth = mArrowWidth;
return this;
}
public Builder angle(float mAngle) {
this.mAngle = mAngle * 2;
return this;
}
public Builder arrowHeight(float mArrowHeight) {
this.mArrowHeight = mArrowHeight;
return this;
}
public Builder arrowPosition(float mArrowPosition) {
this.mArrowPosition = mArrowPosition;
return this;
}
public Builder bubbleColor(int bubbleColor) {
this.bubbleColor = bubbleColor;
bubbleType(BubbleType.COLOR);
return this;
}
public Builder bubbleBitmap(Bitmap bubbleBitmap) {
this.bubbleBitmap = bubbleBitmap;
bubbleType(BubbleType.BITMAP);
return this;
}
public Builder arrowLocation(ArrowLocation arrowLocation) {
this.mArrowLocation = arrowLocation;
return this;
}
public Builder bubbleType(BubbleType bubbleType) {
this.bubbleType = bubbleType;
return this;
}
public Builder arrowCenter(boolean arrowCenter) {
this.arrowCenter = arrowCenter;
return this;
}
public BubbleDrawable build() {
if (mRect == null) {
throw new IllegalArgumentException("BubbleDrawable Rect can not be null");
}
return new BubbleDrawable(this);
}
}
public enum ArrowLocation {
LEFT(0x00),
RIGHT(0x01),
TOP(0x02),
BOTTOM(0x03);
private int mValue;
ArrowLocation(int value) {
this.mValue = value;
}
public static ArrowLocation mapIntToValue(int stateInt) {
for (ArrowLocation value : ArrowLocation.values()) {
if (stateInt == value.getIntValue()) {
return value;
}
}
return getDefault();
}
public static ArrowLocation getDefault() {
return LEFT;
}
public int getIntValue() {
return mValue;
}
}
public enum BubbleType {
COLOR,
BITMAP
}
}
| [
"3287967219@qq.com"
] | 3287967219@qq.com |
adfb877eb3743c267145d248b968b265199723a9 | f321db1ace514d08219cc9ba5089ebcfff13c87a | /generated-tests/dynamosa/tests/s1017/6_re2j/evosuite-tests/com/google/re2j/Utils_ESTest_scaffolding.java | 7cee769df863d6167d0295c42ee46035a45e92c0 | [] | no_license | sealuzh/dynamic-performance-replication | 01bd512bde9d591ea9afa326968b35123aec6d78 | f89b4dd1143de282cd590311f0315f59c9c7143a | refs/heads/master | 2021-07-12T06:09:46.990436 | 2020-06-05T09:44:56 | 2020-06-05T09:44:56 | 146,285,168 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,875 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Thu Jul 04 01:20:25 GMT 2019
*/
package com.google.re2j;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.junit.AfterClass;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class Utils_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "com.google.re2j.Utils";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@AfterClass
public static void clearEvoSuiteFramework(){
Sandbox.resetDefaultSecurityManager();
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
setSystemProperties();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
java.lang.System.setProperty("user.dir", "/home/apaniche/performance/Dataset/gordon_scripts/projects/6_re2j");
java.lang.System.setProperty("java.io.tmpdir", "/tmp");
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(Utils_ESTest_scaffolding.class.getClassLoader() ,
"com.google.re2j.Utils",
"com.google.re2j.UnicodeTables",
"com.google.re2j.Unicode"
);
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(Utils_ESTest_scaffolding.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"com.google.re2j.Utils",
"com.google.re2j.UnicodeTables",
"com.google.re2j.Unicode"
);
}
}
| [
"granogiovanni90@gmail.com"
] | granogiovanni90@gmail.com |
f195dfbedbf05acaa5c16412a6ca3d016d5bf181 | 8eeeb4535cdf7c32c47880e05412cec513ed8ce8 | /core/src/com/pukekogames/airportdesigner/Drawing/DrawAirport.java | 1b50ff48095f4232b89157bf196b5943006df401 | [] | no_license | imperiobadgo/AirportDesigner | 850c3d87a3fb3db4aca83468dc98d5a54f105fb0 | 48da49b9d80238b9f4bc5a934c154d6cecda857f | refs/heads/master | 2021-01-18T16:16:31.641734 | 2017-10-06T15:12:09 | 2017-10-06T15:12:09 | 86,731,797 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,512 | java | package com.pukekogames.airportdesigner.Drawing;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g3d.Shader;
import com.badlogic.gdx.graphics.glutils.FrameBuffer;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.pukekogames.airportdesigner.GameInstance.Airport;
import com.pukekogames.airportdesigner.GameInstance.GameInstance;
import com.pukekogames.airportdesigner.Helper.Geometry.PointInt;
import com.pukekogames.airportdesigner.Objects.Airlines.AirlineList;
import com.pukekogames.airportdesigner.Objects.Buildings.Building;
import com.pukekogames.airportdesigner.Objects.ClickableGameObject;
import com.pukekogames.airportdesigner.Objects.GameObject;
import com.pukekogames.airportdesigner.Objects.RoadIntersection;
import com.pukekogames.airportdesigner.Objects.Roads.Road;
import com.pukekogames.airportdesigner.Objects.Roads.Runway;
import com.pukekogames.airportdesigner.Objects.Vehicles.Airplane;
import com.pukekogames.airportdesigner.Objects.Vehicles.Vehicle;
import com.pukekogames.airportdesigner.Settings;
import java.util.ArrayList;
import java.util.LinkedList;
/**
* Created by Marko Rapka on 28.07.2017.
*/
public class DrawAirport {
private static DrawAirport ourInstance = new DrawAirport();
public static DrawAirport Instance() {
return ourInstance;
}
private LinkedList<GameObject> renderObjects;
private LinkedList<RoadIntersection> selectedRoadIntersections;
private ArrayList<Airplane> planeInstruction;
private PointInt windDirectionCenter;
private PointInt windDirectionTarget;
private ShaderProgram passThroughShader;
private ShaderProgram airplaneShader;
private ShaderProgram vehicleShader;
private DrawAirport() {
renderObjects = new LinkedList<GameObject>();
selectedRoadIntersections = new LinkedList<RoadIntersection>();
planeInstruction = new ArrayList<Airplane>();
windDirectionCenter = new PointInt(200, 200);
windDirectionTarget = new PointInt();
passThroughShader = new ShaderProgram(Gdx.files.internal("shaders/passthrough.vsh"), Gdx.files.internal("shaders/passthrough.fsh"));
passThroughShader.pedantic = false;
airplaneShader = new ShaderProgram(Gdx.files.internal("shaders/airplaneShader.vsh"), Gdx.files.internal("shaders/airplaneShader.fsh"));
airplaneShader.pedantic = false;
vehicleShader = new ShaderProgram(Gdx.files.internal("shaders/vehicleShader.vsh"), Gdx.files.internal("shaders/vehicleShader.fsh"));
vehicleShader.pedantic = false;
System.out.println("passthroughShader:" + (passThroughShader.isCompiled() ? " compiled" : passThroughShader.getLog()));
System.out.println("airplaneShader:" + (airplaneShader.isCompiled() ? " compiled" : airplaneShader.getLog()));
System.out.println("vehicleShader:" + (vehicleShader.isCompiled() ? " compiled" : vehicleShader.getLog()));
}
public void draw(SpriteBatch batch, Airport airport, ClickableGameObject selected) {
ShaderProgram lastShader = batch.getShader();
selectedRoadIntersections.clear();
batch.setShader(passThroughShader);
if (GameInstance.Settings().DebugShowRoad) {
DrawManager.getShapeRenderer().begin(ShapeRenderer.ShapeType.Filled);
for (int i = 0; i < airport.getRoadIntersectionCount(); i++) {
RoadIntersection roadIntersection = GameInstance.Airport().getRoadIntersection(i);
if (roadIntersection.isSelected()) selectedRoadIntersections.add(roadIntersection);
DrawManager.draw(batch, roadIntersection);
}
DrawManager.getShapeRenderer().end();
}
if (GameInstance.Settings().DebugShowRoad) {
batch.begin();
batch.disableBlending();
for (int i = 0; i < airport.getRoadCount(); i++) {
Road road = airport.getRoad(i);
if (road instanceof Runway) continue;
DrawManager.draw(batch, road);
}
for (int i = 0; i < airport.getRunwayCount(); i++) {
Runway runway = airport.getRunway(i);
DrawManager.draw(batch, runway);
}
batch.enableBlending();
batch.end();
DrawManager.getShapeRenderer().begin(ShapeRenderer.ShapeType.Filled);
for (int i = 0; i < airport.getRoadCount(); i++) {
Road road = airport.getRoad(i);
DrawRoads.drawLines(batch, road);
}
// DrawRoads.drawLines(spriteBatch, GameInstance.Airport().getRoad(0));
DrawManager.getShapeRenderer().end();
}
batch.begin();
if (GameInstance.Settings().DebugMode) {
batch.setShader(vehicleShader);
}
for (int i = 0; i < airport.getVehicleCount(); i++) {
Vehicle vehicle = airport.getVehicle(i);
DrawManager.draw(batch, vehicle);
}
if (GameInstance.Settings().DebugMode) {
batch.setShader(passThroughShader);
}
for (int i = 0; i < airport.getBuildingCount(); i++) {
Building building = airport.getBuilding(i);
DrawManager.draw(batch, building);
}
planeInstruction.clear();
if (GameInstance.Settings().DebugMode) {
batch.setShader(airplaneShader);
}
for (int i = 0; i < airport.getAirplaneCount(); i++) {
Airplane airplane = airport.getAirplane(i);
if (airplane.isWaitingForInstructions()) {
planeInstruction.add(airplane);
}
if (GameInstance.Settings().DebugMode) {
Color baseColor;
if (airplane.getAirline() != null) {
baseColor = AirlineList.getAirlineBaseColor(airplane.getAirline().getId());
} else {
baseColor = Color.RED;
}
airplaneShader.setUniformf("u_Color", baseColor.r, baseColor.g, baseColor.b, 1);
}
DrawManager.draw(batch, airplane);
}
batch.end();
if (GameInstance.Settings().DebugMode) {
batch.setShader(passThroughShader);
}
DrawManager.getShapeRenderer().begin(ShapeRenderer.ShapeType.Line);
for (RoadIntersection selectedIntersection : selectedRoadIntersections) {
DrawManager.drawPossibleSelection(batch, selectedIntersection);
}
for (int i = 0; i < airport.getVehicleCount(); i++) {
Vehicle vehicle = airport.getVehicle(i);
DrawVehicle.drawVehicleStatus(batch, vehicle);
if (GameInstance.Settings().DebugShowVehiclePath) {
DrawVehicle.drawPath(vehicle, selected, vehicle.getNextRoads());
}
if (GameInstance.Settings().DebugShowVehicleHeading){
DrawVehicle.drawHeading(vehicle);
}
}
DrawManager.getShapeRenderer().end();
DrawManager.getShapeRenderer().begin(ShapeRenderer.ShapeType.Filled);
for (int i = 0; i < airport.getBuildingCount(); i++) {
Building building = airport.getBuilding(i);
DrawBuildings.drawBuildingStatus(batch, building);
}
DrawManager.getShapeRenderer().setProjectionMatrix(Settings.Instance().uiManager.getScreenStage().getCamera().combined);
for (Airplane plane : planeInstruction) {
DrawManager.drawAttention(plane.getCenterPos(), batch, Settings.Instance().attentionColor, null);
}
float windDirection = (GameInstance.Airport().getWindDirection()) % 360;
float radius = 100;
double dirX = (float) Math.cos(Math.toRadians(windDirection)) * radius;
double dirY = (float) Math.sin(Math.toRadians(windDirection)) * -radius;
windDirectionTarget.set(windDirectionCenter.x + Math.round(dirX), windDirectionCenter.y + Math.round(dirY));
DrawManager.drawArrow(windDirectionCenter, batch, Color.BLUE, windDirectionTarget);
DrawManager.getShapeRenderer().setProjectionMatrix(Settings.Instance().uiManager.getGameScreen().getCamera().combined);
DrawManager.getShapeRenderer().end();
batch.setShader(lastShader);
}
}
| [
"wllokmarko@yahoo.de"
] | wllokmarko@yahoo.de |
b356daf1ff407c07add2222f642b8bb23ff2ad28 | ceb7f1df9e9b984ebcf72527ec26bfbab48836fb | /src/com/ipro/web/util/UTF8Filter.java | e899786d4a893bbbc5c42198905c326045ee18ba | [] | no_license | zdoem/merchant2 | 1b64206b6aa3b6a51ec169d109c63b11065542ea | 731d357d78c56dd37341643ba8ca90e86e9dadb0 | refs/heads/master | 2021-01-01T06:50:10.131221 | 2015-08-29T13:58:22 | 2015-08-29T13:58:22 | 41,594,190 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,964 | java | package com.ipro.web.util;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/*
* date:2011-12-12
* author: pradoem wongkraso
* contact : go2doem@gmail.com,destar_@hotmail.com
* description: this is class Utility for use frequent
* */
/**
* Servlet Filter implementation class UTF8Filter
*/
public class UTF8Filter implements Filter {
/**
* Default constructor.
*/
FilterConfig filterConfig;
public UTF8Filter() {
// TODO Auto-generated constructor stub
}
/**
* @see Filter#destroy()
*/
public void destroy() {
// TODO Auto-generated method stub
}
/**
* @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)
*/
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
// TODO Auto-generated method stub
// place your code here
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
//request.setCharacterEncoding("tis-620");
System.out.println("******* doFilter ********");
HttpServletRequest req = (HttpServletRequest)request;
HttpServletResponse res = (HttpServletResponse)response;
req.setCharacterEncoding("UTF-8");
res.setCharacterEncoding("UTF-8");
System.out.println("******* doFilter2 ********");
// pass the request along the filter chain
chain.doFilter(request, response);
}
/**
* @see Filter#init(FilterConfig)
*/
public void init(FilterConfig fConfig) throws ServletException {
// TODO Auto-generated method stub
filterConfig = fConfig;
}
}
| [
"go2doem@gmail.com"
] | go2doem@gmail.com |
f21996528eb26a48f40b1348148b999c9d123f0d | a0b05f3b8ee47e7742d807fbc511421421b9b9c0 | /course-api-data/src/main/java/io/javabrains/springbootstarter/topic/TopicRepository.java | 10c50634c5e7f649ce0aa03726a362522dda9770 | [] | no_license | vidhurraj147/course-api-data | 52fa6f24295e27a870f1cadca0f836f53d8a697c | 67144a19566b55b780da39ae0640d00f03ff9a5b | refs/heads/master | 2020-04-10T06:15:07.198655 | 2018-12-08T03:03:37 | 2018-12-08T03:03:37 | 160,849,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | package io.javabrains.springbootstarter.topic;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Service;
@Service
public interface TopicRepository extends CrudRepository<Topic, String> {
}
| [
"devops@devops-VirtualBox"
] | devops@devops-VirtualBox |
a0652f33d247ec9c09c6efb72d8b00db26a77b8f | 29036284436de5e23213c52c994e3dc561cca6e1 | /argouml/ArgoUML-0.32.2/argouml/src/argouml-app/src/org/argouml/notation/providers/uml/NotationUtilityUml.java | 8ecccd8b479bc25ae0483883404162287447ef0f | [
"BSD-3-Clause",
"LicenseRef-scancode-other-permissive"
] | permissive | anonbnr/hmin306_TP | c212097eda775cf785bd119792d0b8ec042738b5 | b18391c1430787957b565191d0e7147ec5a1188c | refs/heads/master | 2020-09-07T05:43:37.158186 | 2020-01-17T12:45:04 | 2020-01-17T12:45:04 | 220,673,511 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 46,758 | java | /* $Id: NotationUtilityUml.java 18852 2010-11-20 19:27:11Z mvw $
*****************************************************************************
* Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
*/
// Copyright (c) 2005-2009 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
// and this paragraph appear in all copies. This software program and
// documentation are copyrighted by The Regents of the University of
// California. The software program and documentation are supplied "AS
// IS", without any accompanying services from The Regents. The Regents
// does not warrant that the operation of the program will be
// uninterrupted or error-free. The end-user understands that the program
// was developed for research purposes and is advised not to rely
// exclusively on the program for any reason. IN NO EVENT SHALL THE
// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
package org.argouml.notation.providers.uml;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Stack;
import org.argouml.i18n.Translator;
import org.argouml.kernel.Project;
import org.argouml.kernel.ProjectManager;
import org.argouml.kernel.ProjectSettings;
import org.argouml.model.Model;
import org.argouml.uml.StereotypeUtility;
import org.argouml.util.CustomSeparator;
import org.argouml.util.MyTokenizer;
/**
* This class is a utility for the UML notation.
*
* @author Michiel van der Wulp
*/
public final class NotationUtilityUml {
/**
* The array of special properties for attributes.
*/
static PropertySpecialString[] attributeSpecialStrings;
/**
* The list of CustomSeparators to use when tokenizing attributes.
*/
static List<CustomSeparator> attributeCustomSep;
/**
* The array of special properties for operations.
*/
static PropertySpecialString[] operationSpecialStrings;
/**
* The List of CustomSeparators to use when tokenizing attributes.
*/
static final List<CustomSeparator> operationCustomSep;
/**
* The list of CustomSeparators to use when tokenizing parameters.
*/
private static final List<CustomSeparator> parameterCustomSep;
private static final String LIST_SEPARATOR = ", ";
/**
* The character with a meaning as a visibility at the start
* of an attribute.
*/
static final String VISIBILITYCHARS = "+#-~";
/**
* The constructor.
*/
public NotationUtilityUml() { }
/* TODO: Can we put the static block within the init()? */
static {
attributeSpecialStrings = new PropertySpecialString[2];
attributeCustomSep = new ArrayList<CustomSeparator>();
attributeCustomSep.add(MyTokenizer.SINGLE_QUOTED_SEPARATOR);
attributeCustomSep.add(MyTokenizer.DOUBLE_QUOTED_SEPARATOR);
attributeCustomSep.add(MyTokenizer.PAREN_EXPR_STRING_SEPARATOR);
operationSpecialStrings = new PropertySpecialString[8];
operationCustomSep = new ArrayList<CustomSeparator>();
operationCustomSep.add(MyTokenizer.SINGLE_QUOTED_SEPARATOR);
operationCustomSep.add(MyTokenizer.DOUBLE_QUOTED_SEPARATOR);
operationCustomSep.add(MyTokenizer.PAREN_EXPR_STRING_SEPARATOR);
parameterCustomSep = new ArrayList<CustomSeparator>();
parameterCustomSep.add(MyTokenizer.SINGLE_QUOTED_SEPARATOR);
parameterCustomSep.add(MyTokenizer.DOUBLE_QUOTED_SEPARATOR);
parameterCustomSep.add(MyTokenizer.PAREN_EXPR_STRING_SEPARATOR);
}
static void init() {
int assPos = 0;
attributeSpecialStrings[assPos++] =
new PropertySpecialString("frozen",
new PropertyOperation() {
public void found(Object element, String value) {
if (Model.getFacade().isAStructuralFeature(element)) {
if (value == null) {
/* the text was: {frozen} */
Model.getCoreHelper().setReadOnly(element, true);
} else if ("false".equalsIgnoreCase(value)) {
/* the text was: {frozen = false} */
Model.getCoreHelper().setReadOnly(element, false);
} else if ("true".equalsIgnoreCase(value)) {
/* the text was: {frozen = true} */
Model.getCoreHelper().setReadOnly(element, true);
}
}
}
});
// TODO: AddOnly has been removed in UML 2.x, so we should phase out
// support of it - tfm - 20070529
attributeSpecialStrings[assPos++] =
new PropertySpecialString("addonly",
new PropertyOperation() {
public void found(Object element, String value) {
if (Model.getFacade().isAStructuralFeature(element)) {
if ("false".equalsIgnoreCase(value)) {
Model.getCoreHelper().setReadOnly(element, true);
} else {
Model.getCoreHelper().setChangeability(element,
Model.getChangeableKind().getAddOnly());
}
}
}
});
assert assPos == attributeSpecialStrings.length;
operationSpecialStrings = new PropertySpecialString[8];
int ossPos = 0;
operationSpecialStrings[ossPos++] =
new PropertySpecialString("sequential",
new PropertyOperation() {
public void found(Object element, String value) {
if (Model.getFacade().isAOperation(element)) {
Model.getCoreHelper().setConcurrency(element,
Model.getConcurrencyKind().getSequential());
}
}
});
operationSpecialStrings[ossPos++] =
new PropertySpecialString("guarded",
new PropertyOperation() {
public void found(Object element, String value) {
Object kind = Model.getConcurrencyKind().getGuarded();
if (value != null && value.equalsIgnoreCase("false")) {
kind = Model.getConcurrencyKind().getSequential();
}
if (Model.getFacade().isAOperation(element)) {
Model.getCoreHelper().setConcurrency(element, kind);
}
}
});
operationSpecialStrings[ossPos++] =
new PropertySpecialString("concurrent",
new PropertyOperation() {
public void found(Object element, String value) {
Object kind =
Model.getConcurrencyKind().getConcurrent();
if (value != null && value.equalsIgnoreCase("false")) {
kind = Model.getConcurrencyKind().getSequential();
}
if (Model.getFacade().isAOperation(element)) {
Model.getCoreHelper().setConcurrency(element, kind);
}
}
});
operationSpecialStrings[ossPos++] =
new PropertySpecialString("concurrency",
new PropertyOperation() {
public void found(Object element, String value) {
Object kind =
Model.getConcurrencyKind().getSequential();
if ("guarded".equalsIgnoreCase(value)) {
kind = Model.getConcurrencyKind().getGuarded();
} else if ("concurrent".equalsIgnoreCase(value)) {
kind = Model.getConcurrencyKind().getConcurrent();
}
if (Model.getFacade().isAOperation(element)) {
Model.getCoreHelper().setConcurrency(element, kind);
}
}
});
operationSpecialStrings[ossPos++] =
new PropertySpecialString("abstract",
new PropertyOperation() {
public void found(Object element, String value) {
boolean isAbstract = true;
if (value != null && value.equalsIgnoreCase("false")) {
isAbstract = false;
}
if (Model.getFacade().isAOperation(element)) {
Model.getCoreHelper().setAbstract(
element,
isAbstract);
}
}
});
operationSpecialStrings[ossPos++] =
new PropertySpecialString("leaf",
new PropertyOperation() {
public void found(Object element, String value) {
boolean isLeaf = true;
if (value != null && value.equalsIgnoreCase("false")) {
isLeaf = false;
}
if (Model.getFacade().isAOperation(element)) {
Model.getCoreHelper().setLeaf(element, isLeaf);
}
}
});
operationSpecialStrings[ossPos++] =
new PropertySpecialString("query",
new PropertyOperation() {
public void found(Object element, String value) {
boolean isQuery = true;
if (value != null && value.equalsIgnoreCase("false")) {
isQuery = false;
}
if (Model.getFacade().isABehavioralFeature(element)) {
Model.getCoreHelper().setQuery(element, isQuery);
}
}
});
operationSpecialStrings[ossPos++] =
new PropertySpecialString("root",
new PropertyOperation() {
public void found(Object element, String value) {
boolean isRoot = true;
if (value != null && value.equalsIgnoreCase("false")) {
isRoot = false;
}
if (Model.getFacade().isAOperation(element)) {
Model.getCoreHelper().setRoot(element, isRoot);
}
}
});
assert ossPos == operationSpecialStrings.length;
}
/**
* Parse a string on the format:
* <pre>
* [ << stereotype >>] [+|-|#|~] [full_pathname ::] [name]
* </pre>
*
* @param me The ModelElement <em>text</em> describes.
* @param text A String on the above format.
* @throws ParseException
* when it detects an error in the attribute string. See also
* ParseError.getErrorOffset().
*/
protected static void parseModelElement(Object me, String text)
throws ParseException {
MyTokenizer st;
List<String> path = null;
String name = null;
StringBuilder stereotype = null;
String token;
try {
st = new MyTokenizer(text, "<<,\u00AB,\u00BB,>>,::");
while (st.hasMoreTokens()) {
token = st.nextToken();
if ("<<".equals(token) || "\u00AB".equals(token)) {
if (stereotype != null) {
String msg =
"parsing.error.model-element-name.twin-stereotypes";
throw new ParseException(Translator.localize(msg),
st.getTokenIndex());
}
stereotype = new StringBuilder();
while (true) {
token = st.nextToken();
if (">>".equals(token) || "\u00BB".equals(token)) {
break;
}
stereotype.append(token);
}
} else if ("::".equals(token)) {
if (name != null) {
name = name.trim();
}
if (path != null && (name == null || "".equals(name))) {
String msg =
"parsing.error.model-element-name.anon-qualifiers";
throw new ParseException(Translator.localize(msg),
st.getTokenIndex());
}
if (path == null) {
path = new ArrayList<String>();
}
if (name != null) {
path.add(name);
}
name = null;
} else {
if (name != null) {
String msg =
"parsing.error.model-element-name.twin-names";
throw new ParseException(Translator.localize(msg),
st.getTokenIndex());
}
name = token;
}
}
} catch (NoSuchElementException nsee) {
String msg =
"parsing.error.model-element-name.unexpected-name-element";
throw new ParseException(Translator.localize(msg),
text.length());
} catch (ParseException pre) {
throw pre;
}
if (name != null) {
name = name.trim();
}
if (path != null && (name == null || "".equals(name))) {
String msg = "parsing.error.model-element-name.must-end-with-name";
throw new ParseException(Translator.localize(msg), 0);
}
if (name != null && name.startsWith("+")) {
name = name.substring(1).trim();
Model.getCoreHelper().setVisibility(me,
Model.getVisibilityKind().getPublic());
}
if (name != null && name.startsWith("-")) {
name = name.substring(1).trim();
Model.getCoreHelper().setVisibility(me,
Model.getVisibilityKind().getPrivate());
}
if (name != null && name.startsWith("#")) {
name = name.substring(1).trim();
Model.getCoreHelper().setVisibility(me,
Model.getVisibilityKind().getProtected());
}
if (name != null && name.startsWith("~")) {
name = name.substring(1).trim();
Model.getCoreHelper().setVisibility(me,
Model.getVisibilityKind().getPackage());
}
if (name != null) {
Model.getCoreHelper().setName(me, name);
}
StereotypeUtility.dealWithStereotypes(me, stereotype, false);
if (path != null) {
Object nspe =
Model.getModelManagementHelper().getElement(
path,
Model.getFacade().getRoot(me));
if (nspe == null || !(Model.getFacade().isANamespace(nspe))) {
String msg =
"parsing.error.model-element-name.namespace-unresolved";
throw new ParseException(Translator.localize(msg),
0);
}
if (!Model.getCoreHelper().isValidNamespace(me, nspe)) {
String msg =
"parsing.error.model-element-name.namespace-invalid";
throw new ParseException(Translator.localize(msg),
0);
}
Model.getCoreHelper().addOwnedElement(nspe, me);
}
}
/**
* Utility function to determine the presence of a key.
* The default is false.
*
* @param key the string for the key
* @param map the Map to check for the presence
* and value of the key
* @return true if the value for the key is true, otherwise false
*/
public static boolean isValue(final String key, final Map map) {
if (map == null) {
return false;
}
Object o = map.get(key);
if (!(o instanceof Boolean)) {
return false;
}
return ((Boolean) o).booleanValue();
}
/**
* Returns a visibility String either for a VisibilityKind or a model
* element.
*
* @param o a modelelement or a visibilitykind
* @return a string. May be the empty string, but guaranteed not to be null
*/
public static String generateVisibility2(Object o) {
if (o == null) {
return "";
}
if (Model.getFacade().isANamedElement(o)) {
if (Model.getFacade().isPublic(o)) {
return "+";
}
if (Model.getFacade().isPrivate(o)) {
return "-";
}
if (Model.getFacade().isProtected(o)) {
return "#";
}
if (Model.getFacade().isPackage(o)) {
return "~";
}
}
if (Model.getFacade().isAVisibilityKind(o)) {
if (Model.getVisibilityKind().getPublic().equals(o)) {
return "+";
}
if (Model.getVisibilityKind().getPrivate().equals(o)) {
return "-";
}
if (Model.getVisibilityKind().getProtected().equals(o)) {
return "#";
}
if (Model.getVisibilityKind().getPackage().equals(o)) {
return "~";
}
}
return "";
}
/**
* @param modelElement the UML element to generate for
* @return a string which represents the path
*/
protected static String generatePath(Object modelElement) {
StringBuilder s = new StringBuilder();
Object p = modelElement;
Stack<String> stack = new Stack<String>();
Object ns = Model.getFacade().getNamespace(p);
while (ns != null && !Model.getFacade().isAModel(ns)) {
stack.push(Model.getFacade().getName(ns));
ns = Model.getFacade().getNamespace(ns);
}
while (!stack.isEmpty()) {
s.append(stack.pop() + "::");
}
if (s.length() > 0 && !(s.lastIndexOf(":") == s.length() - 1)) {
s.append("::");
}
return s.toString();
}
/**
* Parses a parameter list and aligns the parameter list in op to that
* specified in param. A parameter list generally has the following syntax:
*
* <pre>
* param := [inout] [name] [: type] [= initial value]
* list := [param] [, param]*
* </pre>
*
* <code>inout</code> is optional and if omitted the old value preserved.
* If no value has been assigned, then <code>in </code> is assumed.<p>
*
* <code>name</code>, <code>type</code> and <code>initial value</code>
* are optional and if omitted the old value preserved.<p>
*
* <code>type</code> and <code>initial value</code> can be given
* in any order.<p>
*
* Unspecified properties is carried over by position, so if a parameter is
* inserted into the list, then it will inherit properties from the
* parameter that was there before for unspecified properties.<p>
*
* This syntax is compatible with the UML 1.3 specification.
*
* @param op
* The operation the parameter list belongs to.
* @param param
* The parameter list, without enclosing parentheses.
* @param paramOffset
* The offset to the beginning of the parameter list. Used for
* error reports.
* @throws java.text.ParseException
* when it detects an error in the attribute string. See also
* ParseError.getErrorOffset().
*/
static void parseParamList(Object op, String param, int paramOffset)
throws ParseException {
MyTokenizer st =
new MyTokenizer(param, " ,\t,:,=,\\,", parameterCustomSep);
// Copy returned parameters because it will be a live collection for MDR
Collection origParam =
new ArrayList(Model.getFacade().getParameters(op));
Object ns = Model.getFacade().getRoot(op);
if (Model.getFacade().isAOperation(op)) {
Object ow = Model.getFacade().getOwner(op);
if (ow != null && Model.getFacade().getNamespace(ow) != null) {
ns = Model.getFacade().getNamespace(ow);
}
}
Iterator it = origParam.iterator();
while (st.hasMoreTokens()) {
String kind = null;
String name = null;
String tok;
String type = null;
StringBuilder value = null;
Object p = null;
boolean hasColon = false;
boolean hasEq = false;
while (it.hasNext() && p == null) {
p = it.next();
if (Model.getFacade().isReturn(p)) {
p = null;
}
}
while (st.hasMoreTokens()) {
tok = st.nextToken();
if (",".equals(tok)) {
break;
} else if (" ".equals(tok) || "\t".equals(tok)) {
if (hasEq) {
value.append(tok);
}
} else if (":".equals(tok)) {
hasColon = true;
hasEq = false;
} else if ("=".equals(tok)) {
if (value != null) {
String msg =
"parsing.error.notation-utility.two-default-values";
throw new ParseException(Translator.localize(msg),
paramOffset + st.getTokenIndex());
}
hasEq = true;
hasColon = false;
value = new StringBuilder();
} else if (hasColon) {
if (type != null) {
String msg = "parsing.error.notation-utility.two-types";
throw new ParseException(Translator.localize(msg),
paramOffset + st.getTokenIndex());
}
if (tok.charAt(0) == '\'' || tok.charAt(0) == '\"') {
String msg =
"parsing.error.notation-utility.type-quoted";
throw new ParseException(Translator.localize(msg),
paramOffset + st.getTokenIndex());
}
if (tok.charAt(0) == '(') {
String msg =
"parsing.error.notation-utility.type-expr";
throw new ParseException(Translator.localize(msg),
paramOffset + st.getTokenIndex());
}
type = tok;
} else if (hasEq) {
value.append(tok);
} else {
if (name != null && kind != null) {
String msg =
"parsing.error.notation-utility.extra-text";
throw new ParseException(Translator.localize(msg),
paramOffset + st.getTokenIndex());
}
if (tok.charAt(0) == '\'' || tok.charAt(0) == '\"') {
String msg =
"parsing.error.notation-utility.name-kind-quoted";
throw new ParseException(
Translator.localize(msg),
paramOffset + st.getTokenIndex());
}
if (tok.charAt(0) == '(') {
String msg =
"parsing.error.notation-utility.name-kind-expr";
throw new ParseException(
Translator.localize(msg),
paramOffset + st.getTokenIndex());
}
kind = name;
name = tok;
}
}
if (p == null) {
/* Leave the type undefined (see issue 6145): */
p = Model.getCoreFactory().buildParameter(op, null);
}
if (name != null) {
Model.getCoreHelper().setName(p, name.trim());
}
if (kind != null) {
setParamKind(p, kind.trim());
}
if (type != null) {
Model.getCoreHelper().setType(p, getType(type.trim(), ns));
}
if (value != null) {
// TODO: Find a better default language
// TODO: We should know the notation language, since it is us
Project project =
ProjectManager.getManager().getCurrentProject();
ProjectSettings ps = project.getProjectSettings();
String notationLanguage = ps.getNotationLanguage();
Object initExpr =
Model.getDataTypesFactory()
.createExpression(
notationLanguage,
value.toString().trim());
Model.getCoreHelper().setDefaultValue(p, initExpr);
}
}
while (it.hasNext()) {
Object p = it.next();
if (!Model.getFacade().isReturn(p)) {
Model.getCoreHelper().removeParameter(op, p);
}
}
}
/**
* Set a parameters kind according to a string description of
* that kind.
* @param parameter the parameter
* @param description the string description
*/
private static void setParamKind(Object parameter, String description) {
Object kind;
if ("out".equalsIgnoreCase(description)) {
kind = Model.getDirectionKind().getOutParameter();
} else if ("inout".equalsIgnoreCase(description)) {
kind = Model.getDirectionKind().getInOutParameter();
} else {
kind = Model.getDirectionKind().getInParameter();
}
Model.getCoreHelper().setKind(parameter, kind);
}
/**
* Finds the classifier associated with the type named in name.
*
* @param name
* The name of the type to get.
* @param defaultSpace
* The default name-space to place the type in.
* @return The classifier associated with the name.
*/
static Object getType(String name, Object defaultSpace) {
Object type = null;
Project p = ProjectManager.getManager().getCurrentProject();
// Should we be getting this from the GUI? BT 11 aug 2002
type = p.findType(name, false);
if (type == null) { // no type defined yet
type = Model.getCoreFactory().buildClass(name,
defaultSpace);
}
return type;
}
/**
* Applies a List of name/value pairs of properties to a model element.
* The name is treated as the tag of a tagged value unless it is one of the
* PropertySpecialStrings, in which case the action of the
* PropertySpecialString is invoked.
*
* @param elem
* An model element to apply the properties to.
* @param prop
* A List with name, value pairs of properties.
* @param spec
* An array of PropertySpecialStrings to use.
*/
static void setProperties(Object elem, List<String> prop,
PropertySpecialString[] spec) {
String name;
String value;
int i, j;
nextProp:
for (i = 0; i + 1 < prop.size(); i += 2) {
name = prop.get(i);
value = prop.get(i + 1);
if (name == null) {
continue;
}
name = name.trim();
if (value != null) {
value = value.trim();
}
/* If the current property occurs a second time
* in the given list of properties, then skip it: */
for (j = i + 2; j < prop.size(); j += 2) {
String s = prop.get(j);
if (s != null && name.equalsIgnoreCase(s.trim())) {
continue nextProp;
}
}
if (spec != null) {
for (j = 0; j < spec.length; j++) {
if (spec[j].invoke(elem, name, value)) {
continue nextProp;
}
}
}
Model.getCoreHelper().setTaggedValue(elem, name, value);
}
}
/**
* Interface specifying the operation to take when a
* PropertySpecialString is matched.
*
* @author Michael Stockman
* @since 0.11.2
* @see PropertySpecialString
*/
interface PropertyOperation {
/**
* Invoked by PropertySpecialString when it has matched a property name.
*
* @param element
* The element on which the property was set.
* @param value
* The value of the property,
* may be null if no value was given.
*/
void found(Object element, String value);
}
/**
* Declares a string that should take special action when it is found
* as a property in
* {@link ParserDisplay#setProperties ParserDisplay.setProperties}.<p>
*
* <em>Example:</em>
*
* <pre>
* attributeSpecialStrings[0] =
* new PropertySpecialString("frozen",
* new PropertyOperation() {
* public void found(Object element, String value) {
* if (Model.getFacade().isAStructuralFeature(element))
* Model.getFacade().setChangeable(element,
* (value != null && value
* .equalsIgnoreCase("false")));
* }
* });
* </pre>
*
* Taken from the (former) ParserDisplay constructor.
* It creates a PropertySpecialString that is invoken when the String
* "frozen" is found as a property name. Then
* the found mehod in the anonymous inner class
* defined on the 2nd line is invoked and performs
* a custom action on the element on which the property was
* specified by the user. In this case it does a setChangeability
* on an attribute instead of setting a tagged value,
* which would not have the desired effect.
*
* @author Michael Stockman
* @since 0.11.2
* @see PropertyOperation
* @see ParserDisplay#setProperties
*/
static class PropertySpecialString {
private String name;
private PropertyOperation op;
/**
* Constructs a new PropertySpecialString that will invoke the
* action in propop when {@link #invoke(Object, String, String)} is
* called with name equal to str and then return true from invoke.
*
* @param str
* The name of this PropertySpecialString.
* @param propop
* An object containing the method to invoke on a match.
*/
public PropertySpecialString(String str, PropertyOperation propop) {
name = str;
op = propop;
}
/**
* Called by {@link NotationUtilityUml#setProperties(Object,
* java.util.Vector, PropertySpecialString[])} while
* searching for an action to
* invoke for a property. If it returns true, then setProperties
* may assume that all required actions have been taken and stop
* searching.
*
* @param pname
* The name of a property.
* @param value
* The value of a property.
* @param element
* A model element to apply the properties to.
* @return <code>true</code> if an action is performed, otherwise
* <code>false</code>.
*/
boolean invoke(Object element, String pname, String value) {
if (!name.equalsIgnoreCase(pname)) {
return false;
}
op.found(element, value);
return true;
}
}
/**
* Checks for ';' in Strings or chars in ';' separated tokens in order to
* return an index to the next attribute or operation substring, -1
* otherwise (a ';' inside a String or char delimiters is ignored).
*
* @param s The string to search.
* @param start The position to start at.
* @return the index to the next attribute
*/
static int indexOfNextCheckedSemicolon(String s, int start) {
if (s == null || start < 0 || start >= s.length()) {
return -1;
}
int end;
boolean inside = false;
boolean backslashed = false;
char c;
for (end = start; end < s.length(); end++) {
c = s.charAt(end);
if (!inside && c == ';') {
return end;
} else if (!backslashed && (c == '\'' || c == '\"')) {
inside = !inside;
}
backslashed = (!backslashed && c == '\\');
}
return end;
}
/**
* Finds a visibility for the visibility specified by name. If no known
* visibility can be deduced, private visibility is used.
*
* @param name
* The Java name of the visibility.
* @return A visibility corresponding to name.
*/
static Object getVisibility(String name) {
if ("+".equals(name) || "public".equals(name)) {
return Model.getVisibilityKind().getPublic();
} else if ("#".equals(name) || "protected".equals(name)) {
return Model.getVisibilityKind().getProtected();
} else if ("~".equals(name) || "package".equals(name)) {
return Model.getVisibilityKind().getPackage();
} else {
/* if ("-".equals(name) || "private".equals(name)) */
return Model.getVisibilityKind().getPrivate();
}
}
/**
* Generate the text for one or more stereotype(s).
*
* @param st One of:
* <ul>
* <li>a stereotype UML object</li>
* <li>a string</li>
* <li>a collection of stereotypes</li>
* <li>a modelelement of which the stereotypes are retrieved</li>
* </ul>
* @param useGuillemets true if Unicode double angle bracket quote
* characters should be used.
* @return fully formatted string with list of stereotypes separated by
* commas and surround in brackets
*/
public static String generateStereotype(Object st, boolean useGuillemets) {
if (st == null) {
return "";
}
if (st instanceof String) {
return formatStereotype((String) st, useGuillemets);
}
if (Model.getFacade().isAStereotype(st)) {
return formatStereotype(Model.getFacade().getName(st),
useGuillemets);
}
if (Model.getFacade().isAModelElement(st)) {
st = Model.getFacade().getStereotypes(st);
}
if (st instanceof Collection) {
String result = null;
boolean found = false;
for (Object stereotype : (Collection) st) {
String name = Model.getFacade().getName(stereotype);
if (!found) {
result = name;
found = true;
} else {
// Allow concatenation order and separator to be localized
result = Translator.localize("misc.stereo.concatenate",
new Object[] {result, name});
}
}
if (found) {
return formatStereotype(result, useGuillemets);
}
}
return "";
}
/**
* Create a string representation of a stereotype, keyword or comma separate
* list of names. This method just wraps the string in <<angle brackets>> or
* guillemets (double angle bracket characters) depending on the setting
* of the flag <code>useGuillemets</code>.
*
* @param name the name of the stereotype
* @param useGuillemets true if Unicode double angle bracket quote
* characters should be used.
* @return the string representation
*/
public static String formatStereotype(String name, boolean useGuillemets) {
if (name == null || name.length() == 0) {
return "";
}
String key = "misc.stereo.guillemets."
+ Boolean.toString(useGuillemets);
return Translator.localize(key, new Object[] {name});
}
/**
* Generates the representation of a parameter on the display (diagram). The
* string to be returned will have the following syntax:
* <p>
*
* kind name : type-expression = default-value
*
* @see org.argouml.notation.NotationProvider2#generateParameter(java.lang.Object)
*/
static String generateParameter(Object parameter) {
StringBuffer s = new StringBuffer();
s.append(generateKind(Model.getFacade().getKind(parameter)));
if (s.length() > 0) {
s.append(" ");
}
s.append(Model.getFacade().getName(parameter));
String classRef =
generateClassifierRef(Model.getFacade().getType(parameter));
if (classRef.length() > 0) {
s.append(" : ");
s.append(classRef);
}
String defaultValue =
generateExpression(Model.getFacade().getDefaultValue(parameter));
if (defaultValue.length() > 0) {
s.append(" = ");
s.append(defaultValue);
}
return s.toString();
}
private static String generateExpression(Object expr) {
if (Model.getFacade().isAExpression(expr)) {
return generateUninterpreted(
(String) Model.getFacade().getBody(expr));
} else if (Model.getFacade().isAConstraint(expr)) {
return generateExpression(Model.getFacade().getBody(expr));
}
return "";
}
private static String generateUninterpreted(String un) {
if (un == null) {
return "";
}
return un;
}
private static String generateClassifierRef(Object cls) {
if (cls == null) {
return "";
}
return Model.getFacade().getName(cls);
}
private static String generateKind(Object /*Parameter etc.*/ kind) {
StringBuffer s = new StringBuffer();
// TODO: I18N
if (kind == null /* "in" is the default */
|| kind == Model.getDirectionKind().getInParameter()) {
s.append(/*"in"*/ ""); /* See issue 3421. */
} else if (kind == Model.getDirectionKind().getInOutParameter()) {
s.append("inout");
} else if (kind == Model.getDirectionKind().getReturnParameter()) {
// return nothing
} else if (kind == Model.getDirectionKind().getOutParameter()) {
s.append("out");
}
return s.toString();
}
/**
* @param tv a tagged value
* @return a string that represents the tagged value
*/
static String generateTaggedValue(Object tv) {
if (tv == null) {
return "";
}
return Model.getFacade().getTagOfTag(tv)
+ "="
+ generateUninterpreted(Model.getFacade().getValueOfTag(tv));
}
/**
* Generate the text of a multiplicity.
*
* @param element a multiplicity or an element which has a multiplicity
* @param showSingularMultiplicity if false return the empty string for 1..1
* multiplicities.
* @return a string containing the formatted multiplicity,
* or the empty string
*/
public static String generateMultiplicity(Object element,
boolean showSingularMultiplicity) {
Object multiplicity;
if (Model.getFacade().isAMultiplicity(element)) {
multiplicity = element;
} else if (Model.getFacade().isAUMLElement(element)) {
multiplicity = Model.getFacade().getMultiplicity(element);
} else {
throw new IllegalArgumentException();
}
// it can still be null if the UML element
// did not have a multiplicity defined.
if (multiplicity != null) {
int upper = Model.getFacade().getUpper(multiplicity);
int lower = Model.getFacade().getLower(multiplicity);
if (lower != 1 || upper != 1 || showSingularMultiplicity) {
// TODO: I18N
return Model.getFacade().toString(multiplicity);
}
}
return "";
}
/**
* @param umlAction the action
* @return the generated text (never null)
*/
static String generateAction(Object umlAction) {
Collection c;
Iterator it;
String s;
StringBuilder p;
boolean first;
if (umlAction == null) {
return "";
}
Object script = Model.getFacade().getScript(umlAction);
if ((script != null) && (Model.getFacade().getBody(script) != null)) {
s = Model.getFacade().getBody(script).toString();
} else {
s = "";
}
p = new StringBuilder();
c = Model.getFacade().getActualArguments(umlAction);
if (c != null) {
it = c.iterator();
first = true;
while (it.hasNext()) {
Object arg = it.next();
if (!first) {
// TODO: I18N
p.append(", ");
}
if (Model.getFacade().getValue(arg) != null) {
p.append(generateExpression(
Model.getFacade().getValue(arg)));
}
first = false;
}
}
if (s.length() == 0 && p.length() == 0) {
return "";
}
/* If there are no arguments, then do not show the ().
* This solves issue 1758.
* Arguments are not supported anyhow in the UI yet.
* These brackets are easily confused with the brackets
* for the Operation of a CallAction.
*/
if (p.length() == 0) {
return s;
}
// TODO: I18N
return s + " (" + p + ")";
}
/**
* Generate a textual representation of the given Action or ActionSequence
* according the UML standard notation.
*
* @param a the UML Action or ActionSequence
* @return the generated textual representation
* of the given action(sequence).
* This value is guaranteed NOT null.
*/
public static String generateActionSequence(Object a) {
if (Model.getFacade().isAActionSequence(a)) {
StringBuffer str = new StringBuffer("");
Collection actions = Model.getFacade().getActions(a);
Iterator i = actions.iterator();
if (i.hasNext()) {
str.append(generateAction(i.next()));
}
while (i.hasNext()) {
str.append("; ");
str.append(generateAction(i.next()));
}
return str.toString();
} else {
return generateAction(a);
}
}
static StringBuilder formatNameList(Collection modelElements) {
return formatNameList(modelElements, LIST_SEPARATOR);
}
static StringBuilder formatNameList(Collection modelElements,
String separator) {
StringBuilder result = new StringBuilder();
for (Object element : modelElements) {
String name = Model.getFacade().getName(element);
// TODO: Any special handling for null names? append will use "null"
result.append(name).append(separator);
}
if (result.length() >= separator.length()) {
result.delete(result.length() - separator.length(),
result.length());
}
return result;
}
}
| [
"amandine.paillard@hotmail.fr"
] | amandine.paillard@hotmail.fr |
2d52858c6c285d759b7d29cd17b1633984ee055b | 89f5ed319feebe12e40a7c9f78a1e20bf5f7525d | /src/main/java/io/gr1d/portal/subscriptions/api/bridge/ApiEndpoints.java | 34333c2ca7a9338843d8d6d8238d7d055b7456aa | [] | no_license | MX-B/subscription | 36c71d9904f98bf090566abf2f9e6f319f341a74 | 3b7aa4d1896d54782e53d275b2ead294a6b46a6b | refs/heads/master | 2021-04-18T10:18:08.197826 | 2020-03-23T20:14:58 | 2020-03-23T20:14:58 | 249,534,177 | 0 | 1 | null | 2021-03-31T21:59:17 | 2020-03-23T20:14:12 | Java | UTF-8 | Java | false | false | 169 | java | package io.gr1d.portal.subscriptions.api.bridge;
import lombok.Data;
import java.util.List;
@Data
public class ApiEndpoints {
private List<String> endpoints;
}
| [
"62027231+kdupieroni@users.noreply.github.com"
] | 62027231+kdupieroni@users.noreply.github.com |
c9a50b3d36930858e411b1e80e440c4ec5c6e3a7 | 61e39a4e2951119d9161bf6cb8e560ef59e7e38d | /java-template/src/main/java/cn/xydata/mapper/MyMapper.java | 9dc5b669946c3e7b543804beeec87bfff80f14f2 | [] | no_license | zhjstudyhard/firstRepository | 115c1932d036ef61f18d9dcf96cd9b604315196c | db1e68f4e77e5f50e4507556011de584a592ad64 | refs/heads/master | 2023-06-12T22:25:46.118825 | 2021-07-06T04:50:49 | 2021-07-06T04:50:49 | 374,644,649 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 260 | java | package cn.xydata.mapper;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.MySqlMapper;
/**
* @Author: haojie
* @qq :1422471205
* @CreateTime: 2021-06-29-10-06
*/
public interface MyMapper<T> extends Mapper<T>, MySqlMapper<T> {
}
| [
"zhjstudyhard@aliyun.com"
] | zhjstudyhard@aliyun.com |
882b79a33555801b2fe1e1039c05ebd084c3df41 | 2627428de46dc51f95adfb2b11584edf34e6eadd | /java-reflection/src/aula/reflection/MainAnnotation.java | 38999e579fa07e58d68a1a7851b1d5f6a09a66ae | [] | no_license | giomodiogo/exemplosJavaReflection | ac1a95b31f08db3acd4aa65f7dd6b702d3c6407e | e6c22e0a44755c1ca5cdc269affc60b345e2cc8b | refs/heads/master | 2021-03-30T22:49:53.267863 | 2018-03-09T00:14:36 | 2018-03-09T00:14:36 | 124,463,589 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,717 | java | package aula.reflection;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import aula.reflection.annotations.MyDBFieldName;
import aula.reflection.annotations.MyInvoke;
import aula.reflection.annotations.MyNotNull;
import aula.reflection.entities.Aluno;
import aula.reflection.entities.Pessoa;
public class MainAnnotation {
public static void main(String[] args) {
try {
// Recupera objeto da classe
Class classAluno = Aluno.class;
// Recupera campos
Field[] fields = classAluno.getDeclaredFields();
// Verifica em quais dos campos possui a annotation.
for (Field field : fields) {
MyNotNull annotation = field.getAnnotation(MyNotNull.class);
if (annotation != null) {
System.out.println("Campo com annotation MyNotNull: " + field.getName());
}
}
// Verifica em quais dos campos possui a annotation.
for (Field field : fields) {
MyDBFieldName annotation = field.getAnnotation(MyDBFieldName.class);
if (annotation != null) {
System.out.println("Mapeando campos DB: " + field.getName() + " -> " + annotation.name());
}
}
// Recupera os metodos.
Method[] methods = classAluno.getDeclaredMethods();
Constructor constructorAluno = classAluno.getConstructor();
// Cria objeto.
Pessoa pessoa = (Pessoa) constructorAluno.newInstance();
// Verifica qual metodo possui a annotation e executa
for (Method method : methods) {
MyInvoke annotation = method.getAnnotation(MyInvoke.class);
if (annotation != null) {
System.out.println("Invocando método com Annotation:");
method.invoke(pessoa);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"giomodiogo@gmail.com"
] | giomodiogo@gmail.com |
78a2612414097dd803338c051468ead041670d1e | b85a472ce96564ac5de93a47a82538abd63f438c | /ejb-testing-workspace/ejb01/src/com/test/ejb/first/FirstEjb.java | 9a149b2ec73ba3a113a004bb52fccd509c23debd | [] | no_license | fushcpc/my-workspace-repository | 042c0014833bd21d99dcde9f191ea469781fb6c0 | 7ae282483bf9478dbe0649cd3151fc9ccf494e7a | refs/heads/master | 2016-09-05T19:07:30.365743 | 2014-04-02T14:25:26 | 2014-04-02T14:25:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 104 | java | package com.test.ejb.first;
public interface FirstEjb {
public String saySomething(String name);
}
| [
"fushcpc@gmail.com"
] | fushcpc@gmail.com |
dce4dc0ca5d7d3bcfdec66ac0c522f3dfde9437c | 941767001c7a977cdd2fe820001b6620a195fba2 | /atcrowdfunding-boot-portal/src/main/java/com/atguigu/atcrowdfunding/service/ActivitiService.java | 434b0fb9b12199c0fad735854b719267a36cc3a6 | [] | no_license | zhangjunchao666/Atcrowdfunding-SpringCloud | 75abd80df2e246b7fe749da3891473efc2305a75 | 97655ad2bfb86521d8a0bb3a9425f795f69a09e4 | refs/heads/master | 2020-05-02T17:47:12.357283 | 2019-03-28T03:12:29 | 2019-03-28T03:12:29 | 178,109,099 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 467 | java | package com.atguigu.atcrowdfunding.service;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@FeignClient("atcrowdfunding-boot-activiti-service")
public interface ActivitiService {
@RequestMapping("/activiti/startProcessInstance/{loginacct}")
public String startProcessInstance(@PathVariable("loginacct") String loginacct);
}
| [
"362297913@qq.com"
] | 362297913@qq.com |
ff727ae0fd7dff5be994964cee183d558ffca533 | b654cadd1468ee83a74db43cdb5551865688cc70 | /src/com/sam/tool/FtpUtil.java | 77ffc8c0fbac2ac694d1f5e23822b8089805b6bc | [] | no_license | WillowObserver/fileex | d65a9146a6a31eebc33ad67562d5fb889da15288 | 3938ba025cd37720863110f6f13c6baa37409cd4 | refs/heads/master | 2020-03-19T14:09:38.717186 | 2018-06-08T11:45:51 | 2018-06-08T11:45:51 | 136,611,352 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,830 | java | package com.sam.tool;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPReply;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
public class FtpUtil {
public static final String ANONYMOUS_LOGIN = "anonymous";
private FTPClient ftp;
private boolean is_connected;
public FtpUtil() {
ftp = new FTPClient();
is_connected = false;
}
public FtpUtil(int defaultTimeoutSecond, int connectTimeoutSecond, int dataTimeoutSecond){
ftp = new FTPClient();
is_connected = false;
ftp.setDefaultTimeout(defaultTimeoutSecond * 1000);
ftp.setConnectTimeout(connectTimeoutSecond * 1000);
ftp.setDataTimeout(dataTimeoutSecond * 1000);
}
/**
* Connects to FTP server.
*
* @param host
* FTP server address or name
* @param port
* FTP server port
* @param user
* user name
* @param password
* user password
* @param isTextMode
* text / binary mode switch
* @throws IOException
* on I/O errors
*/
public void connect(String host, int port, String user, String password, boolean isTextMode) throws IOException {
// Connect to server.
try {
ftp.connect(host, port);
} catch (UnknownHostException ex) {
throw new IOException("Can't find FTP server '" + host + "'");
}
// Check rsponse after connection attempt.
int reply = ftp.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
disconnect();
throw new IOException("Can't connect to server '" + host + "'");
}
if (user == "") {
user = ANONYMOUS_LOGIN;
}
// Login.
if (!ftp.login(user, password)) {
is_connected = false;
disconnect();
throw new IOException("Can't login to server '" + host + "'");
} else {
is_connected = true;
}
// Set data transfer mode.
if (isTextMode) {
ftp.setFileType(FTP.ASCII_FILE_TYPE);
} else {
ftp.setFileType(FTP.BINARY_FILE_TYPE);
}
}
/**
* Uploads the file to the FTP server.
*
* @param ftpFileName
* server file name (with absolute path)
* @param localFile
* local file to upload
* @throws IOException
* on I/O errors
*/
public void upload(String ftpFileName, File localFile) throws IOException {
// File check.
if (!localFile.exists()) {
throw new IOException("Can't upload '" + localFile.getAbsolutePath() + "'. This file doesn't exist.");
}
// Upload.
InputStream in = null;
try {
// Use passive mode to pass firewalls.
ftp.enterLocalPassiveMode();
in = new BufferedInputStream(new FileInputStream(localFile));
if (!ftp.storeFile(ftpFileName, in)) {
throw new IOException("Can't upload file '" + ftpFileName + "' to FTP server. Check FTP permissions and path.");
}
} finally {
try {
in.close();
} catch (IOException ex) {
}
}
}
/**
* Downloads the file from the FTP server.
*
* @param ftpFileName
* server file name (with absolute path)
* @param localFile
* local file to download into
* @throws IOException
* on I/O errors
*/
public void download(String ftpFileName, File localFile) throws IOException {
// Download.
OutputStream out = null;
try {
// Use passive mode to pass firewalls.
ftp.enterLocalPassiveMode();
// Get file info.
FTPFile[] fileInfoArray = ftp.listFiles(ftpFileName);
if (fileInfoArray == null) {
throw new FileNotFoundException("File " + ftpFileName + " was not found on FTP server.");
}
// Check file size.
FTPFile fileInfo = fileInfoArray[0];
long size = fileInfo.getSize();
if (size > Integer.MAX_VALUE) {
throw new IOException("File " + ftpFileName + " is too large.");
}
// Download file.
out = new BufferedOutputStream(new FileOutputStream(localFile));
if (!ftp.retrieveFile(ftpFileName, out)) {
throw new IOException("Error loading file " + ftpFileName + " from FTP server. Check FTP permissions and path.");
}
out.flush();
} finally {
if (out != null) {
try {
out.close();
} catch (IOException ex) {
}
}
}
}
/**
* Removes the file from the FTP server.
*
* @param ftpFileName
* server file name (with absolute path)
* @throws IOException
* on I/O errors
*/
public void remove(String ftpFileName) throws IOException {
if (!ftp.deleteFile(ftpFileName)) {
throw new IOException("Can't remove file '" + ftpFileName + "' from FTP server.");
}
}
/**
* Lists the files in the given FTP directory.
*
* @param filePath
* absolute path on the server
* @return files relative names list
* @throws IOException
* on I/O errors
*/
public List<String> list(String filePath) throws IOException {
List<String> fileList = new ArrayList<String>();
// Use passive mode to pass firewalls.
ftp.enterLocalPassiveMode();
FTPFile[] ftpFiles = ftp.listFiles(filePath);
int size = (ftpFiles == null) ? 0 : ftpFiles.length;
for (int i = 0; i < size; i++) {
FTPFile ftpFile = ftpFiles[i];
if (ftpFile.isFile()) {
fileList.add(ftpFile.getName());
}
}
return fileList;
}
/**
* Sends an FTP Server site specific command
*
* @param args
* site command arguments
* @throws IOException
* on I/O errors
*/
public void sendSiteCommand(String args) throws IOException {
if (ftp.isConnected()) {
try {
ftp.sendSiteCommand(args);
} catch (IOException ex) {
}
}
}
/**
* Disconnects from the FTP server
*
* @throws IOException
* on I/O errors
*/
public void disconnect() throws IOException {
if (ftp.isConnected()) {
try {
ftp.logout();
ftp.disconnect();
is_connected = false;
} catch (IOException ex) {
}
}
}
/**
* Makes the full name of the file on the FTP server by joining its path and
* the local file name.
*
* @param ftpPath
* file path on the server
* @param localFile
* local file
* @return full name of the file on the FTP server
*/
public String makeFTPFileName(String ftpPath, File localFile) {
if (ftpPath == "") {
return localFile.getName();
} else {
String path = ftpPath.trim();
if (path.charAt(path.length() - 1) != '/') {
path = path + "/";
}
return path + localFile.getName();
}
}
/**
* Test coonection to ftp server
*
* @return true, if connected
*/
public boolean isConnected() {
return is_connected;
}
/**
* Get current directory on ftp server
*
* @return current directory
*/
public String getWorkingDirectory() {
if (!is_connected) {
return "";
}
try {
return ftp.printWorkingDirectory();
} catch (IOException e) {
}
return "";
}
/**
* Set working directory on ftp server
*
* @param dir
* new working directory
* @return true, if working directory changed
*/
public boolean setWorkingDirectory(String dir) {
if (!is_connected) {
return false;
}
try {
return ftp.changeWorkingDirectory(dir);
} catch (IOException e) {
}
return false;
}
/**
* Change working directory on ftp server to parent directory
*
* @return true, if working directory changed
*/
public boolean setParentDirectory() {
if (!is_connected) {
return false;
}
try {
return ftp.changeToParentDirectory();
} catch (IOException e) {
}
return false;
}
/**
* Get parent directory name on ftp server
*
* @return parent directory
*/
public String getParentDirectory() {
if (!is_connected) {
return "";
}
String w = getWorkingDirectory();
setParentDirectory();
String p = getWorkingDirectory();
setWorkingDirectory(w);
return p;
}
/**
* Get file from ftp server into given output stream
*
* @param ftpFileName
* file name on ftp server
* @param out
* OutputStream
* @throws IOException
*/
public void getFile(String ftpFileName, OutputStream out) throws IOException {
try {
// Use passive mode to pass firewalls.
ftp.enterLocalPassiveMode();
// Get file info.
FTPFile[] fileInfoArray = ftp.listFiles(ftpFileName);
if (fileInfoArray == null) {
throw new FileNotFoundException("File '" + ftpFileName + "' was not found on FTP server.");
}
// Check file size.
FTPFile fileInfo = fileInfoArray[0];
long size = fileInfo.getSize();
if (size > Integer.MAX_VALUE) {
throw new IOException("File '" + ftpFileName + "' is too large.");
}
// Download file.
if (!ftp.retrieveFile(ftpFileName, out)) {
throw new IOException("Error loading file '" + ftpFileName + "' from FTP server. Check FTP permissions and path.");
}
out.flush();
} finally {
if (out != null) {
try {
out.close();
} catch (IOException ex) {
}
}
}
}
/**
* Put file on ftp server from given input stream
*
* @param ftpFileName
* file name on ftp server
* @param in
* InputStream
* @throws IOException
*/
public void putFile(String ftpFileName, InputStream in) throws IOException {
try {
// Use passive mode to pass firewalls.
ftp.enterLocalPassiveMode();
if (!ftp.storeFile(ftpFileName, in)) {
throw new IOException("Can't upload file '" + ftpFileName + "' to FTP server. Check FTP permissions and path.");
}
} finally {
try {
in.close();
} catch (IOException ex) {
}
}
}
} | [
"IOve1324458"
] | IOve1324458 |
01a65ed4cbb19fcbf6ef88eb4df54003630c7b07 | 3e0237009846a03309907b7a2b975588a24e9a5c | /SpringPracitce02/src/main/java/kh/spring/pratice02/Main.java | fd8e053c1ca2a94ccd16331080f031b873e6b55d | [] | no_license | y2kim/sworkspace | ce76050c160f5af1257d7c14fe4814ab2d27810a | b7439aea395451382f9bd1b24fc5c499fef5541c | refs/heads/master | 2020-03-23T04:16:47.263063 | 2018-09-04T04:38:10 | 2018-09-04T04:38:10 | 141,073,935 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,690 | java | package kh.spring.pratice02;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
import kh.spring.exam.ListBean;
import kh.spring.exam.MapBean;
import kh.spring.exam.QuizBean;
import kh.spring.exam.SetBean;
public class Main {
public static void main(String[] args) {
AbstractApplicationContext ctx =
new GenericXmlApplicationContext("applicationContext.xml");
ListBean instance = (ListBean)ctx.getBean("listBean");
List<String> list = instance.getList();
for(String tmp:list) {
System.out.println(tmp);
}
System.out.println("-------------------------------------------");
SetBean instance2 = (SetBean)ctx.getBean("setBean");
Set<String> set = instance2.getSet();
for(String tmp: set) {
System.out.println(tmp);
}
System.out.println("-------------------------------------------");
MapBean instance3 = (MapBean)ctx.getBean("mapBean");
Map<String,String> map = instance3.getMaps();
for(String tmp: map.keySet()) {
System.out.println(tmp + " : " + map.get(tmp));
}
System.out.println("-------------------------------------------");
QuizBean instance4 = (QuizBean)ctx.getBean("quizBean");
int interal = instance4.getLiteral();
Map<String,String> quizmap = instance4.getMap();
List<String> quizlist = instance4.getNameList();
System.out.println(interal);
for(String tmp: quizmap.keySet()) {
System.out.println(tmp + " : " + quizmap.get(tmp));
}
for(String tmp:quizlist) {
System.out.println(tmp);
}
ctx.close();
}
}
| [
"kchy0806@naver.com"
] | kchy0806@naver.com |
3e7ec2c39256879505f0e5f78b0eb0e431764538 | c60d0566be70a05bd2f3d4d488f115eeb4a528c3 | /app/src/main/java/com/example/gil/irrigationsystemandroidui/GilJavaScriptInterface.java | e6f71eb5d58820df3165c1cf8f69797070f55284 | [] | no_license | gilyaary/IrrigationSystemAndroidUI | df5fa3d0b25bad85b1bd414b2ccc73e812c8abd4 | 0709e32d4a6f257fc1563edcaa210c912ba067b3 | refs/heads/master | 2020-03-31T06:47:59.523498 | 2018-10-12T12:23:31 | 2018-10-12T12:23:31 | 151,995,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,864 | java | package com.example.gil.irrigationsystemandroidui;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.os.AsyncTask;
import android.webkit.JavascriptInterface;
import com.example.gil.irrigationsystemandroidui.http.HttpHelper;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import javax.net.ssl.HttpsURLConnection;
public class GilJavaScriptInterface {
private final Context applicationContext;
private Context con;
private static final String PROTOCOL = "http://";
private static final String HOST_IP = "192.168.1.12";
private static final String SESSION_TOKEN = "ESPSESSIONID=1";
private static final HttpHelper httpHelper = new HttpHelper();
public GilJavaScriptInterface(Context con) {
this.con = con;
this.applicationContext = con.getApplicationContext();
}
@JavascriptInterface
public String showToast(String mssg) {
System.out.println("showToastCalled");
return "Answer from Android Java";
}
@JavascriptInterface
public String getZones() throws Exception {
String zones = httpHelper.sendGet( PROTOCOL + HOST_IP + "/api/zones?" + SESSION_TOKEN);
//String zones = "[{\"id\":\"0\",\"name\":\"Back yard, right side\"},{\"id\":\"1\",\"name\":\"Back yard, left side\"},{\"id\":\"2\",\"name\":\"Zone 3\"},{\"id\":\"3\",\"name\":\"Zone 4\"},{\"id\":\"4\",\"name\":\"Zone 5\"},{\"id\":\"5\",\"name\":\"Zone 6\"},{\"id\":\"6\",\"name\":\"Zone 7\"},{\"id\":\"7\",\"name\":\"Zone 8\"}]";
return zones;
}
@JavascriptInterface
public String getSchedules()throws Exception {
//String schedules= "{\"programIds\":[\"1\",\"2\"],\"programs\":[{\"id\":\"1\",\"name\":\"Evening right side\",\"startTime\":\"19:07\",\"duration\":\"6\",\"days\":[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"0\"],\"outputs\":[\"0\"]},{\"id\":\"2\",\"name\":\"Evening left side\",\"startTime\":\"19:00\",\"duration\":\"6\",\"days\":[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"0\"],\"outputs\":[\"1\"]}]}";
String schedules = httpHelper.sendGet( PROTOCOL + HOST_IP + "/api/programs?" + SESSION_TOKEN);
return schedules;
}
@JavascriptInterface
public String getSchedule(String scheduleId)throws Exception {
//String schedules= "{\"programIds\":[\"1\",\"2\"],\"programs\":[{\"id\":\"1\",\"name\":\"Evening right side\",\"startTime\":\"19:07\",\"duration\":\"6\",\"days\":[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"0\"],\"outputs\":[\"0\"]},{\"id\":\"2\",\"name\":\"Evening left side\",\"startTime\":\"19:00\",\"duration\":\"6\",\"days\":[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"0\"],\"outputs\":[\"1\"]}]}";
String schedule = httpHelper.sendGet( PROTOCOL + HOST_IP + "/api/programs/" + scheduleId + "?" + SESSION_TOKEN);
return schedule;
}
@JavascriptInterface
public String deleteSchedule(String scheduleId)throws Exception {
String schedule = httpHelper.sendDelete( PROTOCOL + HOST_IP + "/api/programs/" + scheduleId + "?" + SESSION_TOKEN);
return schedule;
}
@JavascriptInterface
public String getStatus()throws Exception {
String status = httpHelper.sendGet( PROTOCOL + HOST_IP + "/status?" + SESSION_TOKEN);
return status;
}
@JavascriptInterface
public String getTime()throws Exception {
String status = httpHelper.sendGet( PROTOCOL + HOST_IP + "/time?" + SESSION_TOKEN);
return status;
}
//api/programs/" + scheduleId;
//Android.updateSchedule(scheduleId, JSON.toString($scope.schedule));
@JavascriptInterface
public void createSchedule(String scheduleJsonString)throws Exception {
System.out.printf("Create Schedule, JSON: %s%n", scheduleJsonString);
String status = httpHelper.sendPost( PROTOCOL + HOST_IP + "/api/programs/-1?" + SESSION_TOKEN, scheduleJsonString);
//return status;
}
@JavascriptInterface
public void updateSchedule(String scheduleId, String scheduleJsonString)throws Exception {
System.out.printf(" ^^Update Schedule, ID: %s, JSON: %s%n", scheduleId, scheduleJsonString);
String status = httpHelper.sendPut( PROTOCOL + HOST_IP + "/api/programs/" + scheduleId + "?" + SESSION_TOKEN, scheduleJsonString);
//return status;
}
@JavascriptInterface
public void updateZones(String zonesJsonString)throws Exception {
System.out.printf(" ^^Update Zones, JSON: %s%n", zonesJsonString);
String status = httpHelper.sendPut( PROTOCOL + HOST_IP + "/api/zones?" + SESSION_TOKEN, zonesJsonString);
//return status;
}
@JavascriptInterface
public void changeZoneStatus(String zoneId, String updateJsonString)throws Exception {
System.out.printf(" ^^Update Zone Status, ID: %s, JSON: %s%n", zoneId, updateJsonString);
String status = httpHelper.sendPut( PROTOCOL + HOST_IP + "/api/programOverwrite/" + zoneId + "?" + SESSION_TOKEN, updateJsonString);
//return status;
}
@JavascriptInterface
public String getWifis(){
WifiManager wifiManager = (WifiManager) applicationContext.getSystemService(Context.WIFI_SERVICE);
List<ScanResult> apList = wifiManager.getScanResults();
StringBuffer json = new StringBuffer();
json.append("[");
for(int i=0; i<apList.size(); i++){
json.append("{");
String ssid = apList.get(i).SSID;
json.append(createAttribute("ssid", ssid));
json.append("},");
}
json.append("]");
return json.toString();
}
public String createAttribute(String key, String value){
return "\"" + key + "\":" + "\"" + value + "\"";
}
}
| [
"gilyaary@gmail.com"
] | gilyaary@gmail.com |
9f6f4c06b0550ce4c756f3a46d1a8f9ad224ed29 | 8a3d358ee321c50c8883afa9a08c5216150d522f | /workplace-sugon-salon/cloud-eureka-server7001/src/main/java/com/sugon/gaowz/EurekaServer7001.java | 7bd98266deee67d58a6e2e2245a136ed9c7a1bfa | [] | no_license | Gwisdomm/sugon-cloud-eureka | 13ca4f641c83c067b20b2f4352fe78fa231ed501 | 17c26576d75fcf0a6f0246f45c9a6dfcf87d71a9 | refs/heads/master | 2023-05-09T16:14:44.000884 | 2021-06-02T06:56:38 | 2021-06-02T06:56:38 | 364,885,898 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 545 | java | package com.sugon.gaowz;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
/**
* @program: workplace-sugon-salon
* @description: EurekaServer7001主启动类
* @date: 22:35 2021/4/18
* @author: gaowz
**/
@EnableEurekaServer
@SpringBootApplication
public class EurekaServer7001 {
public static void main(String[] args) {
SpringApplication.run(EurekaServer7001.class,args);
}
}
| [
"gwisdoms@outlook.com"
] | gwisdoms@outlook.com |
c15c396dfeeb7a60ea4f9f75e6fa36311f570791 | 85ca906b4790a11437f7f6cb606c03ad9622e2a3 | /src/main/java/dao/ShowLibraryDiscussDao.java | 0fdc4f3ee1852adf489fd3ac85bca64be2db3f19 | [] | no_license | Pan763059467/SeqSystem_bgManager | fea9283b33e56f26aa92236fe10574284838bbe5 | 7b18afedd5f1dcf809d8085a83d3153854fdedf3 | refs/heads/master | 2020-03-22T21:03:42.256118 | 2019-01-16T07:47:01 | 2019-01-16T07:47:01 | 140,653,319 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 166 | java | package dao;
import entity.LibrarydiscussEntity;
import java.util.List;
public interface ShowLibraryDiscussDao {
List<LibrarydiscussEntity> getAllDiscuss();
}
| [
"763059467@qq.com"
] | 763059467@qq.com |
9aa96add4c17987d71f237bab8c61b6db2dd0a03 | ce0e785348eccfbe071648e1a32ba7b9b74ead60 | /exchange-restweb-starter/src/main/java/com/gop/web/base/controlleradvice/FaultBarrier.java | 0628e2f6902e597447bc26818361d5a960111651 | [] | no_license | littleOrange8023/market | 0c279e8dd92db4dd23e20aeff037e4b2998f9e0e | 093ce8850624061bb6e51dd064b606c82fccbadd | refs/heads/master | 2020-04-19T11:05:11.191298 | 2019-01-25T07:04:27 | 2019-01-25T07:04:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,190 | java | package com.gop.web.base.controlleradvice;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.MissingPathVariableException;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.UnsatisfiedServletRequestParameterException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
import org.springframework.web.servlet.NoHandlerFoundException;
import com.google.common.collect.ImmutableMap;
import com.gop.code.consts.CommonCodeConst;
import com.gop.conetxt.WebApiResponseFactory;
import com.gop.exception.AppException;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@ControllerAdvice
public class FaultBarrier {
@Autowired
@Qualifier("webApiResponseFactory")
WebApiResponseFactory webApiResponseFactory;
private static final ImmutableMap<Class<? extends Throwable>, String> EXCEPTION_MAPPINGS;
static {
final ImmutableMap.Builder<Class<? extends Throwable>, String> builder = ImmutableMap.builder();
// SpringMVC中参数类型转换异常,常见于String找不到对应的ENUM而抛出的异常
builder.put(UnsatisfiedServletRequestParameterException.class, CommonCodeConst.FIELD_ERROR);
builder.put(IllegalArgumentException.class, CommonCodeConst.FIELD_ERROR);
// HTTP Request Method不存在
builder.put(NoHandlerFoundException.class, CommonCodeConst.INVALID_REQUEST);
builder.put(MethodArgumentNotValidException.class, CommonCodeConst.FIELD_ERROR);
builder.put(HttpRequestMethodNotSupportedException.class, CommonCodeConst.FIELD_ERROR);
builder.put(MissingServletRequestParameterException.class, CommonCodeConst.FIELD_ERROR);
builder.put(MissingPathVariableException.class, CommonCodeConst.FIELD_ERROR);
builder.put(MethodArgumentTypeMismatchException.class, CommonCodeConst.FIELD_ERROR);
// 要求有RequestBody的地方却传入了NULL
builder.put(HttpMessageNotReadableException.class, CommonCodeConst.FIELD_ERROR);
// 其他未被发现的异常
builder.put(Exception.class, CommonCodeConst.FIELD_ERROR);
EXCEPTION_MAPPINGS = builder.build();
}
@ExceptionHandler(AppException.class)
@ResponseBody
public Object exp(HttpServletRequest request, AppException ex) {
Locale locale = LocaleContextHolder.getLocale();
try {
/**原来的代码逻辑里不会返回异常信息*/
// if (StringUtils.isNotBlank(ex.getMessage())){
// return webApiResponseFactory.get(ex.getErrCode(), ex.getAttach(), ex.getMessage());
// }
return webApiResponseFactory.get(ex.getErrCode(), ex.getFormat(), ex.getAttach(), locale);
} catch (Exception e) {
log.error("获取错误代码异常:", e);
return webApiResponseFactory.get(CommonCodeConst.SERVICE_ERROR, null, null, locale);
}
}
@ExceptionHandler(Exception.class)
@ResponseBody
public Object noHandlerexp(HttpServletRequest request, Exception ex) {
String url = "";
url += request.getServletPath();
if (request.getQueryString() != null) {
url += "?" + request.getQueryString();
}
Locale locale = LocaleContextHolder.getLocale();
String code = EXCEPTION_MAPPINGS.get(ex.getClass());
if (null != code) {
return webApiResponseFactory.get(code, null, null, locale);
}
log.error("发现没有处理的异常url:{},e:{}", url, ex);
log.error("stack", ex);
return webApiResponseFactory.get(CommonCodeConst.SERVICE_ERROR, null, null, locale);
}
}
| [
"ydq@yangdongqiongdeMacBook-Air.local"
] | ydq@yangdongqiongdeMacBook-Air.local |
d00ac58421c3ca40af15bc041850948b69e28604 | 01f9f55f8bc4482120f3dbdd2117ba71cb3d95c1 | /Backend/src/main/java/com/ttu/tarkvaratehnika/empires/gameofempires/security/TokenService.java | c1717e1572419b1e68fe0bb1e363b347b334e5d6 | [] | no_license | Dmgolov/IDK0071 | 9bce5859c89114b4c55e019c88ea8ccef5dba6e2 | 672f3b10225c017196a6a4df84f8ed251236b2ce | refs/heads/master | 2021-05-01T20:55:22.010231 | 2018-05-16T00:35:02 | 2018-05-16T00:35:02 | 120,967,380 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,411 | java | package com.ttu.tarkvaratehnika.empires.gameofempires.security;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.SignatureException;
import io.jsonwebtoken.impl.crypto.MacProvider;
import org.springframework.stereotype.Service;
import javax.crypto.SecretKey;
import java.util.Date;
import java.util.Optional;
@Service
public class TokenService {
private SecretKey JWTS_KEY;
private final int EXPIRATION_TIME = 180;
private final SignatureAlgorithm SIGNATURE_ALGORITHM = SignatureAlgorithm.HS256;
public TokenService() {
generateSecretKeyToSignTokens();
}
private void generateSecretKeyToSignTokens() {
this.JWTS_KEY = MacProvider.generateKey(SIGNATURE_ALGORITHM);
}
public String generateToken(String username) {
Date now = new Date(System.currentTimeMillis());
Date dateLimit = new Date(now.getTime() + EXPIRATION_TIME * 60 * 1000);
return Jwts.builder()
.setSubject(username)
.setIssuedAt(now)
.setExpiration(dateLimit)
.signWith(SIGNATURE_ALGORITHM, JWTS_KEY)
.compact();
}
public boolean isActive(String token) {
try {
Optional<Date> expiration = Optional.of(Jwts.parser()
.setSigningKey(JWTS_KEY)
.parseClaimsJws(removeBearerPrefix(token))
.getBody()
.getExpiration());
return expiration.isPresent() && !hasExpirationTimePassed(expiration.get());
} catch (SignatureException | NullPointerException e) {
System.out.println(e.getMessage());
return false;
}
}
public Optional<String> getUsernameFromToken(String authToken) throws SignatureException {
try {
return Optional.of(Jwts.parser()
.setSigningKey(JWTS_KEY)
.parseClaimsJws(removeBearerPrefix(authToken))
.getBody()
.getSubject());
} catch (SignatureException | NullPointerException e) {
return Optional.empty();
}
}
private String removeBearerPrefix(String token) {
return token.substring(7);
}
private boolean hasExpirationTimePassed(Date date) {
return date.before(new Date(System.currentTimeMillis()));
}
}
| [
"vasten@ttu.ee"
] | vasten@ttu.ee |
72045990ca4209a309ef3c3d963d214b2578bf31 | 0fa4f30936fc87734a82eb73b4616677c6ad64f1 | /cloud-consumerconsul-order80/src/main/java/com/lun/springcloud/OrderConsulMain80.java | bc9257cbdf6460eb1c8e1e71f8c92b794d235ec8 | [] | no_license | 595152660/cloud2020 | eb26f60f895eb4bf6fae1f5a4facd4f3936f2723 | ea516d24de2aac8d0acb3abf25aa1f02f397ddf3 | refs/heads/master | 2023-03-24T13:14:57.892889 | 2021-03-21T03:25:51 | 2021-03-21T03:25:51 | 315,536,431 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 330 | java | package com.lun.springcloud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class OrderConsulMain80 {
public static void main(String[] args) {
SpringApplication.run(OrderConsulMain80.class, args);
}
}
| [
"58930257+595152660@users.noreply.github.com"
] | 58930257+595152660@users.noreply.github.com |
f9c0559ea4155bad5f1e1abfbda6fd09c7a045ef | 08a3d3ec5c8aef609c66ccd052f51f8e84e47f22 | /febs-gateway/src/main/java/cc/mrbird/febs/gateway/enhance/service/RouteLogService.java | d6bf8ff68c08a1ac119644f05564c32e3be60531 | [
"Apache-2.0"
] | permissive | wx7614140/FEBS-Cloud | 4be3e36708fab687ba520973182c1629783350a4 | 82640fefe5c674116f237021da2d6fccfbcc7bae | refs/heads/master | 2021-09-23T18:21:24.010334 | 2021-09-10T06:23:50 | 2021-09-10T06:23:50 | 207,196,363 | 2 | 0 | Apache-2.0 | 2020-10-31T12:40:06 | 2019-09-09T01:08:50 | Java | UTF-8 | Java | false | false | 1,132 | java | package cc.mrbird.febs.gateway.enhance.service;
import cc.mrbird.febs.common.core.entity.QueryRequest;
import cc.mrbird.febs.gateway.enhance.entity.RouteLog;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
/**
* @author MrBird
*/
public interface RouteLogService {
/**
* 查找所有路由日志
*
* @return 路有日志列表
*/
Flux<RouteLog> findAll();
/**
* 创建路由日志
*
* @param routeLog 路由日志
* @return 路由日志
*/
Mono<RouteLog> create(RouteLog routeLog);
/**
* 删除路由日志
*
* @param ids 路由日志id
* @return 被删除的路由日志
*/
Flux<RouteLog> delete(String ids);
/**
* 查找路由日志分页数据
*
* @param request request
* @param routeLog routeLog
* @return 路由日志分页数据
*/
Flux<RouteLog> findPages(QueryRequest request, RouteLog routeLog);
/**
* 查找路由分页数据count
*
* @param routeLog routeLog
* @return count
*/
Mono<Long> findCount(RouteLog routeLog);
}
| [
"852252810@qq.com"
] | 852252810@qq.com |
7c5f5f2b82359124047bf629cdfcabb4be35c5bd | bccb412254b3e6f35a5c4dd227f440ecbbb60db9 | /hl7/model/V2_7/group/PATIENT_OMG_O19.java | 3058523b570a85c27974325e68e41648df4f1296 | [] | no_license | nlp-lap/Version_Compatible_HL7_Parser | 8bdb307aa75a5317265f730c5b2ac92ae430962b | 9977e1fcd1400916efc4aa161588beae81900cfd | refs/heads/master | 2021-03-03T15:05:36.071491 | 2020-03-09T07:54:42 | 2020-03-09T07:54:42 | 245,967,680 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 10,203 | java | package hl7.model.V2_7.group;
import hl7.bean.Structure;
import hl7.bean.group.Group;
import hl7.bean.message.MessageStructure;
import hl7.bean.segment.Segment;
public class PATIENT_OMG_O19 extends hl7.model.V2_6.group.PATIENT_OMG_O19{
public static final String VERSION = "2.7";
public static int SIZE = 9;
public Structure[][] components = new Structure[SIZE][];
public static Structure[] standard = new Structure[SIZE];
public static boolean[] optional = new boolean[SIZE];
public static boolean[] repeatable = new boolean[SIZE];
static{
standard[0]=hl7.pseudo.segment.PID.CLASS;
standard[1]=hl7.pseudo.segment.PD1.CLASS;
standard[2]=hl7.pseudo.segment.PRT.CLASS;
standard[3]=hl7.pseudo.segment.NTE.CLASS;
standard[4]=hl7.pseudo.segment.NK1.CLASS;
standard[7]=hl7.pseudo.segment.GT1.CLASS;
standard[8]=hl7.pseudo.segment.AL1.CLASS;
standard[5]=hl7.pseudo.group.PATIENT_VISIT_OMG_O19.CLASS;
standard[6]=hl7.pseudo.group.INSURANCE_OMG_O19.CLASS;
optional[0]=false;
optional[1]=false;
optional[2]=false;
optional[3]=false;
optional[4]=false;
optional[7]=false;
optional[8]=false;
optional[5]=true;
optional[6]=true;
repeatable [0]=false;
repeatable [1]=false;
repeatable [2]=false;
repeatable [3]=false;
repeatable [4]=false;
repeatable [7]=false;
repeatable [8]=false;
repeatable [5]=true;
repeatable [6]=true;
}
@Override
public Group cloneClass(String originalVersion, String setVersion) {
hl7.pseudo.group.PATIENT_OMG_O19 group = new hl7.pseudo.group.PATIENT_OMG_O19();
group.originalVersion = originalVersion;
group.setVersion = setVersion;
return group;
}
public void setVersion(String setVersion) {
super.setVersion(setVersion);
this.setVersion = setVersion;
for(int i=0; i<components.length; i++){
Structure[] structures = components[i];
for(int c=0; structures!=null&&c<structures.length; c++){
Structure structure = components[i][c];
structure.setVersion(setVersion);
}
}
}
public void originalVersion(String originalVersion) {
super.originalVersion(originalVersion);
this.originalVersion = originalVersion;
for(int i=0; i<components.length; i++){
Structure[] structures = components[i];
for(int c=0; structures!=null&&c<structures.length; c++){
Structure structure = components[i][c];
structure.originalVersion(originalVersion);
}
}
}
public Structure[][] getComponents(){
if(setVersion.equals(VERSION)){
return components;
}else{
return super.getComponents();
}
}
public boolean needsNewGroup(String segmentType, Structure[] comps){
if(comps==null) return true;
//앱력 Segment의 위치 알아내기
int stdIndex = indexStandard(segmentType);
//현재 components의 마지막 객체 저장 위치 알아내기
int compIndex = -1;
for(int i=0; i<comps.length; i++){
if(comps[i]!=null) compIndex = i;
}
//입력 Segment의 위치가 components 마지막 객체 위치보다 같거나(중복저장) 뒤(추가) 인가?
return stdIndex>=compIndex;
}
public int indexStandard(String segmentType){
int stdIndex = -1;
for(int i=0; i<standard.length; i++){
Structure structure = standard[i];
if(structure instanceof Segment){
if(segmentType.equals(structure.getType())){
stdIndex = i;
break;
}
}else if(structure instanceof Group){
Group group = (Group)structure;
stdIndex = group.indexStandard(segmentType);
if(stdIndex>=0) break;
}
}
return stdIndex;
}
private boolean compiled = false; //최초 컴파일 여부 확인
public void decode(String message) throws Exception {
if(MessageStructure.getVersionCode(originalVersion)<MessageStructure.getVersionCode(VERSION)){
super.decode(message);
}else{
compiled = true; //최초 컴파일 여부 확인
char separator = MessageStructure.SEGMENT_TERMINATOR;
String[] comps = divide(message, separator);
if(comps==null) return;
int[] index = new int[2];
while(index[0]<comps.length && index[1]<SIZE){
decode(originalVersion, setVersion, VERSION, index, index[1], comps);
}
}
}
public void decode(String originalVersion, String setVersion, String VERSION, int[] index, int prevLength, String[] comps) throws Exception{
int[] newIndex = new int[]{index[0], 0};
while(newIndex[1]<standard.length){
Structure structure = standard[newIndex[1]];
if(comps.length<=newIndex[0]){
index[0]=newIndex[0];
return;
}
String comp = comps[newIndex[0]];
String segmentType = comp.substring(0, 3);
if(structure instanceof Segment){ //Segment일 때
String standardType = structure.getType();
if(segmentType.equals(standardType)){ //표준과 Type이 동일한가?
Segment segment = ((Segment)structure).cloneClass(originalVersion, setVersion);
segment.originalVersion(originalVersion);
segment.decode(comp);
addStructure(components, segment, newIndex[1]);
newIndex[0]++; //다음 comp 처리
}else{
newIndex[1]++; //다음 Segment와 비교
}
}else if(structure instanceof Group){
Group group = (Group)structure;
int stdIndex = group.indexStandard(segmentType);
if(stdIndex<0){
newIndex[1]++;
}else{
boolean needsNewGroup = group.needsNewGroup(segmentType, components[newIndex[1]]);
if(needsNewGroup){
Group newGroup = group.cloneClass(originalVersion, setVersion);
newGroup.originalVersion(originalVersion);
newGroup.decode(originalVersion, setVersion, VERSION, newIndex, prevLength, comps);
addStructure(components, newGroup, newIndex[1]);
newIndex[0]++;
}else{
group.decode(originalVersion, setVersion, VERSION, newIndex, prevLength, comps);
}
}
}
}
index[0]=newIndex[0];
}
public static void addStructure(Structure[][] components, Structure structure, int index){
if(components.length<=index) return;
Structure[] comps = components[index];
Structure[] newComps;
newComps = (comps==null)?new Structure[1]:new Structure[comps.length+1];
for(int i=0; i<newComps.length-1; i++) newComps[i]=comps[i];
newComps[newComps.length-1] = structure;
components[index] = newComps;
}
/* -----------------------------------------------------------------
* 이전 버전으로 매핑 components:구버전, subComponents:신버전
* 신버전 메시지-->구버전 파서(상위호환)
* -----------------------------------------------------------------
*/
public static void backward(Structure[][] components, Structure[][] subComponents, String originalVersion, String setVersion) throws Exception{
}
/* -----------------------------------------------------------------
* 이후 버전으로 매핑 components:구버전, subComponents:신버전
* 구버전 메시지-->신버전 파서(하위호환)
* -----------------------------------------------------------------
*/
public static void forward(Structure[][] components, Structure[][] subComponents, String originalVersion, String setVersion) throws Exception{
subComponents[0] = components[0];
subComponents[1] = components[1];
subComponents[3] = components[2];
subComponents[4] = components[3];
subComponents[5] = components[4];
subComponents[6] = components[5];
subComponents[7] = components[6];
subComponents[2] = null;
subComponents[8] = null;
}
public String encode() throws Exception{
seekOriginalVersion = true; //가장 마지막 메소드에서 위치찾기 옵션 설정
return encode(null);
}
public String encode(Structure[][] subComponents) throws Exception{
if(seekOriginalVersion&&MessageStructure.getVersionCode(originalVersion)<MessageStructure.getVersionCode(VERSION)){ //실제 버전의 위치 찾기
//실제 버전이 현재 위치가 아닐 때
//실제 버전 위치 찾아가기
return super.encode(null);
}else{//실제 버전의 위치 찾기
seekOriginalVersion = false;
//실제 버전이 현재 위치일 때
if(setVersion.equals(VERSION)){ //설정 버전의 위치 찾기
//설정 버전이 현재 위치일 때
String message = this.makeMessage(components, VERSION);
return message;
}else{ //설정 버전의 위치 찾기
//설정 버전이 현재 위치가 아닐 때
if(MessageStructure.getVersionCode(setVersion)<MessageStructure.getVersionCode(VERSION)){ //버전으로 이동 방향 찾기
//설정 버전이 현재 버전보다 낮을 때 (backward)
hl7.model.V2_6.group.PATIENT_OMG_O19 type = (hl7.model.V2_6.group.PATIENT_OMG_O19)this;
type.backward(type.components, components, originalVersion, setVersion);
//}
return super.encode(components);
}else{ //버전으로 이동 방향 찾기
/*-------------------------------------------------------------
*설정 버전이 현재 버전보다 높을 때(forward)
*이후 버전으로 Casting 후 forward 호출
*마지막 버전은 생략
*-----------------------------------------------------------------
*/
encodeVersion = VERSION;
return this.encodeForward(encodeVersion, setVersion);
}
}
}
}
public String encodeForward(String encodeVersion, String setVersion) throws Exception{
//하위 버전으로 인코딩 시 해당 위치를 찾아 가도록 (메소드 오버라이딩 때문에 처음부터 다시 찾아가야 함)
if(encodeVersion.equals(VERSION)){
return null;
}else{
return super.encodeForward(encodeVersion, setVersion);
}
}
public String makeMessage(Structure[][] components, String version) throws Exception{
if(VERSION.equals(version)){
setCharacter(components, version);
String message = "";
char separator = MessageStructure.SEGMENT_TERMINATOR;
for(int i=0; i<SIZE; i++){
if(components[i]==null) continue;
for(int j=0; j<components[i].length; j++){
if(!repeatable[i]&&j>0) continue;
String segment = components[i][j].encode();
if(segment!=null){
if(message.length()>0) message += separator;
message += segment;
}
}
}
return (message.length()==0)?null:message;
}else{
return super.makeMessage(components, version);
}
}
}
| [
"terminator800@hanmail.net"
] | terminator800@hanmail.net |
c68cdcc37c8022822bfff8b409cfafc3bc0cc36c | 284b622e2820018503441c1810e2df1636860a1e | /IoT_Edge/persistence-service-ref-app/app/src/main/java/com/sap/persistenceservice/refapp/utils/HttpRequestUtil.java | 0367f8a2cc6432f613b5c44253b3e55d9b4c3787 | [
"Apache-2.0"
] | permissive | steven-g/iot-edge-samples | 2fcadeb9c6a185232ba0835c81ef0966ba6cb7a2 | 09a37bcbd6e619161e6d25e6946638b338dc4752 | refs/heads/main | 2023-08-30T04:30:45.699083 | 2021-11-16T16:46:21 | 2021-11-16T16:46:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,150 | java | package com.sap.persistenceservice.refapp.utils;
import java.io.IOException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
public class HttpRequestUtil {
private static final Logger logger = LoggerFactory.getLogger(HttpRequestUtil.class);
private HttpRequestUtil() {
}
/**
* Returns odata measures
*
* @param getRequest
* @param poolingHttpConnectionManager
* @return
*/
public static ResponseEntity<String> getData(HttpGet getRequest,
PoolingHttpClientConnectionManager poolingHttpConnectionManager) {
try (CloseableHttpResponse response = HttpClients.custom().setConnectionManager(poolingHttpConnectionManager)
.build()
.execute(getRequest)) {
logger.debug("Response code {} and status {}", response.getStatusLine().getStatusCode(),
response.getStatusLine().getReasonPhrase());
String responseEntities = EntityUtils.toString(response.getEntity());
if (logger.isDebugEnabled()) {
logger.debug("Response returned : {}", responseEntities);
}
return new ResponseEntity<>(responseEntities, HttpStatus.OK);
} catch (IOException ex) {
logger.error("Error while making call to the persistence service {}", ex.getMessage());
return new ResponseEntity<>(ex.getMessage(),
HttpStatus.INTERNAL_SERVER_ERROR);
}
}
/**
* Returns raw response
*
* @param getRequest
* @param poolingHttpConnectionManager
* @return
*/
public static String getRawData(HttpGet getRequest,
PoolingHttpClientConnectionManager poolingHttpConnectionManager) {
String responseEntities = null;
try (CloseableHttpResponse response = HttpClients.custom().setConnectionManager(poolingHttpConnectionManager)
.build()
.execute(getRequest)) {
responseEntities = EntityUtils.toString(response.getEntity());
logger.debug("Response code {} and status {}", response.getStatusLine().getStatusCode(),
response.getStatusLine().getReasonPhrase());
if (logger.isDebugEnabled()) {
logger.debug("Response returned : {}", responseEntities);
}
} catch (IOException ex) {
logger.error("Error while making call to the service {}", ex.getMessage());
}
return responseEntities;
}
/**
* This method deletes the entity
*
* @param deleteRequest
* @param poolingHttpConnectionManager
* @return
*/
public static ResponseEntity<String> delete(HttpDelete deleteRequest,
PoolingHttpClientConnectionManager poolingHttpConnectionManager) {
try (CloseableHttpResponse response = HttpClients.custom().setConnectionManager(poolingHttpConnectionManager)
.build()
.execute(deleteRequest)) {
logger.debug("Response code {} and status {}", response.getStatusLine().getStatusCode(),
response.getStatusLine().getReasonPhrase());
if (response.getStatusLine().getStatusCode() == 204) {
return new ResponseEntity<>(HttpStatus.valueOf(response.getStatusLine().getStatusCode()));
}
return new ResponseEntity<>(EntityUtils.toString(response.getEntity()),
HttpStatus.valueOf(response.getStatusLine().getStatusCode()));
} catch (IOException ex) {
logger.error("Error while making call to the persistence service {}", ex.getMessage());
return new ResponseEntity<>(ex.getMessage(),
HttpStatus.INTERNAL_SERVER_ERROR);
}
}
}
| [
"joelle.curcio@sap.com"
] | joelle.curcio@sap.com |
c1af520e60d9349f75592da97ac2d1833dbe376c | 186f1bed337f8ff2640d01f759501a65d080cfaf | /Builder/src/MansãoBuilder.java | 1b397d1971d5348f4be0f5d1f3cc1d56d473d685 | [] | no_license | elciojunior7/elciojunior_padroesprojeto | 265bd1b23a6ef4e3aa6c88268cbef7c315fc0a8e | 04c6d90cb694901ec461965b913c32b78e67b195 | refs/heads/master | 2020-06-25T22:58:19.642281 | 2019-08-12T02:54:38 | 2019-08-12T02:54:38 | 199,446,985 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 227 | java |
public class MansãoBuilder extends CasaBuilder{
@Override
public void buildPreco() {
casa.preco = 3400000.00;
}
@Override
public void buildAnoConstrucao() {
casa.anoConstrucao = 2015;
}
}
| [
"elciosouza.junior@gmail.com"
] | elciosouza.junior@gmail.com |
cab0cf0daa4dc0316188205195cdc396a4ed636c | e2b13d0ccf8c9ba19e32c9f62bca6c52c5c9b04c | /app/src/main/java/studio/baka/opap/utils/ListUtils.java | 845f7ae3c10876a63ca0ac6047fcd33ca38aa711 | [] | no_license | BBleae/BakaOpap | 7340e13d57155f5047dad5465083a62c778d21e8 | 1eddc16a46ba4b2845a456cdcc653acfb70d2ae2 | refs/heads/master | 2020-03-07T14:26:33.307783 | 2018-03-31T16:53:55 | 2018-03-31T16:53:55 | 127,526,510 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,047 | java | package studio.baka.opap.utils;
import android.net.wifi.ScanResult;
import java.util.ArrayList;
import java.util.List;
/**
* Created by mayubao on 2016/11/28.
* Contact me 345269374@qq.com
*/
public class ListUtils {
public static final String NO_PASSWORD = "[ESS]";
public static final String NO_PASSWORD_WPS = "[WPS][ESS]";
/**
* 过滤有密码的Wifi扫描结果集合
* @param scanResultList
* @return
*/
public static List<ScanResult> filterWithNoPassword(List<ScanResult> scanResultList){
if(scanResultList == null || scanResultList.size() == 0){
return scanResultList;
}
List<ScanResult> resultList = new ArrayList<>();
for(ScanResult scanResult : scanResultList){
if(scanResult.capabilities != null && scanResult.capabilities.equals(NO_PASSWORD) || scanResult.capabilities != null && scanResult.capabilities.equals(NO_PASSWORD_WPS)){
resultList.add(scanResult);
}
}
return resultList;
}
}
| [
"bbleae@baka.studio"
] | bbleae@baka.studio |
f3832641336b3e78eded2eedae6c42f729a1d6dd | d821b49a65aa6b94f45b42cebe93c0f862c03b37 | /DS/Tree problem/TestJAVACC/src/foo/syntaxtree/NodeTCF.java | 10866bba2010ebd96456ed66f07c80a7101644a1 | [] | no_license | sainisumitcs/Rajat2_Code | 8245de0ebfe177c4cff94aec80f321d0ffbbacd0 | 55238e289af14ae266206ae634df415cbe961673 | refs/heads/master | 2022-12-06T14:28:34.827954 | 2019-05-29T14:49:13 | 2019-05-29T14:49:13 | 192,717,320 | 0 | 0 | null | 2022-11-24T05:48:41 | 2019-06-19T11:15:29 | Java | UTF-8 | Java | false | false | 360 | java | /* Generated by JTB 1.4.11 */
package foo.syntaxtree;
public class NodeTCF extends NodeToken {
private static final long serialVersionUID = 1411L;
public NodeTCF(String s) {
super(s, -1, -1, -1, -1, -1);
}
public NodeTCF(String s, final int kn, final int bl, final int bc, final int el, final int ec) {
super(s, kn, bl, bc, el, ec);
}
}
| [
"50868914+mycodehistory@users.noreply.github.com"
] | 50868914+mycodehistory@users.noreply.github.com |
880f01303aecadfba0addbbbd955d2d3b2f09201 | 140dfd304d4b870e9bb43dd16c66984d3405e893 | /app/src/main/java/com/shima/smartbushome/assist/holocolorpicker/ColorPicker.java | fbb678d0280a469cd2f539c73cdb5b7092395c5d | [] | no_license | PENGZHIJING/G4AirBus | 7fc6f8941f6fa553c3c97b118f750f0a3cf125b8 | 9efb2ad1071a7a4c4fe19557f8f2e1d664d4bd2b | refs/heads/master | 2020-07-07T23:47:59.439277 | 2019-10-25T09:56:22 | 2019-10-25T09:57:12 | 203,500,393 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 25,126 | java | /*
* Copyright 2012 Lars Werkman
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.shima.smartbushome.assist.holocolorpicker;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.SweepGradient;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import com.shima.smartbushome.R;
/**
* Displays a holo-themed color picker.
*
* <p>
* Use {@link #getColor()} to retrieve the selected color. <br>
* Use {@link #addSVBar(SVBar)} to add a Saturation/Value Bar. <br>
* Use {@link #addOpacityBar(OpacityBar)} to add a Opacity Bar.
* </p>
*/
public class ColorPicker extends View {
/*
* Constants used to save/restore the instance state.
*/
private static final String STATE_PARENT = "parent";
private static final String STATE_ANGLE = "angle";
private static final String STATE_OLD_COLOR = "color";
private static final String STATE_SHOW_OLD_COLOR = "showColor";
/**
* Colors to construct the color wheel using {@link SweepGradient}.
*/
private static final int[] COLORS = new int[] { 0xFFFF0000, 0xFFFF00FF,
0xFF0000FF, 0xFF00FFFF, 0xFF00FF00, 0xFFFFFF00, 0xFFFF0000 };
/**
* {@code Paint} instance used to draw the color wheel.
*/
private Paint mColorWheelPaint;
/**
* {@code Paint} instance used to draw the pointer's "halo".
*/
private Paint mPointerHaloPaint;
/**
* {@code Paint} instance used to draw the pointer (the selected color).
*/
private Paint mPointerColor;
/**
* The width of the color wheel thickness.
*/
private int mColorWheelThickness;
/**
* The radius of the color wheel.
*/
private int mColorWheelRadius;
private int mPreferredColorWheelRadius;
/**
* The radius of the center circle inside the color wheel.
*/
private int mColorCenterRadius;
private int mPreferredColorCenterRadius;
/**
* The radius of the halo of the center circle inside the color wheel.
*/
private int mColorCenterHaloRadius;
private int mPreferredColorCenterHaloRadius;
/**
* The radius of the pointer.
*/
private int mColorPointerRadius;
/**
* The radius of the halo of the pointer.
*/
private int mColorPointerHaloRadius;
/**
* The rectangle enclosing the color wheel.
*/
private RectF mColorWheelRectangle = new RectF();
/**
* The rectangle enclosing the center inside the color wheel.
*/
private RectF mCenterRectangle = new RectF();
/**
* {@code true} if the user clicked on the pointer to start the move mode. <br>
* {@code false} once the user stops touching the screen.
*
* @see #onTouchEvent(MotionEvent)
*/
private boolean mUserIsMovingPointer = false;
/**
* The ARGB value of the currently selected color.
*/
private int mColor;
/**
* The ARGB value of the center with the old selected color.
*/
private int mCenterOldColor;
/**
* Whether to show the old color in the center or not.
*/
private boolean mShowCenterOldColor;
/**
* The ARGB value of the center with the new selected color.
*/
private int mCenterNewColor;
/**
* Number of pixels the origin of this view is moved in X- and Y-direction.
*
* <p>
* We use the center of this (quadratic) View as origin of our internal
* coordinate system. Android uses the upper left corner as origin for the
* View-specific coordinate system. So this is the value we use to translate
* from one coordinate system to the other.
* </p>
*
* <p>
* Note: (Re)calculated in {@link #onMeasure(int, int)}.
* </p>
*
* @see #onDraw(Canvas)
*/
private float mTranslationOffset;
/**
* Distance between pointer and user touch in X-direction.
*/
private float mSlopX;
/**
* Distance between pointer and user touch in Y-direction.
*/
private float mSlopY;
/**
* The pointer's position expressed as angle (in rad).
*/
private float mAngle;
/**
* {@code Paint} instance used to draw the center with the old selected
* color.
*/
private Paint mCenterOldPaint;
/**
* {@code Paint} instance used to draw the center with the new selected
* color.
*/
private Paint mCenterNewPaint;
/**
* {@code Paint} instance used to draw the halo of the center selected
* colors.
*/
private Paint mCenterHaloPaint;
/**
* An array of floats that can be build into a {@code Color} <br>
* Where we can extract the Saturation and Value from.
*/
private float[] mHSV = new float[3];
/**
* {@code SVBar} instance used to control the Saturation/Value bar.
*/
private SVBar mSVbar = null;
/**
* {@code OpacityBar} instance used to control the Opacity bar.
*/
private OpacityBar mOpacityBar = null;
/**
* {@code SaturationBar} instance used to control the Saturation bar.
*/
private SaturationBar mSaturationBar = null;
/**
* {@code TouchAnywhereOnColorWheelEnabled} instance used to control <br>
* if the color wheel accepts input anywhere on the wheel or just <br>
* on the halo.
*/
private boolean mTouchAnywhereOnColorWheelEnabled = true;
/**
* {@code ValueBar} instance used to control the Value bar.
*/
private ValueBar mValueBar = null;
/**
* {@code onColorChangedListener} instance of the onColorChangedListener
*/
private OnColorChangedListener onColorChangedListener;
/**
* {@code onColorSelectedListener} instance of the onColorSelectedListener
*/
private OnColorSelectedListener onColorSelectedListener;
public ColorPicker(Context context) {
super(context);
init(null, 0);
}
public ColorPicker(Context context, AttributeSet attrs) {
super(context, attrs);
init(attrs, 0);
}
public ColorPicker(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(attrs, defStyle);
}
/**
* An interface that is called whenever the color is changed. Currently it
* is always called when the color is changes.
*
* @author lars
*
*/
public interface OnColorChangedListener {
public void onColorChanged(int color);
}
/**
* An interface that is called whenever a new color has been selected.
* Currently it is always called when the color wheel has been released.
*
*/
public interface OnColorSelectedListener {
public void onColorSelected(int color);
}
/**
* Set a onColorChangedListener
*
* @param listener {@code OnColorChangedListener}
*/
public void setOnColorChangedListener(OnColorChangedListener listener) {
this.onColorChangedListener = listener;
}
/**
* Gets the onColorChangedListener
*
* @return {@code OnColorChangedListener}
*/
public OnColorChangedListener getOnColorChangedListener() {
return this.onColorChangedListener;
}
/**
* Set a onColorSelectedListener
*
* @param listener {@code OnColorSelectedListener}
*/
public void setOnColorSelectedListener(OnColorSelectedListener listener) {
this.onColorSelectedListener = listener;
}
/**
* Gets the onColorSelectedListener
*
* @return {@code OnColorSelectedListener}
*/
public OnColorSelectedListener getOnColorSelectedListener() {
return this.onColorSelectedListener;
}
/**
* Color of the latest entry of the onColorChangedListener.
*/
private int oldChangedListenerColor;
/**
* Color of the latest entry of the onColorSelectedListener.
*/
private int oldSelectedListenerColor;
private void init(AttributeSet attrs, int defStyle) {
final TypedArray a = getContext().obtainStyledAttributes(attrs,
R.styleable.ColorPicker, defStyle, 0);
final Resources b = getContext().getResources();
mColorWheelThickness = a.getDimensionPixelSize(
R.styleable.ColorPicker_color_wheel_thickness,
b.getDimensionPixelSize(R.dimen.color_wheel_thickness));
mColorWheelRadius = a.getDimensionPixelSize(
R.styleable.ColorPicker_color_wheel_radius,
b.getDimensionPixelSize(R.dimen.color_wheel_radius));
mPreferredColorWheelRadius = mColorWheelRadius;
mColorCenterRadius = a.getDimensionPixelSize(
R.styleable.ColorPicker_color_center_radius,
b.getDimensionPixelSize(R.dimen.color_center_radius));
mPreferredColorCenterRadius = mColorCenterRadius;
mColorCenterHaloRadius = a.getDimensionPixelSize(
R.styleable.ColorPicker_color_center_halo_radius,
b.getDimensionPixelSize(R.dimen.color_center_halo_radius));
mPreferredColorCenterHaloRadius = mColorCenterHaloRadius;
mColorPointerRadius = a.getDimensionPixelSize(
R.styleable.ColorPicker_color_pointer_radius,
b.getDimensionPixelSize(R.dimen.color_pointer_radius));
mColorPointerHaloRadius = a.getDimensionPixelSize(
R.styleable.ColorPicker_color_pointer_halo_radius,
b.getDimensionPixelSize(R.dimen.color_pointer_halo_radius));
a.recycle();
mAngle = (float) (-Math.PI / 2);
Shader s = new SweepGradient(0, 0, COLORS, null);
mColorWheelPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mColorWheelPaint.setShader(s);
mColorWheelPaint.setStyle(Paint.Style.STROKE);
mColorWheelPaint.setStrokeWidth(mColorWheelThickness);
mPointerHaloPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mPointerHaloPaint.setColor(Color.BLACK);
mPointerHaloPaint.setAlpha(0x50);
mPointerColor = new Paint(Paint.ANTI_ALIAS_FLAG);
mPointerColor.setColor(calculateColor(mAngle));
mCenterNewPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mCenterNewPaint.setColor(calculateColor(mAngle));
mCenterNewPaint.setStyle(Paint.Style.FILL);
mCenterOldPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mCenterOldPaint.setColor(calculateColor(mAngle));
mCenterOldPaint.setStyle(Paint.Style.FILL);
mCenterHaloPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mCenterHaloPaint.setColor(Color.BLACK);
mCenterHaloPaint.setAlpha(0x00);
mCenterNewColor = calculateColor(mAngle);
mCenterOldColor = calculateColor(mAngle);
mShowCenterOldColor = true;
}
@Override
protected void onDraw(Canvas canvas) {
// All of our positions are using our internal coordinate system.
// Instead of translating
// them we let Canvas do the work for us.
canvas.translate(mTranslationOffset, mTranslationOffset);
// Draw the color wheel.
canvas.drawOval(mColorWheelRectangle, mColorWheelPaint);
float[] pointerPosition = calculatePointerPosition(mAngle);
// Draw the pointer's "halo"
canvas.drawCircle(pointerPosition[0], pointerPosition[1],
mColorPointerHaloRadius, mPointerHaloPaint);
// Draw the pointer (the currently selected color) slightly smaller on
// top.
canvas.drawCircle(pointerPosition[0], pointerPosition[1],
mColorPointerRadius, mPointerColor);
// Draw the halo of the center colors.
canvas.drawCircle(0, 0, mColorCenterHaloRadius, mCenterHaloPaint);
/*if (mShowCenterOldColor) {
// Draw the old selected color in the center.
canvas.drawArc(mCenterRectangle, 90, 180, true, mCenterOldPaint);
// Draw the new selected color in the center.
canvas.drawArc(mCenterRectangle, 270, 180, true, mCenterNewPaint);
}
else {*/
// Draw the new selected color in the center.
canvas.drawArc(mCenterRectangle, 0, 360, true, mCenterNewPaint);
//}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int intrinsicSize = 2 * (mPreferredColorWheelRadius + mColorPointerHaloRadius);
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
int width;
int height;
if (widthMode == MeasureSpec.EXACTLY) {
width = widthSize;
} else if (widthMode == MeasureSpec.AT_MOST) {
width = Math.min(intrinsicSize, widthSize);
} else {
width = intrinsicSize;
}
if (heightMode == MeasureSpec.EXACTLY) {
height = heightSize;
} else if (heightMode == MeasureSpec.AT_MOST) {
height = Math.min(intrinsicSize, heightSize);
} else {
height = intrinsicSize;
}
int min = Math.min(width, height);
setMeasuredDimension(min, min);
mTranslationOffset = min * 0.5f;
// fill the rectangle instances.
mColorWheelRadius = min / 2 - mColorWheelThickness - mColorPointerHaloRadius;
mColorWheelRectangle.set(-mColorWheelRadius, -mColorWheelRadius,
mColorWheelRadius, mColorWheelRadius);
mColorCenterRadius = (int) ((float) mPreferredColorCenterRadius * ((float) mColorWheelRadius / (float) mPreferredColorWheelRadius));
mColorCenterHaloRadius = (int) ((float) mPreferredColorCenterHaloRadius * ((float) mColorWheelRadius / (float) mPreferredColorWheelRadius));
mCenterRectangle.set(-mColorCenterRadius, -mColorCenterRadius,
mColorCenterRadius, mColorCenterRadius);
}
private int ave(int s, int d, float p) {
return s + Math.round(p * (d - s));
}
/**
* Calculate the color using the supplied angle.
*
* @param angle The selected color's position expressed as angle (in rad).
*
* @return The ARGB value of the color on the color wheel at the specified
* angle.
*/
private int calculateColor(float angle) {
float unit = (float) (angle / (2 * Math.PI));
if (unit < 0) {
unit += 1;
}
if (unit <= 0) {
mColor = COLORS[0];
return COLORS[0];
}
if (unit >= 1) {
mColor = COLORS[COLORS.length - 1];
return COLORS[COLORS.length - 1];
}
float p = unit * (COLORS.length - 1);
int i = (int) p;
p -= i;
int c0 = COLORS[i];
int c1 = COLORS[i + 1];
int a = ave(Color.alpha(c0), Color.alpha(c1), p);
int r = ave(Color.red(c0), Color.red(c1), p);
int g = ave(Color.green(c0), Color.green(c1), p);
int b = ave(Color.blue(c0), Color.blue(c1), p);
mColor = Color.argb(a, r, g, b);
return Color.argb(a, r, g, b);
}
/**
* Get the currently selected color.
*
* @return The ARGB value of the currently selected color.
*/
public int getColor() {
return mCenterNewColor;
}
/**
* Set the color to be highlighted by the pointer. If the
* instances {@code SVBar} and the {@code OpacityBar} aren't null the color
* will also be set to them
*
* @param color The RGB value of the color to highlight. If this is not a
* color displayed on the color wheel a very simple algorithm is
* used to map it to the color wheel. The resulting color often
* won't look close to the original color. This is especially
* true for shades of grey. You have been warned!
*/
public void setColor(int color) {
mAngle = colorToAngle(color);
mPointerColor.setColor(calculateColor(mAngle));
// check of the instance isn't null
if (mOpacityBar != null) {
// set the value of the opacity
mOpacityBar.setColor(mColor);
mOpacityBar.setOpacity(Color.alpha(color));
}
// check if the instance isn't null
if (mSVbar != null) {
// the array mHSV will be filled with the HSV values of the color.
Color.colorToHSV(color, mHSV);
mSVbar.setColor(mColor,true);
// because of the design of the Saturation/Value bar,
// we can only use Saturation or Value every time.
// Here will be checked which we shall use.
if (mHSV[1] < mHSV[2]) {
mSVbar.setSaturation(mHSV[1]);
} else if(mHSV[1] > mHSV[2]){
mSVbar.setValue(mHSV[2]);
}
}
if (mSaturationBar != null) {
Color.colorToHSV(color, mHSV);
mSaturationBar.setColor(mColor);
mSaturationBar.setSaturation(mHSV[1]);
}
if (mValueBar != null && mSaturationBar == null) {
Color.colorToHSV(color, mHSV);
mValueBar.setColor(mColor);
mValueBar.setValue(mHSV[2]);
} else if (mValueBar != null) {
Color.colorToHSV(color, mHSV);
mValueBar.setValue(mHSV[2]);
}
setNewCenterColor(color);
}
/**
* Convert a color to an angle.
*
* @param color The RGB value of the color to "find" on the color wheel.
*
* @return The angle (in rad) the "normalized" color is displayed on the
* color wheel.
*/
private float colorToAngle(int color) {
float[] colors = new float[3];
Color.colorToHSV(color, colors);
return (float) Math.toRadians(-colors[0]);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
getParent().requestDisallowInterceptTouchEvent(true);
// Convert coordinates to our internal coordinate system
float x = event.getX() - mTranslationOffset;
float y = event.getY() - mTranslationOffset;
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
// Check whether the user pressed on the pointer.
float[] pointerPosition = calculatePointerPosition(mAngle);
if (x >= (pointerPosition[0] - mColorPointerHaloRadius)
&& x <= (pointerPosition[0] + mColorPointerHaloRadius)
&& y >= (pointerPosition[1] - mColorPointerHaloRadius)
&& y <= (pointerPosition[1] + mColorPointerHaloRadius)) {
mSlopX = x - pointerPosition[0];
mSlopY = y - pointerPosition[1];
mUserIsMovingPointer = true;
invalidate();
}
// Check whether the user pressed on the center.
else if (x >= -mColorCenterRadius && x <= mColorCenterRadius
&& y >= -mColorCenterRadius && y <= mColorCenterRadius
&& mShowCenterOldColor) {
mCenterHaloPaint.setAlpha(0x50);
setColor(getOldCenterColor());
invalidate();
}
// Check whether the user pressed anywhere on the wheel.
else if (Math.sqrt(x*x + y*y) <= mColorWheelRadius + mColorPointerHaloRadius
&& Math.sqrt(x*x + y*y) >= mColorWheelRadius - mColorPointerHaloRadius
&& mTouchAnywhereOnColorWheelEnabled) {
mUserIsMovingPointer = true;
invalidate();
}
// If user did not press pointer or center, report event not handled
else{
getParent().requestDisallowInterceptTouchEvent(false);
return false;
}
break;
case MotionEvent.ACTION_MOVE:
if (mUserIsMovingPointer) {
mAngle = (float) Math.atan2(y - mSlopY, x - mSlopX);
mPointerColor.setColor(calculateColor(mAngle));
setNewCenterColor(mCenterNewColor = calculateColor(mAngle));
if (mOpacityBar != null) {
mOpacityBar.setColor(mColor);
}
if (mValueBar != null) {
mValueBar.setColor(mColor);
}
if (mSaturationBar != null) {
mSaturationBar.setColor(mColor);
}
if (mSVbar != null) {
mSVbar.setColor(mColor,false);
}
invalidate();
}
// If user did not press pointer or center, report event not handled
else{
getParent().requestDisallowInterceptTouchEvent(false);
return false;
}
break;
case MotionEvent.ACTION_UP:
mUserIsMovingPointer = false;
mCenterHaloPaint.setAlpha(0x00);
if (onColorSelectedListener != null && mCenterNewColor != oldSelectedListenerColor) {
onColorSelectedListener.onColorSelected(mCenterNewColor);
oldSelectedListenerColor = mCenterNewColor;
}
invalidate();
break;
case MotionEvent.ACTION_CANCEL:
if (onColorSelectedListener != null && mCenterNewColor != oldSelectedListenerColor) {
onColorSelectedListener.onColorSelected(mCenterNewColor);
oldSelectedListenerColor = mCenterNewColor;
}
break;
}
return true;
}
/**
* Calculate the pointer's coordinates on the color wheel using the supplied
* angle.
*
* @param angle The position of the pointer expressed as angle (in rad).
*
* @return The coordinates of the pointer's center in our internal
* coordinate system.
*/
private float[] calculatePointerPosition(float angle) {
float x = (float) (mColorWheelRadius * Math.cos(angle));
float y = (float) (mColorWheelRadius * Math.sin(angle));
return new float[] { x, y };
}
/**
* Add a Saturation/Value bar to the color wheel.
*
* @param bar The instance of the Saturation/Value bar.
*/
public void addSVBar(SVBar bar) {
mSVbar = bar;
// Give an instance of the color picker to the Saturation/Value bar.
mSVbar.setColorPicker(this);
mSVbar.setColor(mColor,true);
}
/**
* Add a Opacity bar to the color wheel.
*
* @param bar The instance of the Opacity bar.
*/
public void addOpacityBar(OpacityBar bar) {
mOpacityBar = bar;
// Give an instance of the color picker to the Opacity bar.
mOpacityBar.setColorPicker(this);
mOpacityBar.setColor(mColor);
}
public void addSaturationBar(SaturationBar bar) {
mSaturationBar = bar;
mSaturationBar.setColorPicker(this);
mSaturationBar.setColor(mColor);
}
public void addValueBar(ValueBar bar) {
mValueBar = bar;
mValueBar.setColorPicker(this);
mValueBar.setColor(mColor);
}
/**
* Change the color of the center which indicates the new color.
*
* @param color int of the color.
*/
public void setNewCenterColor(int color) {
mCenterNewColor = color;
mCenterNewPaint.setColor(color);
if (mCenterOldColor == 0) {
mCenterOldColor = color;
mCenterOldPaint.setColor(color);
}
if (onColorChangedListener != null && color != oldChangedListenerColor ) {
onColorChangedListener.onColorChanged(color);
oldChangedListenerColor = color;
}
invalidate();
}
/**
* Change the color of the center which indicates the old color.
*
* @param color int of the color.
*/
public void setOldCenterColor(int color) {
mCenterOldColor = color;
mCenterOldPaint.setColor(color);
invalidate();
}
public int getOldCenterColor() {
return mCenterOldColor;
}
/**
* Set whether the old color is to be shown in the center or not
*
* @param show true if the old color is to be shown, false otherwise
*/
public void setShowOldCenterColor(boolean show) {
mShowCenterOldColor = show;
invalidate();
}
public boolean getShowOldCenterColor() {
return mShowCenterOldColor;
}
/**
* Used to change the color of the {@code OpacityBar} used by the
* {@code SVBar} if there is an change in color.
*
* @param color int of the color used to change the opacity bar color.
*/
public void changeOpacityBarColor(int color) {
if (mOpacityBar != null) {
mOpacityBar.setColor(color);
}
}
/**
* Used to change the color of the {@code SaturationBar}.
*
* @param color
* int of the color used to change the opacity bar color.
*/
public void changeSaturationBarColor(int color) {
if (mSaturationBar != null) {
mSaturationBar.setColor(color);
}
}
/**
* Used to change the color of the {@code ValueBar}.
*
* @param color int of the color used to change the opacity bar color.
*/
public void changeValueBarColor(int color) {
if (mValueBar != null) {
mValueBar.setColor(color);
}
}
/**
* Checks if there is an {@code OpacityBar} connected.
*
* @return true or false.
*/
public boolean hasOpacityBar(){
return mOpacityBar != null;
}
/**
* Checks if there is a {@code ValueBar} connected.
*
* @return true or false.
*/
public boolean hasValueBar(){
return mValueBar != null;
}
/**
* Checks if there is a {@code SaturationBar} connected.
*
* @return true or false.
*/
public boolean hasSaturationBar(){
return mSaturationBar != null;
}
/**
* Checks if there is a {@code SVBar} connected.
*
* @return true or false.
*/
public boolean hasSVBar(){
return mSVbar != null;
}
@Override
protected Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
Bundle state = new Bundle();
state.putParcelable(STATE_PARENT, superState);
state.putFloat(STATE_ANGLE, mAngle);
state.putInt(STATE_OLD_COLOR, mCenterOldColor);
state.putBoolean(STATE_SHOW_OLD_COLOR, mShowCenterOldColor);
return state;
}
@Override
protected void onRestoreInstanceState(Parcelable state) {
Bundle savedState = (Bundle) state;
Parcelable superState = savedState.getParcelable(STATE_PARENT);
super.onRestoreInstanceState(superState);
mAngle = savedState.getFloat(STATE_ANGLE);
setOldCenterColor(savedState.getInt(STATE_OLD_COLOR));
mShowCenterOldColor = savedState.getBoolean(STATE_SHOW_OLD_COLOR);
int currentColor = calculateColor(mAngle);
mPointerColor.setColor(currentColor);
setNewCenterColor(currentColor);
}
public void setTouchAnywhereOnColorWheelEnabled(boolean TouchAnywhereOnColorWheelEnabled){
mTouchAnywhereOnColorWheelEnabled = TouchAnywhereOnColorWheelEnabled;
}
public boolean getTouchAnywhereOnColorWheel(){
return mTouchAnywhereOnColorWheelEnabled;
}
}
| [
"15814162463@163.com"
] | 15814162463@163.com |
0dd5a064a7032ed82ff1c3fac448ebbe2142418e | 2b3f6663a28f129b679d6e73f23ef82eeca08db4 | /src/ficherosDirectorio/A1_159_AccesoFicheros.java | 4971422cc720e6c2ad0d341ca7c91a0f5e9b8dd8 | [] | no_license | AxelCCp/JAVA5-PILDORAS-INFORMATICAS-STREAMS | 7e67db5344d5b62d523b09c35d5da7e30f506ff8 | ee1d25ed34f2739264a73fd659a16ab42c7a4705 | refs/heads/master | 2023-03-06T03:15:34.833688 | 2021-02-17T20:01:48 | 2021-02-17T20:01:48 | 339,841,735 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,207 | java | package ficherosDirectorio;
import java.io.File;
public class A1_159_AccesoFicheros {
public static void main(String[]args) {
//VER UNA LISTA DE ARCHIVOS QUE HAY EN UN DIRECTORIO.
File ruta = new File("C:/Users/Fantasma/OneDrive/1.-DOCUMENTOS/1.-CURSOS");
//NOS DEVUELVE LA RUTA ESPECIFICADA
System.out.println(ruta.getAbsolutePath());
//list() NOS DEVUELVE UN ARRAY DE STRINGS, CON LOS NOMBRES DE LAS CARPETAS Y ARCHIVOS QUE ESTÁN EN LA RUTA ESPECIFICADA.
String[]nombresArchivos=ruta.list();
//IMPRIMIMOS LOS ARCHIVOS CON UN FOR
for(int i=0;i<nombresArchivos.length;i++) {
System.out.println("");
System.out.println(nombresArchivos[i]);
//CREAMOS UNA NUEVA INSTANCIA DE FILE, PARA VER LOS ARCHIVOS QUE PUEDEN HABER EN UN DIRECTORIO.
//EL 1ER PARÁMETRO NOS DEVUELVE LA RUTA Y EL 2DO PARÁMETRO EXAMINA LOS ARCHIVOS
File f = new File(ruta.getAbsolutePath(), nombresArchivos[i]);
//LE PREGUNTAMOS A JAVA, SI ENTRE LOS ARCHIVOS EXAMINADOS HAY ALGÚN DIRECTORIO.
if(f.isDirectory()) {
String[]subcarpetas = f.list();
for(int j=0; j<subcarpetas.length;j++) {
System.out.println(" " + subcarpetas[j]);
}
}
}
}
}
| [
"hpmajin@outlook.es"
] | hpmajin@outlook.es |
78b09fcf29de73fd68f92364432ad61cd9e65231 | 5c1b75362c27b5d900d0d7833c3e24a0458f45fd | /gulimall-coupon/src/main/java/com/zwp/gulimall/coupon/entity/HomeAdvEntity.java | 38ce858629f09d7def578411e36afc241b1be61f | [
"Apache-2.0"
] | permissive | husterzwp/gulimall | e7502cfcd720c1cc437e33ece2dbc69ea1c378e3 | 6c2914540890d81013d93b004c526971ef9c9308 | refs/heads/master | 2023-07-21T18:44:55.829162 | 2021-08-15T09:41:51 | 2021-08-15T09:41:51 | 395,965,837 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,062 | java | package com.zwp.gulimall.coupon.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 首页轮播广告
*
* @author zhengweiping
* @email zhengweiping@gmail.com
* @date 2021-08-15 16:07:18
*/
@Data
@TableName("sms_home_adv")
public class HomeAdvEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId
private Long id;
/**
* 名字
*/
private String name;
/**
* 图片地址
*/
private String pic;
/**
* 开始时间
*/
private Date startTime;
/**
* 结束时间
*/
private Date endTime;
/**
* 状态
*/
private Integer status;
/**
* 点击数
*/
private Integer clickCount;
/**
* 广告详情连接地址
*/
private String url;
/**
* 备注
*/
private String note;
/**
* 排序
*/
private Integer sort;
/**
* 发布者
*/
private Long publisherId;
/**
* 审核者
*/
private Long authId;
}
| [
"weiping158706@163.com"
] | weiping158706@163.com |
1ea239ac8e7d6881df0ec2847265c83caf34cab7 | c3b5e1587ad9a1b05d086f03f8e1c14b50a9ccdf | /app/controllers/HomeController.java | f1e8bee1968ac0f5696869ac84ae12d89c438cf8 | [
"Apache-2.0"
] | permissive | mukulobject/play-2.5-log4j2-asynclogger | fa8f95bef26fb62bdef557ac9a4348503afb98df | d588d4de75dd84e6d706062826119a5d0340675a | refs/heads/master | 2021-01-10T06:50:33.930631 | 2016-04-06T18:05:55 | 2016-04-06T18:05:55 | 55,531,270 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 994 | java | package controllers;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.ThreadContext;
import play.mvc.Controller;
import play.mvc.Result;
import views.html.index;
/**
* This controller contains an action to handle HTTP requests
* to the application's home page.
*/
public class HomeController extends Controller {
private final Logger asyncLogger = LogManager.getLogger("ASYNC");
/**
* An action that renders an HTML page with a welcome message.
* The configuration in the <code>routes</code> file means that
* this method will be called when the application receives a
* <code>GET</code> request with a path of <code>/</code>.
*/
public Result index() {
ThreadContext.put("requestId", "unique_request_id_123456");
asyncLogger.debug("async debug here ...");
ThreadContext.clearAll();
return ok(index.render("Your new application is ready."));
}
}
| [
"mukul.object@gmail.com"
] | mukul.object@gmail.com |
2267b778b4d6beafd1040d33e712a93de1ee272a | c82a3703f6817787bbff5e3090646a881ecc15da | /job4j/src/ru/job4j/array/SkipNegative.java | 660286ec02d40927c1c09210518b6a48d233d327 | [] | no_license | SereginSun/job4j_elementary | c74991e0b883568a15348cee0551623508b2e47b | 8a9295655a3d1a97e0dd343c8c9b0b7e7f076c3a | refs/heads/main | 2023-01-24T01:20:58.246365 | 2020-12-08T07:00:06 | 2020-12-08T07:00:06 | 310,513,566 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 380 | java | package ru.job4j.array;
public class SkipNegative {
public int[][] skip(int[][] array) {
for (int row = 0; row < array.length; row++) {
for (int column = 0; column < array.length; column++) {
if (array[row][column] < 0) {
array[row][column] = 0;
}
}
}
return array;
}
}
| [
"sereginsun@yandex.ru"
] | sereginsun@yandex.ru |
a56fbfc3c023bf1664291fe2ed001c814294ace1 | 9ab25a78396bbf572a7a482ddb316ca7cc3498b6 | /src/main/java/br/com/poc/service/AccountService.java | 85a295e74cff523470171cd138cd79a3324a4017 | [] | no_license | thiagokuch/poc-narayana-jta | 595ebc25778675f67b701bc619079c5c1181d1df | bd401ad7b13d386b39a20b37d21edc21160308cc | refs/heads/master | 2021-01-21T17:02:20.265227 | 2017-05-23T13:12:07 | 2017-05-23T13:12:07 | 91,925,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,293 | java | /*
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package br.com.poc.service;
import java.util.concurrent.atomic.AtomicInteger;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import br.com.poc.entity.Account;
import br.com.poc.repository.AccountRepository;
@Service
public class AccountService {
private static final AtomicInteger atomicInteger = new AtomicInteger();
@Autowired
private AccountRepository accountRepository;
@Transactional(Transactional.TxType.NOT_SUPPORTED)
public Account create() {
return this.accountRepository.save(new Account("Remote" + atomicInteger.incrementAndGet()));
}
}
| [
"thiagokuch@note-kuch"
] | thiagokuch@note-kuch |
684eef564aceffaa02f96f683da3ff75ac89c171 | 6850d9f28a85c3165c18d2659db9d8bf76ea3f7a | /src/main/java/org/cimmyt/reporter/WFieldbook29.java | 154706f770925f48c6db4164060848784174a22e | [] | no_license | j-alberto/reporter | 83a56d47e24f3a7407201b9ed35464da5ae078e4 | 42c4d46c15d49a8b4b0dd2adf96ec89f2ae8774f | refs/heads/master | 2021-01-18T13:59:50.259944 | 2015-01-26T15:32:21 | 2015-01-26T15:32:21 | 26,495,842 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,625 | java | package org.cimmyt.reporter;
import java.util.Collection;
import java.util.Map;
import org.cimmyt.reporter.domain.GermplasmEntry;
import org.cimmyt.reporter.domain.Occurrence;
import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
public class WFieldbook29 extends AbstractReporter{
@Override
public Reporter createReporter() {
Reporter r = new WFieldbook29();
r.setFileNameExpression("YLD_Nal_Rnd_byEntry{tid}");
return r;
}
@Override
public String getReportCode() {
return "WFb29";
}
@Override
public String getTemplateName() {
return "WFb29_header.jasper";
}
@Override
public Map<String, Object> buildJRParams(Map<String,Object> args){
Map<String, Object> params = super.buildJRParams(args);
Integer dummyInt = new Integer(777);
params.put("tid", dummyInt);
params.put("occ", dummyInt);
params.put("program", "dummy_program");
params.put("lid", "dummy_lid");
params.put("trial_name", "dummy_trialName");
params.put("trial_abbr", "dummy_trial_abbr");
params.put("LoCycle", "dummy_LoCycle");
params.put("gms_ip", "dummy_gms_ip");
params.put("dms_ip", "dummy_dms_ip");
return params;
}
@Override
public JRDataSource buildJRDataSource(Collection<?> args){
for(Object o : args){ //only one bean
Occurrence oc = (Occurrence)o;
for(Occurrence occ : oc.getOcurrencesList()){
occ.setTid(778899);
occ.setOcc(777);
for(GermplasmEntry e : occ.getEntriesList2()){
}
}
}
JRDataSource dataSource = new JRBeanCollectionDataSource(args);
return dataSource;
}
}
| [
"jalberto.roj@gmail.com"
] | jalberto.roj@gmail.com |
02d60c718516d778b42b2f7ca6d230e02abfee64 | 00aedf19d85690033544d35f10841d8838c38ed3 | /ProductIOManager/src/business/Product.java | 08343089e4ba1d49502cd826f2628e66ea2bb7f2 | [] | no_license | sean-blessing/java-instruction-bc201901 | a8bd0bb29490dd856ff2776b6b460c96f106140b | 11cc2d14e8181c064a56bfb6f9fd4f1a4d3ae925 | refs/heads/master | 2020-05-16T19:24:40.560070 | 2019-05-22T20:43:25 | 2019-05-22T20:43:25 | 183,259,228 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,488 | java | package business;
public class Product {
private String code;
private String description;
private double price;
public Product() {
code = "";
description = "";
price = 0.0;
}
// we wrote this one in class
public Product(String inCode, String inDesc, double inPrice) {
code = inCode;
description = inDesc;
price = inPrice;
}
// this constructor was generated by eclipse
// public Product(String code, String description, double price) {
// this.code = code;
// this.description = description;
// this.price = price;
// }
// I wrote this getter/setter
// public String getCode() {
// return code;
// }
//
// public void setCode(String c) {
// code = c;
// }
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
@Override
public String toString() {
return "Product [code=" + code + ", description=" + description + ", price=" + price + "]";
}
public static void aStaticMethod() {
System.out.println("an arbitrary static method");
}
@Override
public boolean equals(Object obj) {
// TODO Auto-generated method stub
return super.equals(obj);
}
}
| [
"snblessing@gmail.com"
] | snblessing@gmail.com |
7e6fc951c4fc220f007d689d805206682ef5bd18 | 8bf143e5e527e9955a4c98ff91ccfe7e382a433f | /DishesBuilder/src/main/java/co/edu/unicauca/dishesbuilder/builderConsola/OrientalDishBuilder.java | 6d0f78be9219cca14c6322b1341d11ae65104d8e | [] | no_license | JavierStivenDuranAlvear/Taller-Patron-Builer | c2191c14aaa7cd6dfaa842897591b034a54e6064 | 56206b1fb1ed7ae8201adfe8b0838e50205f0e3b | refs/heads/main | 2023-04-02T12:51:37.877558 | 2021-04-14T03:12:38 | 2021-04-14T03:12:38 | 357,748,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,434 | java | package co.edu.unicauca.dishesbuilder.builderConsola;
import co.edu.unicauca.dishesbuilder.Dish;
import co.edu.unicauca.dishesbuilder.DishBuilder;
import co.edu.unicauca.dishesbuilder.DishBuilder;
import co.edu.unicauca.dishesbuilder.EnumSize;
import co.edu.unicauca.dishesbuilder.EnumSize;
import co.edu.unicauca.dishesbuilder.OrientalDish;
import java.util.ArrayList;
/**
*
* @author Javier Stiven Duran Alvear
* @author Luis Arango
*/
public class OrientalDishBuilder extends DishBuilder{
@Override
public void setCore() {
this.setDish(new OrientalDish("Arroz oriental", "arroz con estilo oriental"
+ ", añadiendo ingredientes con sabores orientales como la soja"
+ "las verduras y las gambas", "", 56000, EnumSize.ALL, "East rice"));
}
@Override
public void setSize() {
this.dish.setSize(EnumSize.ALL);
}
@Override
public void addParts() {
this.dish.addPart(new Dish("Base de arroz", "Base de arroz para preparar arroz oriental", "", 12000, EnumSize.ALL) {
});
this.dish.addPart(new Dish("Soja", "Soja oriental", "", 8000, EnumSize.ALL) {
});
this.dish.addPart(new Dish("Verduras orientales", "Verduras con sabor oriental", "", 15000, EnumSize.HALF) {
});
this.dish.addPart(new Dish("Gambas", "Gambas orientales", "", 12000, EnumSize.ALL) {
});
}
}
| [
"javierda@unicauca.edu.co"
] | javierda@unicauca.edu.co |
9f329045843e31bf8460a1ee6fb1fd8578e5d8a8 | 70375ad64773d74e8882e45b2f7351b7739fa629 | /src/test/java/org/apache/ibatis/submitted/call_setters_on_nulls_again/MyBatisTest.java | 0d2855f7534315eb4e1c6a42e8e373abaab896ca | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | yangfancoming/mybatis | 104e64e3f1659ebe1228413f16c4a373e8bedd1c | 7cd9c6093a608a0e0da32155e75d1fddd090c8d5 | refs/heads/master | 2022-09-22T21:09:10.430995 | 2021-05-30T10:37:34 | 2021-05-30T10:37:34 | 195,225,348 | 0 | 0 | Apache-2.0 | 2022-09-08T01:01:18 | 2019-07-04T11:00:52 | Java | UTF-8 | Java | false | false | 970 | java |
package org.apache.ibatis.submitted.call_setters_on_nulls_again;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.io.Reader;
class MyBatisTest {
private static SqlSessionFactory sqlSessionFactory;
@BeforeAll
static void setUp() throws Exception {
try (Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/call_setters_on_nulls_again/mybatis-config.xml")) {
sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
}
}
@Test
void test() {
try (SqlSession session = sqlSessionFactory.openSession()) {
ParentBean parentBean = session.selectOne("test");
Assertions.assertEquals("p1", parentBean.getName());
}
}
}
| [
"34465021+jwfl724168@users.noreply.github.com"
] | 34465021+jwfl724168@users.noreply.github.com |
5fe3cb87e4d5b463aca6ce0e917a0242d1476f52 | b5e21ca72330e110e3908a0b11df0d9bc687b86b | /src/com/self/homework1/PalindromeString.java | 3d90403d370ee838ccfd3cbe0d6b0d4e2d789e0d | [] | no_license | albanionut/pentaJava | 1924c1bdf53add7672ba79d4d6f155705f700bda | bb0c3f0072e1c6851515241e510b39590509e190 | refs/heads/master | 2020-04-15T17:38:00.493092 | 2019-02-21T15:45:41 | 2019-02-21T15:45:41 | 164,879,658 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 663 | java | package com.self.homework1;
import java.util.Scanner;
public class PalindromeString {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Introduce the string :");
String palindrome =new String(sc.nextLine());
String emordnilap="";
for (int i = palindrome.length()-1; i>=0 ; i--) { // first try was with length and i>0 who was incorrect..
emordnilap =emordnilap + palindrome.charAt(i);
}
if (palindrome.equals(emordnilap))
System.out.println("Is palindrom");
else
System.out.println("Isn't palindrom");
}
}
| [
"ionut.m.alban@gmail.com"
] | ionut.m.alban@gmail.com |
ee659e118b44285fddf924e224b0e57199935aa4 | cb686e88f8650c0d910f36160c731ca8af887b3f | /src/it/comparison/AmazonComparisonTest.java | 98c0b12ac3b0333c7a06e82754e35cc9b17b7582 | [] | no_license | lucamolteni/AmazonPriceComparison | a71f9672d7410b05673d720a19d0596c3902f295 | 61435d2c48eb15005f01cc258d565ba14e081161 | refs/heads/master | 2016-09-06T15:03:36.790262 | 2014-06-11T17:20:38 | 2014-06-11T17:20:38 | 20,728,210 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,373 | java | package it.comparison;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class AmazonComparisonTest {
private FakeDisplay fakeDisplay;
private AmazonComparison comparison;
private FakeAmazon amazonit;
private FakeAmazon amazonfrance;
@Before
public void setUp() throws Exception {
fakeDisplay = new FakeDisplay();
comparison = new AmazonComparison(fakeDisplay);
amazonit = new FakeAmazon("6,99", "amazon.it");
amazonfrance = new FakeAmazon("7,00", "amazon.fr");
}
@Test
public void comparatoreDeveChiamareSiti() {
comparison.addSite(amazonit);
comparison.addSite(amazonfrance);
comparison.findPrices("7834920174389012");
amazonit.assertFindPriceWasCalled("7834920174389012");
amazonfrance.assertFindPriceWasCalled("7834920174389012");
}
@Test
public void comparatoreDeveRestituirePrezzi() {
comparison.addSite(amazonit);
comparison.addSite(amazonfrance);
PriceResults prices = comparison.findPrices("7834920174389012");
assertEquals("6,99", prices.getPrice(amazonit));
assertEquals("7,00", prices.getPrice(amazonfrance));
}
@Test
public void vediTabella(){
comparison.findPrices("dashjklhdasjkl");
assertTrue(fakeDisplay.wasCalled());
}
public static class FakeAmazon implements Amazon {
private String isbnCalled;
private String price;
private String site;
public FakeAmazon(String price, String url) {
this.price = price;
this.site = url;
}
@Override
public String findPrice(String isbn) {
isbnCalled = isbn;
return price;
}
@Override
public String getSite() {
return site;
}
public void assertFindPriceWasCalled(String s) {
assertEquals("Amazon.findPrice with wrong ISBN", s, isbnCalled);
}
}
private class FakeDisplay implements Display{
private boolean wasCalled = false;
@Override
public void show(PriceResults results) {
wasCalled = true;
}
public boolean wasCalled(){
return wasCalled;
}
}
}
| [
"volothamp@gmail.com"
] | volothamp@gmail.com |
8469cbc9c2a9688dcc6bf1f2d720e097df7dfbc9 | 39014019cd30b9dc5e5dbf79c4f4f570b0a4ef81 | /Slidingmenu_ViewPager_TabIndicator/gen/com/example/slidingmenu_viewpager_tabindicator/BuildConfig.java | e9d37b18a76b4734ff2bf00ea203b4e21937cb2a | [] | no_license | zhuazhuaxiran/practices | d988e0f9ec16d95fe8aca0931058242bae2003fc | d49501c09ecce178e0518a0ab3c06838b68a993c | refs/heads/master | 2021-01-19T02:37:48.424647 | 2016-05-01T04:25:54 | 2016-05-01T04:25:54 | 46,116,647 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 188 | java | /** Automatically generated file. DO NOT MODIFY */
package com.example.slidingmenu_viewpager_tabindicator;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"dongrh@koal.com"
] | dongrh@koal.com |
c10d3792dff65a51ff5d6b9fb910335e349398e9 | 55ffb414b0fc70f087aa90feb24484688bc059c0 | /cfacq/backend/controllers/ActualiteControlleur.java | aa5b37eca98be9a8494be77fd966ca644705b3bb | [] | no_license | SvitlanaMelnyk/App-cfacq | 129188c2f06706b1b485378241fe14403a76ccd8 | 19e1ec4e63b72957de2f19da1681d7c7cd6dd045 | refs/heads/master | 2020-05-01T23:56:16.459398 | 2019-03-25T21:42:23 | 2019-03-25T21:42:23 | 177,668,813 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,851 | java | package sitecfacq.web.controllers;
import ca.attsoft.web.framework.annotations.File;
import ca.attsoft.web.framework.annotations.Json;
import ca.attsoft.web.framework.annotations.Name;
import ca.attsoft.web.framework.annotations.Public;
import ca.attsoft.web.framework.stateful.WebContext;
import org.apache.commons.fileupload.FileItem;
import sitecfacq.domaine.Actualite;
import sitecfacq.domaine.common.Fichier;
import sitecfacq.services.CarrouselService;
import sitecfacq.services.FileService;
import sitecfacq.services.NewsService;
import sitecfacq.web.interceptors.HistoryInterceptor;
import sitecfacq.web.interceptors.ValidationInterceptor;
import javax.inject.Inject;
import javax.interceptor.Interceptors;
import javax.transaction.Transactional;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Base64;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
@Interceptors({ValidationInterceptor.class, HistoryInterceptor.class})
@Public
public class ActualiteControlleur extends ca.attsoft.web.framework.controlleurs.AbstractController {
@Inject
private NewsService service;
@Inject
private CarrouselService serviceCarrousel;
@Inject
private FileService fileService;
@Json
@Public
public List<Actualite> getAll() {
return service.getAll();
}
@Json
@Public
public List<Actualite> getThreeLast() {
return service.getThreeLast();
}
@Json
@Public
public List<Actualite> getNewsByCategory(@Name("category") String category) {
return service.getByCategory(category);
}
@Json
@Public
public Actualite getById(@Name("id") Long id) {
return service.getById(id);
}
@Json
@Transactional
public Boolean delete(@Name("id") Long id) {
Actualite news = service.getById(id);
if (news == null) {
getContext().addError("Erreur lors de la récupération de la nouvelle");
return false;
}
try {
service.delete(news);
} catch (Exception e) {
getContext().addError("Erreur lors de la suppression de la nouvelle");
Logger.getLogger(ActualiteControlleur.class.toString()).log(Level.SEVERE, null, e);
return false;
}
return true;
}
@Json
@Transactional
public Boolean save(@Name("json") Actualite news) {
if (news == null) {
getContext().addError("Erreur lors de la sauvegarde de la nouvelle");
return false;
}
List<FileItem> fi = getContext().getFileItems();
if (fi != null) {
for (FileItem f : fi) {
if (f == null || f.getName() == null || (!f.getName().substring(f.getName().length() - 4).equalsIgnoreCase(".jpg")
&& !f.getName().substring(f.getName().length() - 4).equalsIgnoreCase(".png") && !f.getName().substring(f.getName().length() - 4).equalsIgnoreCase(".pdf") && !f.getName().substring(f.getName().length() - 5).equalsIgnoreCase(".jpeg"))) {
getContext().addError("Le fichier passé en paramêtre est erroné ou l'extension du fichier n'est pas supporté. Assurez-vous que le fichier à bien été saisi et que l'extension de celui-ci est soit JPG, JPEG, PNG.");
return null;
}
}
}
int i = 0;
for (Fichier f : news.getImages()) {
if (f.getId() == null) {
f.setNom(fi.get(i).getName().replace(":", "_"));
f.setFileImage(fi.get(i).get());
i++;
}
}
try {
service.save(news);
} catch (Exception e) {
getContext().addError("Erreur lors de la sauvegarde de la nouvelle");
Logger.getLogger(ActualiteControlleur.class.toString()).log(Level.SEVERE, null, e);
return false;
}
return true;
}
@File
@Public
public String show(@Name("id") Long id) {
if (id == null) {
getContext().addError("Aucun id n'a été fourni");
return null;
}
Fichier facture = serviceCarrousel.getById(id);
if (facture != null) {
try {
WebContext.setFilePayload(new ByteArrayOutputStream());
getContext().setFileIsAttachment(false);
getContext().setFileMimeType(File.JPEG);
DataOutputStream w = new DataOutputStream(WebContext.getFilePayload());
byte[] image = fileService.getFilePayload(facture.getId(), facture.getNom());
if (image != null) {
w.write(image);
} else {
w.writeBytes("null");
}
w.flush();
w.close();
return facture.getNom();
} catch (IOException ex) {
getContext().addError("Erreur lors de la récupération de l'image");
Logger.getLogger(CarrouselControlleur.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
return null;
}
} else {
getContext().addError("Erreur lors de la récupération de l'image");
return null;
}
}
}
| [
"svetmelnyk@gmail.com"
] | svetmelnyk@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.