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
2755dd4fbe8af5d574bf06604942f5761ee3abde
b6df476e8845c59d1a6f7e833cb3d6ba8b2f577d
/trade-rws-flow/src/test/java/com/midea/trade/rws/service/MShopService.java
ce67c0fdfa7826bb05018ab454129359b9143f07
[]
no_license
chenjy16/xudanrw
e76a5975bda9b6aeeb6e646c86d0f75372512c4c
0e36093a195bd274ca99fd12d0806fe0e9311002
refs/heads/master
2021-01-09T20:52:30.468643
2018-03-26T02:22:42
2018-03-26T02:22:42
59,792,535
10
5
null
null
null
null
UTF-8
Java
false
false
216
java
package com.midea.trade.rws.service; public interface MShopService { public void insert()throws Exception; public void select(); public void update(); public void delete(); }
[ "326800567@qq.com" ]
326800567@qq.com
dccb67b278f12296405744f802aae17cf4b138da
7e426cfe38873f00c699949a7a046328bd97b9b9
/src/main/java/io/wispforest/owo/mixin/ui/ChatScreenMixin.java
6263ca745aea957e6e13de5ad99866eaf9dd7f7b
[ "MIT" ]
permissive
wisp-forest/owo-lib
419e54efb0ab8f3158b2e774db54ae728cec6935
19dac0963e14108e18a80af8b4a045822f5559e2
refs/heads/1.20
2023-08-17T15:10:47.409940
2023-08-14T22:33:37
2023-08-14T22:33:37
370,481,201
107
28
MIT
2023-08-31T15:36:57
2021-05-24T20:49:20
Java
UTF-8
Java
false
false
910
java
package io.wispforest.owo.mixin.ui; import io.wispforest.owo.ui.util.CommandOpenedScreen; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.ChatScreen; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(ChatScreen.class) public class ChatScreenMixin { @Inject(method = "keyPressed", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;setScreen(Lnet/minecraft/client/gui/screen/Screen;)V"), cancellable = true) private void cancelClose(int keyCode, int scanCode, int modifiers, CallbackInfoReturnable<Boolean> cir) { if (MinecraftClient.getInstance().currentScreen instanceof CommandOpenedScreen) { cir.setReturnValue(true); } } }
[ "glisco03@web.de" ]
glisco03@web.de
df49973b42f8e52750199c3133dba151b7e1d8a9
6ad4aebfebb5faf6df5708a60dfda2052cd96452
/src/main/java/com/springapp/boot/controllers/HelloRestController.java
570d5694ebbe4520651b15cfb0528b9fb8cb3a2a
[]
no_license
rasikawata/springapp-boot
38b5c1fea3531ec1810f66f0615bf0a89b91dfa2
e0e4bec47892bf638266f79e2c8cfb2d5f753de2
refs/heads/master
2021-01-17T15:37:08.933639
2016-09-30T09:44:21
2016-09-30T09:44:21
69,654,322
0
0
null
null
null
null
WINDOWS-1250
Java
false
false
1,267
java
package com.springapp.boot.controllers; import com.springapp.boot.domain.Greeting; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.concurrent.atomic.AtomicLong; /** * In Spring’s approach to building RESTful web services, HTTP requests are handled by a controller. * These components are easily identified by the @RestController annotation, and the GreetingController * below handles GET requests for /greeting by returning a new instance of the Greeting class: */ @RestController @RequestMapping("/rest") public class HelloRestController { private static final String template = "Hello, %s!"; private final AtomicLong counter = new AtomicLong(); @RequestMapping("/") public String index() { return "Greetings from Spring Boot!"; } @RequestMapping("/greeting") public Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) { return new Greeting(counter.incrementAndGet(), String.format(template, name)); } }
[ "rasikawataketiya@gmail.com" ]
rasikawataketiya@gmail.com
31bf13f2656396ad2890f1697ae17b17d930e5d1
8b4d223f252dd135b9271b207a21e29fa4cbfdf3
/src/main/java/com/db/prisma/droolspoc/pain001/CashAccountType2Choice.java
06e2ca683aaaea1890f6c24e2ff708bf482c08eb
[ "MIT" ]
permissive
demoth/finistika
254c4a687cd4fe2ad7ecb590243703cabc4c14eb
4850cca7345f42033558a83b4c6ffe4e168efc80
refs/heads/master
2021-01-18T19:31:46.642965
2017-06-06T15:58:40
2017-06-06T15:58:40
86,899,301
0
0
null
null
null
null
UTF-8
Java
false
false
2,324
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2017.03.31 at 10:40:01 AM MSK // package com.db.prisma.droolspoc.pain001; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for CashAccountType2Choice complex type. * <p> * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;complexType name="CashAccountType2Choice"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;choice> * &lt;element name="Cd" type="{urn:iso:std:iso:20022:tech:xsd:pain.001.001.08}ExternalCashAccountType1Code"/> * &lt;element name="Prtry" type="{urn:iso:std:iso:20022:tech:xsd:pain.001.001.08}Max35Text"/> * &lt;/choice> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "CashAccountType2Choice", propOrder = { "cd", "prtry" }) public class CashAccountType2Choice { @XmlElement(name = "Cd") private String cd; @XmlElement(name = "Prtry") private String prtry; /** * Gets the value of the cd property. * * @return possible object is * {@link String } */ public String getCd() { return cd; } /** * Sets the value of the cd property. * * @param value allowed object is * {@link String } */ public void setCd(String value) { this.cd = value; } /** * Gets the value of the prtry property. * * @return possible object is * {@link String } */ public String getPrtry() { return prtry; } /** * Sets the value of the prtry property. * * @param value allowed object is * {@link String } */ public void setPrtry(String value) { this.prtry = value; } }
[ "bubnov.d.e@gmail.com" ]
bubnov.d.e@gmail.com
123cd3fff62711963474e143d1dcfde985ae6ff8
b8977ab505a540e3cb4b9c076cecd197d7d54e39
/Project/src/dao/ViewAllEventReportDao.java
57996aad0260f85b5f58df82709ec247594c4645
[]
no_license
bhargavipatel259/Hangouts_Project
221d901a2a14ab1015f380e31abd64c0c37edbb7
30ed182ea3763af1b8e5eda1304492a265422ba5
refs/heads/master
2020-04-16T07:22:01.107488
2019-01-12T12:09:02
2019-01-12T12:09:02
165,383,647
1
0
null
null
null
null
UTF-8
Java
false
false
1,784
java
package dao; import java.io.OutputStream; import java.sql.Blob; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.http.Part; import bean.EventReportBean; public class ViewAllEventReportDao { public List<EventReportBean> viewreports(String email){ List<EventReportBean> list = new ArrayList<EventReportBean>(); try { Db_Connection dbconn=new Db_Connection(); Connection conn= dbconn.Connection(); String sqlString = "SELECT * FROM eventreport WHERE email = '"+email+"'"; Statement myStatement = conn.createStatement(); ResultSet rs=myStatement.executeQuery(sqlString); while (rs.next()) { EventReportBean e = new EventReportBean(); Blob filep = rs.getBlob("file"); long size = ((Blob) filep).length(); String filename=rs.getString("filename"); e.setFile(filep); e.setText(rs.getString("text")); //e.setFilesize(size); e.setEventid(rs.getInt("hangout_id")); System.out.println("event ids from ViewAllEventReportDaofile---"+rs.getInt("hangout_id")); e.setTitle(rs.getString("title")); e.setFilename(filename); list.add(e); /* file = rs.getBlob("file"); fileData = file.getBytes(1,(int)file.length()); */ } conn.close(); } catch (SQLException ex) {Logger.getLogger(Logger.class.getName()).log(Level.SEVERE, null, ex);} return list; } }
[ "bhargavipatel@192.168.1.107" ]
bhargavipatel@192.168.1.107
2e64b8f3e266d4587a3268faedaf193315a80061
f1bff65d5315eae7bfb2eb78a113a5d4f9e6bd2a
/springboot-rabbitmq-producer/src/test/java/ProducerTest.java
87594afcdf342134ac107f32798cfbaa3eb696f8
[]
no_license
keepli/rabbitMQ
318e2b7bcf377f527d11a0fcc9d0999ac03a765d
4edb41926aeb22c517aa7b0d322950dcd194f454
refs/heads/master
2022-12-28T22:22:38.377093
2020-09-24T13:07:08
2020-09-24T13:07:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,492
java
import cn.itcast.ProducerApplication; import cn.itcast.rabbitmq.drict.RabbitMQDirect; import cn.itcast.rabbitmq.fanout.RabbitMQFanout; import cn.itcast.rabbitmq.topic.RabbitMQTopic; import cn.itcast.rabbitmq.smiple.RabbitMQSimple; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @SpringBootTest(classes = ProducerApplication.class) @RunWith ( SpringRunner.class ) public class ProducerTest { @Autowired private RabbitTemplate rabbitTemplate; @Test public void send(){ rabbitTemplate.convertAndSend ( "", RabbitMQSimple.Queue_NAME,"简单模式!" ); } @Test public void sendTopic(){ rabbitTemplate.convertAndSend ( RabbitMQTopic.EXCHANGE_NAME,"itcast.good","Topic模式 itcast!" ); rabbitTemplate.convertAndSend ( RabbitMQTopic.EXCHANGE_NAME,"good.good","Topic模式 good!" ); } @Test public void sendFanout(){ rabbitTemplate.convertAndSend ( RabbitMQFanout.EXCHANGE_NAME,"","Fanout模式!" ); } @Test public void sendDirect(){ rabbitTemplate.convertAndSend ( RabbitMQDirect.EXCHANGE_NAME,"error","Direct模式 error!" ); rabbitTemplate.convertAndSend ( RabbitMQDirect.EXCHANGE_NAME,"info","Direct模式 info!" ); } }
[ "email@gmail.com" ]
email@gmail.com
a1f81fb521c3553de19d369eb733a8ef014cbed2
941f563b2374db77e58eefa36873c8e23d069185
/android/app/src/main/java/com/jyweibo/ThirdLoginModule.java
aece1ddad10c0ba927fb10cb36b759ddd3251949
[]
no_license
jungleiOS/JYWeibo
637ba5a846ff59d652817370ea8bf917b97fcf7a
96a80df3d7a95bb3d915d31ce8ac0121d915555b
refs/heads/master
2020-03-26T04:45:18.436322
2019-01-18T13:19:24
2019-01-18T13:19:24
144,521,116
0
0
null
null
null
null
UTF-8
Java
false
false
4,093
java
package com.jyweibo; import android.app.Activity; import android.content.Intent; import android.os.Handler; import android.os.Looper; import android.util.Log; import android.widget.Toast; import com.facebook.react.bridge.ActivityEventListener; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.BaseActivityEventListener; import com.facebook.react.bridge.Callback; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactMethod; import com.facebook.react.bridge.WritableMap; import com.umeng.socialize.UMShareAPI; import com.umeng.socialize.bean.SHARE_MEDIA; import com.umeng.socialize.UMAuthListener; import com.google.gson.Gson; import java.util.HashMap; import java.util.Map; public class ThirdLoginModule extends ReactContextBaseJavaModule { ReactApplicationContext aContext; Callback callback; UMAuthListener umAuthListener = new UMAuthListener() { /** * @desc 授权开始的回调 * @param platform 平台名称 */ @Override public void onStart(SHARE_MEDIA platform) { } /** * @desc 授权成功的回调 * @param platform 平台名称 * @param action 行为序号,开发者用不上 * @param data 用户资料返回 */ @Override public void onComplete(SHARE_MEDIA platform, int action, Map<String, String> data) { Toast.makeText(aContext, "成功了", Toast.LENGTH_LONG).show(); Map<String, String> baseJsonMap=new HashMap<String, String>(); baseJsonMap.put("uid",data.get("uid")); baseJsonMap.put("accessToken",data.get("access_token")); baseJsonMap.put("refreshToken",data.get("refreshToken")); baseJsonMap.put("expiration",data.get("expiration")); baseJsonMap.put("name",data.get("name")); baseJsonMap.put("iconurl",data.get("iconurl")); baseJsonMap.put("gender",data.get("gender")); Gson gsonObj = new Gson(); String baseJsonStr = gsonObj.toJson(baseJsonMap); String detailedJsonStr = gsonObj.toJson(data); WritableMap contactMap = Arguments.createMap(); contactMap.putString("baseJSONStr",baseJsonStr); contactMap.putString("detailedJSONStr",detailedJsonStr); callback.invoke(contactMap); } /** * @desc 授权失败的回调 * @param platform 平台名称 * @param action 行为序号,开发者用不上 * @param t 错误原因 */ @Override public void onError(SHARE_MEDIA platform, int action, Throwable t) { Toast.makeText(aContext, "失败:" + t.getMessage(), Toast.LENGTH_LONG).show(); } /** * @desc 授权取消的回调 * @param platform 平台名称 * @param action 行为序号,开发者用不上 */ @Override public void onCancel(SHARE_MEDIA platform, int action) { Toast.makeText(aContext, "取消了", Toast.LENGTH_LONG).show(); } }; private final ActivityEventListener mActivityEventListener = new BaseActivityEventListener() { @Override public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) { UMShareAPI.get(aContext).onActivityResult(requestCode, resultCode, data); } }; public ThirdLoginModule(ReactApplicationContext context) { super(context); aContext = context; context.addActivityEventListener(mActivityEventListener); } @Override public String getName(){ return "ThirdLoginModule"; } @ReactMethod public void getAuthWithUserInfoFromSina(Callback theCallback) { Activity activity = getCurrentActivity(); UMShareAPI.get(aContext).getPlatformInfo(activity, SHARE_MEDIA.SINA, umAuthListener); callback = theCallback; } }
[ "1440779243@qq.com" ]
1440779243@qq.com
0ceea0bf991a18c0aab1b7b004568114199bbffb
bbed9dee6673b386e7397a2257c6b4d24e55432b
/src/main/java/com/entities/User.java
d1f1cd1e15f789a501993e968dc451ae2e63bf1a
[]
no_license
infarot/customer
63b6b35be785900b0e4bcbc0cb45eeea0b073bc7
e8de8e1280462a593b4f3f89cabc323fa1e97c1e
refs/heads/master
2020-04-16T07:19:23.149748
2019-01-27T08:29:53
2019-01-27T08:29:53
165,381,958
0
0
null
null
null
null
UTF-8
Java
false
false
1,089
java
package com.entities; import com.enums.Roles; import javax.persistence.*; import java.util.List; @Entity @Table(name = "user") public class User { @Id @Column(name = "username") private String username; @Column(name = "password") private String password; @OneToMany(cascade = CascadeType.ALL, mappedBy = "user") private List<Role> roles; @Override public String toString() { return "User{" + "username='" + username + '\'' + ", password='" + password + '\'' + ", roles=" + roles + '}'; } public User() { } public List<Role> getRoles() { return roles; } public void setRoles(List<Role> roles) { this.roles = roles; } 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; } }
[ "infarot@gmail.com" ]
infarot@gmail.com
935c22cba88849bce2528d24e76ba9d906a33d00
f4fea340da40892ae16582231de6e708d97cc63d
/프로그래머스/그래프/Solution_graph_h2.java
494f9243600747d1fa317918c35768a53a441c93
[]
no_license
bracksnow/My-study
fd2d2f3758e0d3b95218e29a09addff4e8a14120
98c3b5924b490dba80eec3f693931d035e48a694
refs/heads/master
2023-01-22T17:59:48.391757
2021-05-12T13:42:33
2021-05-12T13:42:33
206,094,634
1
0
null
2023-01-07T19:43:59
2019-09-03T14:15:24
JavaScript
UTF-8
Java
false
false
2,376
java
package DataStructure; import java.util.ArrayList; import java.util.HashSet; public class Solution_graph_h2 { public int solution(int n, int[][] results) { int answer = 0; ArrayList<player> players = new ArrayList<player>(); for (int i = 0; i <= n; i++) { players.add(new player(i)); } for (int[] result : results) { players.get(result[0]).win.add(result[1]);//이긴횟수 넣기 players.get(result[1]).lose.add(result[0]);//진 횟수 넣기 //향상된 for문을 사용시에 가로 한줄 씩 접근하는 것이 가능 //이후에 더 세로로 접근하고 싶으면 이중 for문을 사용하고 첫번찌 for문의 result를 대상으로 하면 됨 } for (int depth = 0; depth < n; depth++) { for (int i = 1; i <= n; i++) { player player = players.get(i); // 현재 플레이어 HashSet<Integer> winSet = new HashSet<>(); for (Integer win : player.win) { // 현재 플레이어가 이길 리스트들 for (Integer w : players.get(win).win) { // 현재 플레이어가 이긴 플레이어의 이긴 리스트들 winSet.add(w); } } player.win.addAll(winSet); // 추가 HashSet<Integer> loseSet = new HashSet<>(); for (Integer lose : player.lose) { // 현재 플레이어가 진 리스트들 for (Integer l : players.get(lose).lose) { // 현재 플레이어가 진 플레이어의 진 리스트들 loseSet.add(l); } } player.lose.addAll(loseSet); } } for (player player : players) { int size = player.win.size() + player.lose.size();//이긴 것+진 것은 순위 if (size == n-1) {//n-1일 경우 1씩 더해서 정확한 값을 찾는다 answer++; } } return answer; } public class player{//플레이어마다 이긴 횟수, 진 횟수를 저정한다 int num; HashSet<Integer> win = new HashSet<Integer>(); HashSet<Integer> lose = new HashSet<Integer>(); public player(int num) { this.num = num; } } }
[ "ktom97@gmail.com" ]
ktom97@gmail.com
7f4ca8e150bd1511956304b1916c9a484961de66
7ee57de8501e64f94727b71847de63ecd6c0f7a8
/Patternu IV/Main.java
b1c11dcba857aac2b7e0dd2d3c143573dd89412a
[]
no_license
pree1999/Playground
e4696ac3acebee1ceb370fa281c2d8df2a350824
acbf6d8cce0f4775ac670888f467d3d447c0f91f
refs/heads/master
2022-07-15T21:29:02.433787
2020-05-14T07:20:01
2020-05-14T07:20:01
255,085,599
0
0
null
null
null
null
UTF-8
Java
false
false
341
java
#include <iostream> using namespace std; int main() { int i,j,n; //printf("no. of rows\n"); cin>>n; for(i=1;i<=n;i++) { if(i%2==0) { printf("%d",i+1); } for(j=1;j<n;j++) { printf("%d",i); } if(i%2!=0) { printf("%d",i+1); } printf("\n"); } return 0; }
[ "63546241+pree1999@users.noreply.github.com" ]
63546241+pree1999@users.noreply.github.com
c5ddb782530794f1b08b831dec3da74b279b164b
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/8/8_34f0ac7b4aab1f81f1f7d5486f2ba9fb57527dea/EmbeddedEventVector/8_34f0ac7b4aab1f81f1f7d5486f2ba9fb57527dea_EmbeddedEventVector_s.java
60d7df6fb2ecfaab5c37f78a334d3a1c4d6c735f
[]
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,204
java
package edu.sc.seis.sod.process.waveform.vector; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import edu.iris.Fissures.IfEvent.EventAccessOperations; import edu.iris.Fissures.IfNetwork.Channel; import edu.iris.Fissures.IfSeismogramDC.RequestFilter; import edu.iris.Fissures.seismogramDC.LocalSeismogramImpl; import edu.sc.seis.sod.ChannelGroup; import edu.sc.seis.sod.ConfigurationException; import edu.sc.seis.sod.CookieJar; import edu.sc.seis.sod.SodUtil; import edu.sc.seis.sod.status.StringTree; import edu.sc.seis.sod.status.StringTreeBranch; import edu.sc.seis.sod.status.StringTreeLeaf; import edu.sc.seis.sod.subsetter.eventChannel.vector.EventVectorSubsetter; import edu.sc.seis.sod.subsetter.eventStation.EventStationSubsetter; /** * @author crotwell * Created on Oct 23, 2005 */ public class EmbeddedEventVector implements WaveformVectorProcess { public EmbeddedEventVector(Element config) throws ConfigurationException{ NodeList childNodes = config.getChildNodes(); for(int counter = 0; counter < childNodes.getLength(); counter++) { Node node = childNodes.item(counter); if(node instanceof Element) { eventVector = (EventVectorSubsetter) SodUtil.load((Element)node, "eventVector"); break; } } } EventVectorSubsetter eventVector; public WaveformVectorResult process(EventAccessOperations event, ChannelGroup channelGroup, RequestFilter[][] original, RequestFilter[][] available, LocalSeismogramImpl[][] seismograms, CookieJar cookieJar) throws Exception { StringTree wrapped = eventVector.accept(event, channelGroup, cookieJar); WaveformVectorResult result = new WaveformVectorResult(seismograms, new StringTreeBranch(this, wrapped.isSuccess(), wrapped)); return result; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
b991f897ac2d55136c37cff0e5ac82a0761af8ee
e47c0e83a37adef670306361850ce77caffcb6aa
/src/main/java/com/pany/bad/web/controller/MainController.java
daf0ecb4595c5f73374ce372b177cfe4e04be06d
[]
no_license
Ilya-Simkin/roe-game-manipulator
0448f02c76dedc7ae2827314416e4be71897faaf
56a5a656a87708cd21242efb2bc8cc145aaceeca
refs/heads/master
2023-01-05T18:52:55.375140
2020-10-29T11:42:10
2020-10-29T11:42:10
308,112,110
3
0
null
null
null
null
UTF-8
Java
false
false
6,055
java
package com.pany.bad.web.controller; import com.pany.bad.service.ComputerVisionService; import com.pany.bad.service.DataManipulationService; import com.pany.bad.service.RiseOfEmpiresRobot; import com.pany.bad.web.dto.OneImageDetectRequest; import org.apache.commons.lang3.tuple.MutablePair; import org.opencv.core.Mat; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.web.bind.annotation.*; import java.io.IOException; import java.util.List; @RestController public class MainController { @Autowired private DataManipulationService dataManipulationService; @Autowired @Qualifier("ConcurrentRiseOfEmpiresRobotImpl") private RiseOfEmpiresRobot ConcurrentRiseOfEmpiresRobotImpl; @Autowired @Qualifier("RiseOfEmpiresRobotImpl") private RiseOfEmpiresRobot riseOfEmpiresRobotImpl; @Autowired private ComputerVisionService computerVisionService; // @ApiOperation(value = "A method for retrieving all Host-Customer information.") @RequestMapping(value = "/matchOne/image", method = RequestMethod.POST) public void detectOneInImage(@RequestBody OneImageDetectRequest oneImageDetectRequest) throws IOException { Mat imageToLookOn = dataManipulationService.LoadImageFromFile(oneImageDetectRequest.getImagePath()); Mat template = dataManipulationService.LoadImageFromFile(oneImageDetectRequest.getTemplatePath()); Mat templateMask = dataManipulationService.LoadImageFromFile(oneImageDetectRequest.getTemplateMaskPath()); Mat result = computerVisionService.matchOne(imageToLookOn, template, templateMask); dataManipulationService.saveImageToFile(oneImageDetectRequest.getResultPath(), result); } // @ApiOperation(value = "A method for retrieving all Host-Customer information.") @RequestMapping(value = "/matchMultiple/image", method = RequestMethod.POST) public void detectMultipleInImage(@RequestBody OneImageDetectRequest oneImageDetectRequest) throws IOException { Mat imageToLookOn = dataManipulationService.LoadImageFromFile(oneImageDetectRequest.getImagePath()); Mat template = dataManipulationService.LoadImageFromFile(oneImageDetectRequest.getTemplatePath()); Mat result; if (oneImageDetectRequest.getTemplateMaskPath() != null) { Mat templateMask = dataManipulationService.LoadImageFromFile(oneImageDetectRequest.getTemplateMaskPath()); result = computerVisionService.matchMultiple(imageToLookOn, template, templateMask, oneImageDetectRequest.getTrash1(), oneImageDetectRequest.getTrash2()); } else { result = computerVisionService.matchMultiple(imageToLookOn, template, oneImageDetectRequest.getTrash1(), oneImageDetectRequest.getTrash2()); } dataManipulationService.saveImageToFile(oneImageDetectRequest.getResultPath(), result); } @RequestMapping(value = "/matchMultipleWithMultiple/image", method = RequestMethod.POST) public void detectMultipleInImageByMultiTemplate(@RequestBody OneImageDetectRequest oneImageDetectRequest) throws IOException { Mat result; Mat imageToLookOn = dataManipulationService.LoadImageFromFile(oneImageDetectRequest.getImagePath()); Mat multiTemplate = dataManipulationService.LoadImageFromFile(oneImageDetectRequest.getTemplatePath()); List<Mat> splatTemplates = dataManipulationService.splitImageToMultiImage(multiTemplate, new MutablePair<>(oneImageDetectRequest.getTemplateWidth(), oneImageDetectRequest.getTemplateHeight()), new MutablePair<>(6, 2)); if (oneImageDetectRequest.getTemplateMaskPath() != null) { Mat templateMultiMask = dataManipulationService.LoadImageFromFile(oneImageDetectRequest.getTemplateMaskPath()); List<Mat> splatMasks = dataManipulationService.splitImageToMultiImage(templateMultiMask, new MutablePair<>(oneImageDetectRequest.getTemplateWidth(), oneImageDetectRequest.getTemplateHeight()), new MutablePair<>(6, 2)); result = computerVisionService.matchMultipleWithListOfTemplates(imageToLookOn, splatTemplates, splatMasks, oneImageDetectRequest.getTrash1(), oneImageDetectRequest.getTrash2()); } else { result = computerVisionService.matchMultipleWithListOfTemplates(imageToLookOn, splatTemplates, null, oneImageDetectRequest.getTrash1(), oneImageDetectRequest.getTrash2()); } dataManipulationService.saveImageToFile(oneImageDetectRequest.getResultPath(), result); } @RequestMapping(value = "/detectPlayerCoordinates", method = RequestMethod.GET) public void scanMapInZoomOut(@RequestParam(defaultValue = "271") int state, @RequestParam(defaultValue = "false") boolean isNewSwipe, @RequestParam(defaultValue = "12") int startX, @RequestParam(defaultValue = "12") int startY) throws Exception { riseOfEmpiresRobotImpl.detectPlayersCoordinatesRoutine(state, isNewSwipe, startX, startY); } @RequestMapping(value = "/detectPlayerNamesFromImage", method = RequestMethod.GET) public void detectAndAddUserNames() throws Exception { riseOfEmpiresRobotImpl.recognizeLatestPlayersNamesRoutineFromImageScreen(); } @RequestMapping(value = "/detectPlayerNamesFromInfo", method = RequestMethod.GET) public void detectAndAddUserNamesByInfo( @RequestParam(defaultValue = "0") int pageToStart, @RequestParam(defaultValue = "0") int firstOffset, @RequestParam(defaultValue = "1") int numOfConcurrent ) throws Exception { if(numOfConcurrent > 1 ){ ConcurrentRiseOfEmpiresRobotImpl.recognizeLatestPlayersNamesRoutineByPlayerInfo(pageToStart, firstOffset); }else{ riseOfEmpiresRobotImpl.recognizeLatestPlayersNamesRoutineByPlayerInfo(pageToStart, firstOffset,numOfConcurrent); } } }
[ "isimkin@ecitele.com" ]
isimkin@ecitele.com
5cf318ea0fe5633ca6373a8dfc864205555d01f4
030cad8b644d3d6be61f0d1c07c1f626032b0818
/src/main/java/ui/models/MyListStudentsModel.java
b227469f7b1a143cb93dd924d8ba849790c56d27
[]
no_license
Zappat0n/elan_manager
fb2db006e5e2522f2c81b12e840bf9227ea95096
18d2a591e0613316269aeb75536eaef854db5131
refs/heads/development
2023-04-03T14:11:14.852358
2021-03-10T15:45:29
2021-03-10T15:45:29
324,661,882
1
0
null
2021-02-15T06:39:07
2020-12-27T00:55:12
Java
UTF-8
Java
false
false
1,967
java
package ui.models; import utils.CacheManager; import javax.swing.*; import java.util.ArrayList; import java.util.SortedMap; import java.util.TreeMap; /** * Created by robot on 24/02/17. */ public class MyListStudentsModel extends DefaultListModel<String> { private static final String TAG = MyListStudentsModel.class.getSimpleName(); private final SortedMap<String, Integer> data; public MyListStudentsModel() { data = new TreeMap<>(); } @Override public int getSize() { return data.size(); } @Override public String getElementAt(int index) { int i = 0; for (String key : data.keySet()) { if (i == index) return key; i++; } return null; } public Object[] getElementAndIdAt(int index) { int i = 0; for (String key : data.keySet()) { if (i == index) return new Object[]{key, data.get(key)}; i++; } return null; } public Object[][] getElementsAndIdsAt(int[] indices) { Object[][] res = new Object[indices.length][2]; int i = 0; for (int index : indices) { res[i++] = getElementAndIdAt(index); } return res; } public void addData(CacheManager cacheManager, String classroom) { clear(); if (classroom == null) { for ( Integer id : cacheManager.students.keySet()) data.put( (String)cacheManager.students.get(id)[0], id); } else { Integer classroomId = cacheManager.getClassroomId(classroom); if (classroomId==null) return; ArrayList<Integer> list = cacheManager.studentsPerClassroom.get(classroomId); for (Integer id: list) data.put((String)cacheManager.students.get(id)[0], id); } fireIntervalAdded(this, 0, data.size()); } @Override public void clear() { data.clear(); } }
[ "albarros1973@gmail.com" ]
albarros1973@gmail.com
f4f1142a2a6aba470bc0ee082dcb473c93fdc563
3cc8414f2c7ce1029736648a39f2b2d21913be12
/src/main/java/com/connectionchecker/DirectConnectionChekerApp.java
eab30fcff11a80c3df142fbe52801e2dbcadcd0a
[]
no_license
fbrayner/connectionchecker
808e99531f6532a5a7b6373077745418679bce1f
e58cdb7e77c4f18d06e8ad0c17940d351cbfddf5
refs/heads/master
2021-01-11T20:13:10.309718
2019-01-30T13:53:13
2019-01-30T13:53:13
79,069,049
0
0
null
null
null
null
UTF-8
Java
false
false
881
java
package com.connectionchecker; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.core.env.Environment; import com.connectionchecker.service.DirectConnectionChecker; /** * Welcome to the bus route finder service :) * */ @SpringBootApplication public class DirectConnectionChekerApp { @Autowired private Environment env; public static void main( String[] args ) { SpringApplication.run(DirectConnectionChekerApp.class, args); } @Bean InitializingBean saveData(DirectConnectionChecker directConnectionChecker){ return () -> directConnectionChecker.loadData(env.getProperty("datafile")); } }
[ "fbrayner@gmail.com" ]
fbrayner@gmail.com
9dd21eefa317573776276caef80b4e5234f83c8b
b7f63b75dc0513791f8ffdb790be05caad0b7483
/src/main/java/org/brackit/xquery/expr/NodeCmpExpr.java
ebb969a5581c51b45a85e9fefd1e92dcee6a7022
[ "BSD-3-Clause" ]
permissive
sebbae/brackit
69e13a3f54895f95b232dadd630265f70b38476a
c41c020f630f717ffcca0003d436014e2bbb383b
refs/heads/master
2020-12-04T00:05:32.271888
2018-05-01T23:12:32
2018-05-01T23:12:32
65,936,031
11
9
null
2018-05-01T23:07:07
2016-08-17T19:29:16
Java
UTF-8
Java
false
false
4,043
java
/* * [New BSD License] * Copyright (c) 2011-2012, Brackit Project Team <info@brackit.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Brackit Project Team nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.brackit.xquery.expr; import org.brackit.xquery.ErrorCode; import org.brackit.xquery.QueryContext; import org.brackit.xquery.QueryException; import org.brackit.xquery.Tuple; import org.brackit.xquery.atomic.Bool; import org.brackit.xquery.xdm.Expr; import org.brackit.xquery.xdm.Item; import org.brackit.xquery.xdm.Node; import org.brackit.xquery.xdm.Sequence; /** * * @author Sebastian Baechle * */ public class NodeCmpExpr implements Expr { public enum NodeCmp { is { @Override public Bool compare(QueryContext ctx, Node<?> left, Node<?> right) throws QueryException { return left.equals(right) ? Bool.TRUE : Bool.FALSE; } }, preceding { @Override public Bool compare(QueryContext ctx, Node<?> left, Node<?> right) throws QueryException { return left.isPrecedingOf(right) ? Bool.TRUE : Bool.FALSE; } }, following { @Override public Bool compare(QueryContext ctx, Node<?> left, Node<?> right) throws QueryException { return left.isFollowingOf(right) ? Bool.TRUE : Bool.FALSE; } }; public abstract Bool compare(QueryContext ctx, Node<?> left, Node<?> right) throws QueryException; } protected final NodeCmp nodeCmp; protected final Expr leftExpr; protected final Expr rightExpr; public NodeCmpExpr(NodeCmp nodeCmp, Expr leftExpr, Expr rightExpr) { this.nodeCmp = nodeCmp; this.leftExpr = leftExpr; this.rightExpr = rightExpr; } @Override public final Sequence evaluate(QueryContext ctx, Tuple tuple) throws QueryException { return evaluateToItem(ctx, tuple); } public Item evaluateToItem(QueryContext ctx, Tuple tuple) throws QueryException { Item left = leftExpr.evaluateToItem(ctx, tuple); Item right = rightExpr.evaluateToItem(ctx, tuple); if ((left == null) || (right == null)) { return null; } if (!(left instanceof Node<?>)) { throw new QueryException(ErrorCode.ERR_TYPE_INAPPROPRIATE_TYPE, "Left argument is not a node: %s", left); } if (!(right instanceof Node<?>)) { throw new QueryException(ErrorCode.ERR_TYPE_INAPPROPRIATE_TYPE, "right argument is not a node: %s", right); } return nodeCmp.compare(ctx, (Node<?>) left, (Node<?>) right); } @Override public boolean isUpdating() { return ((leftExpr.isUpdating()) || (rightExpr.isUpdating())); } @Override public boolean isVacuous() { return false; } }
[ "devnull@localhost" ]
devnull@localhost
6b797a57b6264f5df18505d2227694e424824aae
961016a614c6785e6fe8f6bfd7214676f0d91064
/Portlets/ProgateServiceBuilder-portlet/docroot/WEB-INF/service/larion/progate/service/persistence/ProgateOrganizationsStaffsFinderUtil.java
0243e6571811d959dbc6a0b5191242cd435d1a90
[]
no_license
thaond/progate-lmis
f58c447c58c11217e2247c7ca3349a44ad7f3bbd
d143b7e7d56a22cc9ce6256ca6fb77a11459e6d6
refs/heads/master
2021-01-10T03:00:26.888869
2011-07-28T14:12:54
2011-07-28T14:12:54
44,992,742
0
0
null
null
null
null
UTF-8
Java
false
false
2,380
java
/** * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved. * * 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 larion.progate.service.persistence; /** * <a href="ProgateOrganizationsStaffsFinderUtil.java.html"><b><i>View Source</i></b></a> * * @author Brian Wing Shun Chan * */ public class ProgateOrganizationsStaffsFinderUtil { public static java.util.List<larion.progate.model.ProgateOrganizationsStaffs> getEmployeeInformations( int rootId, int userId) throws com.liferay.portal.SystemException { return getFinder().getEmployeeInformations(rootId, userId); } public static java.util.List<larion.progate.model.ProgateOrganizationsStaffs> getEmployeesInPermissions( int rootId, int orgId) throws com.liferay.portal.PortalException, com.liferay.portal.SystemException { return getFinder().getEmployeesInPermissions(rootId, orgId); } public static java.util.List<larion.progate.model.ProgateOrganizationsStaffs> getBODInCompany( int rootId) throws com.liferay.portal.PortalException, com.liferay.portal.SystemException { return getFinder().getBODInCompany(rootId); } public static ProgateOrganizationsStaffsFinder getFinder() { return _finder; } public void setFinder(ProgateOrganizationsStaffsFinder finder) { _finder = finder; } private static ProgateOrganizationsStaffsFinder _finder; }
[ "tigerproand@gmail.com" ]
tigerproand@gmail.com
f2a674358e9b17bbc874e8beb7c306d4f96484a0
c4cfd736d54679c00f14b600ab19c31bb1a66245
/src/main/java/com/thread/CallableAndFuture.java
1b2d8c88ec1eb48066d49e90ce047fc51c0f2b07
[]
no_license
maikelsong/myDemo
dd0484ed98011c65bfdb1e4b6bf78a870c07c9f9
2ea24fa744449fe1a3e0a434d26680c55dbfa0c1
refs/heads/master
2020-03-20T12:22:55.618022
2018-09-05T09:37:34
2018-09-05T09:37:34
137,428,297
0
0
null
null
null
null
UTF-8
Java
false
false
3,438
java
package com.thread; import java.util.Random; import java.util.concurrent.Callable; import java.util.concurrent.CompletionService; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorCompletionService; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; /* * Callable 也是个任务,用threadPool.submit提交一个任务,【和threadPool.execute提交任务一样,只是这样提交任务,这个线程执行任务没有返回值】, * 而threadPool.submit提交任务是有返回值的。返回一个Future * * * */ public class CallableAndFuture { /** * @param args * @throws TimeoutException * @throws ExecutionException * @throws InterruptedException */ public static void main(String[] args) throws InterruptedException, ExecutionException, TimeoutException { ExecutorService threadPool = Executors.newSingleThreadExecutor(); Future<String> future = threadPool.submit( new Callable<String>() { public String call() throws Exception { System.out.println("执行一些任务"); Thread.sleep(10000); return "hello"; } ; } ); System.out.println("等待结果"); // try { // System.out.println("拿到结果:" + future.get()); //一直等待。等到结果 System.out.println("拿到结果:" + future.get(2,TimeUnit.SECONDS)); //1000之内没有返回结果,就抛异常 // } catch (InterruptedException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } catch (Exception e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } //提交一组Callable任务。所以需要一个线程池 //CompletionService表示能获取到最先完成的任务的序列 ExecutorService threadPool2 = Executors.newFixedThreadPool(10); CompletionService<Integer> completionService = new ExecutorCompletionService<Integer>(threadPool2); for (int i = 1; i <= 10; i++) { //提交10个任务。 final int seq = i; completionService.submit(new Callable<Integer>() { public Integer call() throws Exception { Thread.sleep(new Random().nextInt(5000)); return seq; } }); } //任务提交完成,,等待收获了。。。 completionService表示能获取到最先完成的任务的序列 for (int i = 0; i < 10; i++) { try { System.out.println( completionService.take().get()); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ExecutionException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }
[ "raolesong@LH900362.dds.com" ]
raolesong@LH900362.dds.com
0c8c07a8c8ec6bcf7f6f2e3ca3c207b76b78077a
093e810a37e1a04e5d24fcd70856d09215041b12
/src/main/java/cz/cvut/fit/tjv/bi/semwork/semwork/data/dao/StorageRepository.java
949922dd1718157ad75ec8e89e4daaa4b862f8ba
[]
no_license
aheyeant/BI-TJV_rest_api
a7a60a05274915f398f069a5446a3c8335030ef2
fa365a1a7f4901e02937ec32182ed45659d60572
refs/heads/master
2023-07-28T12:11:43.118844
2020-07-28T13:05:39
2020-07-28T13:05:39
283,214,537
0
0
null
2023-07-17T14:12:27
2020-07-28T13:04:41
Java
UTF-8
Java
false
false
489
java
package cz.cvut.fit.tjv.bi.semwork.semwork.data.dao; import cz.cvut.fit.tjv.bi.semwork.semwork.data.model.BookEntity; import cz.cvut.fit.tjv.bi.semwork.semwork.data.model.StorageEntity; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import java.util.Collection; @Repository public interface StorageRepository extends JpaRepository<StorageEntity, String> { //Collection<BookEntity> findAllBooksByStorageId(int id); }
[ "aheyeant@fit.cvut.cz" ]
aheyeant@fit.cvut.cz
fd4a5b096f146f39760b150d7fc4480e4615b842
3c6ebd42f0a7414f67e99e602b15bb922f5d0c01
/app/src/main/java/com/example/dcs/DashboardPage.java
46865d4fadc7055c5ab4e78a570aaa130970860f
[]
no_license
Santhoshkumar2603/DCS12
164b0e4ef630723edfff9e5ddcf153c8143c8780
cd1096f0bf307a8177ad7f7ca851d4ff063d06e4
refs/heads/master
2023-01-07T12:08:45.186894
2020-11-03T17:15:51
2020-11-03T17:15:51
309,756,425
0
0
null
null
null
null
UTF-8
Java
false
false
610
java
package com.example.dcs; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; public class DashboardPage extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dashboard_page); } }
[ "shan18ec126@rmkcet.ac.in" ]
shan18ec126@rmkcet.ac.in
2bdc796dc8b842a20f2db20111471fd743e7d1e1
2730a47af011c97c93aaa5df822f2423b6a3f308
/src/com/cpsh/utils/HttpUtil.java
db97ca2a3e2e8948d75fee8cef7f67f24614cd9e
[]
no_license
cpsh/SpringMVC
9f19e96e569eadad2f0650b276d35f66c3b807f0
56a7503929fa5b2436e5d9265c303e17012eddd8
refs/heads/master
2021-01-21T04:41:37.255878
2016-06-20T08:16:21
2016-06-20T08:16:21
44,380,490
1
0
null
null
null
null
UTF-8
Java
false
false
3,215
java
package com.cpsh.utils; import org.apache.http.Consts; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.config.CookieSpecs; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Set; /** * Created by Administrator on 2015/5/19 0019. */ public class HttpUtil { private static PoolingHttpClientConnectionManager cm = null; private static CloseableHttpClient httpClient = null; static { cm = new PoolingHttpClientConnectionManager(); cm.setMaxTotal(200); cm.setDefaultMaxPerRoute(20); RequestConfig globalConfig = RequestConfig.custom() .setCookieSpec(CookieSpecs.IGNORE_COOKIES) .build(); httpClient = HttpClients.custom().setConnectionManager(cm) .setDefaultRequestConfig(globalConfig) .build(); } public static String get(String url) { HttpGet httpGet = new HttpGet(url); CloseableHttpResponse response = null; try { response = httpClient.execute(httpGet); return EntityUtils.toString(response.getEntity()); } catch (ClientProtocolException e) { } catch (IOException e) { } finally { if (response != null) { try { EntityUtils.consume(response.getEntity()); } catch (IOException e) { response=null; } } } return null; } public static String post(String url,HashMap<String, String> param){ CloseableHttpResponse response = null; List<NameValuePair> formparams = new ArrayList<NameValuePair>(); if(null!=param && param.size()>0){ Set<String> keySet = param.keySet(); for (String key : keySet) { String value = param.get(key); formparams.add(new BasicNameValuePair(key, value)); } } UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, Consts.UTF_8); HttpPost httppost = new HttpPost(url); httppost.setEntity(entity); try { response = httpClient.execute(httppost); return EntityUtils.toString(response.getEntity()); } catch (ClientProtocolException e) { } catch (IOException e) { } return null; } public static void main(String[] args) { String str = HttpUtil.get( "http://192.168.2.80/51auto/website/tree/master"); System.out.println(str); } }
[ "langzilove@126.com" ]
langzilove@126.com
4b7772a4b56ab0cbc0b08b5df520c28e62cd5bbf
68481269afb3abba57200b6b80f0a5351986ce63
/main/java/com/ontag/mcash/admin/web/service/impl/BoRolesPermissionsServiceImpl.java
c28517c557e3b799e0d03c7e6f6cc97d40ba3b84
[]
no_license
rajith89/mtomcash
412f3b00edbf74d879c7d1e7cfb355e3b2226c6a
3c94bbf049985bd5b77a4fcc7b9c04422cda00d4
refs/heads/master
2020-05-20T02:23:10.827148
2015-02-08T03:13:04
2015-02-08T03:13:04
30,477,989
0
0
null
null
null
null
UTF-8
Java
false
false
4,421
java
package com.ontag.mcash.admin.web.service.impl; import java.util.List; import javax.annotation.PostConstruct; import org.hibernate.annotations.Parent; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import com.ontag.mcash.admin.web.exception.ServiceException; import com.ontag.mcash.admin.web.service.AppPermissionsService; import com.ontag.mcash.admin.web.service.BoRolesPermissionsService; import com.ontag.mcash.admin.web.util.Constants; import com.ontag.mcash.dal.dao.BoRolesPermissionsDao; import com.ontag.mcash.dal.domain.AppPermissions; import com.ontag.mcash.dal.domain.BoRoles; import com.ontag.mcash.dal.domain.BoRolesPermission; import com.ontag.mcash.dal.domain.BoUserRole; import com.ontag.mcash.dal.exception.DataAccessException; @Service @Transactional(readOnly = true, propagation = Propagation.REQUIRED) public class BoRolesPermissionsServiceImpl extends GenericServiceImpl<BoRolesPermission> implements BoRolesPermissionsService { protected static org.slf4j.Logger logger = LoggerFactory .getLogger(BoRolesPermissionsServiceImpl.class); @Autowired private BoRolesPermissionsDao boRolesPermissionsDao; @Autowired private AppPermissionsService appPermissionsService; @PostConstruct void init() { super.init(BoRolesPermission.class, boRolesPermissionsDao); } @Override @Transactional(readOnly = false) public void editBoRolesPermissions(BoRoles boRole, String permissionIds) throws ServiceException { try { String[] permissionIdsArr = permissionIds.split(","); System.out.println("count ids ################## " + permissionIdsArr.length); boRolesPermissionsDao.deleteBoRolesPermission(boRole); for (int i = 0; i < permissionIdsArr.length; i++) { System.out.println(permissionIdsArr[i]); BoRolesPermission boRolePermission = new BoRolesPermission(); AppPermissions permissions = appPermissionsService .findById(Long.parseLong(permissionIdsArr[i])); if(permissions.getParentId()!=null){ AppPermissions parentPermission = appPermissionsService.findById(permissions.getParentId().getId()); BoRolesPermission parentCheck = boRolesPermissionsDao.findParentByRole(boRole,parentPermission); System.out.println(parentCheck); if (parentCheck == null) { BoRolesPermission boRolePermissionParent = new BoRolesPermission(); boRolePermissionParent.setBoRoleId(boRole); boRolePermissionParent.setPermissionId(parentPermission); boRolesPermissionsDao.add(boRolePermissionParent); } } System.out.println("Permission ################### : " + permissions.getDisplayName()); boRolePermission.setBoRoleId(boRole); boRolePermission.setPermissionId(permissions); boRolesPermissionsDao.add(boRolePermission); } } catch (DataAccessException dae) { logger.info("Service EditBoUserRoles ################## 3 : " + dae); throw translateException(dae); } catch (Exception e) { logger.info("Service EditBoUserRoles ################## 4 : " + e); throw new ServiceException(ServiceException.PROCESSING_FAILED, e.getMessage(), e); } } @Override public List<BoRolesPermission> getRolesPermissionsByRoleId(int boRoleId) throws ServiceException { try { logger.debug("BoRolesPermissionsServiceImpl getRolesPermissionsByRoleId #############"); return boRolesPermissionsDao.getBoRolesPermissionsByRoleId(boRoleId); } catch (DataAccessException dae) { throw translateException(dae); } catch (Exception e) { throw new ServiceException(ServiceException.PROCESSING_FAILED, e.getMessage(), e); } } @Override public List<Object[]> getPermissionsByRoles(Short[] ids) throws ServiceException { try { logger.debug("BoRolesPermissionsServiceImpl getPermissionsByRoles #############"); return boRolesPermissionsDao.getPermissionsByRoles(ids); } catch (DataAccessException dae) { throw translateException(dae); } catch (Exception e) { throw new ServiceException(ServiceException.PROCESSING_FAILED, e.getMessage(), e); } } }
[ "as62794@sci.sjp.ac.lk" ]
as62794@sci.sjp.ac.lk
fa1376552e5e93b86bf847bb285b891264710081
0d0f3051ca9482131884aecd3191dc779461c718
/src/main/java/guru/springframework/converters/UnitOfMeasureToUnitOfMeasureCommand.java
34f8ecb124c1aa97020177fd9c03c9175e9e144e
[]
no_license
parisana/recipeWebApp
cb002bd726bc2cd7f8c8b567b5ef164fdbb2e59c
4dcc8dd7165d628e1c58a13f98b945f60ad351a9
refs/heads/master
2021-08-29T22:44:33.848301
2017-12-09T15:02:26
2017-12-09T15:02:26
113,166,245
0
0
null
null
null
null
UTF-8
Java
false
false
869
java
package guru.springframework.converters; import guru.springframework.commands.UnitOfMeasureCommand; import guru.springframework.domain.UnitOfMeasure; import lombok.Synchronized; import org.springframework.core.convert.converter.Converter; import org.springframework.lang.Nullable; import org.springframework.stereotype.Component; /** * Created by Parisana on 4/12/17 */ @Component public class UnitOfMeasureToUnitOfMeasureCommand implements Converter<UnitOfMeasure, UnitOfMeasureCommand>{ @Nullable @Synchronized @Override public UnitOfMeasureCommand convert(UnitOfMeasure source) { if (source==null) return null; final UnitOfMeasureCommand unitofMeasure = new UnitOfMeasureCommand(); unitofMeasure.setId(source.getId()); unitofMeasure.setDescription(source.getDescription()); return unitofMeasure; } }
[ "ngpari.earth@gmail.com" ]
ngpari.earth@gmail.com
e16d82b1815fa32f6f442355ac049ba7163a4100
465f6a8e6e9cbb9c79dc2f4258d9886539e330d2
/DGT May 25th Solutions/src/medium/TaskGFotoanGasy.java
c31a1beb7c6e23bc15336a8458104b45d6241d1a
[]
no_license
lucoram/dgt-05.25.19-solutions
9ed7fe6730a2eec4ce3385cfbb6097668a0bc2d8
f6895bc262868090812f42ed770c7d35abbd10d8
refs/heads/master
2020-06-03T11:36:11.672355
2019-06-14T10:21:53
2019-06-14T10:21:53
191,552,595
2
0
null
null
null
null
UTF-8
Java
false
false
9,222
java
package medium; import java.util.HashMap; import java.util.Map; /** * ... Anisan'ny tena fahalementsika malagasy ity fotoan-gasy ity. Tsy misy tsy * manao azy, eny na ianao aza. Misy namanao iray izay mifanao fotoana matetika * aminao, ary tara foana izy indraindray ary ndraindray koa anefa ianao no tara * foana. Tsy mety miara tonga arak'ilay fotoana nomenao azy foana ianareo dia * lasa miteraka disadisa aminareo. Mba hitsaharan'izany disadisa momban'ny * fotoana izany dia te hanamboatra programa ianao izay manome ny ora * tokony ahatongavan'ilay namanao amin'ny fotoananareo manaraka, raha toa ka * omena ny ora tena izy sy ny "historiquen"-ny fotoana rehetra nifanaovanareo * taloha. Izany hoe miankina amin'ny fandinihina ireo fotoana taloha no * hanemboranao na handrosoanao ilay oran'ny fotoana manaraka amin'izay tonga * amin'ny ora tena izy ilay namanao. * * INPUTS * - `fotoanaNifanaovanaRehetra` : tabilaona tabilaona "string" * `string[n][2]` mitahiry ny fotoana rehetra nifanaovanareo taloha, ary ny iray * amin'izany dia miendrika toy izao `["HH:mm", "HH:mm"]`. Ny ao amin'ny indice * `[0]` ny fotoana nifanaovanareo ary ao amin'ny indice `[1]` ny ora * nahatongavany. * - `fotoanaManaraka` : "string" miendrika `"HH:mm"` mitahiry ny * ora tianao ahatongavan'ilay namanao amin'ny fotoananareo manaraka. * * OUTPUT * - "string" miendrika `"HH:mm"` milaza ny ora "lainga" teneninao * amin'ilay namanao mba ahatongavany amin'ilay ora tena izy. Raha tara lava izy * dia aroso ny ora lazaina aminy, raha tonga aloha lava izy dia ahembotrao ilay * ora lazaina aminy. Boriborio ho isaky ny 5 minitra ny valin'ny programanao, * ohatra hoe raha eo anelanelan'ny `"08:58"` sy `"09:02"` no valiny dia * boriborio ho `"09:00"` izany, raha `"08:57"` dia boriboriana ho `"08:55"` ary * raha `"09:03"` dia boriboriana ho `"09:05"`. * * OHATRA * - raha `fotoanaNifanaovana = [["09:00","10:00"], ["08:00","09:00"], * ["06:30","07:30"], ["07:00","08:00"]]` ary `fotoanaManaraka = "08:15"` dia * `"07:15"` no valiny. Eto zao hita mazava fa tara adin'ny iray foana ilay * namanao tamin'ny fotoananareo taloha, ka mba ahatongavany amin'ny ora tsy * diso ("08:15") amin'ny fotoanareo manaraka dia arosonao adin'ny iray ny * fotoana lazaina azy ("07:15"). Raha ny mifamadika amin'izay no nitranga dia * ahembotrao adin'ny iray ny fotoana lazaina azy (Test 2) * - raha `fotoanaNifanaovana = [["11:00","11:05"]]` ary `fotoanaManaraka = "08:15"` * dia aroso amin'ny `"08:10"` ny fotoana lazaina azy satria tara 5 minitra izy * teo aloha. * * @author luco */ public class TaskGFotoanGasy { /** * fotoanGasy => rendezVous * * @param fotoanaNifanaovana // pastRendezVousHistory * @param fotoanaManaraka // nextRendezVousTime * @return */ public String fotoanGasy(String[][] fotoanaNifanaovana, String fotoanaManaraka) { String[][] inputVariables = regularizeInputs(fotoanaNifanaovana); Integer[] independentVariables = extractInputVariables(inputVariables, 0); Integer[] dependentVariables = extractInputVariables(inputVariables, 1); double[] regLinCoeeffs = singleLinearRegressor(independentVariables, dependentVariables); int fotoanaManarakaToMillis = HHmmToMinutes(fotoanaManaraka); int newFotoanaManaraka = (int) (regLinCoeeffs[0] + regLinCoeeffs[1] * fotoanaManarakaToMillis); boolean ahembotra = fotoanaManarakaToMillis > newFotoanaManaraka; int diff = Math.abs(fotoanaManarakaToMillis - newFotoanaManaraka); newFotoanaManaraka = fotoanaManarakaToMillis + (ahembotra ? diff : -diff); return minutesToHHmm(newFotoanaManaraka); } private double[] singleLinearRegressor(Integer[] independentVariablesX, Integer[] dependentVariablesY) { double meanX = mean(independentVariablesX); double meanY = mean(dependentVariablesY); double N = 0; double D = 0; for (int i = 0; i < independentVariablesX.length; i++) { double c = independentVariablesX[i] - meanX; N += (c * (dependentVariablesY[i] - meanY)); D += (c * c); } double B1 = N / D; double B0 = meanY - B1 * meanX; return new double[]{B0, B1}; } private double mean(Integer[] a) { int sum = 0; for (int i : a) { sum += i; } return (double) sum / a.length; } private Integer[] extractInputVariables(String[][] fotoanaNifanaovana, int variableIndex) { int instancesNumber = fotoanaNifanaovana.length; Integer[] inputVariables = new Integer[instancesNumber]; for (int i = 0; i < instancesNumber; i++) { inputVariables[i] = HHmmToMinutes(fotoanaNifanaovana[i][variableIndex]); } return inputVariables; } private String[][] regularizeInputs(String[][] fotoanaNifanaovana) { fotoanaNifanaovana = extendInputs(fotoanaNifanaovana); fotoanaNifanaovana = normalizeInputs(fotoanaNifanaovana); return fotoanaNifanaovana; } private String[][] extendInputs(String[][] fotoanaNifanaovana) { int inputLength = fotoanaNifanaovana.length; if (inputLength < 100) { Map<Scheddule, Integer> occurences = new HashMap<>(); for (String[] input : fotoanaNifanaovana) { int independent = HHmmToMinutes(input[0]); int dependent = HHmmToMinutes(input[1]); Scheddule scheddule = new Scheddule(independent, dependent); occurences.put(scheddule, occurences.containsKey(scheddule) ? occurences.get(scheddule) + 1 : 1); } int totalInputs = 0; for (Scheddule s : occurences.keySet()) { int currentTotal = occurences.get(s) * 100 / inputLength; occurences.put(s, currentTotal); totalInputs += currentTotal; } String[][] newInput = new String[totalInputs][2]; for (int i = 0; i < totalInputs;) { for (Scheddule s : occurences.keySet()) { int currentOccs = occurences.get(s); while (currentOccs-- > 0) { newInput[i][0] = minutesToHHmm(s.expected); newInput[i++][1] = minutesToHHmm(s.real); } } } return newInput; } return fotoanaNifanaovana; } private String[][] normalizeInputs(String[][] fotoanaNifanaovana) { Map<Integer, Boolean> expectedMap = new HashMap<>(); Map<Integer, Boolean> realMap = new HashMap<>(); for (int i = 0; i < fotoanaNifanaovana.length; i++) { int independent = HHmmToMinutes(fotoanaNifanaovana[i][0]); int dependent = HHmmToMinutes(fotoanaNifanaovana[i][1]); while (expectedMap.containsKey(independent) || realMap.containsKey(dependent)) { independent++; dependent++; } expectedMap.put(independent, true); realMap.put(dependent, true); fotoanaNifanaovana[i][0] = minutesToHHmmNoRound(independent); fotoanaNifanaovana[i][1] = minutesToHHmmNoRound(dependent); } return fotoanaNifanaovana; } private String minutesToHHmmNoRound(int minutes) { int hours = (int) (minutes / 60); minutes %= 60; return addLeadingZeros(hours).concat(":").concat(addLeadingZeros(minutes)); } private int HHmmToMinutes(String timeString) { String[] splittedTime = timeString.split(":"); int hours = parseInt(splittedTime[0]); int minutes = parseInt(splittedTime[1]); return hours * 60 + minutes; } private int parseInt(String value) { return Integer.parseInt(value); } private String minutesToHHmm(int minutes) { int hours = (int) (minutes / 60); minutes %= 60; minutes = roundToMultipleOf5(minutes); return addLeadingZeros(hours).concat(":").concat(addLeadingZeros(minutes)); } private String addLeadingZeros(int number) { return String.format("%02d", number); } private int roundToMultipleOf5(int minutes) { int remainder = minutes % 5; return minutes + (remainder > 2 ? 5 - remainder : -remainder); } } class Scheddule { int expected; int real; public Scheddule(int expected, int real) { this.expected = expected; this.real = real; } @Override public int hashCode() { int hash = 7; hash = 29 * hash + this.expected; hash = 29 * hash + this.real; return hash; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Scheddule other = (Scheddule) obj; if (this.expected != other.expected) { return false; } return this.real == other.real; } }
[ "luco@luco-VirtualBox" ]
luco@luco-VirtualBox
e3dc2d862abdd39dbc598c813fc62ffdc15c8de8
ae66c716c0fc6c180f3f87e7bfe7f5c3287ff948
/monitor/src/main/java/kelly/monitor/dao/mapper/ApplicationSqlProvider.java
7f5d03b305048683a5e2801f5e176b56ba95fa18
[]
no_license
cenbow/common
78eeb7b6172127cc9c0bae2144a108aec9a3e174
0c050ac9c87d8f96b4d55ebacf965afacbe8709b
refs/heads/master
2020-03-19T10:58:17.413486
2018-03-16T12:09:04
2018-03-16T12:09:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
862
java
package kelly.monitor.dao.mapper; import com.google.common.base.Strings; import kelly.monitor.common.query.ApplicationQuery; import org.apache.ibatis.jdbc.SQL; /** * Created by kelly.li on 2018/2/27. */ public class ApplicationSqlProvider { public String query(ApplicationQuery query) { return new SQL() {{ SELECT("id,app_code as appCode,app_name as appName,description,status,owners as ownerJson"); FROM("application"); WHERE("1=1"); if (query != null) { if (!Strings.isNullOrEmpty(query.getAppCode())) { AND().WHERE("app_code = #{appCode}"); } if (query.getStatus() != null) { AND().WHERE("status = #{status}"); } } ORDER_BY("id asc"); }}.toString(); } }
[ "397060869@qq.com" ]
397060869@qq.com
225271d1d10aab70bfb811f94f5d75bea41a6f79
c8e2e555c28ea54183bd06096eb0dff8c041abcb
/src/main/java/com/netsdk/lib/enumeration/CFG_EM_FACE_SNAP_POLICY.java
b3491dc6cc6bdbb0d9fabcc3ca202efdcc4e8834
[]
no_license
STAR-ZQ/dahua
b2a1777a46589a39cc136d995e4947c554a3c44d
6ae7065f729897f4557a25ee664ab402dae68236
refs/heads/master
2023-06-29T03:26:42.679160
2021-07-31T09:17:04
2021-07-31T09:17:04
386,193,125
1
0
null
null
null
null
UTF-8
Java
false
false
2,340
java
package com.netsdk.lib.enumeration; /** * @author 251823 * @description 人体检测及人体识别支持的脸部抓拍策略(定制) * @date 2021/01/11 */ public enum CFG_EM_FACE_SNAP_POLICY { // 未知 CFG_EM_FACE_SNAP_POLICY_UNKNOWN(0, "未知"), // 实时抓拍模式(当前的通用模式,实时性优先) CFG_EM_FACE_SNAP_POLICY_REALTIME(1, "实时抓拍模式"), // 优选抓拍模式,在设定的延时区间(OptimalTime)内挑选评分最高的抓图,准确性优先但延时较大 CFG_EM_FACE_SNAP_POLICY_OPTIMAL(2, "优选抓拍模式"), // 质量抓拍模式,在Optimal的基础上,如果图片质量好于阈值提前结束优选,提高实时性 CFG_EM_FACE_SNAP_POLICY_QUALITY(3, "质量抓拍模式"), // 识别优先抓拍模式,在优选时间内,以一定间隔帧数多次进行比对;一旦比对成功则立即结束优选,以提高对比成功率,取代质量优先模式 CFG_EM_FACE_SNAP_POLICY_RECOGNITION(4, "识别优先抓拍模式"), // 快速优选,从检测到人脸/人体开始,抓拍一定帧数内的质量最好的人脸或人体,定制 CFG_EM_FACE_SNAP_POLICY_QUICK(5, "快速优选"), // 全程优选,抓拍全程质量最好的人脸人体,定制 CFG_EM_FACE_SNAP_POLICY_FULLTRACK(6, "全程优选"), // 间隔抓拍,定制 CFG_EM_FACE_SNAP_POLICY_INTERVAL(7, "间隔抓拍"), // 单人模式,常用于门禁,定制 CFG_EM_FACE_SNAP_POLICY_SINGLE(8, "单人模式"), // 高精度模式,增强人脸识别,定制,增强人脸识别,定制 CFG_EM_FACE_SNAP_POLICY_PRECISION(9, "高精度模式"); private int value; private String note; private CFG_EM_FACE_SNAP_POLICY(int givenValue, String note) { this.value = givenValue; this.note = note; } public String getNote() { return note; } public int getValue() { return value; } public static String getNoteByValue(int givenValue) { for (CFG_EM_FACE_SNAP_POLICY enumType : CFG_EM_FACE_SNAP_POLICY.values()) { if (givenValue == enumType.getValue()) { return enumType.getNote(); } } return null; } public static int getValueByNote(String givenNote) { for (CFG_EM_FACE_SNAP_POLICY enumType : CFG_EM_FACE_SNAP_POLICY.values()) { if (givenNote.equals(enumType.getNote())) { return enumType.getValue(); } } return -1; } }
[ "z1501262184@163.com" ]
z1501262184@163.com
8f1c1765c0849346392dc87b325fa4cfebac558b
5f82aae041ab05a5e6c3d9ddd8319506191ab055
/Projects/Math/37/src/test/java/org/apache/commons/math/ode/nonstiff/GillStepInterpolatorTest.java
fdf27dfd45093e27fcdac8b76e3350af611ad669
[]
no_license
lingming/prapr_data
e9ddabdf971451d46f1ef2cdbee15ce342a6f9dc
be9ababc95df45fd66574c6af01122ed9df3db5d
refs/heads/master
2023-08-14T20:36:23.459190
2021-10-17T13:49:39
2021-10-17T13:49:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,326
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.math.ode.nonstiff; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.Random; import org.apache.commons.math.ode.ContinuousOutputModel; import org.apache.commons.math.ode.TestProblem3; import org.apache.commons.math.ode.sampling.StepHandler; import org.apache.commons.math.ode.sampling.StepInterpolatorTestUtils; import org.junit.Assert; import org.junit.Test; public class GillStepInterpolatorTest { @Test public void testDerivativesConsistency() { TestProblem3 pb = new TestProblem3(); double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.001; GillIntegrator integ = new GillIntegrator(step); StepInterpolatorTestUtils.checkDerivativesConsistency(integ, pb, 1.0e-10); } @Test public void serialization() throws IOException, ClassNotFoundException { TestProblem3 pb = new TestProblem3(0.9); double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.0003; GillIntegrator integ = new GillIntegrator(step); integ.addStepHandler(new ContinuousOutputModel()); integ.integrate(pb, pb.getInitialTime(), pb.getInitialState(), pb.getFinalTime(), new double[pb.getDimension()]); ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); for (StepHandler handler : integ.getStepHandlers()) { oos.writeObject(handler); } Assert.assertTrue(bos.size () > 880000); Assert.assertTrue(bos.size () < 900000); ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); ObjectInputStream ois = new ObjectInputStream(bis); ContinuousOutputModel cm = (ContinuousOutputModel) ois.readObject(); Random random = new Random(347588535632l); double maxError = 0.0; for (int i = 0; i < 1000; ++i) { double r = random.nextDouble(); double time = r * pb.getInitialTime() + (1.0 - r) * pb.getFinalTime(); cm.setInterpolatedTime(time); double[] interpolatedY = cm.getInterpolatedState (); double[] theoreticalY = pb.computeTheoreticalState(time); double dx = interpolatedY[0] - theoreticalY[0]; double dy = interpolatedY[1] - theoreticalY[1]; double error = dx * dx + dy * dy; if (error > maxError) { maxError = error; } } Assert.assertTrue(maxError < 0.003); } }
[ "2890268106@qq.com" ]
2890268106@qq.com
8bfc95be18afbe2cda3dad4a7e925aef9a57ca88
3c5e5af8e96c0f2a79cbae4c4b6517c866b87796
/src/main/java/ru/majordomo/hms/personmgr/event/account/AccountPasswordRecoverConfirmedEvent.java
23a0190ced6b2c0e1915eac7fe0d4d6ab823ca44
[ "Apache-2.0" ]
permissive
6d6a/hms-personmgr
af29778480801b732674903a9672db12c81476c0
c0bd802b6d16f50fd79b5bf4a214789230740781
refs/heads/master
2023-08-12T16:18:05.865417
2021-10-12T20:26:31
2021-10-12T20:26:39
408,609,114
0
0
null
null
null
null
UTF-8
Java
false
false
649
java
package ru.majordomo.hms.personmgr.event.account; import org.springframework.context.ApplicationEvent; import java.util.Map; import ru.majordomo.hms.personmgr.model.account.PersonalAccount; public class AccountPasswordRecoverConfirmedEvent extends ApplicationEvent { private Map<String, ?> params; public AccountPasswordRecoverConfirmedEvent(PersonalAccount source, Map<String, ?> params) { super(source); this.params = params; } @Override public PersonalAccount getSource() { return (PersonalAccount) super.getSource(); } public Map<String, ?> getParams() { return params; } }
[ "dolnigin@majordomo.ru" ]
dolnigin@majordomo.ru
baf40bd6526f8be0fbdd9a42b3c47d27c44eb33a
5ac0080a90bbbbad34ecd309d6d460c6aede013f
/src/main/java/kr/ync/service/SoccerFreeBoardRippleServiceImpl.java
714959060fc8518b0b5c49b7c2816f2330be58a9
[]
no_license
shindongwan/dongwan
3935c2d384f0357cdd7f2a739ac7e8d34c304e16
ff8b48063cdef53136f764a2c0ce29c9633495c8
refs/heads/master
2023-01-31T10:16:29.308646
2020-12-14T05:19:58
2020-12-14T05:19:58
315,174,654
0
0
null
null
null
null
UTF-8
Java
false
false
693
java
package kr.ync.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import kr.ync.domain.SoccerFreeBoardRippleVO; import kr.ync.mapper.SoccerFreeBoardRippleMapper; import lombok.extern.log4j.Log4j; @Log4j @Service public class SoccerFreeBoardRippleServiceImpl implements SoccerFreeBoardRippleService { @Autowired private SoccerFreeBoardRippleMapper free_board_ripple; @Override public void register(SoccerFreeBoardRippleVO soccer_free_board_ripple) { // TODO Auto-generated method stub log.info("register......" + soccer_free_board_ripple); free_board_ripple.insert(soccer_free_board_ripple); } }
[ "sdw14566@naver.com" ]
sdw14566@naver.com
4f37345b0f97b298cc0fbe4ae28b12ecd63c8ffc
57252d660eb1e8cd434140828f91f66a4b8b543a
/java-client/src/test/java/io/commercelayer/api/test/generated/ShippingCarrierTest.java
c3a262e379df15b8ba1ec82c993dc97cbad63089
[]
no_license
DrPierlu/cl-clients
fd0e24c8879bf723fb058437b8f0df5d70c9dd97
fc25cde2090a7cc705b8d9392d8652c540672dbe
refs/heads/master
2021-01-13T07:31:27.561277
2017-07-25T21:24:58
2017-07-25T21:24:58
71,550,351
0
0
null
null
null
null
UTF-8
Java
false
false
3,498
java
package io.commercelayer.api.test.generated; import io.commercelayer.api.ApiCaller; import io.commercelayer.api.ApiRequest; import io.commercelayer.api.ApiResponse; import io.commercelayer.api.model.ShippingCarrier; import io.commercelayer.api.operation.DeleteAccountShippingCarriersId; import io.commercelayer.api.operation.GetAccountShippingCarriersId; import io.commercelayer.api.operation.PostAccountShippingCarriers; import io.commercelayer.api.operation.PutAccountShippingCarriersId; import io.commercelayer.api.operation.common.util.ApiOperations; import io.commercelayer.api.test.common.IntegrationTest; import io.commercelayer.api.test.common.TestException; import org.junit.Assert; /** * ShippingCarrierTest */ public class ShippingCarrierTest extends IntegrationTest<ShippingCarrier> { @Override public ApiResponse<ShippingCarrier> crudCreateTest(ApiCaller caller) { // POST PostAccountShippingCarriers postOp = ApiOperations.PostAccountShippingCarriers(); ShippingCarrier res = new ShippingCarrier(); res.setKind("kind"); postOp.setPayload(res); ApiRequest<PostAccountShippingCarriers> postReq = new ApiRequest<>(postOp); ApiResponse<ShippingCarrier> postRes = test(postReq, caller); Assert.assertNotNull(postRes.getResource().getKind()); return postRes; } @Override public ApiResponse<ShippingCarrier> crudReadTest(ShippingCarrier res, ApiCaller caller) { // GET GetAccountShippingCarriersId getOp = ApiOperations.GetAccountShippingCarriersId(); getOp.setId(res.getId()); ApiRequest<GetAccountShippingCarriersId> getReq = new ApiRequest<>(getOp); ApiResponse<ShippingCarrier> getRes = test(getReq, caller); /* No test assertions */ return getRes; } @Override public ApiResponse<ShippingCarrier> crudUpdateTest(ShippingCarrier oldRes, ApiCaller caller) { // PUT PutAccountShippingCarriersId putOp = ApiOperations.PutAccountShippingCarriersId(); putOp.setId(oldRes.getId()); ShippingCarrier res = new ShippingCarrier(); res.setKind(randomField(oldRes.getKind())); putOp.setPayload(res); ApiRequest<PutAccountShippingCarriersId> putReq = new ApiRequest<>(putOp); ApiResponse<ShippingCarrier> putRes = test(putReq, caller); Assert.assertNotEquals(oldRes.getKind(), putRes.getResource().getKind()); return putRes; } @Override public ApiResponse<ShippingCarrier> crudDeleteTest(ShippingCarrier res, ApiCaller caller) { // DELETE DeleteAccountShippingCarriersId delOp = ApiOperations.DeleteAccountShippingCarriersId(); delOp.setId(res.getId()); ApiRequest<DeleteAccountShippingCarriersId> delReq = new ApiRequest<>(delOp); ApiResponse<ShippingCarrier> delRes = test(delReq, caller); // GET GetAccountShippingCarriersId getOp = ApiOperations.GetAccountShippingCarriersId(); getOp.setId(res.getId()); ApiRequest<GetAccountShippingCarriersId> getReq = new ApiRequest<>(getOp); ApiResponse<ShippingCarrier> getRes = null; try { getRes = test(getReq, caller, false); } catch (TestException te) { if (te.causedByApiError()) { Assert.assertTrue(te.getError().getHttpErrorCode() == 404); Assert.assertNull(getRes); } else throw te; } return delRes; } public static void main(String[] args) { ShippingCarrierTest test = new ShippingCarrierTest(); test.runTest(); // crudCreateTest(); // crudReadTest(); // crudUpdateTest(); // crudDeleteTest(); } }
[ "IG01755@N01203.corp.infogroup.it" ]
IG01755@N01203.corp.infogroup.it
ffbf724f8226f7b4ac3c9b9ab856a1f266c15cab
3b91ed788572b6d5ac4db1bee814a74560603578
/com/tencent/mm/plugin/remittance/bankcard/model/a.java
5cdf73845afb897f9c914462077510c40a519733
[]
no_license
linsir6/WeChat_java
a1deee3035b555fb35a423f367eb5e3e58a17cb0
32e52b88c012051100315af6751111bfb6697a29
refs/heads/master
2020-05-31T05:40:17.161282
2018-08-28T02:07:02
2018-08-28T02:07:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,938
java
package com.tencent.mm.plugin.remittance.bankcard.model; import com.tencent.mm.platformtools.SpellMap; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import java.math.BigDecimal; public final class a { public static long ek(String str, String str2) { try { return new BigDecimal(bi.getDouble(str.trim(), 0.0d) == 0.0d ? "0" : str.trim()).divide(new BigDecimal(str2.trim()), 0, 4).longValue(); } catch (Throwable e) { x.printErrStackTrace("MicroMsg.BankRemitUtil", e, "", new Object[0]); return 0; } } public static double el(String str, String str2) { try { return new BigDecimal(bi.getDouble(str.trim(), 0.0d) == 0.0d ? "0" : str.trim()).divide(new BigDecimal(str2.trim()), 2, 4).doubleValue(); } catch (Throwable e) { x.printErrStackTrace("MicroMsg.BankRemitUtil", e, "", new Object[0]); return 0.0d; } } public static double em(String str, String str2) { try { double d = bi.getDouble(str, 0.0d); double d2 = bi.getDouble(str2, 0.0d); if (d == 0.0d) { str = "0"; } BigDecimal bigDecimal = new BigDecimal(str); if (d2 == 0.0d) { str2 = "0"; } return bigDecimal.multiply(new BigDecimal(str2)).doubleValue(); } catch (Throwable e) { x.printErrStackTrace("MicroMsg.BankRemitUtil", e, "", new Object[0]); return 0.0d; } } public static double vp(int i) { return el(String.valueOf(i), "100"); } public static char Kv(String str) { String g = SpellMap.g(str.charAt(0)); x.d("MicroMsg.BankRemitUtil", "pinyin: %s", new Object[]{g}); if (bi.oW(g)) { return '#'; } return g.toUpperCase().charAt(0); } }
[ "707194831@qq.com" ]
707194831@qq.com
411410c2df30a235cbf5eff774b5a1c4da1c845e
6f68e1452b105f0684faf12aa3175d9ea7e7a05a
/src/main/java/njuse/ffff/ui/component/IButtonExListener.java
71969e5bf052a1b27ff94f48aa188f19fd65e33b
[]
no_license
troyeagle/nbastatistic
7ff70b472d1bab0e6e9dae78d60439e64e39f721
14d1ca9b073c808dcff052026a68ee3cbbe90369
refs/heads/master
2021-01-25T08:55:21.942161
2015-06-17T12:14:16
2015-06-17T12:14:16
31,802,401
2
0
null
null
null
null
UTF-8
Java
false
false
262
java
package njuse.ffff.ui.component; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.event.MouseWheelListener; public interface IButtonExListener extends MouseListener, MouseWheelListener, MouseMotionListener { }
[ "lwpqq000@gmail.com" ]
lwpqq000@gmail.com
d8fd65a0e1a89edee174df62f4133f69490c1973
ec8ea34610b049a8769bf2a60427baa1b7138a26
/Runnable standalones/workspace_eclipse/workspace_Apr2015/Servlet_checking/src/model/Object_model1.java
2685b2367a774b5dcecbf2b5375b5b64ec7b446e
[ "MIT" ]
permissive
AloyASen/java-programming-tutorial
1c0419d72e0daad4b7b33a2a172c8786d5006aa2
2bb503cf8f68133a5fc2670bc9b79c42a91eb027
refs/heads/master
2021-05-14T19:15:48.566155
2018-05-17T03:17:48
2018-05-17T03:17:48
116,104,446
0
1
null
null
null
null
UTF-8
Java
false
false
794
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 model; /** * * @author students */ public class Object_model1 extends FractalGeometry{ int obj_zoomLevel; public Object_model1() { obj_zoomLevel=0; } public void display(){ System.out.println(obj_zoomLevel); } public int zoomin() { obj_zoomLevel+=20; return obj_zoomLevel; } public int zoomout() { if(obj_zoomLevel >20){ obj_zoomLevel-=20; } return obj_zoomLevel; } public void detail_per_level() { } }
[ "aloysen951@gmail.com" ]
aloysen951@gmail.com
1aef4ffde3ddd3a234f082dbe0d4cdcf9d0aa566
b5cfe0f0ea89c2f4d4ba3a662fc178736fab5636
/Subtraction of two matrices/Main.java
7964b62e7ef068fbd61ad8a5fc84206c4c210819
[]
no_license
diksha9023/Playground
568e7fcd4b6943c125b80dca622d5a0e357f5aa3
cfb113b982d9faff794b929fedeeab9b061b4823
refs/heads/master
2020-04-14T17:00:24.648100
2019-05-02T09:59:10
2019-05-02T09:59:10
163,967,297
0
0
null
null
null
null
UTF-8
Java
false
false
948
java
import java.util.Scanner; class Main{ public static void main(String args[]) { Scanner scan= new Scanner(System.in); int row_size=scan.nextInt(); int col_size=scan.nextInt(); int matrix1[][]=new int[row_size][col_size]; int matrix2[][]=new int[row_size][col_size]; int sub[][]=new int[row_size][col_size]; for(int i=0;i<=row_size-1;i++) { for(int j=0;j<=col_size-1;j++) { matrix1[i][j]=scan.nextInt(); } } for(int i=0;i<=row_size-1;i++) { for(int j=0;j<=col_size-1;j++) { matrix2[i][j]=scan.nextInt(); } } for(int i=0;i<=row_size-1;i++) { for(int j=0;j<=col_size-1;j++) { sub[i][j]=matrix1[i][j]-matrix2[i][j]; } } for(int i=0;i<=row_size-1;i++) { for(int j=0;j<=col_size-1;j++) { System.out.print(sub[i][j]+" "); } System.out.println(); } } }
[ "46346380+diksha9023@users.noreply.github.com" ]
46346380+diksha9023@users.noreply.github.com
1067f71be9d9edb55cc8c05c90f2ebfff690735c
899ffb948407321ec358a3d9c2d99038b54f0bc5
/lipang-li_chung-yang_001270144-0b29d9b83aeb/finalProject/src/UserInterface/DepositEnterprise/ManageMatchingRequestJPanel1.java
4c9791575228a6d766dcbeaf657fa95e9a6e6e2a
[]
no_license
t0912398031/INFO-5100
78932a82973303851059ac24e4d1fd9d6262e320
f4106c3ac354fe7c64c9e0a88cd8fcc934caea31
refs/heads/master
2020-03-21T02:01:53.928611
2018-06-20T04:17:42
2018-06-20T04:17:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
22,521
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 UserInterface.DepositEnterprise; import Business.ConfigureEcoSystem; import Business.EcoSystem; import Business.Enterprise.CustodyEnterprise; import Business.Enterprise.DepositEnterprise; import Business.Enterprise.Enterprise; import Business.Enterprise.InvestmentEnterprise; import Business.Organization.InvestmentOrg; import Business.Organization.CustomerServiceOrg; import Business.Organization.Organization; import Business.Organization.TransactionOrg; import Business.UserAccount.UserAccount; import Business.WorkQueue.InvestmentWorkRequest; import Business.WorkQueue.WorkRequest; import UserInterface.CommonUse.CheckProgress; import static com.sun.javafx.runtime.SystemProperties.getCodebase; import java.awt.CardLayout; import java.awt.Graphics; import java.awt.Image; import java.awt.Toolkit; import java.text.DecimalFormat; import javax.rmi.CORBA.Util; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.table.DefaultTableModel; /** * * @author Chung-Yang Li */ public class ManageMatchingRequestJPanel1 extends javax.swing.JPanel { /** * Creates new form AccountingAssistantWorkAreaJPanel */ private JPanel userProcessContainer; private UserAccount account; private TransactionOrg matchingOrg; private DepositEnterprise enterprise; private EcoSystem ecoSystem; private Boolean alreadyMatched; private Image background; private JLabel JbackGroundImage; public ManageMatchingRequestJPanel1(JPanel userProcessContainer, UserAccount account, TransactionOrg matchingOrg, Enterprise enterprise, EcoSystem ecoSystem) { initComponents(); setSize(1480,1050); this.account = account; this.userProcessContainer =userProcessContainer; this.matchingOrg = matchingOrg; this.enterprise = (DepositEnterprise)enterprise; this.ecoSystem = ecoSystem; populateBuyTable(); populateSellTable(); populateAveragePrice(); this.alreadyMatched = false; setUpBackground(); } private void populateBuyTable(){ DefaultTableModel model = (DefaultTableModel) marketBuyJTable.getModel(); model.setRowCount(0); for (WorkRequest request : matchingOrg.getWorkQueue().getWorkRequestList()){ InvestmentWorkRequest workRequest = (InvestmentWorkRequest)request; if(workRequest.getType().equalsIgnoreCase("Buy")){ Object[] row = new Object[7]; row[0] = workRequest; row[1] = workRequest.getType(); row[2] = workRequest.getPrice(); row[3] = workRequest.getInitialAmount(); row[4] = workRequest.getAmount(); row[5] = workRequest.getRequestDate(); row[6] = workRequest.getStatus(); model.addRow(row); } } } private void populateSellTable(){ DefaultTableModel model = (DefaultTableModel) marketSellJTable.getModel(); model.setRowCount(0); for (WorkRequest request : matchingOrg.getWorkQueue().getWorkRequestList()){ InvestmentWorkRequest workRequest = (InvestmentWorkRequest)request; if(workRequest.getType().equalsIgnoreCase("Sell")){ Object[] row = new Object[7]; row[0] = workRequest; row[1] = workRequest.getType(); row[2] = workRequest.getPrice(); row[3] = workRequest.getInitialAmount(); row[4] = workRequest.getAmount(); row[5] = workRequest.getRequestDate(); row[6] = workRequest.getStatus(); model.addRow(row); } } } private void populateAveragePrice(){ double dailyAveragePrice = 0.0; if(matchingOrg.getPricehistory().getDailyTransactionPriceList().size() == 0) { txtMarketDailyPrice.setText("0.00"); return; } if(Double.isNaN(matchingOrg.getAverageHistoryPrice())) { txtMarketPrice.setText("Undefined"); return; } else { if(!matchingOrg.getPricehistory().getDailyTransactionPriceList().isEmpty()) dailyAveragePrice = matchingOrg.getPricehistory().getDailyTransactionPriceList().get(matchingOrg.getPricehistory().getDailyTransactionPriceList().size()-1).getDealPrice(); DecimalFormat df=new DecimalFormat("#.##"); String dap=df.format(dailyAveragePrice); String ap=df.format(matchingOrg.getAverageHistoryPrice()); txtMarketDailyPrice.setText(dap); txtMarketPrice.setText(ap); } } private void setUpBackground(){ ImageIcon myImage = new ImageIcon(Toolkit.getDefaultToolkit().getImage(getClass().getResource("bitcoins.jpg"))); Image img = myImage.getImage(); Image newImg = img.getScaledInstance(1480, 1050, Image.SCALE_SMOOTH); jLabel6.setSize(1480, 1050); ImageIcon image = new ImageIcon(newImg); jLabel6.setIcon(image); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { backBtn = new javax.swing.JButton(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); txtMarketDailyPrice = new javax.swing.JTextField(); txtMarketPrice = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); marketBuyJTable = new javax.swing.JTable(); btnMatch1 = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); jScrollPane2 = new javax.swing.JScrollPane(); marketSellJTable = new javax.swing.JTable(); btnMatch2 = new javax.swing.JButton(); btnMatch3 = new javax.swing.JButton(); btnMatch = new javax.swing.JButton(); checkBtn = new javax.swing.JButton(); jLabel6 = new javax.swing.JLabel(); setPreferredSize(new java.awt.Dimension(1680, 1050)); setLayout(null); backBtn.setBackground(new java.awt.Color(255, 255, 255)); backBtn.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N backBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/UserInterface/BitCoinMall/picture/back.png"))); // NOI18N backBtn.setText(" Back"); backBtn.setIconTextGap(10); backBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { backBtnActionPerformed(evt); } }); add(backBtn); backBtn.setBounds(20, 20, 120, 45); jLabel4.setFont(new java.awt.Font("Arial", 1, 28)); // NOI18N jLabel4.setForeground(new java.awt.Color(255, 255, 255)); jLabel4.setText("Manage Matching Request"); add(jLabel4); jLabel4.setBounds(170, 20, 390, 50); jLabel5.setBackground(new java.awt.Color(0, 0, 0)); jLabel5.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N jLabel5.setForeground(new java.awt.Color(255, 255, 255)); jLabel5.setText("Daily Average Price:"); add(jLabel5); jLabel5.setBounds(560, 40, 210, 22); jLabel3.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N jLabel3.setForeground(new java.awt.Color(255, 255, 255)); jLabel3.setText("Market Average Price:"); add(jLabel3); jLabel3.setBounds(560, 80, 220, 22); txtMarketDailyPrice.setFont(new java.awt.Font("Calibri", 1, 18)); // NOI18N txtMarketDailyPrice.setText("Undefined"); txtMarketDailyPrice.setEnabled(false); add(txtMarketDailyPrice); txtMarketDailyPrice.setBounds(760, 40, 120, 32); txtMarketPrice.setFont(new java.awt.Font("Calibri", 1, 18)); // NOI18N txtMarketPrice.setText("Undefined"); txtMarketPrice.setEnabled(false); txtMarketPrice.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtMarketPriceActionPerformed(evt); } }); add(txtMarketPrice); txtMarketPrice.setBounds(760, 80, 120, 32); jLabel2.setFont(new java.awt.Font("Arial", 1, 24)); // NOI18N jLabel2.setForeground(new java.awt.Color(255, 255, 255)); jLabel2.setText("Buy:"); add(jLabel2); jLabel2.setBounds(20, 90, 100, 28); marketBuyJTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Work Number", "Type", "Price", "Initial Amount", "Amount", "Date", "Status" } ) { boolean[] canEdit = new boolean [] { false, false, false, false, false, false, false }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); jScrollPane1.setViewportView(marketBuyJTable); add(jScrollPane1); jScrollPane1.setBounds(20, 130, 800, 150); btnMatch1.setBackground(new java.awt.Color(255, 255, 255)); btnMatch1.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N btnMatch1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/UserInterface/BitCoinMall/picture/OK.png"))); // NOI18N btnMatch1.setText("Suspend/Unsuspend"); btnMatch1.setIconTextGap(10); btnMatch1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnMatch1ActionPerformed(evt); } }); add(btnMatch1); btnMatch1.setBounds(620, 290, 200, 40); jLabel1.setFont(new java.awt.Font("Arial", 1, 24)); // NOI18N jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Sell:"); add(jLabel1); jLabel1.setBounds(20, 290, 100, 28); marketSellJTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Work Number", "Type", "Price", "Initial Amount", "Amount", "Date", "Status" } ) { boolean[] canEdit = new boolean [] { false, false, false, false, false, false, false }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); jScrollPane2.setViewportView(marketSellJTable); add(jScrollPane2); jScrollPane2.setBounds(20, 340, 800, 160); btnMatch2.setBackground(new java.awt.Color(255, 255, 255)); btnMatch2.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N btnMatch2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/UserInterface/BitCoinMall/picture/OK - green.png"))); // NOI18N btnMatch2.setText("Suspend/Unsuspend"); btnMatch2.setIconTextGap(10); btnMatch2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnMatch2ActionPerformed(evt); } }); add(btnMatch2); btnMatch2.setBounds(630, 510, 190, 42); btnMatch3.setBackground(new java.awt.Color(255, 255, 255)); btnMatch3.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N btnMatch3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/UserInterface/BitCoinMall/picture/update.png"))); // NOI18N btnMatch3.setText("Update"); btnMatch3.setIconTextGap(10); btnMatch3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnMatch3ActionPerformed(evt); } }); add(btnMatch3); btnMatch3.setBounds(20, 510, 160, 50); btnMatch.setBackground(new java.awt.Color(255, 255, 255)); btnMatch.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N btnMatch.setIcon(new javax.swing.ImageIcon(getClass().getResource("/UserInterface/BitCoinMall/picture/match.png"))); // NOI18N btnMatch.setText("Match"); btnMatch.setIconTextGap(10); btnMatch.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnMatchActionPerformed(evt); } }); add(btnMatch); btnMatch.setBounds(680, 560, 140, 50); checkBtn.setBackground(new java.awt.Color(255, 255, 255)); checkBtn.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N checkBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/UserInterface/BitCoinMall/picture/confrim.png"))); // NOI18N checkBtn.setText("Check"); checkBtn.setIconTextGap(10); checkBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { checkBtnActionPerformed(evt); } }); add(checkBtn); checkBtn.setBounds(680, 620, 140, 50); jLabel6.setBounds(new java.awt.Rectangle(0, 0, 1480, 1050)); add(jLabel6); jLabel6.setBounds(-4, 0, 1160, 710); }// </editor-fold>//GEN-END:initComponents private void backBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backBtnActionPerformed userProcessContainer.remove(this); CardLayout layout = (CardLayout) userProcessContainer.getLayout(); layout.previous(userProcessContainer); }//GEN-LAST:event_backBtnActionPerformed private void txtMarketPriceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtMarketPriceActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtMarketPriceActionPerformed private void btnMatch1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMatch1ActionPerformed int selectedrow = marketBuyJTable.getSelectedRow(); if(selectedrow < 0){ JOptionPane.showMessageDialog(null, "Please select any row");} else{ InvestmentWorkRequest workRequest = (InvestmentWorkRequest) marketBuyJTable.getValueAt(selectedrow, 0); if(workRequest.getStatus().equalsIgnoreCase("Ready to trade")){ int dialogButton = JOptionPane.YES_NO_OPTION; int dialogResult = JOptionPane.showConfirmDialog(null, "Suspend selected workrequest?", "Warning", dialogButton); if(dialogResult == JOptionPane.YES_OPTION){ workRequest.setStatus("Suspended"); populateBuyTable(); populateSellTable(); } } else if(workRequest.getStatus().equalsIgnoreCase("Suspended")){ int dialogButton = JOptionPane.YES_NO_OPTION; int dialogResult = JOptionPane.showConfirmDialog(null, "Unsuspend selected workrequest?", "Warning", dialogButton); if(dialogResult == JOptionPane.YES_OPTION){ workRequest.setStatus("Ready to trade"); populateBuyTable(); populateSellTable(); } } else{ JOptionPane.showMessageDialog(null, "Unable to suspend selected workrequest", "Warning", JOptionPane.WARNING_MESSAGE); } } // TODO add your handling code here: }//GEN-LAST:event_btnMatch1ActionPerformed private void btnMatch2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMatch2ActionPerformed int selectedrow = marketSellJTable.getSelectedRow(); if(selectedrow < 0){ JOptionPane.showMessageDialog(null, "Please select any row");} else{ InvestmentWorkRequest workRequest = (InvestmentWorkRequest) marketSellJTable.getValueAt(selectedrow, 0); if(workRequest.getStatus().equalsIgnoreCase("Ready to trade")){ int dialogButton = JOptionPane.YES_NO_OPTION; int dialogResult = JOptionPane.showConfirmDialog(null, "Suspend selected workrequest?", "Warning", dialogButton); if(dialogResult == JOptionPane.YES_OPTION){ workRequest.setStatus("Suspended"); populateBuyTable(); populateSellTable(); } } else if(workRequest.getStatus().equalsIgnoreCase("Suspended")){ int dialogButton = JOptionPane.YES_NO_OPTION; int dialogResult = JOptionPane.showConfirmDialog(null, "Unsuspend selected workrequest?", "Warning", dialogButton); if(dialogResult == JOptionPane.YES_OPTION){ workRequest.setStatus("Ready to trade"); populateBuyTable(); populateSellTable(); } } else{ JOptionPane.showMessageDialog(null, "Unable to suspend selected workrequest", "Warning", JOptionPane.WARNING_MESSAGE); } } // TODO add your handling code here: }//GEN-LAST:event_btnMatch2ActionPerformed private void btnMatch3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMatch3ActionPerformed Organization io = null; for(Enterprise enterprise: ecoSystem.getEnterpriseNetwork().getEnterpriseList()){ if(enterprise instanceof CustodyEnterprise && enterprise.getName().equalsIgnoreCase("custodyEnterprise 1")){ for(Organization investOrg: enterprise.getOrganizationDirectory().getOrganizationList()){ if(investOrg instanceof CustomerServiceOrg) { io = investOrg; } } } } for(Enterprise enterprise: ecoSystem.getEnterpriseNetwork().getEnterpriseList()){ if(enterprise instanceof InvestmentEnterprise && enterprise.getName().equalsIgnoreCase("Mogan")){ for(Organization investOrg: enterprise.getOrganizationDirectory().getOrganizationList()){ if(investOrg instanceof InvestmentOrg) { ConfigureEcoSystem.uploadExistedOrder2(matchingOrg, investOrg, io); JOptionPane.showMessageDialog(null, "Update successfully", "Warning", JOptionPane.WARNING_MESSAGE); } } } } populateBuyTable(); populateSellTable(); }//GEN-LAST:event_btnMatch3ActionPerformed private void btnMatchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMatchActionPerformed for(int i = 0; i<marketBuyJTable.getRowCount(); i++){ InvestmentWorkRequest buyRequest = (InvestmentWorkRequest) marketBuyJTable.getValueAt(i, 0); if(buyRequest.getStatus().matches("Ready to trade|Trading")){ for(int j = 0; j<marketSellJTable.getRowCount(); j++){ InvestmentWorkRequest sellRequest = (InvestmentWorkRequest) marketSellJTable.getValueAt(j, 0); if(sellRequest.getStatus().matches("Ready to trade|Trading")) enterprise.matchTradingRequest(buyRequest, sellRequest, ecoSystem); populateBuyTable(); populateSellTable(); } } } /** calculateAverageTransactionPrice **/ matchingOrg.calculateAveragePrice(); for(Enterprise enterprise: ecoSystem.getEnterpriseNetwork().getEnterpriseList()){ if (enterprise instanceof InvestmentEnterprise) { /** calculateTotalDealPrice **/ matchingOrg.getWorkQueue().calculateTotalBuyDealPrice((InvestmentEnterprise)enterprise); /** calculateSpentAndEarnEachMatch **/ InvestmentEnterprise ie = (InvestmentEnterprise)enterprise; ie.calculateSpentAndEarnEachMatch(); } } populateBuyTable(); populateSellTable(); populateAveragePrice(); alreadyMatched = true; JOptionPane.showMessageDialog(null, "Matched successfully"); }//GEN-LAST:event_btnMatchActionPerformed private void checkBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkBtnActionPerformed int selectedRow = marketBuyJTable.getSelectedRow(); WorkRequest workRequest = (WorkRequest) marketBuyJTable.getValueAt(selectedRow, 0); CheckProgress checkProgress = new CheckProgress(workRequest); checkProgress.setVisible(true); }//GEN-LAST:event_checkBtnActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton backBtn; private javax.swing.JButton btnMatch; private javax.swing.JButton btnMatch1; private javax.swing.JButton btnMatch2; private javax.swing.JButton btnMatch3; private javax.swing.JButton checkBtn; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JTable marketBuyJTable; private javax.swing.JTable marketSellJTable; private javax.swing.JTextField txtMarketDailyPrice; private javax.swing.JTextField txtMarketPrice; // End of variables declaration//GEN-END:variables }
[ "you@example.com" ]
you@example.com
3cda858ceb9419f937d6736f760efae612ce4729
53489f89782411d635d487b6e2815e86856a76a7
/robot-service/src/main/java/com/silence/robot/service/InterfaceSceneService.java
ecc01d82b406ca5e19d6cb9e21f4af44195147d6
[ "MIT" ]
permissive
yydxll/robot
a7f92653bf69e93d53c47917ad2a5d4dfd8ca7d3
f67bdfbfd6753428ab9ed2b07f2257887684211f
refs/heads/master
2023-09-01T12:20:54.830504
2021-10-25T10:55:22
2021-10-25T10:55:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,897
java
package com.silence.robot.service; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.silence.robot.domain.InterfaceSceneDto; import com.silence.robot.domain.RobotPage; import com.silence.robot.exception.BusinessException; import com.silence.robot.exception.ExceptionCode; import com.silence.robot.mapper.TInterfaceSceneMapper; import com.silence.robot.model.TInterfaceScene; import com.silence.robot.utils.BeanUtils; import com.silence.robot.utils.CommonUtils; import com.silence.robot.utils.HttpUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; /** * 挡板服务 * * @author silence * @date 2020/10/7 */ @Service public class InterfaceSceneService { private final Logger logger = LoggerFactory.getLogger(InterfaceSceneService.class); @Resource private TInterfaceSceneMapper interfaceSceneMapper; @Resource private SubscribeConfigInfoService subscribeConfigInfoService; @Resource private SequenceService sequenceService; public RobotPage<InterfaceSceneDto> getSceneByTranCode(String tranCode, Integer page, Integer limit) { page = page == null ? 1 : page; limit = limit == null ? Integer.MAX_VALUE : limit; PageHelper.startPage(page, limit); List<TInterfaceScene> interfaceScenes = interfaceSceneMapper.selectByTranCode(tranCode); PageInfo<TInterfaceScene> pageInfo = new PageInfo<>(interfaceScenes); return new RobotPage<>(pageInfo.getTotal(), BeanUtils.copyList(InterfaceSceneDto.class, interfaceScenes)); } public JSONObject getSceneBySceneId(String sceneId) { TInterfaceScene interfaceScene = interfaceSceneMapper.selectBySceneId(sceneId); if (interfaceScene == null) { throw new BusinessException(ExceptionCode.NO_EXIST); } JSONObject jsonObject = JSONObject.parseObject(interfaceScene.getSceneValue()); JSONObject sysHead = jsonObject.getJSONObject("sysHead"); sysHead.forEach((s, o) -> { sysHead.put(s, o); if (CommonUtils.isNotEquals(s, "seqNo") && CommonUtils.isNotEquals(s, "subSeqNo")) { sysHead.put(s, getConfigValue(o.toString())); } }); JSONObject body = jsonObject.getJSONObject("body"); JSONObject result = new JSONObject(); body.forEach((s, o) -> { if (o instanceof List) { JSONArray jsonArray = body.getJSONArray(s); JSONArray resultArray = new JSONArray(); result.put(s, resultArray); for (Object arrayObject : jsonArray) { if (arrayObject instanceof List) { throw new BusinessException(ExceptionCode.JSON_PARSE_ERROR); } JSONObject jsonArrayObject = (JSONObject) arrayObject; jsonArrayObject.forEach((s1, o1) -> { if (o1 instanceof List) { throw new BusinessException(ExceptionCode.JSON_PARSE_ERROR); } jsonArrayObject.put(s1, getConfigValue(o1.toString())); }); resultArray.add(jsonArrayObject); } } else { result.put(s, getConfigValue(o.toString())); } }); jsonObject.put("sysHead", sysHead); jsonObject.put("body", result); return jsonObject; } private String getConfigValue(String configName) { String configValue = configName; if (configName.contains("{{") && configName.contains("}}")) { configName = configName.replace("{{", ""); configName = configName.replace("}}", ""); if (CommonUtils.isEquals("$timestamp", configName)) { configValue = System.currentTimeMillis()+""; }else { configValue = subscribeConfigInfoService.getConfigValue(configName, HttpUtils.getLoginUserName()); } } return configValue; } public RobotPage<InterfaceSceneDto> getScene(Integer page, Integer limit) { PageHelper.startPage(page, limit); List<TInterfaceScene> interfaceScenes = interfaceSceneMapper.selectAll(); PageInfo<TInterfaceScene> pageInfo = new PageInfo<>(interfaceScenes); return new RobotPage<>(pageInfo.getTotal(), BeanUtils.copyList(InterfaceSceneDto.class, interfaceScenes)); } public void addInterfaceScene(InterfaceSceneDto interfaceSceneDto) { checkJson(interfaceSceneDto.getSceneValue()); interfaceSceneDto.setSceneId("Scene" + sequenceService.getSequence("Scene")); TInterfaceScene interfaceScene = BeanUtils.copy(TInterfaceScene.class, interfaceSceneDto); interfaceSceneMapper.insert(interfaceScene); } public void updateInterfaceScene(InterfaceSceneDto interfaceSceneDto) { checkJson(interfaceSceneDto.getSceneValue()); TInterfaceScene interfaceScene = BeanUtils.copy(TInterfaceScene.class, interfaceSceneDto); interfaceSceneMapper.updateByPrimaryKey(interfaceScene); } public void deleteInterfaceScene(String id) { interfaceSceneMapper.deleteByPrimaryKey(id); } public void deleteBatchInterfaceScene(List<String> ids) { interfaceSceneMapper.deleteBatchByPrimaryKey(ids); } private void checkJson(String sceneValue) { JSONObject jsonObject = JSONObject.parseObject(sceneValue); if (CommonUtils.existEmpty(jsonObject.getJSONObject("sysHead"), jsonObject.getJSONObject("body"))) { throw new BusinessException(ExceptionCode.JSON_TEXT_ERROR); } } }
[ "1048037315@qq.com" ]
1048037315@qq.com
d14defa6f8948112b219b472d976aa2913082000
ef53760e1da8a104a0d746b4d40a82f7ae91f428
/spring-study/spring-study07-proxy/src/main/java/com/zpchcbd/test/MarryProxy.java
5447ea1b3d416da95251f1c2208260111ddf2c8f
[]
no_license
chibd2000/Java-Spring
5c95a9035a22975bc21d27a31c5bbda43a3ee459
2934b46cb52527b3b2abf86074bb88d8028a2f2a
refs/heads/main
2023-09-02T10:20:57.845509
2021-10-26T10:08:44
2021-10-26T10:08:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
247
java
package com.zpchcbd.test; public class MarryProxy implements MarryOperation{ Marry marry; public MarryProxy(Marry marry){ this.marry = marry; } @Override public void toMarry() { this.marry.toMarry(); } }
[ "1352483315@qq.com" ]
1352483315@qq.com
4376f971b82fa474a97d84ea134a43c565c8df7f
781e2692049e87a4256320c76e82a19be257a05d
/all_data/cs61bl/lab17/cs61bl-ix/MyTreeMap.java
b530e04c48123fe03b7b7b086965af5822d55718
[]
no_license
itsolutionscorp/AutoStyle-Clustering
54bde86fe6dbad35b568b38cfcb14c5ffaab51b0
be0e2f635a7558f56c61bc0b36c6146b01d1e6e6
refs/heads/master
2020-12-11T07:27:19.291038
2016-03-16T03:18:00
2016-03-16T03:18:42
59,454,921
4
0
null
2016-05-23T05:40:56
2016-05-23T05:40:56
null
UTF-8
Java
false
false
2,763
java
/* The "extends Comparable<K>" syntax just means that whatever K you use, it has to implement Comparable. * Makes sense, right? Otherwise there would be no way to tell whether it should go on * the left or right branch of the tree. */ public class MyTreeMap<K extends Comparable<K>, V> { private int size; // the number of items that have been put into the map // TODO You may declare new instance variables here private BinarySearchTree<KVPair> tree; /** * Constructs an empty map. */ public MyTreeMap() { // TODO Complete this! tree = new BinarySearchTree<KVPair>(); size = 0; } /** * Returns the number of items put into the map (and not subsequently * removed). */ public int size() { return size; } /** * Returns whether the map contains the given key. */ public boolean containsKey(K key) { // TODO Complete this! return tree.contains(new KVPair(key, null)); } /** * Puts the key in the map with the given value. If the key is already in * the map, replaces the value. * * Returns the previous value associated with the key, or null if there was * no such value. */ public V put(K key, V value) { // TODO Complete this! V temp; if(tree.contains(new KVPair(key, value))){ temp = tree.get(new KVPair(key, value)).value;} else{ temp = null; } tree.add(new KVPair(key, value)); return temp; } /** * Removes the key from the map. * * Returns the value associated with the key, or null if there was no key. */ public V remove(K key) { // TODO Complete this! V temp = tree.get(new KVPair(key,null)).value; tree.delete(new KVPair(key, null)); return temp; } /** * Returns the value associated with the key in the map, or null if there is * no such value. */ public V get(K key) { // TODO Complete this! return tree.get(new KVPair(key, null)).value; } /** * A class that can store a key and a value together. You can modify this * class however you want. */ private class KVPair implements Comparable<KVPair>{ private K key; private V value; public KVPair(K k, V v) { key = k; value = v; } public void setValue(V v) { value = v; } public int compareTo(KVPair O){ return key.compareTo(O.key); } } public static void main(String[] args){ MyTreeMap<String, Integer> a = new MyTreeMap(); a.put("A", new Integer(1)); a.put("B", new Integer(2)); a.put("C", new Integer(3)); a.put("D", new Integer(4)); System.out.println(a.put("A", new Integer(2))); System.out.println(a.containsKey("A")); System.out.println(a.get("A")); System.out.println(a.remove("D")); } }
[ "moghadam.joseph@gmail.com" ]
moghadam.joseph@gmail.com
0d9f3f5639f0686e41485e63c6689c7ae2bf4bc7
3c7f4f55d8c0b6679dc979dca9019e051c217add
/src/main/java/com/MRYIN/controller/TaskPoolController.java
22ef418720619e97b6e6ae7c1ebd101e558806d8
[]
no_license
yinandwen/SHYC_03
f72f1a0dae15d48ca8344a3bd01b2c21a9afad1d
af4b355a17dac28e75aad543ea70defa78bdda06
refs/heads/master
2023-02-26T15:35:27.814132
2021-01-26T05:08:03
2021-01-26T05:08:03
332,977,846
0
0
null
null
null
null
UTF-8
Java
false
false
7,924
java
package com.MRYIN.controller; import com.MRYIN.pojo.Task; import com.MRYIN.service.TaskPoolService; import com.MRYIN.util.DataGridView; import com.MRYIN.util.ResultObj; import org.springframework.stereotype.Controller; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author: Mr.Yin * @create: 2021-01-21 13:27 **/ @Controller public class TaskPoolController { @Resource private TaskPoolService taskPoolService; /* 去到任务列表页面 */ @RequestMapping("/TaskPool/toQueryTask") public String toQueryTask() { return "TaskPool/TaskPoolList"; } /* 查询所有任务 */ @RequestMapping("/TaskPool/QueryTask") @ResponseBody public DataGridView queryTask(@RequestParam("page") Integer page, @RequestParam("limit") Integer limit) { System.out.println(page); System.out.println(limit); List<Task> tasks = taskPoolService.queryAllTask(); List<Task> tasks1 = taskPoolService.queryAllTaskByLimit(page, limit); return new DataGridView(0, "成功查询所有任务", (long) tasks.size(), tasks1); } /* 添加任务 */ @RequestMapping("/TaskPool/addTask") @ResponseBody public ResultObj addTask(String PRJ_CODE, String PO_NAME, Task task) { System.out.println(PRJ_CODE); System.out.println(PO_NAME); System.out.println(task); System.out.println(task.getTK_TaskType()); try { taskPoolService.addTask(task); return ResultObj.ADD_SUCCESS; } catch (Exception e) { return ResultObj.ADD_ERROR; } } /* 更新任务 */ @RequestMapping("/TaskPool/updateTask") @ResponseBody public ResultObj updateTask(Task task) { System.out.println(task); try { taskPoolService.updateTask(task); return ResultObj.UPDATE_SUCCESS; } catch (Exception e) { return ResultObj.UPDATE_ERROR; } } /* 删除任务 */ @RequestMapping("/TaskPool/deleteTask") @ResponseBody public ResultObj deleteTask(Integer TK_ID) { System.out.println(TK_ID); try { taskPoolService.deleteTaskByTK_ID(TK_ID); return ResultObj.DELETE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.DELETE_ERROR; } } /* 头部下拉框的模糊查询 */ @RequestMapping("/TaskPool/queryBySearch/{search}") @ResponseBody public Map<String, Object> queryBySearch(@PathVariable String search) { Map<String, Object> map = new HashMap<>(); /* search:表单的四个输入框 1.开始时间、 2.结束时间、 3.任务类型、 4.任务号、项目号、项目名称 split.length-4 split.length-3 split.length-2 split.length-1 */ System.out.println(search); //start=&end=&SearchInput=YC-0001 StringUtils.split(search,"&,="); String[] split = search.split("&"); String FormData_TK_TaskType = split[split.length - 2]; String FormData_TKAll = split[split.length-1]; System.out.println(FormData_TK_TaskType);//SearchInput=YC-0001 System.out.println(FormData_TKAll);//SearchInput=YC-0001 //获取第三个输入框的键值对 String[] Format_TK_TaskType_Split = FormData_TK_TaskType.split("="); String TK_TaskType = Format_TK_TaskType_Split[Format_TK_TaskType_Split.length - 1]; //获取第四个输入框的键值对 String[] FormData_TKAll_split = FormData_TKAll.split("="); String TK_ALL = FormData_TKAll_split[FormData_TKAll_split.length - 1]; //获取值 if(Format_TK_TaskType_Split.length == 1 && FormData_TKAll_split.length == 1 ){ TK_TaskType =""; TK_ALL = ""; queryBySearchCommon(TK_TaskType,TK_ALL,map); }else if (Format_TK_TaskType_Split.length == 1){ TK_TaskType = ""; queryBySearchCommon(TK_TaskType,TK_ALL,map); }else if (FormData_TKAll_split.length == 1){ TK_ALL = ""; queryBySearchCommon(TK_TaskType,TK_ALL,map); }else{ queryBySearchCommon(TK_TaskType,TK_ALL,map); } /* 执行头部搜索 */ return map; } /* 图表的展示 1.PCT、PMT、AST、TBD 2. */ @RequestMapping("/TaskPool/Chart/Bar") @ResponseBody public List<Map<String,Object>> chartBar(){ String[] TK_TaskType = new String[]{"PCT","PMT","AST","TBD"}; List<Map<String , Object>> ls = new ArrayList<>(); for (int i = 0; i < TK_TaskType.length; i++) { HashMap<String,Object> map = new HashMap<>(); //查询所有该分类的任务 int i1 = taskPoolService.queryTaskByEchart(TK_TaskType[i]); //查询所有该分类任务并且状态为0(未完成)的任务 int i2 = taskPoolService.queryTaskByEchartBySTATUS(TK_TaskType[i]); switch (TK_TaskType[i]){ case "PCT": map.put("name","制程任务"); map.put("finish",i1-i2); map.put("unfinish",i2); map.put("value",i1); ls.add(map); break; case "PMT": map.put("name","款项任务"); map.put("finish",i1-i2); map.put("unfinish",i2); map.put("value",i1); ls.add(map); break; case "AST": map.put("name","售后任务"); map.put("finish",i1-i2); map.put("unfinish",i2); map.put("value",i1); ls.add(map); break; case "TBD": map.put("name","其他任务"); map.put("finish",i1-i2); map.put("unfinish",i2); map.put("value",i1); ls.add(map); break; } } return ls; } /* 抽出来的search方法 */ public void queryBySearchCommon(String TK_TaskType , String TK_ALL , Map<String , Object> map){ List<Task> tasks = taskPoolService.queryBySearch(TK_TaskType,TK_ALL); if(tasks.size() == 0){ map.put("code",-1); map.put("msg","尹家浩提醒你:没有找到" + TK_TaskType + "类型的任务"); }else{ map.put("code", 0); map.put("msg", "尹家浩提醒你:查询成功"); map.put("count", tasks.size()); map.put("data", tasks); } } /* 任务状态的变更 */ @RequestMapping("/TaskPool/updateTaskStatus") @ResponseBody public DataGridView updateTaskStatus(Integer TK_ID){ System.out.println(TK_ID); Task task = taskPoolService.queryTaskByTK_ID(TK_ID); System.out.println(task); Integer tk_status = task.getTK_STATUS(); if(tk_status == 0){ //未完成,通过点击之后,转为已完成 tk_status = 1 ; task.setTK_STATUS(tk_status); taskPoolService.updateTask(task); return new DataGridView(0,"更新成功,如果有疑问请联系尹家浩~~"); }else{ return new DataGridView(-1,"该任务已完成,请勿重复点击,如果有疑问请联系尹家浩~~"); } } }
[ "1834145948@qq.com" ]
1834145948@qq.com
e6df2e4e3679fcb75d424a24d90b53d73bdcf615
7ec94efdbde807f172507c1a3f946ef5a9632dfe
/src/main/java/org/java/p18_memo/t2_improvement/improve2_/Memo.java
75604463d419166cc828b1bc3b8865b81bddf983
[]
no_license
luzengqing/design-pattern
41ad109cf2b37baa7fac36030b1740e2a2f5b017
e205a10fb9c7fd8cd35058e58085e5c1c206b8ef
refs/heads/master
2022-06-25T20:33:17.596439
2019-10-11T08:15:48
2019-10-11T08:15:48
168,660,453
0
0
null
2020-10-13T11:52:23
2019-02-01T07:39:42
Java
UTF-8
Java
false
false
407
java
package org.java.p18_memo.t2_improvement.improve2_; /** * Created by lzq on 2018/4/4. * 备忘录 * 由备忘录来管理这个状态 */ public class Memo { //状态 private String state; public Memo(String state) { this.state = state; } public String getState() { return state; } public void setState(String state) { this.state = state; } }
[ "luzengqing@126.com" ]
luzengqing@126.com
e42e7ec1ca03dbef1e64de5d5fef5e2de950731c
1ad46d596dd652bd69e649897b12398309140cd2
/src/main/java/professor/Professor.java
1cfb9297c699ea84b7ac919ea99bc8011970e907
[]
no_license
weinersilva/tacs-microservice-ddd
db66cf8aaa016ed213ba6a7fed5d4db81188d471
71c918438aacbd6e929c886c69e3a705e09a74a7
refs/heads/master
2021-08-23T18:52:54.155182
2017-12-06T03:42:22
2017-12-06T03:42:22
113,105,110
0
0
null
null
null
null
UTF-8
Java
false
false
622
java
package professor; import javax.persistence.Entity; import javax.persistence.Id; @Entity public class Professor { @Id private String matricula; private String nome; private String sobrenome; public String getSobrenome() { return sobrenome; } public void setSobrenome(String sobrenome) { this.sobrenome = sobrenome; } public String getMatricula() { return matricula; } public void setMatricula(String matricula) { this.matricula = matricula; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } }
[ "walison.moreira@gmail.com" ]
walison.moreira@gmail.com
5296c17ec774333ea311cda99bfab903f485925a
07d40ea987eb54c1795eda30b32dca110da82170
/java-benchmark/src/main/java/com/redcode/demo/datastructure/binarytree/BinaryTree.java
c379af2fb9cd17c66e6dae8e65843b456583d367
[]
no_license
simplezzy/red_jcode
cbd6ad0f549d0967ce56a562e61753fa0d00c24b
4fc0ce235f044e954326a2e6e210e3cd5c47f104
refs/heads/master
2021-05-02T06:44:42.261576
2018-04-27T07:07:23
2018-04-27T07:07:23
100,553,185
0
0
null
null
null
null
UTF-8
Java
false
false
1,621
java
package com.redcode.demo.datastructure.binarytree; import java.util.LinkedList; /** * Created by zhiyu.zhou on 2018/2/5. */ public class BinaryTree { //1、求二叉树最大深度 int maxDepth(TreeNode node) { if(null == node) { return 0; } int left = maxDepth(node.left); int right = maxDepth(node.right); return Math.max(left, right) + 1; } //2、二叉树第k层节点个数 int numNodesFromKLevel(TreeNode node, int k) { if(null == node || k < 1) { return 0; } if(k == 1) { return 1; } return numNodesFromKLevel(node.left, k - 1) + numNodesFromKLevel(node.right, k - 1); } //3、二叉树的层次遍历/相当于广度优先搜索,使用队列(深度优先搜索的话,使用栈) /** * 1、根节点为空、返回 * 2、根节点不为null,则加入队列 * 3、从队列中拿出节点,当左右节点不为null时,分别把左右节点加入到队列中 */ public void levelIterator(TreeNode root) { if(null == root) { return; } LinkedList<TreeNode> list = new LinkedList<>(); list.add(root); TreeNode curNode = null; while (!list.isEmpty()) { curNode = list.poll(); //获取节点并删除 System.out.println(curNode.value); if(null != curNode.left) { list.add(curNode.left); } if(null != curNode.right) { list.add(curNode.right); } } } }
[ "zhiyu.zhou@chinaredstar.com" ]
zhiyu.zhou@chinaredstar.com
d05159e6a98088cf190c8b9935c40eea95ce0fee
ab8d10f02716519aadd66ecef4d0c799e15aa517
/src/main/java/jxl/biff/drawing/SpContainer.java
c178f37e20ec0e805368de9f4d0813642b62dc34
[]
no_license
caiqiqi/EngineerMode
cc767ddcde7ccaf0ef15ec7ef8837a70a671b183
09a87a94ceb0d38b97d3fbe0e03086e9ee53a0f3
refs/heads/master
2021-08-12T07:45:06.927619
2017-11-14T14:54:58
2017-11-14T14:54:58
110,684,973
0
0
null
2017-11-14T12:02:58
2017-11-14T12:02:58
null
UTF-8
Java
false
false
226
java
package jxl.biff.drawing; class SpContainer extends EscherContainer { public SpContainer() { super(EscherRecordType.SP_CONTAINER); } public SpContainer(EscherRecordData erd) { super(erd); } }
[ "elliot.alderson@ecorp.com" ]
elliot.alderson@ecorp.com
5eb371dfd214c5dfd75b7c4a070a2afaeb4ad6f1
59385a8fb8ac9f875f68bd41ee32f50c1c719b0f
/app/src/main/java/com/zzu/ehome/utils/NetUtils.java
3b5cb6e984baabc9c0c891dba854776178f1acc9
[]
no_license
xtfgq/ehome
813d3417c6520026842c72e208ad17284915ee89
a957f77d9e7b18d497ac9417e09ebebb7910f778
refs/heads/master
2020-06-24T19:15:52.299080
2017-07-04T01:29:11
2017-07-04T01:29:11
74,626,333
0
1
null
null
null
null
UTF-8
Java
false
false
8,101
java
package com.zzu.ehome.utils; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.location.LocationManager; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Build; import android.text.TextUtils; import com.zzu.ehome.DemoContext; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.cookie.Cookie; import org.apache.http.impl.client.AbstractHttpClient; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import java.util.ArrayList; import java.util.List; import java.util.Map; public class NetUtils { private static HttpClient httpClient = new DefaultHttpClient(); private static final String BASE_URL = "http://webim.demo.rong.io/"; /** * 发送GET请求方法 * * @param requestUrl 请求的URL * @return 响应的数据 */ public static String sendGetRequest(String requestUrl) { HttpGet httpGet = new HttpGet(BASE_URL + requestUrl); if (DemoContext.getInstance().getSharedPreferences() != null) { httpGet.addHeader("cookie", DemoContext.getInstance().getSharedPreferences().getString("DEMO_COOKIE", null)); } try { HttpResponse response = httpClient.execute(httpGet); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { HttpEntity entity = response.getEntity(); getCookie(httpClient); return EntityUtils.toString(entity); // 当返回的类型为Json数据时,调用此返回方法 } } catch (Exception e) { e.printStackTrace(); } return null; } /** * 发送post请求 * * @param requestUrl 请求的URL * @param params 请求的参数 * @return 响应的数据 */ public static String sendPostRequest(String requestUrl, Map<String, String> params) { HttpPost httpPost = new HttpPost(BASE_URL + requestUrl); if (DemoContext.getInstance().getSharedPreferences() != null) { httpPost.addHeader("cookie", DemoContext.getInstance().getSharedPreferences().getString("DEMO_COOKIE", null)); } try { if (params != null && params.size() > 0) { List<NameValuePair> paramLists = new ArrayList<NameValuePair>(); for (Map.Entry<String, String> map : params.entrySet()) { paramLists.add(new BasicNameValuePair(map.getKey(), map.getValue())); } httpPost.setEntity(new UrlEncodedFormEntity(paramLists, "UTF-8")); } HttpResponse response = httpClient.execute(httpPost); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { HttpEntity entity = response.getEntity(); getCookie(httpClient); return EntityUtils.toString(entity); } } catch (Exception e) { e.printStackTrace(); } return null; } /** * 获得cookie * * @param httpClient */ public static void getCookie(HttpClient httpClient) { List<Cookie> cookies = ((AbstractHttpClient) httpClient).getCookieStore().getCookies(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < cookies.size(); i++) { Cookie cookie = cookies.get(i); String cookieName = cookie.getName(); String cookieValue = cookie.getValue(); if (!TextUtils.isEmpty(cookieName) && !TextUtils.isEmpty(cookieValue)) { sb.append(cookieName + "="); sb.append(cookieValue + ";"); } } SharedPreferences.Editor edit = DemoContext.getInstance().getSharedPreferences().edit(); edit.putString("DEMO_COOKIE", sb.toString()); edit.apply(); } // 判断网络连接状态 public static boolean isNetworkConnected(Context context) { if (context != null) { ConnectivityManager mConnectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo mNetworkInfo = mConnectivityManager .getActiveNetworkInfo(); if (mNetworkInfo != null) { return mNetworkInfo.isAvailable(); } } return false; } // 判断wifi状态 public static boolean isWifiConnected(Context context) { if (context != null) { ConnectivityManager mConnectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo mWiFiNetworkInfo = mConnectivityManager .getNetworkInfo(ConnectivityManager.TYPE_WIFI); if (mWiFiNetworkInfo != null) { return mWiFiNetworkInfo.isAvailable(); } } return false; } // 判断移动网络 public static boolean isMobileConnected(Context context) { if (context != null) { ConnectivityManager mConnectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo mMobileNetworkInfo = mConnectivityManager .getNetworkInfo(ConnectivityManager.TYPE_MOBILE); if (mMobileNetworkInfo != null) { return mMobileNetworkInfo.isAvailable(); } } return false; } // 获取连接类型 public static int getConnectedType(Context context) { if (context != null) { ConnectivityManager mConnectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo mNetworkInfo = mConnectivityManager .getActiveNetworkInfo(); if (mNetworkInfo != null && mNetworkInfo.isAvailable()) { return mNetworkInfo.getType(); } } return -1; } /** * 设置网络 * * @param paramContext */ public static void startToSettings(Context paramContext) { if (paramContext == null) return; try { if (Build.VERSION.SDK_INT > 10) { paramContext.startActivity(new Intent( "android.settings.SETTINGS")); return; } } catch (Exception localException) { localException.printStackTrace(); return; } paramContext.startActivity(new Intent( "android.settings.WIRELESS_SETTINGS")); } /** * 判断GPS是否开启,GPS或者AGPS开启一个就认为是开启的 * @param context * @return true 表示开启 */ public static final boolean gPSIsOPen(final Context context) { LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); // 通过GPS卫星定位,定位级别可以精确到街(通过24颗卫星定位,在室外和空旷的地方定位准确、速度快) boolean gps = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); // 通过WLAN或移动网络(3G/2G)确定的位置(也称作AGPS,辅助GPS定位。主要用于在室内或遮盖物(建筑群或茂密的深林等)密集的地方定位) boolean network = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); if (gps || network) { return true; } return false; } }
[ "gq820125@163.com" ]
gq820125@163.com
a0d77d20488f667c6cd3315ffa0f1c2e4f1a7755
b01332bd1b0eac2adb901ce121b0ba481e82a126
/beike/ops-member/src/main/java/com/meitianhui/member/dao/MemberDistributionDao.java
6c93fbff76f60a106ff2be99678f9335bdca7c9d
[]
no_license
xlh198593/resin
5783690411bd23723c27f942b9ebaa6b992c4c3b
9632d32feaeeac3792118269552d3ff5ba976b39
refs/heads/master
2022-12-21T00:17:43.048802
2019-07-17T02:13:54
2019-07-17T02:13:54
81,401,320
0
2
null
2022-12-16T05:02:24
2017-02-09T02:49:12
Java
UTF-8
Java
false
false
1,939
java
package com.meitianhui.member.dao; import java.util.List; import java.util.Map; import com.meitianhui.member.entity.MDMemberDistribution; public interface MemberDistributionDao { Integer insert(MDMemberDistribution mdMemberDistribution) throws Exception; Integer update(MDMemberDistribution mdMemberDistribution) throws Exception; MDMemberDistribution getMemberDistributionInfo(Map<String,Object> map); List<Map<String,Object>> getSimpleMemberdistr(Map<String, Object> paramsMap); /** * 查询满足条件的分销memberId * @param paramsMap * @return */ List<String> getDistrMemberId(); /** * 达到条件的会员的下面所有的memberId(除孙级和子级) * @param paramsMap * @return */ List<String> getDistrNextMemberId(Map<String,Object> map); List<MDMemberDistribution> getSimpleMemberdistrByParentId(Map<String,Object> map); /** * 查询临时粉丝 * @param paramsMap * @return */ List<Map<String,Object>> selectTempFans(Map<String,Object> map); /** * 查询直邀粉丝 * @param paramsMap * @return */ List<Map<String,Object>> selectMemberDirectFans(Map<String, Object> paramsMap); /** * 查询间邀粉丝 * @param paramsMap * @return */ List<Map<String,Object>> selectMemberIndirectFans(Map<String, Object> paramsMap); /** * 查询全部粉丝 * @param paramsMap * @return */ List<Map<String,Object>> selectMemberFans(Map<String, Object> paramsMap); Integer findMemberDistrCount(Map<String,Object> paramMap); /** * 查询上级的手机号 * @param paramsMap * @return */ String selectConsumerMobile(Map<String,Object> paramMap); /** * 查询掌柜memberId * @param paramsMap * @return */ List<String> getMemberManagerId(); /** * 查询掌柜下面的memberId * @param paramsMap * @return */ List<Map<String,Object>> getdistrMemberInfo(Map<String,Object> paramMap); }
[ "longjiangxia@la-inc.cn" ]
longjiangxia@la-inc.cn
e0ab4f742f7dede8ef63863238efb4cea40db35e
e05e39ebe752f4085c0e729a74d8bb399c81af39
/src/main/java/cn/jaly/admin/controller/CommonHandler.java
a9411d3c198b302a3343686a1c2fbe0676fc6951
[]
no_license
jalyshine/jcms
69224b0d53e949dcea9bd6b53021a0b1444dd80f
705ba7924948082bf4af62f7baba40f6d4194c26
refs/heads/master
2020-04-22T20:37:25.373403
2019-02-14T07:51:00
2019-02-14T07:51:10
170,646,940
0
0
null
null
null
null
UTF-8
Java
false
false
1,877
java
package cn.jaly.admin.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import javax.servlet.http.HttpServletRequest; import java.util.Enumeration; import java.util.Map; @Controller public class CommonHandler { @RequestMapping(value = "/test/{module}/{entity}/{action}", method = RequestMethod.GET) public String commonGet(Map<String, Object> request, @PathVariable("module") String module, @PathVariable("entity") String entity, @PathVariable("action") String action){ request.put("entity", entity); request.put("action", action); StringBuilder sb = new StringBuilder(); sb.append(module).append("/").append(entity).append("_").append(action); return sb.toString(); } @RequestMapping(value = "/test/{module}/{entity}/{action}", method = RequestMethod.POST) public String commonPost(Map<String, Object> request, HttpServletRequest servletRequest, @PathVariable("module") String module, @PathVariable("entity") String entity, @PathVariable("action") String action){ Enumeration<String> attributeNames = servletRequest.getParameterNames(); while (attributeNames.hasMoreElements()){ String name = attributeNames.nextElement(); Object value = servletRequest.getParameter(name); request.put(name, value); } StringBuilder sb = new StringBuilder(); sb.append(module).append("/").append(entity).append("_").append(action); return sb.toString(); } }
[ "jaly2010sharp@163.com" ]
jaly2010sharp@163.com
840357027434d08a222c430655132f14308af8b4
817531df79e4c25116d7f308ab617a38fa9a8781
/iap-configure/src/main/java/com/haizhi/iap/configure/controller/ContentController.java
500ade99076c00660233df797265ca15cd140d17
[]
no_license
levonyang/iap
d73cbfee275f1185f8a6622a21235a9f02c9ecff
7d421e67e32928dee3ba1083bb02efce10aa53bd
refs/heads/master
2022-08-20T22:01:06.276772
2020-05-23T06:54:11
2020-05-23T06:54:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
17,411
java
package com.haizhi.iap.configure.controller; import com.google.common.base.Strings; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.haizhi.iap.common.Wrapper; import com.haizhi.iap.configure.enums.CountForm; import com.haizhi.iap.configure.exception.ConfigException; import com.haizhi.iap.configure.model.*; import com.haizhi.iap.configure.service.*; import io.swagger.annotations.Api; import lombok.Setter; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.ws.rs.core.MediaType; import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; /** * Created by chenbo on 17/5/24. */ @Api(tags="【数据配置-页面配置模块】页面配置查询和修改") @Slf4j @RestController @RequestMapping(value = "/config/content") public class ContentController { @Setter @Autowired FirstMenuService firstMenuService; @Setter @Autowired SecondMenuService secondMenuService; @Setter @Autowired DataSourceService dataSourceService; @Setter @Autowired ComponentService componentService; @Setter @Autowired ItemService itemService; @Setter @Autowired CollectionService collectionService; @Setter @Autowired ParamService paramService; /** * 获取数据源列表 * * @return */ @RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON) public Wrapper getContent() { List<FirstMenu> firstMenus = firstMenuService.getAll(); List<FirstMenu> result = Lists.newArrayList(); for (FirstMenu firstMenu : firstMenus) { //init二级导航 List<SecondMenu> secondMenus = secondMenuService.getSecondMenus(firstMenu.getId()); for (SecondMenu secondMenu : secondMenus) { //init组件 Component component = componentService.getComponent(secondMenu.getId()); if (component != null && !component.getId().equals(0l)) { String[] dataSourceIds = component.getDatasourceIds().split(","); Map<Long, DataSourceConfig> dataSourceMap = Maps.newHashMap(); for (int i = 0; i < dataSourceIds.length; i++) { if (dataSourceIds[i] == null || dataSourceIds[i].equals(0l)) { continue; } Long sourceId; try { sourceId = Long.parseLong(dataSourceIds[i]); } catch (NumberFormatException ex) { log.error("{}", ex); continue; } DataSourceConfig dataSourceConfig = dataSourceService.findConfigById(sourceId); dataSourceMap.put(sourceId, dataSourceConfig); } component.setDataSourceConfigList(Lists.newArrayList(dataSourceMap.values())); //获取组件对应的数据源参数,暂时只针对一个数据源 Param param = paramService.getByComponentId(component.getId()); component.setParam(param); //init组件里面的元素 List<Item> items = itemService.getItems(component.getId()); for (Item item : items) { SourceFieldMap sourceFieldMap = dataSourceService.getFieldByFieldId(item.getSourceFieldId()); if (sourceFieldMap != null) { item.setSourceFieldId(sourceFieldMap.getId()); item.setSourceFiledName(sourceFieldMap.getName()); item.setSourceFileKey(sourceFieldMap.getSourceField()); item.setDatasourceId(dataSourceMap.get(sourceFieldMap.getSourceConfigId()).getId()); item.setDatasourceName(dataSourceMap.get(sourceFieldMap.getSourceConfigId()).getName()); item.setDatasourceKey(dataSourceMap.get(sourceFieldMap.getSourceConfigId()).getTargetTable()); } } component.setItems(items.stream().filter(item -> { return item.getType() == 0 ? true : false; }).collect(Collectors.toList())); component.setTopItems(items.stream().filter(item -> { return item.getType() == 1 ? true : false; }).collect(Collectors.toList())); component.setCountItems(items.stream().filter(item -> { return item.getType() == 2 ? true : false; }).collect(Collectors.toList())); secondMenu.setComponent(component); } } firstMenu.setSecondMenus(secondMenus); result.add(firstMenu); } return Wrapper.OKBuilder.data(result).build(); } /** * 保存/更新页面配置 * * @param firstMenus * @return */ @RequestMapping(value = "/update", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON) public Wrapper modifyContent(@RequestBody List<FirstMenu> firstMenus) { if (firstMenus == null) { return ConfigException.MISS_FIRST_MENU.get(); } else if (firstMenus.size() > 9) { return ConfigException.OVER_LIMIT_FIRST_MENU.get(); } Set<String> firstMenuNames = Sets.newHashSet(); for (FirstMenu firstMenu : firstMenus) { if (firstMenu.getIsFix() == null) { return ConfigException.MISS_FIRST_MENU_FIX.get(); } else if (firstMenu.getIsFix().equals(1)) {//固定导航 continue; } if (firstMenu.getOrder() == null || firstMenu.getOrder().equals(0)) { return ConfigException.MISS_FIRST_MENU_LOCATION.get(); } if (firstMenu.getName() == null) { return ConfigException.MISS_FIRST_MENU_NAME.get(); } else if (firstMenu.getName().length() > 8) { return ConfigException.FIRST_MENU_LIMIT.get(); } else if (firstMenuNames.contains(firstMenu.getName())) { return ConfigException.FIRST_MENU_NAME_REPEAT.get(); } else { firstMenuNames.add(firstMenu.getName()); } //二级导航判断 Set<String> secondMenuNames = Sets.newHashSet(); List<SecondMenu> secondMenus = firstMenu.getSecondMenus(); if (secondMenus != null) { for (SecondMenu secondMenu : secondMenus) { if (secondMenu.getOrder() == null || secondMenu.getOrder().equals(0)) { return ConfigException.MISS_SECOND_MENU_ORDER.get(); } if (secondMenu.getName() == null) { return ConfigException.MISS_SECOND_MENU_NAME.get(); } if (secondMenu.getName().length() > 24) { return ConfigException.SECOND_MENU_LIMIT.get(); } if (secondMenuNames.contains(secondMenu.getName())) { return ConfigException.SECOND_MENU_NAME_REPEAT.get(); } secondMenuNames.add(secondMenu.getName()); //组件判断 Component component = secondMenu.getComponent(); if (component != null) { if (Strings.isNullOrEmpty(component.getDatasourceIds())) { return ConfigException.MISS_MENU_COMPONENT_DATASOURCE.get(); } Set dataSourceIds = Sets.newHashSet(); String[] sourceIdStrs = component.getDatasourceIds().split(","); for (int i = 0; i < sourceIdStrs.length; i++) { dataSourceIds.add(Long.parseLong(sourceIdStrs[i])); } //数据源参数判断 Param param = component.getParam(); if (param != null) { if (param.getDatasourceId() == null || param.getDatasourceId().equals(0l)) { return ConfigException.MISS_PARAM_SOURCE_ID.get(); } if (param.getIsOrder().equals(1) && param.getOrderKey() == null) {//开启排序 return ConfigException.MISS_PARAM_ORDER_KEY.get(); } } //元素判断 Set<String> itemNames = Sets.newHashSet(); Set<String> topItemNames = Sets.newHashSet(); Set<String> countItemNames = Sets.newHashSet(); List<Item> itemsAll = component.getItems(); itemsAll = itemsAll.stream().peek(item -> item.setType(0)).collect(Collectors.toList()); if (component.getTopItems() != null) { for (Item item : component.getTopItems()) { item.setType(1); itemsAll.add(item); } } if (component.getCountItems() != null) { for (Item item : component.getCountItems()) { item.setType(2); itemsAll.add(item); } } if (itemsAll != null) { for (Item item : itemsAll) { if (item.getColSpace() == null || item.getRowSpace() == null) { return ConfigException.MISS_ITEM_LOCATION.get(); } if (item.getSourceFieldId() == null) { return ConfigException.MISS_ITEM_FIELD.get(); } if (item.getName() == null) { return ConfigException.MISS_ITEM_NAME.get(); } if (item.getName().length() > 24) { return ConfigException.ITEM_NAME_LIMIT.get(); } if (item.getColSpace() == null || item.getRowSpace() == null) { return ConfigException.MISS_ITEM_SPACEINFO.get(); } if (item.getSourceFieldId() == null) { return ConfigException.MISS_ITEM_SOURCE_FIELD_ID.get(); } else if (!item.getSourceFieldId().equals(0l)) { SourceFieldMap sourceFieldMap = dataSourceService.getFieldByFieldId(item.getSourceFieldId()); if (sourceFieldMap == null) { return Wrapper.builder() .msg(ConfigException.NO_SUCH_SOURCEFIELD.get().getMsg() + item.getSourceFieldId()) .status(ConfigException.NO_SUCH_SOURCEFIELD.get().getStatus()) .build(); } else if (!dataSourceIds.contains(sourceFieldMap.getSourceConfigId())) { return ConfigException.WRONG_FIELD_IN_SOURCE.get(); } } if (item.getEleType() == null) { return ConfigException.MISS_ITEM_TYPE.get(); } else if (item.getEleType().equals(1)) {//计算器类型 if (Strings.isNullOrEmpty(item.getCountForm())) { return ConfigException.MISS_ITEM_COUNT_FORM.get(); } } if (item.getType().equals(0)) { if (itemNames.contains(item.getName())) { return ConfigException.ITEM_NAME_REPEAT.get(); } itemNames.add(item.getName()); } else if (item.getType().equals(1)) { if (topItemNames.contains(item.getName())) { return ConfigException.ITEM_NAME_REPEAT.get(); } topItemNames.add(item.getName()); } else if (item.getType().equals(2)) { if (countItemNames.contains(item.getName())) { return ConfigException.ITEM_NAME_REPEAT.get(); } countItemNames.add(item.getName()); } } } } } } } //处理数据 firstMenuService.createWithDetail(firstMenus); return Wrapper.OK; } /** * 获取一级导航显示的数据总量 * * @param companyName * @return */ @RequestMapping(value = "/fmtotal_list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON) public Wrapper getFirstMenuTotalList(@RequestParam("company_name") String companyName) { if (Strings.isNullOrEmpty(companyName)) { return ConfigException.NO_COMPANY_NAME.get(); } List<FirstMenu> firstMenus = firstMenuService.getAll(); Map<Long, Integer> result = Maps.newHashMap(); for (FirstMenu firstMenu : firstMenus) { int count = 0; List<SecondMenu> secondMenus = secondMenuService.getSecondMenus(firstMenu.getId()); for (SecondMenu secondMenu : secondMenus) { Component component = componentService.getComponent(secondMenu.getId()); if (component != null && !component.getId().equals(0l)) { if (component.getType() == 1) { continue; } else { //查询是否配置了内容 List<Item> items = itemService.getItems(component.getId()); if (items == null) { continue; } Set<Long> posNoCountSourceIds = Sets.newHashSet(); for (Item item : items) { if (!item.getType().equals(2)) {//位置类型:非计算器 SourceFieldMap sourceFieldMap = dataSourceService.getFieldByFieldId(item.getSourceFieldId()); posNoCountSourceIds.add(sourceFieldMap.getSourceConfigId()); } } List<Long> dataSourceIdList = posNoCountSourceIds.stream().collect(Collectors.toList()); if (dataSourceIdList.size() == 0) { continue; } List<SourceFieldMap> sourceFieldMapList = dataSourceService.getFieldsBySourceId(dataSourceIdList.get(0)); String keyFieldName = null; for (SourceFieldMap map : sourceFieldMapList) { if (map.getIsKey() == 1) { keyFieldName = map.getSourceField(); break; } } DataSourceConfig dataSourceConfig = dataSourceService.findConfigById(dataSourceIdList.get(0)); count += collectionService.countAllByNameAndCondition(dataSourceConfig.getTargetTable(), keyFieldName, companyName); } } } result.put(firstMenu.getId(), count); } return Wrapper.OKBuilder.data(result).build(); } /** * 获取所有的计算方式 * * @return */ @RequestMapping(value = "/countforms", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON) public Wrapper getCountForms() { List<String> data = Lists.newArrayList(); for (CountForm countForm : CountForm.values()) { data.add(countForm.getName()); } return Wrapper.OKBuilder.data(data).build(); } }
[ "linyong@stargraph.cn" ]
linyong@stargraph.cn
9af3cc1a8892437845bb02c7915b556f10c8b954
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_2c317f10211f95caeef78dace29eb529c8302bc9/AnnotationReaderTest/2_2c317f10211f95caeef78dace29eb529c8302bc9_AnnotationReaderTest_t.java
a7cd24beedad923b0e7249e547ebb35a222d08e4
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
3,858
java
// AnnotationReaderTest.java /** Copyright (c) 2002 Institute for Systems Biology and the Whitehead Institute ** ** This library is free software; you can redistribute it and/or modify it ** under the terms of the GNU Lesser General Public License as published ** by the Free Software Foundation; either version 2.1 of the License, or ** any later version. ** ** This library is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF ** MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and ** documentation provided hereunder is on an "as is" basis, and the ** Institute of Systems Biology and the Whitehead Institute ** have no obligations to provide maintenance, support, ** updates, enhancements or modifications. In no event shall the ** Institute of Systems Biology and the Whitehead Institute ** 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 ** Institute of Systems Biology and the Whitehead Institute ** have been advised of the possibility of such damage. See ** the GNU Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public License ** along with this library; if not, write to the Free Software Foundation, ** Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. **/ //------------------------------------------------------------------------------ // $Revision$ // $Date$ // $Author$ //-------------------------------------------------------------------------------------- package cytoscape.data.annotation.readers.unitTests; //-------------------------------------------------------------------------------------- import junit.framework.*; import java.io.*; import java.util.*; import cytoscape.data.readers.*; //------------------------------------------------------------------------------ /** * test the AnnotationReader class */ public class AnnotationReaderTest extends TestCase { //------------------------------------------------------------------------------ public AnnotationReaderTest (String name) { super (name); } //------------------------------------------------------------------------------ public void setUp () throws Exception { } //------------------------------------------------------------------------------ public void tearDown () throws Exception { } //------------------------------------------------------------------------------ /** * make sure that the ctor properly initializes all relevant data structures * as seen through the standard getter methods */ public void testReadKeggAnnotation () throws Exception { System.out.println ("testReadKeggAnnotation"); String filename = "sampleData/keggSample.annotation"; AnnotationReader reader = new AnnotationReader (filename); HashMap annotations = reader.getHashMap (); assertTrue (annotations.size () == 5); String [] names = reader.getNames (); assertTrue (names.length == 5); String [] expectedNames = {"VNG0006G", "VNG0008G", "VNG0009G", "VNG0046G", "VNG0047G"}; int [] expectedCounts = {2, 2, 2, 3, 1}; for (int i=0; i < 5; i++) { int [] ids = reader.getAnnotationIDs (expectedNames [i]); assertTrue (ids.length == expectedCounts [i]); } } // testReadKeggAnnotation //------------------------------------------------------------------------- public static void main (String [] args) { junit.textui.TestRunner.run (new TestSuite (AnnotationReaderTest.class)); } // main //------------------------------------------------------------------------------ } // AnnotationReaderTest
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
1fa6e29fd55db59b23ebe207484e9f3d1068e495
aaf3893993d5c200e565e271dccee49a1e2d041e
/src/main/java/com/sungjun/objects/_02_movie/Screening.java
60482a3ef6849bb0ef9954fbf1899473e7fd30b8
[]
no_license
gwonsungjun/study-objects
c1e73d8a91907b247411398e841930e4666f7e72
65b9a4e7e8e621c0c2dab416638f7b8604172f60
refs/heads/master
2021-05-18T00:20:34.558819
2020-04-15T03:46:23
2020-04-15T03:46:23
251,020,772
0
0
null
null
null
null
UTF-8
Java
false
false
920
java
package com.sungjun.objects._02_movie; import java.time.LocalDateTime; public class Screening { private Movie movie; private int sequence; private LocalDateTime whenScreened; public Screening(Movie movie, int sequence, LocalDateTime whenScreened) { this.movie = movie; this.sequence = sequence; this.whenScreened = whenScreened; } public LocalDateTime getStartTime() { return whenScreened; } public boolean isSequence(int sequence) { return this.sequence == sequence; } public Money getMovieFee() { return movie.getFee(); } public Reservation reserve(Customer customer, int audienceCount) { return new Reservation(customer, this, calculateFee(audienceCount), audienceCount); } private Money calculateFee(int audienceCount) { return movie.calculateMovieFee(this).times(audienceCount); } }
[ "sungjunpizz@gmail.com" ]
sungjunpizz@gmail.com
ca0d5c4c931e86599c38b2577e5ea53505b81150
bc2a9b8c261ff1fbfc789f90cd818757f09f7688
/src/test/java/com/evelyn/dao/SeckillDaoTest.java
8c2b6453773815808367c9f76eda1ffa235c6dda
[]
no_license
Evelynww/highConcurSecKill
4739ac0cdf9e93f66bdee37203080b4b3171f3f4
e6ddcd19e3906aee6b70b74c26830e9966ed0f69
refs/heads/master
2023-08-18T05:04:42.151189
2021-09-14T12:36:30
2021-09-14T12:36:30
406,323,366
0
0
null
null
null
null
UTF-8
Java
false
false
2,260
java
package com.evelyn.dao; import com.evelyn.pojo.Seckill; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.annotation.Resource; import java.util.Date; import java.util.List; import static org.junit.Assert.*; /** * 首先配置spring和junit整合,junit启动时加载springIOC容器 * spring-test,junit * @RunWith(SpringJUnit4ClassRunner.class) * * 根据ContextConfiguration注解告诉junit spring配置文件 * * 然后注入Dao实现类依赖 @Resource 会去springIOC容器中查找SeckillDao的实现类 */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration({"classpath:spring/spring-dao.xml"}) public class SeckillDaoTest { //注入Dao实现类依赖 @Resource private SeckillDao seckillDao; @Test public void queryById() { long id=1000; Seckill seckill = seckillDao.queryById(id); System.out.println(seckill.getName()); System.out.println(seckill); } //报错 /** * Caused by: org.apache.ibatis.binding.BindingException: Parameter 'offset' not found. Available parameters are [arg1, arg0, param1, param2] * at org.apache.ibatis.binding.MapperMethod$ParamMap.get(MapperMethod.java:212) * at org.apache.ibatis.reflection.wrapper.MapWrapper.get(MapWrapper.java:45) * at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:122) * at org.apache.ibatis.executor.BaseExecutor.createCacheKey(BaseExecutor.java:219) */ //原因:Java没有保存形参的记录:queryAll(int offset,int limit)->queryAll(arg0,arg1) //有多个参数的时候,要告诉Java到底是那个参数,这样通过#去提取参数的时候mybatis才能帮我们找到参数代表的具体值。 @Test public void queryAll() { List<Seckill> seckills = seckillDao.queryAll(0, 10); for(Seckill seckill:seckills){ System.out.println(seckill); } } @Test public void reduceNumber() { Date killTime = new Date(); int isUpdate = seckillDao.reduceNumber(10000L, killTime); System.out.println(isUpdate); } }
[ "2218650071@qq.com" ]
2218650071@qq.com
08dfb0a9ccf9e2670be3d766f1ea33f6bef22fd1
ba13e634008405ff33b927939f122dd1a5b66630
/src/main/java/com/signs/util/auth/AccessToken.java
2e6354fc990896a15a1690dc706048afa8ddeeef
[]
no_license
superdarktu/wisesigns
fafbaf466677c5a4f2a0f5c2580ae1a413dd9509
52e2d4574c5133bd01779a7e54bf0311b75df25f
refs/heads/master
2020-09-17T07:10:22.399181
2017-09-29T08:47:13
2017-09-29T08:47:13
94,492,312
1
0
null
null
null
null
UTF-8
Java
false
false
548
java
package com.signs.util.auth; public class AccessToken { private String token; private String userId; private String type; public String getToken() { return token; } public void setToken(String token) { this.token = token; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getType() { return type; } public void setType(String type) { this.type = type; } }
[ "695445293@qq.com" ]
695445293@qq.com
ba0f2dbb6410009325c9ee65239826278e779a46
fdd4cc6f8b5a473c0081af5302cb19c34433a0cf
/src/modules/agrega/contenidosportal/src/main/java/es/pode/contenidos/negocio/generacionDinamica/dominio/ContenidoODEDaoImpl.java
cb9f25f15a0a24f38454c7dd3ac567549006ca55
[]
no_license
nwlg/Colony
0170b0990c1f592500d4869ec8583a1c6eccb786
07c908706991fc0979e4b6c41d30812d861776fb
refs/heads/master
2021-01-22T05:24:40.082349
2010-12-23T14:49:00
2010-12-23T14:49:00
null
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
3,823
java
/* Agrega es una federación de repositorios de objetos digitales educativos formada por todas las Comunidades Autónomas propiedad de Red.es. Este código ha sido desarrollado por la Entidad Pública Empresarial red.es adscrita al Ministerio de Industria,Turismo y Comercio a través de la Secretaría de Estado de Telecomunicaciones y para la Sociedad de la Información, dentro del Programa Internet en el Aula, que se encuadra dentro de las actuaciones previstas en el Plan Avanza (Plan 2006-2010 para el desarrollo de la Sociedad de la Información y de Convergencia con Europa y entre Comunidades Autónomas y Ciudades Autónomas) y ha sido cofinanciado con fondos FEDER del Programa Operativo FEDER 2000-2006 “Sociedad de la Información” This program is free software: you can redistribute it and/or modify it under the terms of the European Union Public Licence (EUPL v.1.0). This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the European Union Public Licence (EUPL v.1.0). You should have received a copy of the EUPL licence along with this program. If not, see http://ec.europa.eu/idabc/en/document/7330. */ // license-header java merge-point /** * This is only generated once! It will never be overwritten. * You can (and have to!) safely modify it by hand. */ package es.pode.contenidos.negocio.generacionDinamica.dominio; /** * @see es.pode.contenidos.negocio.generacionDinamica.dominio.ContenidoODE */ public class ContenidoODEDaoImpl extends es.pode.contenidos.negocio.generacionDinamica.dominio.ContenidoODEDaoBase { /** * @see es.pode.contenidos.negocio.generacionDinamica.dominio.ContenidoODEDao#toContenidoODEVO(es.pode.contenidos.negocio.generacionDinamica.dominio.ContenidoODE) */ public es.pode.contenidos.negocio.generacionDinamica.servicio.ContenidoODEVO toContenidoODEVO(final es.pode.contenidos.negocio.generacionDinamica.dominio.ContenidoODE entity) { //default mapping between entity and VO //@todo verify or customize behaviour of this mapping return (es.pode.contenidos.negocio.generacionDinamica.servicio.ContenidoODEVO) this.getBeanMapper().map(entity, es.pode.contenidos.negocio.generacionDinamica.servicio.ContenidoODEVO.class, DEF_MAPPING_CONTENIDOODE_CONTENIDOODEVO); } /** * Copy a VO to a new entity. * @param vo The source bean (VO) * @return A new entity created with the values extracted from the vo. * @see es.pode.contenidos.negocio.generacionDinamica.dominio.ContenidoODEDao#fromContenidoODEVO(es.pode.contenidos.negocio.generacionDinamica.servicio.ContenidoODEVO) */ public es.pode.contenidos.negocio.generacionDinamica.dominio.ContenidoODE fromContenidoODEVO(final es.pode.contenidos.negocio.generacionDinamica.servicio.ContenidoODEVO vo) { //default mapping between VO and entity //@todo verify or customize behaviour of this mapping return super.fromContenidoODEVO(vo); } /** * Copy a VO to an existing entity. * @param vo The source bean (VO) * @param entity The destination bean (an existing entity) * @see es.pode.contenidos.negocio.generacionDinamica.dominio.ContenidoODEDao#fromContenidoODEVO(es.pode.contenidos.negocio.generacionDinamica.servicio.ContenidoODEVO ,es.pode.contenidos.negocio.generacionDinamica.dominio.ContenidoODE) */ public void fromContenidoODEVO(es.pode.contenidos.negocio.generacionDinamica.servicio.ContenidoODEVO vo, es.pode.contenidos.negocio.generacionDinamica.dominio.ContenidoODE entity) { //default mapping between VO and entity //@todo verify or customize behaviour of this mapping super.fromContenidoODEVO(vo, entity); } }
[ "build@zeno.siriusit.co.uk" ]
build@zeno.siriusit.co.uk
3a11be7ff76f3da631a4eede24c0444b0ae2970b
919103145715d59be26aee92a07b916a6d69e919
/app/src/main/java/projects/bryang8/com/twitterclient/images/ImagesPresenterImpl.java
16e872cc1f84b522bcf5e829ab9e2f538cc5a5cf
[]
no_license
bryang8/android-twitterclient
eca9fe766a4c5ef7e8012708f3ba6f289c66aa87
ebd3f5af6d37c5d921cf30d8a26fa7a9652d9bbe
refs/heads/master
2021-01-09T20:17:08.825429
2016-07-06T01:45:26
2016-07-06T01:45:26
62,681,945
0
0
null
null
null
null
UTF-8
Java
false
false
1,876
java
package projects.bryang8.com.twitterclient.images; import org.greenrobot.eventbus.Subscribe; import java.util.List; import projects.bryang8.com.twitterclient.images.ui.ImagesView; import projects.bryang8.com.twitterclient.images.entities.Image; import projects.bryang8.com.twitterclient.images.events.ImagesEvent; import projects.bryang8.com.twitterclient.lib.EventBus; /** * Created by bryan_g8 */ public class ImagesPresenterImpl implements ImagesPresenter { private EventBus eventBus; private ImagesView imagesView; private final ImagesInteractor imagesInteractor; public ImagesPresenterImpl(ImagesView imagesView, ImagesInteractor imagesInteractor, EventBus eventBus) { this.eventBus = eventBus; this.imagesView = imagesView; this.imagesInteractor = imagesInteractor; } @Override public void onPause() { eventBus.unregister(this); } @Override public void onResume() { eventBus.register(this); } @Override public void onDestroy() { this.imagesView = null; } @Override public void getImageTweets(){ if (this.imagesView != null){ imagesView.hideList(); imagesView.showProgress(); } this.imagesInteractor.getImageItemsList(); } @Override @Subscribe public void onEventMainThread(ImagesEvent event) { String errorMsg = event.getError(); if (this.imagesView != null) { imagesView.showList(); imagesView.hideProgress(); if (errorMsg != null) { this.imagesView.onImagesError(errorMsg); } else { List<Image> items = event.getImages(); if (items != null && !items.isEmpty()) { this.imagesView.setImages(items); } } } } }
[ "bryangflores@gmail.com" ]
bryangflores@gmail.com
7a77440bdb4a362d44f160fcb404b75e76e2a1a4
e1e6216245a26e713ac28adbf95ae513178a8fcc
/core/src/com/maplescot/loggerbill/gpg/CloudSave.java
296286458a4aea51968af6a0d5dd073c9f7a2eb7
[ "LicenseRef-scancode-warranty-disclaimer", "CC-BY-3.0" ]
permissive
MapleScotDevelopment/LoggerBill
2dde7ef12e9f10321e11b0ad52549173d49912f4
bf2d1d04ae3d8ef2ae60084ba4333b079ba8894d
refs/heads/master
2016-09-10T18:47:31.087615
2015-01-03T20:44:08
2015-01-03T20:44:08
22,103,836
5
4
null
null
null
null
UTF-8
Java
false
false
1,194
java
/* * (C) Copyright 2014 MapleScot Development * This file licensed under a Creative Commons 3.0 by attribution licence * https://creativecommons.org/licenses/by/3.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. * * https://github.com/duriej/LoggerBill */ package com.maplescot.loggerbill.gpg; /** * Save the user's profile to 'the cloud' * Created by james on 07/09/14. */ public class CloudSave { private static Resolver actual; private CloudSave() { } public static Resolver getInstance() { return actual; } public static void init(Resolver actual) { CloudSave.actual = actual; } public interface Resolver { public void register(ConflictResolver conflictResolver); public void save(byte[] profile); } public interface ConflictResolver { void resolveConflicts(String currentAccountName, byte[] p1, byte[] p2); } }
[ "duriej@gmail.com" ]
duriej@gmail.com
f9d1579a5aae0a447edac2653c56e974ebbea0e1
8c5d7b156f0a1ac8e9c7e68d1092f8e919f3d2cc
/src/com/september/forms/EnterPasswordPage.java
cb9052d73109767a337d5c8d453b7070c0054d8d
[]
no_license
PaulSeptember/MorraBase-Desktop
f930547083fc8354439d8243c94d846103482975
0aa43b14b86d258ed80c3d96ca15bfcc75bd1f22
refs/heads/master
2022-06-30T23:12:43.334355
2020-05-08T05:51:38
2020-05-08T05:51:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,756
java
package com.september.forms; import com.september.DataBase; import com.september.God; import javax.swing.*; public class EnterPasswordPage { private JPasswordField passwordField1; private JButton enterButton; private JButton cancelButton; public JPanel rootPanel; private JLabel nameLabel; private JLabel errorLabel; private JButton viewButton; private JFrame parent; private boolean masked = true; EnterPasswordPage(JFrame parent){ this.parent = parent; nameLabel.setText("Opening database: " + God.filename); cancelButton.addActionListener(e -> { parent.setContentPane(new StartPage(parent).rootPanel); parent.getContentPane().repaint(); parent.getContentPane().revalidate(); }); passwordField1.setEchoChar('*'); viewButton.addActionListener(e ->{ if (masked){ passwordField1.setEchoChar((char)0); }else{ passwordField1.setEchoChar('*'); } masked = !masked; }); enterButton.addActionListener(e -> { String password = new String(passwordField1.getPassword()); DataBase db = new DataBase(God.tryToOpen); db.password = password; System.out.println(db.tryToOpen()); if (db.isOpened){ God.base = db; //System.out.println(God.base.get(0).login); parent.setContentPane(new DatabasePage(parent).rootPanel); parent.getContentPane().repaint(); parent.getContentPane().revalidate(); }else{ errorLabel.setText("Wrong password..."); } }); } }
[ "Mephistophel.6@yandex.by" ]
Mephistophel.6@yandex.by
399e12b8bd19c19c043c3b5a6d2ba12d3edaa067
392e3ff9e804e8caf65964fd9e244876cdee841b
/acts-core/src/test/java/com/alipay/test/acts/collector/sqllog/SqlLogParseFactoryTest.java
ac26b55105c7d14c109763d21c35c34afbaf8392
[ "Apache-2.0" ]
permissive
elseifer/sofa-acts
4d112e934ccdc6a76c6180e27322507e14c03f24
a40275acfa52e08d354c62b67ad50ea6dea717e2
refs/heads/master
2020-04-25T21:43:08.177836
2019-04-19T06:07:52
2019-04-19T06:07:52
173,088,529
1
0
Apache-2.0
2019-04-19T06:07:53
2019-02-28T10:08:19
Java
UTF-8
Java
false
false
1,961
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.alipay.test.acts.collector.sqllog; import org.testng.Assert; import org.testng.annotations.Test; import java.util.ArrayList; import java.util.List; /** * * @author zhiyuan.lzy * @version $Id: SqlLogParseFactoryTest.java, v 0.1 2016年1月20日 下午5:15:23 zhiyuan.lzy Exp $ */ public class SqlLogParseFactoryTest { /** * Test method for {@link SqlLogParseFactory#genVirtualTable(String, List)}. */ @Test public void testParseSqlParamValue() { List<String> sqlExecLog = new ArrayList<String>(); fillUpdateList(sqlExecLog); List<String> list = SqlLogParseFactory.parseSqlParamValue(sqlExecLog.get(1), sqlExecLog.get(2)); Assert.assertTrue(list.size() == 4); } private void fillUpdateList(List<String> sqlExecLog) { sqlExecLog .add("update test_table set params=?, GMT_MODIFIED=now() where ((param2 = ?) AND (param3 = ?) AND (param4 = ?))"); sqlExecLog.add("[value1={key1=2.51, key2=1.50}, 222222222, test, 111111111111]"); sqlExecLog.add("[java.lang.String, java.lang.String, java.lang.String, java.lang.String]"); } }
[ "ddc.niqgniq@gmail.com" ]
ddc.niqgniq@gmail.com
22fa923433bf85fb16014342ee1f08c87886c8e7
f2a45beabfe3ffbc537de4f9bcd32673b0def17c
/src/Mostsoldzip.java
6fe0722e70c6921832318f9aafe9f29332b0fe0e
[]
no_license
RocJeMaintiendrai/Protable-Retailer-Onlineshop
f5389c4bde9dd5809a94352637efb952eff1f71c
875813605cdc119134e49bea193ae3c440129c20
refs/heads/master
2020-03-29T11:07:48.416591
2018-11-18T05:16:26
2018-11-18T05:16:26
149,837,442
1
0
null
null
null
null
UTF-8
Java
false
false
334
java
import java.io.*; public class Mostsoldzip { String zipcode ; String count; public Mostsoldzip(String zipcode,String count) { this.zipcode = zipcode ; this.count = count; } public String getZipcode(){ return zipcode; } public String getCount () { return count; } }
[ "guopeng@shanshu.ai" ]
guopeng@shanshu.ai
b220778551d3fdf8131fba6eb7dcf55c5d19682a
6b2ba5b8e3aaa29ea4fe5e0e563f788ffa9fb7c3
/SavingsAccount.java
da9abe8a28b54c72db72a6a8e011c2fd532e747a
[]
no_license
RyanPapazoglou/BankDatabases
9c97ca240e771bdc74710db5ae2c46edb96cd468
3c0dd08a472c0c48400bf7a64850793025b1b90a
refs/heads/master
2021-01-01T18:50:29.880550
2017-08-17T17:31:35
2017-08-17T17:31:35
98,444,770
2
1
null
null
null
null
UTF-8
Java
false
false
889
java
public class SavingsAccount extends BankAccount { public double interest; public SavingsAccount(String accountName, double balance, int accountNumber) { super(accountName, balance, accountNumber); } public SavingsAccount(String accountName, double balance, int accountNumber, double interest) { super(accountName, balance, accountNumber); this.interest = interest; } public double calcInterest() { double decimalInterest = this.interest/100; double bankInterest = decimalInterest * this.balance; this.balance += bankInterest; return this.balance; } public double calcInterest(double interest) { double decimalInterest = this.balance * (interest/100); double bankInterest = decimalInterest + this.balance; this.balance = bankInterest; return this.balance; } }
[ "ryanpapazoglou@Ryans-MacBook.fios-router.home" ]
ryanpapazoglou@Ryans-MacBook.fios-router.home
2a16cc76c291e8a2646dd18590dcaa23ee1067e2
ade28a8fc24f0f7c04c0d3781b4d43aaa2620950
/src/src/AbstractGradesClass.java
f55823eba04f258dd1b902b2306539f602c2e971
[]
no_license
sha7erxt/EX04
50670fb5f604cc581ca7eb69f4f6fd5479da467c
7449379199197ffb51afe06d7f6e52ffd49b0cad
refs/heads/master
2021-01-02T21:30:37.621487
2020-02-11T16:30:09
2020-02-11T16:30:09
239,810,005
0
0
null
null
null
null
UTF-8
Java
false
false
132
java
package src; abstract class AbstractGradesClass { public String[] grades; } class GradesClass extends AbstractGradesClass{ }
[ "xtshater@gmail.com" ]
xtshater@gmail.com
82d1c032baf9d345a741e702b2bf4e977a21fbf2
76761898fb179407b83b17fa7c39829a9aabac97
/app/src/main/java/sg/edu/rp/c346/exercise2a/PersonDetails.java
e1939d331336ed4e4201053ee2697758e39d3aff
[]
no_license
Amos757/Exercise2ab
2d68bf9f76a697b2a61764dcf89f71b26f2ec842
aca37d10382bd132fb0528207ed179e319e0eb1f
refs/heads/master
2020-03-23T09:30:49.817629
2018-07-18T06:40:39
2018-07-18T06:40:39
141,392,264
0
0
null
null
null
null
UTF-8
Java
false
false
939
java
package sg.edu.rp.c346.exercise2a; public class PersonDetails { private String name; private String role; private double salary; public PersonDetails(String Name, String Role , double Salary) { name = Name; role = Role; salary = Salary; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getRole() { return role; } public void setRole(String role) { this.role = role; } public double getSalary() { return salary; } public void setSalary(double salary) { this.salary = salary; } //tostring() @Override public String toString() { return "PersonDetails{" + "name='" + name + '\'' + ", role='" + role + '\'' + ", salary=" + salary + '}'; } }
[ "17045722@rp.edu.sg" ]
17045722@rp.edu.sg
8a9929bc23ef91ef71db20121fc4ba304259881f
9d053772b771c32047c3eb9818d59e35ab9cfa99
/src/edu/iu/grid/oim/view/CertificateMenuView.java
2a696aafaba879797293f387c81122b06484f054
[ "Apache-2.0" ]
permissive
opensciencegrid/oim
8451e1a80f367c7be74cbd26f9b5d33739bca96f
f46d835f3c0f6898817d69be91fb054b713ffaf7
refs/heads/master
2021-01-24T06:17:47.675362
2018-05-01T19:38:24
2018-05-01T19:38:24
21,243,262
0
3
null
2016-11-01T19:50:49
2014-06-26T14:21:28
Java
UTF-8
Java
false
false
4,570
java
package edu.iu.grid.oim.view; import java.io.PrintWriter; import org.apache.log4j.Logger; import edu.iu.grid.oim.lib.Authorization; import edu.iu.grid.oim.model.UserContext; public class CertificateMenuView implements IView { static Logger log = Logger.getLogger(CertificateMenuView.class); private String current; private UserContext context; public CertificateMenuView(UserContext context, String current) { this.current = current; this.context = context; } public void render(PrintWriter out) { Authorization auth = context.getAuthorization(); out.write("<div class=\"well\" style=\"padding: 8px 0;\">"); out.write("<ul class=\"nav nav-list\">"); if(current.equals("home")) { out.write("<li class=\"active\">"); out.write("<a href=\"certificate\"><i class=\"icon-white icon-home\"></i> Home</a></li>"); } else { out.write("<li>"); out.write("<a href=\"certificate\"><i class=\"icon-home\"></i> Home</a></li>"); } out.write("<li class=\"nav-header\">User Certificates</li>"); if(current.equals("certificaterequestuser")) { out.write("<li class=\"active\">"); out.write("<a href=\"certificaterequestuser\"><i class=\"icon-white icon-plus\"></i> Request New</a></li>"); } else { out.write("<li>"); out.write("<a href=\"certificaterequestuser\"><i class=\"icon-plus\"></i> Request New</a></li>"); } if(auth.isUser()) { if(current.equals("certificateuser")) { out.write("<li class=\"active\">"); out.write("<a href=\"certificateuser\"><i class=\"icon-white icon-list\"></i> My Requests</a></li>"); } else { out.write("<li>"); out.write("<a href=\"certificateuser\"><i class=\"icon-list\"></i> My Requests</a></li>"); } } if(current.equals("certificatesearchuser")) { out.write("<li class=\"active\">"); out.write("<a href=\"certificatesearchuser\"><i class=\"icon-white icon-search\"></i> Search</a></li>"); } else { out.write("<li>"); out.write("<a href=\"certificatesearchuser\"><i class=\"icon-search\"></i> Search</a></li>"); } out.write("<li class=\"nav-header\">Host Certificates</li>"); if(current.equals("certificaterequesthost")) { out.write("<li class=\"active\">"); out.write("<a href=\"certificaterequesthost\"><i class=\"icon-white icon-plus\"></i> Request New</a></li>"); } else { out.write("<li>"); out.write("<a href=\"certificaterequesthost\"><i class=\"icon-plus\"></i> Request New</a></li>"); } if(auth.isUser()) { if(current.equals("certificatehost")) { out.write("<li class=\"active\">"); out.write("<a href=\"certificatehost\"><i class=\"icon-white icon-list\"></i> My Requests</a></li>"); } else { out.write("<li>"); out.write("<a href=\"certificatehost\"><i class=\"icon-list\"></i> My Requests</a></li>"); } } if(!auth.allows("admin_gridadmin")) { //all non-gridadmin_admin oim user can access read-only gridadmin page if(current.equals("gridadmin")) { out.write("<li class=\"active\">"); out.write("<a href=\"gridadmin\"><i class=\"icon-white icon-flag\"></i> GridAdmins</a></li>"); } else { out.write("<li>"); out.write("<a href=\"gridadmin\"><i class=\"icon-flag\"></i> GridAdmins</a></li>"); } } if(current.equals("certificatesearchhost")) { out.write("<li class=\"active\">"); out.write("<a href=\"certificatesearchhost\"><i class=\"icon-white icon-search\"></i> Search</a></li>"); } else { out.write("<li>"); out.write("<a href=\"certificatesearchhost\"><i class=\"icon-search\"></i> Search</a></li>"); } if(auth.allows("admin_gridadmin") || auth.allows("admin_pki_config")) { out.write("<li class=\"nav-header\">Administration</li>"); if(current.equals("gridadmin")) { out.write("<li class=\"active\">"); out.write("<a href=\"gridadmin\"><i class=\"icon-white icon-flag\"></i> GridAdmins</a></li>"); } else { out.write("<li>"); out.write("<a href=\"gridadmin\"><i class=\"icon-flag\"></i> GridAdmin</a></li>"); } if(current.equals("certificateconfig")) { out.write("<li class=\"active\">"); out.write("<a href=\"certificateconfig\"><i class=\"icon-white icon-lock\"></i> Config</a></li>"); } else { out.write("<li>"); out.write("<a href=\"certificateconfig\"><i class=\"icon-lock\"></i> Config</a></li>"); } } out.write("</ul>"); out.write("</div>"); } }
[ "hayashis@soichi7.ppa.iu.edu" ]
hayashis@soichi7.ppa.iu.edu
cf03baf549999a0f875e16a758c5943dbc9a500b
f2a8d6759a2455c915dc26291de60dba952b6175
/app/src/main/java/talad/co/taladv7/ContractorForgotPasswordActivity.java
682d3e9928c2e770c1ba32df1ca92f6bacc4fe1c
[]
no_license
ugabula/Talad_V7.1
50fe69e39742f1131014e01e57212954b9841cd2
558d320765937ae0c8c13fa5a42f96646b76d4a8
refs/heads/master
2020-03-27T05:19:07.133597
2018-08-16T16:03:15
2018-08-16T16:03:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
435
java
package talad.co.taladv7; import android.app.Activity; import android.os.Bundle; import android.support.annotation.Nullable; /** * Created by cvanderhaar on 2018/07/09. */ public class ContractorForgotPasswordActivity extends Activity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_con_forgot_pass); } }
[ "haar36@gmail.com" ]
haar36@gmail.com
93087c781a2d2a8255b6491f8187a4ac9e6f8bdb
9e47bb9b56c16fed0a3e49a4ff303e4f99a7bcef
/jwt/spring-boot-jwt/src/main/java/com/jaraws/springbootjwt/controller/HelloController.java
644f4e2b89444cd06d575936ea425fd6789fd799
[]
no_license
jaraws/my-projects
920d079f2f6a7cc6c88175a6585effa183c49811
dad2ccf266e06cea9f1c1992530ca72cf89d3134
refs/heads/master
2020-03-29T15:21:18.001480
2018-10-10T16:04:54
2018-10-10T16:04:54
150,058,869
0
0
null
null
null
null
UTF-8
Java
false
false
381
java
package com.jaraws.springbootjwt.controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/rest/hello") public class HelloController{ @GetMapping public String sayHello() { return "Hello World "; } }
[ "contact.swaraj@gmail.com" ]
contact.swaraj@gmail.com
6afca2257f2ed924a283a38d5aba6ea8ca264cd5
17bef970727b974445de35c766fe811d3939c45d
/CanShows/src/test/java/utilities/AbstractTest.java
cea0cd92192c28c4189c40ea65200285e77a8419
[]
no_license
Blezerd/CanShows
d7e2d0fa5dc33e4ea72bd782e1ecd7bf47b14c7d
93abd80a3b24ca045e283a05f185d6b65478aa30
refs/heads/master
2021-01-13T13:59:13.916366
2016-11-26T17:15:52
2016-11-26T17:15:52
72,922,157
0
0
null
null
null
null
UTF-8
Java
false
false
1,701
java
/* AbstractTest.java * * Copyright (C) 2015 Universidad de Sevilla * * The use of this project is hereby constrained to the conditions of the * TDG Licence, a copy of which you may download from * http://www.tdg-seville.info/License.html * */ package utilities; import org.junit.After; import org.junit.Before; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.TestingAuthenticationToken; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails; import security.LoginService; import utilities.PopulateDatabase; public abstract class AbstractTest { // Supporting services -------------------------------- @Autowired private LoginService loginService; // Set up and tear down ------------------------------- @Before public void setUp() { PopulateDatabase.main(null); } @After public void tearDown() { } // Supporting methods --------------------------------- public void authenticate(String username) { UserDetails userDetails; TestingAuthenticationToken authenticationToken; SecurityContext context; if (username == null) authenticationToken = null; else { userDetails = loginService.loadUserByUsername(username); authenticationToken = new TestingAuthenticationToken(userDetails, null); } context = SecurityContextHolder.getContext(); context.setAuthentication(authenticationToken); } public void unauthenticate() { authenticate(null); } }
[ "blezerd@blezerd-desktop" ]
blezerd@blezerd-desktop
0161eb3a061e5ff4d39e9f70e61b10f005bfed66
738e8f6c7e8c0e667f0c7c0e199ebda7cdc58ef3
/src/main/java/com/algorithms/JZoffer/Question19.java
822c491c8735a96d9ed806e317e108514663e0d5
[]
no_license
spx1998/javareview
b1d145e9f6d79b52114ff7f829c2f71f7ac327c8
d00953c0d907788d21cee2026daf8f331883de34
refs/heads/master
2023-07-20T19:23:12.884237
2021-09-01T10:11:16
2021-09-01T10:11:16
198,209,915
1
0
null
null
null
null
UTF-8
Java
false
false
1,625
java
package com.algorithms.JZoffer; import java.util.ArrayList; public class Question19 { public static void main(String[] args) { Question19 question19 = new Question19(); // int[][] matrix = {{1,2,3,4},{5,6,7,8},{9,10,11,12}}; // int[][] matrix = {{1,2,3},{4,5,6},{7,8,9}}; int[][] matrix = {{1,2},{3,4},{5,6},{7,8}}; // int[][] matrix = {{1,2,3,4}}; System.out.println(question19.printMatrix(matrix)); } public ArrayList<Integer> printMatrix(int[][] matrix) { int y = matrix.length;//行数 int x = matrix[0].length;//列数 ArrayList<Integer> arrayList = new ArrayList<>(); int times = x>y?y:x; times = times%2==0?times/2:times/2+1; while (times!=0){ for(int i=matrix[0].length-x;i<x-1;i++){ arrayList.add(matrix[matrix.length-y][i]); } for(int i = matrix.length-y;i<y-1;i++){ arrayList.add(matrix[i][x-1]); } for (int i = x-1;i>matrix[0].length-x;i--){ arrayList.add(matrix[y-1][i]); if(y-1==matrix.length-y)break; } for (int i = y-1;i>matrix.length-y;i--){ arrayList.add(matrix[i][matrix[0].length-x]); if(x-1==matrix[0].length-x){ break; } } x--; y--; times--; } if(matrix[0].length==matrix.length&&matrix.length%2==1){ arrayList.add(matrix[matrix.length/2][matrix.length/2]); } return arrayList; } }
[ "457799096@qq.com" ]
457799096@qq.com
e2b33c1d47ab80445a5fd68d71807bea4a35eed6
c4bb57f2c6b495bfbc6e942ec3979b8e88c876ab
/studio-5-bennett-shaw-1/src/studio5/HexTx.java
75a040242bac007df326f529fe398fa959afd263
[]
no_license
davidshaw2018/CSE132_ArduinoC
d21faaa8e40469aab95cdaeab98961d20cbde963
2cc7c19dbff2937a94bdb2fe07c0daca4d25b390
refs/heads/master
2020-07-10T20:40:49.641046
2019-08-26T01:23:21
2019-08-26T01:23:21
204,365,963
1
0
null
null
null
null
UTF-8
Java
false
false
1,416
java
package studio5; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; //import com.sun.java_cup.internal.runtime.Scanner; import jssc.SerialPortException; public class HexTx { static char firstLetter; public static void main(String[] args) { // TODO: Fix this: // a) Uncomment to create a SerialComm object // b) Update the "the port" to refer to the serial port you're using // (The port listed in the Arduino IDE Tools>Port menu. // c) Deal with the unresolved issue try { SerialComm port = new SerialComm("COM4"); } catch (SerialPortException e) { // TODO Auto-generated catch block e.printStackTrace(); } BufferedReader sys = new BufferedReader(new InputStreamReader(System.in)); try { System.out.print((sys).read()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { int a; a = sys.read(); if (a > 47 && a < 58) { a = a-48; } else if (a > 96 && a < 103) a = a-87; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // InputStream s = System.in; // firstLetter = String.valueOf((System.in.charAt(0)); // TODO: Complete section 6 of the Studio (gather sanitized user input // and send it to the Arduino) }
[ "davidshaw@Davids-MacBook-Pro-217.local" ]
davidshaw@Davids-MacBook-Pro-217.local
bd784e001dbacc1b653b95f407084a5460ffd934
f86f8f8a40f4b1cdedf68c1a9979cff3737ec3cc
/pinyougou-service/pinyougou-sellergoods-service/src/main/java/com/pinyougou/sellergoods/service/impl/specificationServiceImpl.java
59f62a2848d2056f376a6e784f14db675453f167
[]
no_license
usernameyc/pinyougou
64e03f46dbcadc246af51986848bf667e247d33e
cd7b1c14e7464195349df37f04bca415bc8a0fcd
refs/heads/master
2020-05-02T13:07:19.518543
2019-03-27T10:58:52
2019-03-27T10:59:37
177,975,980
4
0
null
null
null
null
UTF-8
Java
false
false
3,326
java
package com.pinyougou.sellergoods.service.impl; import com.alibaba.dubbo.config.annotation.Service; import com.github.pagehelper.ISelect; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.pinyougou.common.pojo.PageResult; import com.pinyougou.mapper.SpecificationMapper; import com.pinyougou.mapper.SpecificationOptionMapper; import com.pinyougou.pojo.Specification; import com.pinyougou.pojo.SpecificationOption; import com.pinyougou.service.SpecificationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import java.io.Serializable; import java.util.List; import java.util.Map; @Service(interfaceName = "com.pinyougou.service.SpecificationService") @Transactional public class specificationServiceImpl implements SpecificationService { @Autowired private SpecificationMapper specificationMapper; @Override public PageResult findByPage(Specification specification, int page, int rows) { try { PageInfo<Specification> pageInfo = PageHelper.startPage(page, rows).doSelectPageInfo(new ISelect() { @Override public void doSelect() { specificationMapper.findAll(specification); } }); return new PageResult(pageInfo.getTotal(), pageInfo.getList()); } catch (Exception e) { throw new RuntimeException(e); } } @Autowired private SpecificationOptionMapper specificationOptionMapper; @Override public void save(Specification specification) { try{ specificationMapper.insertSelective(specification); specificationOptionMapper.save(specification); }catch (Exception e){ throw new RuntimeException(e); } } @Override public List<SpecificationOption> findSpecOption(Long id) { try{ SpecificationOption op = new SpecificationOption(); op.setSpecId(id); return specificationOptionMapper.select(op); }catch (Exception e){ throw new RuntimeException(e); } } @Override public void update(Specification specification) { try{ specificationMapper.updateByPrimaryKeySelective(specification); SpecificationOption so = new SpecificationOption(); so.setSpecId(specification.getId()); specificationOptionMapper.delete(so); specificationOptionMapper.save(specification); }catch (Exception e){ throw new RuntimeException(e); } } @Override public void deleteAll(Serializable[] ids) { try{ for (Serializable id : ids ){ SpecificationOption so = new SpecificationOption(); so.setSpecId((Long)id); specificationOptionMapper.delete(so); specificationMapper.deleteByPrimaryKey(id); } }catch (Exception e){ throw new RuntimeException(e); } } @Override public List<Map<String, Object>> findAllByIdAndName() { try { return specificationMapper.findAllByIdAndName(); } catch (Exception e) { throw new RuntimeException(e); } } }
[ "143543636@qq.com" ]
143543636@qq.com
d105f4494809bd0f87dc543b34664f004f48a63c
b9aa658cf9c6c7c85f90e4eb7d66cfb62033b1c4
/Aula 003 Logica de Programacao conceito de algoritmo algoritmos estruturados/Cadastro/src/cadastro/N1.java
08ee8f7ac0b55472935cd84ab8a57ed26986052d
[]
no_license
azlinwei/Aula-java
326b9a139166c67ecf34c6cdc6fc0201dd942007
af8070fb58f8aebda6927989c5b79e058772b3a0
refs/heads/main
2023-09-06T01:16:01.572957
2021-11-09T17:13:44
2021-11-09T17:13:44
391,208,353
3
15
null
null
null
null
UTF-8
Java
false
false
324
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 cadastro; /** * * @author azlin */ public class N1 { public String prod ="Eletronicos"; public String marc = "Weg"; }
[ "azlinwei@gmail.com" ]
azlinwei@gmail.com
dd2b6747e2d3b1738281e64a89339478c4be2200
a17cab9510b3c83e6c9cd1e2255a116c0a15afd4
/clean-code/ReactiveProgrammingExamples/src/main/java/Model/Players.java
f53fdf5d376850a7ad2a38ce8015c871a0704411
[]
no_license
aegivar/AndresGiraldo
8ec8d04057164f65180adb2981e5b21cafbf908a
417adbb0a6b3fed7447f660b501a9c3088ae2df3
refs/heads/master
2023-03-08T04:10:45.855681
2021-02-17T20:03:33
2021-02-17T20:03:33
329,083,848
0
0
null
null
null
null
UTF-8
Java
false
false
1,647
java
package Model; import observer.pattern.PlayerObserver; import java.util.LinkedList; import java.util.List; import java.util.Observable; public class Players extends Observable { private String name; private int pointsPerGame; private Double triplePercentage; private List<PlayerObserver> observers; public Players(String name, Integer pointsPerGame) { this.name = name; this.observers = new LinkedList<PlayerObserver>(); setPointsPerGame(pointsPerGame); setChanged(); //notifyObservers(); } public Players(String name, Double triplePercentage) { this.name = name; this.triplePercentage = triplePercentage; //notifyObservers(); } public Double getTriplePercentage() { return triplePercentage; } public void setTriplePercentage(Double triplePercentage) { this.triplePercentage = triplePercentage; } public int getPointsPerGame() { return pointsPerGame; } public void setPointsPerGame(int pointsPerGame) { this.pointsPerGame = pointsPerGame; notifyObservers(); } public String getName() { return name; } public void setName(String name) { this.name = name; } /*public void registerObserver(PlayerObserver...observers){ for(PlayerObserver observer : observers){ this.observers.add(observer); } } public void notifyObservers(){ observers.stream().forEach(observer -> observer.update()); } public void remove(PlayerObserver observer){ observers.remove(observer); }*/ }
[ "giraldo.vargas.andres@gmail.com" ]
giraldo.vargas.andres@gmail.com
c2c979294cafc98e1d0d26451a8f04288d2c5927
4df3305150da9fdd918a7c0e79b8a932daaef162
/akit/src/main/java/wenjh/akit/common/receiver/AbsMessageReceiver.java
cdfeb92e2271bed729941d5ad622b43313cef921
[]
no_license
RealJianhua/akit
c70457454c00913c5fee3a28a8e1484192b8fb31
f7f4b7162a56b12d8085dc3f9489e556c13b1d10
refs/heads/master
2021-01-12T07:46:39.195513
2016-12-27T08:05:45
2016-12-27T08:05:45
77,011,493
0
0
null
null
null
null
UTF-8
Java
false
false
1,534
java
package wenjh.akit.common.receiver; import android.os.Bundle; import java.util.ArrayList; import java.util.List; public abstract class AbsMessageReceiver implements Comparable<AbsMessageReceiver> { private List<String> actions = new ArrayList<String>(4); private int priority; public AbsMessageReceiver(String... actions) { for (String action : actions) { this.actions.add(action); } } /** * * @param priority 权重。值越大将越早收到消息 * @param actions */ public AbsMessageReceiver(int priority, String... actions) { for (String action : actions) { this.actions.add(action); } this.priority = priority; } /** * 设置权重。值越大将越早收到消息 * @param priority */ public void setPriority(int priority) { this.priority = priority; } public int getPriority() { return priority; } public void addAction(String action) { this.actions.add(action); } public List<String> getActions() { return actions; } public abstract boolean onReceive(Bundle bundle, String action); /** * 相同权值,按照注册顺序排序 */ @Override public int compareTo(AbsMessageReceiver another) { if (another == null) { throw new NullPointerException("the message receiver shouldn't be null!"); } if(equals(another)) { return 0; } else { return this.priority > another.priority ? -1 : 1; } } @Override public String toString() { return "AbsMessageReceiver [actions=" + actions + ", priority=" + priority + "]"; } }
[ "wen.jianhua@immomo.com" ]
wen.jianhua@immomo.com
80df2980ee70d4c996ac0eea0ca4df9b75b5e105
e4fc7ab8b3000f34bd501ab855d5b8ae3baee48f
/src/main/java/nurbol/seydazimov/graph/TripsWithMaximumThreeStoppageCounter.java
6c8bebd4692091fc2424f0885f6716e5c7248c58
[]
no_license
seydaz1mov/trains-and-towns
0bc7d9a9eb85a7a000114bc358e3506d697f891d
bbc4f5994a3f611816ca559671ec2cd4fa2f2529
refs/heads/master
2023-01-29T04:57:25.360232
2019-12-02T12:53:47
2019-12-02T12:53:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,614
java
package nurbol.seydazimov.graph; import nurbol.seydazimov.graph.components.Edge; import nurbol.seydazimov.graph.components.Vertex; import java.util.Arrays; public class TripsWithMaximumThreeStoppageCounter { final Graph graph; int[][] count; public TripsWithMaximumThreeStoppageCounter(Graph graph) { this.graph = graph; this.count = new int[5][4]; } public void compute(final char appointedTown) { fillWithMinusOne(count); count[graph.getTownNumber(appointedTown)][0] = 1; for (int stoppage = 1; stoppage <= 3; stoppage++) { for (int town = 0; town < 5; ++town) { Vertex vertex = graph.vertices[town]; for (Edge incomingEdge : vertex.incomingEdges) { int fromTown = graph.getTownNumber(incomingEdge.to.townName); if (count[fromTown][stoppage - 1] != -1) { if (count[town][stoppage] == -1) count[town][stoppage] = 0; count[town][stoppage] += count[fromTown][stoppage - 1]; } } } } int total = 0; for (int stoppage = 1; stoppage <= 3; stoppage++) { if (count[graph.getTownNumber(appointedTown)][stoppage] != -1) total += count[graph.getTownNumber(appointedTown)][stoppage]; } System.out.println("Output #6: " + total); } private void fillWithMinusOne(int[][] count) { for (int i = 0; i < count.length; ++i) Arrays.fill(count[i], -1); } }
[ "seydazimov.nurbol@gmail.com" ]
seydazimov.nurbol@gmail.com
affe5e9df5808ea55441b8ada12529313c66a7eb
f715b1253b42bc618670f0a84ef6d116583d9eaa
/badugi-game-logic/src/main/java/com/badugi/game/logic/model/vo/api/shop/PresentTicketVo.java
4ed5215a59d5ec8da7e3afda060eb00a7c9a181d
[ "MIT" ]
permissive
cietwwl/BadugiPokerServer
acf282544a2811be436f27abb52a1ace22712051
0b494f80d846fcb2e9db26721bd09add7d674783
refs/heads/master
2020-03-17T18:29:08.353095
2016-01-18T02:46:46
2016-01-18T02:46:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,396
java
package com.badugi.game.logic.model.vo.api.shop; import java.io.Serializable; public class PresentTicketVo implements Serializable{ /** * */ private static final long serialVersionUID = 1L; private Integer tid;//门票/物品编号 private String tn;//门票/物品名称 private Integer myticketid;//我的门票ID private String tmn;//门票/物品图片(跟之前门票/物品路径一致) private Integer tc;//门票总张数 private Integer tam;//门票价值 private String tst;//有效开始时间 private String tet;//有效结束时间 public Integer getTid() { return tid; } public void setTid(Integer tid) { this.tid = tid; } public String getTn() { return tn; } public void setTn(String tn) { this.tn = tn; } public String getTmn() { return tmn; } public void setTmn(String tmn) { this.tmn = tmn; } public Integer getTc() { return tc; } public void setTc(Integer tc) { this.tc = tc; } public String getTst() { return tst; } public void setTst(String tst) { this.tst = tst; } public String getTet() { return tet; } public void setTet(String tet) { this.tet = tet; } public Integer getTam() { return tam; } public void setTam(Integer tam) { this.tam = tam; } public Integer getMyticketid() { return myticketid; } public void setMyticketid(Integer myticketid) { this.myticketid = myticketid; } }
[ "wtuickqmq@163.com" ]
wtuickqmq@163.com
ad3ae4083de73fac5d8cfe1346cb4a1d405c9d08
83c0eb9fa1fa9fcd9f4ec9ddb14ce7d0d14ff4dc
/src/test/java/ocelot/VMEarlyTests.java
a804a0c1599f5eb826c86f47a5193919511d7a6b
[ "Apache-2.0" ]
permissive
daithijmcg/ocelotvm
4651700e8343ce660d3b2cb91dd736387c85d20d
89a4933d996df83ba4d3631118c797f0ccf34fd1
refs/heads/master
2020-12-02T08:07:24.512764
2017-07-06T13:12:26
2017-07-06T13:12:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,208
java
package ocelot; import static org.junit.Assert.*; import org.junit.BeforeClass; import org.junit.Test; /** * * @author boxcat */ public class VMEarlyTests { private static InterpMain vm = new InterpMain(); @BeforeClass public static void init() { vm.init(); } /* @Test public void TestDoublesBasic() { byte[] buffy = {}; // {DCONST_1.B(), DCONST_1.B(), DADD.B()}; JVMValue res = vm.execMethod(buffy); assertEquals(JVMPrimVsRefType.DOUBLE, res.getType()); assertEquals(2.0, (Double) res.getValue(), 0.0001); } @Test public void TestIntIfEqPrim() { Main vm = new Main(); byte[] buffy = {OP_ICONST_1, OP_ICONST_1, OP_IADD, OP_ICONST_2, OP_IF_ICMPEQ, 0, 11, OP_ICONST_4, OP_GOTO, 0, 12, OP_ICONST_3, 0}; vm.loadBytecodes(buffy); vm.doSingleOpCode(); vm.doSingleOpCode(); vm.doSingleOpCode(); JVMValue res = vm.topOfStack(); assertEquals(JVMPrimVsRefType.INT, res.getType()); assertEquals(2, ((Integer) res.getValue()).intValue()); vm.interpret(); res = vm.topOfStack(); assertEquals(JVMPrimVsRefType.INT, res.getType()); assertEquals(3, ((Integer) res.getValue()).intValue()); byte[] buffy2 = {OP_ICONST_1, OP_ICONST_1, OP_IADD, OP_ICONST_3, OP_IF_ICMPEQ, 0, 11, OP_ICONST_4, OP_GOTO, 0, 12, OP_ICONST_3, 0}; vm.loadBytecodes(buffy2); vm.doSingleOpCode(); vm.doSingleOpCode(); vm.doSingleOpCode(); res = vm.topOfStack(); assertEquals(JVMPrimVsRefType.INT, res.getType()); assertEquals(2, ((Integer) res.getValue()).intValue()); vm.interpret(); res = vm.topOfStack(); assertEquals(JVMPrimVsRefType.INT, res.getType()); assertEquals(4, ((Integer) res.getValue()).intValue()); } @Test public void TestIntIfNePrim() { Main vm = new Main(); byte[] buffy = {OP_ICONST_1, OP_ICONST_1, OP_IADD, OP_ICONST_2, OP_IF_ICMPNE, 0, 11, OP_ICONST_4, OP_GOTO, 0, 12, OP_ICONST_3, 0}; vm.loadBytecodes(buffy); vm.doSingleOpCode(); vm.doSingleOpCode(); vm.doSingleOpCode(); JVMValue res = vm.topOfStack(); assertEquals(JVMPrimVsRefType.INT, res.getType()); assertEquals(2, ((Integer) res.getValue()).intValue()); vm.interpret(); res = vm.topOfStack(); assertEquals(JVMPrimVsRefType.INT, res.getType()); assertEquals(4, ((Integer) res.getValue()).intValue()); byte[] buffy2 = {OP_ICONST_1, OP_ICONST_1, OP_IADD, OP_ICONST_3, OP_IF_ICMPNE, 0, 11, OP_ICONST_4, OP_GOTO, 0, 12, OP_ICONST_3, 0}; vm.loadBytecodes(buffy2); vm.doSingleOpCode(); vm.doSingleOpCode(); vm.doSingleOpCode(); res = vm.topOfStack(); assertEquals(JVMPrimVsRefType.INT, res.getType()); assertEquals(2, ((Integer) res.getValue()).intValue()); vm.interpret(); res = vm.topOfStack(); assertEquals(JVMPrimVsRefType.INT, res.getType()); assertEquals(3, ((Integer) res.getValue()).intValue()); } */ // FIXME Add tests for IF_ICMPLT }
[ "benjamin.john.evans@gmail.com" ]
benjamin.john.evans@gmail.com
6430848d57863e073fb1499c3b737579b07fbcf9
42c9c61062728d4cb9ecc10163a9653614a3f439
/src/Solution35.java
9c10ede6e41f894d59505a2da97a2f8fb9a9b846
[]
no_license
VittorioYan/LeetCode
33aac1407c5ac30cb2687e2bf846c2f8ceb76ff2
6111cfd8e2af9c6144a59d44574fd0c71d855f98
refs/heads/master
2020-05-14T18:25:34.911549
2019-06-20T02:07:39
2019-06-20T02:07:39
179,687,619
0
0
null
null
null
null
UTF-8
Java
false
false
199
java
class Solution35{ public int searchInsert(int[] nums, int target) { for(int i=0;i<nums.length;i++){ if(target<=nums[i])return i; } return nums.length; } }
[ "vittorioyan7@gmail.com" ]
vittorioyan7@gmail.com
e9749692b085c68fa9c23056957395853c2868ba
55d16fed73d1e744fda0554e231c20a395d409a2
/wanxinp2p-api/src/main/java/com/wanxin/api/depository/DepositoryAgentAPI.java
3732d39b8ad4d6e790fb88c62a8dea97c0240857
[ "Apache-2.0" ]
permissive
LionDevelop/wanxin-p2p
3032f0f81e9c1212eb3d485cb97914a91aad7d8b
c95671d7bdb4963165e4db8773578ab85832dafd
refs/heads/master
2023-04-01T21:46:24.527977
2021-04-01T08:55:35
2021-04-01T08:55:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,275
java
package com.wanxin.api.depository; import com.wanxin.api.consumer.model.ConsumerRequest; import com.wanxin.api.consumer.model.RechargeRequest; import com.wanxin.api.consumer.model.WithdrawRequest; import com.wanxin.api.depository.model.GatewayRequest; import com.wanxin.api.depository.model.LoanRequest; import com.wanxin.api.depository.model.UserAutoPreTransactionRequest; import com.wanxin.api.repayment.model.RepaymentRequest; import com.wanxin.api.transaction.model.ModifyProjectStatusDTO; import com.wanxin.api.transaction.model.ProjectDTO; import com.wanxin.common.domain.RestResponse; /** * <p> * 银行存管系统代理服务API * </p> * * @author yuelimin * @version 1.0.0 * @since 1.8 */ public interface DepositoryAgentAPI { /** * 还款确认 * * @param repaymentRequest 还款信息 * @return */ RestResponse<String> confirmRepayment(RepaymentRequest repaymentRequest); /** * 修改标的状态 * * @param modifyProjectStatusDTO * @return */ RestResponse<String> modifyProjectStatus(ModifyProjectStatusDTO modifyProjectStatusDTO); /** * 审核标的满标放款 * * @param loanRequest * @return */ RestResponse<String> confirmLoan(LoanRequest loanRequest); /** * 预授权处理 * * @param userAutoPreTransactionRequest 预授权处理信息 * @return */ RestResponse<String> userAutoPreTransaction(UserAutoPreTransactionRequest userAutoPreTransactionRequest); /** * 保存标的信息 * * @param projectDTO 标的信息 * @return 返回提示信息 */ RestResponse<String> createProject(ProjectDTO projectDTO); /** * 生成用户提现数据 * * @param withdrawRequest * @return */ RestResponse<GatewayRequest> createWithdrawRecord(WithdrawRequest withdrawRequest); /** * 生成用户充值数据 * * @param rechargeRequest * @return */ RestResponse<GatewayRequest> createRechargeRecord(RechargeRequest rechargeRequest); /** * 开通存管账户 * * @param consumerRequest 开户信息 * @return */ RestResponse<GatewayRequest> createConsumer(ConsumerRequest consumerRequest); }
[ "yueliminvc@outlook.com" ]
yueliminvc@outlook.com
4c9f876c662cf2a204fa70ecb3d46affc6ecc1bc
62c517c96044f13284cb2d2c06cf853654abece4
/server/src/test/java/com/epsilonschool/controller/SubjectControllerTests.java
698e0d053e28eb7654a18d5fcf51797d17a2a9ce
[]
no_license
Ramneli/epsilon-school
5ef73773ee0ddc12945a57672c1f74b17b7c2f11
c752a6c99ea061e2fbcd4727b03d3659c319dc99
refs/heads/master
2021-03-23T17:14:12.169240
2018-06-30T20:11:33
2018-06-30T20:11:33
120,462,713
0
1
null
null
null
null
UTF-8
Java
false
false
1,290
java
package com.epsilonschool.controller; import com.epsilonschool.dao.repository.SubjectRepository; import com.epsilonschool.dao.service.SubjectService; import com.epsilonschool.entity.Subject; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; public class SubjectControllerTests { SubjectRepository subjectRepository; SubjectService subjectService; SubjectController subjectController; @Before public void setUp() { subjectRepository = Mockito.mock(SubjectRepository.class); subjectService = new SubjectService(subjectRepository); subjectController = new SubjectController(subjectService); } @Test public void testSubjectControllerGetOneSubject() { subjectController.getSubject("896"); Mockito.verify(subjectRepository, Mockito.times(1)).findById("896"); } @Test public void testSubjectControllerGetAllSubjects() { subjectController.getSubjects(); Mockito.verify(subjectRepository, Mockito.times(1)).findAll(); } @Test public void testSubjectControllerAddNewSubject() { Subject subject = new Subject(); subjectController.addSubject(subject); Mockito.verify(subjectRepository, Mockito.times(1)).save(subject); } }
[ "koit456@hot.ee" ]
koit456@hot.ee
c41f00cb861dcd10463ae016d2a6e423aef40513
eac51cf549169e2096009248f4242e0b6b6ea410
/homeworks/3.Day/homework - 3.1/src/inheritance/EmployeeManager.java
dc6085699c3e89c0df8f6f03e63f510c1d129959
[ "MIT" ]
permissive
rzayevsahil/JavaCamp
5ca6df892333112f0a753bcdcd6393b8e1bd930f
35fabb95c9d8b04d690d0e8020bb4e03cf9c2088
refs/heads/master
2023-05-10T14:20:50.342322
2021-06-02T21:49:31
2021-06-02T21:49:31
363,203,848
25
2
MIT
2021-05-07T01:56:42
2021-04-30T16:49:10
Java
ISO-8859-9
Java
false
false
161
java
package inheritance; public class EmployeeManager extends PersonManager { public void BestEmployee() { System.out.println("Ayın elemanı getirildi"); } }
[ "sahilrzayev2000@gmail.com" ]
sahilrzayev2000@gmail.com
ed6ba785bc59986d28d221a33609d062e8a4d9c6
2b69d7124ce03cb40c3ee284aa0d3ce0d1814575
/p2p-member-service/customer-api/src/main/java/com/zb/p2p/customer/api/entity/DemoRes.java
387bf9970956f8d28ad82c68dd8dfc5f0ef024e0
[]
no_license
hhhcommon/fincore_p2p
6bb7a4c44ebd8ff12a4c1f7ca2cf5cc182b55b44
550e937c1f7d1c6642bda948cd2f3cc9feb7d3eb
refs/heads/master
2021-10-24T12:12:22.322007
2019-03-26T02:17:01
2019-03-26T02:17:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
67
java
package com.zb.p2p.customer.api.entity; public class DemoRes { }
[ "kaiyun@zillionfortune.com" ]
kaiyun@zillionfortune.com
f56da65ad8fef882713e1d2c06c526fe920ed448
ca9996169777dffbd6398c59bcb7d13c89882c49
/izuanqian-iLive/src/main/java/com/izuanqian/FocusService.java
11541742d75d4c3f51db7e1124f82dee5d80f19c
[]
no_license
1727Sz/izuanqian
84e8c43aa4d8a94d8d57fb8c36f44f85313810b3
7ea5f4006f597636b2f59dd3a4bf296990abe926
refs/heads/master
2021-01-20T12:12:20.796398
2017-03-08T13:04:30
2017-03-08T13:04:30
82,896,803
0
0
null
null
null
null
UTF-8
Java
false
false
1,158
java
package com.izuanqian; import com.google.common.collect.Lists; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.List; /** * Created by sanlion on 2017/2/22. */ @Service public class FocusService { @Autowired private FocusMapper focusMapper; /** * 关键词搜索关注点 * * @param keyword * @return */ public List<Focus> search(String keyword) { final List<DboFocus> dboFocuses = focusMapper.queryFocusesBySearch(keyword); List<Focus> focuses = Lists.newArrayList(); if (!CollectionUtils.isEmpty(dboFocuses)) { dboFocuses.forEach(dboFocus -> focuses.add( Focus.builder() .title(dboFocus.getTitle()) .address(dboFocus.getAddress()) .category(dboFocus.getCategory() ).build())); } return focuses; } }
[ "sanlion@vip.qq.com" ]
sanlion@vip.qq.com
778572ee1dcc222292c551f4e5230fa5fc6988a4
5d00b27e4022698c2dc56ebbc63263f3c44eea83
/gen/com/ah/xml/be/config/SsidRoamingCache.java
03884f93760e3ede660ce300ad1dbe47e63aa559
[]
no_license
Aliing/WindManager
ac5b8927124f992e5736e34b1b5ebb4df566770a
f66959dcaecd74696ae8bc764371c9a2aa421f42
refs/heads/master
2020-12-27T23:57:43.988113
2014-07-28T17:58:46
2014-07-28T17:58:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,884
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.6 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2014.07.01 at 11:29:17 AM CST // package com.ah.xml.be.config; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for ssid-roaming-cache complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="ssid-roaming-cache"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="AH-DELTA-ASSISTANT" type="{http://www.aerohive.com/configuration/general}ah-only-act" minOccurs="0"/> * &lt;element name="update-interval" type="{http://www.aerohive.com/configuration/ssid}ssid-cache-update-interval" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ssid-roaming-cache", namespace = "http://www.aerohive.com/configuration/ssid", propOrder = { "ahdeltaassistant", "updateInterval" }) public class SsidRoamingCache { @XmlElement(name = "AH-DELTA-ASSISTANT") protected AhOnlyAct ahdeltaassistant; @XmlElement(name = "update-interval") protected SsidCacheUpdateInterval updateInterval; /** * Gets the value of the ahdeltaassistant property. * * @return * possible object is * {@link AhOnlyAct } * */ public AhOnlyAct getAHDELTAASSISTANT() { return ahdeltaassistant; } /** * Sets the value of the ahdeltaassistant property. * * @param value * allowed object is * {@link AhOnlyAct } * */ public void setAHDELTAASSISTANT(AhOnlyAct value) { this.ahdeltaassistant = value; } /** * Gets the value of the updateInterval property. * * @return * possible object is * {@link SsidCacheUpdateInterval } * */ public SsidCacheUpdateInterval getUpdateInterval() { return updateInterval; } /** * Sets the value of the updateInterval property. * * @param value * allowed object is * {@link SsidCacheUpdateInterval } * */ public void setUpdateInterval(SsidCacheUpdateInterval value) { this.updateInterval = value; } }
[ "zjie@aerohive.com" ]
zjie@aerohive.com
abecfb00c4bb55b061a638457a6cc868eebd9840
d69e90ec51b69a92b5c73bb0f6317afa6f4880d5
/lovesecurity/love-security-core/src/mian/java/org/nix/lovedomain/security/core/social/qq/config/QQAutoConfig.java
523927d549c2160ce1f9335f9f71717c065340b4
[]
no_license
zhangpeibisha/lovebs
283622412ad0f42428cca7250acc0b28b915bace
c455e389c74259c2c6d22e6ff88f7eaf7e355c99
refs/heads/master
2022-06-23T12:21:24.955802
2019-04-30T15:16:30
2019-04-30T15:16:30
162,876,437
5
0
null
2022-06-21T01:04:29
2018-12-23T09:02:13
Java
UTF-8
Java
false
false
1,281
java
package org.nix.lovedomain.security.core.social.qq.config; import org.nix.lovedomain.security.core.properties.QQProperties; import org.nix.lovedomain.security.core.properties.SecurityProperties; import org.nix.lovedomain.security.core.social.qq.connet.QQConnectionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.social.SocialAutoConfigurerAdapter; import org.springframework.context.annotation.Configuration; import org.springframework.social.connect.ConnectionFactory; /** * @author zhangpei * @version 1.0 * @description QQ自动配置,当用户配置了 love.security.social.qq.app-id参数时该配置生效 * @date 2019/1/31 */ @Configuration @ConditionalOnProperty(prefix = "love.security.social.qq", name = "appId") public class QQAutoConfig extends SocialAutoConfigurerAdapter { @Autowired private SecurityProperties securityProperties; @Override protected ConnectionFactory<?> createConnectionFactory() { QQProperties qqConfig = securityProperties.getSocial().getQq(); return new QQConnectionFactory(qqConfig.getProviderId(), qqConfig.getAppId(), qqConfig.getAppSecret()); } }
[ "zhangpe0312@qq.com" ]
zhangpe0312@qq.com
b129274ceff275b5fdc6dfdc1963311f598fbe0a
78488964c7cc270c95ebabef6e1a039d61a1421c
/src/sample/Model/RequestCode.java
7b407f5a8587fb0ad76d4eaa410c3a05f17dac0e
[]
no_license
MXslade/Travel-Agency
6bef1b9fd4b8098158e3fe136573cb7544f4aa3d
a41e35374e2366e09f0c82a25bec1d1047cca882
refs/heads/master
2020-09-02T20:54:27.173524
2019-12-10T03:48:18
2019-12-10T03:48:18
219,302,119
0
0
null
null
null
null
UTF-8
Java
false
false
290
java
package sample.Model; public enum RequestCode { SHOW_ONE_WAY_FLIGHT, SHOW_BACK_AND_FORTH_FLIGHT, SHOW_MULTIPLE_FLIGHT, SHOW_ALL_CITIES, EXIT, LOGIN, REGISTRATION, ADD_CITY, ADD_FLIGHT_FULL, GET_FLIGHT_RAW, BUY_TICKET, SHOW_BOUGHT_FLIGHTS, }
[ "turar0408@gmail.com" ]
turar0408@gmail.com
0da9f838de2d8a337ed64594e8b2495814473a60
14651cc4608d2889926f2c9d5aa731b540dc9c94
/well-xcx-back/src/main/java/com/zxk175/xcx/common/consts/Const.java
671bb4d544488025d2555bd8a801d4ece5d55634
[]
no_license
zxk175/xcx-demo-back
ffb78e0d880dfe59a10c27d3caabd9b017066c8f
e0f622173fac8ce09b02a079c9d0c361ef1f60e0
refs/heads/master
2021-04-01T11:32:35.857378
2020-03-24T08:14:30
2020-03-24T08:14:30
248,186,197
0
0
null
null
null
null
UTF-8
Java
false
false
2,893
java
package com.zxk175.xcx.common.consts; import com.alibaba.fastjson.serializer.SerializeConfig; import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; /** * @author zxk175 * @since 2020-03-18 10:16 */ public class Const { public static final String UTF_8 = "UTF-8"; public static final Charset UTF_8_OBJ = StandardCharsets.UTF_8; public static final String JSON_ERR_CODE = "errcode"; public static final String JSON_SESSION_KEY = "session_key"; public static final String REDIS_WX_XCX_SESSION_KEY = "wx-xcx:session-key"; public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; public static SerializerFeature[] serializerFeatures(Boolean prettyFormat) { List<SerializerFeature> serializerFeatures = new ArrayList<>(16); // 输出key时是否使用双引号,默认为true serializerFeatures.add(SerializerFeature.QuoteFieldNames); // 避免循环引用 serializerFeatures.add(SerializerFeature.DisableCircularReferenceDetect); // 是否输出Map值为null的字段 serializerFeatures.add(SerializerFeature.WriteMapNullValue); // 数值字段如果为null,输出为0,而非null serializerFeatures.add(SerializerFeature.WriteNullNumberAsZero); // 字符类型字段如果为null,输出为"",而非null serializerFeatures.add(SerializerFeature.WriteNullStringAsEmpty); // list字段如果为null,输出为[],而非null serializerFeatures.add(SerializerFeature.WriteNullListAsEmpty); // boolean字段如果为null,输出为false,而非null serializerFeatures.add(SerializerFeature.WriteNullBooleanAsFalse); // 设置使用文本方式输出日期,fastJson默认是long serializerFeatures.add(SerializerFeature.WriteDateUseDateFormat); // 将key不是String类型转为String serializerFeatures.add(SerializerFeature.WriteNonStringKeyAsString); // 忽略那些抛异常的get方法 serializerFeatures.add(SerializerFeature.IgnoreErrorGetter); // 启用对'<'和'>'的处理方式 serializerFeatures.add(SerializerFeature.BrowserSecure); if (prettyFormat) { serializerFeatures.add(SerializerFeature.PrettyFormat); } return serializerFeatures.toArray(new SerializerFeature[0]); } public static SerializeConfig serializeConfig() { SerializeConfig config = new SerializeConfig(); config.put(java.util.Date.class, new SimpleDateFormatSerializer(Const.DEFAULT_DATE_FORMAT)); config.put(java.sql.Date.class, new SimpleDateFormatSerializer(Const.DEFAULT_DATE_FORMAT)); return config; } }
[ "zxk175@qq.com" ]
zxk175@qq.com
38e5b1b26c88802918d8c526cfe60ba1b32b6a08
d4a2caf1a3c4010c12289181087df11d7e8d7c70
/src/com/iup/tp/twitup/mock/MockTwitListController.java
1ddca4a486c3bf5bb310e0e1d12eee3b0be71c14
[]
no_license
Sanctuspetrus/TwitupProjet
107342c1f8192f06bcdcbc519d0be44781b61c5d
d8a20122251d01f392200f2b35df61bae2aa2b99
refs/heads/master
2021-01-20T10:30:40.708883
2017-02-27T16:19:26
2017-02-27T16:19:26
80,806,544
0
0
null
null
null
null
UTF-8
Java
false
false
2,512
java
package com.iup.tp.twitup.mock; import java.util.ArrayList; import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Set; import com.iup.tp.twitup.datamodel.IDatabase; import com.iup.tp.twitup.datamodel.IDatabaseObserver; import com.iup.tp.twitup.datamodel.Twit; import com.iup.tp.twitup.datamodel.User; public class MockTwitListController implements IDatabaseObserver { protected final Set<ITwitListObserver> mObservers = new HashSet<ITwitListObserver>(); protected List<Twit> twitList = new ArrayList<Twit>(); private IDatabase database; public MockTwitListController(IDatabase iDatabase) { this.database = iDatabase; this.database.addObserver(this); } /** * @param text */ public void searchTwits(String text) { ArrayList<Twit> newTwitList = new ArrayList<Twit>(); // Récupération des twits à filtrer Set<Twit> databaseTwits = this.database.getTwits(); if (text == null || text.isEmpty()) { newTwitList = new ArrayList<Twit>(databaseTwits); } else { for (Twit twit : databaseTwits) { if (twit.getText().contains(text)) { newTwitList.add(twit); } } } // Ajout de la nouvelle liste this.twitList = newTwitList; // Tri de la nouvelle liste this.sortTwits(); // Notification this.notifyObservers(); } public void addObserver(ITwitListObserver observer) { this.mObservers.add(observer); } @Override public void notifyTwitAdded(Twit addedTwit) { // Ajout du nouveau twit twitList.add(addedTwit); // Tri des twits this.sortTwits(); // Notification notifyObservers(); } @Override public void notifyTwitDeleted(Twit deletedTwit) { twitList.remove(deletedTwit); this.notifyObservers(); } protected void sortTwits() { twitList.sort(new Comparator<Twit>() { @Override public int compare(Twit t1, Twit t2) { Long firstTwitEmissionDate = t1.getEmissionDate(); Long secondTwitEmissionDate = t2.getEmissionDate(); return firstTwitEmissionDate.compareTo(secondTwitEmissionDate); } }); } private void notifyObservers() { for (ITwitListObserver observer : mObservers) { observer.notifyTwitListHasChanged(twitList); } } @Override public void notifyTwitModified(Twit modifiedTwit) { // NA } @Override public void notifyUserAdded(User addedUser) { // NA } @Override public void notifyUserDeleted(User deletedUser) { // NA } @Override public void notifyUserModified(User modifiedUser) { // NA } }
[ "razeltif@gmail.com" ]
razeltif@gmail.com
6a434febf3869b39bf8a69c2332d709c35f06c71
5d5af06b7239c199cec0738d1c40f5b4505e79f1
/src/main/java/com/epam/edu/spring/core/homework/service/AbstractDomainObjectServiceImpl.java
96f254837213a354d3c9ef2128f2ee117a76134d
[]
no_license
zhukovin/spring-core-homework
c6d9a5e240ce49777bc9c8ad6e62feb21fba8950
a80a7ad27ca81805f03632c7030185e926d9039d
refs/heads/master
2020-04-09T02:33:10.986612
2018-12-02T17:42:02
2018-12-02T17:42:02
159,944,968
0
0
null
null
null
null
UTF-8
Java
false
false
973
java
package com.epam.edu.spring.core.homework.service; import com.epam.edu.spring.core.homework.domain.DomainObject; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.BeanFactory; import java.util.Collection; import java.util.HashMap; import java.util.Map; @RequiredArgsConstructor public class AbstractDomainObjectServiceImpl<T extends DomainObject> implements AbstractDomainObjectService<T> { protected final BeanFactory beanFactory; protected final Map<Long, T> storage = new HashMap<>(); @Override public T save(T object) { long id = object.hashCode(); object.setId(id); storage.put(id, object); return object; } @Override public void remove(T object) { storage.remove(object.getId()); } @Override public T getById(Long id) { return storage.get(id); } @Override public Collection<T> getAll() { return storage.values(); } }
[ "zhukovin@gmail.com" ]
zhukovin@gmail.com
c0354c2b960ddcc9b8fb545646bf0fb00e8cbea5
3232d8c8f0652d3d4a19f9ce40351ac56b0c6c91
/app/src/main/java/com/adu/main/mytimertask/base/BaseActivity.java
b769f52c42fbab3620c13fdf10c42ee909b25729
[]
no_license
ZhangTengCR7/Mseei
39d4c6c05dfec37118b4fab3cb3ad48b33537d7b
d1b3112be841d4aad4b1c871c083713a5db76dc6
refs/heads/master
2021-01-15T19:19:04.826309
2016-06-16T02:25:08
2016-06-16T02:25:08
61,256,820
1
0
null
2016-06-16T02:46:24
2016-06-16T02:46:24
null
UTF-8
Java
false
false
1,419
java
package com.adu.main.mytimertask.base; import android.os.Build; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.view.MenuItem; import android.view.Window; import android.view.WindowManager; /** * 返回的基类 * Created by dell on 2016/5/26. */ public class BaseActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //ActionBar上显示返回 getSupportActionBar().setDisplayHomeAsUpEnabled(true); //以下代码用于去除阴影 if(Build.VERSION.SDK_INT>=21){ getSupportActionBar().setElevation(0); } } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()){ case android.R.id.home: finish(); break; } return super.onOptionsItemSelected(item); } private void setTranslucentStatus(boolean on) { Window win = getWindow(); WindowManager.LayoutParams winParams = win.getAttributes(); final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; if (on) { winParams.flags |= bits; } else { winParams.flags &= ~bits; } win.setAttributes(winParams); } }
[ "dpc_206@163.com" ]
dpc_206@163.com
d0284212750a217c6b5a21d58cfa3742bbcc324c
e9603182e4632af91abe7a6a3bc166f8a7f0d287
/app/src/main/java/com/fafen/survey/NewFormSeven/DatabaseAsyncFormSeven.java
4bdab17f5462c7a93a9849940aedcc910c1f52c2
[]
no_license
azeemhaider518/Servey-app-android-
c3facc3f18b2813875d913f5cce06267e606da88
3df7c411267759ea5cf2b720b1ccaf527fe60c08
refs/heads/master
2023-01-07T06:01:34.877194
2018-06-24T16:10:14
2018-06-24T16:10:14
311,906,692
1
0
null
null
null
null
UTF-8
Java
false
false
5,793
java
package com.fafen.survey.NewFormSeven; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.AsyncTask; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLEncoder; import java.util.ArrayList; public class DatabaseAsyncFormSeven extends AsyncTask<String,Void ,String> { private Context context; //private AlertDialog alertDialog; private ArrayList<String> strResult; public DatabaseAsyncFormSeven(Context context) { this.context = context; } @Override protected String doInBackground(String... params) { String ServerURL = "http://emis.creativecube.io/Servey-PHP/InsertForm.php" ; try { publishProgress(); String formNo = "form 7"; String id = params[0]; String ans1 = params[1]; String ans2 = params[2]; String ans3 = params[3]; String ans4 = params[4]; String ans5 = params[5]; String ans6 = params[6]; String ans7 = params[7]; String date = params[8]; String lati = params[9]; String longi = params[10]; URL url = new URL(ServerURL); HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection(); httpURLConnection.setRequestMethod("POST"); httpURLConnection.setDoOutput(true); httpURLConnection.setDoInput(true); OutputStream outputStream = httpURLConnection.getOutputStream(); BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStream,"UTF-8")); String post_data = URLEncoder.encode("formNo","UTF-8")+ "="+ URLEncoder.encode(formNo,"UTF-8") +"&"+ URLEncoder.encode("id","UTF-8")+ "="+ URLEncoder.encode(id,"UTF-8") +"&"+ URLEncoder.encode("ans1","UTF-8")+ "="+ URLEncoder.encode(ans1,"UTF-8") +"&"+ URLEncoder.encode("ans2","UTF-8")+ "="+ URLEncoder.encode(ans2,"UTF-8") +"&"+ URLEncoder.encode("ans3","UTF-8")+ "="+ URLEncoder.encode(ans3,"UTF-8") +"&"+ URLEncoder.encode("ans4","UTF-8")+ "="+ URLEncoder.encode(ans4,"UTF-8") +"&"+ URLEncoder.encode("ans5","UTF-8")+ "="+ URLEncoder.encode(ans5,"UTF-8") +"&"+ URLEncoder.encode("ans6","UTF-8")+ "="+ URLEncoder.encode(ans6,"UTF-8") +"&"+ URLEncoder.encode("ans7","UTF-8")+ "="+ URLEncoder.encode(ans7,"UTF-8") +"&"+ URLEncoder.encode("date","UTF-8")+ "="+ URLEncoder.encode(date,"UTF-8") +"&"+ URLEncoder.encode("lati","UTF-8")+ "="+ URLEncoder.encode(lati,"UTF-8") +"&"+ URLEncoder.encode("longi","UTF-8")+ "="+ URLEncoder.encode(longi,"UTF-8") ; bufferedWriter.write(post_data); bufferedWriter.flush(); bufferedWriter.close(); outputStream.close(); InputStream inputStream = httpURLConnection.getInputStream(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream,"iso-8859-1"));//,"iso-8859-1" String result = "["; String line; while ((line = bufferedReader.readLine())!=null) { result =result+ line; } result = result+"]"; JSONArray jsonArray = new JSONArray(result); JSONObject jsonObject = (JSONObject) jsonArray.get(0); strResult = new ArrayList<>(); result = (String) jsonObject.get("response"); strResult.add(result); //for (int i=0;i<jsonArray.length();i++) //{ //JSONObject jsonObject = (JSONObject) jsonArray.get(0); //result = (String) jsonObject.get("id"); //} bufferedReader.close(); inputStream.close(); httpURLConnection.disconnect(); return result; } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } return null; } @Override protected void onPreExecute() { //alertDialog = new AlertDialog.Builder(context).create(); //alertDialog.setTitle("Login Status"); } public String getId() { return strResult.get(1); } @Override protected void onPostExecute(String result) { // Toast.makeText(context, result , Toast.LENGTH_LONG).show(); Intent returnIntent = new Intent(); returnIntent.putExtra("result","Done Form One"); ((Activity)context).setResult(Activity.RESULT_OK,returnIntent); ((Activity)context).finish(); } @Override protected void onProgressUpdate(Void... values) { super.onProgressUpdate(values); } }
[ "haider.uet111@gmail.com" ]
haider.uet111@gmail.com
810872dabf2ca4e12f643a31f5d6454791571f84
6d10fde3ca6b83434d9f038c8465ba8ab7c04708
/net/acomputerdog/BlazeLoader/proxy/ProfilerProxy.java
8a7c8f655301112fe8d7ed6d55cbf7a72bffd882
[ "BSD-2-Clause" ]
permissive
Mumfrey/BlazeLoader
505678342776f05c32ed1f7cbe4d0e7456a66776
e86fa93426ef2c1697481db995f76c6319f07418
refs/heads/master
2021-01-18T01:43:56.176073
2013-10-24T01:33:03
2013-10-24T01:33:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
800
java
package net.acomputerdog.BlazeLoader.proxy; import net.acomputerdog.BlazeLoader.main.fixes.BlockAir; import net.acomputerdog.BlazeLoader.mod.ModList; import net.minecraft.src.Profiler; public class ProfilerProxy extends Profiler { private boolean hasLoadedMods = false; @Override public void startSection(String par1Str) { if("root".equals(par1Str)){ if(!hasLoadedMods){ BlockAir.injectBlockAir(); hasLoadedMods = true; ModList.start(); } } ModList.startSection(par1Str); super.startSection(par1Str); } @Override public void endSection() { super.endSection(); String section = super.getNameOfLastSection(); ModList.endSection(section); } }
[ "acomputerdog@gmail.com" ]
acomputerdog@gmail.com
e09bc021ba48c7ac3411341cc5bf5a7d0c597092
ae94386f58e2ac4fae27d4f51f88f8cc6982a4d5
/Server.java
fc883c408ab88d2e7b0dd961dbf674e5fe264a07
[ "MIT" ]
permissive
pattharock/GUI-tic-tac-toe
02a0d016c696c3270244d1d95a73499a3b9bd9bd
2eb6b2f45245c140f8fce8acab5f1c9d5af253da
refs/heads/main
2023-03-11T15:41:10.381743
2021-03-02T13:46:45
2021-03-02T13:46:45
343,785,979
0
0
null
null
null
null
UTF-8
Java
false
false
7,662
java
import java.io.IOException; import java.io.PrintWriter; import java.net.*; import java.util.Scanner; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /** * This class is used to Represent a Server in a Socket Programmed GUI Tic-Tac-Toe game * @author ritviksingh * @version 1.0 */ public class Server { private Player [] board = new Player[9]; Player currentPlayer; /** * This class is the Runnable class(i.e. implements the Runnable interface for multi-threading) */ public class Player implements Runnable{ Socket connectorSocket; Scanner inputScanner; PrintWriter outputWriter; char piece; Player opponent; /** * this is the constructor for the class Player * @param connectorSocket * @param piece */ public Player(char piece,Socket connectorSocket){ this.connectorSocket=connectorSocket; this.piece=piece; } /** *Overridden method of the Runnable Interface required for multi-threading. */ public void run(){ try{ initiateNetworking(); getMessageFromClient(); }catch(Exception ex){ System.out.println("Message:-\n"+ex.getMessage()); System.out.println("Stack:-"); ex.printStackTrace(); } if(opponent!=null && opponent.outputWriter!=null){ opponent.outputWriter.println("Opponent Left"); } try{ connectorSocket.close(); }catch (Exception ex){ System.out.println("Message:-\n"+ex.getMessage()); System.out.println("Stack:-"); ex.printStackTrace(); } } /** * Receives message from client and * performs suitable actions. */ private void getMessageFromClient(){ while(inputScanner.hasNextLine()){ String message = inputScanner.nextLine(); if(message.startsWith("EXIT")){ return; } else if(message.startsWith("PLAYED")){ sendMessageToClient(Integer.parseInt(message.substring(7))); } } } /** * Receives input from client, updates the board, writes back * info to the clients * @param position */ private void sendMessageToClient(int position){ try{ isValidMove(position,this); outputWriter.println("Correct Move"); opponent.outputWriter.println("Opponent Moved "+position); if(checkWin()){ outputWriter.println("Win"); opponent.outputWriter.println("Loss"); } else if(checkDraw()){ outputWriter.println("Draw"); opponent.outputWriter.println("Draw"); } }catch (IllegalStateException ex){ outputWriter.println(ex.getMessage()); } } /** * this method checks for the winning condition of the game * @return */ public boolean checkWin(){ if(checkVerticalWin()){ return true; } else if(checkHorizontalWin()){ return true; } else if((board[0]!=null && board[0].equals(board[4]) &&board[4].equals(board[8]))){ return true; } else if((board[2]!=null && board[2].equals(board[4]) &&board[2].equals(board[6]))){ return true; } else{ return false; } } /** * Checks for win conditions in rows * @return */ public boolean checkHorizontalWin(){ for(int i=0;i<3;i+=3){ if(board[i]!=null && board[i].equals(board[i+1]) &&board[i+1].equals(board[i+2])){ return true; } } return false; } /** * Checks for win conditions in columns * @return */ public boolean checkVerticalWin(){ for(int i=0;i<3;i++){ if(board[i]!=null && board[i].equals(board[i+3]) &&board[i+3].equals(board[i+6])){ return true; } } return false; } /** * this checks if the board is full or not * @return */ public boolean checkDraw(){ int i=0; while(i<9){ if(board[i++]==null){ return false; } } return true; } /** * this method checks if the user move is a valid one or not * * @param location * @param player */ public void isValidMove(int location,Player player){ synchronized (this) { if (player != currentPlayer) { throw new IllegalStateException("Opponents turn! Please wait for you turn"); } else if (player.opponent == null) { throw new IllegalStateException("No Opponent Yet! Wait for opponent."); } else if (board[location] != null) { throw new IllegalStateException("Block Occupied! Move Again."); } board[location] = currentPlayer; currentPlayer = currentPlayer.opponent; } } /** * This function helps in switching players based on character piece * @param piece */ public void switchPlayers(char piece){ if(piece == 'X'){ currentPlayer = this; } else { opponent = currentPlayer; opponent.opponent = this; } } /** * This method helps initiate networking */ private void initiateNetworking() { try{ inputScanner= new Scanner(connectorSocket.getInputStream()); outputWriter = new PrintWriter(connectorSocket.getOutputStream(),true); } catch (Exception ex){ System.out.println("Message:-\n"+ex.getMessage()); System.out.println("Stack:-"); ex.printStackTrace(); } outputWriter.println(piece); switchPlayers(piece); } } /** * This is the main method of the server, which is used to create 2 threads of the client class and network the same with the running server. * @param args * @throws Exception */ public static void main(String[] args) throws Exception{ try (ServerSocket listener = new ServerSocket(50000)) { System.out.println("Server is running..."); ExecutorService pool = Executors.newFixedThreadPool(2000); while(true){ try{ Server server = new Server(); pool.execute(server.new Player('X',listener.accept())); pool.execute(server.new Player('O',listener.accept())); }catch (Exception ex){ System.out.println("Message:-\n"+ex.getMessage()); System.out.println("Stack:-"); ex.printStackTrace(); } } } } }
[ "ritvik1609#gmail.com" ]
ritvik1609#gmail.com
4c695a41bdc4060a7d80803c54cce0eaea426730
1cd8313569dcf320b2dff8083111026e574c789f
/src/main/java/com/ceme/crm/CRM/entities/Interaction.java
b6b2a8f48fb46370608a56fe5e9195783ea6e9cb
[]
no_license
heebeers/CEME-CRM-BACKEND
bf15351d2c88f5527463cf8ca51b0d779f5f6538
2f2aae099fd0fe9b3ee9f56ca80fdc0a0fe7a92c
refs/heads/master
2022-12-07T12:07:07.603893
2020-09-02T21:36:24
2020-09-02T21:36:24
292,371,093
0
0
null
null
null
null
UTF-8
Java
false
false
2,197
java
package com.ceme.crm.CRM.entities; import java.util.Date; import org.bson.types.ObjectId; import org.springframework.data.annotation.Id; public class Interaction { @Id private ObjectId id; private String customerId; private String interactionType; private String interactionNotes; private String interactionFollowUpType; private Date iteractionFollowUpDate; private Date interactionDate; private String employeeId; private int priorityLevel; public String getId() { return id.toString(); } public void setId(ObjectId id) { this.id = id; } public String getCustomerId() { return customerId; } public void setCustomerId(String customerId) { this.customerId = customerId; } public String getInteractionType() { return interactionType; } public void setInteractionType(String interactionType) { this.interactionType = interactionType; } public String getInteractionNotes() { return interactionNotes; } public void setInteractionNotes(String interactionNotes) { this.interactionNotes = interactionNotes; } public String getInteractionFollowUpType() { return interactionFollowUpType; } public void setInteractionFollowUpType(String interactionFollowUpType) { this.interactionFollowUpType = interactionFollowUpType; } public Date getIteractionFollowUpDate() { return iteractionFollowUpDate; } public void setIteractionFollowUpDate(Date iteractionFollowUpDate) { this.iteractionFollowUpDate = iteractionFollowUpDate; } public Date getInteractionDate() { return interactionDate; } public void setInteractionDate(Date interactionDate) { this.interactionDate = interactionDate; } public String getEmployeeId() { return employeeId; } public void setEmployeeId(String employeeId) { this.employeeId = employeeId; } public int getPriorityLevel() { return priorityLevel; } public void setPriorityLevel(int priorityLevel) { this.priorityLevel = priorityLevel; } }
[ "hieu.b.trinh@gmail.com" ]
hieu.b.trinh@gmail.com
8534f0e29df6bd6e3dee60c21d7b1014838f2b92
6c9df3db37326b003cde8526c37109f039a10629
/persistent/src/main/java/com/joey/persistent/custom/config/BoundSql.java
b58dbc1dff38fb26a21e7b187f24b690ff5ae7ce
[]
no_license
sumcolin/BaseDemo
ba45903726bee09da29d6da3bfcae3c555561804
2c1f0b392f8d47e34d20e69040c1eab79bb88483
refs/heads/master
2023-01-15T02:24:11.107048
2020-11-26T06:04:26
2020-11-26T06:04:26
312,758,036
1
0
null
null
null
null
UTF-8
Java
false
false
716
java
package com.joey.persistent.custom.config; import com.joey.persistent.custom.util.ParameterMapping; import java.util.ArrayList; import java.util.List; public class BoundSql { private String sqlText; private List<ParameterMapping> parameterMappingsList = new ArrayList<ParameterMapping>(); public String getSqlText() { return sqlText; } public void setSqlText(String sqlText) { this.sqlText = sqlText; } public List<ParameterMapping> getParameterMappingsList() { return parameterMappingsList; } public void setParameterMappingsList(List<ParameterMapping> parameterMappingsList) { this.parameterMappingsList = parameterMappingsList; } }
[ "luck_xin@me.com" ]
luck_xin@me.com
32c4d15c0214ad138a7e96aae446c87df7003879
39497ded01f9ea16f277dc325020387542815502
/src/main/java/com/sz/winter/basereptile/service/ClassifyListService.java
b1f5ec585866f250b95f25b7fff129a44b176b34
[]
no_license
ly1836/base-reptile
b3b1857714111e3a2934aabc87ccb44a76322fdc
c6a40398fb7d5f2bc72715e703c195a1709699ad
refs/heads/master
2022-09-30T01:49:08.298309
2020-05-26T15:46:11
2020-05-26T15:46:11
161,177,505
0
0
null
2022-09-01T23:00:14
2018-12-10T13:14:59
Java
UTF-8
Java
false
false
1,492
java
package com.sz.winter.basereptile.service; import com.sz.winter.basereptile.base.BaseDao; import com.sz.winter.basereptile.model.Classify; import com.sz.winter.basereptile.model.ClassifyList; import org.springframework.stereotype.Service; import java.util.List; @Service public class ClassifyListService extends BaseDao { /** * <p> * 批量插入列表信息 * </p> * @param classifyLists 列表详情 */ public void insertBatchClassifys(List<ClassifyList> classifyLists){ getSession().insert("insertBatchClassifyList",classifyLists); } /** * <p> * 更新列表详情信息 * </p> * @param classifyLists 列表详情 */ public void updateClassifys(ClassifyList classifyLists){ getSession().insert("updateClassifyList",classifyLists); } /** * <p> * 获取全部列表 * </p> * @return List */ public List<ClassifyList> listCalssifyList(){ return getSession().selectList("listCalssifyList"); } /** * <p> * 获取未拉去的视频信息列表 * </p> * @return List */ public List<ClassifyList> getNotDowloadVideo(){ return getSession().selectList("getNotDowloadImage"); } /** * <p> * 获取下封面图列表 * </p> * @return List */ public List<ClassifyList> getNotDowloadImage(){ return getSession().selectList("getNotDowloadImage"); } }
[ "491816301@qq.com" ]
491816301@qq.com
ebede3167895da63fc741330d536358e65be3d9d
e0392711dd12edb2201d2df90c5d26220ea0ac72
/pet-clinic-data/src/main/java/jgomez/springframework/spring5petclinic/model/Specialty.java
f154ae03244db174a514750d970071235e91c428
[]
no_license
jogomez97/spring5-pet-clinic
6462326aa086c6079b81e174c4a198aabd17d12b
9454ef6503bd7602a443521e463e30d72fc979b1
refs/heads/main
2023-06-04T15:09:52.993682
2021-07-04T16:26:58
2021-07-04T16:26:58
378,391,551
0
0
null
null
null
null
UTF-8
Java
false
false
498
java
package jgomez.springframework.spring5petclinic.model; /** * Class Specialty * * @author Joan Gomez * @version 1.0 **/ public class Specialty extends BaseEntity { private String description; public Specialty() { } public Specialty(String description) { this.description = description; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } }
[ "jo_gomez97@hotmail.com" ]
jo_gomez97@hotmail.com
b9322f917d9276dfbeafc2809c18de09a381ac85
7ebd6116f1dd9bae62b9840cced2d90bc763ad51
/src/test/java/com/lazerycode/selenium/utilities/OsUtilsTest.java
12ca91883f4816afbc069b6f2572ef2eeafc03cc
[]
no_license
xmeng1/Selenium-Maven-Template
0c728ec2be2e07cc63444e5449891b832db1df1a
9d405dd39d3f4604eaa54e20724f81795f0e0c89
refs/heads/master
2020-03-27T05:42:21.958504
2018-09-04T17:00:05
2018-09-04T17:00:05
146,041,336
1
0
null
null
null
null
UTF-8
Java
false
false
715
java
package com.lazerycode.selenium.utilities; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.Test; import com.lazerycode.selenium.config.utilities.OsType; import com.lazerycode.selenium.config.utilities.OsUtils; /** * <p>Date: 26/08/18 * * @author mengxin * @version 1.0 */ public class OsUtilsTest { private static final Logger LOG = LoggerFactory.getLogger(OsUtilsTest.class); @Test public void testGetOperatingSystemName() { String test = OsUtils.getOperatingSystemName(); LOG.info(test); } @Test public void testGetCurrentOS() { OsType osType = OsUtils.getCurrentOS(); LOG.info(osType.toString()); } }
[ "x.meng@outlook.com" ]
x.meng@outlook.com
c346d3dd9f6da32e6eed28783ef65df21d9aeb48
581f47bea807f07f458241a75d3dd4382dcdc32a
/推回输入流/PushbackTest.java
3dbf66415249991633ce0c45b25b9e3336e4b348
[]
no_license
KronosOceanus/javaSE
dc30e4f20f02e39ba32b4e7056b95511e1cca648
43bd0660acf9e7488cd581c4e5907b3316c3ca0c
refs/heads/main
2021-06-15T02:11:19.604097
2021-05-01T02:57:35
2021-05-01T02:57:35
186,195,872
1
0
null
null
null
null
UTF-8
Java
false
false
157
java
public class Main{ public static void main(String[] args){ System.out.println("HelloWorld!"); //qwq new PushbackReader; } }
[ "704690152@qq.com" ]
704690152@qq.com
9be706a83e9ad2774ec406ebc464dccf5a48c1aa
527e88a850c84babf41e609a6a6a3ccec590893a
/handwritten_mybatis/src/main/java/com/itcast/mybatis/cfg/Configuration.java
d4518523bb4036cc9bba079cd0d0411952907077
[]
no_license
DragonCattle/handwritten_mybatis
dcd4412bc97dcb9d94f1348be956839afe6c14c6
166af90b00ed884409e214067547a2628c0f36a0
refs/heads/master
2022-07-04T13:57:09.470972
2019-10-24T13:01:23
2019-10-24T13:01:23
217,294,558
0
0
null
2022-06-21T02:06:31
2019-10-24T12:32:38
Java
UTF-8
Java
false
false
1,459
java
package com.itcast.mybatis.cfg; import java.util.HashMap; import java.util.Map; /** * 加载mybatis的配置信息 * 用于连接数据库的信息 */ public class Configuration { private String driver; private String url; private String username; private String password; private Map<String,Mapper> mappers =new HashMap<String, Mapper>(); public Map<String, Mapper> getMappers() { return mappers; } public void setMappers(Map<String, Mapper> mappers) { this.mappers.putAll(mappers); } public String getDriver() { return driver; } public void setDriver(String driver) { this.driver = driver; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } 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; } @Override public String toString() { return "Configuration{" + "driver='" + driver + '\'' + ", url='" + url + '\'' + ", username='" + username + '\'' + ", password='" + password + '\'' + ", mappers=" + mappers + '}'; } }
[ "he1343128728@163.com" ]
he1343128728@163.com
5f8d3d2e2b92912fd560417d6355f23ff26e1e1b
39674677af4a085d57916ca1403ff47f0bacb61b
/EntitiesAPI/spring-server/src/main/java/ch/heigvd/amt/project2/api/util/ApiResponseMessage.java
9908f419900915bf8f2a8324d2be95cd03109a7f
[]
no_license
Koffi94/Teaching-HEIGVD-AMT-2019-Project-Two
4c3257841eec1c9e5f20cfc218e033abd2eec63c
8c5e36c5040f8dfa210d3a8beb0e3a9ba7219195
refs/heads/master
2020-09-23T02:04:39.862271
2020-01-19T22:24:36
2020-01-19T22:24:36
225,374,555
1
0
null
2020-01-19T21:45:46
2019-12-02T12:52:36
JavaScript
UTF-8
Java
false
false
1,558
java
package ch.heigvd.amt.project2.api.util; import javax.xml.bind.annotation.XmlTransient; @javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-12-16T19:36:34.802Z") @javax.xml.bind.annotation.XmlRootElement public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; public static final int INFO = 3; public static final int OK = 4; public static final int TOO_BUSY = 5; int code; String type; String message; public ApiResponseMessage(){} public ApiResponseMessage(int code, String message){ this.code = code; switch(code){ case ERROR: setType("error"); break; case WARNING: setType("warning"); break; case INFO: setType("info"); break; case OK: setType("ok"); break; case TOO_BUSY: setType("too busy"); break; default: setType("unknown"); break; } this.message = message; } @XmlTransient public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
[ "olivier.koffi@heig-vd.ch" ]
olivier.koffi@heig-vd.ch
de8b972fdda8922b378e3bdcc3fadc466b4e46f6
52924c79164478352ea71e638c1252f79fc7d958
/src/java/com/nobodyelses/data/utils/Utils.java
3bc7dd2f8474b97d22aa393fcbcf468410a1c38c
[]
no_license
hovawart/compendium
43c467bfb28d7b8c534797bb61f49e7cba1923ac
331ba609f891d2afac657ca29ec8eb0894ba9c13
refs/heads/master
2021-01-11T03:36:11.819146
2016-10-16T16:08:34
2016-10-16T16:08:34
70,996,091
0
0
null
null
null
null
UTF-8
Java
false
false
37,479
java
package com.nobodyelses.data.utils; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Type; import java.math.BigDecimal; import java.security.GeneralSecurityException; import java.text.DecimalFormat; import java.text.MessageFormat; import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Map.Entry; import java.util.Scanner; import java.util.UUID; import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.joda.time.DateMidnight; import org.joda.time.DateTime; import org.joda.time.DateTimeConstants; import org.joda.time.DateTimeZone; import org.joda.time.Period; import org.joda.time.PeriodType; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; import org.mozilla.javascript.Context; import org.mozilla.javascript.ContextFactory; import org.mozilla.javascript.NativeArray; import org.mozilla.javascript.Script; import org.mozilla.javascript.Scriptable; import org.mozilla.javascript.Undefined; import org.mozilla.javascript.UniqueTag; import org.mozilla.javascript.debug.DebuggableScript; import org.restlet.Request; import org.restlet.engine.util.Base64; import org.restlet.ext.crypto.internal.CryptoUtils; import com.google.appengine.api.datastore.Cursor; import com.google.appengine.api.memcache.MemcacheService; import com.google.appengine.api.taskqueue.Queue; import com.google.appengine.api.taskqueue.QueueFactory; import com.google.appengine.api.taskqueue.RetryOptions; import com.google.appengine.api.taskqueue.TaskHandle; import com.google.appengine.api.taskqueue.TaskOptions; import com.google.appengine.api.taskqueue.TaskOptions.Method; import com.google.apphosting.api.DatastorePb; import com.google.apphosting.api.DatastorePb.CompiledCursor; import com.google.apphosting.api.DatastorePb.CompiledCursor.Position; import com.google.apphosting.api.DatastorePb.CompiledCursor.PositionIndexValue; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import com.google.storage.onestore.v3.OnestoreEntity; import com.google.storage.onestore.v3.OnestoreEntity.Path; import com.google.storage.onestore.v3.OnestoreEntity.Path.Element; import com.google.storage.onestore.v3.OnestoreEntity.PropertyValue; import com.google.storage.onestore.v3.OnestoreEntity.Reference; import com.maintainer.data.controller.Resource; import com.maintainer.data.model.EntityImpl; import com.maintainer.data.model.MyField; import com.maintainer.data.provider.DataProvider; import com.maintainer.data.provider.DataProviderFactory; import com.maintainer.data.provider.Key; import com.maintainer.data.provider.Query; import com.maintainer.data.provider.datastore.MyMemcacheServiceFactory; import com.nobodyelses.data.model.User; import com.nobodyelses.data.router.MyResourceRouter; public class Utils { public static final String SYSTEM_USERNAME = "administrator"; private static final String SYSTEM_USER = "SystemUser"; private static final String SYSTEM_USER_KEY = "SystemUserKey"; public static final int UNAUTHORIZED = 401; private static final Logger log = Logger.getLogger(Utils.class.getName()); private static final String _0_1 = "{0}: {1}"; private static final String WEIGHT_INVALID_0 = "Weight invalid: {0}"; public static final String AMERICA_NEW_YORK = "America/New_York"; public static final String TRADING_TIME_ZONE = AMERICA_NEW_YORK; public static final String YYYY_MM_DD = "yyyy-MM-dd"; public static final String YYYYMMDD = "yyyyMMdd"; public static final String YYYYMMDD_HHMMSS = "yyyyMMdd HH:mm:ss"; public static final String MMDDYY_HHMMZ = "MM.dd.yy HH:mm zzz"; public static final DateTimeFormatter DATE_FORMATTER_NEW_YORK_WITHOUT_TIME = DateTimeFormat.forPattern(YYYYMMDD).withZone(DateTimeZone.forID(TRADING_TIME_ZONE)); public static final DateTimeFormatter DATE_FORMATTER_NEW_YORK_WITHOUT_TIME2 = DateTimeFormat.forPattern(YYYY_MM_DD).withZone(DateTimeZone.forID(TRADING_TIME_ZONE)); public static final DateTimeFormatter DATE_FORMATTER_NEW_YORK_WITH_TIME = DateTimeFormat.forPattern(YYYYMMDD_HHMMSS).withZone(DateTimeZone.forID(TRADING_TIME_ZONE)); public static final SimpleDateFormat sdf = new SimpleDateFormat("MM.dd.yy HH:mm z"); public static final NumberFormat nf = new DecimalFormat("#########.##"); private static final String IT_S_A_WEEKEND_SETTING_TRADING_DATE_TO = "It's a weekend; setting trading date to {0}."; private static final int DAY_MILLISECONDS = 86400000; private static final BigDecimal ZERO = BigDecimal.ZERO; private static DateTime useDate; private static User systemUser; private static Key systemUserKey; private static final SimpleDateFormat expiresSimpleDateFormat = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); @SuppressWarnings("resource") public static String getFileAsString(final String path) { final byte[] buffer = new byte[(int) new File(path).length()]; FileInputStream f; try { f = new FileInputStream(path); f.read(buffer); } catch (final Exception e) { log.warning(e.getMessage()); } return new String(buffer); } @SuppressWarnings("resource") public static byte[] getFile(final String path) { final byte[] buffer = new byte[(int) new File(path).length()]; FileInputStream f; try { f = new FileInputStream(path); f.read(buffer); } catch (final Exception e) { e.printStackTrace(); } return buffer; } public static Date toNewYorkTimeStartOfDay(final Date date) { return stripTime(new DateTime(date)).toDateTime(getTradingTimeZone()).plusHours(9).toDate(); } public static Date xtoNewYorkTimeEndOfDay(final Date date) { return stripTime(new DateTime(date)).toDateTime(getTradingTimeZone()).plusHours(17).toDate(); } public static DateTime getNewYorkTime() { final DateTime now = DateTime.now(getTradingTimeZone()); return now; } public static DateTimeZone getTradingTimeZone() { return DateTimeZone.forID(TRADING_TIME_ZONE); } public static boolean isMarketOpen() { final DateTime date = getNewYorkTime(); return isMarketOpen(date); } public static boolean isMarketOpen(final Date date) { return isMarketOpen(toDateTime(date)); } private static boolean isMarketOpen(final DateTime date) { final boolean isTradingDay = isTradingDay(date); if (!isTradingDay) { return false; } return isTradingHour(date); } public static boolean isTradingHour(final Date date) { return isTradingHour(toDateTime(date)); } private static boolean isTradingHour(final DateTime date) { final int hour = date.toDateTime(getTradingTimeZone()).getHourOfDay(); if (hour < 8 || hour > 17) { return false; } return true; } public static boolean isTradingDay(final Date date) { return isTradingDay(toDateTime(date)); } private static boolean isTradingDay(final DateTime date) { final int day = date.toDateTime(getTradingTimeZone()).getDayOfWeek(); switch (day) { case DateTimeConstants.SATURDAY: case DateTimeConstants.SUNDAY: return false; } return true; } public static boolean isDateAfter(final Date date1, final Date date2) { final DateTime dateTime1 = toDateTime(date1); final DateTime dateTime2 = toDateTime(date2); final DateMidnight midnight1 = dateTime1.toDateMidnight(); final DateMidnight midnight2 = dateTime2.toDateMidnight(); final boolean after = midnight1.isAfter(midnight2); return after; } public static Date yesterday() { return yesterday(getDate()); } public static Date yesterday(final Date date) { return new DateTime(date, DateTimeZone.forID(Utils.TRADING_TIME_ZONE)).toDateMidnight().minusDays(1).toDate(); } private static DateTime yesterday(final DateTime date) { return date.toDateTime(getTradingTimeZone()).toDateMidnight().toDateTime(); } public static Date lastTradingDay() { return lastTradingDay(toDateTime()).toDate(); } public static Date lastTradingDay(final Date date) { return lastTradingDay(toDateTime(date)).toDate(); } private static DateTime lastTradingDay(DateTime date) { final DateTime now = toDateTime(); if (date.isAfter(now)) { date = now; } date = date.minusDays(1); date = stripTime(date); for (int i = 0; i < 30; i++) { if (isTradingDay(date)) { break; } date = date.minusDays(1); } return date; } public static boolean isYesterday(final Date date) { return isYesterday(toDateTime(date)); } private static boolean isYesterday(DateTime date) { final DateTime yesterday = yesterday(toDateTime()); date = date.toDateMidnight().toDateTime(); final boolean equals = yesterday.equals(date); return equals; } public static boolean isWeekend() { return isWeekend(toDateTime()); } public static boolean isWeekend(final Date date) { return isWeekend(new DateTime(date, getTradingTimeZone())); } private static boolean isWeekend(final DateTime date) { final int day = date.getDayOfWeek(); switch (day) { case DateTimeConstants.SATURDAY: case DateTimeConstants.SUNDAY: return true; } return false; } public static int days(final Date start, final Date end) { return days(start, end, true); } public static int days(final Date start, final Date end, final boolean inclusive) { final long startTime = start.getTime(); final long endTime = end.getTime(); final long diff = endTime - startTime; final Long days = diff / DAY_MILLISECONDS; int intValue = days.intValue(); if (inclusive) { if (diff >= 0) { intValue++; } else { intValue--; } } return intValue; } public static boolean isBefore(DateTime date) { final DateTime now = toDateTime(); date = stripTime(date); return date.isBefore(now); } private static DateTime toDateTime(final Date date) { return new DateTime(date); } public static Date stripTime(final Date date) { return new DateTime(date, getTradingTimeZone()).toDateMidnight().toDate(); } private static DateTime stripTime(final DateTime date) { return date.toDateTime(getTradingTimeZone()).toDateMidnight().toDateTime(); } public static Object[] toArray(final Object... objs) { return objs; } public static int getDiffYears(final Date first, final Date last) { return getDiffYears(toDateTime(first), toDateTime(last)); } public static int getDiffYears(DateTime first, DateTime last) { first = stripTime(first); last = stripTime(last); final int years = last.getYear() - first.getYear(); return years; } public static int getDiffQuarters(final Date first, final Date last) { return getDiffQuarters(toDateTime(first), toDateTime(last)); } public static int getDiffQuarters(DateTime first, DateTime last) { first = stripTime(first); last = stripTime(last); final PeriodType monthDay = PeriodType.yearMonthDay().withYearsRemoved(); final Period difference = new Period(first, last, monthDay); final int months = difference.getMonths(); return (int) Math.ceil(months / 3.0); } public static int toInt(final String value) { if (value == null) { return 0; } int i = 0; try { i = Integer.parseInt(value); } catch (final Exception e) { } return i; } public static Date getDateAdd(final Date date, final int years) { return getDateAdd(toDateTime(date), years).toDate(); } public static DateTime getDateAdd(DateTime date, final int years) { date = stripTime(date); return date.plusYears(years); } public static DateTime getDateAddMonths(DateTime date, final int months) { date = stripTime(date); return date.plusMonths(months); } public static Date getDateAddMonths(final Date date, final int days) { return getDateAddMonths(toDateTime(date), days).toDate(); } public static Date getDateAddDays(final Date date, final int days) { return getDateAddDays(toDateTime(date), days).toDate(); } private static DateTime getDateAddDays(DateTime date, final int days) { date = stripTime(date); return date.plusDays(days); } public static String getFormattedDate() { return DATE_FORMATTER_NEW_YORK_WITHOUT_TIME2.print(getDate().getTime()); } public static String getFormattedDate(final Date date) { return DATE_FORMATTER_NEW_YORK_WITHOUT_TIME2.print(date.getTime()); } public static Date getDate() { return toDate().toDate(); } public static DateTime toDateTime() { return getNewYorkTime(); } public static DateTime toDate() { if (useDate != null) { return useDate; } return getNewYorkTime(); } public static Date toDate(final String source, final String format) { return DateTime.parse(source, DateTimeFormat.forPattern(format)).toDate(); } public static Date toDate(final String source, final int days) throws Exception { DateTime dateTime = toDateTime(source); if (days > 0) { dateTime = dateTime.plus(days); } else if (days < 0) { dateTime = dateTime.minus(days); } return dateTime.toDate(); } public static Date toDate(final Date date, final int days) throws Exception { DateTime dateTime = toDateTime(date); if (days > 0) { dateTime = dateTime.plusDays(Math.abs(days)); } else if (days < 0) { dateTime = dateTime.minusDays(Math.abs(days)); } return dateTime.toDate(); } public static Date toDate(final String source) throws Exception { return toDateTime(source).toDate(); } public static DateTime toDateTime(final String source) throws Exception { DateTime parsed = null; if (source.length() == 8) { parsed = DateTime.parse(source, DATE_FORMATTER_NEW_YORK_WITHOUT_TIME); } else if (source.length() == 10) { parsed = DateTime.parse(source, DATE_FORMATTER_NEW_YORK_WITHOUT_TIME2); } else if (source.length() == 17) { parsed = DateTime.parse(source, DATE_FORMATTER_NEW_YORK_WITH_TIME); } else if (source.length() == 18) { parsed = toDateTime(sdf.parse(source)); } else { throw new Exception("Date format '" + source + "' not supported."); } return parsed; } public static boolean isToday(DateTime date) { DateTime now = toDateTime(); now = stripTime(now); date = stripTime(date); return date.equals(now); } public static boolean isLess(final Date date1, final Date date2) { if (date1 == null || date2 == null) { return false; } return date1.getTime() < date2.getTime(); } public static boolean isLessOrEqual(final Date date1, final Date date2) { if (date1 == null || date2 == null) { return false; } return date1.getTime() <= date2.getTime(); } public static boolean isGreater(final Date date1, final Date date2) { if (date1 == null || date2 == null) { return false; } return date1.getTime() > date2.getTime(); } public static boolean isGreaterOrEqual(final Date date1, final Date date2) { if (date1 == null || date2 == null) { return false; } return date1.getTime() >= date2.getTime(); } public static boolean isBetween(final Date date0, final Date date1, final Date date2) { if (date0 == null || date1 == null || date2 == null) { return false; } final long time0 = date0.getTime(); final long time1 = date1.getTime(); final long time2 = date2.getTime(); return time1 <= time0 && time0 <= time2; } public static void setDate(final Date date) throws Exception { if (date == null) { useDate = null; } else { useDate = toDateTime(date); } } public static void setDate(final String source) throws Exception { if (source == null) { useDate = null; } else { setDate(toDateTime(source).toDate()); } } public static boolean isToday(final Date date) { return isToday(toDateTime(date)); } public static Gson getGson() { final GsonBuilder builder = com.maintainer.util.Utils.getGsonBuilder(); final JsonSerializer<User> userSerializer = new JsonSerializer<User>() { @Override public JsonElement serialize(final User user, final Type typeOfSrc, final JsonSerializationContext context) { if (user == null) return null; final JsonObject object = new JsonObject(); if (user.getKey() != null) { object.add("id", new JsonPrimitive(user.getKey().toString())); } if (user.getUsername() != null) { object.add("username", new JsonPrimitive(user.getUsername())); } if (user.getAccountNumber() != null) { object.add("accountNumber", new JsonPrimitive(user.getAccountNumber())); } return object; } }; builder.registerTypeAdapter(User.class, userSerializer); return builder.create(); } public static Cursor getCursor(final String property, final String value, final String app, final String kind) throws Exception { final CompiledCursor compiledCursor = new DatastorePb.CompiledCursor(); final Position position = new DatastorePb.CompiledCursor.Position(); final PositionIndexValue positionIndexValue = new PositionIndexValue(); positionIndexValue.setProperty(property); final PropertyValue propertyValue = new PropertyValue(); propertyValue.setStringValue(value); positionIndexValue.setValue(propertyValue); position.addIndexValue(positionIndexValue); compiledCursor.setPosition(position); final Reference reference = new OnestoreEntity.Reference(); reference.setApp(app); final Path path = new OnestoreEntity.Path(); final Element element = new Path.Element(); element.setType(kind); element.setName(value); path.addElement(element); reference.setPath(path); position.setKey(reference); position.setStartInclusive(false); final Constructor<Cursor> constructor = Cursor.class.getDeclaredConstructor(DatastorePb.CompiledCursor.class); constructor.setAccessible(true); final Cursor cursor = constructor.newInstance(new Object[] { compiledCursor }); return cursor; } public static String getStackTrace(final Exception e) { final StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); final String stacktrace = sw.toString(); return stacktrace; } public static boolean isEmpty(final String string) { return string == null || string.trim().length() == 0; } public static String createTask(final MyResourceRouter router, final Request request, final String resourceName, final byte[] payload, final String mimeType) throws Exception { Method taskMethod = null; final org.restlet.data.Method method = request.getMethod(); if (method.equals(org.restlet.data.Method.POST)) { taskMethod = Method.POST; } else if (method.equals(org.restlet.data.Method.PUT)) { taskMethod = Method.PUT; } else if (method.equals(org.restlet.data.Method.GET)) { taskMethod = Method.GET; } return createTask(router, request, taskMethod, resourceName, payload, mimeType); } public static String createTask(final MyResourceRouter router, final Request request, final Method taskMethod, final String resourceName, final byte[] payload, final String mimeType) throws Exception { final String credentialsCookieName = router.getCrentialsCookieName(); final String cookie = request.getCookies().getFirstValue(credentialsCookieName); final String cookieHeader = credentialsCookieName + "=" + cookie; final String url = "/data/" + resourceName; return createTask(url, taskMethod, cookieHeader, payload, mimeType); } private static String createTask(final String url, final Method taskMethod, final String cookieHeader, final byte[] payload, final String mimeType) { final Map<String, String> headers = new HashMap<String, String>(); headers.put("Cookie", cookieHeader); final TaskOptions taskOptions = createTaskOptions(url, taskMethod, headers, payload, mimeType); return createTask(taskOptions); } public static String createTask(final TaskOptions taskOptions) { final Queue queue = QueueFactory.getDefaultQueue(); final TaskHandle handle = queue.add(taskOptions); return handle.toString(); } public static TaskOptions createTaskOptions(final String url, final Method taskMethod, final Map<String, String> headers, final byte[] payload, final String mimeType) { final TaskOptions taskOptions = TaskOptions.Builder.withUrl(url); taskOptions.method(taskMethod); taskOptions.retryOptions(RetryOptions.Builder.withTaskRetryLimit(0)); for (final Entry<String, String> e : headers.entrySet()) { final String key = e.getKey(); final String value = e.getValue(); taskOptions.header(key, value); } if (payload != null) { taskOptions.payload(payload, mimeType); } return taskOptions; } public static boolean isValid(final Object object) { return (object != null && !Undefined.class.isAssignableFrom(object.getClass()) && !object.equals(Double.NaN) && !object.equals(Double.POSITIVE_INFINITY) && !object.equals(Double.NEGATIVE_INFINITY) && !object.equals(UniqueTag.NOT_FOUND) && !object.equals(UniqueTag.NULL_VALUE)); } public static void severe(final Logger log, final Exception e) { log.severe(e.getMessage()); log.severe(getStackTrace(e)); } public static void severe(final Logger log, final String message) { log.severe(message); } @SuppressWarnings("unchecked") public static User getUser(final Key key) throws Exception { if (key == null) return null; final DataProvider<User> users = (DataProvider<User>) DataProviderFactory.instance().getDataProvider(User.class); final User user = users.get(key); return user; } public static List<String> getVariables(final Script script) throws Exception { final Class<? extends Script> scriptClass = script.getClass(); Field field = scriptClass.getDeclaredField("idata"); field.setAccessible(true); final DebuggableScript idata = (DebuggableScript) field.get(script); final Class<? extends DebuggableScript> idataClass = idata.getClass(); field = idataClass.getDeclaredField("itsStringTable"); field.setAccessible(true); String[] list = (String[]) field.get(idata); if (list != null) { final List<String> strings = new LinkedList<String>(Arrays.asList(list)); field = idataClass.getDeclaredField("argNames"); field.setAccessible(true); list = (String[]) field.get(idata); final List<String> args = new LinkedList<String>(Arrays.asList(list)); strings.removeAll(args); return strings; } return Collections.emptyList(); } public static String getResourceName(final Request request) { final ArrayList<Resource> resources = com.maintainer.util.Utils.getResources(request); final String resourceName = resources.get(0).getResource(); return resourceName; } @SuppressWarnings("unchecked") public static Key getSystemUserKey() throws Exception { if (systemUserKey != null) return systemUserKey; final MemcacheService cache = MyMemcacheServiceFactory.getMemcacheService(); Key key = (Key) cache.get(SYSTEM_USER_KEY); if (key == null) { final User system = getSystemUser(); if (system != null) { key = system.getKey(); cache.put(SYSTEM_USER_KEY, key); } } systemUserKey = key; return systemUserKey; } @SuppressWarnings("unchecked") public static User getSystemUser() throws Exception { if (systemUser != null) return systemUser; final MemcacheService cache = MyMemcacheServiceFactory.getMemcacheService(); User user = (User) cache.get(SYSTEM_USER); if (user == null) { final DataProvider<User> users = (DataProvider<User>) DataProviderFactory.instance().getDataProvider(User.class); final Query query = new Query(User.class); query.filter("username", SYSTEM_USERNAME); final List<User> list = users.find(query); if (!list.isEmpty()) { user = list.get(0); cache.put(SYSTEM_USER, user); } } systemUser = user; return systemUser; } private static Object convertToDoubleIfPossible(Object value) { try { value = com.maintainer.util.Utils.convert(value, Double.class); } catch (final Exception e) { // ignore this as it could be a formatted string } return value; } private static boolean hasChanged(final String s1, final String s2) { if (Utils.isEmpty(s1) && Utils.isEmpty(s2)) { return false; } else if (Utils.isEmpty(s1) && !Utils.isEmpty(s2)) { return true; } else if (!Utils.isEmpty(s1) && Utils.isEmpty(s2)) { return true; } return !s1.equals(s2); } public static String formatRestletCredentials(final String identifier, final char[] secret) throws GeneralSecurityException { // Data buffer final StringBuffer sb = new StringBuffer(); // Indexes buffer final StringBuffer isb = new StringBuffer(); final String timeIssued = Long.toString(System.currentTimeMillis()); int i = timeIssued.length(); sb.append(timeIssued); isb.append(i); sb.append('/'); sb.append(identifier); i += identifier.length() + 1; isb.append(',').append(i); sb.append('/'); sb.append(secret); // Store indexes at the end of the string sb.append('/'); sb.append(isb); return Base64.encode(CryptoUtils.encrypt("AES", "MyExtraSecretKey".getBytes(), sb.toString()), false); } public static String getUserIdCookie(final String userid) { final String cookie = MessageFormat.format("{0}={1}; path={2}; HttpOnly", "userid", userid, "/"); return cookie; } // From: // http://www.mkyong.com/regular-expressions/how-to-validate-email-address-with-regular-expression/ private static final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; private static final Pattern pattern = Pattern.compile(EMAIL_PATTERN); private static Matcher matcher; /** * Validate hex with regular expression * * @param hex * hex for validation * @return true valid hex, false invalid hex */ public static boolean isValidEmailAddress(final String hex) { matcher = pattern.matcher(hex); return matcher.matches(); } private static boolean initGlobalContextCalled = false; private static void initGlobalContext() { if (initGlobalContextCalled) return; initGlobalContextCalled = true; ContextFactory.initGlobal(new SandboxContextFactory(new SandboxShutter() { @Override public boolean allowClassAccess(final Class<?> type) { if ( type.getName().startsWith("java.lang") ) { return true; } return false; } @Override public boolean allowFieldAccess(final Class<?> type, final Object instance, final String fieldName) { return false; } @Override public boolean allowMethodAccess(final Class<?> type, final Object instance, final String methodName) { return true; } @Override public boolean allowStaticFieldAccess(final Class<?> type, final String fieldName) { return false; } @Override public boolean allowStaticMethodAccess(final Class<?> type, final String methodName) { return false; } })); }; public static Context getContext() { initGlobalContext(); final Context cx = Context.enter(); cx.setOptimizationLevel(-1); return cx; } public static void log(final String message, final Object...params) { // final Entity log = new Entity("Log"); // log.setUnindexedProperty("activity", MessageFormat.format(message, params)); // log.setUnindexedProperty("time", new Date().toString()); // DatastoreServiceFactory.getAsyncDatastoreService().put(log); } public static Object executeScript(final Script script, final TimerContext cx, final Scriptable scope, final long expires) { cx.startTimer(expires); return script.exec(cx, scope); } public static String getUniqueId() { final UUID uuid = java.util.UUID.randomUUID(); final String hash = uuid.toString(); return hash; } public static Object[] jsToJava(final NativeArray arr) { final Object [] array = new Object[(int) arr.getLength()]; for (final Object o : arr.getIds()) { final int index = (Integer) o; final Object object2 = arr.get(index, null); if (Utils.isValid(object2)) { array[index] = object2; } } return array; } @SuppressWarnings("rawtypes") public static void stripIds(Object o1) throws Exception { if (o1 == null) return; Class<? extends Object> clazz = o1.getClass(); if (Map.class.isAssignableFrom(clazz)) { o1 = ((Map) o1).values(); clazz = o1.getClass(); } if (Collection.class.isAssignableFrom(clazz)) { final Iterator iterator = ((Collection)o1).iterator(); while (iterator.hasNext()) { final Object o2 = iterator.next(); stripIds(o2); } } else if (EntityImpl.class.isAssignableFrom(clazz)){ final MyField field = com.maintainer.util.Utils.getField(o1, "id"); field.setAccessible(true); if (field != null) { field.set(o1, null); } final Field[] fields = clazz.getDeclaredFields(); for (final Field f : fields) { f.setAccessible(true); final Object o2 = f.get(o1); stripIds(o2); } } } public static void setUser(final Object target, final EntityImpl value) throws Exception { setProperty(target, value, "user"); } public static void setParent(final Object target, final EntityImpl value) throws Exception { setProperty(target, value, "parent"); } @SuppressWarnings("rawtypes") public static void setProperty(Object target, final EntityImpl value, final String fieldName) throws Exception { if (target == null) return; Class<? extends Object> clazz = target.getClass(); if (Map.class.isAssignableFrom(clazz)) { target = ((Map) target).values(); clazz = target.getClass(); } if (Collection.class.isAssignableFrom(clazz)) { final Iterator iterator = ((Collection)target).iterator(); while (iterator.hasNext()) { final Object o2 = iterator.next(); if (o2 != null && EntityImpl.class.isAssignableFrom(o2.getClass())) { setProperty(o2, value, fieldName); } } } else if (EntityImpl.class.isAssignableFrom(clazz)){ final MyField field = com.maintainer.util.Utils.getField(target, fieldName); field.setAccessible(true); if (field != null) { final Object existing = field.get(target); if (existing == null) { if (field.getType().isAssignableFrom(value.getClass())) { field.set(target, value); } } } final Field[] fields = clazz.getDeclaredFields(); for (final Field f : fields) { f.setAccessible(true); final Object o2 = f.get(target); setProperty(o2, value, fieldName); } } } public static String getExpires(final Date expiration) { final String expires = expiresSimpleDateFormat.format(expiration); return expires; } @SuppressWarnings("unchecked") public static User getUserByIdentifier(final String identifier) throws Exception { final MemcacheService cache = MyMemcacheServiceFactory.getMemcacheService(); User user = (User) cache.get(identifier); if (user == null) { final DataProvider<User> users = (DataProvider<User>) DataProviderFactory.instance().getDataProvider(com.nobodyelses.data.model.User.class); final Query q = new Query(User.class); q.filter("username", identifier); final List<User> list = users.find(q); if (!list.isEmpty()) { user = list.get(0); cache.put(identifier, user); } } return user; } public static void sendUnauthorized(final HttpServletResponse resp) throws Exception { sendUnauthorized(resp, "Credentials"); } public static void sendUnauthorized(final HttpServletResponse resp, final String credentialsCookieName) throws Exception { clearCredentialsCookie(resp, credentialsCookieName); //resp.addHeader("Set-Cookie", "userid=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT"); resp.setStatus(UNAUTHORIZED); resp.getOutputStream().write("Unauthorized".getBytes()); } public static void clearCredentialsCookie(final HttpServletResponse resp, final String credentialsCookieName) { resp.addHeader("Set-Cookie", credentialsCookieName + "=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT"); } public static String getBody(final HttpServletRequest req) throws IOException { String body = null; final ServletInputStream inputStream = req.getInputStream(); final java.util.Scanner scanner = new java.util.Scanner(inputStream); try { final Scanner useDelimiter = scanner.useDelimiter("\\A"); if (useDelimiter.hasNext()) { body = useDelimiter.next(); } } finally { scanner.close(); } return body; } }
[ "ashley@nobodyelses.com" ]
ashley@nobodyelses.com
590354d2b5dfd30b86f9eed7b92b75c81a2f2094
a52c2279788d46f3f8e919acfbce6daeaeb4513c
/src/main/java/com/ec/onlineplantnursery/service/ICustomerService.java
7ad123721f4023def9b1465d768bdd5004807c6b
[]
no_license
NagoluTejashwini/onlineNurser
8ec626b5cfe75605e7115b7cb6850b81626074ec
65a70ec6a65dcfef1d911890a424211c622f58be
refs/heads/master
2023-06-24T08:48:22.113080
2021-07-16T13:20:02
2021-07-16T13:20:02
380,239,207
1
0
null
null
null
null
UTF-8
Java
false
false
598
java
package com.ec.onlineplantnursery.service; import java.util.List; import com.ec.onlineplantnursery.entity.Customer; import com.ec.onlineplantnursery.exceptions.ResourceNotFoundException; public interface ICustomerService { Customer addCustomer(Customer customer); Customer updateCustomer(Customer tenant) throws ResourceNotFoundException; Customer deleteCustomer(Customer tenant) throws ResourceNotFoundException; Customer viewCustomer(int customerId) throws ResourceNotFoundException; List<Customer> viewAllCustomers(); boolean validateCustomer(String userName, String password); }
[ "nagolutejashwini065@gmail.com" ]
nagolutejashwini065@gmail.com
3eaf732471d0c1a7c6230a9e89c5566c05a8ebc1
5392007816a38b5494eed58e1d41a3fc99beb385
/src/main/java/tw/billy/servlet/GetUserVideoServlet.java
979133958ac6ba922fe6e6e2a289340059ef39ba
[]
no_license
Billychuan/KnowLife
a83b87ea6716d1aea46e2171b0b68de756a56bc1
45caa0d5c12953defd666d37217dd61a5d72e593
refs/heads/main
2023-08-30T07:52:00.506307
2021-11-08T08:29:15
2021-11-08T08:29:15
425,754,698
1
0
null
null
null
null
UTF-8
Java
false
false
1,618
java
package tw.billy.servlet; import java.io.IOException; import java.io.PrintWriter; import java.util.List; 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 com.google.gson.Gson; import com.google.gson.GsonBuilder; import tw.billy.model.UserDao; import tw.wsm.videoModel.VideoBean; @WebServlet("/GetUserVideoServlet") public class GetUserVideoServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.addHeader("Access-Control-Allow-Origin", "http://localhost:8080"); response.addHeader("Access-Control-Allow-Methods", "*"); response.addHeader("Access-Control-Allow-Headers", "Accept,Authorization,DNT,Content-Type,Referer,User-Agent"); response.addHeader("Access-Control-Allow-Credentials","true"); // 允許攜帶驗證資訊 request.setCharacterEncoding("UTF-8"); response.setContentType("application/json;charset=utf-8"); PrintWriter out = response.getWriter(); HttpSession session = request.getSession(false); Integer userId = (Integer)session.getAttribute("userId"); UserDao userDao = new UserDao(); List<VideoBean> list = userDao.getUserVideo(userId); Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create(); String listjson = gson.toJson(list); out.println(listjson); } }
[ "ljps50507@gmail.com" ]
ljps50507@gmail.com
2f927aa1cbd355185689c56a38f4e66903f9b73b
345fedb01a883c98a55fbd2d96cfc89db161318d
/bin/custom/keyruspoc/keyruspocinitialdata/gensrc/br/com/keyrus/poc/initialdata/constants/GeneratedKeyruspocInitialDataConstants.java
7db02e3ee3de97845e6d39cd0e4180186496bd90
[]
no_license
ironbats/keyrus-poc
81d695be0fabfb3db28eb14100a37f8e0118eeca
0f18b05c4c1aa02bb452e77ee7b366942058e9a9
refs/heads/master
2022-04-25T17:20:10.411146
2019-08-20T17:24:38
2019-08-20T17:24:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
666
java
/* * ---------------------------------------------------------------- * --- WARNING: THIS FILE IS GENERATED AND WILL BE OVERWRITTEN! --- * --- Generated at 15 de ago de 2019 11:26:17 --- * ---------------------------------------------------------------- */ package br.com.keyrus.poc.initialdata.constants; /** * @deprecated since ages - use constants in Model classes instead */ @Deprecated @SuppressWarnings({"unused","cast"}) public class GeneratedKeyruspocInitialDataConstants { public static final String EXTENSIONNAME = "keyruspocinitialdata"; protected GeneratedKeyruspocInitialDataConstants() { // private constructor } }
[ "felipe.rodrigues@keyrus.com.br" ]
felipe.rodrigues@keyrus.com.br