blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
list
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
gha_stargazers_count
int32
0
112k
gha_forks_count
int32
0
39.4k
gha_open_issues_count
int32
0
11k
gha_language
stringlengths
1
21
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
list
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
26ab6b55c7bfb7b580cea935af78fc8fae270dc8
18,038,862,695,502
f7a2f4fa4cd801e47ab7e711de170056131162c8
/src/main/java/ru/shift/chat/model/Message.java
3dfe75bd1ed245524577a7dd6a0e39597ffc48c2
[]
no_license
EnKarin/Chat
https://github.com/EnKarin/Chat
4345799bd830989e6417b452015f18a43d843476
a88f673c76406bdc59905c7106461389b12d51f8
refs/heads/master
2023-08-25T02:04:49.714000
2021-07-14T08:04:15
2021-07-14T08:04:15
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ru.shift.chat.model; import com.fasterxml.jackson.annotation.JsonIgnore; import io.swagger.annotations.ApiModelProperty; import javax.persistence.*; import java.util.List; @Entity @Table(name = "message") public class Message { @ApiModelProperty( value = "Message ID in the database. Not specified at creation", name = "messageId", dataType = "int", example = "1") @Id @GeneratedValue(strategy = GenerationType.AUTO) private int messageId; @ApiModelProperty( value = "User ID in the database", name = "userId", dataType = "int", example = "6") @Column private int userId; @ApiModelProperty( value = "Message text", name = "text", dataType = "String", example = "Hello!") @Column(length = 1500) private String text; @Column private String sendTime; @ApiModelProperty( value = "The lifetime of the message. If -1, then the time is not limited", name = "lifetimeSec", dataType = "int", example = "60") @Column @JsonIgnore private int lifetimeSec; @ManyToOne @JoinColumn(name = "chatId") @JsonIgnore private Chat chat; @OneToMany(mappedBy = "message") @JsonIgnore private List<Unchecked> unchecked; @Column private String attach; public String getAttach() { return attach; } public void setAttach(String attach) { this.attach = attach; } public void setChat(Chat chat) { this.chat = chat; } public Chat getChat() { return chat; } public void toUserView() { sendTime = sendTime.replace('T', ' '); } public int getMessageId() { return messageId; } public int getUserId() { return userId; } public void setUserId(int userId) { this.userId = userId; } public String getText() { return text; } public void setText(String text) { this.text = text; } public String getSendTime() { return sendTime; } public void setSendTime(String sendTime) { this.sendTime = sendTime; } public void setLifetimeSec(int lifetimeSec) { this.lifetimeSec = lifetimeSec; } public int getLifetimeSec() { return lifetimeSec; } }
UTF-8
Java
2,443
java
Message.java
Java
[]
null
[]
package ru.shift.chat.model; import com.fasterxml.jackson.annotation.JsonIgnore; import io.swagger.annotations.ApiModelProperty; import javax.persistence.*; import java.util.List; @Entity @Table(name = "message") public class Message { @ApiModelProperty( value = "Message ID in the database. Not specified at creation", name = "messageId", dataType = "int", example = "1") @Id @GeneratedValue(strategy = GenerationType.AUTO) private int messageId; @ApiModelProperty( value = "User ID in the database", name = "userId", dataType = "int", example = "6") @Column private int userId; @ApiModelProperty( value = "Message text", name = "text", dataType = "String", example = "Hello!") @Column(length = 1500) private String text; @Column private String sendTime; @ApiModelProperty( value = "The lifetime of the message. If -1, then the time is not limited", name = "lifetimeSec", dataType = "int", example = "60") @Column @JsonIgnore private int lifetimeSec; @ManyToOne @JoinColumn(name = "chatId") @JsonIgnore private Chat chat; @OneToMany(mappedBy = "message") @JsonIgnore private List<Unchecked> unchecked; @Column private String attach; public String getAttach() { return attach; } public void setAttach(String attach) { this.attach = attach; } public void setChat(Chat chat) { this.chat = chat; } public Chat getChat() { return chat; } public void toUserView() { sendTime = sendTime.replace('T', ' '); } public int getMessageId() { return messageId; } public int getUserId() { return userId; } public void setUserId(int userId) { this.userId = userId; } public String getText() { return text; } public void setText(String text) { this.text = text; } public String getSendTime() { return sendTime; } public void setSendTime(String sendTime) { this.sendTime = sendTime; } public void setLifetimeSec(int lifetimeSec) { this.lifetimeSec = lifetimeSec; } public int getLifetimeSec() { return lifetimeSec; } }
2,443
0.577569
0.573885
117
19.880342
16.782248
87
false
false
0
0
0
0
0
0
0.350427
false
false
7
f20bde21514bb17d67d98e23df542518b4851f39
27,719,718,989,587
fa5be1152df71446cff2406ab222a1cc07b1995d
/SpringDemo1/src/main/java/com/tsingkuo/webapp/aware/webApplicationContextAware.java
a58fe98e38d695fcfb00898a7249b6a9d44ab53c
[]
no_license
zackgq2009/imoocTest
https://github.com/zackgq2009/imoocTest
ff6df242e980ed6abdfe50a6ba82ea78ee933942
3271a8761ffc24cc3177bd7de628d6befb96763e
refs/heads/master
2021-09-02T12:13:52.714000
2018-01-02T13:54:03
2018-01-02T13:54:31
111,273,783
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tsingkuo.webapp.aware; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanNameAware; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; public class webApplicationContextAware implements ApplicationContextAware, BeanNameAware{ private String name; public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { System.out.println("setApplicationContext:" + applicationContext.getBean(this.name).hashCode()); } public void setBeanName(String name) { this.name = name; System.out.println("setBeanName:" + name); } }
UTF-8
Java
715
java
webApplicationContextAware.java
Java
[]
null
[]
package com.tsingkuo.webapp.aware; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanNameAware; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; public class webApplicationContextAware implements ApplicationContextAware, BeanNameAware{ private String name; public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { System.out.println("setApplicationContext:" + applicationContext.getBean(this.name).hashCode()); } public void setBeanName(String name) { this.name = name; System.out.println("setBeanName:" + name); } }
715
0.787413
0.787413
20
34.799999
33.980289
104
false
false
0
0
0
0
0
0
0.5
false
false
7
4b4dfc4a6998fa9e1667c4cedf52c21e16fd32a3
32,280,974,232,904
00ab80ff2ad9f057013add2df26ffda49614dd86
/netty-client/src/main/java/com/crwu/tool/netty/client/right/ReceiverPart.java
03b961b697e1a580fce0dad977079f79ea80fec9
[]
no_license
JavaRui/netty
https://github.com/JavaRui/netty
352f2a91b2e1b27664aa0f63dc4d5c171b5f74cb
0f592ff95a4fce4c304c4d03d75558dcfcf7f3de
refs/heads/master
2023-01-11T22:56:35.221000
2020-11-11T05:40:46
2020-11-11T05:40:46
311,640,856
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.crwu.tool.netty.client.right; import com.crwu.tool.netty.biz.protocol.IMMessage; import com.crwu.tool.netty.biz.protocol.IMP; import com.crwu.tool.netty.biz.receiver.ReceiverFace; import com.crwu.tool.netty.biz.receiver.ReceiverMgr; import com.crwu.tool.netty.biz.setting.GlobalSetting; import com.yt.tool.swt.base.SwtVoid; import com.yt.tool.swt.base.YtComposite; import com.yt.tool.swt.ui.text.YtText; import io.netty.channel.socket.nio.NioSocketChannel; import org.eclipse.swt.widgets.Composite; /** * @author wuchengrui * @Description: 接收消息的面板 * @date 2020/9/15 20:16 */ public class ReceiverPart extends YtComposite implements ReceiverFace { private YtText receiverText; public ReceiverPart(Composite parent, int style) { super(parent, style); init(); } private void init(){ receiverText = new YtText(this); receiverText.setGdFill(true,true); setGridLayout(); ReceiverMgr.setReceiver(this); } @Override public void receiverMsg(IMMessage msg) { SwtVoid.delayAsy(0,()->{ analysis(msg); }); } private void analysis(IMMessage msg) { if(IMP.LOGIN.getName().equals(msg.getCmd())){ //登录 analysisLogin(msg); } else if(IMP.LOGOUT.getName().equals(msg.getCmd())){ analysisLogout(msg); }else{ analysisChat(msg); } } private void analysisLogout(IMMessage msg) { receiverText.append(msg.getContent()+"\n"); } private void analysisLogin(IMMessage msg){ String say = "喜迎 [ %s ] 登录!!!!"; say= String.format(say,msg.getSender()); receiverText.append(say+"\n"); } private void analysisChat(IMMessage msg){ String say = "%s 说: %s"; if(msg.getSender().equals(GlobalSetting.getCreateClientVo().getNickName())){ say= String.format(say,"你",msg.getContent()); }else{ say = String.format(say,msg.getSender(),msg.getContent()); } receiverText.append(say+"\n"); } @Override public void setChannel(NioSocketChannel nioSocketChannel) { GlobalSetting.setNioSocketChannel(nioSocketChannel); } }
UTF-8
Java
2,287
java
ReceiverPart.java
Java
[ { "context": "org.eclipse.swt.widgets.Composite;\n\n/**\n * @author wuchengrui\n * @Description: 接收消息的面板\n * @date 2020/9/15 20:16", "end": 538, "score": 0.9996835589408875, "start": 528, "tag": "USERNAME", "value": "wuchengrui" } ]
null
[]
package com.crwu.tool.netty.client.right; import com.crwu.tool.netty.biz.protocol.IMMessage; import com.crwu.tool.netty.biz.protocol.IMP; import com.crwu.tool.netty.biz.receiver.ReceiverFace; import com.crwu.tool.netty.biz.receiver.ReceiverMgr; import com.crwu.tool.netty.biz.setting.GlobalSetting; import com.yt.tool.swt.base.SwtVoid; import com.yt.tool.swt.base.YtComposite; import com.yt.tool.swt.ui.text.YtText; import io.netty.channel.socket.nio.NioSocketChannel; import org.eclipse.swt.widgets.Composite; /** * @author wuchengrui * @Description: 接收消息的面板 * @date 2020/9/15 20:16 */ public class ReceiverPart extends YtComposite implements ReceiverFace { private YtText receiverText; public ReceiverPart(Composite parent, int style) { super(parent, style); init(); } private void init(){ receiverText = new YtText(this); receiverText.setGdFill(true,true); setGridLayout(); ReceiverMgr.setReceiver(this); } @Override public void receiverMsg(IMMessage msg) { SwtVoid.delayAsy(0,()->{ analysis(msg); }); } private void analysis(IMMessage msg) { if(IMP.LOGIN.getName().equals(msg.getCmd())){ //登录 analysisLogin(msg); } else if(IMP.LOGOUT.getName().equals(msg.getCmd())){ analysisLogout(msg); }else{ analysisChat(msg); } } private void analysisLogout(IMMessage msg) { receiverText.append(msg.getContent()+"\n"); } private void analysisLogin(IMMessage msg){ String say = "喜迎 [ %s ] 登录!!!!"; say= String.format(say,msg.getSender()); receiverText.append(say+"\n"); } private void analysisChat(IMMessage msg){ String say = "%s 说: %s"; if(msg.getSender().equals(GlobalSetting.getCreateClientVo().getNickName())){ say= String.format(say,"你",msg.getContent()); }else{ say = String.format(say,msg.getSender(),msg.getContent()); } receiverText.append(say+"\n"); } @Override public void setChannel(NioSocketChannel nioSocketChannel) { GlobalSetting.setNioSocketChannel(nioSocketChannel); } }
2,287
0.638184
0.632844
91
23.692308
22.406677
84
false
false
0
0
0
0
0
0
0.450549
false
false
7
5eac0ae534193a88547a0d27d1010b66933a2959
11,914,239,304,586
a9c70da8a69ad522ea5c38b7c818576f526e0bb8
/main/java/com/lastminute/model/PassengerType.java
a11f8310c89bfd3adbc137edb5a6837257696097
[]
no_license
moleisking/lastminute
https://github.com/moleisking/lastminute
710b6fe0a55c3413abc56e7ea4f95a728bc30c3a
987d8ba694ab78ff6a192e1910618c98e0bc948a
refs/heads/master
2020-05-07T09:18:46.977000
2019-04-09T13:50:08
2019-04-09T13:50:08
180,372,193
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lastminute.model; public enum PassengerType { ADULT, CHILD, INFANT; }
UTF-8
Java
87
java
PassengerType.java
Java
[]
null
[]
package com.lastminute.model; public enum PassengerType { ADULT, CHILD, INFANT; }
87
0.735632
0.735632
6
13.666667
13.38739
29
false
false
0
0
0
0
0
0
0.666667
false
false
7
7e15f43ab7cf2f6ae3df726c383de46e18a377b3
14,310,831,037,858
6db286e2336202ea37a088b820bc2972da246d9f
/utils-core/src/test/java/de/hegmanns/it/utis/core/commonobject/EqualsRepresentationFuerAbstractCommonObjectUnitTest.java
c6f4aa72b4d0a23a0f7714fc7a0da37198522542
[]
no_license
bhegmanns/utils-core
https://github.com/bhegmanns/utils-core
3c05965921c221aea9154811256283aca1a51853
8533122d3a6c7d00a8711a5f0583f3e79b881c0f
refs/heads/master
2016-09-06T15:35:26.511000
2015-03-27T22:59:05
2015-03-27T22:59:05
15,749,852
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.hegmanns.it.utis.core.commonobject; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; import org.junit.Before; import org.junit.Test; import de.hegmanns.it.utils.core.commonobject.AbstractCommonObject; import de.hegmanns.it.utils.core.commonobject.EqualsRepresentationField; import de.hegmanns.it.utils.core.commonobject.ToStringRepresentation; /** * Ein Smoketest fuer {@link AbstractCommonObject}. * * @author B. Hegmanns * */ public class EqualsRepresentationFuerAbstractCommonObjectUnitTest { private Testklasse testInstanz = new Testklasse(); @Before public void beforeAnyTest(){ testInstanz.setEqualsUndToStringRelevant("EqualsUndToStringRelevant"); testInstanz.setNichtRelevant("NichtRelevant"); testInstanz.setNurEqualsRelevant("NurEqualsRelevant"); testInstanz.setNurToStringRelevant("NurToStringRelevant"); } @Test public void toStringListetNurStringRelevanteAttribute() { String toStringAusgabe = testInstanz.toString(); System.out.println(">>> '" + toStringAusgabe + "'"); assertThat(toStringAusgabe, containsString("nurToStringRelevant=NurToStringRelevant")); assertThat(toStringAusgabe, containsString("equalsUndToStringRelevant=EqualsUndToStringRelevant")); assertThat(toStringAusgabe, not(containsString("nichtRelevant=NichtRelevant"))); assertThat(toStringAusgabe, not(containsString("nurEqualsRelevant=NurEqualsRelevant"))); } @Test public void toStringFunktioniertAuchBeiFalschenNamenInDefinition() { TestklasseMitFalschDeklariertemToStringRepresenationNamen instanz = new TestklasseMitFalschDeklariertemToStringRepresenationNamen(); instanz.setEqualsUndToStringRelevant("EqualsUndToStringRelevant"); instanz.setNichtRelevant("NichtRelevant"); instanz.setNurEqualsRelevant("NurEqualsRelevant"); instanz.setNurToStringRelevant("NurToStringRelevant"); String toStringAusgabe = instanz.toString(); System.out.println(">>> '" + toStringAusgabe + "'"); assertThat(toStringAusgabe, containsString("nurToStringRelevant=NurToStringRelevant")); assertThat(toStringAusgabe, not(containsString("equalsUndToStringRelevant=EqualsUndToStringRelevant"))); assertThat(toStringAusgabe, not(containsString("nichtRelevant=NichtRelevant"))); assertThat(toStringAusgabe, not(containsString("nurEqualsRelevant=NurEqualsRelevant"))); assertThat(toStringAusgabe, not(containsString("existiertNicht"))); } @Test public void equalsFunktioniert() throws CloneNotSupportedException{ Testklasse neueTestInstanz = (Testklasse) testInstanz.clone(); neueTestInstanz.setNichtRelevant(null); neueTestInstanz.setNurToStringRelevant(null); assertThat(neueTestInstanz==testInstanz, is(false)); assertThat(neueTestInstanz, equalTo(testInstanz)); } @Test public void equalsFunktioniert1() throws CloneNotSupportedException{ Testklasse neueTestInstanz = (Testklasse) testInstanz.clone(); neueTestInstanz.setNichtRelevant(null); neueTestInstanz.setNurToStringRelevant(null); neueTestInstanz.setEqualsUndToStringRelevant("A"); assertThat(neueTestInstanz==testInstanz, is(false)); assertThat(neueTestInstanz, not(equalTo(testInstanz))); } @Test public void equalsFunktioniert2() throws CloneNotSupportedException{ Testklasse neueTestInstanz = (Testklasse) testInstanz.clone(); neueTestInstanz.setNichtRelevant(null); neueTestInstanz.setNurToStringRelevant(null); neueTestInstanz.setNurEqualsRelevant("A"); assertThat(neueTestInstanz==testInstanz, is(false)); assertThat(neueTestInstanz, not(equalTo(testInstanz))); } @Test public void equalsFunktioniert3() throws CloneNotSupportedException{ Testklasse neueTestInstanz = (Testklasse) testInstanz.clone(); neueTestInstanz.setNichtRelevant(null); neueTestInstanz.setNurToStringRelevant(null); neueTestInstanz.setEqualsUndToStringRelevant("A"); neueTestInstanz.setNurEqualsRelevant("A"); assertThat(neueTestInstanz==testInstanz, is(false)); assertThat(neueTestInstanz, not(equalTo(testInstanz))); } @Test public void hashCodeFunktioniert(){ } }
UTF-8
Java
4,230
java
EqualsRepresentationFuerAbstractCommonObjectUnitTest.java
Java
[ { "context": " fuer {@link AbstractCommonObject}.\n * \n * @author B. Hegmanns\n *\n */\npublic class EqualsRepresentationFuerAbstr", "end": 623, "score": 0.9998219609260559, "start": 612, "tag": "NAME", "value": "B. Hegmanns" } ]
null
[]
package de.hegmanns.it.utis.core.commonobject; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; import org.junit.Before; import org.junit.Test; import de.hegmanns.it.utils.core.commonobject.AbstractCommonObject; import de.hegmanns.it.utils.core.commonobject.EqualsRepresentationField; import de.hegmanns.it.utils.core.commonobject.ToStringRepresentation; /** * Ein Smoketest fuer {@link AbstractCommonObject}. * * @author <NAME> * */ public class EqualsRepresentationFuerAbstractCommonObjectUnitTest { private Testklasse testInstanz = new Testklasse(); @Before public void beforeAnyTest(){ testInstanz.setEqualsUndToStringRelevant("EqualsUndToStringRelevant"); testInstanz.setNichtRelevant("NichtRelevant"); testInstanz.setNurEqualsRelevant("NurEqualsRelevant"); testInstanz.setNurToStringRelevant("NurToStringRelevant"); } @Test public void toStringListetNurStringRelevanteAttribute() { String toStringAusgabe = testInstanz.toString(); System.out.println(">>> '" + toStringAusgabe + "'"); assertThat(toStringAusgabe, containsString("nurToStringRelevant=NurToStringRelevant")); assertThat(toStringAusgabe, containsString("equalsUndToStringRelevant=EqualsUndToStringRelevant")); assertThat(toStringAusgabe, not(containsString("nichtRelevant=NichtRelevant"))); assertThat(toStringAusgabe, not(containsString("nurEqualsRelevant=NurEqualsRelevant"))); } @Test public void toStringFunktioniertAuchBeiFalschenNamenInDefinition() { TestklasseMitFalschDeklariertemToStringRepresenationNamen instanz = new TestklasseMitFalschDeklariertemToStringRepresenationNamen(); instanz.setEqualsUndToStringRelevant("EqualsUndToStringRelevant"); instanz.setNichtRelevant("NichtRelevant"); instanz.setNurEqualsRelevant("NurEqualsRelevant"); instanz.setNurToStringRelevant("NurToStringRelevant"); String toStringAusgabe = instanz.toString(); System.out.println(">>> '" + toStringAusgabe + "'"); assertThat(toStringAusgabe, containsString("nurToStringRelevant=NurToStringRelevant")); assertThat(toStringAusgabe, not(containsString("equalsUndToStringRelevant=EqualsUndToStringRelevant"))); assertThat(toStringAusgabe, not(containsString("nichtRelevant=NichtRelevant"))); assertThat(toStringAusgabe, not(containsString("nurEqualsRelevant=NurEqualsRelevant"))); assertThat(toStringAusgabe, not(containsString("existiertNicht"))); } @Test public void equalsFunktioniert() throws CloneNotSupportedException{ Testklasse neueTestInstanz = (Testklasse) testInstanz.clone(); neueTestInstanz.setNichtRelevant(null); neueTestInstanz.setNurToStringRelevant(null); assertThat(neueTestInstanz==testInstanz, is(false)); assertThat(neueTestInstanz, equalTo(testInstanz)); } @Test public void equalsFunktioniert1() throws CloneNotSupportedException{ Testklasse neueTestInstanz = (Testklasse) testInstanz.clone(); neueTestInstanz.setNichtRelevant(null); neueTestInstanz.setNurToStringRelevant(null); neueTestInstanz.setEqualsUndToStringRelevant("A"); assertThat(neueTestInstanz==testInstanz, is(false)); assertThat(neueTestInstanz, not(equalTo(testInstanz))); } @Test public void equalsFunktioniert2() throws CloneNotSupportedException{ Testklasse neueTestInstanz = (Testklasse) testInstanz.clone(); neueTestInstanz.setNichtRelevant(null); neueTestInstanz.setNurToStringRelevant(null); neueTestInstanz.setNurEqualsRelevant("A"); assertThat(neueTestInstanz==testInstanz, is(false)); assertThat(neueTestInstanz, not(equalTo(testInstanz))); } @Test public void equalsFunktioniert3() throws CloneNotSupportedException{ Testklasse neueTestInstanz = (Testklasse) testInstanz.clone(); neueTestInstanz.setNichtRelevant(null); neueTestInstanz.setNurToStringRelevant(null); neueTestInstanz.setEqualsUndToStringRelevant("A"); neueTestInstanz.setNurEqualsRelevant("A"); assertThat(neueTestInstanz==testInstanz, is(false)); assertThat(neueTestInstanz, not(equalTo(testInstanz))); } @Test public void hashCodeFunktioniert(){ } }
4,225
0.806856
0.806147
115
35.773914
31.223196
134
false
false
0
0
0
0
0
0
1.869565
false
false
7
c3b187869beec217ec0ab181a9050ceeac74658d
936,302,889,427
038ee6b20cae51169a2ed4ed64a7b8e99b5cbaad
/schemaOrgDomaConv/src/org/kyojo/schemaOrg/m3n3/doma/core/container/DropoffLocationConverter.java
eda8407d3146d3856ed094157d0153004d3952fe
[ "Apache-2.0" ]
permissive
nagaikenshin/schemaOrg
https://github.com/nagaikenshin/schemaOrg
3dec1626781913930da5585884e3484e0b525aea
4c9d6d098a2741c2dc2a814f1c708ee55c36e9a8
refs/heads/master
2021-06-25T04:52:49.995000
2019-05-12T06:22:37
2019-05-12T06:22:37
134,319,974
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.kyojo.schemaorg.m3n3.doma.core.container; import org.seasar.doma.ExternalDomain; import org.seasar.doma.jdbc.domain.DomainConverter; import org.kyojo.schemaorg.m3n3.core.impl.DROPOFF_LOCATION; import org.kyojo.schemaorg.m3n3.core.Container.DropoffLocation; @ExternalDomain public class DropoffLocationConverter implements DomainConverter<DropoffLocation, String> { @Override public String fromDomainToValue(DropoffLocation domain) { return domain.getNativeValue(); } @Override public DropoffLocation fromValueToDomain(String value) { return new DROPOFF_LOCATION(value); } }
UTF-8
Java
602
java
DropoffLocationConverter.java
Java
[]
null
[]
package org.kyojo.schemaorg.m3n3.doma.core.container; import org.seasar.doma.ExternalDomain; import org.seasar.doma.jdbc.domain.DomainConverter; import org.kyojo.schemaorg.m3n3.core.impl.DROPOFF_LOCATION; import org.kyojo.schemaorg.m3n3.core.Container.DropoffLocation; @ExternalDomain public class DropoffLocationConverter implements DomainConverter<DropoffLocation, String> { @Override public String fromDomainToValue(DropoffLocation domain) { return domain.getNativeValue(); } @Override public DropoffLocation fromValueToDomain(String value) { return new DROPOFF_LOCATION(value); } }
602
0.817276
0.807309
22
26.363636
27.633223
91
false
false
0
0
0
0
0
0
0.818182
false
false
7
4440f988c739192aed134f7424e5fc21797fd1ad
1,168,231,168,217
3d62f0ffc02c8e1f20905d8aedf462dd128f6a8c
/src/main/java/com/example/securudemo/service/history/HistoryProjectServiceImpl.java
426f0172b47d75f7e4e07dad174a022f8721739d
[]
no_license
irsatkayad1/test-management
https://github.com/irsatkayad1/test-management
0a6bcfe5b884d2d91c1eabeb727463c9caa693ef
9522ddfaec8c14db19361db729aff41ebcbc7596
refs/heads/master
2020-07-28T21:43:23
2019-09-27T11:55:29
2019-09-27T11:55:29
209,547,882
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.securudemo.service.history; import java.util.Date; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.example.securudemo.model.history.HistoryProject; import com.example.securudemo.model.project.Project; import com.example.securudemo.model.role.User; import com.example.securudemo.repository.history.HistoryProjectRepository; @Service public class HistoryProjectServiceImpl implements HistoryProjectService{ @Autowired HistoryProjectRepository historyProjectRepository; @Override public void createProject(Project project, User user) { HistoryProject hp = new HistoryProject(project, new Date(System.currentTimeMillis()), user, "create"); historyProjectRepository.save(hp); } @Override public void deleteProject(Project project, User user) { /*proje delete olursa bağlı tablodaki verilerinde silinmesi gerekir. delete edilmeden önce history'e eklenmesi gerekir*/ HistoryProject hp = new HistoryProject(project, new Date(System.currentTimeMillis()), user, "delete"); historyProjectRepository.save(hp); } @Override public List<HistoryProject> findByProjectName(String projectName) { //görüntüleyenler için history tutulacak mı? return historyProjectRepository.findByProjectName(projectName); } @Override public void updateProject(Project project, User user) { HistoryProject hp = new HistoryProject(project, new Date(System.currentTimeMillis()), user, "update"); historyProjectRepository.save(hp); } }
UTF-8
Java
1,591
java
HistoryProjectServiceImpl.java
Java
[]
null
[]
package com.example.securudemo.service.history; import java.util.Date; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.example.securudemo.model.history.HistoryProject; import com.example.securudemo.model.project.Project; import com.example.securudemo.model.role.User; import com.example.securudemo.repository.history.HistoryProjectRepository; @Service public class HistoryProjectServiceImpl implements HistoryProjectService{ @Autowired HistoryProjectRepository historyProjectRepository; @Override public void createProject(Project project, User user) { HistoryProject hp = new HistoryProject(project, new Date(System.currentTimeMillis()), user, "create"); historyProjectRepository.save(hp); } @Override public void deleteProject(Project project, User user) { /*proje delete olursa bağlı tablodaki verilerinde silinmesi gerekir. delete edilmeden önce history'e eklenmesi gerekir*/ HistoryProject hp = new HistoryProject(project, new Date(System.currentTimeMillis()), user, "delete"); historyProjectRepository.save(hp); } @Override public List<HistoryProject> findByProjectName(String projectName) { //görüntüleyenler için history tutulacak mı? return historyProjectRepository.findByProjectName(projectName); } @Override public void updateProject(Project project, User user) { HistoryProject hp = new HistoryProject(project, new Date(System.currentTimeMillis()), user, "update"); historyProjectRepository.save(hp); } }
1,591
0.794694
0.794694
56
27.267857
31.114128
104
false
false
0
0
0
0
0
0
1.410714
false
false
7
a16c4d50376b6546f48f0846fbe268f084f7ea35
25,451,976,210,753
f2db200edc87653aaa446905e1782ac6b8b04b55
/main4-item/main4-item-default/src/main/java/com/opentae/data/mall/examples/ShiguGoodsSingleSkuExample.java
d1284a6190039525ecba789db7d1e8b7c6ddd186
[]
no_license
moutainhigh/main-pom
https://github.com/moutainhigh/main-pom
4f5deada05053dd4d25675b6fd49b8829b435dff
dbe6b45afc1ecd1afde1c93826c35f2d38623dab
refs/heads/master
2021-09-26T23:17:28.986000
2018-10-31T06:39:14
2018-10-31T06:39:14
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.opentae.data.mall.examples; import com.opentae.core.mybatis.SgExample; import com.opentae.core.mybatis.example.EntityColumn; import com.opentae.core.mybatis.example.EntityTable; import com.opentae.core.mybatis.mapperhelper.EntityHelper; import com.opentae.data.mall.beans.ShiguGoodsSingleSku; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; public class ShiguGoodsSingleSkuExample extends SgExample<ShiguGoodsSingleSkuExample.Criteria> { public static final Class<ShiguGoodsSingleSku> beanClass = ShiguGoodsSingleSku.class; public static final EntityTable entityTable = EntityHelper.getEntityTable(beanClass); public static EntityColumn colorName; public static EntityColumn priceString; public static EntityColumn goodsId; public static EntityColumn colorVid; public static EntityColumn sizeInputStr; public static EntityColumn colorPropertyAlias; public static EntityColumn colorPid; public static EntityColumn colorInputStr; public static EntityColumn sizeVid; public static EntityColumn sizeName; public static EntityColumn sizePid; public static EntityColumn stockNum; public static EntityColumn sizePropertyAlias; public static EntityColumn skuId; public static EntityColumn status; static { Set<EntityColumn> columns = entityTable.getEntityClassColumns(); Map<String, EntityColumn> listMap = new HashMap<>(); for (EntityColumn column : columns) { listMap.put(column.getProperty(), column); } colorName = listMap.get("colorName"); priceString = listMap.get("priceString"); goodsId = listMap.get("goodsId"); colorVid = listMap.get("colorVid"); sizeInputStr = listMap.get("sizeInputStr"); colorPropertyAlias = listMap.get("colorPropertyAlias"); colorPid = listMap.get("colorPid"); colorInputStr = listMap.get("colorInputStr"); sizeVid = listMap.get("sizeVid"); sizeName = listMap.get("sizeName"); sizePid = listMap.get("sizePid"); stockNum = listMap.get("stockNum"); sizePropertyAlias = listMap.get("sizePropertyAlias"); skuId = listMap.get("skuId"); status = listMap.get("status"); } public ShiguGoodsSingleSkuExample() { this.setTableAlias(entityTable.getName()); } @Override public EntityTable getEntityTable() { return entityTable; } @Override protected ShiguGoodsSingleSkuExample.Criteria createCriteriaInternal() { return new ShiguGoodsSingleSkuExample.Criteria(this); } public static class Criteria extends SgExample.GeneratedCriteria<Criteria> { protected Criteria(SgExample example) { super(example); } public ShiguGoodsSingleSkuExample.Criteria andColorNameIsNull() { return isNull(colorName); } public ShiguGoodsSingleSkuExample.Criteria andColorNameIsNotNull() { return isNotNull(colorName); } public ShiguGoodsSingleSkuExample.Criteria andColorNameEqualTo(String value) { return equalTo(colorName, value); } public ShiguGoodsSingleSkuExample.Criteria andColorNameNotEqualTo(String value) { return notEqualTo(colorName, value); } public ShiguGoodsSingleSkuExample.Criteria andColorNameGreaterThan(String value) { return greaterThan(colorName, value); } public ShiguGoodsSingleSkuExample.Criteria andColorNameGreaterThanOrEqualTo(String value) { return greaterThanOrEqualTo(colorName, value); } public ShiguGoodsSingleSkuExample.Criteria andColorNameLessThan(String value) { return lessThan(colorName, value); } public ShiguGoodsSingleSkuExample.Criteria andColorNameLessThanOrEqualTo(String value) { return lessThanOrEqualTo(colorName, value); } public ShiguGoodsSingleSkuExample.Criteria andColorNameLike(String value) { return like(colorName, value); } public ShiguGoodsSingleSkuExample.Criteria andColorNameNotLike(String value) { return notLike(colorName, value); } public ShiguGoodsSingleSkuExample.Criteria andColorNameIn(List<String> values) { return in(colorName, values); } public ShiguGoodsSingleSkuExample.Criteria andColorNameNotIn(List<String> values) { return notIn(colorName, values); } public ShiguGoodsSingleSkuExample.Criteria andColorNameBetween(String value1, String value2) { return between(colorName, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andColorNameNotBetween(String value1, String value2) { return notBetween(colorName, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringIsNull() { return isNull(priceString); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringIsNotNull() { return isNotNull(priceString); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringEqualTo(String value) { return equalTo(priceString, value); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringNotEqualTo(String value) { return notEqualTo(priceString, value); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringGreaterThan(String value) { return greaterThan(priceString, value); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringGreaterThanOrEqualTo(String value) { return greaterThanOrEqualTo(priceString, value); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringLessThan(String value) { return lessThan(priceString, value); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringLessThanOrEqualTo(String value) { return lessThanOrEqualTo(priceString, value); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringLike(String value) { return like(priceString, value); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringNotLike(String value) { return notLike(priceString, value); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringIn(List<String> values) { return in(priceString, values); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringNotIn(List<String> values) { return notIn(priceString, values); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringBetween(String value1, String value2) { return between(priceString, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringNotBetween(String value1, String value2) { return notBetween(priceString, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdIsNull() { return isNull(goodsId); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdIsNotNull() { return isNotNull(goodsId); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdEqualTo(Long value) { return equalTo(goodsId, value); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdNotEqualTo(Long value) { return notEqualTo(goodsId, value); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdGreaterThan(Long value) { return greaterThan(goodsId, value); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdGreaterThanOrEqualTo(Long value) { return greaterThanOrEqualTo(goodsId, value); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdLessThan(Long value) { return lessThan(goodsId, value); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdLessThanOrEqualTo(Long value) { return lessThanOrEqualTo(goodsId, value); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdIn(List<Long> values) { return in(goodsId, values); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdNotIn(List<Long> values) { return notIn(goodsId, values); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdBetween(Long value1, Long value2) { return between(goodsId, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdNotBetween(Long value1, Long value2) { return notBetween(goodsId, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andColorVidIsNull() { return isNull(colorVid); } public ShiguGoodsSingleSkuExample.Criteria andColorVidIsNotNull() { return isNotNull(colorVid); } public ShiguGoodsSingleSkuExample.Criteria andColorVidEqualTo(Long value) { return equalTo(colorVid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorVidNotEqualTo(Long value) { return notEqualTo(colorVid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorVidGreaterThan(Long value) { return greaterThan(colorVid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorVidGreaterThanOrEqualTo(Long value) { return greaterThanOrEqualTo(colorVid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorVidLessThan(Long value) { return lessThan(colorVid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorVidLessThanOrEqualTo(Long value) { return lessThanOrEqualTo(colorVid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorVidIn(List<Long> values) { return in(colorVid, values); } public ShiguGoodsSingleSkuExample.Criteria andColorVidNotIn(List<Long> values) { return notIn(colorVid, values); } public ShiguGoodsSingleSkuExample.Criteria andColorVidBetween(Long value1, Long value2) { return between(colorVid, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andColorVidNotBetween(Long value1, Long value2) { return notBetween(colorVid, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrIsNull() { return isNull(sizeInputStr); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrIsNotNull() { return isNotNull(sizeInputStr); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrEqualTo(String value) { return equalTo(sizeInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrNotEqualTo(String value) { return notEqualTo(sizeInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrGreaterThan(String value) { return greaterThan(sizeInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrGreaterThanOrEqualTo(String value) { return greaterThanOrEqualTo(sizeInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrLessThan(String value) { return lessThan(sizeInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrLessThanOrEqualTo(String value) { return lessThanOrEqualTo(sizeInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrLike(String value) { return like(sizeInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrNotLike(String value) { return notLike(sizeInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrIn(List<String> values) { return in(sizeInputStr, values); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrNotIn(List<String> values) { return notIn(sizeInputStr, values); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrBetween(String value1, String value2) { return between(sizeInputStr, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrNotBetween(String value1, String value2) { return notBetween(sizeInputStr, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasIsNull() { return isNull(colorPropertyAlias); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasIsNotNull() { return isNotNull(colorPropertyAlias); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasEqualTo(String value) { return equalTo(colorPropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasNotEqualTo(String value) { return notEqualTo(colorPropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasGreaterThan(String value) { return greaterThan(colorPropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasGreaterThanOrEqualTo(String value) { return greaterThanOrEqualTo(colorPropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasLessThan(String value) { return lessThan(colorPropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasLessThanOrEqualTo(String value) { return lessThanOrEqualTo(colorPropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasLike(String value) { return like(colorPropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasNotLike(String value) { return notLike(colorPropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasIn(List<String> values) { return in(colorPropertyAlias, values); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasNotIn(List<String> values) { return notIn(colorPropertyAlias, values); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasBetween(String value1, String value2) { return between(colorPropertyAlias, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasNotBetween(String value1, String value2) { return notBetween(colorPropertyAlias, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andColorPidIsNull() { return isNull(colorPid); } public ShiguGoodsSingleSkuExample.Criteria andColorPidIsNotNull() { return isNotNull(colorPid); } public ShiguGoodsSingleSkuExample.Criteria andColorPidEqualTo(Long value) { return equalTo(colorPid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPidNotEqualTo(Long value) { return notEqualTo(colorPid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPidGreaterThan(Long value) { return greaterThan(colorPid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPidGreaterThanOrEqualTo(Long value) { return greaterThanOrEqualTo(colorPid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPidLessThan(Long value) { return lessThan(colorPid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPidLessThanOrEqualTo(Long value) { return lessThanOrEqualTo(colorPid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPidIn(List<Long> values) { return in(colorPid, values); } public ShiguGoodsSingleSkuExample.Criteria andColorPidNotIn(List<Long> values) { return notIn(colorPid, values); } public ShiguGoodsSingleSkuExample.Criteria andColorPidBetween(Long value1, Long value2) { return between(colorPid, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andColorPidNotBetween(Long value1, Long value2) { return notBetween(colorPid, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrIsNull() { return isNull(colorInputStr); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrIsNotNull() { return isNotNull(colorInputStr); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrEqualTo(String value) { return equalTo(colorInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrNotEqualTo(String value) { return notEqualTo(colorInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrGreaterThan(String value) { return greaterThan(colorInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrGreaterThanOrEqualTo(String value) { return greaterThanOrEqualTo(colorInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrLessThan(String value) { return lessThan(colorInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrLessThanOrEqualTo(String value) { return lessThanOrEqualTo(colorInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrLike(String value) { return like(colorInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrNotLike(String value) { return notLike(colorInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrIn(List<String> values) { return in(colorInputStr, values); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrNotIn(List<String> values) { return notIn(colorInputStr, values); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrBetween(String value1, String value2) { return between(colorInputStr, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrNotBetween(String value1, String value2) { return notBetween(colorInputStr, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidIsNull() { return isNull(sizeVid); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidIsNotNull() { return isNotNull(sizeVid); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidEqualTo(Long value) { return equalTo(sizeVid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidNotEqualTo(Long value) { return notEqualTo(sizeVid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidGreaterThan(Long value) { return greaterThan(sizeVid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidGreaterThanOrEqualTo(Long value) { return greaterThanOrEqualTo(sizeVid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidLessThan(Long value) { return lessThan(sizeVid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidLessThanOrEqualTo(Long value) { return lessThanOrEqualTo(sizeVid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidIn(List<Long> values) { return in(sizeVid, values); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidNotIn(List<Long> values) { return notIn(sizeVid, values); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidBetween(Long value1, Long value2) { return between(sizeVid, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidNotBetween(Long value1, Long value2) { return notBetween(sizeVid, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameIsNull() { return isNull(sizeName); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameIsNotNull() { return isNotNull(sizeName); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameEqualTo(String value) { return equalTo(sizeName, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameNotEqualTo(String value) { return notEqualTo(sizeName, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameGreaterThan(String value) { return greaterThan(sizeName, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameGreaterThanOrEqualTo(String value) { return greaterThanOrEqualTo(sizeName, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameLessThan(String value) { return lessThan(sizeName, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameLessThanOrEqualTo(String value) { return lessThanOrEqualTo(sizeName, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameLike(String value) { return like(sizeName, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameNotLike(String value) { return notLike(sizeName, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameIn(List<String> values) { return in(sizeName, values); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameNotIn(List<String> values) { return notIn(sizeName, values); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameBetween(String value1, String value2) { return between(sizeName, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameNotBetween(String value1, String value2) { return notBetween(sizeName, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSizePidIsNull() { return isNull(sizePid); } public ShiguGoodsSingleSkuExample.Criteria andSizePidIsNotNull() { return isNotNull(sizePid); } public ShiguGoodsSingleSkuExample.Criteria andSizePidEqualTo(Long value) { return equalTo(sizePid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePidNotEqualTo(Long value) { return notEqualTo(sizePid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePidGreaterThan(Long value) { return greaterThan(sizePid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePidGreaterThanOrEqualTo(Long value) { return greaterThanOrEqualTo(sizePid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePidLessThan(Long value) { return lessThan(sizePid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePidLessThanOrEqualTo(Long value) { return lessThanOrEqualTo(sizePid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePidIn(List<Long> values) { return in(sizePid, values); } public ShiguGoodsSingleSkuExample.Criteria andSizePidNotIn(List<Long> values) { return notIn(sizePid, values); } public ShiguGoodsSingleSkuExample.Criteria andSizePidBetween(Long value1, Long value2) { return between(sizePid, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSizePidNotBetween(Long value1, Long value2) { return notBetween(sizePid, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andStockNumIsNull() { return isNull(stockNum); } public ShiguGoodsSingleSkuExample.Criteria andStockNumIsNotNull() { return isNotNull(stockNum); } public ShiguGoodsSingleSkuExample.Criteria andStockNumEqualTo(Integer value) { return equalTo(stockNum, value); } public ShiguGoodsSingleSkuExample.Criteria andStockNumNotEqualTo(Integer value) { return notEqualTo(stockNum, value); } public ShiguGoodsSingleSkuExample.Criteria andStockNumGreaterThan(Integer value) { return greaterThan(stockNum, value); } public ShiguGoodsSingleSkuExample.Criteria andStockNumGreaterThanOrEqualTo(Integer value) { return greaterThanOrEqualTo(stockNum, value); } public ShiguGoodsSingleSkuExample.Criteria andStockNumLessThan(Integer value) { return lessThan(stockNum, value); } public ShiguGoodsSingleSkuExample.Criteria andStockNumLessThanOrEqualTo(Integer value) { return lessThanOrEqualTo(stockNum, value); } public ShiguGoodsSingleSkuExample.Criteria andStockNumIn(List<Integer> values) { return in(stockNum, values); } public ShiguGoodsSingleSkuExample.Criteria andStockNumNotIn(List<Integer> values) { return notIn(stockNum, values); } public ShiguGoodsSingleSkuExample.Criteria andStockNumBetween(Integer value1, Integer value2) { return between(stockNum, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andStockNumNotBetween(Integer value1, Integer value2) { return notBetween(stockNum, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasIsNull() { return isNull(sizePropertyAlias); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasIsNotNull() { return isNotNull(sizePropertyAlias); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasEqualTo(String value) { return equalTo(sizePropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasNotEqualTo(String value) { return notEqualTo(sizePropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasGreaterThan(String value) { return greaterThan(sizePropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasGreaterThanOrEqualTo(String value) { return greaterThanOrEqualTo(sizePropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasLessThan(String value) { return lessThan(sizePropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasLessThanOrEqualTo(String value) { return lessThanOrEqualTo(sizePropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasLike(String value) { return like(sizePropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasNotLike(String value) { return notLike(sizePropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasIn(List<String> values) { return in(sizePropertyAlias, values); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasNotIn(List<String> values) { return notIn(sizePropertyAlias, values); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasBetween(String value1, String value2) { return between(sizePropertyAlias, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasNotBetween(String value1, String value2) { return notBetween(sizePropertyAlias, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdIsNull() { return isNull(skuId); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdIsNotNull() { return isNotNull(skuId); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdEqualTo(Long value) { return equalTo(skuId, value); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdNotEqualTo(Long value) { return notEqualTo(skuId, value); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdGreaterThan(Long value) { return greaterThan(skuId, value); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdGreaterThanOrEqualTo(Long value) { return greaterThanOrEqualTo(skuId, value); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdLessThan(Long value) { return lessThan(skuId, value); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdLessThanOrEqualTo(Long value) { return lessThanOrEqualTo(skuId, value); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdIn(List<Long> values) { return in(skuId, values); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdNotIn(List<Long> values) { return notIn(skuId, values); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdBetween(Long value1, Long value2) { return between(skuId, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdNotBetween(Long value1, Long value2) { return notBetween(skuId, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andStatusIsNull() { return isNull(status); } public ShiguGoodsSingleSkuExample.Criteria andStatusIsNotNull() { return isNotNull(status); } public ShiguGoodsSingleSkuExample.Criteria andStatusEqualTo(Integer value) { return equalTo(status, value); } public ShiguGoodsSingleSkuExample.Criteria andStatusNotEqualTo(Integer value) { return notEqualTo(status, value); } public ShiguGoodsSingleSkuExample.Criteria andStatusGreaterThan(Integer value) { return greaterThan(status, value); } public ShiguGoodsSingleSkuExample.Criteria andStatusGreaterThanOrEqualTo(Integer value) { return greaterThanOrEqualTo(status, value); } public ShiguGoodsSingleSkuExample.Criteria andStatusLessThan(Integer value) { return lessThan(status, value); } public ShiguGoodsSingleSkuExample.Criteria andStatusLessThanOrEqualTo(Integer value) { return lessThanOrEqualTo(status, value); } public ShiguGoodsSingleSkuExample.Criteria andStatusIn(List<Integer> values) { return in(status, values); } public ShiguGoodsSingleSkuExample.Criteria andStatusNotIn(List<Integer> values) { return notIn(status, values); } public ShiguGoodsSingleSkuExample.Criteria andStatusBetween(Integer value1, Integer value2) { return between(status, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andStatusNotBetween(Integer value1, Integer value2) { return notBetween(status, value1, value2); } } }
UTF-8
Java
32,154
java
ShiguGoodsSingleSkuExample.java
Java
[]
null
[]
package com.opentae.data.mall.examples; import com.opentae.core.mybatis.SgExample; import com.opentae.core.mybatis.example.EntityColumn; import com.opentae.core.mybatis.example.EntityTable; import com.opentae.core.mybatis.mapperhelper.EntityHelper; import com.opentae.data.mall.beans.ShiguGoodsSingleSku; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; public class ShiguGoodsSingleSkuExample extends SgExample<ShiguGoodsSingleSkuExample.Criteria> { public static final Class<ShiguGoodsSingleSku> beanClass = ShiguGoodsSingleSku.class; public static final EntityTable entityTable = EntityHelper.getEntityTable(beanClass); public static EntityColumn colorName; public static EntityColumn priceString; public static EntityColumn goodsId; public static EntityColumn colorVid; public static EntityColumn sizeInputStr; public static EntityColumn colorPropertyAlias; public static EntityColumn colorPid; public static EntityColumn colorInputStr; public static EntityColumn sizeVid; public static EntityColumn sizeName; public static EntityColumn sizePid; public static EntityColumn stockNum; public static EntityColumn sizePropertyAlias; public static EntityColumn skuId; public static EntityColumn status; static { Set<EntityColumn> columns = entityTable.getEntityClassColumns(); Map<String, EntityColumn> listMap = new HashMap<>(); for (EntityColumn column : columns) { listMap.put(column.getProperty(), column); } colorName = listMap.get("colorName"); priceString = listMap.get("priceString"); goodsId = listMap.get("goodsId"); colorVid = listMap.get("colorVid"); sizeInputStr = listMap.get("sizeInputStr"); colorPropertyAlias = listMap.get("colorPropertyAlias"); colorPid = listMap.get("colorPid"); colorInputStr = listMap.get("colorInputStr"); sizeVid = listMap.get("sizeVid"); sizeName = listMap.get("sizeName"); sizePid = listMap.get("sizePid"); stockNum = listMap.get("stockNum"); sizePropertyAlias = listMap.get("sizePropertyAlias"); skuId = listMap.get("skuId"); status = listMap.get("status"); } public ShiguGoodsSingleSkuExample() { this.setTableAlias(entityTable.getName()); } @Override public EntityTable getEntityTable() { return entityTable; } @Override protected ShiguGoodsSingleSkuExample.Criteria createCriteriaInternal() { return new ShiguGoodsSingleSkuExample.Criteria(this); } public static class Criteria extends SgExample.GeneratedCriteria<Criteria> { protected Criteria(SgExample example) { super(example); } public ShiguGoodsSingleSkuExample.Criteria andColorNameIsNull() { return isNull(colorName); } public ShiguGoodsSingleSkuExample.Criteria andColorNameIsNotNull() { return isNotNull(colorName); } public ShiguGoodsSingleSkuExample.Criteria andColorNameEqualTo(String value) { return equalTo(colorName, value); } public ShiguGoodsSingleSkuExample.Criteria andColorNameNotEqualTo(String value) { return notEqualTo(colorName, value); } public ShiguGoodsSingleSkuExample.Criteria andColorNameGreaterThan(String value) { return greaterThan(colorName, value); } public ShiguGoodsSingleSkuExample.Criteria andColorNameGreaterThanOrEqualTo(String value) { return greaterThanOrEqualTo(colorName, value); } public ShiguGoodsSingleSkuExample.Criteria andColorNameLessThan(String value) { return lessThan(colorName, value); } public ShiguGoodsSingleSkuExample.Criteria andColorNameLessThanOrEqualTo(String value) { return lessThanOrEqualTo(colorName, value); } public ShiguGoodsSingleSkuExample.Criteria andColorNameLike(String value) { return like(colorName, value); } public ShiguGoodsSingleSkuExample.Criteria andColorNameNotLike(String value) { return notLike(colorName, value); } public ShiguGoodsSingleSkuExample.Criteria andColorNameIn(List<String> values) { return in(colorName, values); } public ShiguGoodsSingleSkuExample.Criteria andColorNameNotIn(List<String> values) { return notIn(colorName, values); } public ShiguGoodsSingleSkuExample.Criteria andColorNameBetween(String value1, String value2) { return between(colorName, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andColorNameNotBetween(String value1, String value2) { return notBetween(colorName, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringIsNull() { return isNull(priceString); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringIsNotNull() { return isNotNull(priceString); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringEqualTo(String value) { return equalTo(priceString, value); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringNotEqualTo(String value) { return notEqualTo(priceString, value); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringGreaterThan(String value) { return greaterThan(priceString, value); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringGreaterThanOrEqualTo(String value) { return greaterThanOrEqualTo(priceString, value); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringLessThan(String value) { return lessThan(priceString, value); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringLessThanOrEqualTo(String value) { return lessThanOrEqualTo(priceString, value); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringLike(String value) { return like(priceString, value); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringNotLike(String value) { return notLike(priceString, value); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringIn(List<String> values) { return in(priceString, values); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringNotIn(List<String> values) { return notIn(priceString, values); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringBetween(String value1, String value2) { return between(priceString, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andPriceStringNotBetween(String value1, String value2) { return notBetween(priceString, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdIsNull() { return isNull(goodsId); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdIsNotNull() { return isNotNull(goodsId); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdEqualTo(Long value) { return equalTo(goodsId, value); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdNotEqualTo(Long value) { return notEqualTo(goodsId, value); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdGreaterThan(Long value) { return greaterThan(goodsId, value); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdGreaterThanOrEqualTo(Long value) { return greaterThanOrEqualTo(goodsId, value); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdLessThan(Long value) { return lessThan(goodsId, value); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdLessThanOrEqualTo(Long value) { return lessThanOrEqualTo(goodsId, value); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdIn(List<Long> values) { return in(goodsId, values); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdNotIn(List<Long> values) { return notIn(goodsId, values); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdBetween(Long value1, Long value2) { return between(goodsId, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andGoodsIdNotBetween(Long value1, Long value2) { return notBetween(goodsId, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andColorVidIsNull() { return isNull(colorVid); } public ShiguGoodsSingleSkuExample.Criteria andColorVidIsNotNull() { return isNotNull(colorVid); } public ShiguGoodsSingleSkuExample.Criteria andColorVidEqualTo(Long value) { return equalTo(colorVid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorVidNotEqualTo(Long value) { return notEqualTo(colorVid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorVidGreaterThan(Long value) { return greaterThan(colorVid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorVidGreaterThanOrEqualTo(Long value) { return greaterThanOrEqualTo(colorVid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorVidLessThan(Long value) { return lessThan(colorVid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorVidLessThanOrEqualTo(Long value) { return lessThanOrEqualTo(colorVid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorVidIn(List<Long> values) { return in(colorVid, values); } public ShiguGoodsSingleSkuExample.Criteria andColorVidNotIn(List<Long> values) { return notIn(colorVid, values); } public ShiguGoodsSingleSkuExample.Criteria andColorVidBetween(Long value1, Long value2) { return between(colorVid, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andColorVidNotBetween(Long value1, Long value2) { return notBetween(colorVid, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrIsNull() { return isNull(sizeInputStr); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrIsNotNull() { return isNotNull(sizeInputStr); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrEqualTo(String value) { return equalTo(sizeInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrNotEqualTo(String value) { return notEqualTo(sizeInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrGreaterThan(String value) { return greaterThan(sizeInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrGreaterThanOrEqualTo(String value) { return greaterThanOrEqualTo(sizeInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrLessThan(String value) { return lessThan(sizeInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrLessThanOrEqualTo(String value) { return lessThanOrEqualTo(sizeInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrLike(String value) { return like(sizeInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrNotLike(String value) { return notLike(sizeInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrIn(List<String> values) { return in(sizeInputStr, values); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrNotIn(List<String> values) { return notIn(sizeInputStr, values); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrBetween(String value1, String value2) { return between(sizeInputStr, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSizeInputStrNotBetween(String value1, String value2) { return notBetween(sizeInputStr, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasIsNull() { return isNull(colorPropertyAlias); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasIsNotNull() { return isNotNull(colorPropertyAlias); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasEqualTo(String value) { return equalTo(colorPropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasNotEqualTo(String value) { return notEqualTo(colorPropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasGreaterThan(String value) { return greaterThan(colorPropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasGreaterThanOrEqualTo(String value) { return greaterThanOrEqualTo(colorPropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasLessThan(String value) { return lessThan(colorPropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasLessThanOrEqualTo(String value) { return lessThanOrEqualTo(colorPropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasLike(String value) { return like(colorPropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasNotLike(String value) { return notLike(colorPropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasIn(List<String> values) { return in(colorPropertyAlias, values); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasNotIn(List<String> values) { return notIn(colorPropertyAlias, values); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasBetween(String value1, String value2) { return between(colorPropertyAlias, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andColorPropertyAliasNotBetween(String value1, String value2) { return notBetween(colorPropertyAlias, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andColorPidIsNull() { return isNull(colorPid); } public ShiguGoodsSingleSkuExample.Criteria andColorPidIsNotNull() { return isNotNull(colorPid); } public ShiguGoodsSingleSkuExample.Criteria andColorPidEqualTo(Long value) { return equalTo(colorPid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPidNotEqualTo(Long value) { return notEqualTo(colorPid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPidGreaterThan(Long value) { return greaterThan(colorPid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPidGreaterThanOrEqualTo(Long value) { return greaterThanOrEqualTo(colorPid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPidLessThan(Long value) { return lessThan(colorPid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPidLessThanOrEqualTo(Long value) { return lessThanOrEqualTo(colorPid, value); } public ShiguGoodsSingleSkuExample.Criteria andColorPidIn(List<Long> values) { return in(colorPid, values); } public ShiguGoodsSingleSkuExample.Criteria andColorPidNotIn(List<Long> values) { return notIn(colorPid, values); } public ShiguGoodsSingleSkuExample.Criteria andColorPidBetween(Long value1, Long value2) { return between(colorPid, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andColorPidNotBetween(Long value1, Long value2) { return notBetween(colorPid, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrIsNull() { return isNull(colorInputStr); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrIsNotNull() { return isNotNull(colorInputStr); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrEqualTo(String value) { return equalTo(colorInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrNotEqualTo(String value) { return notEqualTo(colorInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrGreaterThan(String value) { return greaterThan(colorInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrGreaterThanOrEqualTo(String value) { return greaterThanOrEqualTo(colorInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrLessThan(String value) { return lessThan(colorInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrLessThanOrEqualTo(String value) { return lessThanOrEqualTo(colorInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrLike(String value) { return like(colorInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrNotLike(String value) { return notLike(colorInputStr, value); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrIn(List<String> values) { return in(colorInputStr, values); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrNotIn(List<String> values) { return notIn(colorInputStr, values); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrBetween(String value1, String value2) { return between(colorInputStr, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andColorInputStrNotBetween(String value1, String value2) { return notBetween(colorInputStr, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidIsNull() { return isNull(sizeVid); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidIsNotNull() { return isNotNull(sizeVid); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidEqualTo(Long value) { return equalTo(sizeVid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidNotEqualTo(Long value) { return notEqualTo(sizeVid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidGreaterThan(Long value) { return greaterThan(sizeVid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidGreaterThanOrEqualTo(Long value) { return greaterThanOrEqualTo(sizeVid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidLessThan(Long value) { return lessThan(sizeVid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidLessThanOrEqualTo(Long value) { return lessThanOrEqualTo(sizeVid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidIn(List<Long> values) { return in(sizeVid, values); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidNotIn(List<Long> values) { return notIn(sizeVid, values); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidBetween(Long value1, Long value2) { return between(sizeVid, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSizeVidNotBetween(Long value1, Long value2) { return notBetween(sizeVid, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameIsNull() { return isNull(sizeName); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameIsNotNull() { return isNotNull(sizeName); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameEqualTo(String value) { return equalTo(sizeName, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameNotEqualTo(String value) { return notEqualTo(sizeName, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameGreaterThan(String value) { return greaterThan(sizeName, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameGreaterThanOrEqualTo(String value) { return greaterThanOrEqualTo(sizeName, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameLessThan(String value) { return lessThan(sizeName, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameLessThanOrEqualTo(String value) { return lessThanOrEqualTo(sizeName, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameLike(String value) { return like(sizeName, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameNotLike(String value) { return notLike(sizeName, value); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameIn(List<String> values) { return in(sizeName, values); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameNotIn(List<String> values) { return notIn(sizeName, values); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameBetween(String value1, String value2) { return between(sizeName, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSizeNameNotBetween(String value1, String value2) { return notBetween(sizeName, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSizePidIsNull() { return isNull(sizePid); } public ShiguGoodsSingleSkuExample.Criteria andSizePidIsNotNull() { return isNotNull(sizePid); } public ShiguGoodsSingleSkuExample.Criteria andSizePidEqualTo(Long value) { return equalTo(sizePid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePidNotEqualTo(Long value) { return notEqualTo(sizePid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePidGreaterThan(Long value) { return greaterThan(sizePid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePidGreaterThanOrEqualTo(Long value) { return greaterThanOrEqualTo(sizePid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePidLessThan(Long value) { return lessThan(sizePid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePidLessThanOrEqualTo(Long value) { return lessThanOrEqualTo(sizePid, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePidIn(List<Long> values) { return in(sizePid, values); } public ShiguGoodsSingleSkuExample.Criteria andSizePidNotIn(List<Long> values) { return notIn(sizePid, values); } public ShiguGoodsSingleSkuExample.Criteria andSizePidBetween(Long value1, Long value2) { return between(sizePid, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSizePidNotBetween(Long value1, Long value2) { return notBetween(sizePid, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andStockNumIsNull() { return isNull(stockNum); } public ShiguGoodsSingleSkuExample.Criteria andStockNumIsNotNull() { return isNotNull(stockNum); } public ShiguGoodsSingleSkuExample.Criteria andStockNumEqualTo(Integer value) { return equalTo(stockNum, value); } public ShiguGoodsSingleSkuExample.Criteria andStockNumNotEqualTo(Integer value) { return notEqualTo(stockNum, value); } public ShiguGoodsSingleSkuExample.Criteria andStockNumGreaterThan(Integer value) { return greaterThan(stockNum, value); } public ShiguGoodsSingleSkuExample.Criteria andStockNumGreaterThanOrEqualTo(Integer value) { return greaterThanOrEqualTo(stockNum, value); } public ShiguGoodsSingleSkuExample.Criteria andStockNumLessThan(Integer value) { return lessThan(stockNum, value); } public ShiguGoodsSingleSkuExample.Criteria andStockNumLessThanOrEqualTo(Integer value) { return lessThanOrEqualTo(stockNum, value); } public ShiguGoodsSingleSkuExample.Criteria andStockNumIn(List<Integer> values) { return in(stockNum, values); } public ShiguGoodsSingleSkuExample.Criteria andStockNumNotIn(List<Integer> values) { return notIn(stockNum, values); } public ShiguGoodsSingleSkuExample.Criteria andStockNumBetween(Integer value1, Integer value2) { return between(stockNum, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andStockNumNotBetween(Integer value1, Integer value2) { return notBetween(stockNum, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasIsNull() { return isNull(sizePropertyAlias); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasIsNotNull() { return isNotNull(sizePropertyAlias); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasEqualTo(String value) { return equalTo(sizePropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasNotEqualTo(String value) { return notEqualTo(sizePropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasGreaterThan(String value) { return greaterThan(sizePropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasGreaterThanOrEqualTo(String value) { return greaterThanOrEqualTo(sizePropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasLessThan(String value) { return lessThan(sizePropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasLessThanOrEqualTo(String value) { return lessThanOrEqualTo(sizePropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasLike(String value) { return like(sizePropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasNotLike(String value) { return notLike(sizePropertyAlias, value); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasIn(List<String> values) { return in(sizePropertyAlias, values); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasNotIn(List<String> values) { return notIn(sizePropertyAlias, values); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasBetween(String value1, String value2) { return between(sizePropertyAlias, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSizePropertyAliasNotBetween(String value1, String value2) { return notBetween(sizePropertyAlias, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdIsNull() { return isNull(skuId); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdIsNotNull() { return isNotNull(skuId); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdEqualTo(Long value) { return equalTo(skuId, value); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdNotEqualTo(Long value) { return notEqualTo(skuId, value); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdGreaterThan(Long value) { return greaterThan(skuId, value); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdGreaterThanOrEqualTo(Long value) { return greaterThanOrEqualTo(skuId, value); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdLessThan(Long value) { return lessThan(skuId, value); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdLessThanOrEqualTo(Long value) { return lessThanOrEqualTo(skuId, value); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdIn(List<Long> values) { return in(skuId, values); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdNotIn(List<Long> values) { return notIn(skuId, values); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdBetween(Long value1, Long value2) { return between(skuId, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andSkuIdNotBetween(Long value1, Long value2) { return notBetween(skuId, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andStatusIsNull() { return isNull(status); } public ShiguGoodsSingleSkuExample.Criteria andStatusIsNotNull() { return isNotNull(status); } public ShiguGoodsSingleSkuExample.Criteria andStatusEqualTo(Integer value) { return equalTo(status, value); } public ShiguGoodsSingleSkuExample.Criteria andStatusNotEqualTo(Integer value) { return notEqualTo(status, value); } public ShiguGoodsSingleSkuExample.Criteria andStatusGreaterThan(Integer value) { return greaterThan(status, value); } public ShiguGoodsSingleSkuExample.Criteria andStatusGreaterThanOrEqualTo(Integer value) { return greaterThanOrEqualTo(status, value); } public ShiguGoodsSingleSkuExample.Criteria andStatusLessThan(Integer value) { return lessThan(status, value); } public ShiguGoodsSingleSkuExample.Criteria andStatusLessThanOrEqualTo(Integer value) { return lessThanOrEqualTo(status, value); } public ShiguGoodsSingleSkuExample.Criteria andStatusIn(List<Integer> values) { return in(status, values); } public ShiguGoodsSingleSkuExample.Criteria andStatusNotIn(List<Integer> values) { return notIn(status, values); } public ShiguGoodsSingleSkuExample.Criteria andStatusBetween(Integer value1, Integer value2) { return between(status, value1, value2); } public ShiguGoodsSingleSkuExample.Criteria andStatusNotBetween(Integer value1, Integer value2) { return notBetween(status, value1, value2); } } }
32,154
0.688375
0.684643
835
37.508984
35.180809
114
false
false
0
0
0
0
0
0
0.561677
false
false
7
b0644c5de2b8c704741e2dc4f2c340934447ee32
26,371,099,215,119
1bdb31b76d67ee997a0d767c21828c6162ca62fd
/src/main/java/com/github/alburnus/controller/TeamController.java
752d02346bbfbfcd9c78ae5d8ad62a0eec6efef7
[]
no_license
alburnus/transaction-example
https://github.com/alburnus/transaction-example
cef7c2d7a575726ce93094c968f92d41b6daefff
0d991dbdb861ce4a468b0c8532c52f5abafc3846
refs/heads/master
2020-09-29T06:36:52.582000
2019-12-09T22:40:00
2019-12-09T22:40:00
226,977,353
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.github.alburnus.controller; import com.github.alburnus.model.Team; import com.github.alburnus.service.TeamService; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping(value = "/team") @Slf4j public class TeamController { private final TeamService teamService; public TeamController(TeamService teamService) { this.teamService = teamService; } @PostMapping public String save(@RequestParam("name") String name, @RequestParam("sleep") Long sleep) { log.info("Start save team"); teamService.createAndSave(name, sleep); return ""; } @PutMapping public String update(@RequestParam("id") Long id, @RequestParam("name") String newName) { log.info("Start update team"); teamService.update(id, newName); return ""; } @GetMapping public List<Team> getAll() { log.info("Start getAll team"); return teamService.getAll(); } }
UTF-8
Java
1,042
java
TeamController.java
Java
[]
null
[]
package com.github.alburnus.controller; import com.github.alburnus.model.Team; import com.github.alburnus.service.TeamService; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping(value = "/team") @Slf4j public class TeamController { private final TeamService teamService; public TeamController(TeamService teamService) { this.teamService = teamService; } @PostMapping public String save(@RequestParam("name") String name, @RequestParam("sleep") Long sleep) { log.info("Start save team"); teamService.createAndSave(name, sleep); return ""; } @PutMapping public String update(@RequestParam("id") Long id, @RequestParam("name") String newName) { log.info("Start update team"); teamService.update(id, newName); return ""; } @GetMapping public List<Team> getAll() { log.info("Start getAll team"); return teamService.getAll(); } }
1,042
0.678503
0.675624
42
23.809525
23.251459
94
false
false
0
0
0
0
0
0
0.47619
false
false
7
32c378ab103e1efc4fe9fe047e66821db15f367f
36,189,394,483,083
188a2238dd06e3bf8afe8920e637eca35f573a56
/src/Tests/ConditionTest.java
1d49a74a6a12afc79354244fad684e54728e414d
[]
no_license
4mycar/DEBaseTasks
https://github.com/4mycar/DEBaseTasks
74542fc6fe2c30119cc59ae8b70eea362d3f79af
53e77fc71847fc6e6b9018a5d43c0137acca1a7c
refs/heads/master
2022-11-14T14:37:59.937000
2020-07-07T15:32:29
2020-07-07T15:32:29
267,250,704
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Tests; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import BaseTasks.Condition; import static org.junit.Assert.*; public class ConditionTest { @Before public void setUp() throws Exception { } @After public void tearDown() throws Exception { } @Test public void isEven() { Assert.assertEquals(true, Condition.isEven(2)); Assert.assertEquals(false, Condition.isEven(5)); } @Test public void getExpByEven() { Assert.assertEquals(10, Condition.getExpByEven(2, 5),0); Assert.assertEquals(12, Condition.getExpByEven(7, 5), 0); Assert.assertEquals(0, Condition.getExpByEven(0, 5),0); } @Test public void getQuarterNumByPoint() { Assert.assertEquals("1st Quarter", Condition.getQuarterNumByPoint(1,1)); Assert.assertEquals("2nd Quarter", Condition.getQuarterNumByPoint(-2,2)); Assert.assertEquals("3rd Quarter", Condition.getQuarterNumByPoint(-3,-3)); Assert.assertEquals("4th Quarter", Condition.getQuarterNumByPoint(4,-4)); Assert.assertEquals("Zero point", Condition.getQuarterNumByPoint(0,0)); Assert.assertEquals("On the x axis", Condition.getQuarterNumByPoint(5,0)); Assert.assertEquals("On the y axis", Condition.getQuarterNumByPoint(0,5)); } @Test public void getPositiveNumSumOfNumbers() { Assert.assertEquals(6, Condition.getPositiveNumSumOfNumbers(1,2,3),0); Assert.assertEquals(5, Condition.getPositiveNumSumOfNumbers(-1,2,3),0); Assert.assertEquals(3, Condition.getPositiveNumSumOfNumbers(-1,-2,3),0); Assert.assertEquals(0, Condition.getPositiveNumSumOfNumbers(-1,-2,-3),0); } @Test public void getMaxValue() { Assert.assertEquals(6, Condition.getMaxValue(1,1,1),0); Assert.assertEquals(9, Condition.getMaxValue(1,2,3),0); } @Test public void getMarkUsingRating() { Assert.assertEquals("A", Condition.getMarkUsingRating(95)); Assert.assertEquals("B", Condition.getMarkUsingRating(85)); Assert.assertEquals("C", Condition.getMarkUsingRating(65)); Assert.assertEquals("D", Condition.getMarkUsingRating(55)); Assert.assertEquals("E", Condition.getMarkUsingRating(35)); Assert.assertEquals("F", Condition.getMarkUsingRating(5)); Assert.assertEquals("Rating is out of range", Condition.getMarkUsingRating(105)); } }
UTF-8
Java
2,487
java
ConditionTest.java
Java
[]
null
[]
package Tests; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import BaseTasks.Condition; import static org.junit.Assert.*; public class ConditionTest { @Before public void setUp() throws Exception { } @After public void tearDown() throws Exception { } @Test public void isEven() { Assert.assertEquals(true, Condition.isEven(2)); Assert.assertEquals(false, Condition.isEven(5)); } @Test public void getExpByEven() { Assert.assertEquals(10, Condition.getExpByEven(2, 5),0); Assert.assertEquals(12, Condition.getExpByEven(7, 5), 0); Assert.assertEquals(0, Condition.getExpByEven(0, 5),0); } @Test public void getQuarterNumByPoint() { Assert.assertEquals("1st Quarter", Condition.getQuarterNumByPoint(1,1)); Assert.assertEquals("2nd Quarter", Condition.getQuarterNumByPoint(-2,2)); Assert.assertEquals("3rd Quarter", Condition.getQuarterNumByPoint(-3,-3)); Assert.assertEquals("4th Quarter", Condition.getQuarterNumByPoint(4,-4)); Assert.assertEquals("Zero point", Condition.getQuarterNumByPoint(0,0)); Assert.assertEquals("On the x axis", Condition.getQuarterNumByPoint(5,0)); Assert.assertEquals("On the y axis", Condition.getQuarterNumByPoint(0,5)); } @Test public void getPositiveNumSumOfNumbers() { Assert.assertEquals(6, Condition.getPositiveNumSumOfNumbers(1,2,3),0); Assert.assertEquals(5, Condition.getPositiveNumSumOfNumbers(-1,2,3),0); Assert.assertEquals(3, Condition.getPositiveNumSumOfNumbers(-1,-2,3),0); Assert.assertEquals(0, Condition.getPositiveNumSumOfNumbers(-1,-2,-3),0); } @Test public void getMaxValue() { Assert.assertEquals(6, Condition.getMaxValue(1,1,1),0); Assert.assertEquals(9, Condition.getMaxValue(1,2,3),0); } @Test public void getMarkUsingRating() { Assert.assertEquals("A", Condition.getMarkUsingRating(95)); Assert.assertEquals("B", Condition.getMarkUsingRating(85)); Assert.assertEquals("C", Condition.getMarkUsingRating(65)); Assert.assertEquals("D", Condition.getMarkUsingRating(55)); Assert.assertEquals("E", Condition.getMarkUsingRating(35)); Assert.assertEquals("F", Condition.getMarkUsingRating(5)); Assert.assertEquals("Rating is out of range", Condition.getMarkUsingRating(105)); } }
2,487
0.685565
0.654202
73
33.082191
30.948368
89
false
false
0
0
0
0
0
0
1.20548
false
false
7
06c7e9b66a458c53ba568a0930d68189e507c40d
22,093,311,833,780
521627f44fd95df86352cf14ca98f6d2ca3e356d
/loup-schlurpr/src/main/java/at/loup/schlurpr/data/ChangeResponse.java
ecbfe63d0ce0cb4406a0090be37c9f7ae31aae6e
[ "Apache-2.0" ]
permissive
Traubenfuchs/loup
https://github.com/Traubenfuchs/loup
2c09d8d93e415868cf24688227fa04923b750b46
4530f731700266379d8c1b95e7ef2c2ebaf6f8b9
refs/heads/master
2020-05-22T01:17:51.410000
2017-05-16T20:06:53
2017-05-16T20:06:53
56,921,145
0
0
null
false
2016-05-07T17:02:55
2016-04-23T13:41:22
2016-04-23T13:44:41
2016-05-07T17:02:54
156
0
0
0
Java
null
null
package at.loup.schlurpr.data; public class ChangeResponse { private Long projectId; private Integer projectVersion; public ChangeResponse() { } public Long getProjectId() { return projectId; } public void setProjectId(Long projectId) { this.projectId = projectId; } public Integer getProjectVersion() { return projectVersion; } public void setProjectVersion(Integer projectVersion) { this.projectVersion = projectVersion; } public static ChangeResponse create(long projectId, int projectVersion) { ChangeResponse result = new ChangeResponse(); result.setProjectId(projectId); result.setProjectVersion(projectVersion); return result; } }
UTF-8
Java
713
java
ChangeResponse.java
Java
[]
null
[]
package at.loup.schlurpr.data; public class ChangeResponse { private Long projectId; private Integer projectVersion; public ChangeResponse() { } public Long getProjectId() { return projectId; } public void setProjectId(Long projectId) { this.projectId = projectId; } public Integer getProjectVersion() { return projectVersion; } public void setProjectVersion(Integer projectVersion) { this.projectVersion = projectVersion; } public static ChangeResponse create(long projectId, int projectVersion) { ChangeResponse result = new ChangeResponse(); result.setProjectId(projectId); result.setProjectVersion(projectVersion); return result; } }
713
0.725105
0.725105
35
18.371429
19.713789
74
false
false
0
0
0
0
0
0
1.2
false
false
7
d6bb2aaae0bba586e444d1e1ab3e35068dad8cd9
39,685,497,836,073
7b82a1f47a2bfe5fa1b9b36611c7c0a9c35966e4
/ErrorHandling/src/com/pluralsight/errorhandling/Main.java
ed4699a71e34de111e295272f34f37a8a2b13b35
[]
no_license
y-usuf/JavaLearning
https://github.com/y-usuf/JavaLearning
1e2197468330b94722ea449e56d4965e9e21e274
596f8a9125684b78f6ade9f11368d775f976ab29
refs/heads/master
2022-11-13T13:12:29.744000
2020-07-06T04:28:00
2020-07-06T04:28:00
275,769,973
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pluralsight.errorhandling; public class Main { // Error handling using exceptions public static void main(String[] args) { int i = 12; int j = 2; // if j = 2, error will occur. // Using exception try { int results = i / (j - 2); System.out.println(results); } catch (Exception e) { System.out.println("Error: " + e.getMessage()); e.printStackTrace(); } } }
UTF-8
Java
484
java
Main.java
Java
[]
null
[]
package com.pluralsight.errorhandling; public class Main { // Error handling using exceptions public static void main(String[] args) { int i = 12; int j = 2; // if j = 2, error will occur. // Using exception try { int results = i / (j - 2); System.out.println(results); } catch (Exception e) { System.out.println("Error: " + e.getMessage()); e.printStackTrace(); } } }
484
0.520661
0.510331
22
21
18.836618
59
false
false
0
0
0
0
0
0
0.363636
false
false
7
a7af2a1f889480ee5e9ab71a85ba8b66cbf9cdae
37,812,892,107,688
0984eadc090a66cbaed5fa8399d83a406369d69b
/src/test/java/com/highlighter/HighlighterTest.java
b998e58fe0201fc407b6679290cdadcaa0145363
[]
no_license
ximagination80/highlighter
https://github.com/ximagination80/highlighter
586859fb15a62b13c5bb028ce8b5ecdd6d500c4a
5d2e7b3f042f6c5ed46093386ae7cc0c2d264ce9
refs/heads/master
2023-03-29T18:03:43.350000
2021-04-06T08:37:52
2021-04-06T08:37:52
355,114,399
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.highlighter; import static java.nio.charset.StandardCharsets.UTF_8; import static org.apache.commons.io.FileUtils.readFileToString; import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import java.util.Collection; import org.apache.commons.io.FileUtils; import org.junit.Assert; import org.junit.ComparisonFailure; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; @RunWith(Parameterized.class) public class HighlighterTest { private final Path inputPath; private final Path expectedPath; private final String textToHighlight; private final Highlighter highlighter; @Parameters(name = " {index}. {0} ") public static Collection<Object[]> data() { return Arrays.asList(new Object[][]{ {"no_overlap_1", "Please read first section of"}, {"no_overlap_2", "Hello, welcome to the text "}, {"full_overlap_1_with_bordering", "Hello, welcome to the text document.Please read first section of chart. As soon as you come to the conclusion...This text is located in inner-section, effectively a subsection of super section. This section"}, {"partially_overlap_with_bordering", "Hello, welcome to the text document.Please read first section of chart. As soon as you come to the conclusion...This text is located in inner-section, effectively a subsection of super section. T"}, }); } public HighlighterTest(String name, Object textToHighlight) { this.inputPath = Paths.get("src", "test", "resources", name, "input.html"); this.expectedPath = Paths.get("src", "test", "resources", name, "expected.html"); this.textToHighlight = (String) textToHighlight; this.highlighter = new Highlighter(); } @Test public void transform() throws IOException { String inputHtml = readFileToString(inputPath.toFile(), UTF_8); String expectedHtml = readFileToString(expectedPath.toFile(), UTF_8); String actualHtml = highlighter.transform(inputHtml, this.textToHighlight); try { Assert.assertEquals(expectedHtml, actualHtml); } catch (ComparisonFailure comparisonFailure) { FileUtils.writeStringToFile( new File(inputPath.toFile().getParentFile(), "actual.html"), actualHtml, UTF_8); throw comparisonFailure; } } }
UTF-8
Java
2,418
java
HighlighterTest.java
Java
[]
null
[]
package com.highlighter; import static java.nio.charset.StandardCharsets.UTF_8; import static org.apache.commons.io.FileUtils.readFileToString; import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import java.util.Collection; import org.apache.commons.io.FileUtils; import org.junit.Assert; import org.junit.ComparisonFailure; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; @RunWith(Parameterized.class) public class HighlighterTest { private final Path inputPath; private final Path expectedPath; private final String textToHighlight; private final Highlighter highlighter; @Parameters(name = " {index}. {0} ") public static Collection<Object[]> data() { return Arrays.asList(new Object[][]{ {"no_overlap_1", "Please read first section of"}, {"no_overlap_2", "Hello, welcome to the text "}, {"full_overlap_1_with_bordering", "Hello, welcome to the text document.Please read first section of chart. As soon as you come to the conclusion...This text is located in inner-section, effectively a subsection of super section. This section"}, {"partially_overlap_with_bordering", "Hello, welcome to the text document.Please read first section of chart. As soon as you come to the conclusion...This text is located in inner-section, effectively a subsection of super section. T"}, }); } public HighlighterTest(String name, Object textToHighlight) { this.inputPath = Paths.get("src", "test", "resources", name, "input.html"); this.expectedPath = Paths.get("src", "test", "resources", name, "expected.html"); this.textToHighlight = (String) textToHighlight; this.highlighter = new Highlighter(); } @Test public void transform() throws IOException { String inputHtml = readFileToString(inputPath.toFile(), UTF_8); String expectedHtml = readFileToString(expectedPath.toFile(), UTF_8); String actualHtml = highlighter.transform(inputHtml, this.textToHighlight); try { Assert.assertEquals(expectedHtml, actualHtml); } catch (ComparisonFailure comparisonFailure) { FileUtils.writeStringToFile( new File(inputPath.toFile().getParentFile(), "actual.html"), actualHtml, UTF_8); throw comparisonFailure; } } }
2,418
0.732837
0.729529
59
40
45.398796
253
false
false
0
0
0
0
0
0
1.016949
false
false
7
d307254482b2894eb7b9eff9fd254755ed7a200e
12,266,426,614,620
da42ee8d725c96c18ba66315ee691ad772562e20
/app/src/test/java/com/kurtmustafa/countryselector/CountryDetailsViewModelTest.java
b3ebc81592a4b5b12d967c09cb29db517e0d5c63
[ "Apache-2.0" ]
permissive
DeveloperKurt/CountrySelector
https://github.com/DeveloperKurt/CountrySelector
215dd63a810ed62046e315a80c123c6fc4ac1825
59364b470452a0af7b6837b605ac063cb296d314
refs/heads/master
2020-08-15T03:32:17.329000
2019-10-15T19:31:59
2019-10-15T19:31:59
215,266,803
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kurtmustafa.countryselector; import android.content.Context; import com.kurtmustafa.countryselector.models.Country; import com.kurtmustafa.countryselector.models.CountryDetails; import com.kurtmustafa.countryselector.models.ErrorCodes; import com.kurtmustafa.countryselector.repositories.CountryDetailsRepository; import com.kurtmustafa.countryselector.testutils.LiveDataTestUtil; import com.kurtmustafa.countryselector.testutils.ModelInstances; import com.kurtmustafa.countryselector.ui.dialogfragmentcountrylist.OnCountryClickListener; import com.kurtmustafa.countryselector.ui.fragmentcountrydetails.CountryDetailsViewModel; import com.kurtmustafa.countryselector.utils.LiveDataEvent; import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.junit.MockitoJUnitRunner; import androidx.arch.core.executor.testing.InstantTaskExecutorRule; import androidx.lifecycle.MutableLiveData; import androidx.test.filters.MediumTest; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @MediumTest //Execution time is greater than 200ms (400ms) @RunWith(MockitoJUnitRunner.class) public class CountryDetailsViewModelTest { @Rule //This rule is needed to be able to use the LiveData public InstantTaskExecutorRule instantExecutorRule = new InstantTaskExecutorRule(); private CountryDetailsViewModel countryDetailsViewModel; @Mock private CountryDetailsRepository countryDetailsRepository; @Before public void setUp() { MockitoAnnotations.initMocks(this); Context mockedContext = mock(Context.class); doReturn("Placeholder Header String").when(mockedContext).getString(any(Integer.class)); countryDetailsViewModel = new CountryDetailsViewModel(mockedContext, countryDetailsRepository); } @Test public void getsCountryDetailsAsFormattedString() throws InterruptedException { //Given MutableLiveData<CountryDetails> countryDetailsMutableLiveData = new MutableLiveData<>(); CountryDetails swedenCountryDetails = ModelInstances.SwedenCountryDetails; countryDetailsMutableLiveData.setValue(swedenCountryDetails); doReturn(countryDetailsMutableLiveData).when(countryDetailsRepository).getCountryDetails(); //When String countryDetailsInString = LiveDataTestUtil.getOrAwaitValue(countryDetailsViewModel.getCountryDetails()); //Then verify(countryDetailsRepository, times(1)).getCountryDetails(); Assert.assertNotEquals(null, countryDetailsInString); } @Test public void observersForErrorsInRepo() throws InterruptedException { //Given MutableLiveData<LiveDataEvent<ErrorCodes>> errorCodesMutableLiveData = new MutableLiveData<>(); errorCodesMutableLiveData.setValue(new LiveDataEvent<>(ErrorCodes.OTHER_REQUEST_RELATED)); // When doReturn(errorCodesMutableLiveData).when(countryDetailsRepository).getErrors(); //Then Assert.assertEquals(ErrorCodes.OTHER_REQUEST_RELATED, LiveDataTestUtil.getOrAwaitValue(countryDetailsViewModel.observeForErrors()).peekContent()); } /** * Shouldn't load country from view arguments if multiple country is displayed, otherwise it causes inconsistencies when screen is rotated etc. */ @Test public void handlesCountryOnViewRecreation() throws InterruptedException { //Given Country country1 = mock(Country.class); Country country2 = mock(Country.class); //When view gets created countryDetailsViewModel.onGetCountryFromArguments(country1); //And user displays another country countryDetailsViewModel.onCountryClick(country2); //And rotates the screen therefore view gets created again countryDetailsViewModel.onGetCountryFromArguments(country1); //Then Assert.assertEquals("The Country in the ViewModel's LiveData still should be the clicked country (country2) to prevent inconsistencies", country2,LiveDataTestUtil.getOrAwaitValue(countryDetailsViewModel.getCountry())); } @Test public void handlesLocalErrors() throws InterruptedException { //Given MutableLiveData<LiveDataEvent<ErrorCodes>> dummyLiveData = new MutableLiveData<>(); //For mediatorlivedata to not to crash doReturn(dummyLiveData).when(countryDetailsRepository).getErrors(); //When there is an error within viewmodel ( Country is null) countryDetailsViewModel.onCountryClick(new Country(null,null,null)); //Then Assert.assertNotEquals(null, LiveDataTestUtil.getOrAwaitValue(countryDetailsViewModel.observeForErrors()).peekContent()); } @Test public void implementsOnCountryClick() { Assert.assertTrue(countryDetailsViewModel instanceof OnCountryClickListener); } }
UTF-8
Java
5,689
java
CountryDetailsViewModelTest.java
Java
[]
null
[]
package com.kurtmustafa.countryselector; import android.content.Context; import com.kurtmustafa.countryselector.models.Country; import com.kurtmustafa.countryselector.models.CountryDetails; import com.kurtmustafa.countryselector.models.ErrorCodes; import com.kurtmustafa.countryselector.repositories.CountryDetailsRepository; import com.kurtmustafa.countryselector.testutils.LiveDataTestUtil; import com.kurtmustafa.countryselector.testutils.ModelInstances; import com.kurtmustafa.countryselector.ui.dialogfragmentcountrylist.OnCountryClickListener; import com.kurtmustafa.countryselector.ui.fragmentcountrydetails.CountryDetailsViewModel; import com.kurtmustafa.countryselector.utils.LiveDataEvent; import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.junit.MockitoJUnitRunner; import androidx.arch.core.executor.testing.InstantTaskExecutorRule; import androidx.lifecycle.MutableLiveData; import androidx.test.filters.MediumTest; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @MediumTest //Execution time is greater than 200ms (400ms) @RunWith(MockitoJUnitRunner.class) public class CountryDetailsViewModelTest { @Rule //This rule is needed to be able to use the LiveData public InstantTaskExecutorRule instantExecutorRule = new InstantTaskExecutorRule(); private CountryDetailsViewModel countryDetailsViewModel; @Mock private CountryDetailsRepository countryDetailsRepository; @Before public void setUp() { MockitoAnnotations.initMocks(this); Context mockedContext = mock(Context.class); doReturn("Placeholder Header String").when(mockedContext).getString(any(Integer.class)); countryDetailsViewModel = new CountryDetailsViewModel(mockedContext, countryDetailsRepository); } @Test public void getsCountryDetailsAsFormattedString() throws InterruptedException { //Given MutableLiveData<CountryDetails> countryDetailsMutableLiveData = new MutableLiveData<>(); CountryDetails swedenCountryDetails = ModelInstances.SwedenCountryDetails; countryDetailsMutableLiveData.setValue(swedenCountryDetails); doReturn(countryDetailsMutableLiveData).when(countryDetailsRepository).getCountryDetails(); //When String countryDetailsInString = LiveDataTestUtil.getOrAwaitValue(countryDetailsViewModel.getCountryDetails()); //Then verify(countryDetailsRepository, times(1)).getCountryDetails(); Assert.assertNotEquals(null, countryDetailsInString); } @Test public void observersForErrorsInRepo() throws InterruptedException { //Given MutableLiveData<LiveDataEvent<ErrorCodes>> errorCodesMutableLiveData = new MutableLiveData<>(); errorCodesMutableLiveData.setValue(new LiveDataEvent<>(ErrorCodes.OTHER_REQUEST_RELATED)); // When doReturn(errorCodesMutableLiveData).when(countryDetailsRepository).getErrors(); //Then Assert.assertEquals(ErrorCodes.OTHER_REQUEST_RELATED, LiveDataTestUtil.getOrAwaitValue(countryDetailsViewModel.observeForErrors()).peekContent()); } /** * Shouldn't load country from view arguments if multiple country is displayed, otherwise it causes inconsistencies when screen is rotated etc. */ @Test public void handlesCountryOnViewRecreation() throws InterruptedException { //Given Country country1 = mock(Country.class); Country country2 = mock(Country.class); //When view gets created countryDetailsViewModel.onGetCountryFromArguments(country1); //And user displays another country countryDetailsViewModel.onCountryClick(country2); //And rotates the screen therefore view gets created again countryDetailsViewModel.onGetCountryFromArguments(country1); //Then Assert.assertEquals("The Country in the ViewModel's LiveData still should be the clicked country (country2) to prevent inconsistencies", country2,LiveDataTestUtil.getOrAwaitValue(countryDetailsViewModel.getCountry())); } @Test public void handlesLocalErrors() throws InterruptedException { //Given MutableLiveData<LiveDataEvent<ErrorCodes>> dummyLiveData = new MutableLiveData<>(); //For mediatorlivedata to not to crash doReturn(dummyLiveData).when(countryDetailsRepository).getErrors(); //When there is an error within viewmodel ( Country is null) countryDetailsViewModel.onCountryClick(new Country(null,null,null)); //Then Assert.assertNotEquals(null, LiveDataTestUtil.getOrAwaitValue(countryDetailsViewModel.observeForErrors()).peekContent()); } @Test public void implementsOnCountryClick() { Assert.assertTrue(countryDetailsViewModel instanceof OnCountryClickListener); } }
5,689
0.697838
0.695377
143
38.783218
39.541805
162
false
false
0
0
0
0
0
0
0.461538
false
false
7
186457d63a2b5278cf9976ccc80742b12b9f14e2
5,308,579,625,229
6ce12f6d65ea461d2897a376c7cf6e21befd3394
/MerLION/MerLION-ejb/test/Common/session/CompanyManagementSessionBeanTest.java
e0a6c05974a976bb0a620f5b84d34fff033aa5ee
[]
no_license
jonathandarryl/FYP-Gamification
https://github.com/jonathandarryl/FYP-Gamification
6938b26e88a6d49b5297a831ce5fcfbd9e155e60
c156ccf6613616aa9d9e98a5a706084a9292787b
refs/heads/master
2016-09-15T19:44:38.444000
2015-01-19T15:10:14
2015-01-19T15:10:14
27,864,699
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * 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 Common.session; import Common.entity.Company; import Common.entity.CustomerCompany; import Common.entity.Department; import Common.entity.PartnerCompany; import java.util.List; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import org.junit.After; import org.junit.AfterClass; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import util.exception.CompanyExistException; import util.exception.CompanyNotExistException; import util.exception.DepartmentNotExistException; /** * * @author Sun Mingjia */ public class CompanyManagementSessionBeanTest { CompanyManagementSessionBeanRemote cmsbr = this.lookupCompanyManagementSessionBeanRemote(); public CompanyManagementSessionBeanTest() { } @BeforeClass public static void setUpClass() { } @AfterClass public static void tearDownClass() { } @Before public void setUp() { } @After public void tearDown() { } @Test(expected = CompanyNotExistException.class) public void testRetrieveCompany() throws CompanyNotExistException { String companyName = ""; Company result = cmsbr.retrieveCompany(companyName); assertNull(result); } @Test(expected = CompanyNotExistException.class) public void testRetrieveCustomerCompany() throws CompanyNotExistException { String companyName = ""; CustomerCompany result = cmsbr.retrieveCustomerCompany(companyName); assertNull(result); } @Test(expected = CompanyNotExistException.class) public void testRetrievePartnerCompany() throws CompanyNotExistException { String companyName = ""; PartnerCompany result = cmsbr.retrievePartnerCompany(companyName); assertNull(result); } @Test public void testDeactivateCompany() throws Exception { Long companyId = Long.valueOf("11"); String companyType = "3PL"; boolean result = cmsbr.deactivateCompany(companyId, companyType); assertTrue(result); } @Test public void testRetrieveCompany02() throws Exception { Long companyId = Long.valueOf("21"); Company result = cmsbr.retrieveCompany(companyId); assertNotNull(result); } @Test public void testCreateCustomerCompany() throws CompanyExistException { String companyName = "company1"; String companyType = "1PL"; String contactNo = "12341234"; String VAT = "213243"; // CustomerCompany result = cmsbr.createCustomerCompany(companyName, companyType, contactNo, VAT); String result = null; assertNull(result); } @Test public void testRegisterCustomerCompany() throws Exception { String companyName = "company1"; String companyType = "1PL"; String contactNo = "12341234"; String VAT = "213243"; String result = "company1"; assertNotNull(result); } @Test public void testUpdateCustomerCompany() throws Exception { String companyName = "testregistercompany"; String companyType = "1PL"; String contactNo = "12341234"; String VAT = "213243"; CustomerCompany result = cmsbr.updateCustomerCompany(Long.valueOf("1"), companyName, companyType, contactNo, contactNo, VAT, VAT, VAT, contactNo, contactNo); assertNotNull(result); } @Test(expected=CompanyNotExistException.class) public void testDeleteCustomerCompany() throws CompanyNotExistException { Long companyId = Long.valueOf("999"); boolean result = cmsbr.deleteCustomerCompany(companyId); assertFalse(result); } @Test public void testCreatePartnerCompany() throws CompanyExistException { String companyName = "company2"; String companyType = "2PL"; String contactNo = "12341234"; String VAT = "213243"; // PartnerCompany pc = cmsbr.createPartnerCompany(companyName, companyType, contactNo, VAT); boolean result = false; assertFalse(result); } @Test public void testRegisterPartnerCompany() throws CompanyExistException { String companyName = "company2"; String companyType = "1PL"; String contactNo = "12341234"; String VAT = "213243"; // PartnerCompany pc = cmsbr.registerPartnerCompany(companyName, companyType, contactNo, contactNo, VAT, VAT, VAT, contactNo, contactNo, VAT); boolean result = false; assertFalse(result); } @Test public void testUpdatePartnerCompany() throws CompanyNotExistException { Long companyId = Long.valueOf("16"); String companyName = "testregistercompany"; String companyType = "2PL"; String contactNo = "12341234"; String VAT = "213243"; PartnerCompany result = cmsbr.updatePartnerCompany(companyId, companyName, companyType, contactNo, contactNo, VAT, VAT, VAT, contactNo, contactNo); assertNotNull(result); } @Test(expected=CompanyNotExistException.class) public void testDeletePartnerCompany() throws CompanyNotExistException { Long companyId = Long.valueOf("999"); boolean result = cmsbr.deletePartnerCompany(companyId); assertTrue(result); } @Test public void testRetrieveDepartment() throws DepartmentNotExistException { Long departmentId = Long.valueOf("2"); Department result = cmsbr.retrieveDepartment(departmentId); assertNotNull(result); } @Test public void testRetrieveAllCompany() { List<Company> result = cmsbr.retrieveAllCompany(); assertNotNull(result); } @Test public void testRetrieveLockedCompany() { List<Company> result = cmsbr.retrieveLockedCompany(); assertNotNull(result); } @Test public void testRetrieveMerLION() throws CompanyNotExistException { Long companyId = Long.valueOf("21"); Company result = cmsbr.retrieveMerLION(companyId); assertNotNull(result); } private CompanyManagementSessionBeanRemote lookupCompanyManagementSessionBeanRemote() { try { Context c = new InitialContext(); return (CompanyManagementSessionBeanRemote)c.lookup("java:global/MerLION/MerLION-ejb/CompanyManagementSessionBean!Common.session.CompanyManagementSessionBeanRemote"); } catch (NamingException ne) { throw new RuntimeException(ne); } } }
UTF-8
Java
7,149
java
CompanyManagementSessionBeanTest.java
Java
[ { "context": "epartmentNotExistException;\r\n\r\n/**\r\n *\r\n * @author Sun Mingjia\r\n */\r\npublic class CompanyManagementSessionBeanTe", "end": 984, "score": 0.9998455047607422, "start": 973, "tag": "NAME", "value": "Sun Mingjia" }, { "context": "throws Exception {\r\n Str...
null
[]
/* * 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 Common.session; import Common.entity.Company; import Common.entity.CustomerCompany; import Common.entity.Department; import Common.entity.PartnerCompany; import java.util.List; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import org.junit.After; import org.junit.AfterClass; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import util.exception.CompanyExistException; import util.exception.CompanyNotExistException; import util.exception.DepartmentNotExistException; /** * * @author <NAME> */ public class CompanyManagementSessionBeanTest { CompanyManagementSessionBeanRemote cmsbr = this.lookupCompanyManagementSessionBeanRemote(); public CompanyManagementSessionBeanTest() { } @BeforeClass public static void setUpClass() { } @AfterClass public static void tearDownClass() { } @Before public void setUp() { } @After public void tearDown() { } @Test(expected = CompanyNotExistException.class) public void testRetrieveCompany() throws CompanyNotExistException { String companyName = ""; Company result = cmsbr.retrieveCompany(companyName); assertNull(result); } @Test(expected = CompanyNotExistException.class) public void testRetrieveCustomerCompany() throws CompanyNotExistException { String companyName = ""; CustomerCompany result = cmsbr.retrieveCustomerCompany(companyName); assertNull(result); } @Test(expected = CompanyNotExistException.class) public void testRetrievePartnerCompany() throws CompanyNotExistException { String companyName = ""; PartnerCompany result = cmsbr.retrievePartnerCompany(companyName); assertNull(result); } @Test public void testDeactivateCompany() throws Exception { Long companyId = Long.valueOf("11"); String companyType = "3PL"; boolean result = cmsbr.deactivateCompany(companyId, companyType); assertTrue(result); } @Test public void testRetrieveCompany02() throws Exception { Long companyId = Long.valueOf("21"); Company result = cmsbr.retrieveCompany(companyId); assertNotNull(result); } @Test public void testCreateCustomerCompany() throws CompanyExistException { String companyName = "company1"; String companyType = "1PL"; String contactNo = "12341234"; String VAT = "213243"; // CustomerCompany result = cmsbr.createCustomerCompany(companyName, companyType, contactNo, VAT); String result = null; assertNull(result); } @Test public void testRegisterCustomerCompany() throws Exception { String companyName = "company1"; String companyType = "1PL"; String contactNo = "12341234"; String VAT = "213243"; String result = "company1"; assertNotNull(result); } @Test public void testUpdateCustomerCompany() throws Exception { String companyName = "testregistercompany"; String companyType = "1PL"; String contactNo = "12341234"; String VAT = "213243"; CustomerCompany result = cmsbr.updateCustomerCompany(Long.valueOf("1"), companyName, companyType, contactNo, contactNo, VAT, VAT, VAT, contactNo, contactNo); assertNotNull(result); } @Test(expected=CompanyNotExistException.class) public void testDeleteCustomerCompany() throws CompanyNotExistException { Long companyId = Long.valueOf("999"); boolean result = cmsbr.deleteCustomerCompany(companyId); assertFalse(result); } @Test public void testCreatePartnerCompany() throws CompanyExistException { String companyName = "company2"; String companyType = "2PL"; String contactNo = "12341234"; String VAT = "213243"; // PartnerCompany pc = cmsbr.createPartnerCompany(companyName, companyType, contactNo, VAT); boolean result = false; assertFalse(result); } @Test public void testRegisterPartnerCompany() throws CompanyExistException { String companyName = "company2"; String companyType = "1PL"; String contactNo = "12341234"; String VAT = "213243"; // PartnerCompany pc = cmsbr.registerPartnerCompany(companyName, companyType, contactNo, contactNo, VAT, VAT, VAT, contactNo, contactNo, VAT); boolean result = false; assertFalse(result); } @Test public void testUpdatePartnerCompany() throws CompanyNotExistException { Long companyId = Long.valueOf("16"); String companyName = "testregistercompany"; String companyType = "2PL"; String contactNo = "12341234"; String VAT = "213243"; PartnerCompany result = cmsbr.updatePartnerCompany(companyId, companyName, companyType, contactNo, contactNo, VAT, VAT, VAT, contactNo, contactNo); assertNotNull(result); } @Test(expected=CompanyNotExistException.class) public void testDeletePartnerCompany() throws CompanyNotExistException { Long companyId = Long.valueOf("999"); boolean result = cmsbr.deletePartnerCompany(companyId); assertTrue(result); } @Test public void testRetrieveDepartment() throws DepartmentNotExistException { Long departmentId = Long.valueOf("2"); Department result = cmsbr.retrieveDepartment(departmentId); assertNotNull(result); } @Test public void testRetrieveAllCompany() { List<Company> result = cmsbr.retrieveAllCompany(); assertNotNull(result); } @Test public void testRetrieveLockedCompany() { List<Company> result = cmsbr.retrieveLockedCompany(); assertNotNull(result); } @Test public void testRetrieveMerLION() throws CompanyNotExistException { Long companyId = Long.valueOf("21"); Company result = cmsbr.retrieveMerLION(companyId); assertNotNull(result); } private CompanyManagementSessionBeanRemote lookupCompanyManagementSessionBeanRemote() { try { Context c = new InitialContext(); return (CompanyManagementSessionBeanRemote)c.lookup("java:global/MerLION/MerLION-ejb/CompanyManagementSessionBean!Common.session.CompanyManagementSessionBeanRemote"); } catch (NamingException ne) { throw new RuntimeException(ne); } } }
7,144
0.667506
0.65156
204
33.053921
30.067442
178
false
false
0
0
0
0
0
0
0.656863
false
false
7
8cf7474fd1f5808342e91c34c680b32ada51570d
7,791,070,692,623
aa9bd7eec9b57ae87ee3ca4bc813c121cdda391f
/CLDII/src/de/telekom/cldii/view/sms/.svn/text-base/SmsComposeActivity.java.svn-base
0edd184c01ce1dbfa633b67c5f8cc7e2c9587f7c
[]
no_license
razor4513/macciato
https://github.com/razor4513/macciato
a04b8fdd5b2e13618fcd7653086bf1b2d40373fc
c0795657a743118ae91dc6eb488037a721b82fa7
refs/heads/master
2021-01-10T21:44:08.704000
2013-06-27T13:42:53
2013-06-27T13:42:53
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.telekom.cldii.view.sms; import static de.telekom.cldii.ApplicationConstants.EXTRAS_KEY_SMSCONTENT; import static de.telekom.cldii.ApplicationConstants.EXTRAS_KEY_SMSNUMBER; import java.util.ArrayList; import android.app.Activity; import android.app.AlertDialog; import android.app.PendingIntent; import android.app.ProgressDialog; import android.content.BroadcastReceiver; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.gesture.GestureLibraries; import android.gesture.Prediction; import android.os.Bundle; import android.os.Looper; import android.telephony.PhoneNumberUtils; import android.telephony.SmsManager; import android.text.Editable; import android.text.InputFilter; import android.text.TextWatcher; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.EditText; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import de.telekom.cldii.ApplicationConstants; import de.telekom.cldii.R; import de.telekom.cldii.statemachine.StateModel; import de.telekom.cldii.view.AbstractActivity; import de.telekom.cldii.view.sms.adapter.SmsDialogSelectNumberAdapter; /** * Activity for composing/reply a Sms * * @author Jun Chen, jambit GmbH * */ public class SmsComposeActivity extends AbstractActivity { private static final int MAX_SMS_CONTENT_CHARS = 1000; private final String TAG = "SmsComposeActivity"; private ProgressDialog sendSmsProgressDialog; private String SENT = "SMS_SENT"; private String DELIVERED = "SMS_DELIVERED"; private boolean broadcastReceiversSet = false; private int sendSuccessful = 0; private int deliverySuccessful = 0; private int maxBroadcasts = 0; private View tempAlertDialogView; /** * BroadcastReceiver for "SMS_SENT" broadcast. */ BroadcastReceiver sentBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context arg0, Intent arg1) { switch (getResultCode()) { case Activity.RESULT_OK: sendSuccessful++; Log.d(TAG, "sendSuccessful: " + sendSuccessful); break; default: onSmsSendFail(); break; } } }; /** * BroadcastReceiver for "SMS_DELIVERED" broadcast. */ BroadcastReceiver deliveredBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context arg0, Intent arg1) { switch (getResultCode()) { case Activity.RESULT_OK: deliverySuccessful++; Log.d(TAG, "deliverySuccessful: " + deliverySuccessful); if (sendSuccessful >= 1 && deliverySuccessful == maxBroadcasts) { onSmsSendSuccess(); } break; } } }; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sms_compose); setTopBarName(getString(R.string.section_sms)); hideSpeakButton(); Bundle extras = getIntent().getExtras(); if (extras != null) { if (extras.containsKey(EXTRAS_KEY_SMSNUMBER)) { ((EditText) findViewById(R.id.recepientEditText)).setText(extras.getString(EXTRAS_KEY_SMSNUMBER)); findViewById(R.id.smsContentEditText).requestFocus(); } if (extras.containsKey(EXTRAS_KEY_SMSCONTENT)) { ((EditText) findViewById(R.id.smsContentEditText)).setText("\n\n" + extras.getString(EXTRAS_KEY_SMSCONTENT)); findViewById(R.id.recepientEditText).requestFocus(); } } initListeners(); sendSmsProgressDialog = new ProgressDialog(SmsComposeActivity.this); sendSmsProgressDialog.setTitle(getString(R.string.please_wait)); sendSmsProgressDialog.setMessage(getString(R.string.sms_progress_sending)); } @Override protected void onResume() { super.onResume(); setBroadcastReceiver(); } @Override protected void onPause() { super.onPause(); unsetBroadcastReceiver(); } @Override protected void onDestroy() { super.onDestroy(); unsetBroadcastReceiver(); } private void initListeners() { final View sendButtonLayout = findViewById(R.id.smsSendButtonLayout); sendButtonLayout.setEnabled(false); sendButtonLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { sendSmsProgressDialog.show(); String phoneNumber = ((EditText) findViewById(R.id.recepientEditText)).getText().toString(); String message = ((EditText) findViewById(R.id.smsContentEditText)).getText().toString(); sendSMS(phoneNumber, message); new Thread(new Runnable() { @Override public void run() { try { Looper.prepare(); Thread.sleep(ApplicationConstants.SMS_SEND_TIMEOUT); SmsComposeActivity.this.runOnUiThread(new Runnable() { @Override public void run() { if (sendSuccessful >= 1 && deliverySuccessful != maxBroadcasts) { onTimeout(); } } }); } catch (InterruptedException e) { e.printStackTrace(); } } }).start(); } }); View cancelButtonLayout = findViewById(R.id.smsCancelButtonLayout); cancelButtonLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { finish(); } }); findViewById(R.id.chooseContactButton).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { pickPhoneNumber(); } }); ((EditText) findViewById(R.id.recepientEditText)).addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { if (s.length() > 0 && PhoneNumberUtils.isGlobalPhoneNumber(s.toString())) sendButtonLayout.setEnabled(true); else sendButtonLayout.setEnabled(false); } }); final EditText contentEditText = (EditText) findViewById(R.id.smsContentEditText); contentEditText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(MAX_SMS_CONTENT_CHARS) }); contentEditText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { final TextView sendButtonTextView = (TextView) findViewById(R.id.smsSendButton); if (s.length() > 0) { sendButtonTextView.setText(getString(R.string.sms_detail_send) + " (" + s.length() + "/" + MAX_SMS_CONTENT_CHARS + ")"); sendButtonLayout.setEnabled(true); } else { sendButtonTextView.setText(getString(R.string.sms_detail_send)); sendButtonLayout.setEnabled(false); } } }); } @Override protected void initGestureLibrary() { gestureLibrary = GestureLibraries.fromRawResource(this, R.raw.cldii_gestures); gestureLibrary.load(); } @Override public void onGesturePerformed(Prediction prediction) { // no gesture mode } @Override public StateModel getStateModel() { // no gesture mode return null; } private void pickPhoneNumber() { AlertDialog.Builder builder = new AlertDialog.Builder(this); final View selectNumberView = new SmsDialogSelectNumber(this, getDataProviderManager()); builder.setTitle(getString(R.string.sms_selectNumber)); builder.setView(selectNumberView); builder.setPositiveButton(R.string.confirm_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String number = ((SmsDialogSelectNumberAdapter) ((ListView) tempAlertDialogView .findViewById(R.id.phoneNumberList)).getAdapter()).getNumber(); if (number != null) ((EditText) findViewById(R.id.recepientEditText)).setText(number); } }); builder.setNegativeButton(R.string.confirm_cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); this.tempAlertDialogView = selectNumberView; builder.create().show(); } private void sendSMS(String phoneNumber, String message) { maxBroadcasts = 0; sendSuccessful = 0; deliverySuccessful = 0; SmsManager sms = SmsManager.getDefault(); ArrayList<String> smsParts = sms.divideMessage(message); ArrayList<PendingIntent> sentIntents = new ArrayList<PendingIntent>(); ArrayList<PendingIntent> deliveredIntents = new ArrayList<PendingIntent>(); PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, new Intent(SENT), 0); PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0, new Intent(DELIVERED), 0); for (int i = 0; i < smsParts.size(); i++) { sentIntents.add(sentPI); deliveredIntents.add(deliveredPI); maxBroadcasts++; Log.d(TAG, "maxBroadcasts: " + maxBroadcasts); } sms.sendMultipartTextMessage(phoneNumber, null, smsParts, sentIntents, deliveredIntents); } private void onSmsSendSuccess() { sendSmsProgressDialog.dismiss(); Toast.makeText(getBaseContext(), getString(R.string.sms_prompt_smssendsuccessful), Toast.LENGTH_LONG).show(); Log.d(TAG, "TOAST: " + getString(R.string.sms_prompt_smssendsuccessful)); finish(); } private void onSmsSendFail() { sendSmsProgressDialog.dismiss(); Toast.makeText(getBaseContext(), getString(R.string.sms_prompt_smssendfailed), Toast.LENGTH_LONG).show(); Log.d(TAG, "TOAST: " + getString(R.string.sms_prompt_smssendfailed)); } private void onTimeout() { sendSmsProgressDialog.dismiss(); if (sendSuccessful >= 1 && deliverySuccessful < maxBroadcasts) { Toast.makeText(getBaseContext(), getString(R.string.sms_prompt_timeout), Toast.LENGTH_LONG).show(); Log.d(TAG, "TOAST (timeout): " + getString(R.string.sms_prompt_timeout)); finish(); } else if (sendSuccessful < 1) { Toast.makeText(getBaseContext(), getString(R.string.sms_prompt_smssendfailed), Toast.LENGTH_LONG).show(); Log.d(TAG, "TOAST (timeout): " + getString(R.string.sms_prompt_smssendfailed)); } } private void setBroadcastReceiver() { if (!broadcastReceiversSet) { registerReceiver(sentBroadcastReceiver, new IntentFilter(SENT)); registerReceiver(deliveredBroadcastReceiver, new IntentFilter(DELIVERED)); broadcastReceiversSet = true; } } private void unsetBroadcastReceiver() { if (broadcastReceiversSet) { unregisterReceiver(sentBroadcastReceiver); unregisterReceiver(deliveredBroadcastReceiver); broadcastReceiversSet = false; } } }
UTF-8
Java
12,671
SmsComposeActivity.java.svn-base
Java
[ { "context": " Activity for composing/reply a Sms\n * \n * @author Jun Chen, jambit GmbH\n * \n */\n\npublic class SmsComposeActi", "end": 1355, "score": 0.9990838766098022, "start": 1347, "tag": "NAME", "value": "Jun Chen" } ]
null
[]
package de.telekom.cldii.view.sms; import static de.telekom.cldii.ApplicationConstants.EXTRAS_KEY_SMSCONTENT; import static de.telekom.cldii.ApplicationConstants.EXTRAS_KEY_SMSNUMBER; import java.util.ArrayList; import android.app.Activity; import android.app.AlertDialog; import android.app.PendingIntent; import android.app.ProgressDialog; import android.content.BroadcastReceiver; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.gesture.GestureLibraries; import android.gesture.Prediction; import android.os.Bundle; import android.os.Looper; import android.telephony.PhoneNumberUtils; import android.telephony.SmsManager; import android.text.Editable; import android.text.InputFilter; import android.text.TextWatcher; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.EditText; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import de.telekom.cldii.ApplicationConstants; import de.telekom.cldii.R; import de.telekom.cldii.statemachine.StateModel; import de.telekom.cldii.view.AbstractActivity; import de.telekom.cldii.view.sms.adapter.SmsDialogSelectNumberAdapter; /** * Activity for composing/reply a Sms * * @author <NAME>, jambit GmbH * */ public class SmsComposeActivity extends AbstractActivity { private static final int MAX_SMS_CONTENT_CHARS = 1000; private final String TAG = "SmsComposeActivity"; private ProgressDialog sendSmsProgressDialog; private String SENT = "SMS_SENT"; private String DELIVERED = "SMS_DELIVERED"; private boolean broadcastReceiversSet = false; private int sendSuccessful = 0; private int deliverySuccessful = 0; private int maxBroadcasts = 0; private View tempAlertDialogView; /** * BroadcastReceiver for "SMS_SENT" broadcast. */ BroadcastReceiver sentBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context arg0, Intent arg1) { switch (getResultCode()) { case Activity.RESULT_OK: sendSuccessful++; Log.d(TAG, "sendSuccessful: " + sendSuccessful); break; default: onSmsSendFail(); break; } } }; /** * BroadcastReceiver for "SMS_DELIVERED" broadcast. */ BroadcastReceiver deliveredBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context arg0, Intent arg1) { switch (getResultCode()) { case Activity.RESULT_OK: deliverySuccessful++; Log.d(TAG, "deliverySuccessful: " + deliverySuccessful); if (sendSuccessful >= 1 && deliverySuccessful == maxBroadcasts) { onSmsSendSuccess(); } break; } } }; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sms_compose); setTopBarName(getString(R.string.section_sms)); hideSpeakButton(); Bundle extras = getIntent().getExtras(); if (extras != null) { if (extras.containsKey(EXTRAS_KEY_SMSNUMBER)) { ((EditText) findViewById(R.id.recepientEditText)).setText(extras.getString(EXTRAS_KEY_SMSNUMBER)); findViewById(R.id.smsContentEditText).requestFocus(); } if (extras.containsKey(EXTRAS_KEY_SMSCONTENT)) { ((EditText) findViewById(R.id.smsContentEditText)).setText("\n\n" + extras.getString(EXTRAS_KEY_SMSCONTENT)); findViewById(R.id.recepientEditText).requestFocus(); } } initListeners(); sendSmsProgressDialog = new ProgressDialog(SmsComposeActivity.this); sendSmsProgressDialog.setTitle(getString(R.string.please_wait)); sendSmsProgressDialog.setMessage(getString(R.string.sms_progress_sending)); } @Override protected void onResume() { super.onResume(); setBroadcastReceiver(); } @Override protected void onPause() { super.onPause(); unsetBroadcastReceiver(); } @Override protected void onDestroy() { super.onDestroy(); unsetBroadcastReceiver(); } private void initListeners() { final View sendButtonLayout = findViewById(R.id.smsSendButtonLayout); sendButtonLayout.setEnabled(false); sendButtonLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { sendSmsProgressDialog.show(); String phoneNumber = ((EditText) findViewById(R.id.recepientEditText)).getText().toString(); String message = ((EditText) findViewById(R.id.smsContentEditText)).getText().toString(); sendSMS(phoneNumber, message); new Thread(new Runnable() { @Override public void run() { try { Looper.prepare(); Thread.sleep(ApplicationConstants.SMS_SEND_TIMEOUT); SmsComposeActivity.this.runOnUiThread(new Runnable() { @Override public void run() { if (sendSuccessful >= 1 && deliverySuccessful != maxBroadcasts) { onTimeout(); } } }); } catch (InterruptedException e) { e.printStackTrace(); } } }).start(); } }); View cancelButtonLayout = findViewById(R.id.smsCancelButtonLayout); cancelButtonLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { finish(); } }); findViewById(R.id.chooseContactButton).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { pickPhoneNumber(); } }); ((EditText) findViewById(R.id.recepientEditText)).addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { if (s.length() > 0 && PhoneNumberUtils.isGlobalPhoneNumber(s.toString())) sendButtonLayout.setEnabled(true); else sendButtonLayout.setEnabled(false); } }); final EditText contentEditText = (EditText) findViewById(R.id.smsContentEditText); contentEditText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(MAX_SMS_CONTENT_CHARS) }); contentEditText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { final TextView sendButtonTextView = (TextView) findViewById(R.id.smsSendButton); if (s.length() > 0) { sendButtonTextView.setText(getString(R.string.sms_detail_send) + " (" + s.length() + "/" + MAX_SMS_CONTENT_CHARS + ")"); sendButtonLayout.setEnabled(true); } else { sendButtonTextView.setText(getString(R.string.sms_detail_send)); sendButtonLayout.setEnabled(false); } } }); } @Override protected void initGestureLibrary() { gestureLibrary = GestureLibraries.fromRawResource(this, R.raw.cldii_gestures); gestureLibrary.load(); } @Override public void onGesturePerformed(Prediction prediction) { // no gesture mode } @Override public StateModel getStateModel() { // no gesture mode return null; } private void pickPhoneNumber() { AlertDialog.Builder builder = new AlertDialog.Builder(this); final View selectNumberView = new SmsDialogSelectNumber(this, getDataProviderManager()); builder.setTitle(getString(R.string.sms_selectNumber)); builder.setView(selectNumberView); builder.setPositiveButton(R.string.confirm_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String number = ((SmsDialogSelectNumberAdapter) ((ListView) tempAlertDialogView .findViewById(R.id.phoneNumberList)).getAdapter()).getNumber(); if (number != null) ((EditText) findViewById(R.id.recepientEditText)).setText(number); } }); builder.setNegativeButton(R.string.confirm_cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); this.tempAlertDialogView = selectNumberView; builder.create().show(); } private void sendSMS(String phoneNumber, String message) { maxBroadcasts = 0; sendSuccessful = 0; deliverySuccessful = 0; SmsManager sms = SmsManager.getDefault(); ArrayList<String> smsParts = sms.divideMessage(message); ArrayList<PendingIntent> sentIntents = new ArrayList<PendingIntent>(); ArrayList<PendingIntent> deliveredIntents = new ArrayList<PendingIntent>(); PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, new Intent(SENT), 0); PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0, new Intent(DELIVERED), 0); for (int i = 0; i < smsParts.size(); i++) { sentIntents.add(sentPI); deliveredIntents.add(deliveredPI); maxBroadcasts++; Log.d(TAG, "maxBroadcasts: " + maxBroadcasts); } sms.sendMultipartTextMessage(phoneNumber, null, smsParts, sentIntents, deliveredIntents); } private void onSmsSendSuccess() { sendSmsProgressDialog.dismiss(); Toast.makeText(getBaseContext(), getString(R.string.sms_prompt_smssendsuccessful), Toast.LENGTH_LONG).show(); Log.d(TAG, "TOAST: " + getString(R.string.sms_prompt_smssendsuccessful)); finish(); } private void onSmsSendFail() { sendSmsProgressDialog.dismiss(); Toast.makeText(getBaseContext(), getString(R.string.sms_prompt_smssendfailed), Toast.LENGTH_LONG).show(); Log.d(TAG, "TOAST: " + getString(R.string.sms_prompt_smssendfailed)); } private void onTimeout() { sendSmsProgressDialog.dismiss(); if (sendSuccessful >= 1 && deliverySuccessful < maxBroadcasts) { Toast.makeText(getBaseContext(), getString(R.string.sms_prompt_timeout), Toast.LENGTH_LONG).show(); Log.d(TAG, "TOAST (timeout): " + getString(R.string.sms_prompt_timeout)); finish(); } else if (sendSuccessful < 1) { Toast.makeText(getBaseContext(), getString(R.string.sms_prompt_smssendfailed), Toast.LENGTH_LONG).show(); Log.d(TAG, "TOAST (timeout): " + getString(R.string.sms_prompt_smssendfailed)); } } private void setBroadcastReceiver() { if (!broadcastReceiversSet) { registerReceiver(sentBroadcastReceiver, new IntentFilter(SENT)); registerReceiver(deliveredBroadcastReceiver, new IntentFilter(DELIVERED)); broadcastReceiversSet = true; } } private void unsetBroadcastReceiver() { if (broadcastReceiversSet) { unregisterReceiver(sentBroadcastReceiver); unregisterReceiver(deliveredBroadcastReceiver); broadcastReceiversSet = false; } } }
12,669
0.611396
0.609423
352
34.997158
29.831011
117
false
false
0
0
0
0
0
0
0.573864
false
false
7
42563b3b042f254b23f3ad7609718689822c0819
33,535,104,672,601
cde787159535844ab9adf1cd8fb3285f8eb567cd
/app/src/main/java/practice/code/com/baseframework/adapter/RefishRV.java
e842648f7f300d8af16c0bf30c7c8ca6bee5ba4e
[]
no_license
15239206484/MVC
https://github.com/15239206484/MVC
753b49ddb1a2ba26d12b1cf1cd5daf3e08bfd065
37ac33106903cd0f1d7106d85f6a0116b4da6abc
refs/heads/master
2021-01-11T13:40:55.677000
2017-05-13T07:38:34
2017-05-13T07:38:34
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package practice.code.com.baseframework.adapter; import android.content.Context; import com.androidkun.adapter.BaseAdapter; import com.androidkun.adapter.ViewHolder; import java.util.List; import practice.code.com.baseframework.R; import practice.code.com.baseframework.model.entity.MessageEntity; /** * Created by Administrator on 2017/5/11 0011. */ public class RefishRV extends BaseAdapter<MessageEntity.NewsBean> { public RefishRV(Context context, List<MessageEntity.NewsBean> datas) { super(context, R.layout.item_rv, datas); } @Override public void convert(ViewHolder holder, MessageEntity.NewsBean newsBean) { holder.setText(R.id.item_txt,newsBean.getAuthorid()); } }
UTF-8
Java
722
java
RefishRV.java
Java
[]
null
[]
package practice.code.com.baseframework.adapter; import android.content.Context; import com.androidkun.adapter.BaseAdapter; import com.androidkun.adapter.ViewHolder; import java.util.List; import practice.code.com.baseframework.R; import practice.code.com.baseframework.model.entity.MessageEntity; /** * Created by Administrator on 2017/5/11 0011. */ public class RefishRV extends BaseAdapter<MessageEntity.NewsBean> { public RefishRV(Context context, List<MessageEntity.NewsBean> datas) { super(context, R.layout.item_rv, datas); } @Override public void convert(ViewHolder holder, MessageEntity.NewsBean newsBean) { holder.setText(R.id.item_txt,newsBean.getAuthorid()); } }
722
0.756233
0.740997
28
24.785715
26.927624
77
false
false
0
0
0
0
0
0
0.5
false
false
7
fda15f567104504c8a364d41f72a4341b4bf3544
1,322,849,965,142
6723c867c65988f3deb25562b672f1ee362bf65d
/app/src/main/java/com/destinyapp/e_businessprofile/Activity/ui/home/Healtcare/Hospital/BusinessRefrence/Ebook/EbookActivity.java
5bd2b395633a147c4f680a26cbdce6f697d29227
[]
no_license
musupadi/TrialeBusinessProfile
https://github.com/musupadi/TrialeBusinessProfile
2625e174254bda8e8eb1ed9aec3b7955ec4be8c0
01fbf451b47595c59eaf25eb5397a4cbed7c8f91
refs/heads/master
2020-09-20T12:11:52.072000
2019-11-28T03:32:30
2019-11-28T03:32:30
224,472,248
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.destinyapp.e_businessprofile.Activity.ui.home.Healtcare.Hospital.BusinessRefrence.Ebook; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.LinearLayout; import com.destinyapp.e_businessprofile.Activity.ui.home.Healtcare.Hospital.BusinessRefrence.BusinessRefrenceActivity; import com.destinyapp.e_businessprofile.Model.Method; import com.destinyapp.e_businessprofile.R; public class EbookActivity extends AppCompatActivity { LinearLayout full,highlight; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ebook); full = findViewById(R.id.linearFullVersion); highlight = findViewById(R.id.linearHighlight); final Method method = new Method(); full.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(EbookActivity.this, FullVersionActivity.class); startActivity(intent); } }); highlight.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { method.copyReadAssets(EbookActivity.this,"Materi Highligt e-Book.pdf"); } }); } }
UTF-8
Java
1,427
java
EbookActivity.java
Java
[]
null
[]
package com.destinyapp.e_businessprofile.Activity.ui.home.Healtcare.Hospital.BusinessRefrence.Ebook; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.LinearLayout; import com.destinyapp.e_businessprofile.Activity.ui.home.Healtcare.Hospital.BusinessRefrence.BusinessRefrenceActivity; import com.destinyapp.e_businessprofile.Model.Method; import com.destinyapp.e_businessprofile.R; public class EbookActivity extends AppCompatActivity { LinearLayout full,highlight; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ebook); full = findViewById(R.id.linearFullVersion); highlight = findViewById(R.id.linearHighlight); final Method method = new Method(); full.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(EbookActivity.this, FullVersionActivity.class); startActivity(intent); } }); highlight.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { method.copyReadAssets(EbookActivity.this,"Materi Highligt e-Book.pdf"); } }); } }
1,427
0.702873
0.702873
37
37.567566
28.814919
118
false
false
0
0
0
0
0
0
0.621622
false
false
7
7e8752d667de9d8f51cbd068d9446c77879d11e5
18,459,769,464,245
c89a3b28c6de673420137c85e95c427e7682baf8
/src/main/java/com/redq/latte/mapper/ZoneMapper.java
3d1fddabd08f14111c8d29a3acaa46cb009885be
[]
no_license
ahlon/latte
https://github.com/ahlon/latte
bcc92b2c7b448374b241ce7ad48c54de47d174ad
155ca015d812fc7acf4b7ebc06d143eb8781a089
refs/heads/master
2020-05-21T04:35:48.683000
2018-07-31T12:56:00
2018-07-31T12:56:00
55,217,214
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.redq.latte.mapper; import java.util.List; import com.redq.latte.common.CrudMapper; import com.redq.latte.model.Zone; public interface ZoneMapper extends CrudMapper<Zone> { List<Zone> selectByParentId(Long parentId); }
UTF-8
Java
237
java
ZoneMapper.java
Java
[]
null
[]
package com.redq.latte.mapper; import java.util.List; import com.redq.latte.common.CrudMapper; import com.redq.latte.model.Zone; public interface ZoneMapper extends CrudMapper<Zone> { List<Zone> selectByParentId(Long parentId); }
237
0.78481
0.78481
12
18.75
19.807932
54
false
false
0
0
0
0
0
0
0.583333
false
false
7
654a497e75221eb2ae2dafafe40f7290bcc59862
3,624,952,427,950
356dcbf5b2b897729a84efe6dbf992b913799410
/app/src/main/java/com/fluidsoft/fluidsoft/tgconnect/SignInActivity.java
fbe17c90dc174148b016ce2101d2d1d4d75f1f30
[]
no_license
PrernaYadav/FitnessApp
https://github.com/PrernaYadav/FitnessApp
3474aef4a687fefab911f2ee586e40bd4a5b7bce
e3581814e2c4a24ed151dc2321474add024bfc4f
refs/heads/master
2021-08-19T02:03:53.006000
2017-11-24T12:33:43
2017-11-24T12:33:43
111,916,562
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fluidsoft.fluidsoft.tgconnect; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; import android.provider.Settings; import android.support.annotation.NonNull; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.text.Editable; import android.text.InputType; import android.text.TextWatcher; import android.text.method.PasswordTransformationMethod; import android.util.Log; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.facebook.CallbackManager; import com.facebook.FacebookCallback; import com.facebook.FacebookException; import com.facebook.FacebookSdk; import com.facebook.GraphRequest; import com.facebook.GraphResponse; import com.facebook.Profile; import com.facebook.login.LoginManager; import com.facebook.login.LoginResult; import com.google.android.gms.auth.api.Auth; import com.google.android.gms.auth.api.signin.GoogleSignInAccount; import com.google.android.gms.auth.api.signin.GoogleSignInOptions; import com.google.android.gms.auth.api.signin.GoogleSignInResult; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.json.JSONObject; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; public class SignInActivity extends AppCompatActivity implements GoogleApiClient.OnConnectionFailedListener, TextWatcher { EditText et_username, et_email, et_password; Button btn_signup; TextView txt_forgot_password; Button btn_signin_facebook, btn_signin_google, btn_signin_twitter, btn_signin_instagram; String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+";// LoginButton btn_signin_facebook; SharedPreferences sharedpreferences; CallbackManager callbackManager; // SignInButton google_signin; GoogleApiClient googleApiClient; private int RC_SIGN_IN = 100; private final Jsonparse jsonParser = new Jsonparse(this); public static String name, email, pass; public static String loginType; public static String emailGmail; public static String nameGmail; public static Uri dpGmail; public static String profilePictureString; public static Uri fb_profile_pic; public static String emailFB; Boolean isFirstTime; public static final String Email = "emailKey"; public static final String Type = "emailType"; public static final String MyPREFERENCES = "MyPrefs" ; Toolbar toolbar; String deviceIdd; SharedPreferences.Editor editor1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); FacebookSdk.sdkInitialize(getApplicationContext()); callbackManager = CallbackManager.Factory.create(); String deviceId =Settings.Secure.getString(this.getContentResolver(),Settings .Secure.ANDROID_ID); String build=Build.SERIAL; /*Settings.Secure.getString(this.getContentResolver(),android.os.Build.SERIAL);*/ LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { GraphRequest request = GraphRequest.newMeRequest(loginResult.getAccessToken(), new GraphRequest.GraphJSONObjectCallback() { public void onCompleted(JSONObject jsonObject, GraphResponse response) { Profile profile = Profile.getCurrentProfile(); fb_profile_pic = profile.getProfilePictureUri(200, 200); profilePictureString = String.valueOf(fb_profile_pic); Bundle facebookData = getFacebookData(jsonObject); emailFB = facebookData.getString("emailfb"); /* idFB = facebookData.getString("idFacebook"); nameFB = facebookData.getString("name"); gender = facebookData.getString("gender"); about = facebookData.getString("about"); birthday = facebookData.getString("birthday"); */ } }); loginType = "F"; Intent intent = new Intent(SignInActivity.this, CategoryActivity.class); startActivity(intent); } @Override public void onCancel() { Toast.makeText(SignInActivity.this, "Login Cancel", Toast.LENGTH_LONG).show(); } @Override public void onError(FacebookException exception) { Toast.makeText(SignInActivity.this, exception.getMessage(), Toast.LENGTH_LONG).show(); } }); setContentView(R.layout.activity_sign_in); et_username = (EditText) findViewById(R.id.et_username); et_email = (EditText) findViewById(R.id.et_email); et_password = (EditText) findViewById(R.id.et_password); et_username.setPressed(false); et_email.setPressed(false); et_password.setPressed(false); et_password.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); et_password.setTransformationMethod(PasswordTransformationMethod.getInstance()); btn_signup = (Button) findViewById(R.id.btn_sign_up); txt_forgot_password = (TextView) findViewById(R.id.txt_forgot_password); btn_signin_facebook = (Button) findViewById(R.id.signin_facebook); // btn_signin_facebook = (LoginButton) findViewById(R.id.signin_facebook); // btn_signin_facebook.setBackgroundResource(R.drawable.facebook_small); SharedPreferences pref = getApplicationContext().getSharedPreferences("login", 0); // 0 - for private mode editor1= pref.edit(); btn_signin_google = (Button) findViewById(R.id.signin_google); et_username.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) @Override public void onTextChanged(CharSequence s, int start, int before, int count) { et_username.setBackground(et_username.hasFocus() ? getResources().getDrawable(R.drawable.rounded_edit_text) : getResources().getDrawable(R.drawable.red_rounded_edit_text)); et_username.setTextColor(et_username.hasFocus() ? getResources().getColor(R.color.app_color) : getResources().getColor(R.color.red)); } @Override public void afterTextChanged(Editable s) { } }); et_email.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) @Override public void onTextChanged(CharSequence s, int start, int before, int count) { et_email.setBackground(et_email.hasFocus() ? getResources().getDrawable(R.drawable.rounded_edit_text) : getResources().getDrawable(R.drawable.red_rounded_edit_text)); et_email.setTextColor(et_email.hasFocus() ? getResources().getColor(R.color.app_color) : getResources().getColor(R.color.red)); } @Override public void afterTextChanged(Editable s) { } }); et_password.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) @Override public void onTextChanged(CharSequence s, int start, int before, int count) { et_password.setBackground(et_password.hasFocus() ? getResources().getDrawable(R.drawable.rounded_edit_text) : getResources().getDrawable(R.drawable.red_rounded_edit_text)); et_password.setTextColor(et_password.hasFocus() ? getResources().getColor(R.color.app_color) : getResources().getColor(R.color.red)); } @Override public void afterTextChanged(Editable s) { } }); et_username.setOnFocusChangeListener(new View.OnFocusChangeListener() { @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { et_username.setBackground(getResources().getDrawable(R.drawable.rounded_edit_text)); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(et_username, InputMethodManager.SHOW_IMPLICIT); } } }); et_email.setOnFocusChangeListener(new View.OnFocusChangeListener() { @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) public void onFocusChange(View v, boolean hasFocus) { /* et_username.setPressed(false); et_username.setFocusable(true); et_password.setPressed(false); et_password.setFocusable(true);*/ if (hasFocus) { et_email.setBackground(getResources().getDrawable(R.drawable.rounded_edit_text)); InputMethodManager imm1 = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm1.showSoftInput(et_email, InputMethodManager.SHOW_IMPLICIT); } } }); et_password.setOnFocusChangeListener(new View.OnFocusChangeListener() { @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) public void onFocusChange(View v, boolean hasFocus) { /* et_password.setActivated(true); et_password.setPressed(true); et_password.setFocusable(true);*/ if (hasFocus) { et_password.setBackground(getResources().getDrawable(R.drawable.rounded_edit_text)); InputMethodManager imm2 = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm2.showSoftInput(et_password, InputMethodManager.SHOW_IMPLICIT); } } }); SharedPreferences app_preferences = PreferenceManager .getDefaultSharedPreferences(SignInActivity.this); final SharedPreferences.Editor editor = app_preferences.edit(); isFirstTime = app_preferences.getBoolean("isFirstTime", true); if (isFirstTime) { //implement your first time logic editor.putBoolean("isFirstTime", false); editor.commit(); }else{ //app open directly startActivity(new Intent(SignInActivity.this,CategoryActivity.class)); } //google sign in GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestEmail() .build(); googleApiClient = new GoogleApiClient.Builder(this) .enableAutoManage(this, this) .addApi(Auth.GOOGLE_SIGN_IN_API, gso) .build(); btn_signin_google = (Button) findViewById(R.id.signin_google); btn_signin_google.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor1.putString("email", emailGmail); editor1.putString("type",loginType); // Storing string Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(googleApiClient); startActivityForResult(signInIntent, RC_SIGN_IN); } }); btn_signin_facebook.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { editor1.putString("email",emailFB); editor1.putString("type",loginType); LoginManager.getInstance().logInWithReadPermissions(SignInActivity.this, Arrays.asList("public_profile", "user_friends")); } }); btn_signup.setOnClickListener(new View.OnClickListener() { @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) @Override public void onClick(View view) { loginType = "N"; name = et_username.getText().toString(); email = et_email.getText().toString(); pass = et_password.getText().toString(); editor1.putString("email",email); editor1.putString("type",loginType); //store /* SharedPreferences.Editor editor = sharedpreferences.edit(); editor.putString(Email, email); editor.putString(Type,loginType); editor.commit();*/ if (name.equals("")) { et_username.setBackground(getResources().getDrawable(R.drawable.red_rounded_edit_text)); et_username.setTextColor(getResources().getColor(R.color.red)); } else if (et_email.length() < 5 || et_email.getText().toString().equals("") || !et_email.getText().toString().trim().matches(emailPattern)) { et_email.setTextColor(getResources().getColor(R.color.red)); et_email.setBackground(getResources().getDrawable(R.drawable.red_rounded_edit_text)); } else if (pass.equals("")) { et_password.setTextColor(getResources().getColor(R.color.red)); et_password.setBackground(getResources().getDrawable(R.drawable.red_rounded_edit_text)); } else { /* deviceId = DeviceID.generateID(JobsActivity.this); et_username.addTextChangedListener(new ); et_username.setTextColor(getResources().getColor(R.color.app_color)); et_email.setBackground(getResources().getDrawable(R.drawable.rounded_edit_text)); et_username.setBackground(getResources().getDrawable(R.drawable.rounded_edit_text)); et_password.setBackground(getResources().getDrawable(R.drawable.rounded_edit_text)); et_email.setTextColor(getResources().getColor(R.color.app_color)); et_password.setTextColor(getResources().getColor(R.color.app_color)); */ deviceIdd = DeviceID.generateID(SignInActivity.this); new signinPage().execute(); } } }); /* et_username.setTextColor(getResources().getColor(R.color.app_color)); et_password.setTextColor(getResources().getColor(R.color.app_color)); et_email.setTextColor(getResources().getColor(R.color.app_color)); */ } private Bundle getFacebookData(JSONObject object) { Bundle bundle = new Bundle(); try { String id = object.getString("id"); bundle.putString("idFacebook", id); if (object.has("name")) bundle.putString("name", object.getString("name")); if (object.has("first_name")) bundle.putString("first_name", object.getString("first_name")); if (object.has("last_name")) bundle.putString("last_name", object.getString("last_name")); if (object.has("emailfb")) bundle.putString("emailfb", object.getString("emailfb")); if (object.has("gender")) bundle.putString("gender", object.getString("gender")); if (object.has("about")) bundle.putString("about", object.getString("about")); if (object.has("phone_number")) bundle.putString("phone_number", object.getString("phone_number")); } catch (Exception e) { Log.d("TAG", "BUNDLE Exception : " + e.toString()); } return bundle; } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { } /* @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) @Override public void onTextChanged(CharSequence s, int start, int before, int count) { et_username.setTextColor(et_username.hasFocus() ? getResources().getColor(R.color.app_color) : getResources().getColor(R.color.red)); } @Override public void afterTextChanged(Editable s) { }*/ private class signinPage extends AsyncTask<String, Void, Boolean> { @Override protected Boolean doInBackground(String... params) { ArrayList<NameValuePair> param = new ArrayList<>(); param.add(new BasicNameValuePair("UserName", name)); param.add(new BasicNameValuePair("EmailId", email)); param.add(new BasicNameValuePair("Password", pass)); param.add(new BasicNameValuePair("DeviceID",deviceIdd)); Log.i("param", "param:" + param); try { //------------------>> HttpGet httppost = new HttpGet(UserInformation.signup); HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = httpclient.execute(httppost); JSONObject jobj = jsonParser.makeHttpRequest(UserInformation.signup, "POST", param); // StatusLine stat = response.getStatusLine(); int status = response.getStatusLine().getStatusCode(); if (status == 200) { Intent intent = new Intent(SignInActivity.this, CategoryActivity.class); startActivity(intent); } else { } } catch (IOException e) { e.printStackTrace(); } return false; } @Override protected void onPostExecute(Boolean result) { super.onPostExecute(result); Log.i("tag", "" + result); } } /* @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { callbackManager.onActivityResult(requestCode, resultCode, data); }*/ @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (callbackManager.onActivityResult(requestCode, resultCode, data)) { return; } if (requestCode == RC_SIGN_IN) { GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data); handleSignInResult(result); } } @Override public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { } private void handleSignInResult(GoogleSignInResult result) { Log.d("TAG", "handleSignInResult:" + result.isSuccess()); if (result.isSuccess()) { // Signed in successfully, show authenticated UI. GoogleSignInAccount acct = result.getSignInAccount(); loginType = "G"; nameGmail = acct.getDisplayName(); emailGmail = acct.getEmail(); dpGmail = acct.getPhotoUrl(); profilePictureString = String.valueOf(dpGmail); // mStatusTextView.setText(getString(R.string.signed_in_fmt, acct.getDisplayName())); Intent i = new Intent(SignInActivity.this, CategoryActivity.class); startActivity(i); // updateUI(true); } else { // Signed out, show unauthenticated UI. // updateUI(false); } } }
UTF-8
Java
21,056
java
SignInActivity.java
Java
[ { "context": " param.add(new BasicNameValuePair(\"Password\", pass));\n param.add(new BasicNameValuePair(\"", "end": 18284, "score": 0.9326726794242859, "start": 18280, "tag": "PASSWORD", "value": "pass" } ]
null
[]
package com.fluidsoft.fluidsoft.tgconnect; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; import android.provider.Settings; import android.support.annotation.NonNull; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.text.Editable; import android.text.InputType; import android.text.TextWatcher; import android.text.method.PasswordTransformationMethod; import android.util.Log; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.facebook.CallbackManager; import com.facebook.FacebookCallback; import com.facebook.FacebookException; import com.facebook.FacebookSdk; import com.facebook.GraphRequest; import com.facebook.GraphResponse; import com.facebook.Profile; import com.facebook.login.LoginManager; import com.facebook.login.LoginResult; import com.google.android.gms.auth.api.Auth; import com.google.android.gms.auth.api.signin.GoogleSignInAccount; import com.google.android.gms.auth.api.signin.GoogleSignInOptions; import com.google.android.gms.auth.api.signin.GoogleSignInResult; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.json.JSONObject; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; public class SignInActivity extends AppCompatActivity implements GoogleApiClient.OnConnectionFailedListener, TextWatcher { EditText et_username, et_email, et_password; Button btn_signup; TextView txt_forgot_password; Button btn_signin_facebook, btn_signin_google, btn_signin_twitter, btn_signin_instagram; String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+";// LoginButton btn_signin_facebook; SharedPreferences sharedpreferences; CallbackManager callbackManager; // SignInButton google_signin; GoogleApiClient googleApiClient; private int RC_SIGN_IN = 100; private final Jsonparse jsonParser = new Jsonparse(this); public static String name, email, pass; public static String loginType; public static String emailGmail; public static String nameGmail; public static Uri dpGmail; public static String profilePictureString; public static Uri fb_profile_pic; public static String emailFB; Boolean isFirstTime; public static final String Email = "emailKey"; public static final String Type = "emailType"; public static final String MyPREFERENCES = "MyPrefs" ; Toolbar toolbar; String deviceIdd; SharedPreferences.Editor editor1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); FacebookSdk.sdkInitialize(getApplicationContext()); callbackManager = CallbackManager.Factory.create(); String deviceId =Settings.Secure.getString(this.getContentResolver(),Settings .Secure.ANDROID_ID); String build=Build.SERIAL; /*Settings.Secure.getString(this.getContentResolver(),android.os.Build.SERIAL);*/ LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { GraphRequest request = GraphRequest.newMeRequest(loginResult.getAccessToken(), new GraphRequest.GraphJSONObjectCallback() { public void onCompleted(JSONObject jsonObject, GraphResponse response) { Profile profile = Profile.getCurrentProfile(); fb_profile_pic = profile.getProfilePictureUri(200, 200); profilePictureString = String.valueOf(fb_profile_pic); Bundle facebookData = getFacebookData(jsonObject); emailFB = facebookData.getString("emailfb"); /* idFB = facebookData.getString("idFacebook"); nameFB = facebookData.getString("name"); gender = facebookData.getString("gender"); about = facebookData.getString("about"); birthday = facebookData.getString("birthday"); */ } }); loginType = "F"; Intent intent = new Intent(SignInActivity.this, CategoryActivity.class); startActivity(intent); } @Override public void onCancel() { Toast.makeText(SignInActivity.this, "Login Cancel", Toast.LENGTH_LONG).show(); } @Override public void onError(FacebookException exception) { Toast.makeText(SignInActivity.this, exception.getMessage(), Toast.LENGTH_LONG).show(); } }); setContentView(R.layout.activity_sign_in); et_username = (EditText) findViewById(R.id.et_username); et_email = (EditText) findViewById(R.id.et_email); et_password = (EditText) findViewById(R.id.et_password); et_username.setPressed(false); et_email.setPressed(false); et_password.setPressed(false); et_password.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); et_password.setTransformationMethod(PasswordTransformationMethod.getInstance()); btn_signup = (Button) findViewById(R.id.btn_sign_up); txt_forgot_password = (TextView) findViewById(R.id.txt_forgot_password); btn_signin_facebook = (Button) findViewById(R.id.signin_facebook); // btn_signin_facebook = (LoginButton) findViewById(R.id.signin_facebook); // btn_signin_facebook.setBackgroundResource(R.drawable.facebook_small); SharedPreferences pref = getApplicationContext().getSharedPreferences("login", 0); // 0 - for private mode editor1= pref.edit(); btn_signin_google = (Button) findViewById(R.id.signin_google); et_username.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) @Override public void onTextChanged(CharSequence s, int start, int before, int count) { et_username.setBackground(et_username.hasFocus() ? getResources().getDrawable(R.drawable.rounded_edit_text) : getResources().getDrawable(R.drawable.red_rounded_edit_text)); et_username.setTextColor(et_username.hasFocus() ? getResources().getColor(R.color.app_color) : getResources().getColor(R.color.red)); } @Override public void afterTextChanged(Editable s) { } }); et_email.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) @Override public void onTextChanged(CharSequence s, int start, int before, int count) { et_email.setBackground(et_email.hasFocus() ? getResources().getDrawable(R.drawable.rounded_edit_text) : getResources().getDrawable(R.drawable.red_rounded_edit_text)); et_email.setTextColor(et_email.hasFocus() ? getResources().getColor(R.color.app_color) : getResources().getColor(R.color.red)); } @Override public void afterTextChanged(Editable s) { } }); et_password.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) @Override public void onTextChanged(CharSequence s, int start, int before, int count) { et_password.setBackground(et_password.hasFocus() ? getResources().getDrawable(R.drawable.rounded_edit_text) : getResources().getDrawable(R.drawable.red_rounded_edit_text)); et_password.setTextColor(et_password.hasFocus() ? getResources().getColor(R.color.app_color) : getResources().getColor(R.color.red)); } @Override public void afterTextChanged(Editable s) { } }); et_username.setOnFocusChangeListener(new View.OnFocusChangeListener() { @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { et_username.setBackground(getResources().getDrawable(R.drawable.rounded_edit_text)); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(et_username, InputMethodManager.SHOW_IMPLICIT); } } }); et_email.setOnFocusChangeListener(new View.OnFocusChangeListener() { @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) public void onFocusChange(View v, boolean hasFocus) { /* et_username.setPressed(false); et_username.setFocusable(true); et_password.setPressed(false); et_password.setFocusable(true);*/ if (hasFocus) { et_email.setBackground(getResources().getDrawable(R.drawable.rounded_edit_text)); InputMethodManager imm1 = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm1.showSoftInput(et_email, InputMethodManager.SHOW_IMPLICIT); } } }); et_password.setOnFocusChangeListener(new View.OnFocusChangeListener() { @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) public void onFocusChange(View v, boolean hasFocus) { /* et_password.setActivated(true); et_password.setPressed(true); et_password.setFocusable(true);*/ if (hasFocus) { et_password.setBackground(getResources().getDrawable(R.drawable.rounded_edit_text)); InputMethodManager imm2 = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm2.showSoftInput(et_password, InputMethodManager.SHOW_IMPLICIT); } } }); SharedPreferences app_preferences = PreferenceManager .getDefaultSharedPreferences(SignInActivity.this); final SharedPreferences.Editor editor = app_preferences.edit(); isFirstTime = app_preferences.getBoolean("isFirstTime", true); if (isFirstTime) { //implement your first time logic editor.putBoolean("isFirstTime", false); editor.commit(); }else{ //app open directly startActivity(new Intent(SignInActivity.this,CategoryActivity.class)); } //google sign in GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestEmail() .build(); googleApiClient = new GoogleApiClient.Builder(this) .enableAutoManage(this, this) .addApi(Auth.GOOGLE_SIGN_IN_API, gso) .build(); btn_signin_google = (Button) findViewById(R.id.signin_google); btn_signin_google.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor1.putString("email", emailGmail); editor1.putString("type",loginType); // Storing string Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(googleApiClient); startActivityForResult(signInIntent, RC_SIGN_IN); } }); btn_signin_facebook.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { editor1.putString("email",emailFB); editor1.putString("type",loginType); LoginManager.getInstance().logInWithReadPermissions(SignInActivity.this, Arrays.asList("public_profile", "user_friends")); } }); btn_signup.setOnClickListener(new View.OnClickListener() { @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) @Override public void onClick(View view) { loginType = "N"; name = et_username.getText().toString(); email = et_email.getText().toString(); pass = et_password.getText().toString(); editor1.putString("email",email); editor1.putString("type",loginType); //store /* SharedPreferences.Editor editor = sharedpreferences.edit(); editor.putString(Email, email); editor.putString(Type,loginType); editor.commit();*/ if (name.equals("")) { et_username.setBackground(getResources().getDrawable(R.drawable.red_rounded_edit_text)); et_username.setTextColor(getResources().getColor(R.color.red)); } else if (et_email.length() < 5 || et_email.getText().toString().equals("") || !et_email.getText().toString().trim().matches(emailPattern)) { et_email.setTextColor(getResources().getColor(R.color.red)); et_email.setBackground(getResources().getDrawable(R.drawable.red_rounded_edit_text)); } else if (pass.equals("")) { et_password.setTextColor(getResources().getColor(R.color.red)); et_password.setBackground(getResources().getDrawable(R.drawable.red_rounded_edit_text)); } else { /* deviceId = DeviceID.generateID(JobsActivity.this); et_username.addTextChangedListener(new ); et_username.setTextColor(getResources().getColor(R.color.app_color)); et_email.setBackground(getResources().getDrawable(R.drawable.rounded_edit_text)); et_username.setBackground(getResources().getDrawable(R.drawable.rounded_edit_text)); et_password.setBackground(getResources().getDrawable(R.drawable.rounded_edit_text)); et_email.setTextColor(getResources().getColor(R.color.app_color)); et_password.setTextColor(getResources().getColor(R.color.app_color)); */ deviceIdd = DeviceID.generateID(SignInActivity.this); new signinPage().execute(); } } }); /* et_username.setTextColor(getResources().getColor(R.color.app_color)); et_password.setTextColor(getResources().getColor(R.color.app_color)); et_email.setTextColor(getResources().getColor(R.color.app_color)); */ } private Bundle getFacebookData(JSONObject object) { Bundle bundle = new Bundle(); try { String id = object.getString("id"); bundle.putString("idFacebook", id); if (object.has("name")) bundle.putString("name", object.getString("name")); if (object.has("first_name")) bundle.putString("first_name", object.getString("first_name")); if (object.has("last_name")) bundle.putString("last_name", object.getString("last_name")); if (object.has("emailfb")) bundle.putString("emailfb", object.getString("emailfb")); if (object.has("gender")) bundle.putString("gender", object.getString("gender")); if (object.has("about")) bundle.putString("about", object.getString("about")); if (object.has("phone_number")) bundle.putString("phone_number", object.getString("phone_number")); } catch (Exception e) { Log.d("TAG", "BUNDLE Exception : " + e.toString()); } return bundle; } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { } /* @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) @Override public void onTextChanged(CharSequence s, int start, int before, int count) { et_username.setTextColor(et_username.hasFocus() ? getResources().getColor(R.color.app_color) : getResources().getColor(R.color.red)); } @Override public void afterTextChanged(Editable s) { }*/ private class signinPage extends AsyncTask<String, Void, Boolean> { @Override protected Boolean doInBackground(String... params) { ArrayList<NameValuePair> param = new ArrayList<>(); param.add(new BasicNameValuePair("UserName", name)); param.add(new BasicNameValuePair("EmailId", email)); param.add(new BasicNameValuePair("Password", <PASSWORD>)); param.add(new BasicNameValuePair("DeviceID",deviceIdd)); Log.i("param", "param:" + param); try { //------------------>> HttpGet httppost = new HttpGet(UserInformation.signup); HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = httpclient.execute(httppost); JSONObject jobj = jsonParser.makeHttpRequest(UserInformation.signup, "POST", param); // StatusLine stat = response.getStatusLine(); int status = response.getStatusLine().getStatusCode(); if (status == 200) { Intent intent = new Intent(SignInActivity.this, CategoryActivity.class); startActivity(intent); } else { } } catch (IOException e) { e.printStackTrace(); } return false; } @Override protected void onPostExecute(Boolean result) { super.onPostExecute(result); Log.i("tag", "" + result); } } /* @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { callbackManager.onActivityResult(requestCode, resultCode, data); }*/ @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (callbackManager.onActivityResult(requestCode, resultCode, data)) { return; } if (requestCode == RC_SIGN_IN) { GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data); handleSignInResult(result); } } @Override public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { } private void handleSignInResult(GoogleSignInResult result) { Log.d("TAG", "handleSignInResult:" + result.isSuccess()); if (result.isSuccess()) { // Signed in successfully, show authenticated UI. GoogleSignInAccount acct = result.getSignInAccount(); loginType = "G"; nameGmail = acct.getDisplayName(); emailGmail = acct.getEmail(); dpGmail = acct.getPhotoUrl(); profilePictureString = String.valueOf(dpGmail); // mStatusTextView.setText(getString(R.string.signed_in_fmt, acct.getDisplayName())); Intent i = new Intent(SignInActivity.this, CategoryActivity.class); startActivity(i); // updateUI(true); } else { // Signed out, show unauthenticated UI. // updateUI(false); } } }
21,062
0.621913
0.620441
551
37.214157
35.321156
188
false
false
0
0
0
0
0
0
0.638838
false
false
7
5f64d070346478f80a8efa9aa065bdf275ef699a
5,299,989,678,118
d70f61b1c1e86688d4b4144c31fd4118051121e8
/src/main/java/com/yy/modules/dc/mail/MailSenderService.java
664d98bff93143f80bdfd2f0f1a5cd5fce492865
[]
no_license
ls909074489/productAdmin
https://github.com/ls909074489/productAdmin
a5c5419ac9b5aeb9323d4bc39f9a4eb7eb286130
5723e1c07cc4777f9e2720d1508420c6863232fb
refs/heads/master
2022-12-28T11:05:50.843000
2020-12-15T03:31:10
2020-12-15T03:31:10
141,645,895
0
0
null
false
2022-12-16T04:49:50
2018-07-20T01:00:03
2020-12-15T03:31:13
2022-12-16T04:49:46
16,587
0
0
63
JavaScript
false
false
package com.yy.modules.dc.mail; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; import com.yy.frame.controller.ActionResultModel; import com.yy.frame.dao.IBaseDAO; import com.yy.frame.service.BaseServiceImpl; /** * 邮件发送人service * @ClassName: MailSenderService * @author liusheng * @date 2016年9月1日 上午11:26:30 */ @Service @Transactional public class MailSenderService extends BaseServiceImpl<MailSenderEntity, String> { @Autowired private MailSenderDao dao; @SuppressWarnings({ "unchecked", "rawtypes" }) @Override protected IBaseDAO getDAO() { return dao; } /** * 根据类型查询 * @Title: findByType * @author liusheng * @date 2016年9月1日 上午11:25:02 * @param @param type * @param @return 设定文件 * @return MailTemplateEntity 返回类型 * @throws */ public List<MailSenderEntity> findByType(String type) { return dao.findByType(type); } /** * 添加 * @Title: saveMailSender * @author liusheng * @date 2016年9月1日 上午11:33:51 * @param @param name * @param @param email * @param @param billType * @param @return 设定文件 * @return ActionResultModel<MailSenderEntity> 返回类型 * @throws */ public ActionResultModel<MailSenderEntity> saveMailSender(String name, String email, String billType) { ActionResultModel<MailSenderEntity> arm=new ActionResultModel<MailSenderEntity>(); try { MailSenderEntity user=new MailSenderEntity(); user.setName(name); user.setEmail(email); user.setBillType(billType); doAdd(user); arm.setSuccess(true); arm.setMsg("保存成功"); } catch (Exception e) { arm.setSuccess(false); arm.setMsg("保存失败"); e.printStackTrace(); } return arm; } /** * 删除 * @Title: delMailSender * @author liusheng * @date 2016年9月1日 上午11:34:02 * @param @param uuid * @param @return 设定文件 * @return ActionResultModel<MailSenderEntity> 返回类型 * @throws */ public ActionResultModel<MailSenderEntity> delMailSender(String uuid) { ActionResultModel<MailSenderEntity> arm=new ActionResultModel<MailSenderEntity>(); try { doDelete(uuid); arm.setSuccess(true); arm.setMsg("删除成功"); } catch (Exception e) { arm.setSuccess(false); arm.setMsg("删除失败"); e.printStackTrace(); } return arm; } /** * 保存为默认的 * @Title: saveDefaultSender * @author liusheng * @date 2016年9月1日 下午4:12:27 * @param @param pks * @param @return 设定文件 * @return ActionResultModel<MailSenderEntity> 返回类型 * @throws */ public ActionResultModel<MailSenderEntity> saveDefaultSender(String pks,String billType) { ActionResultModel<MailSenderEntity> arm=new ActionResultModel<MailSenderEntity>(); try { dao.updateSenderIsDefault(billType,"0"); if(!StringUtils.isEmpty(pks)){ List<String> idList=new ArrayList<String>(); for(String id:pks.split(",")){ idList.add(id); } List<MailSenderEntity> list=(List<MailSenderEntity>) findAll(idList); for(MailSenderEntity user:list){ user.setIsDefault("1"); } arm.setSuccess(true); } } catch (Exception e) { arm.setSuccess(false); e.printStackTrace(); } return arm; } }
UTF-8
Java
3,486
java
MailSenderService.java
Java
[ { "context": "ervice\n * @ClassName: MailSenderService\n * @author liusheng\n * @date 2016年9月1日 上午11:26:30\n */\n@Service\n@Trans", "end": 508, "score": 0.9954856038093567, "start": 500, "tag": "USERNAME", "value": "liusheng" }, { "context": "/**\n\t * 根据类型查询\n\t * @Title: findByType...
null
[]
package com.yy.modules.dc.mail; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; import com.yy.frame.controller.ActionResultModel; import com.yy.frame.dao.IBaseDAO; import com.yy.frame.service.BaseServiceImpl; /** * 邮件发送人service * @ClassName: MailSenderService * @author liusheng * @date 2016年9月1日 上午11:26:30 */ @Service @Transactional public class MailSenderService extends BaseServiceImpl<MailSenderEntity, String> { @Autowired private MailSenderDao dao; @SuppressWarnings({ "unchecked", "rawtypes" }) @Override protected IBaseDAO getDAO() { return dao; } /** * 根据类型查询 * @Title: findByType * @author liusheng * @date 2016年9月1日 上午11:25:02 * @param @param type * @param @return 设定文件 * @return MailTemplateEntity 返回类型 * @throws */ public List<MailSenderEntity> findByType(String type) { return dao.findByType(type); } /** * 添加 * @Title: saveMailSender * @author liusheng * @date 2016年9月1日 上午11:33:51 * @param @param name * @param @param email * @param @param billType * @param @return 设定文件 * @return ActionResultModel<MailSenderEntity> 返回类型 * @throws */ public ActionResultModel<MailSenderEntity> saveMailSender(String name, String email, String billType) { ActionResultModel<MailSenderEntity> arm=new ActionResultModel<MailSenderEntity>(); try { MailSenderEntity user=new MailSenderEntity(); user.setName(name); user.setEmail(email); user.setBillType(billType); doAdd(user); arm.setSuccess(true); arm.setMsg("保存成功"); } catch (Exception e) { arm.setSuccess(false); arm.setMsg("保存失败"); e.printStackTrace(); } return arm; } /** * 删除 * @Title: delMailSender * @author liusheng * @date 2016年9月1日 上午11:34:02 * @param @param uuid * @param @return 设定文件 * @return ActionResultModel<MailSenderEntity> 返回类型 * @throws */ public ActionResultModel<MailSenderEntity> delMailSender(String uuid) { ActionResultModel<MailSenderEntity> arm=new ActionResultModel<MailSenderEntity>(); try { doDelete(uuid); arm.setSuccess(true); arm.setMsg("删除成功"); } catch (Exception e) { arm.setSuccess(false); arm.setMsg("删除失败"); e.printStackTrace(); } return arm; } /** * 保存为默认的 * @Title: saveDefaultSender * @author liusheng * @date 2016年9月1日 下午4:12:27 * @param @param pks * @param @return 设定文件 * @return ActionResultModel<MailSenderEntity> 返回类型 * @throws */ public ActionResultModel<MailSenderEntity> saveDefaultSender(String pks,String billType) { ActionResultModel<MailSenderEntity> arm=new ActionResultModel<MailSenderEntity>(); try { dao.updateSenderIsDefault(billType,"0"); if(!StringUtils.isEmpty(pks)){ List<String> idList=new ArrayList<String>(); for(String id:pks.split(",")){ idList.add(id); } List<MailSenderEntity> list=(List<MailSenderEntity>) findAll(idList); for(MailSenderEntity user:list){ user.setIsDefault("1"); } arm.setSuccess(true); } } catch (Exception e) { arm.setSuccess(false); e.printStackTrace(); } return arm; } }
3,486
0.706792
0.688296
136
23.25
21.404284
104
false
false
0
0
0
0
0
0
1.786765
false
false
7
3932c368c08f2fdefaa0231d74b7a6d4a4b4983b
29,463,475,675,281
ce43ed14f2a6d986e9cea5cee849052bab5a1d7e
/simgu_transportes/src/java/com/asae/entities/Evaluacion.java
b9a4e579977c1b5e896da8f6d5940eb10f38e137
[]
no_license
alejo491/simgu
https://github.com/alejo491/simgu
76d0d11125d7faa62e9c33975cae118c17ed8de3
90450b195a9cf481b6ad76b606f9b991fc93f6de
refs/heads/master
2021-01-10T14:23:04.541000
2014-06-19T18:42:37
2014-06-19T18:42:37
36,107,110
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.asae.entities; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; import javax.validation.constraints.NotNull; import javax.xml.bind.annotation.XmlRootElement; /** * * @author Administrador */ @Entity @Table(name = "evaluacion") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Evaluacion.findAll", query = "SELECT e FROM Evaluacion e"), @NamedQuery(name = "Evaluacion.findByIdEvaluacion", query = "SELECT e FROM Evaluacion e WHERE e.idEvaluacion = :idEvaluacion"), @NamedQuery(name = "Evaluacion.findByPeso", query = "SELECT e FROM Evaluacion e WHERE e.peso = :peso"), @NamedQuery(name = "Evaluacion.findByFechaIngreso", query = "SELECT e FROM Evaluacion e WHERE e.fechaIngreso = :fechaIngreso"), @NamedQuery(name = "Evaluacion.findByFechaSigEvaluacion", query = "SELECT e FROM Evaluacion e WHERE e.fechaSigEvaluacion = :fechaSigEvaluacion"), @NamedQuery(name = "Evaluacion.findByAbdomenInferior", query = "SELECT e FROM Evaluacion e WHERE e.abdomenInferior = :abdomenInferior"), @NamedQuery(name = "Evaluacion.findByCadera", query = "SELECT e FROM Evaluacion e WHERE e.cadera = :cadera"), @NamedQuery(name = "Evaluacion.findByBicepsRelajadoDer", query = "SELECT e FROM Evaluacion e WHERE e.bicepsRelajadoDer = :bicepsRelajadoDer"), @NamedQuery(name = "Evaluacion.findByBicepsRelajadoIzq", query = "SELECT e FROM Evaluacion e WHERE e.bicepsRelajadoIzq = :bicepsRelajadoIzq"), @NamedQuery(name = "Evaluacion.findBySesionesSemana", query = "SELECT e FROM Evaluacion e WHERE e.sesionesSemana = :sesionesSemana"), @NamedQuery(name = "Evaluacion.findBySemanaPrograma", query = "SELECT e FROM Evaluacion e WHERE e.semanaPrograma = :semanaPrograma"), @NamedQuery(name = "Evaluacion.findByBicepsContraidoDer", query = "SELECT e FROM Evaluacion e WHERE e.bicepsContraidoDer = :bicepsContraidoDer"), @NamedQuery(name = "Evaluacion.findByTorax", query = "SELECT e FROM Evaluacion e WHERE e.torax = :torax"), @NamedQuery(name = "Evaluacion.findByBicepsContraidoIzq", query = "SELECT e FROM Evaluacion e WHERE e.bicepsContraidoIzq = :bicepsContraidoIzq"), @NamedQuery(name = "Evaluacion.findByMusloSuperiorDer", query = "SELECT e FROM Evaluacion e WHERE e.musloSuperiorDer = :musloSuperiorDer"), @NamedQuery(name = "Evaluacion.findByMusloSuperiorIzq", query = "SELECT e FROM Evaluacion e WHERE e.musloSuperiorIzq = :musloSuperiorIzq"), @NamedQuery(name = "Evaluacion.findByPantorrillaDer", query = "SELECT e FROM Evaluacion e WHERE e.pantorrillaDer = :pantorrillaDer"), @NamedQuery(name = "Evaluacion.findByPantorrillaIzq", query = "SELECT e FROM Evaluacion e WHERE e.pantorrillaIzq = :pantorrillaIzq"), @NamedQuery(name = "Evaluacion.findByAbdominal", query = "SELECT e FROM Evaluacion e WHERE e.abdominal = :abdominal"), @NamedQuery(name = "Evaluacion.findByGrasaImpedanciometria", query = "SELECT e FROM Evaluacion e WHERE e.grasaImpedanciometria = :grasaImpedanciometria"), @NamedQuery(name = "Evaluacion.findByMedialPierna", query = "SELECT e FROM Evaluacion e WHERE e.medialPierna = :medialPierna"), @NamedQuery(name = "Evaluacion.findByMuslo", query = "SELECT e FROM Evaluacion e WHERE e.muslo = :muslo"), @NamedQuery(name = "Evaluacion.findByPectoral", query = "SELECT e FROM Evaluacion e WHERE e.pectoral = :pectoral"), @NamedQuery(name = "Evaluacion.findBySubescapular", query = "SELECT e FROM Evaluacion e WHERE e.subescapular = :subescapular"), @NamedQuery(name = "Evaluacion.findBySuprailiaco", query = "SELECT e FROM Evaluacion e WHERE e.suprailiaco = :suprailiaco"), @NamedQuery(name = "Evaluacion.findByTriceps", query = "SELECT e FROM Evaluacion e WHERE e.triceps = :triceps"), @NamedQuery(name = "Evaluacion.findByFrecuenciaReposo", query = "SELECT e FROM Evaluacion e WHERE e.frecuenciaReposo = :frecuenciaReposo")}) public class Evaluacion implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "ID_EVALUACION") private Integer idEvaluacion; // @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation @Column(name = "PESO") private BigDecimal peso; @Basic(optional = false) @NotNull @Column(name = "FECHA_INGRESO") @Temporal(TemporalType.TIMESTAMP) private Date fechaIngreso; @Basic(optional = false) @NotNull @Column(name = "FECHA_SIG_EVALUACION") @Temporal(TemporalType.DATE) private Date fechaSigEvaluacion; @Basic(optional = false) @NotNull @Column(name = "ABDOMEN_INFERIOR") private BigDecimal abdomenInferior; @Basic(optional = false) @NotNull @Column(name = "CADERA") private BigDecimal cadera; @Basic(optional = false) @NotNull @Column(name = "BICEPS_RELAJADO_DER") private BigDecimal bicepsRelajadoDer; @Basic(optional = false) @NotNull @Column(name = "BICEPS_RELAJADO_IZQ") private BigDecimal bicepsRelajadoIzq; @Column(name = "SESIONES_SEMANA") private Integer sesionesSemana; @Column(name = "SEMANA_PROGRAMA") private Integer semanaPrograma; @Basic(optional = false) @NotNull @Column(name = "BICEPS_CONTRAIDO_DER") private BigDecimal bicepsContraidoDer; @Basic(optional = false) @NotNull @Column(name = "TORAX") private BigDecimal torax; @Basic(optional = false) @NotNull @Column(name = "BICEPS_CONTRAIDO_IZQ") private BigDecimal bicepsContraidoIzq; @Basic(optional = false) @NotNull @Column(name = "MUSLO_SUPERIOR_DER") private BigDecimal musloSuperiorDer; @Basic(optional = false) @NotNull @Column(name = "MUSLO_SUPERIOR_IZQ") private BigDecimal musloSuperiorIzq; @Basic(optional = false) @NotNull @Column(name = "PANTORRILLA_DER") private BigDecimal pantorrillaDer; @Basic(optional = false) @NotNull @Column(name = "PANTORRILLA_IZQ") private BigDecimal pantorrillaIzq; @Column(name = "ABDOMINAL") private BigDecimal abdominal; @Column(name = "GRASA_IMPEDANCIOMETRIA") private BigDecimal grasaImpedanciometria; @Column(name = "MEDIAL_PIERNA") private BigDecimal medialPierna; @Column(name = "MUSLO") private BigDecimal muslo; @Column(name = "PECTORAL") private BigDecimal pectoral; @Column(name = "SUBESCAPULAR") private BigDecimal subescapular; @Column(name = "SUPRAILIACO") private BigDecimal suprailiaco; @Column(name = "TRICEPS") private BigDecimal triceps; @Basic(optional = false) @NotNull @Column(name = "FRECUENCIA_REPOSO") private BigDecimal frecuenciaReposo; @JoinColumn(name = "ID_USUARIO", referencedColumnName = "IDUSUARIO") @ManyToOne private Usuario idUsuario; @JoinColumn(name = "ID_TECNICO", referencedColumnName = "IDUSUARIO") @ManyToOne private Usuario idTecnico; public Evaluacion() { } public Evaluacion(Integer idEvaluacion) { this.idEvaluacion = idEvaluacion; } public Evaluacion(Integer idEvaluacion, Date fechaIngreso, Date fechaSigEvaluacion, BigDecimal abdomenInferior, BigDecimal cadera, BigDecimal bicepsRelajadoDer, BigDecimal bicepsRelajadoIzq, BigDecimal bicepsContraidoDer, BigDecimal torax, BigDecimal bicepsContraidoIzq, BigDecimal musloSuperiorDer, BigDecimal musloSuperiorIzq, BigDecimal pantorrillaDer, BigDecimal pantorrillaIzq, BigDecimal frecuenciaReposo) { this.idEvaluacion = idEvaluacion; this.fechaIngreso = fechaIngreso; this.fechaSigEvaluacion = fechaSigEvaluacion; this.abdomenInferior = abdomenInferior; this.cadera = cadera; this.bicepsRelajadoDer = bicepsRelajadoDer; this.bicepsRelajadoIzq = bicepsRelajadoIzq; this.bicepsContraidoDer = bicepsContraidoDer; this.torax = torax; this.bicepsContraidoIzq = bicepsContraidoIzq; this.musloSuperiorDer = musloSuperiorDer; this.musloSuperiorIzq = musloSuperiorIzq; this.pantorrillaDer = pantorrillaDer; this.pantorrillaIzq = pantorrillaIzq; this.frecuenciaReposo = frecuenciaReposo; } public Integer getIdEvaluacion() { return idEvaluacion; } public void setIdEvaluacion(Integer idEvaluacion) { this.idEvaluacion = idEvaluacion; } public BigDecimal getPeso() { return peso; } public void setPeso(BigDecimal peso) { this.peso = peso; } public Date getFechaIngreso() { return fechaIngreso; } public void setFechaIngreso(Date fechaIngreso) { this.fechaIngreso = fechaIngreso; } public Date getFechaSigEvaluacion() { return fechaSigEvaluacion; } public void setFechaSigEvaluacion(Date fechaSigEvaluacion) { this.fechaSigEvaluacion = fechaSigEvaluacion; } public BigDecimal getAbdomenInferior() { return abdomenInferior; } public void setAbdomenInferior(BigDecimal abdomenInferior) { this.abdomenInferior = abdomenInferior; } public BigDecimal getCadera() { return cadera; } public void setCadera(BigDecimal cadera) { this.cadera = cadera; } public BigDecimal getBicepsRelajadoDer() { return bicepsRelajadoDer; } public void setBicepsRelajadoDer(BigDecimal bicepsRelajadoDer) { this.bicepsRelajadoDer = bicepsRelajadoDer; } public BigDecimal getBicepsRelajadoIzq() { return bicepsRelajadoIzq; } public void setBicepsRelajadoIzq(BigDecimal bicepsRelajadoIzq) { this.bicepsRelajadoIzq = bicepsRelajadoIzq; } public Integer getSesionesSemana() { return sesionesSemana; } public void setSesionesSemana(Integer sesionesSemana) { this.sesionesSemana = sesionesSemana; } public Integer getSemanaPrograma() { return semanaPrograma; } public void setSemanaPrograma(Integer semanaPrograma) { this.semanaPrograma = semanaPrograma; } public BigDecimal getBicepsContraidoDer() { return bicepsContraidoDer; } public void setBicepsContraidoDer(BigDecimal bicepsContraidoDer) { this.bicepsContraidoDer = bicepsContraidoDer; } public BigDecimal getTorax() { return torax; } public void setTorax(BigDecimal torax) { this.torax = torax; } public BigDecimal getBicepsContraidoIzq() { return bicepsContraidoIzq; } public void setBicepsContraidoIzq(BigDecimal bicepsContraidoIzq) { this.bicepsContraidoIzq = bicepsContraidoIzq; } public BigDecimal getMusloSuperiorDer() { return musloSuperiorDer; } public void setMusloSuperiorDer(BigDecimal musloSuperiorDer) { this.musloSuperiorDer = musloSuperiorDer; } public BigDecimal getMusloSuperiorIzq() { return musloSuperiorIzq; } public void setMusloSuperiorIzq(BigDecimal musloSuperiorIzq) { this.musloSuperiorIzq = musloSuperiorIzq; } public BigDecimal getPantorrillaDer() { return pantorrillaDer; } public void setPantorrillaDer(BigDecimal pantorrillaDer) { this.pantorrillaDer = pantorrillaDer; } public BigDecimal getPantorrillaIzq() { return pantorrillaIzq; } public void setPantorrillaIzq(BigDecimal pantorrillaIzq) { this.pantorrillaIzq = pantorrillaIzq; } public BigDecimal getAbdominal() { return abdominal; } public void setAbdominal(BigDecimal abdominal) { this.abdominal = abdominal; } public BigDecimal getGrasaImpedanciometria() { return grasaImpedanciometria; } public void setGrasaImpedanciometria(BigDecimal grasaImpedanciometria) { this.grasaImpedanciometria = grasaImpedanciometria; } public BigDecimal getMedialPierna() { return medialPierna; } public void setMedialPierna(BigDecimal medialPierna) { this.medialPierna = medialPierna; } public BigDecimal getMuslo() { return muslo; } public void setMuslo(BigDecimal muslo) { this.muslo = muslo; } public BigDecimal getPectoral() { return pectoral; } public void setPectoral(BigDecimal pectoral) { this.pectoral = pectoral; } public BigDecimal getSubescapular() { return subescapular; } public void setSubescapular(BigDecimal subescapular) { this.subescapular = subescapular; } public BigDecimal getSuprailiaco() { return suprailiaco; } public void setSuprailiaco(BigDecimal suprailiaco) { this.suprailiaco = suprailiaco; } public BigDecimal getTriceps() { return triceps; } public void setTriceps(BigDecimal triceps) { this.triceps = triceps; } public BigDecimal getFrecuenciaReposo() { return frecuenciaReposo; } public void setFrecuenciaReposo(BigDecimal frecuenciaReposo) { this.frecuenciaReposo = frecuenciaReposo; } public Usuario getIdUsuario() { return idUsuario; } public void setIdUsuario(Usuario idUsuario) { this.idUsuario = idUsuario; } public Usuario getIdTecnico() { return idTecnico; } public void setIdTecnico(Usuario idTecnico) { this.idTecnico = idTecnico; } /*Datos Calculados*/ @Transient private String imc; @Transient private String sumPliegue; @Transient private String pesoIdeal; @Transient private String pesoIdealMin; @Transient private String pesoIdealMax; @Transient private String pesoTotal; @Transient private String porcGrasaTot; @Transient private String porcGrasaIdeal; @Transient private String pesoGraso; @Transient private String pesoOseo; @Transient private String porcPesoOseo; @Transient private String pesoMusc; @Transient private String pesoMuscIdeal; @Transient private String porcPesoMusc; @Transient private String porcPesoMuscIdeal; @Transient private String pesoResidual; @Transient private String porcPesoResidual; @Transient private String masaCorpMagra; @Transient private String masaCorpMagraIdeal; @Transient private String porcPesoOseoIdeal; @Transient private String relacionCinturaCadera; //datos calculados de nutricion @Transient private String caloriasDieta; @Transient private String quemaCalorias; @Transient private String quemaCaloriasSesion; @Transient private String rangosFrecuencia; @Transient private String pesoAnterior; @Transient private String porcGrasaAnterior; @Transient private String pesoMuscAnterior; private String numAleatorio() { return String.valueOf(Math.random() * 4); } /*metodos para datos calculaddos*/ public void calc_imc() { double formula = -1e9; try { double Pe = peso.doubleValue(); double Es = getIdUsuario().getMedidasGenerales().getEstatura().doubleValue(); formula = Pe / (Math.pow(Es, 2)); } catch (Exception e) { System.out.print("se ha producido un error en calc_sumPliegue"); e.printStackTrace(); } this.sumPliegue = String.valueOf(formula); } public void calc_sumPliegue() { double formula = -1e9; try { double Tr = this.triceps.doubleValue(); double Sub = this.subescapular.doubleValue(); double Sup = this.suprailiaco.doubleValue(); double Ab = this.abdominal.doubleValue(); double Mus = this.muslo.doubleValue(); double Med = this.medialPierna.doubleValue(); formula = Tr + Sub + Sup + Ab + Mus + Med; } catch (Exception e) { System.out.print("se ha producido un error en calc_sumPliegue"); e.printStackTrace(); } this.sumPliegue = String.valueOf(formula); } public void calc_pesoIdeal() { double formula = -1e9; try { MedidasGenerales m = this.getIdUsuario().getMedidasGenerales(); double PeT = Double.valueOf(this.pesoTotal); double pgrCorT = Double.valueOf(this.porcGrasaTot); double pgrId = Double.valueOf(this.porcGrasaIdeal); double MasCMId = Double.valueOf(this.masaCorpMagraIdeal); double MasCM = Double.valueOf(this.masaCorpMagra); formula = (PeT * (100 - pgrCorT) / (100 - pgrId)) + MasCMId - MasCM; } catch (Exception e) { System.out.print("se ha producido un error en calc_pesoIdeal"); e.printStackTrace(); } this.pesoIdeal = String.valueOf(formula); } public void calc_pesoTotal() { double formula = -1e9; try { double Pe = this.peso.doubleValue(); formula = Pe; } catch (Exception e) { System.out.print("se ha producido un error en calc_pesoTotal"); e.printStackTrace(); } this.pesoTotal = String.valueOf(formula); } public void calc_porcGrasaTot() { double formula = -1e9; try { double Pe = this.peso.doubleValue(); double pgrCT = Double.valueOf(this.pesoTotal); formula = Pe * pgrCT / 100.0; } catch (Exception e) { System.out.print("se ha producido un error en calc_porcGrasaTot"); e.printStackTrace(); } this.porcGrasaTot = String.valueOf(formula); } public void calc_porcGrasaIdeal() { double formula = -1e9; try { double PeI = Double.valueOf(this.pesoTotal); double pgrId = Double.valueOf(this.porcGrasaTot); formula = PeI * (pgrId / 100.0); } catch (Exception e) { System.out.print("se ha producido un error en calc_porcGrasaIdeal"); e.printStackTrace(); } this.porcGrasaIdeal = String.valueOf(formula); } public void calc_pesoOseo() { double formula = -1e9; try { MedidasGenerales m = this.getIdUsuario().getMedidasGenerales(); double est = m.getEstatura().doubleValue(); double radC = m.getRadioCubital().doubleValue(); double bieF = m.getBiepicondilarFemoral().doubleValue(); formula = Math.pow(3.02 * (Math.pow(est, 2) * (radC / 100.0) * (bieF / 100.0) * 400), 0.712); } catch (Exception e) { System.out.print("se ha producido un error en calc_pesoOseo"); e.printStackTrace(); } this.pesoOseo = String.valueOf(formula); } public void calc_porcPesoOseo() { double formula = -1e9; try { double Pe = peso.doubleValue(); double PeO = Double.valueOf(this.pesoOseo); formula = PeO * 100 / Pe; } catch (Exception e) { System.out.print("se ha producido un error en calc_porcPesoOseo"); e.printStackTrace(); } this.porcPesoOseo = String.valueOf(formula); } public void calc_pesoMusc() { double formula = -1e9; try { double Pe = peso.doubleValue(); double PeGr = Double.valueOf(this.pesoIdeal); double PeRes = Double.valueOf(this.pesoResidual); double PeO = Double.valueOf(this.pesoOseo); formula = Pe - (PeGr + PeRes + PeO); } catch (Exception e) { System.out.print("se ha producido un error en calc_pesoMusc"); e.printStackTrace(); } this.pesoMusc = String.valueOf(formula); } public void calc_pesoMuscIdeal() { double formula = -1e9; try { double PeId = Double.valueOf(this.pesoIdeal); double PeGrId = Double.valueOf(this.pesoIdeal); double PeRes = Double.valueOf(this.pesoResidual); double PeO = Double.valueOf(this.pesoOseo); formula = PeId - (PeGrId + PeRes + PeO); } catch (Exception e) { System.out.print("se ha producido un error en calc_pesoMuscIdeal"); e.printStackTrace(); } this.pesoMuscIdeal = String.valueOf(formula); } public void calc_porcPesoMusc() { double formula = -1e9; try { double Pe = peso.doubleValue(); double PeM = Double.valueOf(this.pesoMusc); formula = PeM * 100 / Pe; } catch (Exception e) { System.out.print("se ha producido un error en calc_porcPesoMusc"); e.printStackTrace(); } this.porcPesoMusc = String.valueOf(formula); } public void calc_porcPesoMuscIdeal() { double formula = -1e9; try { double pPeRes = Double.valueOf(this.porcPesoResidual); double pGrId = Double.valueOf(this.porcGrasaIdeal); double pOsId = Double.valueOf(this.porcPesoOseoIdeal); formula = 100.0 - pPeRes - pGrId - pOsId; } catch (Exception e) { System.out.print("se ha producido un error en calc_porcPesoMuscIdeal"); e.printStackTrace(); } this.porcPesoMuscIdeal = String.valueOf(formula); } public void calc_pesoResidual() { double formula = -1e9; try { MedidasGenerales m = this.getIdUsuario().getMedidasGenerales(); double PeT = Double.valueOf(this.pesoTotal); String sexo = m.getSexo(); if (sexo.toLowerCase().contains("f")) { formula = PeT * 20.9 / 100.0; } else { formula = PeT * 24.1 / 100; } } catch (Exception e) { System.out.print("se ha producido un error en calc_pesoResidual"); e.printStackTrace(); } this.pesoResidual = String.valueOf(formula); } public void calc_porcPesoResidual() { double formula = -1e9; try { MedidasGenerales m = this.getIdUsuario().getMedidasGenerales(); String sexo = m.getSexo(); if (sexo.toLowerCase().contains("f")) { formula = 20.9; } else { formula = 24.1; } } catch (Exception e) { System.out.print("se ha producido un error en calc_porcPesoResidual"); e.printStackTrace(); } this.porcPesoResidual = String.valueOf(formula); } public void calc_masaCorpMagra() { double formula = -1e9; try { double PeT = peso.doubleValue(); double PeGr = Double.valueOf(this.pesoTotal); formula = PeT - PeGr; } catch (Exception e) { System.out.print("se ha producido un error en calc_masaCorpMagra"); e.printStackTrace(); } this.masaCorpMagra = String.valueOf(formula); } public void calc_masaCorpMagraIdeal() { double formula = -1e9; try { formula = -1000000000; } catch (Exception e) { System.out.print("se ha producido un error en calc_masaCorpMagraIdeal"); e.printStackTrace(); } this.masaCorpMagraIdeal = String.valueOf(formula); } public void calc_porcPesoOseoIdeal() { double formula = -1e9; try { double PeO = Double.valueOf(this.pesoOseo); double PeId = Double.valueOf(this.pesoIdeal); formula = PeO / PeId * 100; } catch (Exception e) { System.out.print("se ha producido un error en calc_porcPesoOseoIdeal"); e.printStackTrace(); } this.porcPesoOseoIdeal = String.valueOf(formula); } public void calc_relacionCinturaCadera() { double formula = -1e9; try { System.out.print("este es el valor de abdomenInferior: "); System.out.print(getAbdomenInferior()); System.out.print("termina..."); double Abi = getAbdomenInferior().doubleValue(); double Ca = this.cadera.doubleValue(); formula = Abi / Ca; } catch (Exception e) { System.out.print("se ha producido un error en calc_relacionCinturaCadera"); e.printStackTrace(); } this.relacionCinturaCadera = String.valueOf(formula); } /*terminan metodos para datos calculaddos*/ /*inician metodos para datos calculados de nutricion*/ public void calc_caloriasDieta() { double formula = -1e9; try { MedidasGenerales m = this.getIdUsuario().getMedidasGenerales(); String actividad = m.getEstado(); double tmb24 = -100000000; double PeId = Double.valueOf(this.pesoIdeal); if (actividad.toLowerCase().contains("lig")) { formula = ((tmb24 / 40.0) * PeId * 0.9); } else if (actividad.toLowerCase().contains("mod")) { formula = ((tmb24 / 40.0) * PeId * 1); } else if (actividad.toLowerCase().contains("alt")) { formula = ((tmb24 / 40.0) * PeId * 1.17); } } catch (Exception e) { System.out.print("se ha producido un error en calc_caloriasDieta"); e.printStackTrace(); } this.caloriasDieta = String.valueOf(formula); } public void calc_quemaCalorias() { double formula = -1e9; try { double PeGr = Double.valueOf(this.pesoIdeal); double PeGrId = Double.valueOf(this.pesoIdeal); double SemProg = this.semanaPrograma.doubleValue(); formula = ((PeGr - PeGrId) * 7000) * SemProg; } catch (Exception e) { System.out.print("se ha producido un error en calc_quemaCalorias"); e.printStackTrace(); } this.quemaCalorias = String.valueOf(formula); } public void calc_quemaCaloriasSesion() { double formula = -1e9; try { double QuCaSem = Double.valueOf(this.quemaCalorias); double SeSem = Double.valueOf(sesionesSemana); formula = QuCaSem / SeSem; } catch (Exception e) { System.out.print("se ha producido un error en calc_quemaCaloriasSesion"); e.printStackTrace(); } this.quemaCaloriasSesion = String.valueOf(formula); } public void calc_rangosFrecuencia() { double formula1 = -1e9; double formula2 = -1e9; try { MedidasGenerales m = this.getIdUsuario().getMedidasGenerales(); String sexo = m.getSexo(); double Ed = Double.valueOf(0); double FrCaRep = frecuenciaReposo.doubleValue(); if (sexo.toLowerCase().contains("fem")) { formula1 = (225 - Ed) * 0.65; formula2 = (((225 - Ed) - FrCaRep) * 0.8) + FrCaRep; } else if (sexo.toLowerCase().contains("mas")) { formula1 = (220 - Ed) * 0.65; formula2 = (((220 - Ed) - FrCaRep) * 0.8) + FrCaRep; } else { formula1 = -1000000000; formula2 = -1000000000; } } catch (Exception e) { System.out.print("se ha producido un error en calc_rangosFrecuencia"); e.printStackTrace(); } this.rangosFrecuencia = String.valueOf("[" + formula1 + "," + formula2 + "]"); } public void calc_pesoAnterior() { double formula = -1e9; try { formula = -1000000000; } catch (Exception e) { System.out.print("se ha producido un error en calc_pesoAnterior"); e.printStackTrace(); } this.pesoAnterior = String.valueOf(formula); } public void calc_porcGrasaAnterior() { double formula = -1e9; try { formula = -1000000000; } catch (Exception e) { System.out.print("se ha producido un error en calc_porcGrasaAnterior"); e.printStackTrace(); } this.porcGrasaAnterior = String.valueOf(formula); } public void calc_pesoMuscAnterior() { double formula = -1e9; try { formula = -1000000000; } catch (Exception e) { System.out.print("se ha producido un error en calc_pesoMuscAnterior"); e.printStackTrace(); } this.pesoMuscAnterior = String.valueOf(formula); } /*Fin Datos Calculados*/ /*Get y set de Datos Calculados*/ public String getImc() { return imc; } public void setImc(String imc) { this.imc = imc; } public String getSumPliegue() { return sumPliegue; } public void setSumPliegue(String sumPliegue) { this.sumPliegue = sumPliegue; } public String getPesoIdeal() { return pesoIdeal; } public void setPesoIdeal(String pesoIdeal) { this.pesoIdeal = pesoIdeal; } public String getPesoIdealMin() { return pesoIdealMin; } public void setPesoIdealMin(String pesoIdealMin) { this.pesoIdealMin = pesoIdealMin; } public String getPesoIdealMax() { return pesoIdealMax; } public void setPesoIdealMax(String pesoIdealMax) { this.pesoIdealMax = pesoIdealMax; } public String getPesoTotal() { return pesoTotal; } public void setPesoTotal(String pesoTotal) { this.pesoTotal = pesoTotal; } public String getPorcGrasaTot() { return porcGrasaTot; } public void setPorcGrasaTot(String porcGrasaTot) { this.porcGrasaTot = porcGrasaTot; } public String getPorcGrasaIdeal() { return porcGrasaIdeal; } public void setPorcGrasaIdeal(String porcGrasaIdeal) { this.porcGrasaIdeal = porcGrasaIdeal; } public String getPesoGraso() { return pesoGraso; } public void setPesoGraso(String pesoGraso) { this.pesoGraso = pesoGraso; } public String getPesoOseo() { return pesoOseo; } public void setPesoOseo(String pesoOseo) { this.pesoOseo = pesoOseo; } public String getPorcPesoOseo() { return porcPesoOseo; } public void setPorcPesoOseo(String porcPesoOseo) { this.porcPesoOseo = porcPesoOseo; } public String getPesoMusc() { return pesoMusc; } public void setPesoMusc(String pesoMusc) { this.pesoMusc = pesoMusc; } public String getPesoMuscIdeal() { return pesoMuscIdeal; } public void setPesoMuscIdeal(String pesoMuscIdeal) { this.pesoMuscIdeal = pesoMuscIdeal; } public String getPorcPesoMusc() { return porcPesoMusc; } public void setPorcPesoMusc(String porcPesoMusc) { this.porcPesoMusc = porcPesoMusc; } public String getPorcPesoMuscIdeal() { return porcPesoMuscIdeal; } public void setPorcPesoMuscIdeal(String porcPesoMuscIdeal) { this.porcPesoMuscIdeal = porcPesoMuscIdeal; } public String getPesoResidual() { return pesoResidual; } public void setPesoResidual(String pesoResidual) { this.pesoResidual = pesoResidual; } public String getPorcPesoResidual() { return porcPesoResidual; } public void setPorcPesoResidual(String porcPesoResidual) { this.porcPesoResidual = porcPesoResidual; } public String getMasaCorpMagra() { return masaCorpMagra; } public void setMasaCorpMagra(String masaCorpMagra) { this.masaCorpMagra = masaCorpMagra; } public String getMasaCorpMagraIdeal() { return masaCorpMagraIdeal; } public void setMasaCorpMagraIdeal(String masaCorpMagraIdeal) { this.masaCorpMagraIdeal = masaCorpMagraIdeal; } public String getPorcPesoOseoIdeal() { return porcPesoOseoIdeal; } public void setPorcPesoOseoIdeal(String porcPesoOseoIdeal) { this.porcPesoOseoIdeal = porcPesoOseoIdeal; } public String getRelacionCinturaCadera() { return relacionCinturaCadera; } public void setRelacionCinturaCadera(String relacionCinturaCadera) { this.relacionCinturaCadera = relacionCinturaCadera; } public String getCaloriasDieta() { return caloriasDieta; } public void setCaloriasDieta(String caloriasDieta) { this.caloriasDieta = caloriasDieta; } public String getQuemaCalorias() { return quemaCalorias; } public void setQuemaCalorias(String quemaCalorias) { this.quemaCalorias = quemaCalorias; } public String getQuemaCaloriasSesion() { return quemaCaloriasSesion; } public void setQuemaCaloriasSesion(String quemaCaloriasSesion) { this.quemaCaloriasSesion = quemaCaloriasSesion; } public String getRangosFrecuencia() { return rangosFrecuencia; } public void setRangosFrecuencia(String rangosFrecuencia) { this.rangosFrecuencia = rangosFrecuencia; } public String getPesoAnterior() { return pesoAnterior; } public void setPesoAnterior(String pesoAnterior) { this.pesoAnterior = pesoAnterior; } public String getPorcGrasaAnterior() { return porcGrasaAnterior; } public void setPorcGrasaAnterior(String porcGrasaAnterior) { this.porcGrasaAnterior = porcGrasaAnterior; } public String getPesoMuscAnterior() { return pesoMuscAnterior; } public void setPesoMuscAnterior(String pesoMuscAnterior) { this.pesoMuscAnterior = pesoMuscAnterior; } /*Fin Gets y Sets*/ @Override public int hashCode() { int hash = 0; hash += (idEvaluacion != null ? idEvaluacion.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Evaluacion)) { return false; } Evaluacion other = (Evaluacion) object; if ((this.idEvaluacion == null && other.idEvaluacion != null) || (this.idEvaluacion != null && !this.idEvaluacion.equals(other.idEvaluacion))) { return false; } return true; } @Override public String toString() { return "com.asae.entities.Evaluacion[ idEvaluacion=" + idEvaluacion + " ]"; } }
UTF-8
Java
36,503
java
Evaluacion.java
Java
[ { "context": ".annotation.XmlRootElement;\r\n\r\n/**\r\n *\r\n * @author Administrador\r\n */\r\n@Entity\r\n@Table(name = \"evaluacion\")\r\n@XmlR", "end": 949, "score": 0.7009986042976379, "start": 936, "tag": "NAME", "value": "Administrador" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.asae.entities; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; import javax.validation.constraints.NotNull; import javax.xml.bind.annotation.XmlRootElement; /** * * @author Administrador */ @Entity @Table(name = "evaluacion") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Evaluacion.findAll", query = "SELECT e FROM Evaluacion e"), @NamedQuery(name = "Evaluacion.findByIdEvaluacion", query = "SELECT e FROM Evaluacion e WHERE e.idEvaluacion = :idEvaluacion"), @NamedQuery(name = "Evaluacion.findByPeso", query = "SELECT e FROM Evaluacion e WHERE e.peso = :peso"), @NamedQuery(name = "Evaluacion.findByFechaIngreso", query = "SELECT e FROM Evaluacion e WHERE e.fechaIngreso = :fechaIngreso"), @NamedQuery(name = "Evaluacion.findByFechaSigEvaluacion", query = "SELECT e FROM Evaluacion e WHERE e.fechaSigEvaluacion = :fechaSigEvaluacion"), @NamedQuery(name = "Evaluacion.findByAbdomenInferior", query = "SELECT e FROM Evaluacion e WHERE e.abdomenInferior = :abdomenInferior"), @NamedQuery(name = "Evaluacion.findByCadera", query = "SELECT e FROM Evaluacion e WHERE e.cadera = :cadera"), @NamedQuery(name = "Evaluacion.findByBicepsRelajadoDer", query = "SELECT e FROM Evaluacion e WHERE e.bicepsRelajadoDer = :bicepsRelajadoDer"), @NamedQuery(name = "Evaluacion.findByBicepsRelajadoIzq", query = "SELECT e FROM Evaluacion e WHERE e.bicepsRelajadoIzq = :bicepsRelajadoIzq"), @NamedQuery(name = "Evaluacion.findBySesionesSemana", query = "SELECT e FROM Evaluacion e WHERE e.sesionesSemana = :sesionesSemana"), @NamedQuery(name = "Evaluacion.findBySemanaPrograma", query = "SELECT e FROM Evaluacion e WHERE e.semanaPrograma = :semanaPrograma"), @NamedQuery(name = "Evaluacion.findByBicepsContraidoDer", query = "SELECT e FROM Evaluacion e WHERE e.bicepsContraidoDer = :bicepsContraidoDer"), @NamedQuery(name = "Evaluacion.findByTorax", query = "SELECT e FROM Evaluacion e WHERE e.torax = :torax"), @NamedQuery(name = "Evaluacion.findByBicepsContraidoIzq", query = "SELECT e FROM Evaluacion e WHERE e.bicepsContraidoIzq = :bicepsContraidoIzq"), @NamedQuery(name = "Evaluacion.findByMusloSuperiorDer", query = "SELECT e FROM Evaluacion e WHERE e.musloSuperiorDer = :musloSuperiorDer"), @NamedQuery(name = "Evaluacion.findByMusloSuperiorIzq", query = "SELECT e FROM Evaluacion e WHERE e.musloSuperiorIzq = :musloSuperiorIzq"), @NamedQuery(name = "Evaluacion.findByPantorrillaDer", query = "SELECT e FROM Evaluacion e WHERE e.pantorrillaDer = :pantorrillaDer"), @NamedQuery(name = "Evaluacion.findByPantorrillaIzq", query = "SELECT e FROM Evaluacion e WHERE e.pantorrillaIzq = :pantorrillaIzq"), @NamedQuery(name = "Evaluacion.findByAbdominal", query = "SELECT e FROM Evaluacion e WHERE e.abdominal = :abdominal"), @NamedQuery(name = "Evaluacion.findByGrasaImpedanciometria", query = "SELECT e FROM Evaluacion e WHERE e.grasaImpedanciometria = :grasaImpedanciometria"), @NamedQuery(name = "Evaluacion.findByMedialPierna", query = "SELECT e FROM Evaluacion e WHERE e.medialPierna = :medialPierna"), @NamedQuery(name = "Evaluacion.findByMuslo", query = "SELECT e FROM Evaluacion e WHERE e.muslo = :muslo"), @NamedQuery(name = "Evaluacion.findByPectoral", query = "SELECT e FROM Evaluacion e WHERE e.pectoral = :pectoral"), @NamedQuery(name = "Evaluacion.findBySubescapular", query = "SELECT e FROM Evaluacion e WHERE e.subescapular = :subescapular"), @NamedQuery(name = "Evaluacion.findBySuprailiaco", query = "SELECT e FROM Evaluacion e WHERE e.suprailiaco = :suprailiaco"), @NamedQuery(name = "Evaluacion.findByTriceps", query = "SELECT e FROM Evaluacion e WHERE e.triceps = :triceps"), @NamedQuery(name = "Evaluacion.findByFrecuenciaReposo", query = "SELECT e FROM Evaluacion e WHERE e.frecuenciaReposo = :frecuenciaReposo")}) public class Evaluacion implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "ID_EVALUACION") private Integer idEvaluacion; // @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation @Column(name = "PESO") private BigDecimal peso; @Basic(optional = false) @NotNull @Column(name = "FECHA_INGRESO") @Temporal(TemporalType.TIMESTAMP) private Date fechaIngreso; @Basic(optional = false) @NotNull @Column(name = "FECHA_SIG_EVALUACION") @Temporal(TemporalType.DATE) private Date fechaSigEvaluacion; @Basic(optional = false) @NotNull @Column(name = "ABDOMEN_INFERIOR") private BigDecimal abdomenInferior; @Basic(optional = false) @NotNull @Column(name = "CADERA") private BigDecimal cadera; @Basic(optional = false) @NotNull @Column(name = "BICEPS_RELAJADO_DER") private BigDecimal bicepsRelajadoDer; @Basic(optional = false) @NotNull @Column(name = "BICEPS_RELAJADO_IZQ") private BigDecimal bicepsRelajadoIzq; @Column(name = "SESIONES_SEMANA") private Integer sesionesSemana; @Column(name = "SEMANA_PROGRAMA") private Integer semanaPrograma; @Basic(optional = false) @NotNull @Column(name = "BICEPS_CONTRAIDO_DER") private BigDecimal bicepsContraidoDer; @Basic(optional = false) @NotNull @Column(name = "TORAX") private BigDecimal torax; @Basic(optional = false) @NotNull @Column(name = "BICEPS_CONTRAIDO_IZQ") private BigDecimal bicepsContraidoIzq; @Basic(optional = false) @NotNull @Column(name = "MUSLO_SUPERIOR_DER") private BigDecimal musloSuperiorDer; @Basic(optional = false) @NotNull @Column(name = "MUSLO_SUPERIOR_IZQ") private BigDecimal musloSuperiorIzq; @Basic(optional = false) @NotNull @Column(name = "PANTORRILLA_DER") private BigDecimal pantorrillaDer; @Basic(optional = false) @NotNull @Column(name = "PANTORRILLA_IZQ") private BigDecimal pantorrillaIzq; @Column(name = "ABDOMINAL") private BigDecimal abdominal; @Column(name = "GRASA_IMPEDANCIOMETRIA") private BigDecimal grasaImpedanciometria; @Column(name = "MEDIAL_PIERNA") private BigDecimal medialPierna; @Column(name = "MUSLO") private BigDecimal muslo; @Column(name = "PECTORAL") private BigDecimal pectoral; @Column(name = "SUBESCAPULAR") private BigDecimal subescapular; @Column(name = "SUPRAILIACO") private BigDecimal suprailiaco; @Column(name = "TRICEPS") private BigDecimal triceps; @Basic(optional = false) @NotNull @Column(name = "FRECUENCIA_REPOSO") private BigDecimal frecuenciaReposo; @JoinColumn(name = "ID_USUARIO", referencedColumnName = "IDUSUARIO") @ManyToOne private Usuario idUsuario; @JoinColumn(name = "ID_TECNICO", referencedColumnName = "IDUSUARIO") @ManyToOne private Usuario idTecnico; public Evaluacion() { } public Evaluacion(Integer idEvaluacion) { this.idEvaluacion = idEvaluacion; } public Evaluacion(Integer idEvaluacion, Date fechaIngreso, Date fechaSigEvaluacion, BigDecimal abdomenInferior, BigDecimal cadera, BigDecimal bicepsRelajadoDer, BigDecimal bicepsRelajadoIzq, BigDecimal bicepsContraidoDer, BigDecimal torax, BigDecimal bicepsContraidoIzq, BigDecimal musloSuperiorDer, BigDecimal musloSuperiorIzq, BigDecimal pantorrillaDer, BigDecimal pantorrillaIzq, BigDecimal frecuenciaReposo) { this.idEvaluacion = idEvaluacion; this.fechaIngreso = fechaIngreso; this.fechaSigEvaluacion = fechaSigEvaluacion; this.abdomenInferior = abdomenInferior; this.cadera = cadera; this.bicepsRelajadoDer = bicepsRelajadoDer; this.bicepsRelajadoIzq = bicepsRelajadoIzq; this.bicepsContraidoDer = bicepsContraidoDer; this.torax = torax; this.bicepsContraidoIzq = bicepsContraidoIzq; this.musloSuperiorDer = musloSuperiorDer; this.musloSuperiorIzq = musloSuperiorIzq; this.pantorrillaDer = pantorrillaDer; this.pantorrillaIzq = pantorrillaIzq; this.frecuenciaReposo = frecuenciaReposo; } public Integer getIdEvaluacion() { return idEvaluacion; } public void setIdEvaluacion(Integer idEvaluacion) { this.idEvaluacion = idEvaluacion; } public BigDecimal getPeso() { return peso; } public void setPeso(BigDecimal peso) { this.peso = peso; } public Date getFechaIngreso() { return fechaIngreso; } public void setFechaIngreso(Date fechaIngreso) { this.fechaIngreso = fechaIngreso; } public Date getFechaSigEvaluacion() { return fechaSigEvaluacion; } public void setFechaSigEvaluacion(Date fechaSigEvaluacion) { this.fechaSigEvaluacion = fechaSigEvaluacion; } public BigDecimal getAbdomenInferior() { return abdomenInferior; } public void setAbdomenInferior(BigDecimal abdomenInferior) { this.abdomenInferior = abdomenInferior; } public BigDecimal getCadera() { return cadera; } public void setCadera(BigDecimal cadera) { this.cadera = cadera; } public BigDecimal getBicepsRelajadoDer() { return bicepsRelajadoDer; } public void setBicepsRelajadoDer(BigDecimal bicepsRelajadoDer) { this.bicepsRelajadoDer = bicepsRelajadoDer; } public BigDecimal getBicepsRelajadoIzq() { return bicepsRelajadoIzq; } public void setBicepsRelajadoIzq(BigDecimal bicepsRelajadoIzq) { this.bicepsRelajadoIzq = bicepsRelajadoIzq; } public Integer getSesionesSemana() { return sesionesSemana; } public void setSesionesSemana(Integer sesionesSemana) { this.sesionesSemana = sesionesSemana; } public Integer getSemanaPrograma() { return semanaPrograma; } public void setSemanaPrograma(Integer semanaPrograma) { this.semanaPrograma = semanaPrograma; } public BigDecimal getBicepsContraidoDer() { return bicepsContraidoDer; } public void setBicepsContraidoDer(BigDecimal bicepsContraidoDer) { this.bicepsContraidoDer = bicepsContraidoDer; } public BigDecimal getTorax() { return torax; } public void setTorax(BigDecimal torax) { this.torax = torax; } public BigDecimal getBicepsContraidoIzq() { return bicepsContraidoIzq; } public void setBicepsContraidoIzq(BigDecimal bicepsContraidoIzq) { this.bicepsContraidoIzq = bicepsContraidoIzq; } public BigDecimal getMusloSuperiorDer() { return musloSuperiorDer; } public void setMusloSuperiorDer(BigDecimal musloSuperiorDer) { this.musloSuperiorDer = musloSuperiorDer; } public BigDecimal getMusloSuperiorIzq() { return musloSuperiorIzq; } public void setMusloSuperiorIzq(BigDecimal musloSuperiorIzq) { this.musloSuperiorIzq = musloSuperiorIzq; } public BigDecimal getPantorrillaDer() { return pantorrillaDer; } public void setPantorrillaDer(BigDecimal pantorrillaDer) { this.pantorrillaDer = pantorrillaDer; } public BigDecimal getPantorrillaIzq() { return pantorrillaIzq; } public void setPantorrillaIzq(BigDecimal pantorrillaIzq) { this.pantorrillaIzq = pantorrillaIzq; } public BigDecimal getAbdominal() { return abdominal; } public void setAbdominal(BigDecimal abdominal) { this.abdominal = abdominal; } public BigDecimal getGrasaImpedanciometria() { return grasaImpedanciometria; } public void setGrasaImpedanciometria(BigDecimal grasaImpedanciometria) { this.grasaImpedanciometria = grasaImpedanciometria; } public BigDecimal getMedialPierna() { return medialPierna; } public void setMedialPierna(BigDecimal medialPierna) { this.medialPierna = medialPierna; } public BigDecimal getMuslo() { return muslo; } public void setMuslo(BigDecimal muslo) { this.muslo = muslo; } public BigDecimal getPectoral() { return pectoral; } public void setPectoral(BigDecimal pectoral) { this.pectoral = pectoral; } public BigDecimal getSubescapular() { return subescapular; } public void setSubescapular(BigDecimal subescapular) { this.subescapular = subescapular; } public BigDecimal getSuprailiaco() { return suprailiaco; } public void setSuprailiaco(BigDecimal suprailiaco) { this.suprailiaco = suprailiaco; } public BigDecimal getTriceps() { return triceps; } public void setTriceps(BigDecimal triceps) { this.triceps = triceps; } public BigDecimal getFrecuenciaReposo() { return frecuenciaReposo; } public void setFrecuenciaReposo(BigDecimal frecuenciaReposo) { this.frecuenciaReposo = frecuenciaReposo; } public Usuario getIdUsuario() { return idUsuario; } public void setIdUsuario(Usuario idUsuario) { this.idUsuario = idUsuario; } public Usuario getIdTecnico() { return idTecnico; } public void setIdTecnico(Usuario idTecnico) { this.idTecnico = idTecnico; } /*Datos Calculados*/ @Transient private String imc; @Transient private String sumPliegue; @Transient private String pesoIdeal; @Transient private String pesoIdealMin; @Transient private String pesoIdealMax; @Transient private String pesoTotal; @Transient private String porcGrasaTot; @Transient private String porcGrasaIdeal; @Transient private String pesoGraso; @Transient private String pesoOseo; @Transient private String porcPesoOseo; @Transient private String pesoMusc; @Transient private String pesoMuscIdeal; @Transient private String porcPesoMusc; @Transient private String porcPesoMuscIdeal; @Transient private String pesoResidual; @Transient private String porcPesoResidual; @Transient private String masaCorpMagra; @Transient private String masaCorpMagraIdeal; @Transient private String porcPesoOseoIdeal; @Transient private String relacionCinturaCadera; //datos calculados de nutricion @Transient private String caloriasDieta; @Transient private String quemaCalorias; @Transient private String quemaCaloriasSesion; @Transient private String rangosFrecuencia; @Transient private String pesoAnterior; @Transient private String porcGrasaAnterior; @Transient private String pesoMuscAnterior; private String numAleatorio() { return String.valueOf(Math.random() * 4); } /*metodos para datos calculaddos*/ public void calc_imc() { double formula = -1e9; try { double Pe = peso.doubleValue(); double Es = getIdUsuario().getMedidasGenerales().getEstatura().doubleValue(); formula = Pe / (Math.pow(Es, 2)); } catch (Exception e) { System.out.print("se ha producido un error en calc_sumPliegue"); e.printStackTrace(); } this.sumPliegue = String.valueOf(formula); } public void calc_sumPliegue() { double formula = -1e9; try { double Tr = this.triceps.doubleValue(); double Sub = this.subescapular.doubleValue(); double Sup = this.suprailiaco.doubleValue(); double Ab = this.abdominal.doubleValue(); double Mus = this.muslo.doubleValue(); double Med = this.medialPierna.doubleValue(); formula = Tr + Sub + Sup + Ab + Mus + Med; } catch (Exception e) { System.out.print("se ha producido un error en calc_sumPliegue"); e.printStackTrace(); } this.sumPliegue = String.valueOf(formula); } public void calc_pesoIdeal() { double formula = -1e9; try { MedidasGenerales m = this.getIdUsuario().getMedidasGenerales(); double PeT = Double.valueOf(this.pesoTotal); double pgrCorT = Double.valueOf(this.porcGrasaTot); double pgrId = Double.valueOf(this.porcGrasaIdeal); double MasCMId = Double.valueOf(this.masaCorpMagraIdeal); double MasCM = Double.valueOf(this.masaCorpMagra); formula = (PeT * (100 - pgrCorT) / (100 - pgrId)) + MasCMId - MasCM; } catch (Exception e) { System.out.print("se ha producido un error en calc_pesoIdeal"); e.printStackTrace(); } this.pesoIdeal = String.valueOf(formula); } public void calc_pesoTotal() { double formula = -1e9; try { double Pe = this.peso.doubleValue(); formula = Pe; } catch (Exception e) { System.out.print("se ha producido un error en calc_pesoTotal"); e.printStackTrace(); } this.pesoTotal = String.valueOf(formula); } public void calc_porcGrasaTot() { double formula = -1e9; try { double Pe = this.peso.doubleValue(); double pgrCT = Double.valueOf(this.pesoTotal); formula = Pe * pgrCT / 100.0; } catch (Exception e) { System.out.print("se ha producido un error en calc_porcGrasaTot"); e.printStackTrace(); } this.porcGrasaTot = String.valueOf(formula); } public void calc_porcGrasaIdeal() { double formula = -1e9; try { double PeI = Double.valueOf(this.pesoTotal); double pgrId = Double.valueOf(this.porcGrasaTot); formula = PeI * (pgrId / 100.0); } catch (Exception e) { System.out.print("se ha producido un error en calc_porcGrasaIdeal"); e.printStackTrace(); } this.porcGrasaIdeal = String.valueOf(formula); } public void calc_pesoOseo() { double formula = -1e9; try { MedidasGenerales m = this.getIdUsuario().getMedidasGenerales(); double est = m.getEstatura().doubleValue(); double radC = m.getRadioCubital().doubleValue(); double bieF = m.getBiepicondilarFemoral().doubleValue(); formula = Math.pow(3.02 * (Math.pow(est, 2) * (radC / 100.0) * (bieF / 100.0) * 400), 0.712); } catch (Exception e) { System.out.print("se ha producido un error en calc_pesoOseo"); e.printStackTrace(); } this.pesoOseo = String.valueOf(formula); } public void calc_porcPesoOseo() { double formula = -1e9; try { double Pe = peso.doubleValue(); double PeO = Double.valueOf(this.pesoOseo); formula = PeO * 100 / Pe; } catch (Exception e) { System.out.print("se ha producido un error en calc_porcPesoOseo"); e.printStackTrace(); } this.porcPesoOseo = String.valueOf(formula); } public void calc_pesoMusc() { double formula = -1e9; try { double Pe = peso.doubleValue(); double PeGr = Double.valueOf(this.pesoIdeal); double PeRes = Double.valueOf(this.pesoResidual); double PeO = Double.valueOf(this.pesoOseo); formula = Pe - (PeGr + PeRes + PeO); } catch (Exception e) { System.out.print("se ha producido un error en calc_pesoMusc"); e.printStackTrace(); } this.pesoMusc = String.valueOf(formula); } public void calc_pesoMuscIdeal() { double formula = -1e9; try { double PeId = Double.valueOf(this.pesoIdeal); double PeGrId = Double.valueOf(this.pesoIdeal); double PeRes = Double.valueOf(this.pesoResidual); double PeO = Double.valueOf(this.pesoOseo); formula = PeId - (PeGrId + PeRes + PeO); } catch (Exception e) { System.out.print("se ha producido un error en calc_pesoMuscIdeal"); e.printStackTrace(); } this.pesoMuscIdeal = String.valueOf(formula); } public void calc_porcPesoMusc() { double formula = -1e9; try { double Pe = peso.doubleValue(); double PeM = Double.valueOf(this.pesoMusc); formula = PeM * 100 / Pe; } catch (Exception e) { System.out.print("se ha producido un error en calc_porcPesoMusc"); e.printStackTrace(); } this.porcPesoMusc = String.valueOf(formula); } public void calc_porcPesoMuscIdeal() { double formula = -1e9; try { double pPeRes = Double.valueOf(this.porcPesoResidual); double pGrId = Double.valueOf(this.porcGrasaIdeal); double pOsId = Double.valueOf(this.porcPesoOseoIdeal); formula = 100.0 - pPeRes - pGrId - pOsId; } catch (Exception e) { System.out.print("se ha producido un error en calc_porcPesoMuscIdeal"); e.printStackTrace(); } this.porcPesoMuscIdeal = String.valueOf(formula); } public void calc_pesoResidual() { double formula = -1e9; try { MedidasGenerales m = this.getIdUsuario().getMedidasGenerales(); double PeT = Double.valueOf(this.pesoTotal); String sexo = m.getSexo(); if (sexo.toLowerCase().contains("f")) { formula = PeT * 20.9 / 100.0; } else { formula = PeT * 24.1 / 100; } } catch (Exception e) { System.out.print("se ha producido un error en calc_pesoResidual"); e.printStackTrace(); } this.pesoResidual = String.valueOf(formula); } public void calc_porcPesoResidual() { double formula = -1e9; try { MedidasGenerales m = this.getIdUsuario().getMedidasGenerales(); String sexo = m.getSexo(); if (sexo.toLowerCase().contains("f")) { formula = 20.9; } else { formula = 24.1; } } catch (Exception e) { System.out.print("se ha producido un error en calc_porcPesoResidual"); e.printStackTrace(); } this.porcPesoResidual = String.valueOf(formula); } public void calc_masaCorpMagra() { double formula = -1e9; try { double PeT = peso.doubleValue(); double PeGr = Double.valueOf(this.pesoTotal); formula = PeT - PeGr; } catch (Exception e) { System.out.print("se ha producido un error en calc_masaCorpMagra"); e.printStackTrace(); } this.masaCorpMagra = String.valueOf(formula); } public void calc_masaCorpMagraIdeal() { double formula = -1e9; try { formula = -1000000000; } catch (Exception e) { System.out.print("se ha producido un error en calc_masaCorpMagraIdeal"); e.printStackTrace(); } this.masaCorpMagraIdeal = String.valueOf(formula); } public void calc_porcPesoOseoIdeal() { double formula = -1e9; try { double PeO = Double.valueOf(this.pesoOseo); double PeId = Double.valueOf(this.pesoIdeal); formula = PeO / PeId * 100; } catch (Exception e) { System.out.print("se ha producido un error en calc_porcPesoOseoIdeal"); e.printStackTrace(); } this.porcPesoOseoIdeal = String.valueOf(formula); } public void calc_relacionCinturaCadera() { double formula = -1e9; try { System.out.print("este es el valor de abdomenInferior: "); System.out.print(getAbdomenInferior()); System.out.print("termina..."); double Abi = getAbdomenInferior().doubleValue(); double Ca = this.cadera.doubleValue(); formula = Abi / Ca; } catch (Exception e) { System.out.print("se ha producido un error en calc_relacionCinturaCadera"); e.printStackTrace(); } this.relacionCinturaCadera = String.valueOf(formula); } /*terminan metodos para datos calculaddos*/ /*inician metodos para datos calculados de nutricion*/ public void calc_caloriasDieta() { double formula = -1e9; try { MedidasGenerales m = this.getIdUsuario().getMedidasGenerales(); String actividad = m.getEstado(); double tmb24 = -100000000; double PeId = Double.valueOf(this.pesoIdeal); if (actividad.toLowerCase().contains("lig")) { formula = ((tmb24 / 40.0) * PeId * 0.9); } else if (actividad.toLowerCase().contains("mod")) { formula = ((tmb24 / 40.0) * PeId * 1); } else if (actividad.toLowerCase().contains("alt")) { formula = ((tmb24 / 40.0) * PeId * 1.17); } } catch (Exception e) { System.out.print("se ha producido un error en calc_caloriasDieta"); e.printStackTrace(); } this.caloriasDieta = String.valueOf(formula); } public void calc_quemaCalorias() { double formula = -1e9; try { double PeGr = Double.valueOf(this.pesoIdeal); double PeGrId = Double.valueOf(this.pesoIdeal); double SemProg = this.semanaPrograma.doubleValue(); formula = ((PeGr - PeGrId) * 7000) * SemProg; } catch (Exception e) { System.out.print("se ha producido un error en calc_quemaCalorias"); e.printStackTrace(); } this.quemaCalorias = String.valueOf(formula); } public void calc_quemaCaloriasSesion() { double formula = -1e9; try { double QuCaSem = Double.valueOf(this.quemaCalorias); double SeSem = Double.valueOf(sesionesSemana); formula = QuCaSem / SeSem; } catch (Exception e) { System.out.print("se ha producido un error en calc_quemaCaloriasSesion"); e.printStackTrace(); } this.quemaCaloriasSesion = String.valueOf(formula); } public void calc_rangosFrecuencia() { double formula1 = -1e9; double formula2 = -1e9; try { MedidasGenerales m = this.getIdUsuario().getMedidasGenerales(); String sexo = m.getSexo(); double Ed = Double.valueOf(0); double FrCaRep = frecuenciaReposo.doubleValue(); if (sexo.toLowerCase().contains("fem")) { formula1 = (225 - Ed) * 0.65; formula2 = (((225 - Ed) - FrCaRep) * 0.8) + FrCaRep; } else if (sexo.toLowerCase().contains("mas")) { formula1 = (220 - Ed) * 0.65; formula2 = (((220 - Ed) - FrCaRep) * 0.8) + FrCaRep; } else { formula1 = -1000000000; formula2 = -1000000000; } } catch (Exception e) { System.out.print("se ha producido un error en calc_rangosFrecuencia"); e.printStackTrace(); } this.rangosFrecuencia = String.valueOf("[" + formula1 + "," + formula2 + "]"); } public void calc_pesoAnterior() { double formula = -1e9; try { formula = -1000000000; } catch (Exception e) { System.out.print("se ha producido un error en calc_pesoAnterior"); e.printStackTrace(); } this.pesoAnterior = String.valueOf(formula); } public void calc_porcGrasaAnterior() { double formula = -1e9; try { formula = -1000000000; } catch (Exception e) { System.out.print("se ha producido un error en calc_porcGrasaAnterior"); e.printStackTrace(); } this.porcGrasaAnterior = String.valueOf(formula); } public void calc_pesoMuscAnterior() { double formula = -1e9; try { formula = -1000000000; } catch (Exception e) { System.out.print("se ha producido un error en calc_pesoMuscAnterior"); e.printStackTrace(); } this.pesoMuscAnterior = String.valueOf(formula); } /*Fin Datos Calculados*/ /*Get y set de Datos Calculados*/ public String getImc() { return imc; } public void setImc(String imc) { this.imc = imc; } public String getSumPliegue() { return sumPliegue; } public void setSumPliegue(String sumPliegue) { this.sumPliegue = sumPliegue; } public String getPesoIdeal() { return pesoIdeal; } public void setPesoIdeal(String pesoIdeal) { this.pesoIdeal = pesoIdeal; } public String getPesoIdealMin() { return pesoIdealMin; } public void setPesoIdealMin(String pesoIdealMin) { this.pesoIdealMin = pesoIdealMin; } public String getPesoIdealMax() { return pesoIdealMax; } public void setPesoIdealMax(String pesoIdealMax) { this.pesoIdealMax = pesoIdealMax; } public String getPesoTotal() { return pesoTotal; } public void setPesoTotal(String pesoTotal) { this.pesoTotal = pesoTotal; } public String getPorcGrasaTot() { return porcGrasaTot; } public void setPorcGrasaTot(String porcGrasaTot) { this.porcGrasaTot = porcGrasaTot; } public String getPorcGrasaIdeal() { return porcGrasaIdeal; } public void setPorcGrasaIdeal(String porcGrasaIdeal) { this.porcGrasaIdeal = porcGrasaIdeal; } public String getPesoGraso() { return pesoGraso; } public void setPesoGraso(String pesoGraso) { this.pesoGraso = pesoGraso; } public String getPesoOseo() { return pesoOseo; } public void setPesoOseo(String pesoOseo) { this.pesoOseo = pesoOseo; } public String getPorcPesoOseo() { return porcPesoOseo; } public void setPorcPesoOseo(String porcPesoOseo) { this.porcPesoOseo = porcPesoOseo; } public String getPesoMusc() { return pesoMusc; } public void setPesoMusc(String pesoMusc) { this.pesoMusc = pesoMusc; } public String getPesoMuscIdeal() { return pesoMuscIdeal; } public void setPesoMuscIdeal(String pesoMuscIdeal) { this.pesoMuscIdeal = pesoMuscIdeal; } public String getPorcPesoMusc() { return porcPesoMusc; } public void setPorcPesoMusc(String porcPesoMusc) { this.porcPesoMusc = porcPesoMusc; } public String getPorcPesoMuscIdeal() { return porcPesoMuscIdeal; } public void setPorcPesoMuscIdeal(String porcPesoMuscIdeal) { this.porcPesoMuscIdeal = porcPesoMuscIdeal; } public String getPesoResidual() { return pesoResidual; } public void setPesoResidual(String pesoResidual) { this.pesoResidual = pesoResidual; } public String getPorcPesoResidual() { return porcPesoResidual; } public void setPorcPesoResidual(String porcPesoResidual) { this.porcPesoResidual = porcPesoResidual; } public String getMasaCorpMagra() { return masaCorpMagra; } public void setMasaCorpMagra(String masaCorpMagra) { this.masaCorpMagra = masaCorpMagra; } public String getMasaCorpMagraIdeal() { return masaCorpMagraIdeal; } public void setMasaCorpMagraIdeal(String masaCorpMagraIdeal) { this.masaCorpMagraIdeal = masaCorpMagraIdeal; } public String getPorcPesoOseoIdeal() { return porcPesoOseoIdeal; } public void setPorcPesoOseoIdeal(String porcPesoOseoIdeal) { this.porcPesoOseoIdeal = porcPesoOseoIdeal; } public String getRelacionCinturaCadera() { return relacionCinturaCadera; } public void setRelacionCinturaCadera(String relacionCinturaCadera) { this.relacionCinturaCadera = relacionCinturaCadera; } public String getCaloriasDieta() { return caloriasDieta; } public void setCaloriasDieta(String caloriasDieta) { this.caloriasDieta = caloriasDieta; } public String getQuemaCalorias() { return quemaCalorias; } public void setQuemaCalorias(String quemaCalorias) { this.quemaCalorias = quemaCalorias; } public String getQuemaCaloriasSesion() { return quemaCaloriasSesion; } public void setQuemaCaloriasSesion(String quemaCaloriasSesion) { this.quemaCaloriasSesion = quemaCaloriasSesion; } public String getRangosFrecuencia() { return rangosFrecuencia; } public void setRangosFrecuencia(String rangosFrecuencia) { this.rangosFrecuencia = rangosFrecuencia; } public String getPesoAnterior() { return pesoAnterior; } public void setPesoAnterior(String pesoAnterior) { this.pesoAnterior = pesoAnterior; } public String getPorcGrasaAnterior() { return porcGrasaAnterior; } public void setPorcGrasaAnterior(String porcGrasaAnterior) { this.porcGrasaAnterior = porcGrasaAnterior; } public String getPesoMuscAnterior() { return pesoMuscAnterior; } public void setPesoMuscAnterior(String pesoMuscAnterior) { this.pesoMuscAnterior = pesoMuscAnterior; } /*Fin Gets y Sets*/ @Override public int hashCode() { int hash = 0; hash += (idEvaluacion != null ? idEvaluacion.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Evaluacion)) { return false; } Evaluacion other = (Evaluacion) object; if ((this.idEvaluacion == null && other.idEvaluacion != null) || (this.idEvaluacion != null && !this.idEvaluacion.equals(other.idEvaluacion))) { return false; } return true; } @Override public String toString() { return "com.asae.entities.Evaluacion[ idEvaluacion=" + idEvaluacion + " ]"; } }
36,503
0.62088
0.614004
1,091
31.458296
29.883963
417
false
false
0
0
0
0
0
0
0.450962
false
false
7
1b65390af0f434e675fef6e414be2d51580834b3
4,002,909,548,806
80b8924acd9d09cddb9e20b28d50d1b222f26bc6
/src/main/java/com/walguru/jsonbuilder/tileentity/TileEntityBuilder.java
afd59ff5a17e9c3528af8960854fb928f2ae83b3
[]
no_license
walguru/Builder
https://github.com/walguru/Builder
891930b33c8cd81acce31e21ce07f093035fcfeb
a2fb9d55baec6ac1678e8498f8f3b8bfa1e71556
refs/heads/master
2016-07-26T11:55:50.075000
2015-07-22T20:53:47
2015-07-22T20:53:47
31,157,418
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.walguru.jsonbuilder.tileentity; import com.google.gson.Gson; import com.walguru.jsonbuilder.Serialization.BlockLevel; import com.walguru.jsonbuilder.Serialization.BuildInformation; import com.walguru.jsonbuilder.Webrequests.Web; import com.walguru.jsonbuilder.init.ModBlocks; import com.walguru.jsonbuilder.reference.Names; import com.walguru.jsonbuilder.tileentity.base.TileEntityJB; import com.walguru.jsonbuilder.Utility.RandomUtils; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemEditableBook; import net.minecraft.tileentity.TileEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.server.MinecraftServer; import net.minecraft.util.ChatComponentText; import net.minecraft.item.ItemWritableBook; import net.minecraftforge.common.util.ForgeDirection; /** * Created by Aurora on 25/02/2015. */ public class TileEntityBuilder extends TileEntityJB implements ISidedInventory{ public static final int INVENTORY_SIZE=1; public static final int Book_Inventory_Index=0; public int numUsingPlayers; private ItemStack[] inventory; private String jsonbuild; @Override public ItemStack getStackInSlot(int slotIndex) { return inventory[slotIndex]; } @Override public void updateEntity() { //MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message")); long worldTime = worldObj.getWorldTime(); if (worldObj.isRemote) { return; } ItemStack itemStack = getStackInSlot(Book_Inventory_Index); if (itemStack != null) { markDirty(); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); if (!Started){ Started=true; //http://pastebin.com/raw.php?i=S8x0K3ui jsonbuild=Web.GetInfo("http://pastebin.com/raw.php?i=S8x0K3ui"); //MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message:" + s)); } if(!(jsonbuild.equals(""))) { } } super.updateEntity(); } @Override public ItemStack decrStackSize(int slotIndex, int decrementAmount) { ItemStack itemStack = getStackInSlot(slotIndex); if (itemStack != null) { if (itemStack.stackSize <= decrementAmount) { setInventorySlotContents(slotIndex, null); } else { itemStack = itemStack.splitStack(decrementAmount); if (itemStack.stackSize == 0) { setInventorySlotContents(slotIndex, null); } } } return itemStack; } @Override public int getSizeInventory() { return inventory.length; } @Override public boolean hasCustomInventoryName() { return this.hasCustomName(); } @Override public ItemStack getStackInSlotOnClosing(int slotIndex) { ItemStack itemStack = getStackInSlot(slotIndex); if (itemStack != null) { setInventorySlotContents(slotIndex, null); } return itemStack; } @Override public void closeInventory() { --numUsingPlayers; worldObj.addBlockEvent(xCoord, yCoord, zCoord, ModBlocks.builderBlock, 1, numUsingPlayers); } @Override public void setInventorySlotContents(int slotIndex, ItemStack itemStack) { inventory[slotIndex] = itemStack; if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) { itemStack.stackSize = getInventoryStackLimit(); } } @Override public String getInventoryName() { return this.hasCustomName() ? this.getCustomName() : Names.Containers.BUILDER; } @Override public boolean isUseableByPlayer(EntityPlayer player) { return true; } @Override public void openInventory() { ++numUsingPlayers; worldObj.addBlockEvent(xCoord, yCoord, zCoord, ModBlocks.builderBlock, 1, numUsingPlayers); } @Override public int getInventoryStackLimit() { return 1; } @Override public boolean canExtractItem(int slotindex, ItemStack itemstack, int side) { return slotindex==Book_Inventory_Index; } @Override public int[] getAccessibleSlotsFromSide(int side) { return new int[]{1}; } public TileEntityBuilder(){ super(); inventory= new ItemStack[INVENTORY_SIZE]; metadata= RandomUtils.OrientationToMetadata(orientation); initiateDirection(); } @Override public boolean canInsertItem(int slotIndex, ItemStack itemStack, int side) { return isItemValidForSlot(slotIndex, itemStack); } @Override public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) { switch (slotIndex) { case Book_Inventory_Index: { if (itemStack.getItem() instanceof ItemEditableBook){ MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message: ItemEditableBook")); //itemStack.getItem(). /* NBTTagCompound book=itemStack.stackTagCompound; NBTTagList pages= (NBTTagList) book.getTag("pages"); MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message: " + pages.getStringTagAt(0)));*/ return true; } if (itemStack.getItem() instanceof ItemWritableBook){ MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message: ItemWritableBook")); /* NBTTagCompound book=itemStack.stackTagCompound; NBTTagList pages= (NBTTagList) book.getTag("pages"); MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message: " + pages.getStringTagAt(0)));*/ return true; } } default: { return false; } } } @Override public void readFromNBT(NBTTagCompound nbtTagCompound) { super.readFromNBT(nbtTagCompound); //NBTTagList tagList = nbtTagCompound.getTagList(Names.NBT.BUILDERACTIVE,1); //Started = nbtTagCompound.getBoolean(Names.NBT.BUILDERACTIVE); //nbtTagCompound.getTagList(tagname , tag type); NBTTagList tagList = nbtTagCompound.getTagList(Names.NBT.ITEMS,10); inventory = new ItemStack[this.getSizeInventory()]; for (int i = 0; i < tagList.tagCount(); ++i) { NBTTagCompound tagCompound = tagList.getCompoundTagAt(i); byte slotIndex = tagCompound.getByte("Slot"); if (slotIndex >= 0 && slotIndex < inventory.length) { inventory[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound); } } } boolean Started= false; @Override public Packet getDescriptionPacket() { //return super.getDescriptionPacket(); NBTTagCompound var1= new NBTTagCompound(); this.writeToNBT(var1); return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, var1); } @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { this.readFromNBT(packet.func_148857_g()); } @Override public boolean receiveClientEvent(int eventID, int numUsingPlayers) { if (eventID == 1) { this.numUsingPlayers = numUsingPlayers; return true; } else { return super.receiveClientEvent(eventID, numUsingPlayers); } } @Override public void writeToNBT(NBTTagCompound nbtTagCompound) { super.writeToNBT(nbtTagCompound); //nbtTagCompound.setBoolean(Names.NBT.BUILDERACTIVE,Started); NBTTagList taglist= new NBTTagList(); for (int currentIndex = 0; currentIndex < inventory.length; ++currentIndex) { if (inventory[currentIndex] != null) { NBTTagCompound tagcompound= new NBTTagCompound(); tagcompound.setByte("Slot",(byte) currentIndex); inventory[currentIndex].writeToNBT(tagcompound); taglist.appendTag(tagcompound); } } nbtTagCompound.setTag(Names.NBT.ITEMS,taglist); } private int metadata=0; public void Activate() { MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message: " + Started)); metadata = worldObj.getBlockMetadata(xCoord, yCoord, zCoord) + 1; orientation= RandomUtils.MetaDataToOrientation(metadata); if (metadata > 4) { orientation= ForgeDirection.NORTH; metadata=RandomUtils.OrientationToMetadata(orientation); } if(! worldObj.isRemote) worldObj.setBlockMetadataWithNotify(xCoord,yCoord,zCoord,metadata, 2); markDirty(); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message: " + Started)); MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your orientation: " + orientation.toString())); //'MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message: Book " + inventory[0].getItem())); try { BuildInformation BI = new BuildInformation(); BI.setAuthor("Walguru"); BI.getBuildLevel().add(new BlockLevel()); Gson gson = new Gson(); String s=""; s=gson.toJson(BI); MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message: " + s)); }catch (Exception ex) { MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message: " + ex.toString())); } } public void initiateDirection(){ metadata=RandomUtils.OrientationToMetadata(orientation); if ( !(worldObj == null)) { if(! worldObj.isRemote) worldObj.setBlockMetadataWithNotify(xCoord,yCoord,zCoord,metadata, 2); } } }
UTF-8
Java
11,036
java
TileEntityBuilder.java
Java
[ { "context": "ge.common.util.ForgeDirection;\n\n\n/**\n * Created by Aurora on 25/02/2015.\n */\n\npublic class TileEntityBuilde", "end": 1186, "score": 0.8362724184989929, "start": 1180, "tag": "NAME", "value": "Aurora" } ]
null
[]
package com.walguru.jsonbuilder.tileentity; import com.google.gson.Gson; import com.walguru.jsonbuilder.Serialization.BlockLevel; import com.walguru.jsonbuilder.Serialization.BuildInformation; import com.walguru.jsonbuilder.Webrequests.Web; import com.walguru.jsonbuilder.init.ModBlocks; import com.walguru.jsonbuilder.reference.Names; import com.walguru.jsonbuilder.tileentity.base.TileEntityJB; import com.walguru.jsonbuilder.Utility.RandomUtils; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemEditableBook; import net.minecraft.tileentity.TileEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.server.MinecraftServer; import net.minecraft.util.ChatComponentText; import net.minecraft.item.ItemWritableBook; import net.minecraftforge.common.util.ForgeDirection; /** * Created by Aurora on 25/02/2015. */ public class TileEntityBuilder extends TileEntityJB implements ISidedInventory{ public static final int INVENTORY_SIZE=1; public static final int Book_Inventory_Index=0; public int numUsingPlayers; private ItemStack[] inventory; private String jsonbuild; @Override public ItemStack getStackInSlot(int slotIndex) { return inventory[slotIndex]; } @Override public void updateEntity() { //MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message")); long worldTime = worldObj.getWorldTime(); if (worldObj.isRemote) { return; } ItemStack itemStack = getStackInSlot(Book_Inventory_Index); if (itemStack != null) { markDirty(); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); if (!Started){ Started=true; //http://pastebin.com/raw.php?i=S8x0K3ui jsonbuild=Web.GetInfo("http://pastebin.com/raw.php?i=S8x0K3ui"); //MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message:" + s)); } if(!(jsonbuild.equals(""))) { } } super.updateEntity(); } @Override public ItemStack decrStackSize(int slotIndex, int decrementAmount) { ItemStack itemStack = getStackInSlot(slotIndex); if (itemStack != null) { if (itemStack.stackSize <= decrementAmount) { setInventorySlotContents(slotIndex, null); } else { itemStack = itemStack.splitStack(decrementAmount); if (itemStack.stackSize == 0) { setInventorySlotContents(slotIndex, null); } } } return itemStack; } @Override public int getSizeInventory() { return inventory.length; } @Override public boolean hasCustomInventoryName() { return this.hasCustomName(); } @Override public ItemStack getStackInSlotOnClosing(int slotIndex) { ItemStack itemStack = getStackInSlot(slotIndex); if (itemStack != null) { setInventorySlotContents(slotIndex, null); } return itemStack; } @Override public void closeInventory() { --numUsingPlayers; worldObj.addBlockEvent(xCoord, yCoord, zCoord, ModBlocks.builderBlock, 1, numUsingPlayers); } @Override public void setInventorySlotContents(int slotIndex, ItemStack itemStack) { inventory[slotIndex] = itemStack; if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) { itemStack.stackSize = getInventoryStackLimit(); } } @Override public String getInventoryName() { return this.hasCustomName() ? this.getCustomName() : Names.Containers.BUILDER; } @Override public boolean isUseableByPlayer(EntityPlayer player) { return true; } @Override public void openInventory() { ++numUsingPlayers; worldObj.addBlockEvent(xCoord, yCoord, zCoord, ModBlocks.builderBlock, 1, numUsingPlayers); } @Override public int getInventoryStackLimit() { return 1; } @Override public boolean canExtractItem(int slotindex, ItemStack itemstack, int side) { return slotindex==Book_Inventory_Index; } @Override public int[] getAccessibleSlotsFromSide(int side) { return new int[]{1}; } public TileEntityBuilder(){ super(); inventory= new ItemStack[INVENTORY_SIZE]; metadata= RandomUtils.OrientationToMetadata(orientation); initiateDirection(); } @Override public boolean canInsertItem(int slotIndex, ItemStack itemStack, int side) { return isItemValidForSlot(slotIndex, itemStack); } @Override public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) { switch (slotIndex) { case Book_Inventory_Index: { if (itemStack.getItem() instanceof ItemEditableBook){ MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message: ItemEditableBook")); //itemStack.getItem(). /* NBTTagCompound book=itemStack.stackTagCompound; NBTTagList pages= (NBTTagList) book.getTag("pages"); MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message: " + pages.getStringTagAt(0)));*/ return true; } if (itemStack.getItem() instanceof ItemWritableBook){ MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message: ItemWritableBook")); /* NBTTagCompound book=itemStack.stackTagCompound; NBTTagList pages= (NBTTagList) book.getTag("pages"); MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message: " + pages.getStringTagAt(0)));*/ return true; } } default: { return false; } } } @Override public void readFromNBT(NBTTagCompound nbtTagCompound) { super.readFromNBT(nbtTagCompound); //NBTTagList tagList = nbtTagCompound.getTagList(Names.NBT.BUILDERACTIVE,1); //Started = nbtTagCompound.getBoolean(Names.NBT.BUILDERACTIVE); //nbtTagCompound.getTagList(tagname , tag type); NBTTagList tagList = nbtTagCompound.getTagList(Names.NBT.ITEMS,10); inventory = new ItemStack[this.getSizeInventory()]; for (int i = 0; i < tagList.tagCount(); ++i) { NBTTagCompound tagCompound = tagList.getCompoundTagAt(i); byte slotIndex = tagCompound.getByte("Slot"); if (slotIndex >= 0 && slotIndex < inventory.length) { inventory[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound); } } } boolean Started= false; @Override public Packet getDescriptionPacket() { //return super.getDescriptionPacket(); NBTTagCompound var1= new NBTTagCompound(); this.writeToNBT(var1); return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, var1); } @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { this.readFromNBT(packet.func_148857_g()); } @Override public boolean receiveClientEvent(int eventID, int numUsingPlayers) { if (eventID == 1) { this.numUsingPlayers = numUsingPlayers; return true; } else { return super.receiveClientEvent(eventID, numUsingPlayers); } } @Override public void writeToNBT(NBTTagCompound nbtTagCompound) { super.writeToNBT(nbtTagCompound); //nbtTagCompound.setBoolean(Names.NBT.BUILDERACTIVE,Started); NBTTagList taglist= new NBTTagList(); for (int currentIndex = 0; currentIndex < inventory.length; ++currentIndex) { if (inventory[currentIndex] != null) { NBTTagCompound tagcompound= new NBTTagCompound(); tagcompound.setByte("Slot",(byte) currentIndex); inventory[currentIndex].writeToNBT(tagcompound); taglist.appendTag(tagcompound); } } nbtTagCompound.setTag(Names.NBT.ITEMS,taglist); } private int metadata=0; public void Activate() { MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message: " + Started)); metadata = worldObj.getBlockMetadata(xCoord, yCoord, zCoord) + 1; orientation= RandomUtils.MetaDataToOrientation(metadata); if (metadata > 4) { orientation= ForgeDirection.NORTH; metadata=RandomUtils.OrientationToMetadata(orientation); } if(! worldObj.isRemote) worldObj.setBlockMetadataWithNotify(xCoord,yCoord,zCoord,metadata, 2); markDirty(); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message: " + Started)); MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your orientation: " + orientation.toString())); //'MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message: Book " + inventory[0].getItem())); try { BuildInformation BI = new BuildInformation(); BI.setAuthor("Walguru"); BI.getBuildLevel().add(new BlockLevel()); Gson gson = new Gson(); String s=""; s=gson.toJson(BI); MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message: " + s)); }catch (Exception ex) { MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("your message: " + ex.toString())); } } public void initiateDirection(){ metadata=RandomUtils.OrientationToMetadata(orientation); if ( !(worldObj == null)) { if(! worldObj.isRemote) worldObj.setBlockMetadataWithNotify(xCoord,yCoord,zCoord,metadata, 2); } } }
11,036
0.640903
0.636191
342
31.269007
32.263771
155
false
false
0
0
0
0
0
0
0.520468
false
false
7
b8567e8d32051e75b4c5a68c1e7b429a972464b8
31,860,067,433,624
d4b4a28a618c982ee9b9c9e0ac8651a6e104417b
/src/main/java/com/medapp/model/Fisa.java
d2e610553d0d1c749c8c47c75feadf7d138337d8
[]
no_license
AndrewRotary/dent-app
https://github.com/AndrewRotary/dent-app
6511a68875fc5d903064553e0f7c4fe6645a0522
209d68a259139d4d29d6c97ebf2115f3f7bf51d6
refs/heads/master
2021-01-11T09:11:05.059000
2017-05-08T19:07:00
2017-05-08T19:07:00
77,337,532
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.medapp.model; import javax.persistence.*; import java.io.Serializable; import java.sql.Date; /** * Created by Root on 27.12.2016. */ @Entity public class Fisa implements Serializable { private static final long serialVersionUID = -2162658279783557828L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private int fisaId; @OneToOne @JoinColumn(name = "clientId") private Client client; @OneToOne @JoinColumn(name = "dintiiId") private Dintii dintii; @Column(name = "dataCreat") private Date date; @Column(name = "dataEditat") private Date dateEdited; private String diagnosticul; private String acuze; private String boli; private String evolutiaBolii; private String examenExterior; private String ocluzia; private String stareaMucoaseiEtc; public int getFisaId() { return fisaId; } public void setFisaId(int fisaId) { this.fisaId = fisaId; } public Client getClient() { return client; } public void setClient(Client client) { this.client = client; } public Dintii getDintii() { return dintii; } public void setDintii(Dintii dintii) { this.dintii = dintii; } public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } public String getDiagnosticul() { return diagnosticul; } public void setDiagnosticul(String diagnosticul) { this.diagnosticul = diagnosticul; } public String getAcuze() { return acuze; } public void setAcuze(String acuze) { this.acuze = acuze; } public String getBoli() { return boli; } public void setBoli(String boli) { this.boli = boli; } public String getEvolutiaBolii() { return evolutiaBolii; } public void setEvolutiaBolii(String evolutiaBolii) { this.evolutiaBolii = evolutiaBolii; } public String getExamenExterior() { return examenExterior; } public void setExamenExterior(String examenExterior) { this.examenExterior = examenExterior; } public String getOcluzia() { return ocluzia; } public void setOcluzia(String ocluzia) { this.ocluzia = ocluzia; } public String getStareaMucoaseiEtc() { return stareaMucoaseiEtc; } public void setStareaMucoaseiEtc(String stareaMucoaseiEtc) { this.stareaMucoaseiEtc = stareaMucoaseiEtc; } public Date getDateEdited() { return dateEdited; } public void setDateEdited(Date dateEdited) { this.dateEdited = dateEdited; } }
UTF-8
Java
2,508
java
Fisa.java
Java
[ { "context": "alizable;\nimport java.sql.Date;\n\n/**\n * Created by Root on 27.12.2016.\n */\n@Entity\npublic class Fisa impl", "end": 129, "score": 0.9378876686096191, "start": 125, "tag": "USERNAME", "value": "Root" } ]
null
[]
package com.medapp.model; import javax.persistence.*; import java.io.Serializable; import java.sql.Date; /** * Created by Root on 27.12.2016. */ @Entity public class Fisa implements Serializable { private static final long serialVersionUID = -2162658279783557828L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private int fisaId; @OneToOne @JoinColumn(name = "clientId") private Client client; @OneToOne @JoinColumn(name = "dintiiId") private Dintii dintii; @Column(name = "dataCreat") private Date date; @Column(name = "dataEditat") private Date dateEdited; private String diagnosticul; private String acuze; private String boli; private String evolutiaBolii; private String examenExterior; private String ocluzia; private String stareaMucoaseiEtc; public int getFisaId() { return fisaId; } public void setFisaId(int fisaId) { this.fisaId = fisaId; } public Client getClient() { return client; } public void setClient(Client client) { this.client = client; } public Dintii getDintii() { return dintii; } public void setDintii(Dintii dintii) { this.dintii = dintii; } public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } public String getDiagnosticul() { return diagnosticul; } public void setDiagnosticul(String diagnosticul) { this.diagnosticul = diagnosticul; } public String getAcuze() { return acuze; } public void setAcuze(String acuze) { this.acuze = acuze; } public String getBoli() { return boli; } public void setBoli(String boli) { this.boli = boli; } public String getEvolutiaBolii() { return evolutiaBolii; } public void setEvolutiaBolii(String evolutiaBolii) { this.evolutiaBolii = evolutiaBolii; } public String getExamenExterior() { return examenExterior; } public void setExamenExterior(String examenExterior) { this.examenExterior = examenExterior; } public String getOcluzia() { return ocluzia; } public void setOcluzia(String ocluzia) { this.ocluzia = ocluzia; } public String getStareaMucoaseiEtc() { return stareaMucoaseiEtc; } public void setStareaMucoaseiEtc(String stareaMucoaseiEtc) { this.stareaMucoaseiEtc = stareaMucoaseiEtc; } public Date getDateEdited() { return dateEdited; } public void setDateEdited(Date dateEdited) { this.dateEdited = dateEdited; } }
2,508
0.69378
0.683014
142
16.661972
16.789034
69
false
false
0
0
0
0
0
0
0.288732
false
false
7
77d99eb58ece7d1564a1ec937e9a31f40ee8674c
26,955,214,789,311
d4160d23c0fb62abe18caebf8318eddca21d9be4
/src/ConnectionHandler/Connector.java
91f16ed2db512c9902a276617512c44c3aef79f9
[]
no_license
Amir79Naziri/HTTP_Client
https://github.com/Amir79Naziri/HTTP_Client
3b5761903340252b7d519107d44aa87697bd0db0
322a3cf51d93723fa6e20cc550017a2c07710d72
refs/heads/master
2023-08-19T10:38:35.325000
2021-10-22T19:01:27
2021-10-22T19:01:27
288,470,193
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ConnectionHandler; import ClientRequest.ClientRequest; /** * this class connect a client request to server * * @author Amir Naziri */ public class Connector implements Runnable { private ClientRequest clientRequest; /** * create new connector * @param clientRequest clientRequest */ protected Connector (ClientRequest clientRequest) { this.clientRequest = clientRequest; } /** * send request */ @Override public void run () { HttpConnection httpConnection = new HttpConnection (clientRequest.getResponseStorage ()); String url = clientRequest.getUrl (); while (true) { if (httpConnection.connectionInitializer (clientRequest.getCustomHeaders (), clientRequest.getQueryDataString (),url, clientRequest.getRequestType ())) { try { switch (clientRequest.getRequestType ()) { case GET: httpConnection.onlyGet (clientRequest.isFollowRedirect (), clientRequest.isShouldSaveOutputInFile (), clientRequest.getAddressOfFileForSaveOutput ()); break; case POST: case PUT: case DELETE:httpConnection.sendAndGet (clientRequest.getMessageBodyType (), clientRequest.getFormUrlData (),clientRequest.getUploadBinaryFile (), clientRequest.getFormUrlDataEncodedString (), clientRequest.isFollowRedirect (), clientRequest.isShouldSaveOutputInFile (), clientRequest.getAddressOfFileForSaveOutput ()); } clientRequest.printResult (); return; } catch (FollowRedirectException e) { url = e.getNewUrl (); } } else return; } } }
UTF-8
Java
2,215
java
Connector.java
Java
[ { "context": "s connect a client request to server\n *\n * @author Amir Naziri\n */\npublic class Connector implements Runnable\n{\n", "end": 143, "score": 0.9998668432235718, "start": 132, "tag": "NAME", "value": "Amir Naziri" } ]
null
[]
package ConnectionHandler; import ClientRequest.ClientRequest; /** * this class connect a client request to server * * @author <NAME> */ public class Connector implements Runnable { private ClientRequest clientRequest; /** * create new connector * @param clientRequest clientRequest */ protected Connector (ClientRequest clientRequest) { this.clientRequest = clientRequest; } /** * send request */ @Override public void run () { HttpConnection httpConnection = new HttpConnection (clientRequest.getResponseStorage ()); String url = clientRequest.getUrl (); while (true) { if (httpConnection.connectionInitializer (clientRequest.getCustomHeaders (), clientRequest.getQueryDataString (),url, clientRequest.getRequestType ())) { try { switch (clientRequest.getRequestType ()) { case GET: httpConnection.onlyGet (clientRequest.isFollowRedirect (), clientRequest.isShouldSaveOutputInFile (), clientRequest.getAddressOfFileForSaveOutput ()); break; case POST: case PUT: case DELETE:httpConnection.sendAndGet (clientRequest.getMessageBodyType (), clientRequest.getFormUrlData (),clientRequest.getUploadBinaryFile (), clientRequest.getFormUrlDataEncodedString (), clientRequest.isFollowRedirect (), clientRequest.isShouldSaveOutputInFile (), clientRequest.getAddressOfFileForSaveOutput ()); } clientRequest.printResult (); return; } catch (FollowRedirectException e) { url = e.getNewUrl (); } } else return; } } }
2,210
0.506546
0.506546
68
31.57353
29.086239
101
false
false
0
0
0
0
0
0
0.352941
false
false
7
e6961a583a98dbfb127927e58386935baf18f247
30,485,677,904,407
128838591f528e90bd18c99981395ec489c0a0c8
/src/main/java/duantn/backend/model/entity/Roommate.java
b372cfd41f0935af14b8951a21321e9ee2b2199e
[]
no_license
thanhbinhgtv/Java-SpringBoot-Backend-DuAnTN
https://github.com/thanhbinhgtv/Java-SpringBoot-Backend-DuAnTN
7aaba32f5e4fc907967d1f7cf360eb0d58dfdcf7
70f331c084ce39c01e0a31cc28ee2beb73c8cb50
refs/heads/master
2023-06-23T15:28:01.698000
2021-06-30T12:30:38
2021-06-30T12:30:38
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package duantn.backend.model.entity; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import javax.persistence.*; import java.io.Serializable; @Entity @Getter @Setter @AllArgsConstructor @NoArgsConstructor public class Roommate implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer roommateId; @Column(nullable = false) private Boolean gender; @Column(nullable = false) private Integer quantity; @Column(columnDefinition = "text") private String description; }
UTF-8
Java
609
java
Roommate.java
Java
[]
null
[]
package duantn.backend.model.entity; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import javax.persistence.*; import java.io.Serializable; @Entity @Getter @Setter @AllArgsConstructor @NoArgsConstructor public class Roommate implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer roommateId; @Column(nullable = false) private Boolean gender; @Column(nullable = false) private Integer quantity; @Column(columnDefinition = "text") private String description; }
609
0.765189
0.765189
29
20
15.467429
55
false
false
0
0
0
0
0
0
0.37931
false
false
7
e10cfacf95bcaff096bb0a6cbb27355f063d45ba
15,049,565,437,330
d17c73e4b67373b711b80c8825a16aab18c3493d
/hw03-Language-Processor/src/main/java/hr/fer/zemris/java/custom/scripting/lexer/Lexer.java
0b15bbbc5b605f4ee23968af511d9168c5571f7e
[]
no_license
mmesaric/OPJJ-Homeworks
https://github.com/mmesaric/OPJJ-Homeworks
b68ac76c22e1592cb7ccf403d17f537752f3c493
791284cd44fc6c887657c0ef0e640154f58a2b8c
refs/heads/master
2020-03-28T18:44:39.370000
2018-09-17T15:48:26
2018-09-17T15:48:26
148,906,658
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package hr.fer.zemris.java.custom.scripting.lexer; /** * This class represents a simple Lexer implementation which can work with text * blocks or tag blocks. Character escaping is possible in both states of lexer * if input is according to given rules. Possible tokens are numbers, * identifiers, for loops, function names, opening and closing blocks, strings * and eof. It consists of two separate classes, for each of given states. * * @author Marko Mesarić * */ public class Lexer { /** * Interface which specifies a single method to implement for generating and * returning next Token * * @author Marko Mesarić * */ public interface Tokenizer { Token nextToken(); } /** * Class which gives the solution for generating tokens when parsing blocks of * text. Iterates through data array char by char and appends them accordingly. * Can generate text or EOF tokens. Implements and overrides next token method * responsible for generating next tokens and retrieving last generated tokens. * * @author Marko Mesarić * */ class TextTokenizer implements Tokenizer { /** * Generates and returns the next Token. * * @return generated Token */ @Override public Token nextToken() { StringBuilder textBuilder = new StringBuilder(); for (;; currentIndex++) { if (currentIndex == data.length) { if (textBuilder.toString().isEmpty()) { token = new Token(TokenType.EOF, null); currentIndex++; } else { token = new Token(TokenType.TEXT, textBuilder.toString()); } return token; } if (currentIndex > data.length) { throw new LexerException("There are no more tokens after EOF token"); } if (data[currentIndex] == '\\') { checkWhenEscapeSign(textBuilder); continue; } else if (data[currentIndex] == '{') { if (!textBuilder.toString().isEmpty()) { token = new Token(TokenType.TEXT, textBuilder.toString()); return token; } Token toBeReturned = generateOpeningTag(data[currentIndex], textBuilder); if (toBeReturned!=null) { return token; } // return generateOpeningTag(data[currentIndex], textBuilder); } else { textBuilder.append(data[currentIndex]); } } } /** * Helper method for generating tokens consisting of Opening tag. * * @param currentElement * current element of data array * @param textBuilder * reference to stringbuilder which appends chars of text. * @return generated token * @throws LexerException * in case of wrong string input. */ public Token generateOpeningTag(char currentElement, StringBuilder textBuilder) { if (data.length == currentIndex + 1) { throw new LexerException("'\\' Escape sequence is not complete."); } if (data[currentIndex + 1] == '$') { textBuilder.append(currentElement).append(data[currentIndex + 1]); currentIndex += 2; token = new Token(TokenType.OPENING_TAG, textBuilder.toString()); return token; } else { // throw new LexerException("Input opening tag is not valid. " + currentIndex); textBuilder.append(data[currentIndex]); return null; } } /** * Helper method for generating tokens which include escape sign (\) * * @param textBuilder * reference to strinbuilder object * @throws LexerException * in case of wrong input. */ public void checkWhenEscapeSign(StringBuilder textBuilder) { if (data.length == currentIndex + 1) { throw new LexerException("'\\' Escape sequence is not complete."); } if (data[currentIndex + 1] == '\\') { textBuilder.append(currentIndex); } else if (data[currentIndex + 1] == '{') { textBuilder.append(data[currentIndex]); textBuilder.append(data[currentIndex + 1]); } else { throw new LexerException("After '\\' can come only '\' or '{' for text tokens"); } currentIndex++; } } /** * Class which gives the solution for generating tokens when parsing blocks of * tags. Iterates through data array char by char and appends them accordingly. * Can generate number, identifier, symbol, string, function name or EOF tokens. * Implements and overrides next token method responsible for generating next * tokens and retrieving last generated tokens. * * @author Marko Mesarić * */ class TagTokenizer implements Tokenizer { @Override public Token nextToken() { StringBuilder tagBuilder = new StringBuilder(); for (;; currentIndex++) { if (currentIndex == data.length) { return checkIfEnd(tagBuilder); } if (currentIndex > data.length) { throw new LexerException("There are no more tokens after EOF token"); } char currentElement = data[currentIndex]; if (Character.isWhitespace(currentElement)) { continue; } if (currentElement == '+' || currentElement == '*' || currentElement == '/' || currentElement == '^' || currentElement == '-') { if (generateSymbol(currentElement) != null) { return token; } } if (Character.isAlphabetic(currentElement)) { tagBuilder.append(currentElement); return generateIdentifier(tagBuilder); } if (currentElement == '-') { if (data.length != currentIndex + 1) { if (Character.isDigit(data[currentIndex + 1])) { tagBuilder.append(currentElement).append(data[currentIndex + 1]); currentIndex++; return generateNumber(tagBuilder); } } } if (Character.isDigit(currentElement)) { tagBuilder.append(currentElement); return generateNumber(tagBuilder); } switch (currentElement) { // case '{': // return generateOpeningTag(currentElement, tagBuilder); case '$': return generateClosingTag(currentElement, tagBuilder); case '@': if (data.length == currentIndex + 1) { throw new LexerException("Function name is not valid."); } if (Character.isAlphabetic(data[currentIndex + 1])) { currentIndex++; tagBuilder.append(currentElement).append(data[currentIndex]); return generateFunctionName(tagBuilder); } else { throw new LexerException("Function name must start with a letter."); } case '"': return generateString(tagBuilder); case '=': currentIndex++; token = new Token(TokenType.IDENTIFIER, currentElement); return token; default: throw new LexerException("Wrong input."); } // } } /** * Helper method which is called in the end of iteration through data array. * Determines if token is type EOF or TEXT * * @param tagBuilder * reference to StringBuilder object * @return generated Token */ public Token checkIfEnd(StringBuilder tagBuilder) { if (tagBuilder.toString().isEmpty()) { token = new Token(TokenType.EOF, null); currentIndex++; } else { token = new Token(TokenType.TEXT, tagBuilder.toString()); } return token; } /** * Method responsible for generating number. Called upon first occurrence of a * digit. In case of decimal point, calls the method of generating double Token * accordingly. * * @param tagBuilder * reference to stringbuilder object responsible for generating * number sequence. * @return generated Token * @throws LexerException * in case of invalid input. */ public Token generateNumber(StringBuilder tagBuilder) { currentIndex++; for (;; currentIndex++) { if (data.length == currentIndex) { token = new Token(TokenType.INT, tagBuilder.toString()); return token; } char currentElement = data[currentIndex]; if (currentElement == ' ' || currentElement =='\n' || currentElement == '\t' || currentElement== '\r') { currentIndex++; token = new Token(TokenType.INT, tagBuilder.toString()); return token; } if (Character.isDigit(currentElement)) { tagBuilder.append(currentElement); } else if (currentElement == '.') { tagBuilder.append(currentElement); return appendDecimalPart(tagBuilder); } else if (currentElement == '$') { token = new Token(TokenType.INT, tagBuilder.toString()); return token; } else { throw new LexerException("Number must start with digit, and can contain only digits." + "Error on index: " + currentIndex); } } } /** * Helper method which is called when generating number sequence and finding a * decimal point. Iterates through the rest of sequence and appends the digits * accordingly. * * @param tagBuilder * reference to stringbuilder object responsible for generating * number sequence. * * @return generated Token * @throws LexerException * in case of invalid input. */ public Token appendDecimalPart(StringBuilder tagBuilder) { currentIndex++; for (;; currentIndex++) { if (data.length == currentIndex) { token = new Token(TokenType.DOUBLE, tagBuilder.toString()); return token; } char currentElement = data[currentIndex]; if (currentElement == ' ') { currentIndex++; token = new Token(TokenType.DOUBLE, tagBuilder.toString()); return token; } if (Character.isDigit(currentElement)) { tagBuilder.append(currentElement); } else if (currentElement == '$') { token = new Token(TokenType.DOUBLE, tagBuilder.toString()); return token; } else { throw new LexerException("Number must start with digit, and can contain only digits."); } } } /** * Helper method which is called when generating identifier sequence and * alphabetic char. Iterates through the rest of sequence and appends the * characters accordingly. * * @param tagBuilder * reference to stringbuilder object responsible for generating * identifier sequence. * * @return generated Token * @throws LexerException * in case of invalid input. */ public Token generateIdentifier(StringBuilder tagBuilder) { currentIndex++; for (;; currentIndex++) { if (data.length == currentIndex) { token = new Token(TokenType.IDENTIFIER, tagBuilder.toString()); return token; } char currentElement = data[currentIndex]; if (currentElement == ' ') { currentIndex++; token = new Token(TokenType.IDENTIFIER, tagBuilder.toString()); return token; } if (Character.isAlphabetic(currentElement) || Character.isDigit(currentElement) || currentElement == '_') { tagBuilder.append(currentElement); } else if (currentElement == '$') { token = new Token(TokenType.IDENTIFIER, tagBuilder.toString()); return token; } else { throw new LexerException( "Name of identifier must start with letter, and can contain only digits, letters and '_'"); } } } /** * Helper method which is called when generating symbols(operators). * * @param currentElement * current element in the data array * @return generated Token * @throws LexerException * in case of invalid input. */ public Token generateSymbol(char currentElement) { if (currentElement == '-') { if (data.length == currentIndex + 1) { throw new LexerException("'\\' Escape sequence is not complete."); } if (!Character.isDigit(data[currentIndex + 1])) { token = new Token(TokenType.SYMBOL, data[currentIndex]); currentIndex++; return token; } return null; } else { currentIndex++; token = new Token(TokenType.SYMBOL, currentElement); return token; } } /** * Helper method for generating tokens consisting of closing tag. * * @param currentElement * current element of data array * @param textBuilder * reference to stringbuilder which appends chars of text. * @return generated token * @throws LexerException * in case of wrong string input. */ public Token generateClosingTag(char currentElement, StringBuilder tagBuilder) { if (data.length == currentIndex + 1) { throw new LexerException("'\\' Escape sequence is not complete."); } if (data[currentIndex + 1] == '}') { tagBuilder.append(currentElement).append(data[currentIndex + 1]); currentIndex += 2; token = new Token(TokenType.CLOSING_TAG, tagBuilder.toString()); return token; } else { throw new LexerException("Input closing tag is not valid."); } } /** * Helper method which is called when generating function name sequence. Called * upon first occurence of '@' char. Iterates through the rest of sequence and * appends the characters accordingly. * * @param tagBuilder * reference to stringbuilder object responsible for generating * method name sequence. * * @return generated Token * @throws LexerException * in case of invalid input. */ public Token generateFunctionName(StringBuilder tagBuilder) { currentIndex++; for (;; currentIndex++) { if (data.length == currentIndex) { token = new Token(TokenType.FUNCTION_NAME, tagBuilder.toString().substring(1)); return token; } char currentElement = data[currentIndex]; if (currentElement == ' ' || currentElement =='\n' || currentElement == '\t' || currentElement== '\r') { currentIndex++; token = new Token(TokenType.FUNCTION_NAME, tagBuilder.toString().substring(1)); return token; } if (Character.isAlphabetic(currentElement) || Character.isDigit(currentElement) || currentElement == '_') { tagBuilder.append(currentElement); } else if (currentElement == '$') { token = new Token(TokenType.FUNCTION_NAME, tagBuilder.toString().substring(1)); return token; } else { throw new LexerException("Exception on index: " + currentIndex + "Name of function must start with letter, and can contain only digits, letters and '_'"); } } } /** * Helper method which is called when generating string sequence. Called upon * finding the first occurrence of '"'. Iterates through the rest of sequence * and appends the characters accordingly. * * @param tagBuilder * reference to stringbuilder object responsible for generating * string sequence. * * @return generated Token * @throws LexerException * in case of invalid input. */ public Token generateString(StringBuilder tagBuilder) { currentIndex++; for (;; currentIndex++) { if (data.length == currentIndex) { throw new LexerException("Wrong string input"); } char currentElement = data[currentIndex]; if (currentElement == '"') { currentIndex++; token = new Token(TokenType.STRING, tagBuilder.toString()); return token; } // if (Character.isWhitespace(currentElement)) { // tagBuilder.append(currentElement); // continue; // } if (currentElement == '\\') { checkWhenEscape(currentElement, tagBuilder); } else { tagBuilder.append(currentElement); } } } /** * Helper method for generating tokens which include escape sign (\) * * @param textBuilder * reference to stringbuilder object * @throws LexerException * in case of wrong input. */ public void checkWhenEscape(char currentElement, StringBuilder tagBuilder) { if (data.length == currentIndex + 1) { throw new LexerException("Wrong string input"); } char nextChar = data[currentIndex + 1]; if (nextChar == 'n') { tagBuilder.append("\n"); } else if (nextChar == 'r') { tagBuilder.append("\r"); } else if (nextChar == 't') { tagBuilder.append("\t"); } else if (nextChar == '\\' ) { tagBuilder.append(nextChar); } else if (nextChar == '"') { tagBuilder.append(nextChar); } else { throw new LexerException("In strings, after '\\' can appear only '\\' or '\"' " + " Index: " +currentIndex); } currentIndex++; } } /** * char array of data which lexer should handle. */ private char[] data; /** * Last generated token */ private Token token; /** * Attribute which determines the current work mode of Lexer. */ private LexerState lexerState; /** * current index of the data array. */ private int currentIndex; /** * Constructor which parses input string to char array and sets the default * state and size * * @throws IllegalArgumentException * in case when input is null * @param text * given input */ public Lexer(String text) { if (text == null) { throw new IllegalArgumentException("Input text can't be null"); } this.data = text.toCharArray(); this.lexerState = LexerState.TEXT; this.currentIndex = 0; } /** * Generates and returns the next Token. * * @return generated Token */ public Token nextToken() { Tokenizer tokenizer = stateFactoryGenerator(); return tokenizer.nextToken(); } /** * Factory method which returns the proper instantiated object of class which * implements Tokenizer interface. * * @return Tokenizer object */ public Tokenizer stateFactoryGenerator() { if (lexerState == LexerState.TEXT) { return new TextTokenizer(); } else { return new TagTokenizer(); } } /** * Returns last generated token without creating the next one * * @return last generated token */ public Token getToken() { if (token == null) { throw new NullPointerException("There are no generated tokens yet."); } return token; } /** * Sets the lexer state to given state value. * * @throws IllegalArgumentException * in case null is sent * @param state * can be BASIC or EXTENDED */ public void setState(LexerState state) { if (state == null) { throw new IllegalArgumentException("State can't be null."); } this.lexerState = state; } }
UTF-8
Java
18,210
java
Lexer.java
Java
[ { "context": " classes, for each of given states.\n * \n * @author Marko Mesarić\n *\n */\npublic class Lexer {\n\n\t/**\n\t * Interface w", "end": 468, "score": 0.9998806715011597, "start": 455, "tag": "NAME", "value": "Marko Mesarić" }, { "context": "ting and\n\t * returning next T...
null
[]
package hr.fer.zemris.java.custom.scripting.lexer; /** * This class represents a simple Lexer implementation which can work with text * blocks or tag blocks. Character escaping is possible in both states of lexer * if input is according to given rules. Possible tokens are numbers, * identifiers, for loops, function names, opening and closing blocks, strings * and eof. It consists of two separate classes, for each of given states. * * @author <NAME> * */ public class Lexer { /** * Interface which specifies a single method to implement for generating and * returning next Token * * @author <NAME> * */ public interface Tokenizer { Token nextToken(); } /** * Class which gives the solution for generating tokens when parsing blocks of * text. Iterates through data array char by char and appends them accordingly. * Can generate text or EOF tokens. Implements and overrides next token method * responsible for generating next tokens and retrieving last generated tokens. * * @author <NAME> * */ class TextTokenizer implements Tokenizer { /** * Generates and returns the next Token. * * @return generated Token */ @Override public Token nextToken() { StringBuilder textBuilder = new StringBuilder(); for (;; currentIndex++) { if (currentIndex == data.length) { if (textBuilder.toString().isEmpty()) { token = new Token(TokenType.EOF, null); currentIndex++; } else { token = new Token(TokenType.TEXT, textBuilder.toString()); } return token; } if (currentIndex > data.length) { throw new LexerException("There are no more tokens after EOF token"); } if (data[currentIndex] == '\\') { checkWhenEscapeSign(textBuilder); continue; } else if (data[currentIndex] == '{') { if (!textBuilder.toString().isEmpty()) { token = new Token(TokenType.TEXT, textBuilder.toString()); return token; } Token toBeReturned = generateOpeningTag(data[currentIndex], textBuilder); if (toBeReturned!=null) { return token; } // return generateOpeningTag(data[currentIndex], textBuilder); } else { textBuilder.append(data[currentIndex]); } } } /** * Helper method for generating tokens consisting of Opening tag. * * @param currentElement * current element of data array * @param textBuilder * reference to stringbuilder which appends chars of text. * @return generated token * @throws LexerException * in case of wrong string input. */ public Token generateOpeningTag(char currentElement, StringBuilder textBuilder) { if (data.length == currentIndex + 1) { throw new LexerException("'\\' Escape sequence is not complete."); } if (data[currentIndex + 1] == '$') { textBuilder.append(currentElement).append(data[currentIndex + 1]); currentIndex += 2; token = new Token(TokenType.OPENING_TAG, textBuilder.toString()); return token; } else { // throw new LexerException("Input opening tag is not valid. " + currentIndex); textBuilder.append(data[currentIndex]); return null; } } /** * Helper method for generating tokens which include escape sign (\) * * @param textBuilder * reference to strinbuilder object * @throws LexerException * in case of wrong input. */ public void checkWhenEscapeSign(StringBuilder textBuilder) { if (data.length == currentIndex + 1) { throw new LexerException("'\\' Escape sequence is not complete."); } if (data[currentIndex + 1] == '\\') { textBuilder.append(currentIndex); } else if (data[currentIndex + 1] == '{') { textBuilder.append(data[currentIndex]); textBuilder.append(data[currentIndex + 1]); } else { throw new LexerException("After '\\' can come only '\' or '{' for text tokens"); } currentIndex++; } } /** * Class which gives the solution for generating tokens when parsing blocks of * tags. Iterates through data array char by char and appends them accordingly. * Can generate number, identifier, symbol, string, function name or EOF tokens. * Implements and overrides next token method responsible for generating next * tokens and retrieving last generated tokens. * * @author <NAME> * */ class TagTokenizer implements Tokenizer { @Override public Token nextToken() { StringBuilder tagBuilder = new StringBuilder(); for (;; currentIndex++) { if (currentIndex == data.length) { return checkIfEnd(tagBuilder); } if (currentIndex > data.length) { throw new LexerException("There are no more tokens after EOF token"); } char currentElement = data[currentIndex]; if (Character.isWhitespace(currentElement)) { continue; } if (currentElement == '+' || currentElement == '*' || currentElement == '/' || currentElement == '^' || currentElement == '-') { if (generateSymbol(currentElement) != null) { return token; } } if (Character.isAlphabetic(currentElement)) { tagBuilder.append(currentElement); return generateIdentifier(tagBuilder); } if (currentElement == '-') { if (data.length != currentIndex + 1) { if (Character.isDigit(data[currentIndex + 1])) { tagBuilder.append(currentElement).append(data[currentIndex + 1]); currentIndex++; return generateNumber(tagBuilder); } } } if (Character.isDigit(currentElement)) { tagBuilder.append(currentElement); return generateNumber(tagBuilder); } switch (currentElement) { // case '{': // return generateOpeningTag(currentElement, tagBuilder); case '$': return generateClosingTag(currentElement, tagBuilder); case '@': if (data.length == currentIndex + 1) { throw new LexerException("Function name is not valid."); } if (Character.isAlphabetic(data[currentIndex + 1])) { currentIndex++; tagBuilder.append(currentElement).append(data[currentIndex]); return generateFunctionName(tagBuilder); } else { throw new LexerException("Function name must start with a letter."); } case '"': return generateString(tagBuilder); case '=': currentIndex++; token = new Token(TokenType.IDENTIFIER, currentElement); return token; default: throw new LexerException("Wrong input."); } // } } /** * Helper method which is called in the end of iteration through data array. * Determines if token is type EOF or TEXT * * @param tagBuilder * reference to StringBuilder object * @return generated Token */ public Token checkIfEnd(StringBuilder tagBuilder) { if (tagBuilder.toString().isEmpty()) { token = new Token(TokenType.EOF, null); currentIndex++; } else { token = new Token(TokenType.TEXT, tagBuilder.toString()); } return token; } /** * Method responsible for generating number. Called upon first occurrence of a * digit. In case of decimal point, calls the method of generating double Token * accordingly. * * @param tagBuilder * reference to stringbuilder object responsible for generating * number sequence. * @return generated Token * @throws LexerException * in case of invalid input. */ public Token generateNumber(StringBuilder tagBuilder) { currentIndex++; for (;; currentIndex++) { if (data.length == currentIndex) { token = new Token(TokenType.INT, tagBuilder.toString()); return token; } char currentElement = data[currentIndex]; if (currentElement == ' ' || currentElement =='\n' || currentElement == '\t' || currentElement== '\r') { currentIndex++; token = new Token(TokenType.INT, tagBuilder.toString()); return token; } if (Character.isDigit(currentElement)) { tagBuilder.append(currentElement); } else if (currentElement == '.') { tagBuilder.append(currentElement); return appendDecimalPart(tagBuilder); } else if (currentElement == '$') { token = new Token(TokenType.INT, tagBuilder.toString()); return token; } else { throw new LexerException("Number must start with digit, and can contain only digits." + "Error on index: " + currentIndex); } } } /** * Helper method which is called when generating number sequence and finding a * decimal point. Iterates through the rest of sequence and appends the digits * accordingly. * * @param tagBuilder * reference to stringbuilder object responsible for generating * number sequence. * * @return generated Token * @throws LexerException * in case of invalid input. */ public Token appendDecimalPart(StringBuilder tagBuilder) { currentIndex++; for (;; currentIndex++) { if (data.length == currentIndex) { token = new Token(TokenType.DOUBLE, tagBuilder.toString()); return token; } char currentElement = data[currentIndex]; if (currentElement == ' ') { currentIndex++; token = new Token(TokenType.DOUBLE, tagBuilder.toString()); return token; } if (Character.isDigit(currentElement)) { tagBuilder.append(currentElement); } else if (currentElement == '$') { token = new Token(TokenType.DOUBLE, tagBuilder.toString()); return token; } else { throw new LexerException("Number must start with digit, and can contain only digits."); } } } /** * Helper method which is called when generating identifier sequence and * alphabetic char. Iterates through the rest of sequence and appends the * characters accordingly. * * @param tagBuilder * reference to stringbuilder object responsible for generating * identifier sequence. * * @return generated Token * @throws LexerException * in case of invalid input. */ public Token generateIdentifier(StringBuilder tagBuilder) { currentIndex++; for (;; currentIndex++) { if (data.length == currentIndex) { token = new Token(TokenType.IDENTIFIER, tagBuilder.toString()); return token; } char currentElement = data[currentIndex]; if (currentElement == ' ') { currentIndex++; token = new Token(TokenType.IDENTIFIER, tagBuilder.toString()); return token; } if (Character.isAlphabetic(currentElement) || Character.isDigit(currentElement) || currentElement == '_') { tagBuilder.append(currentElement); } else if (currentElement == '$') { token = new Token(TokenType.IDENTIFIER, tagBuilder.toString()); return token; } else { throw new LexerException( "Name of identifier must start with letter, and can contain only digits, letters and '_'"); } } } /** * Helper method which is called when generating symbols(operators). * * @param currentElement * current element in the data array * @return generated Token * @throws LexerException * in case of invalid input. */ public Token generateSymbol(char currentElement) { if (currentElement == '-') { if (data.length == currentIndex + 1) { throw new LexerException("'\\' Escape sequence is not complete."); } if (!Character.isDigit(data[currentIndex + 1])) { token = new Token(TokenType.SYMBOL, data[currentIndex]); currentIndex++; return token; } return null; } else { currentIndex++; token = new Token(TokenType.SYMBOL, currentElement); return token; } } /** * Helper method for generating tokens consisting of closing tag. * * @param currentElement * current element of data array * @param textBuilder * reference to stringbuilder which appends chars of text. * @return generated token * @throws LexerException * in case of wrong string input. */ public Token generateClosingTag(char currentElement, StringBuilder tagBuilder) { if (data.length == currentIndex + 1) { throw new LexerException("'\\' Escape sequence is not complete."); } if (data[currentIndex + 1] == '}') { tagBuilder.append(currentElement).append(data[currentIndex + 1]); currentIndex += 2; token = new Token(TokenType.CLOSING_TAG, tagBuilder.toString()); return token; } else { throw new LexerException("Input closing tag is not valid."); } } /** * Helper method which is called when generating function name sequence. Called * upon first occurence of '@' char. Iterates through the rest of sequence and * appends the characters accordingly. * * @param tagBuilder * reference to stringbuilder object responsible for generating * method name sequence. * * @return generated Token * @throws LexerException * in case of invalid input. */ public Token generateFunctionName(StringBuilder tagBuilder) { currentIndex++; for (;; currentIndex++) { if (data.length == currentIndex) { token = new Token(TokenType.FUNCTION_NAME, tagBuilder.toString().substring(1)); return token; } char currentElement = data[currentIndex]; if (currentElement == ' ' || currentElement =='\n' || currentElement == '\t' || currentElement== '\r') { currentIndex++; token = new Token(TokenType.FUNCTION_NAME, tagBuilder.toString().substring(1)); return token; } if (Character.isAlphabetic(currentElement) || Character.isDigit(currentElement) || currentElement == '_') { tagBuilder.append(currentElement); } else if (currentElement == '$') { token = new Token(TokenType.FUNCTION_NAME, tagBuilder.toString().substring(1)); return token; } else { throw new LexerException("Exception on index: " + currentIndex + "Name of function must start with letter, and can contain only digits, letters and '_'"); } } } /** * Helper method which is called when generating string sequence. Called upon * finding the first occurrence of '"'. Iterates through the rest of sequence * and appends the characters accordingly. * * @param tagBuilder * reference to stringbuilder object responsible for generating * string sequence. * * @return generated Token * @throws LexerException * in case of invalid input. */ public Token generateString(StringBuilder tagBuilder) { currentIndex++; for (;; currentIndex++) { if (data.length == currentIndex) { throw new LexerException("Wrong string input"); } char currentElement = data[currentIndex]; if (currentElement == '"') { currentIndex++; token = new Token(TokenType.STRING, tagBuilder.toString()); return token; } // if (Character.isWhitespace(currentElement)) { // tagBuilder.append(currentElement); // continue; // } if (currentElement == '\\') { checkWhenEscape(currentElement, tagBuilder); } else { tagBuilder.append(currentElement); } } } /** * Helper method for generating tokens which include escape sign (\) * * @param textBuilder * reference to stringbuilder object * @throws LexerException * in case of wrong input. */ public void checkWhenEscape(char currentElement, StringBuilder tagBuilder) { if (data.length == currentIndex + 1) { throw new LexerException("Wrong string input"); } char nextChar = data[currentIndex + 1]; if (nextChar == 'n') { tagBuilder.append("\n"); } else if (nextChar == 'r') { tagBuilder.append("\r"); } else if (nextChar == 't') { tagBuilder.append("\t"); } else if (nextChar == '\\' ) { tagBuilder.append(nextChar); } else if (nextChar == '"') { tagBuilder.append(nextChar); } else { throw new LexerException("In strings, after '\\' can appear only '\\' or '\"' " + " Index: " +currentIndex); } currentIndex++; } } /** * char array of data which lexer should handle. */ private char[] data; /** * Last generated token */ private Token token; /** * Attribute which determines the current work mode of Lexer. */ private LexerState lexerState; /** * current index of the data array. */ private int currentIndex; /** * Constructor which parses input string to char array and sets the default * state and size * * @throws IllegalArgumentException * in case when input is null * @param text * given input */ public Lexer(String text) { if (text == null) { throw new IllegalArgumentException("Input text can't be null"); } this.data = text.toCharArray(); this.lexerState = LexerState.TEXT; this.currentIndex = 0; } /** * Generates and returns the next Token. * * @return generated Token */ public Token nextToken() { Tokenizer tokenizer = stateFactoryGenerator(); return tokenizer.nextToken(); } /** * Factory method which returns the proper instantiated object of class which * implements Tokenizer interface. * * @return Tokenizer object */ public Tokenizer stateFactoryGenerator() { if (lexerState == LexerState.TEXT) { return new TextTokenizer(); } else { return new TagTokenizer(); } } /** * Returns last generated token without creating the next one * * @return last generated token */ public Token getToken() { if (token == null) { throw new NullPointerException("There are no generated tokens yet."); } return token; } /** * Sets the lexer state to given state value. * * @throws IllegalArgumentException * in case null is sent * @param state * can be BASIC or EXTENDED */ public void setState(LexerState state) { if (state == null) { throw new IllegalArgumentException("State can't be null."); } this.lexerState = state; } }
18,178
0.642261
0.640888
685
25.578102
25.752077
112
false
false
0
0
0
0
0
0
2.854015
false
false
7
eeaf09d5f8f6ab3f01013f6c7369f3336d87432d
21,552,145,924,334
4937fe4c99e5e117aa64222749214727cfc2363c
/JAVA/grafi_mio/lista/GraphList.java
a706150b3ca997585e6f6842eaa577c3ed7d1fd0
[]
no_license
mrccv/ASD
https://github.com/mrccv/ASD
879d03e5038e1fd8df258078dca74ec33a93ae7d
767463b510a258c2c5a6cfcecbe56ce68e7025c9
refs/heads/master
2020-04-19T17:22:13.252000
2019-02-05T11:06:12
2019-02-05T11:06:12
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package grafi_mio.lista; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; import grafi_mio.Edge; import grafi_mio.Graph; import grafi_mio.PairVertex; import grafi_mio.Vertex; public abstract class GraphList extends Graph { public HashMap<Vertex, LinkedHashSet<Vertex>> adj; public Map<PairVertex, Edge> edges; protected int mVerticesCount = 0; public GraphList(int vertices) { adj = new HashMap<>(); edges = new HashMap<>(); for (int i = 0; i < vertices; i++) { adj.put(new Vertex(i), new LinkedHashSet<Vertex>(vertices)); } mVerticesCount = vertices; } @Override public boolean hasEdge(Vertex v1, Vertex v2) { // return adj.get(v1).contains(v2); return edges.containsKey(new PairVertex(v1, v2)); } @Override public Edge getEdge(Vertex v1, Vertex v2) { PairVertex p = new PairVertex(v1, v2); if (edges.containsKey(p)) { return edges.get(p); } return null; } public Map<PairVertex, Edge> getEdges() { return edges; } public List<Edge> getEdgesAsList() { return (List<Edge>) edges.values(); } // Tutti gli archi USCENTI da v1 public List<Vertex> outEdges(Vertex v1) { return new ArrayList<Vertex>(adj.get(v1)); } // Tutti gli archi entranti in v2 public List<Vertex> inEdges(Vertex v2) { List<Vertex> edges = new ArrayList<Vertex>(); for (Entry<Vertex, LinkedHashSet<Vertex>> sub : adj.entrySet()) { if (sub.getValue().contains(v2)) edges.add(sub.getKey()); } return edges; } @Override public int getEdgesCount() { return edges.size(); } @Override public int getVerticesCount() { return mVerticesCount; } protected int isOutOfBound(int v1, int v2) { if (v1 > mVerticesCount) { return v1; } if (v2 > mVerticesCount) { return v2; } return -1; } public boolean[][] toMatrix() { boolean[][] matrix = new boolean[mVerticesCount + 1][mVerticesCount + 1]; for (int i = 0; i < matrix.length; i++) { for (int j = 0; j < matrix.length; j++) { matrix[i][j] = false; } } for (PairVertex pair : edges.keySet()) { int v1 = pair.getVer1().getIndex(); int v2 = pair.getVer2().getIndex(); matrix[v1][v2] = true; } return matrix; } }
UTF-8
Java
2,382
java
GraphList.java
Java
[]
null
[]
package grafi_mio.lista; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; import grafi_mio.Edge; import grafi_mio.Graph; import grafi_mio.PairVertex; import grafi_mio.Vertex; public abstract class GraphList extends Graph { public HashMap<Vertex, LinkedHashSet<Vertex>> adj; public Map<PairVertex, Edge> edges; protected int mVerticesCount = 0; public GraphList(int vertices) { adj = new HashMap<>(); edges = new HashMap<>(); for (int i = 0; i < vertices; i++) { adj.put(new Vertex(i), new LinkedHashSet<Vertex>(vertices)); } mVerticesCount = vertices; } @Override public boolean hasEdge(Vertex v1, Vertex v2) { // return adj.get(v1).contains(v2); return edges.containsKey(new PairVertex(v1, v2)); } @Override public Edge getEdge(Vertex v1, Vertex v2) { PairVertex p = new PairVertex(v1, v2); if (edges.containsKey(p)) { return edges.get(p); } return null; } public Map<PairVertex, Edge> getEdges() { return edges; } public List<Edge> getEdgesAsList() { return (List<Edge>) edges.values(); } // Tutti gli archi USCENTI da v1 public List<Vertex> outEdges(Vertex v1) { return new ArrayList<Vertex>(adj.get(v1)); } // Tutti gli archi entranti in v2 public List<Vertex> inEdges(Vertex v2) { List<Vertex> edges = new ArrayList<Vertex>(); for (Entry<Vertex, LinkedHashSet<Vertex>> sub : adj.entrySet()) { if (sub.getValue().contains(v2)) edges.add(sub.getKey()); } return edges; } @Override public int getEdgesCount() { return edges.size(); } @Override public int getVerticesCount() { return mVerticesCount; } protected int isOutOfBound(int v1, int v2) { if (v1 > mVerticesCount) { return v1; } if (v2 > mVerticesCount) { return v2; } return -1; } public boolean[][] toMatrix() { boolean[][] matrix = new boolean[mVerticesCount + 1][mVerticesCount + 1]; for (int i = 0; i < matrix.length; i++) { for (int j = 0; j < matrix.length; j++) { matrix[i][j] = false; } } for (PairVertex pair : edges.keySet()) { int v1 = pair.getVer1().getIndex(); int v2 = pair.getVer2().getIndex(); matrix[v1][v2] = true; } return matrix; } }
2,382
0.637699
0.623006
106
20.471699
18.165491
75
false
false
0
0
0
0
0
0
1.783019
false
false
7
eefc90a818c3da9d99f219962273296edc514e58
10,153,302,720,362
da0c234d86e5dd4d97aee320a966606778f83e6e
/code/bones/java/tulin/netty/jlog/config/config-core/src/main/java/com/jd/platform/jlog/core/Configurator.java
ad4bdf46c697ab5e14fe9f7185de28b66bb38289
[ "Apache-2.0" ]
permissive
legendsf/life
https://github.com/legendsf/life
db6fe837d7476cfe08ba0ab26063cbe08b1caa73
3cc3aaaf9cbbdb1c6dd68c505deba33a906a3c05
refs/heads/master
2022-08-13T10:39:00.026000
2022-07-28T03:02:44
2022-07-28T03:02:44
190,318,814
3
3
null
false
2022-07-21T06:34:05
2019-06-05T03:21:46
2022-03-14T01:03:01
2022-07-21T06:34:05
150,299
2
3
40
Java
false
false
package com.jd.platform.jlog.core; import java.util.List; /** * @author tangbohu * @version 1.0.0 * @desc 参考log4J * @ClassName Configurator.java * @createTime 2022年02月15日 17:06:00 */ public interface Configurator { /** * 获取string配置 * @param key key * @return val */ String getString(String key); /** * 获取LONG配置 * @param key key * @return val */ Long getLong(String key); /** * 获取LIST类型配置 * @param key key * @return val */ List<String> getList(String key); /** * 获取实体类型配置 * @param key key * @return val */ <T> T getObject(String key, Class<T> clz); /** * 设置配置 * @param key key * @param content val * @return content val */ boolean putConfig(String key, String content); /** * 设置配置 * @param key key * @return content val * @param timeoutMills timeoutMills * @param content content */ boolean putConfig(String key, String content, long timeoutMills); /** * 获取配置器类型 * @return string example:apollo */ String getType(); }
UTF-8
Java
1,227
java
Configurator.java
Java
[ { "context": "jlog.core;\n\nimport java.util.List;\n\n/**\n * @author tangbohu\n * @version 1.0.0\n * @desc 参考log4J\n * @ClassName ", "end": 83, "score": 0.9993125796318054, "start": 75, "tag": "USERNAME", "value": "tangbohu" } ]
null
[]
package com.jd.platform.jlog.core; import java.util.List; /** * @author tangbohu * @version 1.0.0 * @desc 参考log4J * @ClassName Configurator.java * @createTime 2022年02月15日 17:06:00 */ public interface Configurator { /** * 获取string配置 * @param key key * @return val */ String getString(String key); /** * 获取LONG配置 * @param key key * @return val */ Long getLong(String key); /** * 获取LIST类型配置 * @param key key * @return val */ List<String> getList(String key); /** * 获取实体类型配置 * @param key key * @return val */ <T> T getObject(String key, Class<T> clz); /** * 设置配置 * @param key key * @param content val * @return content val */ boolean putConfig(String key, String content); /** * 设置配置 * @param key key * @return content val * @param timeoutMills timeoutMills * @param content content */ boolean putConfig(String key, String content, long timeoutMills); /** * 获取配置器类型 * @return string example:apollo */ String getType(); }
1,227
0.557305
0.541557
69
15.565217
14.163106
69
false
false
0
0
0
0
0
0
0.188406
false
false
7
cab677b3995946c2fbc53cea7b5b26cee871a2fd
24,936,580,134,769
21363f7d3a13a4f198095c9c0d9da08d3b457116
/src/main/java/ro/fastrackit/homework6/PascalSolution.java
d2cf95092d88dc2a87171c1ee38deb4a6d0c55fa
[]
no_license
MihaiChiorean/fasttrackit-practice
https://github.com/MihaiChiorean/fasttrackit-practice
38f759c4c363c938a1722a7c07a2dbe1a3769aaa
8fc121e25af2e6ed26536b41d12ff098402d0e74
refs/heads/main
2023-02-11T05:26:41.354000
2021-01-02T15:13:13
2021-01-02T15:13:13
302,391,673
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ro.fastrackit.homework6; public class PascalSolution { private static Integer numberOfRows; PascalSolution (Integer numberOfRows) { this.numberOfRows = numberOfRows; } public static void displayTheTriangle() { int rows = numberOfRows; int n; for(int i = 0; i<numberOfRows; i++) { for(int j = 1; j <= rows; j++) { System.out.print(" "); } n = 1; for(int l = 0; l<= i; l++){ System.out.print(n + " "); n = n + (i-l)/(l+1); } rows--; System.out.println(); } } }
UTF-8
Java
665
java
PascalSolution.java
Java
[]
null
[]
package ro.fastrackit.homework6; public class PascalSolution { private static Integer numberOfRows; PascalSolution (Integer numberOfRows) { this.numberOfRows = numberOfRows; } public static void displayTheTriangle() { int rows = numberOfRows; int n; for(int i = 0; i<numberOfRows; i++) { for(int j = 1; j <= rows; j++) { System.out.print(" "); } n = 1; for(int l = 0; l<= i; l++){ System.out.print(n + " "); n = n + (i-l)/(l+1); } rows--; System.out.println(); } } }
665
0.461654
0.452632
29
21.931034
17.142267
45
false
false
0
0
0
0
0
0
0.586207
false
false
7
6dafa4b2f783108ec5e9d22eadce474319bbb467
4,741,643,911,065
0c19d4e513019e6a383996419ae5ad326839f46c
/first-spring-web-jar/src/main/java/ch/elca/training/dom/Group.java
a7b3f78aa00ad824b192c34641ed1b86ddf24c5c
[]
no_license
TranDuongTu/first-spring-mvc
https://github.com/TranDuongTu/first-spring-mvc
ea3eaaf22d1187ab9289faf9d1b4297793ccccac
eb01326608608feb9543942a4a3cc3693246b5c3
refs/heads/master
2020-12-24T13:53:03.356000
2015-01-29T02:46:54
2015-01-29T02:46:54
29,852,630
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Group.java * * Project: TECHWATCH - TESTING TECHNOLOGIES * * Copyright 2008 by ELCA Informatique SA * Av. de la Harpe 22-24, 1000 Lausanne 13 * All rights reserved. * * This software is the confidential and proprietary information * of ELCA Informatique SA. ("Confidential Information"). You * shall not disclose such Confidential Information and shall * use it only in accordance with the terms of the license * agreement you entered into with ELCA. */ package ch.elca.training.dom; import java.util.ArrayList; import java.util.List; public class Group extends BaseDom { private static final long serialVersionUID = 1L; private Employee leader; private List<Project> projects = new ArrayList<Project>(); public Employee getLeader() { return leader; } public void setLeader(Employee leader) { this.leader = leader; } public List<Project> getProjects() { return projects; } public void setProjects(List<Project> projects) { this.projects = projects; } }
UTF-8
Java
1,064
java
Group.java
Java
[]
null
[]
/* * Group.java * * Project: TECHWATCH - TESTING TECHNOLOGIES * * Copyright 2008 by ELCA Informatique SA * Av. de la Harpe 22-24, 1000 Lausanne 13 * All rights reserved. * * This software is the confidential and proprietary information * of ELCA Informatique SA. ("Confidential Information"). You * shall not disclose such Confidential Information and shall * use it only in accordance with the terms of the license * agreement you entered into with ELCA. */ package ch.elca.training.dom; import java.util.ArrayList; import java.util.List; public class Group extends BaseDom { private static final long serialVersionUID = 1L; private Employee leader; private List<Project> projects = new ArrayList<Project>(); public Employee getLeader() { return leader; } public void setLeader(Employee leader) { this.leader = leader; } public List<Project> getProjects() { return projects; } public void setProjects(List<Project> projects) { this.projects = projects; } }
1,064
0.692669
0.678571
43
23.767443
20.954922
64
false
false
0
0
0
0
0
0
0.348837
false
false
7
f1d6689d09c0d7c925d1917f2424c34fbf9f6dd0
4,741,643,913,505
822e8268fb17256dd3b2aa71eb81323a8a66b27f
/tests/sql/src/main/java/sql/dmlDistTxRRStatements/TradeNetworthDMLDistTxRRStmt.java
83d607abfe1ceeeff47a93fb90b41557d97535cf
[ "LGPL-2.1-only", "LicenseRef-scancode-other-permissive", "Apache-1.1", "GPL-2.0-only", "Plexus", "JSON", "MIT", "Apache-2.0", "BSD-2-Clause" ]
permissive
gemxd/gemfirexd-oss
https://github.com/gemxd/gemfirexd-oss
3d096b2de5cd49f787e65d4ee65bb51cd35cab4b
d89cad2b075df92fc3acce09b9f8dc7b30be2445
refs/heads/master
2020-12-28T04:41:41.641000
2020-11-18T03:39:41
2020-11-18T03:39:41
48,769,190
13
9
Apache-2.0
false
2018-10-12T07:42:55
2015-12-29T22:07:26
2018-06-17T22:03:24
2018-10-11T16:53:51
112,345
11
19
0
Java
false
null
/* * Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you * may not use this file except in compliance with the License. You * may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. See accompanying * LICENSE file. */ package sql.dmlDistTxRRStatements; import hydra.Log; import hydra.blackboard.SharedMap; import java.math.BigDecimal; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashMap; import java.util.List; import com.gemstone.gemfire.cache.query.Struct; import sql.SQLHelper; import sql.dmlDistTxStatements.TradeNetworthDMLDistTxStmt; import sql.sqlTx.ReadLockedKey; import sql.sqlTx.SQLDistRRTxTest; import sql.sqlTx.SQLTxRRReadBB; import sql.sqlutil.ResultSetHelper; import util.TestException; public class TradeNetworthDMLDistTxRRStmt extends TradeNetworthDMLDistTxStmt { protected boolean verifyConflict(HashMap<String, Integer> modifiedKeysByOp, HashMap<String, Integer>modifiedKeysByThisTx, SQLException gfxdse, boolean getConflict) { return verifyConflictForRR(modifiedKeysByOp, modifiedKeysByThisTx, gfxdse, getConflict); } public boolean queryGfxd(Connection gConn, boolean withDerby){ if (!withDerby) { return queryGfxdOnly(gConn); } int whichQuery = rand.nextInt(select.length-numOfNonUniq); //only uses with tid condition int cash = 100000; int sec = 100000; int tid = testUniqueKeys ? getMyTid() : getRandomTid(); int loanLimit = loanLimits[rand.nextInt(loanLimits.length)]; BigDecimal loanAmount = new BigDecimal (Integer.toString(rand.nextInt(loanLimit))); BigDecimal queryCash = new BigDecimal (Integer.toString(rand.nextInt(cash))); BigDecimal querySec= new BigDecimal (Integer.toString(rand.nextInt(sec))); ResultSet gfxdRS = null; SQLException gfxdse = null; try { gfxdRS = query (gConn, whichQuery, queryCash, querySec, loanLimit, loanAmount, tid); if (gfxdRS == null) { if (isHATest) { Log.getLogWriter().info("Testing HA and did not get GFXD result set"); return true; } else throw new TestException("Not able to get gfxd result set"); } } catch (SQLException se) { if (isHATest && SQLHelper.gotTXNodeFailureException(se) ) { SQLHelper.printSQLException(se); Log.getLogWriter().info("got node failure exception during Tx with HA support, continue testing"); return false; //assume node failure exception causes the tx to rollback } SQLHelper.printSQLException(se); gfxdse = se; } List<Struct> gfxdList = ResultSetHelper.asList(gfxdRS, false); if (gfxdList == null) { if (isHATest) { Log.getLogWriter().info("Testing HA and did not get GFXD result set"); return true; //do not compare query results as gemfirexd does not get any } else throw new TestException("Did not get gfxd results and it is not HA test"); } addReadLockedKeys(gfxdList); addQueryToDerbyTx(whichQuery, queryCash, querySec, loanLimit, loanAmount, tid, gfxdList, gfxdse); //only the first thread to commit the tx in this round could verify results //this is handled in the SQLDistTxTest doDMLOp return true; } @SuppressWarnings("unchecked") protected void addReadLockedKeys(List<Struct> gfxdList) { int txId = (Integer) SQLDistRRTxTest.curTxId.get(); SharedMap readLockedKeysByRRTx = SQLTxRRReadBB.getBB().getSharedMap(); Log.getLogWriter().info("adding the RR read keys to the Map for " + "this txId: " + txId); for (int i=0; i<gfxdList.size(); i++) { int cid = (Integer) gfxdList.get(i).get("CID"); String key = getTableName()+"_"+cid; Log.getLogWriter().info("RR read key to be added is " + key); ((HashMap<String, Integer>) SQLDistRRTxTest.curTxRRReadKeys.get()).put(key, txId); ReadLockedKey readKey = (ReadLockedKey) readLockedKeysByRRTx.get(key); if (readKey == null) readKey = new ReadLockedKey(key); readKey.addKeyByCurTx(txId); readLockedKeysByRRTx.put(key, readKey); } } protected boolean queryGfxdOnly(Connection gConn){ try { return super.queryGfxdOnly(gConn); } catch (TestException te) { if (te.getMessage().contains("X0Z02") && !reproduce49935) { Log.getLogWriter().info("hit #49935, continuing test"); return false; } else throw te; } } }
UTF-8
Java
4,973
java
TradeNetworthDMLDistTxRRStmt.java
Java
[ { "context": "er) gfxdList.get(i).get(\"CID\");\n String key = getTableName()+\"_\"+cid;\n Log.getLogWriter().info(\"RR read key to be", "end": 4240, "score": 0.9734138250350952, "start": 4218, "tag": "KEY", "value": "getTableName()+\"_\"+cid" } ]
null
[]
/* * Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you * may not use this file except in compliance with the License. You * may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. See accompanying * LICENSE file. */ package sql.dmlDistTxRRStatements; import hydra.Log; import hydra.blackboard.SharedMap; import java.math.BigDecimal; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashMap; import java.util.List; import com.gemstone.gemfire.cache.query.Struct; import sql.SQLHelper; import sql.dmlDistTxStatements.TradeNetworthDMLDistTxStmt; import sql.sqlTx.ReadLockedKey; import sql.sqlTx.SQLDistRRTxTest; import sql.sqlTx.SQLTxRRReadBB; import sql.sqlutil.ResultSetHelper; import util.TestException; public class TradeNetworthDMLDistTxRRStmt extends TradeNetworthDMLDistTxStmt { protected boolean verifyConflict(HashMap<String, Integer> modifiedKeysByOp, HashMap<String, Integer>modifiedKeysByThisTx, SQLException gfxdse, boolean getConflict) { return verifyConflictForRR(modifiedKeysByOp, modifiedKeysByThisTx, gfxdse, getConflict); } public boolean queryGfxd(Connection gConn, boolean withDerby){ if (!withDerby) { return queryGfxdOnly(gConn); } int whichQuery = rand.nextInt(select.length-numOfNonUniq); //only uses with tid condition int cash = 100000; int sec = 100000; int tid = testUniqueKeys ? getMyTid() : getRandomTid(); int loanLimit = loanLimits[rand.nextInt(loanLimits.length)]; BigDecimal loanAmount = new BigDecimal (Integer.toString(rand.nextInt(loanLimit))); BigDecimal queryCash = new BigDecimal (Integer.toString(rand.nextInt(cash))); BigDecimal querySec= new BigDecimal (Integer.toString(rand.nextInt(sec))); ResultSet gfxdRS = null; SQLException gfxdse = null; try { gfxdRS = query (gConn, whichQuery, queryCash, querySec, loanLimit, loanAmount, tid); if (gfxdRS == null) { if (isHATest) { Log.getLogWriter().info("Testing HA and did not get GFXD result set"); return true; } else throw new TestException("Not able to get gfxd result set"); } } catch (SQLException se) { if (isHATest && SQLHelper.gotTXNodeFailureException(se) ) { SQLHelper.printSQLException(se); Log.getLogWriter().info("got node failure exception during Tx with HA support, continue testing"); return false; //assume node failure exception causes the tx to rollback } SQLHelper.printSQLException(se); gfxdse = se; } List<Struct> gfxdList = ResultSetHelper.asList(gfxdRS, false); if (gfxdList == null) { if (isHATest) { Log.getLogWriter().info("Testing HA and did not get GFXD result set"); return true; //do not compare query results as gemfirexd does not get any } else throw new TestException("Did not get gfxd results and it is not HA test"); } addReadLockedKeys(gfxdList); addQueryToDerbyTx(whichQuery, queryCash, querySec, loanLimit, loanAmount, tid, gfxdList, gfxdse); //only the first thread to commit the tx in this round could verify results //this is handled in the SQLDistTxTest doDMLOp return true; } @SuppressWarnings("unchecked") protected void addReadLockedKeys(List<Struct> gfxdList) { int txId = (Integer) SQLDistRRTxTest.curTxId.get(); SharedMap readLockedKeysByRRTx = SQLTxRRReadBB.getBB().getSharedMap(); Log.getLogWriter().info("adding the RR read keys to the Map for " + "this txId: " + txId); for (int i=0; i<gfxdList.size(); i++) { int cid = (Integer) gfxdList.get(i).get("CID"); String key = getTableName()+"_"+cid; Log.getLogWriter().info("RR read key to be added is " + key); ((HashMap<String, Integer>) SQLDistRRTxTest.curTxRRReadKeys.get()).put(key, txId); ReadLockedKey readKey = (ReadLockedKey) readLockedKeysByRRTx.get(key); if (readKey == null) readKey = new ReadLockedKey(key); readKey.addKeyByCurTx(txId); readLockedKeysByRRTx.put(key, readKey); } } protected boolean queryGfxdOnly(Connection gConn){ try { return super.queryGfxdOnly(gConn); } catch (TestException te) { if (te.getMessage().contains("X0Z02") && !reproduce49935) { Log.getLogWriter().info("hit #49935, continuing test"); return false; } else throw te; } } }
4,973
0.692741
0.6851
136
35.566177
28.703531
106
false
false
0
0
0
0
0
0
0.705882
false
false
7
9ba48031c92b987cc713d25126253fd2c1bd722a
11,802,570,137,871
c94fc59fdc76b07dee82bca61c7a9ea6a53d6835
/Spring_Boot_MVC_Example/src/main/java/com/rep/TrainersRep.java
335707b8841b28c4b08aa22ba814d4f876a86c7a
[]
no_license
sofia6998/pika_web
https://github.com/sofia6998/pika_web
02777fe595ba29b63eceed1063d4ee5ade4c7301
d7dbc016ebc6681f16c6eb824d05b18941e03b19
refs/heads/master
2020-03-16T20:07:51.009000
2018-05-10T19:59:31
2018-05-10T19:59:31
132,947,641
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rep; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.entity.Trainers; import java.util.List; @Repository public interface TrainersRep extends JpaRepository<Trainers, Integer> { Trainers findByName(String name); List<Trainers> findByOrderByExpDesc(); Trainers findByNameAndPass(String name, String pass); }
UTF-8
Java
426
java
TrainersRep.java
Java
[]
null
[]
package com.rep; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.entity.Trainers; import java.util.List; @Repository public interface TrainersRep extends JpaRepository<Trainers, Integer> { Trainers findByName(String name); List<Trainers> findByOrderByExpDesc(); Trainers findByNameAndPass(String name, String pass); }
426
0.769953
0.769953
17
23.17647
24.258984
71
false
false
0
0
0
0
0
0
0.588235
false
false
7
9e1490da7e2186988294b0f4679000a89e635895
26,697,516,743,803
aae30ba376d45cbaaa1fde6f1f2d5e19a0e5a8a4
/src/doc/Ex26.java
aa48c522e842a8232906a57efcb370967da9ea4f
[]
no_license
annakopaczewska/exercises
https://github.com/annakopaczewska/exercises
7604c838806db4adaff55457d3b9c21ce3865e74
bd33751e7762a37787064654670caa42cd26d69f
refs/heads/master
2023-01-01T03:49:56.864000
2020-10-14T16:45:52
2020-10-14T16:45:52
254,902,549
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package doc; public class Ex26 { public static void main(String[] args) { boolean n = containsWord("acp", "Kacper"); // "cpe" ma długość 3 liter, czyli index= 3 jest ostatnim indeksem który warto sprawdzić System.out.println(n); } public static boolean containsWord(String piceWord, String word) { boolean result = false; int iterations = word.length() - piceWord.length(); for (int i = 0; i < iterations - 1; i++) { if (word.charAt(i) == piceWord.charAt(0)) { for (int j = 0; j < piceWord.length(); j++) { // zaczynamy od drugiej litery w "cpe" aż do końca // tutaj sprawdzenia kolejnych liter itd result = true; break; } } } return result; } }
UTF-8
Java
856
java
Ex26.java
Java
[ { "context": "args) {\n\n boolean n = containsWord(\"acp\", \"Kacper\");\n\n // \"cpe\" ma długość 3 liter, czyli in", "end": 127, "score": 0.9965432286262512, "start": 121, "tag": "NAME", "value": "Kacper" } ]
null
[]
package doc; public class Ex26 { public static void main(String[] args) { boolean n = containsWord("acp", "Kacper"); // "cpe" ma długość 3 liter, czyli index= 3 jest ostatnim indeksem który warto sprawdzić System.out.println(n); } public static boolean containsWord(String piceWord, String word) { boolean result = false; int iterations = word.length() - piceWord.length(); for (int i = 0; i < iterations - 1; i++) { if (word.charAt(i) == piceWord.charAt(0)) { for (int j = 0; j < piceWord.length(); j++) { // zaczynamy od drugiej litery w "cpe" aż do końca // tutaj sprawdzenia kolejnych liter itd result = true; break; } } } return result; } }
856
0.528857
0.519435
30
27.333334
29.754925
112
false
false
0
0
0
0
0
0
0.5
false
false
7
6efb5d3787b9bdcbd2b2897af1ab46318739b463
22,368,189,685,999
815912e40615557fcf9f1b4bca5cfa981a82c503
/src/Algoritms/TextEditor/EditingDistance.java
b96a99878b37252d0a1bd8d67fc648ed538a4905
[]
no_license
avdeev1/DataStructuresAndAlgorithms
https://github.com/avdeev1/DataStructuresAndAlgorithms
9796ba659db0002158bcc46d2ab3ebbf6b59cf6f
bac2b50ff9d9bd4bfe0e0d791dbbdeadf808968c
refs/heads/master
2020-07-26T09:02:10.714000
2019-09-15T13:37:26
2019-09-15T13:37:26
208,595,714
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Levenshtein distance * https://en.wikipedia.org/wiki/Levenshtein_distance */ package Algoritms.TextEditor; public class EditingDistance { public static void main(String[] args) { new EditingDistance().run(); } private void run() { String a = "editing"; String b = "distance"; int res = EditDist(a, b); System.out.println(res); } private int EditDist(String a, String b) { int n = a.length() + 1; int m = b.length() + 1; int[][] distance = new int[n][m]; for (int i = 0; i < n; i++) distance[i][0] = i; for (int j = 0; j < m; j++) distance[0][j] = j; for (int i = 1; i < n; i++) { for (int j = 1; j < m; j++) { int c = diff(a.charAt(i - 1), b.charAt(j - 1)); distance[i][j] = Min(distance[i-1][j] + 1, distance[i][j-1] + 1, distance[i-1][j-1] + c); } } return distance[n-1][m-1]; } private int Min(int i, int i1, int i2) { return Math.min(i, Math.min(i1, i2)); } private int diff(char c, char c1) { return (c == c1) ? 0 : 1; } }
UTF-8
Java
1,190
java
EditingDistance.java
Java
[]
null
[]
/** * Levenshtein distance * https://en.wikipedia.org/wiki/Levenshtein_distance */ package Algoritms.TextEditor; public class EditingDistance { public static void main(String[] args) { new EditingDistance().run(); } private void run() { String a = "editing"; String b = "distance"; int res = EditDist(a, b); System.out.println(res); } private int EditDist(String a, String b) { int n = a.length() + 1; int m = b.length() + 1; int[][] distance = new int[n][m]; for (int i = 0; i < n; i++) distance[i][0] = i; for (int j = 0; j < m; j++) distance[0][j] = j; for (int i = 1; i < n; i++) { for (int j = 1; j < m; j++) { int c = diff(a.charAt(i - 1), b.charAt(j - 1)); distance[i][j] = Min(distance[i-1][j] + 1, distance[i][j-1] + 1, distance[i-1][j-1] + c); } } return distance[n-1][m-1]; } private int Min(int i, int i1, int i2) { return Math.min(i, Math.min(i1, i2)); } private int diff(char c, char c1) { return (c == c1) ? 0 : 1; } }
1,190
0.47479
0.452941
51
22.333334
21.49297
105
false
false
0
0
0
0
0
0
0.666667
false
false
7
fb4ca9a590324c6c8bc055a2e87db825911a3b4a
6,605,659,753,885
fb6eabbf4f27061974f8b82dc86761e786548273
/java/DownloadBatchManager-web/src/main/java/nl/amis/download/InfoJobListener.java
d46143ccaefe70452b1a6eac487152b3bc2bd9b2
[]
no_license
spring-open-source/projects
https://github.com/spring-open-source/projects
d014515695afca3c548ade228bacdd719f7aa26e
2558dd7211d3eaf94826d8fcd3e48f71f1c22a0b
refs/heads/master
2021-08-24T01:28:19.007000
2017-12-07T12:45:06
2017-12-07T12:45:06
105,523,534
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package nl.amis.download; import javax.batch.api.listener.JobListener; import javax.batch.api.listener.StepListener; import javax.batch.runtime.context.JobContext; import javax.batch.runtime.context.StepContext; import javax.enterprise.context.Dependent; import javax.inject.Inject; import javax.inject.Named; @Dependent @Named("InfoJobListener") public class InfoJobListener implements JobListener, StepListener { @Inject JobContext jobCtx; @Inject StepContext stepCtx; @Override public void beforeJob() throws Exception { System.out.println("Job starting "+jobCtx.getJobName()); } @Override public void afterJob() { System.out.println("Job Finished");} @Override public void beforeStep() throws Exception { System.out.println("Start STep "+stepCtx.getStepName()); } @Override public void afterStep() throws Exception { System.out.println("End step"); } }
UTF-8
Java
1,058
java
InfoJobListener.java
Java
[]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package nl.amis.download; import javax.batch.api.listener.JobListener; import javax.batch.api.listener.StepListener; import javax.batch.runtime.context.JobContext; import javax.batch.runtime.context.StepContext; import javax.enterprise.context.Dependent; import javax.inject.Inject; import javax.inject.Named; @Dependent @Named("InfoJobListener") public class InfoJobListener implements JobListener, StepListener { @Inject JobContext jobCtx; @Inject StepContext stepCtx; @Override public void beforeJob() throws Exception { System.out.println("Job starting "+jobCtx.getJobName()); } @Override public void afterJob() { System.out.println("Job Finished");} @Override public void beforeStep() throws Exception { System.out.println("Start STep "+stepCtx.getStepName()); } @Override public void afterStep() throws Exception { System.out.println("End step"); } }
1,058
0.71172
0.71172
43
23.627907
21.662338
67
false
false
0
0
0
0
0
0
0.395349
false
false
7
b3e79a13b81593fedb2c150574c22b4695218712
7,327,214,257,005
5d729c0365aa471217cc289aa241eb7056da730f
/src/main/java/com/org/sysetem/service/RolesService.java
f4d1fef61737e59ad40cf571d22388bc84940815
[]
no_license
jianghouwei/overseasfees
https://github.com/jianghouwei/overseasfees
5677f6ed21c864000e752deefa23f8808a95d14f
4a2989c79637ac0756a6e91474c724dc424d1925
refs/heads/master
2020-04-18T05:11:59.989000
2016-09-02T10:18:29
2016-09-02T10:18:29
67,212,664
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.org.sysetem.service; import java.util.List; import java.util.Set; import com.org.system.model.Role; import com.org.system.model.UserRole; public interface RolesService { /** * * TODO(依据用户id查询用户角色).<br/> * * @author mao.ru * @return * @since JDK 1.7 */ Set<String> getRolesByUserId(Long userId); /** * * 查询所有用户角色 * @author mao.ru * @return * @since JDK 1.7 */ List<Role> queryRoles(); int deleteByPrimaryKey(Long id); int insert(UserRole record); int insertSelective(UserRole record); UserRole selectByPrimaryKey(Long id); int updateByPrimaryKeySelective(UserRole record); int updateUserRoleByUserIdSelective(UserRole record); int updateByPrimaryKey(UserRole record); int deleteByRoleUserUserId(Long userId); int deleteRoleUserByRoleId(Long userId); List<Role> getRoleListPage(Role role); Long getRoleCountPage(Role role); int deleteRoleByPrimaryKey(Long id); int insertRole(Role record); int insertRoleSelective(Role record); Role selectRoleByPrimaryKey(Long id); int updateRoleByPrimaryKeySelective(Role record); int updateRoleByPrimaryKey(Role record); }
UTF-8
Java
1,239
java
RolesService.java
Java
[ { "context": "\n\t * \n\t * TODO(依据用户id查询用户角色).<br/>\n\t *\n\t * @author mao.ru\n\t * @return\n\t * @since JDK 1.7\n\t */\n\tSet<String> ", "end": 247, "score": 0.998829185962677, "start": 241, "tag": "USERNAME", "value": "mao.ru" }, { "context": "Long userId);\n\t\n\t/**\n\t * \n\t ...
null
[]
package com.org.sysetem.service; import java.util.List; import java.util.Set; import com.org.system.model.Role; import com.org.system.model.UserRole; public interface RolesService { /** * * TODO(依据用户id查询用户角色).<br/> * * @author mao.ru * @return * @since JDK 1.7 */ Set<String> getRolesByUserId(Long userId); /** * * 查询所有用户角色 * @author mao.ru * @return * @since JDK 1.7 */ List<Role> queryRoles(); int deleteByPrimaryKey(Long id); int insert(UserRole record); int insertSelective(UserRole record); UserRole selectByPrimaryKey(Long id); int updateByPrimaryKeySelective(UserRole record); int updateUserRoleByUserIdSelective(UserRole record); int updateByPrimaryKey(UserRole record); int deleteByRoleUserUserId(Long userId); int deleteRoleUserByRoleId(Long userId); List<Role> getRoleListPage(Role role); Long getRoleCountPage(Role role); int deleteRoleByPrimaryKey(Long id); int insertRole(Role record); int insertRoleSelective(Role record); Role selectRoleByPrimaryKey(Long id); int updateRoleByPrimaryKeySelective(Role record); int updateRoleByPrimaryKey(Role record); }
1,239
0.704073
0.700748
64
17.796875
18.102295
57
false
false
0
0
0
0
0
0
0.75
false
false
7
4f1f378a904eadea72aa7fd003fe26a7bffd9dd3
7,327,214,255,187
593b516ee19df37d8a1c917d9ecfb280da54b99a
/yuvraj.brock/Tutorial1/src/com/himline/mypractice/Printbandw.java
3cf4153f9c2260438a272349789d6a9c7a3a46a1
[]
no_license
himline/training
https://github.com/himline/training
2f51dfc1ed7d63ca7c2b0a6cd387895471fc1662
25746db133a494de68a08f6aca61a15b1ac254cd
refs/heads/master
2021-05-04T11:41:02.527000
2015-10-06T06:26:55
2015-10-06T06:26:55
43,299,877
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.himline.mypractice; public class Printbandw { public static void main(String[] args) { String[][] checker = new String[9][9]; for (int i = 1; i < 9; i++) { for (int j = 1; j < 9; j++) { if (i % 2 == 0) { if (j % 2 == 1) { checker[i][j] = "black"; } else { checker[i][j] = "white"; } } else { if (j % 2 == 1) { checker[i][j] = "white"; } else { checker[i][j] = "black"; } } } } String temp = ""; for (int i = 1; i < 9; i++) { for (int j = 1; j < 9; j++) { temp = temp + checker[i][j] + "-"; } System.out.println(temp); temp = ""; } } }
UTF-8
Java
653
java
Printbandw.java
Java
[]
null
[]
package com.himline.mypractice; public class Printbandw { public static void main(String[] args) { String[][] checker = new String[9][9]; for (int i = 1; i < 9; i++) { for (int j = 1; j < 9; j++) { if (i % 2 == 0) { if (j % 2 == 1) { checker[i][j] = "black"; } else { checker[i][j] = "white"; } } else { if (j % 2 == 1) { checker[i][j] = "white"; } else { checker[i][j] = "black"; } } } } String temp = ""; for (int i = 1; i < 9; i++) { for (int j = 1; j < 9; j++) { temp = temp + checker[i][j] + "-"; } System.out.println(temp); temp = ""; } } }
653
0.42879
0.404288
35
17.657143
13.443943
41
false
false
0
0
0
0
0
0
3.428571
false
false
7
b00ee1fd8bfe8b4ba3ebc73eb92177e845eb0cca
16,827,681,878,025
4a6e40c21d592158bc1f5d6cee4d8c8ae057e16b
/src/main/java/com/ms/email/controllers/EmailController.java
5132fde55712909d73883b01a49376db26ef8519
[]
no_license
isaiassantossilva/ms-email
https://github.com/isaiassantossilva/ms-email
42cf657d739488e6a18042b142e232802719bc5a
dd1e14dd8cd7f0ebbc8fdb97ca69bafa3fb816a9
refs/heads/main
2023-07-08T04:21:21.650000
2021-08-14T20:09:45
2021-08-14T20:09:45
396,117,604
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ms.email.controllers; import com.ms.email.dtos.EmailDto; import com.ms.email.models.EmailModel; import com.ms.email.services.EmailService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; @RestController public class EmailController { @Autowired EmailService emailService; @ResponseStatus(HttpStatus.CREATED) @PostMapping("/send-email") public EmailModel sendEmail(@RequestBody @Valid EmailDto emailDto){ var email = new EmailModel(); BeanUtils.copyProperties(emailDto, email); return emailService.sendEmail(email); } }
UTF-8
Java
964
java
EmailController.java
Java
[]
null
[]
package com.ms.email.controllers; import com.ms.email.dtos.EmailDto; import com.ms.email.models.EmailModel; import com.ms.email.services.EmailService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; @RestController public class EmailController { @Autowired EmailService emailService; @ResponseStatus(HttpStatus.CREATED) @PostMapping("/send-email") public EmailModel sendEmail(@RequestBody @Valid EmailDto emailDto){ var email = new EmailModel(); BeanUtils.copyProperties(emailDto, email); return emailService.sendEmail(email); } }
964
0.793568
0.793568
29
32.241379
22.021393
71
false
false
0
0
0
0
0
0
0.586207
false
false
7
94d1426a9d39a6afa82356179d223e8fadd64e9f
15,650,860,864,127
3d0d7e9207221c2805e36a3742caf69687d1e599
/src/main/java/com/br/smallmanager/apismallManager/entity/EnderecoEmpresa.java
6297e2edebc384f36840e6cf7402fa891f4a9263
[]
no_license
JonasVera/api_small_manager_spring
https://github.com/JonasVera/api_small_manager_spring
57e75d3e18d9114a067ff7ff9b082fa30569c6ff
6302003012972fed087b2e78ebbca6d87b196634
refs/heads/main
2023-06-03T02:05:51.980000
2021-06-25T16:00:43
2021-06-25T16:00:43
346,522,891
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.br.smallmanager.apismallManager.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.ToString; @Entity @Table(name = "endereco_empresa", schema = "api_smallmanager") @Data @Builder @EqualsAndHashCode @ToString @NoArgsConstructor @AllArgsConstructor public class EnderecoEmpresa { @Id @Column(name = "id") @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "cidade") private String cidade; @Column(name = "uf") private String uf; @Column(name = "logradouro") private String logradouro; @Column(name = "numero") private String numero; @Column(name = "bairro") private String bairro; @Column(name = "cep") private String cep; @ManyToOne @JoinColumn(name = "empresa_id") @JsonIgnore private Empresa empresa; }
UTF-8
Java
1,243
java
EnderecoEmpresa.java
Java
[]
null
[]
package com.br.smallmanager.apismallManager.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.ToString; @Entity @Table(name = "endereco_empresa", schema = "api_smallmanager") @Data @Builder @EqualsAndHashCode @ToString @NoArgsConstructor @AllArgsConstructor public class EnderecoEmpresa { @Id @Column(name = "id") @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "cidade") private String cidade; @Column(name = "uf") private String uf; @Column(name = "logradouro") private String logradouro; @Column(name = "numero") private String numero; @Column(name = "bairro") private String bairro; @Column(name = "cep") private String cep; @ManyToOne @JoinColumn(name = "empresa_id") @JsonIgnore private Empresa empresa; }
1,243
0.77313
0.77313
58
20.431034
15.230541
63
false
false
0
0
0
0
0
0
0.931035
false
false
7
f7f5c5af5fb0780fc78b80404720fc9503709ddb
17,214,228,977,508
4c7d974de7cdd9e11dd965bae8979773d5a0bd00
/src/main/java/com/huifu/restfulmock/dao/FxConversionDetailsDao.java
6dd2d435a932a99cd82b1c43108567e19303c63f
[]
no_license
raycai0821/restfulmock
https://github.com/raycai0821/restfulmock
d899af24360be15c3e9686683753b1f00a174cca
6dcbf3cd486dddfc89200d8bc1fea9fe9f13d741
refs/heads/master
2023-03-01T12:07:19.468000
2021-02-05T02:56:59
2021-02-05T02:56:59
286,431,225
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.huifu.restfulmock.dao; import com.huifu.restfulmock.entity.FxConversionEntity; import org.springframework.data.jpa.repository.JpaRepository; public interface FxConversionDetailsDao extends JpaRepository<FxConversionEntity, Integer> { }
UTF-8
Java
250
java
FxConversionDetailsDao.java
Java
[]
null
[]
package com.huifu.restfulmock.dao; import com.huifu.restfulmock.entity.FxConversionEntity; import org.springframework.data.jpa.repository.JpaRepository; public interface FxConversionDetailsDao extends JpaRepository<FxConversionEntity, Integer> { }
250
0.856
0.856
7
34.714287
33.660976
92
false
false
0
0
0
0
0
0
0.571429
false
false
7
d1f6f4488b70703c700053e6d8c1f956a25afc8e
30,863,635,009,418
c4f3a391fe6f06b862ddbcd163350fc658f68372
/src/main/java/com/hydra/invoke/InvokeStrategy.java
4c70718bd8998793099aff3a45879e00da96e532
[]
no_license
NormanDai/Hydra-bate
https://github.com/NormanDai/Hydra-bate
94f36e8958b72f46b253b8184338de3e87cdc16b
7d43abdaffea42197c2786fa5fc877205e8fb108
refs/heads/master
2021-01-19T23:21:26.900000
2017-08-24T07:03:49
2017-08-24T07:03:49
101,264,194
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hydra.invoke; import com.hydra.annotation.wrapper.DistributedWrapper; public interface InvokeStrategy { public void invoke(String taskName); }
UTF-8
Java
164
java
InvokeStrategy.java
Java
[]
null
[]
package com.hydra.invoke; import com.hydra.annotation.wrapper.DistributedWrapper; public interface InvokeStrategy { public void invoke(String taskName); }
164
0.786585
0.786585
10
15.4
19.920843
55
false
false
0
0
0
0
0
0
0.3
false
false
7
3671cbb9d20375d44b7ad9e5d222655c44324536
18,511,309,114,737
b9c0901d36ba7bc4bfa4f0902b0809115213a1c4
/src/main/java/org/tickler/model/factories/TickleFactory.java
cc5c85a00b8cda6b125d491b732c17c3bd630ee9
[ "Apache-2.0" ]
permissive
jbog/Tickler
https://github.com/jbog/Tickler
177a7da16190d68428afeea79b9c949437f12573
64c316bb7b2c0255b8d29ea4ac0ec9560b49b8e3
refs/heads/master
2020-04-02T21:25:45.350000
2018-10-26T08:04:35
2018-10-26T08:04:35
154,798,876
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.tickler.model.factories; import org.tickler.exceptions.ProductionException; import org.tickler.model.Tickle; import org.tickler.model.context.Comment; import javax.persistence.Entity; import java.util.ArrayList; import java.util.Collection; /** * Created by jasper on 12/10/18. */ @Entity public abstract class TickleFactory { private Long identifier; /** * The comments associated with the tickles associated with the factory. These must be added automatically upon producing the Tickle. */ private Collection<? extends Comment> comments; public TickleFactory() { this.setComments(new ArrayList<Comment>()); } public Collection<? extends Comment> getComments() { return comments; } protected void setComments(Collection<? extends Comment> comments) { this.comments = comments; } public Long getIdentifier() { return identifier; } protected void setIdentifier(Long identifier) { this.identifier = identifier; } /** * Produces the Tickle instance according to the state of the factory. * @return A Tickle instance. * @throws ProductionException Whenever generating the Tickle instance fails */ public abstract Tickle produce() throws ProductionException; }
UTF-8
Java
1,309
java
TickleFactory.java
Java
[ { "context": "t;\nimport java.util.Collection;\n\n/**\n * Created by jasper on 12/10/18.\n */\n@Entity\npublic abstract class Ti", "end": 280, "score": 0.9950061440467834, "start": 274, "tag": "USERNAME", "value": "jasper" } ]
null
[]
package org.tickler.model.factories; import org.tickler.exceptions.ProductionException; import org.tickler.model.Tickle; import org.tickler.model.context.Comment; import javax.persistence.Entity; import java.util.ArrayList; import java.util.Collection; /** * Created by jasper on 12/10/18. */ @Entity public abstract class TickleFactory { private Long identifier; /** * The comments associated with the tickles associated with the factory. These must be added automatically upon producing the Tickle. */ private Collection<? extends Comment> comments; public TickleFactory() { this.setComments(new ArrayList<Comment>()); } public Collection<? extends Comment> getComments() { return comments; } protected void setComments(Collection<? extends Comment> comments) { this.comments = comments; } public Long getIdentifier() { return identifier; } protected void setIdentifier(Long identifier) { this.identifier = identifier; } /** * Produces the Tickle instance according to the state of the factory. * @return A Tickle instance. * @throws ProductionException Whenever generating the Tickle instance fails */ public abstract Tickle produce() throws ProductionException; }
1,309
0.706646
0.702063
48
26.270834
27.79294
137
false
false
0
0
0
0
0
0
0.3125
false
false
7
1d2cb25c790f4a4d2b8a1182264b6fd1faf740e9
3,899,830,355,788
2d98a8b973655fc91b7fd579037df8157a0b209e
/src/main/java/com/vs/utils/Result.java
3f1de789e0d483f708e6faeb63e5badb297aa872
[]
no_license
SocketNet/web_iot
https://github.com/SocketNet/web_iot
844d761b44f98c400279874af859d56618e5d755
8a90ba827e985c2e932a64a5f237a4e34c2fe663
refs/heads/master
2020-03-06T00:37:35.611000
2017-04-04T04:20:58
2017-04-04T04:20:58
86,458,969
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.vs.utils; import lombok.Getter; import lombok.Setter; import lombok.ToString; /** * Created by tanxw on 2017/4/2. * Http返回最外层对象 * 统一异常处理 */ @Getter @Setter @ToString public class Result<T> { /** 状态码. */ private Integer code; /** 结果信息 */ private String msg; /** 返回值 */ private T data; /** 数据总条数 */ private Integer cont; }
UTF-8
Java
428
java
Result.java
Java
[ { "context": "Setter;\nimport lombok.ToString;\n\n/**\n * Created by tanxw on 2017/4/2.\n * Http返回最外层对象\n * 统一异常处理\n */\n\n@Gette", "end": 115, "score": 0.9995830059051514, "start": 110, "tag": "USERNAME", "value": "tanxw" } ]
null
[]
package com.vs.utils; import lombok.Getter; import lombok.Setter; import lombok.ToString; /** * Created by tanxw on 2017/4/2. * Http返回最外层对象 * 统一异常处理 */ @Getter @Setter @ToString public class Result<T> { /** 状态码. */ private Integer code; /** 结果信息 */ private String msg; /** 返回值 */ private T data; /** 数据总条数 */ private Integer cont; }
428
0.615591
0.599462
25
13.88
9.27931
32
false
false
0
0
0
0
0
0
0.32
false
false
7
93fdfdc9a6703884606facc404dc9cb477a014b5
12,524,124,653,695
7f8c8e3ec8970a447fe40508345df50373088c4d
/src/main/java/tech/burkinabe/todo/domain/EmployeeActivity.java
7d6dc5e259fc0e1f7c46d7364b9d6c1c2f3396af
[]
no_license
burkinabe-tech/todo
https://github.com/burkinabe-tech/todo
4b524c1d200db0917280634a16a45abc5cbdd960
6ff4c9366a7b623d00dd0353bdd1e5bd0989f652
refs/heads/master
2023-07-04T02:09:06.467000
2021-08-10T22:22:56
2021-08-10T22:22:56
393,093,789
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tech.burkinabe.todo.domain; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import javax.persistence.*; import java.time.ZonedDateTime; @Getter @Setter @NoArgsConstructor @AllArgsConstructor @Entity @Table public class EmployeeActivity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "created_at") private ZonedDateTime createdAt; @Column(name = "modified_at") private ZonedDateTime modifiedAt; @Column(name = "begun_at") private ZonedDateTime begunAt; @Column(name = "end_at") private ZonedDateTime endAt; }
UTF-8
Java
675
java
EmployeeActivity.java
Java
[]
null
[]
package tech.burkinabe.todo.domain; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import javax.persistence.*; import java.time.ZonedDateTime; @Getter @Setter @NoArgsConstructor @AllArgsConstructor @Entity @Table public class EmployeeActivity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "created_at") private ZonedDateTime createdAt; @Column(name = "modified_at") private ZonedDateTime modifiedAt; @Column(name = "begun_at") private ZonedDateTime begunAt; @Column(name = "end_at") private ZonedDateTime endAt; }
675
0.740741
0.740741
35
18.285715
15.262599
55
false
false
0
0
0
0
0
0
0.342857
false
false
7
a7864ecdc1f6b7d52c23ac2cd52547a009c50520
3,547,643,008,372
b514c9ca9f7cd1d69e6bb6076f66c50d5aef4745
/src/Inspectable.java
35c70c074f4812a34e5fd940f8e36b05c8e8f0c4
[]
no_license
FantasticMrSocks/comp730-proj
https://github.com/FantasticMrSocks/comp730-proj
ef88f860e1d5156723e4f94518f13506ccb630d6
6a3c5cb2487a18a7f0cd105bdc582777f7d47b09
refs/heads/master
2021-08-28T17:15:40.409000
2017-12-05T23:44:48
2017-12-05T23:44:48
105,463,314
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Inspectable { public boolean visible; public String name; public String description; public Inspectable(String n, String d) { visible = true; name = n; description =d; } public void setVisible (boolean v) { visible = v; } public String getName() { return name; } public String inspect() { String d = name + ": " + description; return d; } }
UTF-8
Java
387
java
Inspectable.java
Java
[]
null
[]
public class Inspectable { public boolean visible; public String name; public String description; public Inspectable(String n, String d) { visible = true; name = n; description =d; } public void setVisible (boolean v) { visible = v; } public String getName() { return name; } public String inspect() { String d = name + ": " + description; return d; } }
387
0.653747
0.653747
23
15.826087
13.080527
41
false
false
0
0
0
0
0
0
1.782609
false
false
7
a05cd1c3ac20dd0e09a88e65837bdc1d2592801e
10,273,561,793,052
74f281e9ab3a83f2d9bd0bb0e60b56933cbf6e3d
/Encryption/src/Encryption.java
a54eb5946fca03d5e4b7caf56c47a63b413e14d7
[]
no_license
Yusuf-hands-in-work/Yusuf-Projectss
https://github.com/Yusuf-hands-in-work/Yusuf-Projectss
ea1bd3c7f4ce80cc5c7edc7de628ff7f425bdf67
09986e210b4d9efaabadf7f554284cdcd0894ff6
refs/heads/master
2020-07-25T16:02:16.919000
2020-02-20T18:44:58
2020-02-20T18:44:58
208,348,020
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; public class Encryption { public static void main(String[] args) { Scanner scan = new Scanner(System. in); System.out.println("Please enter a word "); String word = scan.next(); System.out.println(" "); System.out.println("wwbk" + word.substring(0,3) + word + "fwjf" ); System.out.println(" "); System.out.println(word); } }
UTF-8
Java
418
java
Encryption.java
Java
[]
null
[]
import java.util.Scanner; public class Encryption { public static void main(String[] args) { Scanner scan = new Scanner(System. in); System.out.println("Please enter a word "); String word = scan.next(); System.out.println(" "); System.out.println("wwbk" + word.substring(0,3) + word + "fwjf" ); System.out.println(" "); System.out.println(word); } }
418
0.588517
0.583732
15
26.866667
21.546436
74
false
false
0
0
0
0
0
0
0.6
false
false
7
423f09352ac2ba1cb66dcc17db8a2d0e1e21f4b5
1,709,397,009,430
c2d6775130415a787827afd11462c31fa346a134
/src/main/java/it/greenvulcano/gvesb/adapter/redis/operations/BaseOperation.java
0254ea4456c35a8fd95b0ddc8ec18ff7109d61fb
[]
no_license
cs91chris/gv-adapter-redis
https://github.com/cs91chris/gv-adapter-redis
a3e3e0f3c23b2f043336f4bf097602ce9bd8a622
922626b8c37bae0b9fea2990f73f768396be6323
refs/heads/master
2022-11-15T15:03:29.785000
2020-07-04T15:14:14
2020-07-04T15:14:14
273,517,110
0
0
null
true
2020-06-19T14:44:16
2020-06-19T14:44:15
2019-10-24T10:10:02
2019-10-24T10:10:01
147
0
0
0
null
false
false
package it.greenvulcano.gvesb.adapter.redis.operations; import org.slf4j.Logger; import org.w3c.dom.Node; import it.greenvulcano.configuration.XMLConfig; import it.greenvulcano.configuration.XMLConfigException; import it.greenvulcano.gvesb.adapter.redis.RedisAPI; import it.greenvulcano.gvesb.buffer.GVBuffer; import it.greenvulcano.util.metadata.PropertiesHandler; import it.greenvulcano.util.metadata.PropertiesHandlerException; public abstract class BaseOperation { public static final String defaultSeparator = "\n"; protected static final Logger logger = org.slf4j.LoggerFactory.getLogger(BaseOperation.class); protected RedisAPI client = null; protected String endpoint = null; public void setClient(RedisAPI client) { this.client = client; } public void init(Node node) throws XMLConfigException { endpoint = XMLConfig.get(node, "@endpoint"); } public String perform(GVBuffer gvBuffer) throws PropertiesHandlerException { if (endpoint != null && endpoint != "") { client = new RedisAPI(PropertiesHandler.expand(endpoint, gvBuffer)); } return null; } public void cleanUp() { this.client.close(); } }
UTF-8
Java
1,145
java
BaseOperation.java
Java
[]
null
[]
package it.greenvulcano.gvesb.adapter.redis.operations; import org.slf4j.Logger; import org.w3c.dom.Node; import it.greenvulcano.configuration.XMLConfig; import it.greenvulcano.configuration.XMLConfigException; import it.greenvulcano.gvesb.adapter.redis.RedisAPI; import it.greenvulcano.gvesb.buffer.GVBuffer; import it.greenvulcano.util.metadata.PropertiesHandler; import it.greenvulcano.util.metadata.PropertiesHandlerException; public abstract class BaseOperation { public static final String defaultSeparator = "\n"; protected static final Logger logger = org.slf4j.LoggerFactory.getLogger(BaseOperation.class); protected RedisAPI client = null; protected String endpoint = null; public void setClient(RedisAPI client) { this.client = client; } public void init(Node node) throws XMLConfigException { endpoint = XMLConfig.get(node, "@endpoint"); } public String perform(GVBuffer gvBuffer) throws PropertiesHandlerException { if (endpoint != null && endpoint != "") { client = new RedisAPI(PropertiesHandler.expand(endpoint, gvBuffer)); } return null; } public void cleanUp() { this.client.close(); } }
1,145
0.778166
0.775546
37
29.918919
26.112417
95
false
false
0
0
0
0
0
0
1.378378
false
false
7
b4cb8fc456760227d0b4d7701c3b40d2aad42a2e
1,709,397,011,404
aff9bb2b6753ca756fe3923fa70b7ff7b65b8f9f
/services-trainning/src/test/java/com/barcelona/training/tdd/template/TemplateProcessorTest.java
e6efbeba2eb392d308970f8f6ed623c1092a0f06
[]
no_license
alepoletto/Dojos
https://github.com/alepoletto/Dojos
306b3b526eab0159ae49be5cd6e5086169e6e2ab
87217c7ed4a3c32f272fff0ece034f515a5e8271
refs/heads/master
2021-01-16T17:46:09.433000
2013-03-19T14:22:55
2013-03-19T14:22:55
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.barcelona.training.tdd.template; import junit.framework.Assert; import org.junit.Before; import org.junit.Test; import com.barcelona.training.tdd.template.TemplateProcessor; public class TemplateProcessorTest { private TemplateProcessor template; @Before public void init(){ template = new TemplateProcessor(); } @Test public void testSimpleMessage(){ String mensagen = template.apply("Ola $nome Bon DIa", "Xavi"); Assert.assertEquals("Ola Xavi Bon DIa", mensagen); } @Test public void testAnotherName(){ String mensagen = template.apply("Ola $nome Bon DIa", "Toni"); Assert.assertEquals("Ola Toni Bon DIa", mensagen); } @Test public void testAnotherMessage(){ String mensagen = template.apply("Ola que tal! $nome Bouenos Dias", "Toni"); Assert.assertEquals("Ola que tal! Toni Bouenos Dias", mensagen); } }
UTF-8
Java
863
java
TemplateProcessorTest.java
Java
[ { "context": "g mensagen = template.apply(\"Ola $nome Bon DIa\", \"Xavi\");\n\t\tAssert.assertEquals(\"Ola Xavi Bon DIa\", mens", "end": 443, "score": 0.9996436834335327, "start": 439, "tag": "NAME", "value": "Xavi" }, { "context": "nome Bon DIa\", \"Xavi\");\n\t\tAssert.assertEquals...
null
[]
package com.barcelona.training.tdd.template; import junit.framework.Assert; import org.junit.Before; import org.junit.Test; import com.barcelona.training.tdd.template.TemplateProcessor; public class TemplateProcessorTest { private TemplateProcessor template; @Before public void init(){ template = new TemplateProcessor(); } @Test public void testSimpleMessage(){ String mensagen = template.apply("Ola $nome Bon DIa", "Xavi"); Assert.assertEquals("Ola <NAME>", mensagen); } @Test public void testAnotherName(){ String mensagen = template.apply("Ola $nome Bon DIa", "Toni"); Assert.assertEquals("Ola <NAME>", mensagen); } @Test public void testAnotherMessage(){ String mensagen = template.apply("Ola que tal! $nome B<NAME>", "Toni"); Assert.assertEquals("Ola que tal! <NAME>", mensagen); } }
835
0.73117
0.73117
38
21.710526
23.790653
78
false
false
0
0
0
0
0
0
1.368421
false
false
7
1ba734e33d2480f1126e24eafa8ce4f0a734deb7
1,632,087,593,935
b51f328f9db58a021394db60e461bd7cacec5111
/Code/FavouritesFragment.java
47e28f917217b9e67217a65510a02e131fd55cab
[]
no_license
askarbekov007/androidios
https://github.com/askarbekov007/androidios
e035269a6498fed1c05f3692ae28ce4e31728836
eb54015edab30418d92f49f21e96a34ca28f8106
refs/heads/master
2022-05-25T06:04:06.307000
2020-04-29T17:10:26
2020-04-29T17:10:26
259,979,023
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.myvk4; import android.content.Intent; import android.os.Bundle; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import java.util.ArrayList; import java.util.List; /** * A simple {@link Fragment} subclass. */ public class FavouritesFragment extends Fragment { private RecyclerView recyclerView; FavouritesAdapter favouritesAdapter; private FavouritesAdapter.ItemClickListener listener=null; public static List<Post> items= new ArrayList<>(); public static final String authorImageSaver="A"; public static final String descSaver="B"; public static final String dateSaver="C"; public static final String authorNameSaver="D"; public static final String postImageSaver="E"; public static final String likeCountSaver="F"; public static final String commentCountSaver="G"; public static final String repostCountSaver="H"; public static final String viewCountSaver="I"; public FavouritesFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view =inflater.inflate(R.layout.fragment_favourites, container, false); listener = new FavouritesAdapter.ItemClickListener() { @Override public void itemClick(int position, Post item) { Intent intent = new Intent(getActivity(), DetailedPostActivity.class); intent.putExtra("post",item); intent.putExtra("clicked", favouritesAdapter.clicked); startActivity(intent); } }; recyclerView=view.findViewById(R.id.favRecView); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); favouritesAdapter =new FavouritesAdapter(postGenerator(),listener); recyclerView.setAdapter(favouritesAdapter); favouritesAdapter.notifyDataSetChanged(); return view; } private List<Post> postGenerator() { return Adapter.favList; } }
UTF-8
Java
2,357
java
FavouritesFragment.java
Java
[]
null
[]
package com.example.myvk4; import android.content.Intent; import android.os.Bundle; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import java.util.ArrayList; import java.util.List; /** * A simple {@link Fragment} subclass. */ public class FavouritesFragment extends Fragment { private RecyclerView recyclerView; FavouritesAdapter favouritesAdapter; private FavouritesAdapter.ItemClickListener listener=null; public static List<Post> items= new ArrayList<>(); public static final String authorImageSaver="A"; public static final String descSaver="B"; public static final String dateSaver="C"; public static final String authorNameSaver="D"; public static final String postImageSaver="E"; public static final String likeCountSaver="F"; public static final String commentCountSaver="G"; public static final String repostCountSaver="H"; public static final String viewCountSaver="I"; public FavouritesFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view =inflater.inflate(R.layout.fragment_favourites, container, false); listener = new FavouritesAdapter.ItemClickListener() { @Override public void itemClick(int position, Post item) { Intent intent = new Intent(getActivity(), DetailedPostActivity.class); intent.putExtra("post",item); intent.putExtra("clicked", favouritesAdapter.clicked); startActivity(intent); } }; recyclerView=view.findViewById(R.id.favRecView); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); favouritesAdapter =new FavouritesAdapter(postGenerator(),listener); recyclerView.setAdapter(favouritesAdapter); favouritesAdapter.notifyDataSetChanged(); return view; } private List<Post> postGenerator() { return Adapter.favList; } }
2,357
0.687314
0.68689
66
33.71212
24.632921
86
false
false
0
0
0
0
0
0
0.69697
false
false
7
27bd0291be3b0b7da29ba8f741f024f1d23c75da
13,460,427,512,847
872b969e28b4f67bc4e5259384c8e03b052a42fb
/src/com/Dibalo/zou/FindMaxString.java
014558a3029b03b525654c9c0ed83c4c923f5ab0
[]
no_license
diabloyong/javatest
https://github.com/diabloyong/javatest
10334f33584269a9dff6fb541727c548615dfa95
09ff83adc790cdd3e1306dc943cfdf037eb74ad7
refs/heads/master
2016-03-26T18:39:09.890000
2015-04-21T13:17:51
2015-04-21T13:17:51
34,299,716
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.Dibalo.zou; public class FindMaxString { private String query; private String text; private int Max=0; private int F[][]=new int[1000][1000]; public FindMaxString(String query, String text) { super(); this.query = query; this.text = text; for (int i=0;i<=1000;i++) for(int j=0;j<=1000;j++) F[i][j]=-1; init(); } public int find(int i,int j){ int x=0; if(i<0||j<0) x=0; if(F[i][j]!=-1) x=F[i][j]; if(this.query.charAt(i)==this.text.charAt(j)){ x=find(i-1,j-1)+1; F[i][j]=x; } return x; } public void init(){ int query_len=query.length(); int text_len=text.length(); for (int i=query_len-1;i>=0;i--) for(int j=text_len-1;j>=0;j--) if(this.Max>find(i,j)) this.Max=find(i,j); } public int getMax(){ return this.Max; } }
UTF-8
Java
841
java
FindMaxString.java
Java
[]
null
[]
package com.Dibalo.zou; public class FindMaxString { private String query; private String text; private int Max=0; private int F[][]=new int[1000][1000]; public FindMaxString(String query, String text) { super(); this.query = query; this.text = text; for (int i=0;i<=1000;i++) for(int j=0;j<=1000;j++) F[i][j]=-1; init(); } public int find(int i,int j){ int x=0; if(i<0||j<0) x=0; if(F[i][j]!=-1) x=F[i][j]; if(this.query.charAt(i)==this.text.charAt(j)){ x=find(i-1,j-1)+1; F[i][j]=x; } return x; } public void init(){ int query_len=query.length(); int text_len=text.length(); for (int i=query_len-1;i>=0;i--) for(int j=text_len-1;j>=0;j--) if(this.Max>find(i,j)) this.Max=find(i,j); } public int getMax(){ return this.Max; } }
841
0.560048
0.521998
40
19.025
12.775929
50
false
false
0
0
0
0
0
0
2.625
false
false
7
4bc4dc3e8c165fdd90928a9024a5455e1b179b52
10,874,857,228,951
09552ac5dfcb376cfec2af85adc2b1883a9e9444
/src/main/java/edu/pe/pucp/team_1/dp1/sigapucp/Controllers/Modales/ModalController.java
2419bcc9e4f5af93770e768ef3addb946d3c866a
[]
no_license
sigapucp/SIGAPUCP
https://github.com/sigapucp/SIGAPUCP
b01ffb3b363692ff63adb0a4b40f000f65f4a7b9
868da0146880271e6846e65f61f2ed69957f36ae
refs/heads/master
2021-08-14T07:10:31.482000
2017-11-14T23:18:29
2017-11-14T23:18:29
104,978,048
0
0
null
false
2017-11-14T23:18:30
2017-09-27T05:58:38
2017-09-27T06:35:52
2017-11-14T23:18:30
8,440
0
0
0
Java
false
null
/* * 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 edu.pe.pucp.team_1.dp1.sigapucp.Controllers.Modales; import edu.pe.pucp.team_1.dp1.sigapucp.Controllers.Controller; import edu.pe.pucp.team_1.dp1.sigapucp.CustomEvents.Event; import edu.pe.pucp.team_1.dp1.sigapucp.CustomEvents.IEvent; import edu.pe.pucp.team_1.dp1.sigapucp.Navegacion.abrirModalPromoArgs; import javafx.stage.Stage; /** * * @author herbert */ public class ModalController extends Controller { public IEvent<abrirModalPromoArgs> abrirModal; private Stage current_stage; public ModalController() { abrirModal = new Event<>(); } public void setCurrentStage(Stage stage) { current_stage = stage; } public Stage getCurrentStage() { return current_stage; } public Event getCloseModalEvent() { return null; } }
UTF-8
Java
1,007
java
ModalController.java
Java
[ { "context": "rgs;\nimport javafx.stage.Stage;\n\n/**\n *\n * @author herbert\n */\npublic class ModalController extends Controll", "end": 553, "score": 0.7198868989944458, "start": 546, "tag": "NAME", "value": "herbert" } ]
null
[]
/* * 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 edu.pe.pucp.team_1.dp1.sigapucp.Controllers.Modales; import edu.pe.pucp.team_1.dp1.sigapucp.Controllers.Controller; import edu.pe.pucp.team_1.dp1.sigapucp.CustomEvents.Event; import edu.pe.pucp.team_1.dp1.sigapucp.CustomEvents.IEvent; import edu.pe.pucp.team_1.dp1.sigapucp.Navegacion.abrirModalPromoArgs; import javafx.stage.Stage; /** * * @author herbert */ public class ModalController extends Controller { public IEvent<abrirModalPromoArgs> abrirModal; private Stage current_stage; public ModalController() { abrirModal = new Event<>(); } public void setCurrentStage(Stage stage) { current_stage = stage; } public Stage getCurrentStage() { return current_stage; } public Event getCloseModalEvent() { return null; } }
1,007
0.708044
0.698113
37
26.216217
23.868032
79
false
false
0
0
0
0
0
0
0.405405
false
false
7
62a14fd4b75871d516f01af2be160079d5191202
16,045,997,819,243
06f094c299c31fd622c1a90cb10c36095902be41
/src/main/java/com/string/TestGarbageCollection.java
cfb4fb34be323c01972cf0862ba39ecd5276f31b
[]
no_license
vikaskumarpaul/Data_Strructure_and_Algorithm
https://github.com/vikaskumarpaul/Data_Strructure_and_Algorithm
f5640f03184344aedc4f1106d41492f6c85c6750
d869e98e43d4e13b4219ef7c3dec6c891f1cb67a
refs/heads/master
2022-03-31T09:11:47.859000
2019-11-13T04:55:55
2019-11-13T04:55:55
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.string; public class TestGarbageCollection { String test; public TestGarbageCollection(String s1) { this.test = s1; } public static void main(String[] args) { TestGarbageCollection t1 = new TestGarbageCollection("Vikas"); TestGarbageCollection t2 = new TestGarbageCollection("Paul"); t1 = null; t2 = null; System.gc(); } @Override protected void finalize() throws Throwable { // TODO Auto-generated method stub System.out.println("GC object: "+ this.test); } }
UTF-8
Java
514
java
TestGarbageCollection.java
Java
[ { "context": "GarbageCollection t1 = new TestGarbageCollection(\"Vikas\");\n\t\tTestGarbageCollection t2 = new TestGarbageCo", "end": 245, "score": 0.9994966387748718, "start": 240, "tag": "NAME", "value": "Vikas" }, { "context": "GarbageCollection t2 = new TestGarbageCollection(\"Pa...
null
[]
package com.string; public class TestGarbageCollection { String test; public TestGarbageCollection(String s1) { this.test = s1; } public static void main(String[] args) { TestGarbageCollection t1 = new TestGarbageCollection("Vikas"); TestGarbageCollection t2 = new TestGarbageCollection("Paul"); t1 = null; t2 = null; System.gc(); } @Override protected void finalize() throws Throwable { // TODO Auto-generated method stub System.out.println("GC object: "+ this.test); } }
514
0.698444
0.68677
29
16.724138
19.523455
64
false
false
0
0
0
0
0
0
1.517241
false
false
7
6c1930e28f4b014147b36e3d717d586e9daac059
33,414,845,584,128
e7b467bcf72ae89a7aa824e936e117e279df238a
/price-service/src/main/java/com/ironhack/priceservice/controller/interfaces/PriceController.java
085d56e34a8b0f8a72c7cd03788a3f3ee6a805e4
[]
no_license
luisbadolato/Lab603
https://github.com/luisbadolato/Lab603
6ed4c21c6ff78a3ba2311df6526a7dac08ad9548
8a6781f9bb68a50a2b539ada8958fcbaeacf6380
refs/heads/master
2023-08-06T15:55:09.794000
2021-10-12T13:24:20
2021-10-12T13:24:20
416,346,967
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ironhack.priceservice.controller.interfaces; import com.ironhack.priceservice.controller.dto.PriceDTO; public interface PriceController { PriceDTO getBySerialNumber(Long serial); }
UTF-8
Java
201
java
PriceController.java
Java
[]
null
[]
package com.ironhack.priceservice.controller.interfaces; import com.ironhack.priceservice.controller.dto.PriceDTO; public interface PriceController { PriceDTO getBySerialNumber(Long serial); }
201
0.820895
0.820895
9
21.333334
24.454039
57
false
false
0
0
0
0
0
0
0.333333
false
false
7
a0763f9ca1c12d0ea49ab645b02fc61400d16f51
16,114,717,317,266
74df0a48870317cb7a7514daa9549f7ec8804758
/CLONCLAS/src/Antibody.java
ff5139ae5e2c3fd86444c9ec3731c276a7591540
[]
no_license
malvee/3rdYearProject
https://github.com/malvee/3rdYearProject
df45c81af9a14bc52ced3864e613b07854f9e037
50f63699401b05cc25f0319b3f5e16e7cafb4bc5
refs/heads/master
2021-01-21T09:11:04.519000
2016-04-16T14:50:49
2016-04-16T14:50:49
48,438,256
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Random; public class Antibody implements Cloneable { final double D[]; final int size; final int range; public double random(double M, double S) { Random r = new Random(); return r.nextGaussian() * S + M; } public Antibody(int size, int range) { this.D = new double[size]; this.size = size; this.range = range; for (int i = 0; i < size; i++) D[i] = Math.random() * range; } public void mutate(double p) { for (int i = 0; i < size; i++) { double x = random(D[i], (p * D[i] + 0.1) / 2.0); if (x <= 0.0) { // System.out.println(D[i] + " " + x + "happened" + p); x = 0.1; } D[i] = x; } } public Antibody clone() { Antibody rst = new Antibody(size, range); for (int i = 0; i < size; i++) rst.D[i] = D[i]; return rst; } public String toString() { String temp = ""; for (int i = 0; i < size; i++) { temp += D[i] + " "; } return temp; } }
UTF-8
Java
928
java
Antibody.java
Java
[]
null
[]
import java.util.Random; public class Antibody implements Cloneable { final double D[]; final int size; final int range; public double random(double M, double S) { Random r = new Random(); return r.nextGaussian() * S + M; } public Antibody(int size, int range) { this.D = new double[size]; this.size = size; this.range = range; for (int i = 0; i < size; i++) D[i] = Math.random() * range; } public void mutate(double p) { for (int i = 0; i < size; i++) { double x = random(D[i], (p * D[i] + 0.1) / 2.0); if (x <= 0.0) { // System.out.println(D[i] + " " + x + "happened" + p); x = 0.1; } D[i] = x; } } public Antibody clone() { Antibody rst = new Antibody(size, range); for (int i = 0; i < size; i++) rst.D[i] = D[i]; return rst; } public String toString() { String temp = ""; for (int i = 0; i < size; i++) { temp += D[i] + " "; } return temp; } }
928
0.545259
0.532328
48
18.333334
15.781494
59
false
false
0
0
0
0
0
0
2.166667
false
false
7
8eb6f6ff70d731d318427cc760c76180944020da
300,647,738,376
8b54475faed9841fe3a3f6f02791a7179983c096
/app/src/main/java/com/ksfc/newfarmer/activitys/AddAddressActivity.java
5bab2440eec838550f4c3d7440b52dc4aef59600
[]
no_license
xxnr/android
https://github.com/xxnr/android
ffd9b80bc3b7961e354066367849dd51bd818673
43fdc6b6085661885cd8d23ccb43f8dfa4a051fc
refs/heads/master
2021-04-30T18:43:05.571000
2016-08-29T04:50:42
2016-08-29T04:50:42
48,672,054
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * */ package com.ksfc.newfarmer.activitys; import com.ksfc.newfarmer.BaseActivity; import com.ksfc.newfarmer.R; import com.ksfc.newfarmer.db.Store; import com.ksfc.newfarmer.protocol.ApiType; import com.ksfc.newfarmer.protocol.Request; import com.ksfc.newfarmer.protocol.RequestParams; import com.ksfc.newfarmer.beans.LoginResult.UserInfo; import com.ksfc.newfarmer.utils.BundleUtils; import com.ksfc.newfarmer.utils.IntentUtil; import com.ksfc.newfarmer.utils.StringUtil; import com.ksfc.newfarmer.widget.BaseViewUtils; import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.view.KeyEvent; import android.view.View; import android.widget.CheckBox; import android.widget.EditText; import android.widget.TextView; /** * 项目名称:QianXihe518 类名称:AddAddressActivity 类描述: 创建人:王蕾 创建时间:2015-5-26 上午11:19:21 * 修改备注: */ public class AddAddressActivity extends BaseActivity { private final int cityRequestCode = 1;//省市区 private final int townRequestCode = 2;//乡镇 private TextView choice_town_text; private TextView choice_city_text; private EditText room_edit, receipt_name, receipt_phone, zipCode_text;//详细地址 收货人 收货电话 邮编 private String cityareaid = "";//省 id private String queueid = "";//市 id private String buildid = "";//县 id private String townid = "";//乡镇 id private CheckBox default_address;//是否是默认地址 private int count = -1;//之前是否有地址 public static final String ARG_PARAM1 = "param1"; @Override public int getLayout() { return R.layout.activity_add_edit_address; } public static Intent getCallingIntent(Context context, int addressCount) { Intent callingIntent = new Intent(context, AddAddressActivity.class); callingIntent.putExtra(ARG_PARAM1, addressCount); return callingIntent; } @Override public void OnActCreate(Bundle savedInstanceState) { setTitle("新增收货地址"); initView(); count = getIntent().getIntExtra(ARG_PARAM1, -1); //如果新加地址是第一个 ,默认选中默认 if (count == 0) { UserInfo userInfo = Store.User.queryMe(); if (userInfo != null) { receipt_name.setText(userInfo.name); receipt_phone.setText(userInfo.phone); } default_address.setChecked(true); } else { default_address.setChecked(false); } } private void initView() { choice_city_text = (TextView) findViewById(R.id.choice_city_text);//选择省市县 choice_town_text = (TextView) findViewById(R.id.choice_town_text);//选择镇 room_edit = (EditText) findViewById(R.id.choice_detail_room_edit); zipCode_text = (EditText) findViewById(R.id.choice_zipCode_edit); // room_edit加一个完成按钮 room_edit.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { //关闭软键盘 BaseViewUtils.hideSoftInput(AddAddressActivity.this, room_edit); return (event.getKeyCode() == KeyEvent.KEYCODE_ENTER); } }); receipt_phone = (EditText) findViewById(R.id.shouhuo_tel); receipt_name = (EditText) findViewById(R.id.shouhuo_name); default_address = (CheckBox) findViewById(R.id.default_address); setViewClick(R.id.choice_city_layout); setViewClick(R.id.choice_town_layout); setViewClick(R.id.choice_compelet); setViewClick(R.id.choice_detail_room_edit); } @SuppressLint("NewApi") @Override public void OnViewClick(View v) { switch (v.getId()) { case R.id.choice_city_layout: IntentUtil.startActivityForResult(this, SelectAddressActivity.class, cityRequestCode, BundleUtils.Put("tag", 0)); break; case R.id.choice_town_layout: if (TextUtils.isEmpty(choice_city_text.getText().toString())) { showToast("请先选择省市县区地址"); } else { Bundle bundle = BundleUtils.Put("tag", 1, "queueid", queueid, "buildid", buildid); IntentUtil.startActivityForResult(this, SelectAddressActivity.class, townRequestCode, bundle); } break; case R.id.choice_compelet: if (StringUtil.empty(receipt_name.getEditableText().toString() .trim())) { showToast("请输入收货人姓名"); return; } if (StringUtil.empty(receipt_phone.getText().toString().trim())) { showToast("请输入手机号码"); return; } if (!isMobileNum(receipt_phone.getText().toString().trim())) { showToast("请输入正确的手机号码"); return; } if (StringUtil.empty(choice_city_text.getText().toString().trim())) { showToast("请选择城市"); return; } String room = room_edit.getEditableText().toString().trim(); if (StringUtil.empty(room)) { showToast("请输入您的详细地址"); return; } String zipCode = zipCode_text.getEditableText().toString().trim(); // userId:用户ID, // areaId:省份ID // address:手动填写的具体地址, // type:(1.默认地址2.非默认地址) // receiptPhone:收货人手机号 // receiptPeople:收货人名称 showProgressDialog(); RequestParams params = new RequestParams(); if (isLogin()) { params.put("userId", Store.User.queryMe().userid); } params.put("areaId", cityareaid); params.put("cityId", queueid); params.put("countyId", buildid); params.put("townId", townid); if (StringUtil.checkStr(zipCode)) { params.put("zipCode", zipCode); } params.put("address", room); if (default_address.isChecked()) { params.put("type", 1); } else { params.put("type", 2); } params.put("receiptPeople", receipt_name.getEditableText() .toString().trim()); params.put("receiptPhone", receipt_phone.getEditableText().toString() .trim()); execApi(ApiType.SAVE_ADDRESS, params); break; default: break; } } @Override protected void onActivityResult(int arg0, int arg1, Intent arg2) { // TODO Auto-generated method stub if (arg1 == RESULT_OK) { switch (arg0) { case cityRequestCode: Bundle bundle = arg2.getExtras(); if (bundle != null) { cityareaid = bundle.getString("cityareaid"); queueid = bundle.getString("queueid"); buildid = bundle.getString("buildid"); String city = bundle.getString("city");//省市县区 choice_city_text.setText(city); choice_town_text.setText(""); room_edit.setText(""); townid = ""; } break; case townRequestCode: townid = arg2.getExtras().getString("townid"); String town = arg2.getExtras().getString("town"); choice_town_text.setText(town); room_edit.setText(""); break; default: break; } } } @Override public void onResponsed(Request req) { disMissDialog(); if (req.getApi() == ApiType.SAVE_ADDRESS) { if ("1000".equals(req.getData().getStatus())) { showToast("成功新增了地址"); finish(); } } } }
UTF-8
Java
8,805
java
AddAddressActivity.java
Java
[ { "context": " 项目名称:QianXihe518 类名称:AddAddressActivity 类描述: 创建人:王蕾 创建时间:2015-5-26 上午11:19:21\n * 修改备注:\n */\npublic cla", "end": 901, "score": 0.9986296892166138, "start": 899, "tag": "NAME", "value": "王蕾" } ]
null
[]
/** * */ package com.ksfc.newfarmer.activitys; import com.ksfc.newfarmer.BaseActivity; import com.ksfc.newfarmer.R; import com.ksfc.newfarmer.db.Store; import com.ksfc.newfarmer.protocol.ApiType; import com.ksfc.newfarmer.protocol.Request; import com.ksfc.newfarmer.protocol.RequestParams; import com.ksfc.newfarmer.beans.LoginResult.UserInfo; import com.ksfc.newfarmer.utils.BundleUtils; import com.ksfc.newfarmer.utils.IntentUtil; import com.ksfc.newfarmer.utils.StringUtil; import com.ksfc.newfarmer.widget.BaseViewUtils; import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.view.KeyEvent; import android.view.View; import android.widget.CheckBox; import android.widget.EditText; import android.widget.TextView; /** * 项目名称:QianXihe518 类名称:AddAddressActivity 类描述: 创建人:王蕾 创建时间:2015-5-26 上午11:19:21 * 修改备注: */ public class AddAddressActivity extends BaseActivity { private final int cityRequestCode = 1;//省市区 private final int townRequestCode = 2;//乡镇 private TextView choice_town_text; private TextView choice_city_text; private EditText room_edit, receipt_name, receipt_phone, zipCode_text;//详细地址 收货人 收货电话 邮编 private String cityareaid = "";//省 id private String queueid = "";//市 id private String buildid = "";//县 id private String townid = "";//乡镇 id private CheckBox default_address;//是否是默认地址 private int count = -1;//之前是否有地址 public static final String ARG_PARAM1 = "param1"; @Override public int getLayout() { return R.layout.activity_add_edit_address; } public static Intent getCallingIntent(Context context, int addressCount) { Intent callingIntent = new Intent(context, AddAddressActivity.class); callingIntent.putExtra(ARG_PARAM1, addressCount); return callingIntent; } @Override public void OnActCreate(Bundle savedInstanceState) { setTitle("新增收货地址"); initView(); count = getIntent().getIntExtra(ARG_PARAM1, -1); //如果新加地址是第一个 ,默认选中默认 if (count == 0) { UserInfo userInfo = Store.User.queryMe(); if (userInfo != null) { receipt_name.setText(userInfo.name); receipt_phone.setText(userInfo.phone); } default_address.setChecked(true); } else { default_address.setChecked(false); } } private void initView() { choice_city_text = (TextView) findViewById(R.id.choice_city_text);//选择省市县 choice_town_text = (TextView) findViewById(R.id.choice_town_text);//选择镇 room_edit = (EditText) findViewById(R.id.choice_detail_room_edit); zipCode_text = (EditText) findViewById(R.id.choice_zipCode_edit); // room_edit加一个完成按钮 room_edit.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { //关闭软键盘 BaseViewUtils.hideSoftInput(AddAddressActivity.this, room_edit); return (event.getKeyCode() == KeyEvent.KEYCODE_ENTER); } }); receipt_phone = (EditText) findViewById(R.id.shouhuo_tel); receipt_name = (EditText) findViewById(R.id.shouhuo_name); default_address = (CheckBox) findViewById(R.id.default_address); setViewClick(R.id.choice_city_layout); setViewClick(R.id.choice_town_layout); setViewClick(R.id.choice_compelet); setViewClick(R.id.choice_detail_room_edit); } @SuppressLint("NewApi") @Override public void OnViewClick(View v) { switch (v.getId()) { case R.id.choice_city_layout: IntentUtil.startActivityForResult(this, SelectAddressActivity.class, cityRequestCode, BundleUtils.Put("tag", 0)); break; case R.id.choice_town_layout: if (TextUtils.isEmpty(choice_city_text.getText().toString())) { showToast("请先选择省市县区地址"); } else { Bundle bundle = BundleUtils.Put("tag", 1, "queueid", queueid, "buildid", buildid); IntentUtil.startActivityForResult(this, SelectAddressActivity.class, townRequestCode, bundle); } break; case R.id.choice_compelet: if (StringUtil.empty(receipt_name.getEditableText().toString() .trim())) { showToast("请输入收货人姓名"); return; } if (StringUtil.empty(receipt_phone.getText().toString().trim())) { showToast("请输入手机号码"); return; } if (!isMobileNum(receipt_phone.getText().toString().trim())) { showToast("请输入正确的手机号码"); return; } if (StringUtil.empty(choice_city_text.getText().toString().trim())) { showToast("请选择城市"); return; } String room = room_edit.getEditableText().toString().trim(); if (StringUtil.empty(room)) { showToast("请输入您的详细地址"); return; } String zipCode = zipCode_text.getEditableText().toString().trim(); // userId:用户ID, // areaId:省份ID // address:手动填写的具体地址, // type:(1.默认地址2.非默认地址) // receiptPhone:收货人手机号 // receiptPeople:收货人名称 showProgressDialog(); RequestParams params = new RequestParams(); if (isLogin()) { params.put("userId", Store.User.queryMe().userid); } params.put("areaId", cityareaid); params.put("cityId", queueid); params.put("countyId", buildid); params.put("townId", townid); if (StringUtil.checkStr(zipCode)) { params.put("zipCode", zipCode); } params.put("address", room); if (default_address.isChecked()) { params.put("type", 1); } else { params.put("type", 2); } params.put("receiptPeople", receipt_name.getEditableText() .toString().trim()); params.put("receiptPhone", receipt_phone.getEditableText().toString() .trim()); execApi(ApiType.SAVE_ADDRESS, params); break; default: break; } } @Override protected void onActivityResult(int arg0, int arg1, Intent arg2) { // TODO Auto-generated method stub if (arg1 == RESULT_OK) { switch (arg0) { case cityRequestCode: Bundle bundle = arg2.getExtras(); if (bundle != null) { cityareaid = bundle.getString("cityareaid"); queueid = bundle.getString("queueid"); buildid = bundle.getString("buildid"); String city = bundle.getString("city");//省市县区 choice_city_text.setText(city); choice_town_text.setText(""); room_edit.setText(""); townid = ""; } break; case townRequestCode: townid = arg2.getExtras().getString("townid"); String town = arg2.getExtras().getString("town"); choice_town_text.setText(town); room_edit.setText(""); break; default: break; } } } @Override public void onResponsed(Request req) { disMissDialog(); if (req.getApi() == ApiType.SAVE_ADDRESS) { if ("1000".equals(req.getData().getStatus())) { showToast("成功新增了地址"); finish(); } } } }
8,805
0.546787
0.541662
238
34.247898
24.631773
102
false
false
0
0
0
0
0
0
0.634454
false
false
7
a19c7c13b59902782996a4e9d5ca22c7c63e26c2
592,705,505,652
e4a47830c99c09d682b7548455463391c518fa96
/src/edu/ycp/cs320/PersonalizedCommencementProject/controller/AdvisorController.java
770f446a6db16b377a6787ab818e9408d1a65c0e
[]
no_license
jgross11/Personalized-Commencement-Project
https://github.com/jgross11/Personalized-Commencement-Project
7a7ca1de190152b41807d0133f18e9c203e2033e
2f9fae9018cf211be2314132cf2ca7d917918b4a
refs/heads/master
2020-04-27T02:19:20.714000
2019-05-17T03:22:53
2019-05-17T03:22:53
173,990,514
0
2
null
false
2019-05-17T03:22:54
2019-03-05T17:25:40
2019-04-29T22:10:52
2019-05-17T03:22:53
29,898
0
2
1
Java
false
false
package edu.ycp.cs320.PersonalizedCommencementProject.controller; import java.util.ArrayList; import java.util.List; import edu.ycp.cs320.PersonalizedCommencementProject.databaseModel.Admin; import edu.ycp.cs320.PersonalizedCommencementProject.databaseModel.Advisor; import edu.ycp.cs320.PersonalizedCommencementProject.databaseModel.Graduate; import edu.ycp.cs320.PersonalizedCommencementProject.databaseModel.User; import edu.ycp.cs320.PersonalizedCommencementProject.model.LoginModel; import edu.ycp.cs320.PersonalizedCommencementProject.persist.DatabaseProvider; import edu.ycp.cs320.PersonalizedCommencementProject.persist.DerbyDatabase; import edu.ycp.cs320.PersonalizedCommencementProject.persist.IDatabase; public class AdvisorController { private IDatabase db = null; private Advisor model; public AdvisorController() { // creates DB instance DatabaseProvider.setInstance(new DerbyDatabase()); db = DatabaseProvider.getInstance(); } public void setModel(Advisor model) { this.model = model; } public Advisor getModel() { return model; } public ArrayList<Graduate> getGraduateByUsername(String username) { // get the list of users - should only return one List<Graduate> graduateList = db.findGraduateByUsername(username); ArrayList<Graduate> graduates = null; if (graduateList.isEmpty()) { System.out.println("No graduates found"); return null; } else { graduates = new ArrayList<Graduate>(); for (Graduate graduate : graduates) { graduates.add(graduate); } } // return found graduate return graduates; } }
UTF-8
Java
1,600
java
AdvisorController.java
Java
[]
null
[]
package edu.ycp.cs320.PersonalizedCommencementProject.controller; import java.util.ArrayList; import java.util.List; import edu.ycp.cs320.PersonalizedCommencementProject.databaseModel.Admin; import edu.ycp.cs320.PersonalizedCommencementProject.databaseModel.Advisor; import edu.ycp.cs320.PersonalizedCommencementProject.databaseModel.Graduate; import edu.ycp.cs320.PersonalizedCommencementProject.databaseModel.User; import edu.ycp.cs320.PersonalizedCommencementProject.model.LoginModel; import edu.ycp.cs320.PersonalizedCommencementProject.persist.DatabaseProvider; import edu.ycp.cs320.PersonalizedCommencementProject.persist.DerbyDatabase; import edu.ycp.cs320.PersonalizedCommencementProject.persist.IDatabase; public class AdvisorController { private IDatabase db = null; private Advisor model; public AdvisorController() { // creates DB instance DatabaseProvider.setInstance(new DerbyDatabase()); db = DatabaseProvider.getInstance(); } public void setModel(Advisor model) { this.model = model; } public Advisor getModel() { return model; } public ArrayList<Graduate> getGraduateByUsername(String username) { // get the list of users - should only return one List<Graduate> graduateList = db.findGraduateByUsername(username); ArrayList<Graduate> graduates = null; if (graduateList.isEmpty()) { System.out.println("No graduates found"); return null; } else { graduates = new ArrayList<Graduate>(); for (Graduate graduate : graduates) { graduates.add(graduate); } } // return found graduate return graduates; } }
1,600
0.780625
0.76375
54
28.629629
26.356035
78
false
false
0
0
0
0
0
0
1.796296
false
false
7
0ec5e713ed99a98c813fe24ba1cc8c2675a24077
32,744,830,669,767
badaf3dd79d940f1ce871a09fb8edc5b6c4c98a5
/Workspace/AlgoCodes/src/hacker/rank/project/euler/PythagorianTriplets.java
b5fc9d1bdf0567c1c183aa810c34c205ea7df7d8
[]
no_license
Freeze777/mycodes
https://github.com/Freeze777/mycodes
cd56f2358e8708bd3aef1328a532c75e77b98d5d
be412b5394d9e2ebf92333db3e5c6da6f4456fb9
refs/heads/master
2022-09-08T23:09:27.350000
2022-09-03T03:09:56
2022-09-03T03:09:56
43,015,386
2
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package hacker.rank.project.euler; import java.util.Scanner; public class PythagorianTriplets { static int max = -1; public static void main(String[] args) { int a = 3, b = 4, c = 5; Scanner sc = new Scanner(System.in); int tst = sc.nextInt(); while (tst > 0) { int n = sc.nextInt(); if (n > 12) { if (n % 12 == 0) { max = (n / 12) * (n / 12) * (n / 12) * a * b * c; } generatePythagorianTriplets(a, b, c, n); System.out.println(max); } else if (n == 12) System.out.println(a * b * c); else System.out.println(-1); tst--; max=-1; } } /* * 1 -2 2 2 -1 2 2 -2 3 * * -1 2 2 -2 1 2 -2 2 3 * * 1 2 2 2 1 2 2 2 3 */ private static void generatePythagorianTriplets(int a, int b, int c, int n) { int a1 = a + (-2 * b) + (2 * c); int b1 = (2 * a) + (-1 * b) + (2 * c); int c1 = (2 * a) + (-2 * b) + (3 * c); int sum = (a1 + b1 + c1); if (sum < n) { if (n % sum == 0) { int prod = (n / sum) * (n / sum) * (n / sum) * a1 * b1 * c1; max = (max < prod) ? prod : max; } generatePythagorianTriplets(a1, b1, c1, n); } else if (sum == n) { int prod = a1 * b1 * c1; max = (max < prod) ? prod : max; } a1 = (-1 * a) + (2 * b) + (2 * c); b1 = (-2 * a) + (1 * b) + (2 * c); c1 = (-2 * a) + (2 * b) + (3 * c); sum = (a1 + b1 + c1); if (sum < n) { if (n % sum == 0) { int prod = (n / sum) * (n / sum) * (n / sum) * a1 * b1 * c1; max = (max < prod) ? prod : max; } generatePythagorianTriplets(a1, b1, c1, n); } else if (sum == n) { int prod = a1 * b1 * c1; max = (max < prod) ? prod : max; } a1 = a + (2 * b) + (2 * c); b1 = (2 * a) + (1 * b) + (2 * c); c1 = (2 * a) + (2 * b) + (3 * c); sum = (a1 + b1 + c1); if (sum < n) { if (n % sum == 0) { int prod = (n / sum) * (n / sum) * (n / sum) * a1 * b1 * c1; max = (max < prod) ? prod : max; } generatePythagorianTriplets(a1, b1, c1, n); } else if (sum == n) { int prod = a1 * b1 * c1; max = (max < prod) ? prod : max; } } }
UTF-8
Java
2,053
java
PythagorianTriplets.java
Java
[]
null
[]
package hacker.rank.project.euler; import java.util.Scanner; public class PythagorianTriplets { static int max = -1; public static void main(String[] args) { int a = 3, b = 4, c = 5; Scanner sc = new Scanner(System.in); int tst = sc.nextInt(); while (tst > 0) { int n = sc.nextInt(); if (n > 12) { if (n % 12 == 0) { max = (n / 12) * (n / 12) * (n / 12) * a * b * c; } generatePythagorianTriplets(a, b, c, n); System.out.println(max); } else if (n == 12) System.out.println(a * b * c); else System.out.println(-1); tst--; max=-1; } } /* * 1 -2 2 2 -1 2 2 -2 3 * * -1 2 2 -2 1 2 -2 2 3 * * 1 2 2 2 1 2 2 2 3 */ private static void generatePythagorianTriplets(int a, int b, int c, int n) { int a1 = a + (-2 * b) + (2 * c); int b1 = (2 * a) + (-1 * b) + (2 * c); int c1 = (2 * a) + (-2 * b) + (3 * c); int sum = (a1 + b1 + c1); if (sum < n) { if (n % sum == 0) { int prod = (n / sum) * (n / sum) * (n / sum) * a1 * b1 * c1; max = (max < prod) ? prod : max; } generatePythagorianTriplets(a1, b1, c1, n); } else if (sum == n) { int prod = a1 * b1 * c1; max = (max < prod) ? prod : max; } a1 = (-1 * a) + (2 * b) + (2 * c); b1 = (-2 * a) + (1 * b) + (2 * c); c1 = (-2 * a) + (2 * b) + (3 * c); sum = (a1 + b1 + c1); if (sum < n) { if (n % sum == 0) { int prod = (n / sum) * (n / sum) * (n / sum) * a1 * b1 * c1; max = (max < prod) ? prod : max; } generatePythagorianTriplets(a1, b1, c1, n); } else if (sum == n) { int prod = a1 * b1 * c1; max = (max < prod) ? prod : max; } a1 = a + (2 * b) + (2 * c); b1 = (2 * a) + (1 * b) + (2 * c); c1 = (2 * a) + (2 * b) + (3 * c); sum = (a1 + b1 + c1); if (sum < n) { if (n % sum == 0) { int prod = (n / sum) * (n / sum) * (n / sum) * a1 * b1 * c1; max = (max < prod) ? prod : max; } generatePythagorianTriplets(a1, b1, c1, n); } else if (sum == n) { int prod = a1 * b1 * c1; max = (max < prod) ? prod : max; } } }
2,053
0.443741
0.38529
90
21.811111
17.887236
78
false
false
0
0
0
0
0
0
2.644444
false
false
7
6ee3bf6602b0e13dc07eb765aa1a44470fc60e34
17,222,818,863,227
6bd492c81bcbde27547c6c7fe010e24caf50469c
/src/main/java/cn/shijinet/kunlun/payment/controller/service/RefundProformaTxnService.java
9fbd41f6c69cb5fa81e17b5f08ddb99a8a4b86de
[]
no_license
tiger107/scanpay
https://github.com/tiger107/scanpay
c089f1e68f5f72b4babbd2251a2106679516e40c
66b136b13716c9e82737f99ad0d6aa36d4818180
refs/heads/master
2019-09-29T11:25:43.430000
2017-08-04T03:58:38
2017-08-04T03:58:38
99,298,845
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Copyright (c) 2016 Beijing Shiji Kunlun Software Co., Ltd. All Rights Reserved. * RefundProformaTxnService.java 2016年1月25日 上午10:41:33 ZhaoQian */ package cn.shijinet.kunlun.payment.controller.service; import java.math.BigDecimal; import java.util.Date; import java.util.List; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.inject.Named; import org.apache.commons.lang3.StringUtils; import cn.shijinet.kunlun.payment.common.exception.PaymentException; import cn.shijinet.kunlun.payment.gateway.alipay2.AlipayTradeService; import cn.shijinet.kunlun.payment.gateway.shiji.ShijiTradeService; import cn.shijinet.kunlun.payment.gateway.tenpay.TenRefundQueryService; import cn.shijinet.kunlun.payment.model.FinanceTransaction; import cn.shijinet.kunlun.payment.model.RefundProformaTransaction; import cn.shijinet.kunlun.payment.model.enums.ActionType; import cn.shijinet.kunlun.payment.model.enums.TransactionStatus; import cn.shijinet.kunlun.payment.model.enums.TransactionType; import cn.shijinet.kunlun.payment.model.provider.Provider; import cn.shijinet.kunlun.payment.repository.FinanceTxnRepository; import cn.shijinet.kunlun.payment.repository.RefundProformaTxnRepository; import cn.shijinet.kunlun.security.qualifier.Authenticated; /** * @author ZhaoQian * */ @RequestScoped public class RefundProformaTxnService { @Inject @Authenticated @Named("currentUserName") private String currentUserName; @Inject private FinanceTxnRepository financeTxnRepository; @Inject private RefundProformaTxnRepository refundProformaTxnRepository; @Inject private TenRefundQueryService tenRefundQueryService; @Inject private ShijiTradeService shijiTradeService; @Inject private AlipayTradeService alipayTradeService; /** * 退款查询 * * @param financeId * @throws PaymentException * @throws Exception */ public void refundQuery(String transactionId, String paymentProvider) throws PaymentException { try { // 更新退款记录状态 RefundProformaTransaction proformaTransaction = refundProformaTxnRepository.queryById(transactionId); if ( StringUtils.equalsIgnoreCase(Provider.ALIPAY.toString(), paymentProvider) ) { FinanceTransaction ft = alipayTradeService.refundQuery(proformaTransaction); if ( ft != null && TransactionStatus.SUCCESS.equals(ft.getTransactionStatus()) ) { ft.setTransactionType(TransactionType.REFUND); financeTxnRepository.merge(ft); refundProformaTxnRepository.deleteById(proformaTransaction.getTransactionId()); } else { if ( ft != null ) { proformaTransaction.setTransactionStatus(ft.getTransactionStatus()); refundProformaTxnRepository.merge(proformaTransaction); } } } else if ( StringUtils.equalsIgnoreCase(Provider.SHIJIPAYMENT.toString(), paymentProvider) ) { FinanceTransaction ft = shijiTradeService.queryRefundTxn(proformaTransaction); if ( ft != null && TransactionStatus.SUCCESS.equals(ft.getTransactionStatus()) ) { ft.setTransactionType(TransactionType.REFUND); financeTxnRepository.merge(ft); refundProformaTxnRepository.deleteById(proformaTransaction.getTransactionId()); } else { if ( ft != null ) { proformaTransaction.setTransactionStatus(ft.getTransactionStatus()); refundProformaTxnRepository.merge(proformaTransaction); } } } else if ( StringUtils.equalsIgnoreCase(Provider.TENPAY.toString(), paymentProvider) ) { List<RefundProformaTransaction> queryTenpayResult = tenRefundQueryService.requestWeChat(proformaTransaction); for ( RefundProformaTransaction refundProformaTxn : queryTenpayResult ) { RefundProformaTransaction localRefundProformaTxn = refundProformaTxnRepository .queryByExternalTraceNo(refundProformaTxn.getExternalTraceNumber()); if ( TransactionStatus.SUCCESS.equals(refundProformaTxn.getTransactionStatus()) ) { FinanceTransaction tft = new FinanceTransaction(); tft.setPaymentRequestMessage(localRefundProformaTxn.getPaymentRequestMessage()); tft.setReferenceTransaction(localRefundProformaTxn.getReferenceTransaction()); tft.setCashierId(localRefundProformaTxn.getCashierId()); tft.setTerminalID(localRefundProformaTxn.getTerminalID()); tft.setTransactionType(TransactionType.REFUND); tft.setTransactionId(refundProformaTxn.getTransactionId()); tft.setExternalTraceNumber(refundProformaTxn.getExternalTraceNumber()); if ( refundProformaTxn.getRefundAmt() != null ) tft.setTransactionAmount(refundProformaTxn.getRefundAmt().divide(BigDecimal.valueOf(100))); tft.setTransactionStatus(TransactionStatus.SUCCESS); tft.setCashierId(localRefundProformaTxn.getCashierId()); tft.setTerminalID(localRefundProformaTxn.getTerminalID()); tft.setTransactionDateTime(new Date()); tft.setAcceptResultDateTime(new Date()); tft.setAcceptResultActionType(ActionType.tenpay_trade_refundQuery.toString()); tft.setLastUpdateBy("SYSTEM"); tft.setLastUpdate(new Date()); financeTxnRepository.merge(tft); refundProformaTxnRepository.deleteById(localRefundProformaTxn.getTransactionId()); } else { localRefundProformaTxn.setTransactionStatus(refundProformaTxn.getTransactionStatus()); refundProformaTxnRepository.merge(localRefundProformaTxn); } } } } catch ( Exception e ) { e.printStackTrace(); throw new PaymentException(e.getMessage()); } } }
UTF-8
Java
5,554
java
RefundProformaTxnService.java
Java
[ { "context": "/**\n * Copyright (c) 2016 Beijing Shiji Kunlun Software Co., Ltd. All Rights R", "end": 28, "score": 0.6164757013320923, "start": 26, "tag": "NAME", "value": "Be" }, { "context": "/**\n * Copyright (c) 2016 Beijing Shiji Kunlun Software Co., Ltd. All Rights Reserved.\n...
null
[]
/** * Copyright (c) 2016 Beij<NAME> Kunlun Software Co., Ltd. All Rights Reserved. * RefundProformaTxnService.java 2016年1月25日 上午10:41:33 ZhaoQian */ package cn.shijinet.kunlun.payment.controller.service; import java.math.BigDecimal; import java.util.Date; import java.util.List; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.inject.Named; import org.apache.commons.lang3.StringUtils; import cn.shijinet.kunlun.payment.common.exception.PaymentException; import cn.shijinet.kunlun.payment.gateway.alipay2.AlipayTradeService; import cn.shijinet.kunlun.payment.gateway.shiji.ShijiTradeService; import cn.shijinet.kunlun.payment.gateway.tenpay.TenRefundQueryService; import cn.shijinet.kunlun.payment.model.FinanceTransaction; import cn.shijinet.kunlun.payment.model.RefundProformaTransaction; import cn.shijinet.kunlun.payment.model.enums.ActionType; import cn.shijinet.kunlun.payment.model.enums.TransactionStatus; import cn.shijinet.kunlun.payment.model.enums.TransactionType; import cn.shijinet.kunlun.payment.model.provider.Provider; import cn.shijinet.kunlun.payment.repository.FinanceTxnRepository; import cn.shijinet.kunlun.payment.repository.RefundProformaTxnRepository; import cn.shijinet.kunlun.security.qualifier.Authenticated; /** * @author ZhaoQian * */ @RequestScoped public class RefundProformaTxnService { @Inject @Authenticated @Named("currentUserName") private String currentUserName; @Inject private FinanceTxnRepository financeTxnRepository; @Inject private RefundProformaTxnRepository refundProformaTxnRepository; @Inject private TenRefundQueryService tenRefundQueryService; @Inject private ShijiTradeService shijiTradeService; @Inject private AlipayTradeService alipayTradeService; /** * 退款查询 * * @param financeId * @throws PaymentException * @throws Exception */ public void refundQuery(String transactionId, String paymentProvider) throws PaymentException { try { // 更新退款记录状态 RefundProformaTransaction proformaTransaction = refundProformaTxnRepository.queryById(transactionId); if ( StringUtils.equalsIgnoreCase(Provider.ALIPAY.toString(), paymentProvider) ) { FinanceTransaction ft = alipayTradeService.refundQuery(proformaTransaction); if ( ft != null && TransactionStatus.SUCCESS.equals(ft.getTransactionStatus()) ) { ft.setTransactionType(TransactionType.REFUND); financeTxnRepository.merge(ft); refundProformaTxnRepository.deleteById(proformaTransaction.getTransactionId()); } else { if ( ft != null ) { proformaTransaction.setTransactionStatus(ft.getTransactionStatus()); refundProformaTxnRepository.merge(proformaTransaction); } } } else if ( StringUtils.equalsIgnoreCase(Provider.SHIJIPAYMENT.toString(), paymentProvider) ) { FinanceTransaction ft = shijiTradeService.queryRefundTxn(proformaTransaction); if ( ft != null && TransactionStatus.SUCCESS.equals(ft.getTransactionStatus()) ) { ft.setTransactionType(TransactionType.REFUND); financeTxnRepository.merge(ft); refundProformaTxnRepository.deleteById(proformaTransaction.getTransactionId()); } else { if ( ft != null ) { proformaTransaction.setTransactionStatus(ft.getTransactionStatus()); refundProformaTxnRepository.merge(proformaTransaction); } } } else if ( StringUtils.equalsIgnoreCase(Provider.TENPAY.toString(), paymentProvider) ) { List<RefundProformaTransaction> queryTenpayResult = tenRefundQueryService.requestWeChat(proformaTransaction); for ( RefundProformaTransaction refundProformaTxn : queryTenpayResult ) { RefundProformaTransaction localRefundProformaTxn = refundProformaTxnRepository .queryByExternalTraceNo(refundProformaTxn.getExternalTraceNumber()); if ( TransactionStatus.SUCCESS.equals(refundProformaTxn.getTransactionStatus()) ) { FinanceTransaction tft = new FinanceTransaction(); tft.setPaymentRequestMessage(localRefundProformaTxn.getPaymentRequestMessage()); tft.setReferenceTransaction(localRefundProformaTxn.getReferenceTransaction()); tft.setCashierId(localRefundProformaTxn.getCashierId()); tft.setTerminalID(localRefundProformaTxn.getTerminalID()); tft.setTransactionType(TransactionType.REFUND); tft.setTransactionId(refundProformaTxn.getTransactionId()); tft.setExternalTraceNumber(refundProformaTxn.getExternalTraceNumber()); if ( refundProformaTxn.getRefundAmt() != null ) tft.setTransactionAmount(refundProformaTxn.getRefundAmt().divide(BigDecimal.valueOf(100))); tft.setTransactionStatus(TransactionStatus.SUCCESS); tft.setCashierId(localRefundProformaTxn.getCashierId()); tft.setTerminalID(localRefundProformaTxn.getTerminalID()); tft.setTransactionDateTime(new Date()); tft.setAcceptResultDateTime(new Date()); tft.setAcceptResultActionType(ActionType.tenpay_trade_refundQuery.toString()); tft.setLastUpdateBy("SYSTEM"); tft.setLastUpdate(new Date()); financeTxnRepository.merge(tft); refundProformaTxnRepository.deleteById(localRefundProformaTxn.getTransactionId()); } else { localRefundProformaTxn.setTransactionStatus(refundProformaTxn.getTransactionStatus()); refundProformaTxnRepository.merge(localRefundProformaTxn); } } } } catch ( Exception e ) { e.printStackTrace(); throw new PaymentException(e.getMessage()); } } }
5,551
0.775543
0.771558
156
34.384617
32.435036
113
false
false
0
0
0
0
0
0
2.935897
false
false
7
4c0fdc40257f8dd75305c8d82852f44fd153ca1c
19,636,590,538,294
d121c0c5db3183a6f2f33a176fe11c16d424edc7
/CursoPildoras/Sockets/src/rubensockets/Servidor.java
aa2c6494870072e7858799a6d83337dd12091777
[]
no_license
RuboDev/Ejercicios
https://github.com/RuboDev/Ejercicios
90f74652ca363ea82f299cae5d817c926f263e94
5908d27235531b8d132c81faed768ee5edbcee0e
refs/heads/master
2023-06-29T18:51:01.611000
2021-07-31T20:17:22
2021-07-31T20:17:22
360,703,784
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package rubensockets; import javax.swing.*; import java.awt.*; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.util.ArrayList; public class Servidor { public static void main(String[] args) { MarcoServidor mimarco = new MarcoServidor(); mimarco.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } class MarcoServidor extends JFrame implements Runnable { private JTextArea areatexto; public MarcoServidor() { setBounds(1200, 300, 280, 350); JPanel milamina = new JPanel(); milamina.setLayout(new BorderLayout()); areatexto = new JTextArea(); milamina.add(areatexto, BorderLayout.CENTER); add(milamina); setVisible(true); Thread t = new Thread(this); t.start(); } @Override public void run() { try { String nick, ip, mensaje; PaqueteEnvio paquete_recibido; ArrayList<String> usersOnlineList = new ArrayList<String>(); while (true) { ServerSocket servidor = new ServerSocket(9999); Socket misocket = servidor.accept(); ObjectInputStream flujo_entrada = new ObjectInputStream(misocket.getInputStream()); paquete_recibido = (PaqueteEnvio) flujo_entrada.readObject(); nick = paquete_recibido.getNick(); ip = paquete_recibido.getIp(); mensaje = paquete_recibido.getMensaje(); if (!mensaje.equals("!@!-Online-!@!")) { if (mensaje.equals("!@!-Offline-!@!")) { // ----- To know adress of use gone offline InetAddress direccion = misocket.getInetAddress(); String ipClientOn = direccion.getHostAddress(); // ---------------------------------------------------------------- usersOnlineList.remove(ipClientOn); // quita de la lista la ip del cliente que desconectó // ------ENVIA LISTA DE IPS for (String ipAddr : usersOnlineList) { Socket enviaDestinatario = new Socket(ipAddr, 9090); ObjectOutputStream flujo_salida = new ObjectOutputStream(enviaDestinatario.getOutputStream()); PaqueteEnvio paqueteLista = new PaqueteEnvio(); paqueteLista.setIps(usersOnlineList); flujo_salida.writeObject(paqueteLista); flujo_salida.close(); enviaDestinatario.close(); } } else { areatexto.append("\n" + nick + ": " + mensaje + " para " + ip); Socket enviaDestinatario = new Socket(ip, 9090); ObjectOutputStream flujo_salida = new ObjectOutputStream(enviaDestinatario.getOutputStream()); flujo_salida.writeObject(paquete_recibido); flujo_salida.close(); enviaDestinatario.close(); } } else { // -----------DETECTA USUARIOS ONLINE------------------------------ InetAddress direccion = misocket.getInetAddress(); String ipClientOn = direccion.getHostAddress(); System.out.println("Online: " + ipClientOn); // ---------------------------------------------------------------- usersOnlineList.add(ipClientOn); // añade ip del cliente conectado a la lista. // ------ENVIA LISTA DE IPS for (String ipAddr : usersOnlineList) { Socket enviaDestinatario = new Socket(ipAddr, 9090); ObjectOutputStream flujo_salida = new ObjectOutputStream(enviaDestinatario.getOutputStream()); PaqueteEnvio paqueteLista = new PaqueteEnvio(); paqueteLista.setIps(usersOnlineList); flujo_salida.writeObject(paqueteLista); flujo_salida.close(); enviaDestinatario.close(); } } flujo_entrada.close(); misocket.close(); servidor.close(); } } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } }
UTF-8
Java
3,831
java
Servidor.java
Java
[ { "context": "\t}\r\n\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tareatexto.append(\"\\n\" + nick + \": \" + mensaje + \" para \" + ip);\r\n\r\n\t\t\t\t\t\tSocke", "end": 2409, "score": 0.9042525887489319, "start": 2405, "tag": "NAME", "value": "nick" } ]
null
[]
package rubensockets; import javax.swing.*; import java.awt.*; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.util.ArrayList; public class Servidor { public static void main(String[] args) { MarcoServidor mimarco = new MarcoServidor(); mimarco.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } class MarcoServidor extends JFrame implements Runnable { private JTextArea areatexto; public MarcoServidor() { setBounds(1200, 300, 280, 350); JPanel milamina = new JPanel(); milamina.setLayout(new BorderLayout()); areatexto = new JTextArea(); milamina.add(areatexto, BorderLayout.CENTER); add(milamina); setVisible(true); Thread t = new Thread(this); t.start(); } @Override public void run() { try { String nick, ip, mensaje; PaqueteEnvio paquete_recibido; ArrayList<String> usersOnlineList = new ArrayList<String>(); while (true) { ServerSocket servidor = new ServerSocket(9999); Socket misocket = servidor.accept(); ObjectInputStream flujo_entrada = new ObjectInputStream(misocket.getInputStream()); paquete_recibido = (PaqueteEnvio) flujo_entrada.readObject(); nick = paquete_recibido.getNick(); ip = paquete_recibido.getIp(); mensaje = paquete_recibido.getMensaje(); if (!mensaje.equals("!@!-Online-!@!")) { if (mensaje.equals("!@!-Offline-!@!")) { // ----- To know adress of use gone offline InetAddress direccion = misocket.getInetAddress(); String ipClientOn = direccion.getHostAddress(); // ---------------------------------------------------------------- usersOnlineList.remove(ipClientOn); // quita de la lista la ip del cliente que desconectó // ------ENVIA LISTA DE IPS for (String ipAddr : usersOnlineList) { Socket enviaDestinatario = new Socket(ipAddr, 9090); ObjectOutputStream flujo_salida = new ObjectOutputStream(enviaDestinatario.getOutputStream()); PaqueteEnvio paqueteLista = new PaqueteEnvio(); paqueteLista.setIps(usersOnlineList); flujo_salida.writeObject(paqueteLista); flujo_salida.close(); enviaDestinatario.close(); } } else { areatexto.append("\n" + nick + ": " + mensaje + " para " + ip); Socket enviaDestinatario = new Socket(ip, 9090); ObjectOutputStream flujo_salida = new ObjectOutputStream(enviaDestinatario.getOutputStream()); flujo_salida.writeObject(paquete_recibido); flujo_salida.close(); enviaDestinatario.close(); } } else { // -----------DETECTA USUARIOS ONLINE------------------------------ InetAddress direccion = misocket.getInetAddress(); String ipClientOn = direccion.getHostAddress(); System.out.println("Online: " + ipClientOn); // ---------------------------------------------------------------- usersOnlineList.add(ipClientOn); // añade ip del cliente conectado a la lista. // ------ENVIA LISTA DE IPS for (String ipAddr : usersOnlineList) { Socket enviaDestinatario = new Socket(ipAddr, 9090); ObjectOutputStream flujo_salida = new ObjectOutputStream(enviaDestinatario.getOutputStream()); PaqueteEnvio paqueteLista = new PaqueteEnvio(); paqueteLista.setIps(usersOnlineList); flujo_salida.writeObject(paqueteLista); flujo_salida.close(); enviaDestinatario.close(); } } flujo_entrada.close(); misocket.close(); servidor.close(); } } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } }
3,831
0.63463
0.627057
122
29.385246
25.494598
101
false
false
0
0
0
0
0
0
3.434426
false
false
7
83161d847671cce5134fd0c3482dbec5c1e2a060
27,006,754,388,765
7940c4adda206ad7297e2c69976020b6c5d1bf9f
/store/src/main/java/com/dragonmq/store/AppendFile.java
57336d66935f54a275d4be73c5b642def471f750
[]
no_license
sean417/dragonMQ
https://github.com/sean417/dragonMQ
bf949462bd85edf20071ee598f61e7970615d3f8
07af446c2510e0b1e010f4fddb6d2af672661bfa
refs/heads/master
2020-09-05T20:09:31.668000
2019-11-14T12:25:29
2019-11-14T12:25:29
220,201,790
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dragonmq.store; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.*; import java.nio.ByteBuffer; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; /** * @author chenyang@koolearn-inc.com * @date 2019/11/8 10:29 */ public class AppendFile { static Logger logger = LoggerFactory.getLogger(AppendFile.class); protected final AtomicInteger wrotePosition = new AtomicInteger(0); File file; RandomAccessFile randomAccessFile; FileChannel channel; MappedByteBuffer mappedByteBuffer; public AppendFile() { try { file = new File("D:\\data\\message"); randomAccessFile=new RandomAccessFile(file, "rw"); channel=randomAccessFile.getChannel(); mappedByteBuffer = channel.map(FileChannel.MapMode.READ_WRITE, 0, 1 * 1024 * 1024); }catch (IOException ex){ logger.error("excepton:{}",ex); } } public static void main(String[] args) throws Exception { File file = new File("D:\\copy.txt"); } public void appendMsg(byte[] bytes) { mappedByteBuffer.position(wrotePosition.get()); mappedByteBuffer.put(bytes); wrotePosition.addAndGet(bytes.length); } }
UTF-8
Java
1,379
java
AppendFile.java
Java
[ { "context": "util.concurrent.atomic.AtomicLong;\n\n/**\n * @author chenyang@koolearn-inc.com\n * @date 2019/11/8 10:29\n */\npublic class AppendF", "end": 343, "score": 0.9999288320541382, "start": 318, "tag": "EMAIL", "value": "chenyang@koolearn-inc.com" } ]
null
[]
package com.dragonmq.store; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.*; import java.nio.ByteBuffer; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; /** * @author <EMAIL> * @date 2019/11/8 10:29 */ public class AppendFile { static Logger logger = LoggerFactory.getLogger(AppendFile.class); protected final AtomicInteger wrotePosition = new AtomicInteger(0); File file; RandomAccessFile randomAccessFile; FileChannel channel; MappedByteBuffer mappedByteBuffer; public AppendFile() { try { file = new File("D:\\data\\message"); randomAccessFile=new RandomAccessFile(file, "rw"); channel=randomAccessFile.getChannel(); mappedByteBuffer = channel.map(FileChannel.MapMode.READ_WRITE, 0, 1 * 1024 * 1024); }catch (IOException ex){ logger.error("excepton:{}",ex); } } public static void main(String[] args) throws Exception { File file = new File("D:\\copy.txt"); } public void appendMsg(byte[] bytes) { mappedByteBuffer.position(wrotePosition.get()); mappedByteBuffer.put(bytes); wrotePosition.addAndGet(bytes.length); } }
1,361
0.671501
0.654097
52
25.51923
23.638699
95
false
false
0
0
0
0
0
0
0.538462
false
false
7
01fc3553f47e3d4190b120e44722e3bd034e5709
22,935,125,412,658
d1f153f8ae3180f4c6fad1a233e4ca11193bc7eb
/src/com/example/internet/AsyncHttpTask.java
d65ce53b998df462207b9270acfb6e5af116d8d6
[]
no_license
DerHexer17/HVS-App
https://github.com/DerHexer17/HVS-App
8d62204e5d79c2b67f36a77ac14b2c9aca95e4fd
6071f36a33b0dc1fb91ba0a656f5b23a2c0d34fe
refs/heads/master
2021-01-25T05:35:29.416000
2014-10-17T08:19:30
2014-10-17T08:19:30
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.internet; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; import java.util.Calendar; import java.util.GregorianCalendar; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.example.datahandling.DatabaseHelper; import com.example.datahandling.HTMLParser; import com.example.datahandling.Spiel; import com.example.datahandling.Spieltag; import com.example.hvs.R; import com.example.hvs.StartActivity; import com.example.hvs.TempResultActivity; import android.app.Application; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.os.AsyncTask; import android.os.Bundle; import android.text.format.Time; import android.util.Log; import android.widget.ArrayAdapter; import android.widget.TextView; public class AsyncHttpTask extends AsyncTask<String, Void, Integer> { //Context wird benötigt, kann aber nur in Activity erzeugt werden. Daher Mitgabe als Paramter private Context mContext; //Liste der gezogenen Spiele, die dann in die Datenbank eingeträgen bzw. geändert werden ArrayList<Spiel> spiele; ProgressDialog mDialog; //Spiele gehören zu einer bestimmten Liga, die passende Nummer brauchen wir als Variable int ligaNr; //Unterschied zwischen Initialem Daten-Download oder nur Update wird hier festgehalten boolean update; DatabaseHelper dbh; public AsyncHttpTask(Context context, int ligaNr, boolean update, DatabaseHelper dbh){ mContext = context; this.ligaNr = ligaNr; this.update = update; this.dbh = dbh; } @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); //mDialog = new ProgressDialog(mContext); //mDialog.setMessage("Please wait..."); //mDialog.show(); } @Override protected Integer doInBackground(String... params) { InputStream inputStream = null; HttpURLConnection urlConnection = null; int result = 0; String response = "Keine Daten"; try { /* forming th java.net.URL object */ URL url = new URL(params[0]); urlConnection = (HttpURLConnection) url.openConnection(); /* optional request header */ urlConnection.setRequestProperty("Content-Type", "application/json"); /* optional request header */ urlConnection.setRequestProperty("Accept", "application/json"); urlConnection.setRequestProperty("Accept-Charset", "iso-8859-1"); /* for Get request */ urlConnection.setRequestMethod("GET"); int statusCode = urlConnection.getResponseCode(); /* 200 represents HTTP OK */ if (statusCode == 200) { inputStream = new BufferedInputStream(urlConnection.getInputStream()); response = convertInputStreamToString(inputStream); //Wenn update == false, sind wir in der initalen Phase, holen also daten komplett //Wenn update == true führen wir nur ein Ergebnis Update durch, brauchen also einen anderen HTML Parser if(update==false){ HTMLParser htmlparser = new HTMLParser(); spiele = htmlparser.initialHTMLParsing(response, ligaNr); }else{ Cursor c = dbh.getAllPlayedGames(ligaNr); HTMLParser htmlparser = new HTMLParser(); spiele = htmlparser.updateHtmlParsing(response, ligaNr, c); } result = 1; // Successful }else{ result = 0; //"Failed to fetch data!"; } } catch (Exception e) { result=1000; String TAG = "Hauptmethode"; Log.d(TAG, e.getLocalizedMessage()); } //StartActivity.setTestDataResult(result); return result; //"Failed to fetch data!"; } @Override protected void onPostExecute(Integer result) { /* Download complete. Lets update UI */ if(result == 1){ //arrayAdapter = new ArrayAdapter(MyActivity.this, android.R.layout.simple_list_item_1, blogTitles); //listView.setAdapter(arrayAdapter); //Jetzt schreiben wir die Daten in die interne SQLite Datenbank. Bei initial also Neuanlage //Dabei kreieren wir auch gleich die Spieltage if(update==false){ String TAG = "db"; int z = 0; int ligaNr = spiele.get(2).getLigaNr(); String saison = dbh.getLiga(ligaNr).getSaison(); //Hier die Suche nach den Spieltagen Spieltag spieltag = new Spieltag(); int spieltagsNr = 0; GregorianCalendar aktuell = new GregorianCalendar(1970, 1, 1); GregorianCalendar prüfung = new GregorianCalendar(); for(Spiel s : this.spiele){ prüfung.set(s.getDateYear(), s.getDateMonth(), s.getDateDay()); int datePrüfung = prüfung.compareTo(aktuell); if(prüfung.after(aktuell)){ if(prüfung.get(Calendar.DAY_OF_MONTH)-aktuell.get(Calendar.DAY_OF_MONTH)==1){ spieltag.setDatumEnde(s.getDateYear()+"-"+s.getDateMonth()+"-"+s.getDateDay()); }else if(prüfung.get(Calendar.DAY_OF_MONTH)==1 && prüfung.get(Calendar.MONTH)-aktuell.get(Calendar.MONTH)==1 && aktuell.get(Calendar.DAY_OF_MONTH)>26){ spieltag.setDatumEnde(s.getDateYear()+"-"+s.getDateMonth()+"-"+s.getDateDay()); }else{ if(spieltagsNr>0){ dbh.createSpieltag(spieltag); } spieltagsNr++; spieltag.setLigaNr(ligaNr); spieltag.setSpieltags_Nr(spieltagsNr); spieltag.setSpieltags_Name(spieltagsNr+". Spieltag"); spieltag.setDatumBeginn(s.getDateYear()+"-"+s.getDateMonth()+"-"+s.getDateDay()); spieltag.setDatumEnde(s.getDateYear()+"-"+s.getDateMonth()+"-"+s.getDateDay()); spieltag.setSaison(saison); aktuell = prüfung; } } s.setSpieltagsNr(spieltagsNr); dbh.createSpiel(s); } dbh.createSpieltag(spieltag); Log.d(TAG, "Alle Spiele in die Datenbank geschrieben, insgesamt "+z+" Datensätze neu hinzu"); } //setProgressBarIndeterminateVisibility(false); //mDialog.dismiss(); }else{ String TAG = "PostExecute"; Log.e(TAG, "Failed to fetch data!"); } } private String convertInputStreamToString(InputStream inputStream) throws IOException { BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(inputStream)); String line = ""; String result = ""; while((line = bufferedReader.readLine()) != null){ result += line; } /* Close Stream */ if(null!=inputStream){ inputStream.close(); } return result; } /* Brauche ich JSON Parsing? private void parseResult(String result) { try{ JSONObject response = new JSONObject(result); JSONArray posts = response.optJSONArray("posts"); blogTitles = new String[posts.length()]; for(int i=0; i< posts.length();i++ ){ JSONObject post = posts.optJSONObject(i); String title = post.optString("title"); blogTitles[i] = title; } }catch (JSONException e){ e.printStackTrace(); } } */ }
ISO-8859-3
Java
8,174
java
AsyncHttpTask.java
Java
[]
null
[]
package com.example.internet; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; import java.util.Calendar; import java.util.GregorianCalendar; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.example.datahandling.DatabaseHelper; import com.example.datahandling.HTMLParser; import com.example.datahandling.Spiel; import com.example.datahandling.Spieltag; import com.example.hvs.R; import com.example.hvs.StartActivity; import com.example.hvs.TempResultActivity; import android.app.Application; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.os.AsyncTask; import android.os.Bundle; import android.text.format.Time; import android.util.Log; import android.widget.ArrayAdapter; import android.widget.TextView; public class AsyncHttpTask extends AsyncTask<String, Void, Integer> { //Context wird benötigt, kann aber nur in Activity erzeugt werden. Daher Mitgabe als Paramter private Context mContext; //Liste der gezogenen Spiele, die dann in die Datenbank eingeträgen bzw. geändert werden ArrayList<Spiel> spiele; ProgressDialog mDialog; //Spiele gehören zu einer bestimmten Liga, die passende Nummer brauchen wir als Variable int ligaNr; //Unterschied zwischen Initialem Daten-Download oder nur Update wird hier festgehalten boolean update; DatabaseHelper dbh; public AsyncHttpTask(Context context, int ligaNr, boolean update, DatabaseHelper dbh){ mContext = context; this.ligaNr = ligaNr; this.update = update; this.dbh = dbh; } @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); //mDialog = new ProgressDialog(mContext); //mDialog.setMessage("Please wait..."); //mDialog.show(); } @Override protected Integer doInBackground(String... params) { InputStream inputStream = null; HttpURLConnection urlConnection = null; int result = 0; String response = "Keine Daten"; try { /* forming th java.net.URL object */ URL url = new URL(params[0]); urlConnection = (HttpURLConnection) url.openConnection(); /* optional request header */ urlConnection.setRequestProperty("Content-Type", "application/json"); /* optional request header */ urlConnection.setRequestProperty("Accept", "application/json"); urlConnection.setRequestProperty("Accept-Charset", "iso-8859-1"); /* for Get request */ urlConnection.setRequestMethod("GET"); int statusCode = urlConnection.getResponseCode(); /* 200 represents HTTP OK */ if (statusCode == 200) { inputStream = new BufferedInputStream(urlConnection.getInputStream()); response = convertInputStreamToString(inputStream); //Wenn update == false, sind wir in der initalen Phase, holen also daten komplett //Wenn update == true führen wir nur ein Ergebnis Update durch, brauchen also einen anderen HTML Parser if(update==false){ HTMLParser htmlparser = new HTMLParser(); spiele = htmlparser.initialHTMLParsing(response, ligaNr); }else{ Cursor c = dbh.getAllPlayedGames(ligaNr); HTMLParser htmlparser = new HTMLParser(); spiele = htmlparser.updateHtmlParsing(response, ligaNr, c); } result = 1; // Successful }else{ result = 0; //"Failed to fetch data!"; } } catch (Exception e) { result=1000; String TAG = "Hauptmethode"; Log.d(TAG, e.getLocalizedMessage()); } //StartActivity.setTestDataResult(result); return result; //"Failed to fetch data!"; } @Override protected void onPostExecute(Integer result) { /* Download complete. Lets update UI */ if(result == 1){ //arrayAdapter = new ArrayAdapter(MyActivity.this, android.R.layout.simple_list_item_1, blogTitles); //listView.setAdapter(arrayAdapter); //Jetzt schreiben wir die Daten in die interne SQLite Datenbank. Bei initial also Neuanlage //Dabei kreieren wir auch gleich die Spieltage if(update==false){ String TAG = "db"; int z = 0; int ligaNr = spiele.get(2).getLigaNr(); String saison = dbh.getLiga(ligaNr).getSaison(); //Hier die Suche nach den Spieltagen Spieltag spieltag = new Spieltag(); int spieltagsNr = 0; GregorianCalendar aktuell = new GregorianCalendar(1970, 1, 1); GregorianCalendar prüfung = new GregorianCalendar(); for(Spiel s : this.spiele){ prüfung.set(s.getDateYear(), s.getDateMonth(), s.getDateDay()); int datePrüfung = prüfung.compareTo(aktuell); if(prüfung.after(aktuell)){ if(prüfung.get(Calendar.DAY_OF_MONTH)-aktuell.get(Calendar.DAY_OF_MONTH)==1){ spieltag.setDatumEnde(s.getDateYear()+"-"+s.getDateMonth()+"-"+s.getDateDay()); }else if(prüfung.get(Calendar.DAY_OF_MONTH)==1 && prüfung.get(Calendar.MONTH)-aktuell.get(Calendar.MONTH)==1 && aktuell.get(Calendar.DAY_OF_MONTH)>26){ spieltag.setDatumEnde(s.getDateYear()+"-"+s.getDateMonth()+"-"+s.getDateDay()); }else{ if(spieltagsNr>0){ dbh.createSpieltag(spieltag); } spieltagsNr++; spieltag.setLigaNr(ligaNr); spieltag.setSpieltags_Nr(spieltagsNr); spieltag.setSpieltags_Name(spieltagsNr+". Spieltag"); spieltag.setDatumBeginn(s.getDateYear()+"-"+s.getDateMonth()+"-"+s.getDateDay()); spieltag.setDatumEnde(s.getDateYear()+"-"+s.getDateMonth()+"-"+s.getDateDay()); spieltag.setSaison(saison); aktuell = prüfung; } } s.setSpieltagsNr(spieltagsNr); dbh.createSpiel(s); } dbh.createSpieltag(spieltag); Log.d(TAG, "Alle Spiele in die Datenbank geschrieben, insgesamt "+z+" Datensätze neu hinzu"); } //setProgressBarIndeterminateVisibility(false); //mDialog.dismiss(); }else{ String TAG = "PostExecute"; Log.e(TAG, "Failed to fetch data!"); } } private String convertInputStreamToString(InputStream inputStream) throws IOException { BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(inputStream)); String line = ""; String result = ""; while((line = bufferedReader.readLine()) != null){ result += line; } /* Close Stream */ if(null!=inputStream){ inputStream.close(); } return result; } /* Brauche ich JSON Parsing? private void parseResult(String result) { try{ JSONObject response = new JSONObject(result); JSONArray posts = response.optJSONArray("posts"); blogTitles = new String[posts.length()]; for(int i=0; i< posts.length();i++ ){ JSONObject post = posts.optJSONObject(i); String title = post.optString("title"); blogTitles[i] = title; } }catch (JSONException e){ e.printStackTrace(); } } */ }
8,174
0.619194
0.614659
245
32.30204
27.164776
119
false
false
0
0
0
0
0
0
1.555102
false
false
7
9ec3597c52d8c60829806829c3adbcda99d4d79a
25,589,415,204,511
c62158ce348da54a1ed3c74a909e0c7a6bb67981
/app/src/main/java/com/example/mangareader/CustomBottomItem.java
df6b206559d230e93162ea5f7c4d3cc6d0e3df00
[]
no_license
liondy/MangaReader
https://github.com/liondy/MangaReader
9f4353b3c88d5336f231df0f2be8722f7669eb20
a367b6672fbb097cd8c300a4987e6ea4296fa1b4
refs/heads/master
2020-09-04T20:26:21.953000
2019-12-07T04:26:56
2019-12-07T04:26:56
219,883,550
3
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.mangareader; public class CustomBottomItem { private int itemId; private int itemIconId; private String itemTitle; private String itemBackgroundColor; private String itemTintColor; private boolean isOpen; public CustomBottomItem(int itemId, int itemIconId, String itemTitle, String itemBackgroundColor, String itemTintColor) { this.itemId = itemId; this.itemIconId = itemIconId; this.itemTitle = itemTitle; this.itemBackgroundColor = itemBackgroundColor; this.itemTintColor = itemTintColor; this.isOpen = false; } public int getItemId() { return itemId; } public void setItemId(int itemId) { this.itemId = itemId; } public int getItemIconId() { return itemIconId; } public void setItemIconId(int itemIconId) { this.itemIconId = itemIconId; } public String getItemTitle() { return itemTitle; } public void setItemTitle(String itemTitle) { this.itemTitle = itemTitle; } public String getItemBackgroundColor() { return itemBackgroundColor; } public void setItemBackgroundColor(String itemBackgroundColor) { this.itemBackgroundColor = itemBackgroundColor; } public String getItemTintColor() { return itemTintColor; } public void setItemTintColor(String itemTintColor) { this.itemTintColor = itemTintColor; } public boolean isOpen() { return isOpen; } public void setOpen(boolean open) { isOpen = open; } }
UTF-8
Java
1,609
java
CustomBottomItem.java
Java
[]
null
[]
package com.example.mangareader; public class CustomBottomItem { private int itemId; private int itemIconId; private String itemTitle; private String itemBackgroundColor; private String itemTintColor; private boolean isOpen; public CustomBottomItem(int itemId, int itemIconId, String itemTitle, String itemBackgroundColor, String itemTintColor) { this.itemId = itemId; this.itemIconId = itemIconId; this.itemTitle = itemTitle; this.itemBackgroundColor = itemBackgroundColor; this.itemTintColor = itemTintColor; this.isOpen = false; } public int getItemId() { return itemId; } public void setItemId(int itemId) { this.itemId = itemId; } public int getItemIconId() { return itemIconId; } public void setItemIconId(int itemIconId) { this.itemIconId = itemIconId; } public String getItemTitle() { return itemTitle; } public void setItemTitle(String itemTitle) { this.itemTitle = itemTitle; } public String getItemBackgroundColor() { return itemBackgroundColor; } public void setItemBackgroundColor(String itemBackgroundColor) { this.itemBackgroundColor = itemBackgroundColor; } public String getItemTintColor() { return itemTintColor; } public void setItemTintColor(String itemTintColor) { this.itemTintColor = itemTintColor; } public boolean isOpen() { return isOpen; } public void setOpen(boolean open) { isOpen = open; } }
1,609
0.660037
0.660037
68
22.661764
22.087133
125
false
false
0
0
0
0
0
0
0.426471
false
false
7
3b080ed73b94bc58361867ca92b0474ab8c47b34
21,492,016,367,202
2a6620625cd2324841749ed363c019834e0de6ee
/src/com/bensoft/mulg2/model/tiles/TiltingRampTileModel.java
82b0336c102507e6463e949a7b040d87c1202b45
[]
no_license
lopsided98/Mulg
https://github.com/lopsided98/Mulg
220613875397f19347f3908254034ee67839b0de
768108f5a42c89c48fb14a1da4d6cc4bb2691e18
refs/heads/master
2020-05-18T04:00:47.291000
2013-10-07T00:25:06
2013-10-07T00:25:06
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.bensoft.mulg2.model.tiles; import com.badlogic.gdx.physics.box2d.Contact; import com.badlogic.gdx.physics.box2d.Manifold; import com.bensoft.mulg2.game.level.Level; import com.bensoft.mulg2.model.Model; import com.bensoft.mulg2.view.tiles.TwoStateTileView; /** * * @author Ben Wolsieffer */ public abstract class TiltingRampTileModel extends TileModel<TwoStateTileView>{ protected boolean allowThrough = true; public TiltingRampTileModel(Level level, float x, float y, int data, TwoStateTileView view) { super(level, x, y, data, view); } @Override public void preSolve(Contact contact, Manifold manifold, Model<?> otherElem) { super.preSolve(contact, manifold, otherElem); contact.setEnabled(!allowThrough); } }
UTF-8
Java
994
java
TiltingRampTileModel.java
Java
[ { "context": "iew.tiles.TwoStateTileView;\r\n\r\n/**\r\n *\r\n * @author Ben Wolsieffer\r\n */\r\npublic abstract class TiltingRampTileModel ", "end": 505, "score": 0.999660313129425, "start": 491, "tag": "NAME", "value": "Ben Wolsieffer" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.bensoft.mulg2.model.tiles; import com.badlogic.gdx.physics.box2d.Contact; import com.badlogic.gdx.physics.box2d.Manifold; import com.bensoft.mulg2.game.level.Level; import com.bensoft.mulg2.model.Model; import com.bensoft.mulg2.view.tiles.TwoStateTileView; /** * * @author <NAME> */ public abstract class TiltingRampTileModel extends TileModel<TwoStateTileView>{ protected boolean allowThrough = true; public TiltingRampTileModel(Level level, float x, float y, int data, TwoStateTileView view) { super(level, x, y, data, view); } @Override public void preSolve(Contact contact, Manifold manifold, Model<?> otherElem) { super.preSolve(contact, manifold, otherElem); contact.setEnabled(!allowThrough); } }
986
0.717304
0.711268
30
31.133333
28.725985
97
false
false
0
0
0
0
0
0
0.833333
false
false
7
8c21ff767b37f60c2e1b8a1c61a4ed0e921ead4d
12,549,894,451,573
592a91d72944d5c6e2331b790c10cc8108b828e1
/src/bapers/data/domain/TaskDiscount.java
e5732bfc3ce7a0f44169c3f3ac1be3151065835d
[]
no_license
ChristopherMichael-Stokes/IN2018-BAPERS
https://github.com/ChristopherMichael-Stokes/IN2018-BAPERS
4b3e205cec8e32b6941f6743397bdc6f017e4312
a2514d08fbd5deb6b2b410ef51e97b5d42247e54
refs/heads/master
2021-03-22T04:59:46.634000
2018-04-19T21:21:25
2018-04-19T21:21:25
121,184,572
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (c) 2018, chris * 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. * * 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 bapers.data.domain; import java.io.Serializable; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.EmbeddedId; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.xml.bind.annotation.XmlRootElement; /** * * @author chris */ @Entity @Table(name = "task_discount") @XmlRootElement @NamedQueries({ @NamedQuery(name = "TaskDiscount.findAll", query = "SELECT t FROM TaskDiscount t") , @NamedQuery(name = "TaskDiscount.findByFkAccountNumber", query = "SELECT t FROM TaskDiscount t WHERE t.taskDiscountPK.fkAccountNumber = :fkAccountNumber") , @NamedQuery(name = "TaskDiscount.findByFkTaskId", query = "SELECT t FROM TaskDiscount t WHERE t.taskDiscountPK.fkTaskId = :fkTaskId") , @NamedQuery(name = "TaskDiscount.findByPercentage", query = "SELECT t FROM TaskDiscount t WHERE t.percentage = :percentage")}) public class TaskDiscount implements Serializable { private static final long serialVersionUID = 1L; @EmbeddedId protected TaskDiscountPK taskDiscountPK; @Basic(optional = false) @Column(name = "percentage") private float percentage; @JoinColumn(name = "fk_task_id", referencedColumnName = "task_id", insertable = false, updatable = false) @ManyToOne(optional = false, fetch = FetchType.EAGER) private Task task; @JoinColumn(name = "fk_account_number", referencedColumnName = "account_number", insertable = false, updatable = false) @ManyToOne(optional = false, fetch = FetchType.EAGER) private CustomerAccount customerAccount; public TaskDiscount() { } public TaskDiscount(TaskDiscountPK taskDiscountPK) { this.taskDiscountPK = taskDiscountPK; } public TaskDiscount(TaskDiscountPK taskDiscountPK, float percentage) { this.taskDiscountPK = taskDiscountPK; this.percentage = percentage; } public TaskDiscount(short fkAccountNumber, int fkTaskId) { this.taskDiscountPK = new TaskDiscountPK(fkAccountNumber, fkTaskId); } public TaskDiscountPK getTaskDiscountPK() { return taskDiscountPK; } public void setTaskDiscountPK(TaskDiscountPK taskDiscountPK) { this.taskDiscountPK = taskDiscountPK; } public float getPercentage() { return percentage; } public void setPercentage(float percentage) { this.percentage = percentage; } public Task getTask() { return task; } public void setTask(Task task) { this.task = task; } public CustomerAccount getCustomerAccount() { return customerAccount; } public void setCustomerAccount(CustomerAccount customerAccount) { this.customerAccount = customerAccount; } @Override public int hashCode() { int hash = 0; hash += (taskDiscountPK != null ? taskDiscountPK.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof TaskDiscount)) { return false; } TaskDiscount other = (TaskDiscount) object; if ((this.taskDiscountPK == null && other.taskDiscountPK != null) || (this.taskDiscountPK != null && !this.taskDiscountPK.equals(other.taskDiscountPK))) { return false; } return true; } @Override public String toString() { return "bapers.data.domain.TaskDiscount[ taskDiscountPK=" + taskDiscountPK + " ]"; } }
UTF-8
Java
5,251
java
TaskDiscount.java
Java
[ { "context": "/*\r\n * Copyright (c) 2018, chris\r\n * All rights reserved.\r\n *\r\n * Redistribution a", "end": 32, "score": 0.9975876808166504, "start": 27, "tag": "NAME", "value": "chris" }, { "context": ".annotation.XmlRootElement;\r\n\r\n/**\r\n *\r\n * @author chris\r\n */\r\n...
null
[]
/* * Copyright (c) 2018, chris * 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. * * 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 bapers.data.domain; import java.io.Serializable; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.EmbeddedId; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.xml.bind.annotation.XmlRootElement; /** * * @author chris */ @Entity @Table(name = "task_discount") @XmlRootElement @NamedQueries({ @NamedQuery(name = "TaskDiscount.findAll", query = "SELECT t FROM TaskDiscount t") , @NamedQuery(name = "TaskDiscount.findByFkAccountNumber", query = "SELECT t FROM TaskDiscount t WHERE t.taskDiscountPK.fkAccountNumber = :fkAccountNumber") , @NamedQuery(name = "TaskDiscount.findByFkTaskId", query = "SELECT t FROM TaskDiscount t WHERE t.taskDiscountPK.fkTaskId = :fkTaskId") , @NamedQuery(name = "TaskDiscount.findByPercentage", query = "SELECT t FROM TaskDiscount t WHERE t.percentage = :percentage")}) public class TaskDiscount implements Serializable { private static final long serialVersionUID = 1L; @EmbeddedId protected TaskDiscountPK taskDiscountPK; @Basic(optional = false) @Column(name = "percentage") private float percentage; @JoinColumn(name = "fk_task_id", referencedColumnName = "task_id", insertable = false, updatable = false) @ManyToOne(optional = false, fetch = FetchType.EAGER) private Task task; @JoinColumn(name = "fk_account_number", referencedColumnName = "account_number", insertable = false, updatable = false) @ManyToOne(optional = false, fetch = FetchType.EAGER) private CustomerAccount customerAccount; public TaskDiscount() { } public TaskDiscount(TaskDiscountPK taskDiscountPK) { this.taskDiscountPK = taskDiscountPK; } public TaskDiscount(TaskDiscountPK taskDiscountPK, float percentage) { this.taskDiscountPK = taskDiscountPK; this.percentage = percentage; } public TaskDiscount(short fkAccountNumber, int fkTaskId) { this.taskDiscountPK = new TaskDiscountPK(fkAccountNumber, fkTaskId); } public TaskDiscountPK getTaskDiscountPK() { return taskDiscountPK; } public void setTaskDiscountPK(TaskDiscountPK taskDiscountPK) { this.taskDiscountPK = taskDiscountPK; } public float getPercentage() { return percentage; } public void setPercentage(float percentage) { this.percentage = percentage; } public Task getTask() { return task; } public void setTask(Task task) { this.task = task; } public CustomerAccount getCustomerAccount() { return customerAccount; } public void setCustomerAccount(CustomerAccount customerAccount) { this.customerAccount = customerAccount; } @Override public int hashCode() { int hash = 0; hash += (taskDiscountPK != null ? taskDiscountPK.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof TaskDiscount)) { return false; } TaskDiscount other = (TaskDiscount) object; if ((this.taskDiscountPK == null && other.taskDiscountPK != null) || (this.taskDiscountPK != null && !this.taskDiscountPK.equals(other.taskDiscountPK))) { return false; } return true; } @Override public String toString() { return "bapers.data.domain.TaskDiscount[ taskDiscountPK=" + taskDiscountPK + " ]"; } }
5,251
0.695296
0.693963
141
35.241135
34.085396
162
false
false
0
0
0
0
0
0
0.574468
false
false
7
78be03da546c8260026202fcdbc859eb1c70c120
19,086,834,704,216
c982da2d54537c53f6c41da1f95bffe04a9ca8ce
/turispetro/src/main/java/br/gov/rj/petropolis/turispetro/repositories/EstablishmentRepository.java
a33bfdfd035d5497a74bebd6440b3ab355665eb3
[]
no_license
rbarbosa1985/Project-Turispetro
https://github.com/rbarbosa1985/Project-Turispetro
2aba8fa0d684e5e7a397f259a79aa531def38587
163fb42929171ed396fcb33c68b772171455a1a4
refs/heads/master
2023-01-08T03:31:18.581000
2020-11-07T04:45:36
2020-11-07T04:45:36
310,755,001
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.gov.rj.petropolis.turispetro.repositories; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import br.gov.rj.petropolis.turispetro.model.Establishment; @Repository public interface EstablishmentRepository extends JpaRepository<Establishment, Integer>{ }
UTF-8
Java
332
java
EstablishmentRepository.java
Java
[]
null
[]
package br.gov.rj.petropolis.turispetro.repositories; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import br.gov.rj.petropolis.turispetro.model.Establishment; @Repository public interface EstablishmentRepository extends JpaRepository<Establishment, Integer>{ }
332
0.85241
0.85241
11
29.181818
31.240469
87
false
false
0
0
0
0
0
0
0.454545
false
false
7
5dd7f9c349f48e57d20121ddfe1f670883a878aa
15,504,831,982,936
556938b7e7fa16bcf307782a8804ddfd8f2c358b
/src/main/java/com/paxport/multicommerce/client/MCSessionJob.java
e2bf87dc366db706d4a4eb665f91383c1a70480e
[ "MIT" ]
permissive
paxport/multicommerce-client
https://github.com/paxport/multicommerce-client
53461c50811c2275e64f3a7cf8f0f78bdfed4705
cacf0fe262de01050eb4c06778ada260b22f7019
refs/heads/master
2020-12-25T15:17:43.159000
2016-11-28T14:30:37
2016-11-28T14:30:37
67,506,410
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.paxport.multicommerce.client; public interface MCSessionJob<E> { E doInSession(MCSession session); }
UTF-8
Java
118
java
MCSessionJob.java
Java
[]
null
[]
package com.paxport.multicommerce.client; public interface MCSessionJob<E> { E doInSession(MCSession session); }
118
0.779661
0.779661
5
22.6
18.18351
41
false
false
0
0
0
0
0
0
0.4
false
false
7
7a1ef06b2a98fc508d76e8ffb2906b2c9f80aaf3
19,945,828,172,377
618067f17bfb40208a8489d7fb9b0e38dcac7002
/app/src/main/java/jair/ejemplo/android/ejemplowebservices/ListaAdapater.java
c3b6154d5b71b923c1f8bda4346a7b33ec95657d
[]
no_license
jairbc16/EjemploWebServices
https://github.com/jairbc16/EjemploWebServices
af6a7fae0bf467ee232f3d3536538c1ecfebff0a
2cddc76ee508aef8c593a87efd67b113669f9718
refs/heads/master
2020-05-20T20:36:32.846000
2017-03-11T05:28:46
2017-03-11T05:28:46
84,520,980
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package jair.ejemplo.android.ejemplowebservices; import android.content.Context; import android.support.annotation.NonNull; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import java.util.ArrayList; import java.util.List; import static android.R.attr.resource; /** * Created by Jair Barzola on 27-Feb-17. */ public class ListaAdapater extends ArrayAdapter<Usuario>{ public Usuario usuario; public ListaAdapater(Context context, List<Usuario> users) { super(context,0,users); } @Override public View getView(int position, View convertView, ViewGroup parent) { View listItemView = convertView; if (listItemView == null) { listItemView = LayoutInflater.from(getContext()).inflate(R.layout.item_list, parent, false); } usuario = getItem(position); TextView nombre = (TextView) listItemView.findViewById(R.id.nombre); TextView apellido = (TextView) listItemView.findViewById(R.id.apellido); TextView edad = (TextView) listItemView.findViewById(R.id.edad); TextView carrera = (TextView) listItemView.findViewById(R.id.carrera); nombre.setText(usuario.getNombre()); apellido.setText(usuario.getApellido()); edad.setText(String.valueOf(usuario.getEdad())); carrera.setText(usuario.getCarrera()); return listItemView; } }
UTF-8
Java
1,486
java
ListaAdapater.java
Java
[ { "context": "static android.R.attr.resource;\n\n/**\n * Created by Jair Barzola on 27-Feb-17.\n */\n\npublic class ListaAdapater ext", "end": 409, "score": 0.9998895525932312, "start": 397, "tag": "NAME", "value": "Jair Barzola" } ]
null
[]
package jair.ejemplo.android.ejemplowebservices; import android.content.Context; import android.support.annotation.NonNull; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import java.util.ArrayList; import java.util.List; import static android.R.attr.resource; /** * Created by <NAME> on 27-Feb-17. */ public class ListaAdapater extends ArrayAdapter<Usuario>{ public Usuario usuario; public ListaAdapater(Context context, List<Usuario> users) { super(context,0,users); } @Override public View getView(int position, View convertView, ViewGroup parent) { View listItemView = convertView; if (listItemView == null) { listItemView = LayoutInflater.from(getContext()).inflate(R.layout.item_list, parent, false); } usuario = getItem(position); TextView nombre = (TextView) listItemView.findViewById(R.id.nombre); TextView apellido = (TextView) listItemView.findViewById(R.id.apellido); TextView edad = (TextView) listItemView.findViewById(R.id.edad); TextView carrera = (TextView) listItemView.findViewById(R.id.carrera); nombre.setText(usuario.getNombre()); apellido.setText(usuario.getApellido()); edad.setText(String.valueOf(usuario.getEdad())); carrera.setText(usuario.getCarrera()); return listItemView; } }
1,480
0.712651
0.709287
46
31.304348
26.694626
104
false
false
0
0
0
0
0
0
0.695652
false
false
7
2b85a553b17b0d5ddb13353a934426b093c6bc95
24,129,126,311,017
94ce12dee204dd9d22191b597dfc620638bc7f45
/src/main/java/com/pkj/boker/demo/seven/SevenTestController.java
8f7a33825ec68a153cc934c73e6b33cedc513ba0
[]
no_license
beanbroker/spring_study_2021
https://github.com/beanbroker/spring_study_2021
2e4df139c71f295806c1c069cec33673276a52ab
76dde7cc53d7588e4079e6fb2ef38e41f9431e3d
refs/heads/master
2023-05-02T11:42:24.588000
2021-05-27T11:15:37
2021-05-27T11:15:37
356,610,046
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pkj.boker.demo.seven; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; @RequestMapping("/seven") @RestController public class SevenTestController { private final PkjCacheService pkjCacheService; public SevenTestController(PkjCacheService pkjCacheService) { this.pkjCacheService = pkjCacheService; } @GetMapping("/test-redis") public String getName(@RequestParam("userId") String userId) { return pkjCacheService.getUserName(userId); } @PostMapping("/sign-up") public String signUp(@Valid @RequestBody SevenUser sevenUser) { return "ok"; } }
UTF-8
Java
623
java
SevenTestController.java
Java
[]
null
[]
package com.pkj.boker.demo.seven; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; @RequestMapping("/seven") @RestController public class SevenTestController { private final PkjCacheService pkjCacheService; public SevenTestController(PkjCacheService pkjCacheService) { this.pkjCacheService = pkjCacheService; } @GetMapping("/test-redis") public String getName(@RequestParam("userId") String userId) { return pkjCacheService.getUserName(userId); } @PostMapping("/sign-up") public String signUp(@Valid @RequestBody SevenUser sevenUser) { return "ok"; } }
623
0.756019
0.756019
27
22.074074
22.472906
65
false
false
0
0
0
0
0
0
0.259259
false
false
7
6e5cd8fb608b6f3e5cd3084efa76aca52c0db515
10,290,741,643,240
3cfe581d2771b7453028ef19b6b8416c12e79047
/automation/src/HandlingExcelSheet/RetriveDataFromExcel.java
062e51a4e1b879d36856a6ef9610f03bd02b5253
[]
no_license
Poonam592/WCSM5
https://github.com/Poonam592/WCSM5
69e46b03d72cfb5146d0e6cde341cf0bbec7c472
af03d08b951f78fbda93c254c55357e2b55855cc
refs/heads/master
2023-06-10T06:14:27.041000
2021-07-07T04:14:44
2021-07-07T04:14:44
383,668,025
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package HandlingExcelSheet; import java.io.FileInputStream; import java.io.IOException; import org.apache.poi.EncryptedDocumentException; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.WorkbookFactory; import dataDrivenFramework.CreateMethodExcelsheet; public class RetriveDataFromExcel { public static void main(String[] args) throws EncryptedDocumentException, IOException { FileInputStream fs=new FileInputStream("./Data/ActiTime.xlsx"); Workbook wb=WorkbookFactory.create(fs);//make the excel file ready for read operation org.apache.poi.ss.usermodel.Sheet sh = wb.getSheet("InvalidCredentials");//go to that sheet CreateMethodExcelsheet fil = new CreateMethodExcelsheet(); int rc = fil.getRowCount("./Data/ActiTime.xlsx","InvalidCredentials"); for(int i=0;i<=rc;i++) { Row row = sh.getRow(i); for(int j=0 ; j<=1 ;j++) { Cell cell = row.getCell(j); String data = cell.getStringCellValue(); System.out.println(data); } } } }
UTF-8
Java
1,131
java
RetriveDataFromExcel.java
Java
[]
null
[]
package HandlingExcelSheet; import java.io.FileInputStream; import java.io.IOException; import org.apache.poi.EncryptedDocumentException; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.WorkbookFactory; import dataDrivenFramework.CreateMethodExcelsheet; public class RetriveDataFromExcel { public static void main(String[] args) throws EncryptedDocumentException, IOException { FileInputStream fs=new FileInputStream("./Data/ActiTime.xlsx"); Workbook wb=WorkbookFactory.create(fs);//make the excel file ready for read operation org.apache.poi.ss.usermodel.Sheet sh = wb.getSheet("InvalidCredentials");//go to that sheet CreateMethodExcelsheet fil = new CreateMethodExcelsheet(); int rc = fil.getRowCount("./Data/ActiTime.xlsx","InvalidCredentials"); for(int i=0;i<=rc;i++) { Row row = sh.getRow(i); for(int j=0 ; j<=1 ;j++) { Cell cell = row.getCell(j); String data = cell.getStringCellValue(); System.out.println(data); } } } }
1,131
0.725022
0.72237
34
31.264706
27.602545
93
false
false
0
0
0
0
0
0
2.029412
false
false
7
a75ffde09d116283a0f3d252d7bdaa6e89334ec1
5,497,558,207,230
0003cd4853b695bf0bbccb94041909d1431b4288
/app/src/main/java/com/example/csainz/androidwikipedia/common/LifecycleLoggingActivity.java
657de7f649d8aa0c15d38eea051ce19bb0dbeba0
[]
no_license
micho10/android-wikipedia
https://github.com/micho10/android-wikipedia
d633cb085739c174980ca11371499eceec86caa2
c55dab308094f25c022478cfeea56d38c4791fdc
refs/heads/master
2016-09-05T20:46:42.442000
2015-09-08T00:39:49
2015-09-08T00:39:49
41,537,775
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.csainz.androidwikipedia.common; import android.app.Activity; import android.os.Bundle; import android.util.Log; /** * This abstract class extends the Activity class and overrides lifecycle callbacks for logging * various lifecycle events. */ public abstract class LifecycleLoggingActivity extends Activity { /** * Debugging tag used by the Android logger. */ protected final String TAG = getClass().getSimpleName(); /** * Hook method called when a new instance of Activity is created. One time initialization code * should go here e.g. UI layout, some class scope variable initialization. if finish() is * called from onCreate no other lifecycle callbacks are called except for onDestroy(). * * @param savedInstanceState * object that contains saved state information. */ @Override protected void onCreate(Bundle savedInstanceState) { // Always call super class for necessary initialization/implementation. super.onCreate(savedInstanceState); if (savedInstanceState != null) { // The activity is being re-created. Use the savedInstanceState bundle for // initializations either during onCreate or onRestoreInstanceState(). Log.d(TAG, "onCreate(): activity re-created"); } else { // Activity is being created anew. No prior saved instance state information available // in Bundle object. Log.d(TAG, "onCreate(): activity created anew"); } } /** * Hook method called after onCreate() or after onRestart() (when the activity is being * restarted from stopped state). Should re-acquire resources relinquished when activity was * stopped (onStop()) or acquire those resources for the first time after onCreate(). */ @Override protected void onStart() { // Always call super class for necessary initialization/implementation. super.onStart(); Log.d(TAG, "onStart() - the activity is about to become visible"); } /** * Hook method called after onRestoreStateInstance(Bundle) only if there is a prior saved * instance state in Bundle object. onResume() is called immediately after onStart(). * onResume() is called when user resumes activity from paused state (onPause()) User can begin * interacting with activity. Place to start animations, acquire exclusive resources, such as * the camera. */ @Override protected void onResume() { // Always call super class for necessary initialization/implementation and then log which // lifecycle hook method is being called. super.onResume(); Log.d(TAG, "onResume() - the activity has become visible (it is now \"resumed\")"); } /** * Hook method called when an Activity loses focus but is still visible in background. May be * followed by onStop() or onResume(). Delegate more CPU intensive operation to onStop for * seamless transition to next activity. Save persistent state (onSaveInstanceState()) in case * app is killed. Often used to release exclusive resources. */ @Override protected void onPause() { // Always call super class for necessary initialization/implementation and then log which // lifecycle hook method is being called. super.onPause(); Log.d(TAG, "onPause() - another activity is taking focus (this activity is about to be " + "\"paused\")"); } /** * Called when Activity is no longer visible. Release resources that may cause memory leak. * Save instance state (onSaveInstanceState()) in case activity is killed. */ @Override protected void onStop() { // Always call super class for necessary initialization/implementation and then log which // lifecycle hook method is being called. super.onStop(); Log.d(TAG, "onStop() - the activity is no longer visible (it is now \"stopped\")"); } /** * Hook method called when user restarts a stopped activity. Is followed by a call to onStart() * and onResume(). */ @Override protected void onRestart() { // Always call super class for necessary initialization/implementation and then log which // lifecycle hook method is being called. super.onRestart(); Log.d(TAG, "onRestart() - the activity is about to be restarted()"); } /** * Hook method that gives a final chance to release resources and stop spawned threads. This * method may not always be called when the Android system kills the hosting process. */ @Override protected void onDestroy() { // Always call super class for necessary initialization/implementation and then log which // lifecycle hook method is being called. super.onDestroy(); Log.d(TAG, "onDestroy() - the activity is about to be destroyed"); } }
UTF-8
Java
5,022
java
LifecycleLoggingActivity.java
Java
[ { "context": "package com.example.csainz.androidwikipedia.common;\n\nimport android.app.Acti", "end": 26, "score": 0.7834197878837585, "start": 20, "tag": "USERNAME", "value": "csainz" } ]
null
[]
package com.example.csainz.androidwikipedia.common; import android.app.Activity; import android.os.Bundle; import android.util.Log; /** * This abstract class extends the Activity class and overrides lifecycle callbacks for logging * various lifecycle events. */ public abstract class LifecycleLoggingActivity extends Activity { /** * Debugging tag used by the Android logger. */ protected final String TAG = getClass().getSimpleName(); /** * Hook method called when a new instance of Activity is created. One time initialization code * should go here e.g. UI layout, some class scope variable initialization. if finish() is * called from onCreate no other lifecycle callbacks are called except for onDestroy(). * * @param savedInstanceState * object that contains saved state information. */ @Override protected void onCreate(Bundle savedInstanceState) { // Always call super class for necessary initialization/implementation. super.onCreate(savedInstanceState); if (savedInstanceState != null) { // The activity is being re-created. Use the savedInstanceState bundle for // initializations either during onCreate or onRestoreInstanceState(). Log.d(TAG, "onCreate(): activity re-created"); } else { // Activity is being created anew. No prior saved instance state information available // in Bundle object. Log.d(TAG, "onCreate(): activity created anew"); } } /** * Hook method called after onCreate() or after onRestart() (when the activity is being * restarted from stopped state). Should re-acquire resources relinquished when activity was * stopped (onStop()) or acquire those resources for the first time after onCreate(). */ @Override protected void onStart() { // Always call super class for necessary initialization/implementation. super.onStart(); Log.d(TAG, "onStart() - the activity is about to become visible"); } /** * Hook method called after onRestoreStateInstance(Bundle) only if there is a prior saved * instance state in Bundle object. onResume() is called immediately after onStart(). * onResume() is called when user resumes activity from paused state (onPause()) User can begin * interacting with activity. Place to start animations, acquire exclusive resources, such as * the camera. */ @Override protected void onResume() { // Always call super class for necessary initialization/implementation and then log which // lifecycle hook method is being called. super.onResume(); Log.d(TAG, "onResume() - the activity has become visible (it is now \"resumed\")"); } /** * Hook method called when an Activity loses focus but is still visible in background. May be * followed by onStop() or onResume(). Delegate more CPU intensive operation to onStop for * seamless transition to next activity. Save persistent state (onSaveInstanceState()) in case * app is killed. Often used to release exclusive resources. */ @Override protected void onPause() { // Always call super class for necessary initialization/implementation and then log which // lifecycle hook method is being called. super.onPause(); Log.d(TAG, "onPause() - another activity is taking focus (this activity is about to be " + "\"paused\")"); } /** * Called when Activity is no longer visible. Release resources that may cause memory leak. * Save instance state (onSaveInstanceState()) in case activity is killed. */ @Override protected void onStop() { // Always call super class for necessary initialization/implementation and then log which // lifecycle hook method is being called. super.onStop(); Log.d(TAG, "onStop() - the activity is no longer visible (it is now \"stopped\")"); } /** * Hook method called when user restarts a stopped activity. Is followed by a call to onStart() * and onResume(). */ @Override protected void onRestart() { // Always call super class for necessary initialization/implementation and then log which // lifecycle hook method is being called. super.onRestart(); Log.d(TAG, "onRestart() - the activity is about to be restarted()"); } /** * Hook method that gives a final chance to release resources and stop spawned threads. This * method may not always be called when the Android system kills the hosting process. */ @Override protected void onDestroy() { // Always call super class for necessary initialization/implementation and then log which // lifecycle hook method is being called. super.onDestroy(); Log.d(TAG, "onDestroy() - the activity is about to be destroyed"); } }
5,022
0.669255
0.669255
128
38.234375
36.522358
99
false
false
0
0
0
0
0
0
0.242188
false
false
7
7eca61cf1cafcc9f6306a86b5597c7abcd33aa35
2,353,642,087,519
b774d5b532ef20e5c8476e35ea90da5e3f09287e
/src/com/github/tomap/modeler/model/diagramClass/test/TestRelation.java
fd5ac120db1811409700bf54f964b148d77a12d3
[]
no_license
Phalexei/Modeleur
https://github.com/Phalexei/Modeleur
ae94ab6c191a7999cf9deaee4dac8542eb6a52bb
f143c85930c3b668670087693ec807a9cd4bda81
refs/heads/master
2021-01-02T08:51:16.535000
2013-11-16T19:54:20
2013-11-16T19:54:20
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.github.tomap.modeler.model.diagramClass.test; import com.github.tomap.modeler.model.diagramClass.A_Class_Diagram; import com.github.tomap.modeler.model.diagramClass.aclass.A_Class; import com.github.tomap.modeler.model.diagramClass.aninterface.An_Interface; import com.github.tomap.modeler.model.diagramClass.apackage.A_Package; import com.github.tomap.modeler.model.diagramClass.exception.BadTypeException; import com.github.tomap.modeler.model.diagramClass.multiplicity.DoubleMultiplicity; import com.github.tomap.modeler.model.diagramClass.multiplicity.NoMultiplicity; import com.github.tomap.modeler.model.diagramClass.relation.Agregation; import com.github.tomap.modeler.model.diagramClass.relation.Association; import com.github.tomap.modeler.model.diagramClass.relation.Composition; import com.github.tomap.modeler.model.diagramClass.relation.Generalization; import com.github.tomap.modeler.model.diagramClass.relation.Implementation; import com.github.tomap.modeler.model.diagramClass.relation.N_Relation; import com.github.tomap.modeler.model.diagramClass.relation.SimpleRelation; public class TestRelation { // pour ceux qui veulent faire du Junit ... :) public void testGeneralization() throws BadTypeException { A_Class_Diagram d = new A_Class_Diagram(); A_Package p1 = new A_Package("p1"); d.addPackage(p1); A_Class c1 = new A_Class("c1", false, false, true, p1); p1.addClass(c1); A_Class c2 = new A_Class("c2", false, false, false, p1); p1.addClass(c1); Generalization g = new Generalization(c2, c1); d.addRelation(g); System.out.println(d.display()); } public void testImplementation() throws BadTypeException { A_Class_Diagram d = new A_Class_Diagram(); A_Package p1 = new A_Package("p1"); d.addPackage(p1); A_Class c1 = new A_Class("c1", false, false, true, p1); p1.addClass(c1); An_Interface i1 = new An_Interface("i1", p1); p1.addInterface(i1); Implementation p = new Implementation(c1, i1); d.addRelation(p); System.out.println(d.display()); } public void testComposition() throws BadTypeException { A_Class_Diagram d = new A_Class_Diagram(); A_Package p1 = new A_Package("p1"); d.addPackage(p1); A_Class c1 = new A_Class("c1", false, false, true, p1); p1.addClass(c1); A_Class c2 = new A_Class("c2", false, false, false, p1); p1.addClass(c1); Composition c = new Composition("works"); DoubleMultiplicity m1 = new DoubleMultiplicity(0, 2, "att1",c1,c); DoubleMultiplicity m2 = new DoubleMultiplicity(2,2, "att2", c2, c); c.updateMultiplicities(m1, m2); d.addRelation(c); System.out.println(d.display()); } public void testAgregation() throws BadTypeException { A_Class_Diagram d = new A_Class_Diagram(); A_Package p1 = new A_Package("p1"); d.addPackage(p1); A_Class c1 = new A_Class("c1", false, false, true, p1); p1.addClass(c1); A_Class c2 = new A_Class("c2", false, false, false, p1); p1.addClass(c1); Agregation a = new Agregation("works"); DoubleMultiplicity m1 = new DoubleMultiplicity(0, 2, "att1",c1,a); DoubleMultiplicity m2 = new DoubleMultiplicity(2,2, "att2", c2, a); a.updateMultiplicities(m1, m2); d.addRelation(a); System.out.println(d.display()); } public void testSimpleRelation() throws BadTypeException { A_Class_Diagram d = new A_Class_Diagram(); A_Package p1 = new A_Package("p1"); d.addPackage(p1); A_Class c1 = new A_Class("c1", false, false, true, p1); p1.addClass(c1); A_Class c2 = new A_Class("c2", false, false, false, p1); p1.addClass(c1); SimpleRelation sr = new SimpleRelation("works"); NoMultiplicity m1 = new NoMultiplicity(c1, sr); NoMultiplicity m2 = new NoMultiplicity(c2, sr); sr.updateMultiplicities(m1, m2); d.addRelation(sr); System.out.println(d.display()); } public void testAssociation() throws BadTypeException { A_Class_Diagram d = new A_Class_Diagram(); A_Package p1 = new A_Package("p1"); d.addPackage(p1); A_Class c1 = new A_Class("c1", false, false, true, p1); p1.addClass(c1); A_Class c2 = new A_Class("c2", false, false, false, p1); p1.addClass(c1); A_Class c3 = new A_Class("c3", false, false, true, p1); p1.addClass(c3); Agregation a = new Agregation("works"); DoubleMultiplicity m1 = new DoubleMultiplicity(0, 2, "att1",c1,a); DoubleMultiplicity m2 = new DoubleMultiplicity(2,2, "att2", c2, a); a.updateMultiplicities(m1, m2); Association ass = new Association(c3, a); d.addRelation(ass); System.out.println(d.display()); } public void testAssociationNary() throws BadTypeException { A_Class_Diagram d = new A_Class_Diagram(); A_Package p1 = new A_Package("p1"); d.addPackage(p1); A_Class c1 = new A_Class("c1", false, false, true, p1); p1.addClass(c1); A_Class c2 = new A_Class("c2", false, false, false, p1); p1.addClass(c1); A_Class c3 = new A_Class("c3", false, false, true, p1); p1.addClass(c3); A_Class c4 = new A_Class("c4", false, false, true, p1); p1.addClass(c3); SimpleRelation r = new SimpleRelation(""); DoubleMultiplicity m1 = new DoubleMultiplicity(2,2, "att2", c1, r); DoubleMultiplicity m2 = new DoubleMultiplicity(0, 2, "att2",c2,r); DoubleMultiplicity m3 = new DoubleMultiplicity(0, 7, "att3",c3,r); N_Relation nr = new N_Relation("my association"); nr.addMultiplicity(m1); nr.addMultiplicity(m2); nr.addMultiplicity(m3); Association ass = new Association(c4, nr); d.addRelation(ass); System.out.println(d.display()); } }
UTF-8
Java
5,742
java
TestRelation.java
Java
[]
null
[]
package com.github.tomap.modeler.model.diagramClass.test; import com.github.tomap.modeler.model.diagramClass.A_Class_Diagram; import com.github.tomap.modeler.model.diagramClass.aclass.A_Class; import com.github.tomap.modeler.model.diagramClass.aninterface.An_Interface; import com.github.tomap.modeler.model.diagramClass.apackage.A_Package; import com.github.tomap.modeler.model.diagramClass.exception.BadTypeException; import com.github.tomap.modeler.model.diagramClass.multiplicity.DoubleMultiplicity; import com.github.tomap.modeler.model.diagramClass.multiplicity.NoMultiplicity; import com.github.tomap.modeler.model.diagramClass.relation.Agregation; import com.github.tomap.modeler.model.diagramClass.relation.Association; import com.github.tomap.modeler.model.diagramClass.relation.Composition; import com.github.tomap.modeler.model.diagramClass.relation.Generalization; import com.github.tomap.modeler.model.diagramClass.relation.Implementation; import com.github.tomap.modeler.model.diagramClass.relation.N_Relation; import com.github.tomap.modeler.model.diagramClass.relation.SimpleRelation; public class TestRelation { // pour ceux qui veulent faire du Junit ... :) public void testGeneralization() throws BadTypeException { A_Class_Diagram d = new A_Class_Diagram(); A_Package p1 = new A_Package("p1"); d.addPackage(p1); A_Class c1 = new A_Class("c1", false, false, true, p1); p1.addClass(c1); A_Class c2 = new A_Class("c2", false, false, false, p1); p1.addClass(c1); Generalization g = new Generalization(c2, c1); d.addRelation(g); System.out.println(d.display()); } public void testImplementation() throws BadTypeException { A_Class_Diagram d = new A_Class_Diagram(); A_Package p1 = new A_Package("p1"); d.addPackage(p1); A_Class c1 = new A_Class("c1", false, false, true, p1); p1.addClass(c1); An_Interface i1 = new An_Interface("i1", p1); p1.addInterface(i1); Implementation p = new Implementation(c1, i1); d.addRelation(p); System.out.println(d.display()); } public void testComposition() throws BadTypeException { A_Class_Diagram d = new A_Class_Diagram(); A_Package p1 = new A_Package("p1"); d.addPackage(p1); A_Class c1 = new A_Class("c1", false, false, true, p1); p1.addClass(c1); A_Class c2 = new A_Class("c2", false, false, false, p1); p1.addClass(c1); Composition c = new Composition("works"); DoubleMultiplicity m1 = new DoubleMultiplicity(0, 2, "att1",c1,c); DoubleMultiplicity m2 = new DoubleMultiplicity(2,2, "att2", c2, c); c.updateMultiplicities(m1, m2); d.addRelation(c); System.out.println(d.display()); } public void testAgregation() throws BadTypeException { A_Class_Diagram d = new A_Class_Diagram(); A_Package p1 = new A_Package("p1"); d.addPackage(p1); A_Class c1 = new A_Class("c1", false, false, true, p1); p1.addClass(c1); A_Class c2 = new A_Class("c2", false, false, false, p1); p1.addClass(c1); Agregation a = new Agregation("works"); DoubleMultiplicity m1 = new DoubleMultiplicity(0, 2, "att1",c1,a); DoubleMultiplicity m2 = new DoubleMultiplicity(2,2, "att2", c2, a); a.updateMultiplicities(m1, m2); d.addRelation(a); System.out.println(d.display()); } public void testSimpleRelation() throws BadTypeException { A_Class_Diagram d = new A_Class_Diagram(); A_Package p1 = new A_Package("p1"); d.addPackage(p1); A_Class c1 = new A_Class("c1", false, false, true, p1); p1.addClass(c1); A_Class c2 = new A_Class("c2", false, false, false, p1); p1.addClass(c1); SimpleRelation sr = new SimpleRelation("works"); NoMultiplicity m1 = new NoMultiplicity(c1, sr); NoMultiplicity m2 = new NoMultiplicity(c2, sr); sr.updateMultiplicities(m1, m2); d.addRelation(sr); System.out.println(d.display()); } public void testAssociation() throws BadTypeException { A_Class_Diagram d = new A_Class_Diagram(); A_Package p1 = new A_Package("p1"); d.addPackage(p1); A_Class c1 = new A_Class("c1", false, false, true, p1); p1.addClass(c1); A_Class c2 = new A_Class("c2", false, false, false, p1); p1.addClass(c1); A_Class c3 = new A_Class("c3", false, false, true, p1); p1.addClass(c3); Agregation a = new Agregation("works"); DoubleMultiplicity m1 = new DoubleMultiplicity(0, 2, "att1",c1,a); DoubleMultiplicity m2 = new DoubleMultiplicity(2,2, "att2", c2, a); a.updateMultiplicities(m1, m2); Association ass = new Association(c3, a); d.addRelation(ass); System.out.println(d.display()); } public void testAssociationNary() throws BadTypeException { A_Class_Diagram d = new A_Class_Diagram(); A_Package p1 = new A_Package("p1"); d.addPackage(p1); A_Class c1 = new A_Class("c1", false, false, true, p1); p1.addClass(c1); A_Class c2 = new A_Class("c2", false, false, false, p1); p1.addClass(c1); A_Class c3 = new A_Class("c3", false, false, true, p1); p1.addClass(c3); A_Class c4 = new A_Class("c4", false, false, true, p1); p1.addClass(c3); SimpleRelation r = new SimpleRelation(""); DoubleMultiplicity m1 = new DoubleMultiplicity(2,2, "att2", c1, r); DoubleMultiplicity m2 = new DoubleMultiplicity(0, 2, "att2",c2,r); DoubleMultiplicity m3 = new DoubleMultiplicity(0, 7, "att3",c3,r); N_Relation nr = new N_Relation("my association"); nr.addMultiplicity(m1); nr.addMultiplicity(m2); nr.addMultiplicity(m3); Association ass = new Association(c4, nr); d.addRelation(ass); System.out.println(d.display()); } }
5,742
0.676594
0.646639
191
28.062828
25.708519
83
false
false
0
0
0
0
0
0
2.544503
false
false
7
30205bfc3afdb559412f9b1c7044c90bb766c583
17,274,358,535,156
58d604ec530b3e4f83f91152a04deb94c9074de2
/src/main/java/com/stone/designpattern/adapter/Adapter.java
ae17b402e04ca54782679db29095e1bc89f20c8a
[]
no_license
stonebox1122/stonetools
https://github.com/stonebox1122/stonetools
2dcb696d9205deabe669c91f582348cf6d08db69
afd1a017c7f0b9b2eec7afa1dfb1130fc66f7627
refs/heads/master
2020-05-25T21:47:54.823000
2019-10-11T05:41:17
2019-10-11T05:41:17
188,005,584
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.stone.designpattern.adapter; /** * @author stone * @date 2019/5/23 17:16 * description 通过组合的方式来实现适配器 */ public class Adapter implements Target { private Adaptee adaptee; public Adapter(Adaptee adaptee) { this.adaptee = adaptee; } @Override public void handleReq() { adaptee.print(); } }
UTF-8
Java
373
java
Adapter.java
Java
[ { "context": "e com.stone.designpattern.adapter;\n\n/**\n * @author stone\n * @date 2019/5/23 17:16\n * description 通过组合的方式来实", "end": 62, "score": 0.9989247918128967, "start": 57, "tag": "USERNAME", "value": "stone" } ]
null
[]
package com.stone.designpattern.adapter; /** * @author stone * @date 2019/5/23 17:16 * description 通过组合的方式来实现适配器 */ public class Adapter implements Target { private Adaptee adaptee; public Adapter(Adaptee adaptee) { this.adaptee = adaptee; } @Override public void handleReq() { adaptee.print(); } }
373
0.645533
0.613833
20
16.35
14.55773
40
false
false
0
0
0
0
0
0
0.2
false
false
7
03264aaba23491196b674688b8de64ddd1adc15c
6,442,451,001,323
72b14c285fb4584b571e33f4a273ba549aea0725
/dorandom.java
33d8c626b83bdb7ce3a5b6afa5299ac14b8c6ba4
[]
no_license
priyankakoul12/projects
https://github.com/priyankakoul12/projects
12510c3056c6ae46991d675c1f88fb83e23f5730
a396ca69799e3afe4d3ac865b864a38ff2c5732c
refs/heads/master
2020-12-15T12:59:23.161000
2020-01-20T14:37:18
2020-01-20T14:37:18
235,110,741
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
class dorandom { public static void main(String args[]) { int i=0,count=0; double ans=0; while(ans<10) { double a=Math.random(); System.out.println(a); ans=ans+a; i++; count++; } System.out.println("SUM OF RANDOM NUMBERS IS:"+ans); System.out.println("count is:"+count); } }
UTF-8
Java
302
java
dorandom.java
Java
[]
null
[]
class dorandom { public static void main(String args[]) { int i=0,count=0; double ans=0; while(ans<10) { double a=Math.random(); System.out.println(a); ans=ans+a; i++; count++; } System.out.println("SUM OF RANDOM NUMBERS IS:"+ans); System.out.println("count is:"+count); } }
302
0.622517
0.60596
20
14.15
14.708076
53
false
false
0
0
0
0
0
0
1.8
false
false
7
414cbc65030fabdb53862499ae490d231cf92b15
24,910,810,366,165
562705d85d0892e950daea6dfebf3b23ced1080d
/pay-model/src/main/java/org/andy/pay/page/PageResult.java
b51092a6e2f5cbe75a7315797f9286a860ee76c0
[]
no_license
UserAndy/andy-pay
https://github.com/UserAndy/andy-pay
88b6a6b0e7937e6906a3b6ee13e97e937f42d085
db577ce10c2d480e1e04fe1cdb53bb36d66b0134
refs/heads/master
2020-07-07T09:08:07.792000
2017-03-02T09:31:02
2017-03-02T09:31:02
74,038,208
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.andy.pay.page; import java.util.List; /** * @description: datatables 的分页返回结果 * @author: Andy * @date: 2017-03-02 * @blog: www.andyqian.com */ public class PageResult implements java.io.Serializable { private int draw; /** * 没有过滤的记录数 */ private int recordsTotal; /** * 过滤后的记录数 */ private int recordsFiltered; /** * 数组 */ private List<?> data; /** * 错误信息 */ private String error; public int getDraw() { return draw; } public void setDraw(int draw) { this.draw = draw; } public int getRecordsTotal() { return recordsTotal; } public void setRecordsTotal(int recordsTotal) { this.recordsTotal = recordsTotal; } public int getRecordsFiltered() { return recordsFiltered; } public void setRecordsFiltered(int recordsFiltered) { this.recordsFiltered = recordsFiltered; } public List<?> getData() { return data; } public void setData(List<?> data) { this.data = data; } public String getError() { return error; } public void setError(String error) { this.error = error; } }
UTF-8
Java
1,291
java
PageResult.java
Java
[ { "context": "*\n * @description: datatables 的分页返回结果\n * @author: Andy\n * @date: 2017-03-02\n * @blog: www.andyqian.com\n ", "end": 109, "score": 0.9977877140045166, "start": 105, "tag": "NAME", "value": "Andy" } ]
null
[]
package org.andy.pay.page; import java.util.List; /** * @description: datatables 的分页返回结果 * @author: Andy * @date: 2017-03-02 * @blog: www.andyqian.com */ public class PageResult implements java.io.Serializable { private int draw; /** * 没有过滤的记录数 */ private int recordsTotal; /** * 过滤后的记录数 */ private int recordsFiltered; /** * 数组 */ private List<?> data; /** * 错误信息 */ private String error; public int getDraw() { return draw; } public void setDraw(int draw) { this.draw = draw; } public int getRecordsTotal() { return recordsTotal; } public void setRecordsTotal(int recordsTotal) { this.recordsTotal = recordsTotal; } public int getRecordsFiltered() { return recordsFiltered; } public void setRecordsFiltered(int recordsFiltered) { this.recordsFiltered = recordsFiltered; } public List<?> getData() { return data; } public void setData(List<?> data) { this.data = data; } public String getError() { return error; } public void setError(String error) { this.error = error; } }
1,291
0.574089
0.567611
74
15.689189
15.471793
57
false
false
0
0
0
0
0
0
0.22973
false
false
7
352f8065c6aba06f5d0b09080ba134fc75d71b49
20,203,526,170,100
43f3df5fcd65106ce772d3d3f4632b2ca6daa619
/backend/backend/src/main/java/backend/dto/charts/ChartIncomeEventsDTO.java
2ca22b93b03294bb258bfa373fc65504c2e65eec
[]
no_license
ArpadVS/KTS-NVT_tim9_2019
https://github.com/ArpadVS/KTS-NVT_tim9_2019
68c65067caee3f5e8b8d0d2ad0e2fdc51922f2be
cba64ead02cb5a7da6c0979c5f86c40a145cd1f2
refs/heads/master
2021-06-21T22:04:16.322000
2020-02-09T05:00:33
2020-02-09T05:00:33
218,356,892
0
2
null
false
2021-05-10T21:32:51
2019-10-29T18:34:02
2020-02-09T05:00:37
2021-05-10T21:32:49
27,278
0
2
11
Java
false
false
package backend.dto.charts; public class ChartIncomeEventsDTO { private String eventName; private double income; public ChartIncomeEventsDTO() { super(); } public ChartIncomeEventsDTO(String eventName, double income) { super(); this.eventName = eventName; this.income = income; } public String getEventName() { return eventName; } public void setEventName(String eventName) { this.eventName = eventName; } public double getIncome() { return income; } public void setIncome(double income) { this.income = income; } @Override public String toString() { return "ChartIncomeEventsDTO [eventName=" + eventName + ", income=" + income + "]"; } }
UTF-8
Java
687
java
ChartIncomeEventsDTO.java
Java
[]
null
[]
package backend.dto.charts; public class ChartIncomeEventsDTO { private String eventName; private double income; public ChartIncomeEventsDTO() { super(); } public ChartIncomeEventsDTO(String eventName, double income) { super(); this.eventName = eventName; this.income = income; } public String getEventName() { return eventName; } public void setEventName(String eventName) { this.eventName = eventName; } public double getIncome() { return income; } public void setIncome(double income) { this.income = income; } @Override public String toString() { return "ChartIncomeEventsDTO [eventName=" + eventName + ", income=" + income + "]"; } }
687
0.704512
0.704512
39
16.615385
17.696321
69
false
false
0
0
0
0
0
0
1.358974
false
false
7
646c9df24bba817c72fba3719a7f3d5722e1e2f1
14,413,910,286,798
c019e55c25ac61dd5517237367e71ac067e63e76
/loadview/src/main/java/com/mingle/LoadFrameLayout.java
afab41514f51c2bfe4ab60ef4ff99ec76818e2bb
[]
no_license
zzz40500/Android_LoadLayout
https://github.com/zzz40500/Android_LoadLayout
a680612655f6f89ddfed24f1cb0e4b9592bb4ac7
1bfaf3e31a089b9ae7e9d3cad2367c81703069f7
refs/heads/master
2021-01-21T07:53:35.409000
2015-06-21T18:18:02
2015-06-21T18:18:02
37,820,219
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mingle; import android.annotation.TargetApi; import android.content.Context; import android.content.res.TypedArray; import android.os.Build; import android.util.AttributeSet; import android.util.Log; import android.view.View; import android.widget.FrameLayout; import com.mingle.entity.LoadingViewArg; import com.mingle.loadview.LoadingViewHelp; import com.mingle.loadview.R; import java.util.ArrayList; import java.util.List; /** * Created by zzz40500 on 15/6/10. */ public class LoadFrameLayout extends FrameLayout { private boolean mLoadFinish; private boolean mError=false; private LoadingViewHelp mLoadingViewHelp; private boolean autoDismiss=false; private int mProgressType; private int mProgressColor; private String mLoadText; private int mEmptyView; private List<Action> mDelayed=new ArrayList<>(); private LoadingViewArg mLoadingViewArg=new LoadingViewArg();; public LoadFrameLayout(Context context) { super(context); } public LoadFrameLayout(Context context, AttributeSet attrs) { super(context, attrs); init(attrs); } public LoadFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(attrs); } private void init(AttributeSet attrs) { TypedArray typedArray = getContext() .obtainStyledAttributes(attrs, R.styleable.LoadFrameLayout); autoDismiss= typedArray.getBoolean(R.styleable.LoadFrameLayout_autoDismiss, LoadingViewConfig.getInstance().isAutoDismiss()); mProgressType= typedArray.getInt(R.styleable.LoadFrameLayout_loadViewType, LoadingViewConfig.getInstance().getDefProgressType()); mProgressColor=typedArray.getResourceId(R.styleable.LoadFrameLayout_progressColor,R.color.def_progress_color); mLoadText=typedArray.getString(R.styleable.LoadFrameLayout_loadText); mEmptyView=typedArray.getResourceId(R.styleable.LoadFrameLayout_emptyView,LoadingViewConfig.getInstance().getEmptyViewLayoutId()); typedArray.recycle(); } @TargetApi(Build.VERSION_CODES.LOLLIPOP) public LoadFrameLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); } @Override protected void onFinishInflate() { if(this.getChildCount() != 1) { throw new RuntimeException("the child count must is 1"); }else{ mLoadingViewArg.context=getContext(); mLoadingViewArg.parentVG=this; mLoadingViewArg.contentView=getChildAt(0); mLoadingViewArg.progressColor=mProgressColor; mLoadingViewArg.type=mProgressType; mLoadingViewArg.loadText=mLoadText; mLoadingViewArg.startTime=System.currentTimeMillis(); mLoadingViewArg.emptyViewLayoutId=mEmptyView; mLoadingViewHelp = new LoadingViewHelp(mLoadingViewArg); mLoadingViewHelp.showLoadView(); } super.onFinishInflate(); } public void setError(CharSequence charSequence){ mError=true; mLoadingViewHelp.setError(charSequence); } public void setmError(CharSequence sequence,View.OnClickListener onClickListener){ mError=true; mLoadingViewHelp.setError(sequence, onClickListener); } public void setErrorClickListener(View.OnClickListener onClickListener){ mLoadingViewHelp.setErrorClickListener(onClickListener); } /** * @param changed * @param left * @param top * @param right * @param bottom */ @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { Log.e("'","onLayout"); if( mLoadFinish&&! mError && autoDismiss){ if(System.currentTimeMillis()-mLoadingViewArg.startTime >100) { mLoadingViewHelp.dismissLoadView(); for(Action action: mDelayed){ action.action(); } mDelayed.clear(); } } super.onLayout(changed, left, top, right, bottom); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); Log.e("'","onMeasure"); } public void showLoadView(){ mError=false; mLoadingViewArg.startTime=System.currentTimeMillis(); mLoadingViewHelp.showLoadView(); } public void dismissLoadView(){ mLoadingViewHelp.dismissLoadView(); } public void setEorrText(CharSequence sequence){ mLoadingViewHelp.setError(sequence); } /** * 因为在4.0 上面的话,调用了onWindowFocusChanged之后会调用 onLayout的方法, * 在5.0上面的话,调用了onWindowFocusChanged 不在调用onLayout 的方法 * 为了避免这个事情,所以加了这个加以判断. */ @Override public void onWindowFocusChanged(boolean hasWindowFocus) { super.onWindowFocusChanged(hasWindowFocus); mLoadFinish=hasWindowFocus; if(hasWindowFocus){ mLoadingViewArg.startTime=System.currentTimeMillis(); mLoadingViewHelp.onWindowFocused(); } Log.e("'onWindowFocusChanged","onWindowFocusChanged "+hasWindowFocus); } public void addDelayedAction(Action action){ mDelayed.add(action); } }
UTF-8
Java
5,521
java
LoadFrameLayout.java
Java
[ { "context": "rayList;\nimport java.util.List;\n\n/**\n * Created by zzz40500 on 15/6/10.\n */\npublic class LoadFrameLayout exte", "end": 469, "score": 0.9994773268699646, "start": 461, "tag": "USERNAME", "value": "zzz40500" } ]
null
[]
package com.mingle; import android.annotation.TargetApi; import android.content.Context; import android.content.res.TypedArray; import android.os.Build; import android.util.AttributeSet; import android.util.Log; import android.view.View; import android.widget.FrameLayout; import com.mingle.entity.LoadingViewArg; import com.mingle.loadview.LoadingViewHelp; import com.mingle.loadview.R; import java.util.ArrayList; import java.util.List; /** * Created by zzz40500 on 15/6/10. */ public class LoadFrameLayout extends FrameLayout { private boolean mLoadFinish; private boolean mError=false; private LoadingViewHelp mLoadingViewHelp; private boolean autoDismiss=false; private int mProgressType; private int mProgressColor; private String mLoadText; private int mEmptyView; private List<Action> mDelayed=new ArrayList<>(); private LoadingViewArg mLoadingViewArg=new LoadingViewArg();; public LoadFrameLayout(Context context) { super(context); } public LoadFrameLayout(Context context, AttributeSet attrs) { super(context, attrs); init(attrs); } public LoadFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(attrs); } private void init(AttributeSet attrs) { TypedArray typedArray = getContext() .obtainStyledAttributes(attrs, R.styleable.LoadFrameLayout); autoDismiss= typedArray.getBoolean(R.styleable.LoadFrameLayout_autoDismiss, LoadingViewConfig.getInstance().isAutoDismiss()); mProgressType= typedArray.getInt(R.styleable.LoadFrameLayout_loadViewType, LoadingViewConfig.getInstance().getDefProgressType()); mProgressColor=typedArray.getResourceId(R.styleable.LoadFrameLayout_progressColor,R.color.def_progress_color); mLoadText=typedArray.getString(R.styleable.LoadFrameLayout_loadText); mEmptyView=typedArray.getResourceId(R.styleable.LoadFrameLayout_emptyView,LoadingViewConfig.getInstance().getEmptyViewLayoutId()); typedArray.recycle(); } @TargetApi(Build.VERSION_CODES.LOLLIPOP) public LoadFrameLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); } @Override protected void onFinishInflate() { if(this.getChildCount() != 1) { throw new RuntimeException("the child count must is 1"); }else{ mLoadingViewArg.context=getContext(); mLoadingViewArg.parentVG=this; mLoadingViewArg.contentView=getChildAt(0); mLoadingViewArg.progressColor=mProgressColor; mLoadingViewArg.type=mProgressType; mLoadingViewArg.loadText=mLoadText; mLoadingViewArg.startTime=System.currentTimeMillis(); mLoadingViewArg.emptyViewLayoutId=mEmptyView; mLoadingViewHelp = new LoadingViewHelp(mLoadingViewArg); mLoadingViewHelp.showLoadView(); } super.onFinishInflate(); } public void setError(CharSequence charSequence){ mError=true; mLoadingViewHelp.setError(charSequence); } public void setmError(CharSequence sequence,View.OnClickListener onClickListener){ mError=true; mLoadingViewHelp.setError(sequence, onClickListener); } public void setErrorClickListener(View.OnClickListener onClickListener){ mLoadingViewHelp.setErrorClickListener(onClickListener); } /** * @param changed * @param left * @param top * @param right * @param bottom */ @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { Log.e("'","onLayout"); if( mLoadFinish&&! mError && autoDismiss){ if(System.currentTimeMillis()-mLoadingViewArg.startTime >100) { mLoadingViewHelp.dismissLoadView(); for(Action action: mDelayed){ action.action(); } mDelayed.clear(); } } super.onLayout(changed, left, top, right, bottom); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); Log.e("'","onMeasure"); } public void showLoadView(){ mError=false; mLoadingViewArg.startTime=System.currentTimeMillis(); mLoadingViewHelp.showLoadView(); } public void dismissLoadView(){ mLoadingViewHelp.dismissLoadView(); } public void setEorrText(CharSequence sequence){ mLoadingViewHelp.setError(sequence); } /** * 因为在4.0 上面的话,调用了onWindowFocusChanged之后会调用 onLayout的方法, * 在5.0上面的话,调用了onWindowFocusChanged 不在调用onLayout 的方法 * 为了避免这个事情,所以加了这个加以判断. */ @Override public void onWindowFocusChanged(boolean hasWindowFocus) { super.onWindowFocusChanged(hasWindowFocus); mLoadFinish=hasWindowFocus; if(hasWindowFocus){ mLoadingViewArg.startTime=System.currentTimeMillis(); mLoadingViewHelp.onWindowFocused(); } Log.e("'onWindowFocusChanged","onWindowFocusChanged "+hasWindowFocus); } public void addDelayedAction(Action action){ mDelayed.add(action); } }
5,521
0.684259
0.680568
181
28.939226
29.078512
138
false
false
0
0
0
0
0
0
0.60221
false
false
7
2cb352503e152c3e7ba739fea27007e79e4a331c
27,238,682,618,228
84c243342eb60e2e26a2b1253a3092feea71c772
/item/caisign/src/main/java/com/jby/caisign/service/impl/SignSvcImpl.java
55cff90a805b4a98a95fee9b15d01ee9421e6345
[]
no_license
szb24680/demo
https://github.com/szb24680/demo
593bb00960a8f1fd01099de5315b0eb702d4e3d1
b600d9feb262d8a62a1b994f3f40cb1be8fe21c2
refs/heads/master
2020-04-07T04:34:23.873000
2018-11-18T08:12:52
2018-11-18T08:12:52
158,062,582
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jby.caisign.service.impl; import java.util.List; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.jby.caisign.dao.SignDao; import com.jby.caisign.service.SignSvc; @Service public class SignSvcImpl implements SignSvc { private static Logger logger = LoggerFactory.getLogger(SignSvcImpl.class); @Autowired SignDao signDao; @Override public List<Map<String, Object>> findByCondition(String stamp) { logger.info("---------->【根据条件查询印章日志信息】service start-----------"); List<Map<String, Object>> signs = signDao.findByCondition(stamp); logger.info("---------->【根据条件查询印章日志信息】service end-----------"); return signs; } @Override public Integer usedCount(String orginazition) { logger.info("---------->【查询印章使用次数--企业】service start-----------"); Integer count = signDao.usedCount(orginazition); logger.info("---------->【查询印章使用次数--企业】service end-----------"); return count; } @Override public Integer usedCount1(String userId) { logger.info("---------->【查询印章使用次数--用户】service start-----------"); Integer count = signDao.usedCount1(userId); logger.info("---------->【查询印章使用次数--用户】service end-----------"); return count; } @Override public List<Map<String, Object>> findByCondition(String orginazitionId, String documentName, String userName) { logger.info("---------->【查询印章使用次数】service start-----------"); List<Map<String, Object>> signs = signDao.findByCondition(orginazitionId, documentName, userName); logger.info("---------->【查询印章使用次数】service end-----------"); return signs; } }
UTF-8
Java
1,881
java
SignSvcImpl.java
Java
[]
null
[]
package com.jby.caisign.service.impl; import java.util.List; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.jby.caisign.dao.SignDao; import com.jby.caisign.service.SignSvc; @Service public class SignSvcImpl implements SignSvc { private static Logger logger = LoggerFactory.getLogger(SignSvcImpl.class); @Autowired SignDao signDao; @Override public List<Map<String, Object>> findByCondition(String stamp) { logger.info("---------->【根据条件查询印章日志信息】service start-----------"); List<Map<String, Object>> signs = signDao.findByCondition(stamp); logger.info("---------->【根据条件查询印章日志信息】service end-----------"); return signs; } @Override public Integer usedCount(String orginazition) { logger.info("---------->【查询印章使用次数--企业】service start-----------"); Integer count = signDao.usedCount(orginazition); logger.info("---------->【查询印章使用次数--企业】service end-----------"); return count; } @Override public Integer usedCount1(String userId) { logger.info("---------->【查询印章使用次数--用户】service start-----------"); Integer count = signDao.usedCount1(userId); logger.info("---------->【查询印章使用次数--用户】service end-----------"); return count; } @Override public List<Map<String, Object>> findByCondition(String orginazitionId, String documentName, String userName) { logger.info("---------->【查询印章使用次数】service start-----------"); List<Map<String, Object>> signs = signDao.findByCondition(orginazitionId, documentName, userName); logger.info("---------->【查询印章使用次数】service end-----------"); return signs; } }
1,881
0.681468
0.6791
54
30.277779
29.264071
112
false
false
0
0
0
0
0
0
1.574074
false
false
7
fa08c300017739aebdd85d5e88848a92a017c396
30,863,635,014,856
651fd32266317562b2f29f657e2c5ad810b49c3a
/platform/services/entity/src/main/java/com/e3framework/platform/services/entity/model/common/place/local/location/LocalLocationRelationship.java
d19090f93f4790e3d2066985b9b033d01758b97b
[]
no_license
truongdk/grootee
https://github.com/truongdk/grootee
f5079813a7edaba0370f3e57c2e3aabe2d0e9ec9
087c50f24144bb8eaee9545d112ab26bc5f4a85b
refs/heads/master
2020-04-28T01:10:02.968000
2019-09-30T05:56:34
2019-09-30T05:56:34
174,844,285
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.e3framework.platform.services.entity.model.common.place.local.location; import com.e3framework.platform.services.entity.model.base.association.Relationship; /** * An association between two LocalLocations. * _____________________________________________________________________ * Physical_Model_Classname : LocalLocation.java * Logical_Model_Classname : Local Location * Logical_Model_id: DaRM_123456789 * * Object type : Entity * Is leaf : false * Is abstract : true * Persistent object : false * _____________________________________________________________________ * * Status : published-completed * Diagram check : NON * */ public class LocalLocationRelationship extends Relationship { /** * The role the association between the two LocalLocations plays. */ protected String role; /** * Association End * * Status : published */ protected LocalLocation source; /** * Association End * * Status : published */ protected LocalLocation target; /*--COMPLETED--*/ }
UTF-8
Java
1,077
java
LocalLocationRelationship.java
Java
[]
null
[]
package com.e3framework.platform.services.entity.model.common.place.local.location; import com.e3framework.platform.services.entity.model.base.association.Relationship; /** * An association between two LocalLocations. * _____________________________________________________________________ * Physical_Model_Classname : LocalLocation.java * Logical_Model_Classname : Local Location * Logical_Model_id: DaRM_123456789 * * Object type : Entity * Is leaf : false * Is abstract : true * Persistent object : false * _____________________________________________________________________ * * Status : published-completed * Diagram check : NON * */ public class LocalLocationRelationship extends Relationship { /** * The role the association between the two LocalLocations plays. */ protected String role; /** * Association End * * Status : published */ protected LocalLocation source; /** * Association End * * Status : published */ protected LocalLocation target; /*--COMPLETED--*/ }
1,077
0.588672
0.578459
44
23.477272
24.144911
84
false
false
0
0
0
0
0
0
0.113636
false
false
7
3e018e79f54c09513a55561f7caa625f01106100
21,294,447,896,602
b0296d820c0400440232152485a0b3dff3e943be
/GTAS/GridTalk/src/Client/com/gridnode/gtas/client/web/renderers/ISimpleResourceLookup.java
02e069379a466a2a3ea6ea3b3f052bafc605aa56
[]
no_license
andytanoko/4.2.x_integration
https://github.com/andytanoko/4.2.x_integration
74536c8933a98373b0118eeac66678b72b00aa8e
984842d92abaa797a19bd0f002ec45c9c37da288
refs/heads/master
2021-01-10T13:46:58.824000
2015-09-23T10:41:25
2015-09-23T10:41:25
46,325,977
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * This software is the proprietary information of GridNode Pte Ltd. * Use is subjected to license terms. * * Copyright 2001-2002 (C) GridNode Pte Ltd. All Rights Reserved. * * File: ISimpleResourceLookup.java * **************************************************************************** * Date Author Changes **************************************************************************** * 2002-06-03 Andrew Hill Created * 2002-10-28 Andrew Hill Method supporting params added * 2003-01-07 Andrew Hill getLocale() */ package com.gridnode.gtas.client.web.renderers; import java.util.*; public interface ISimpleResourceLookup { public String getMessage(String key); public String getMessage(String key, Object[] params); public Locale getLocale(); //20030107AH }
UTF-8
Java
844
java
ISimpleResourceLookup.java
Java
[ { "context": "********************************\n * 2002-06-03 Andrew Hill Created\n * 2002-10-28 Andrew Hill ", "end": 453, "score": 0.9997575283050537, "start": 442, "tag": "NAME", "value": "Andrew Hill" }, { "context": " Andrew Hill Created\n * 2002-1...
null
[]
/** * This software is the proprietary information of GridNode Pte Ltd. * Use is subjected to license terms. * * Copyright 2001-2002 (C) GridNode Pte Ltd. All Rights Reserved. * * File: ISimpleResourceLookup.java * **************************************************************************** * Date Author Changes **************************************************************************** * 2002-06-03 <NAME> Created * 2002-10-28 <NAME> Method supporting params added * 2003-01-07 <NAME> getLocale() */ package com.gridnode.gtas.client.web.renderers; import java.util.*; public interface ISimpleResourceLookup { public String getMessage(String key); public String getMessage(String key, Object[] params); public Locale getLocale(); //20030107AH }
829
0.556872
0.509479
25
32.799999
26.731255
77
false
false
0
0
0
0
0
0
0.24
false
false
7
f2d0f04c6282d6167951b59a0147d4f968acfdf5
25,829,933,335,434
959e6688d2935fa3c48e40a32e749a2897734083
/src/animalchess/GameTest.java
43e06f8e08f9ee6c334448409df841bac693ede7
[]
no_license
ConorJEM/Animal_Chess
https://github.com/ConorJEM/Animal_Chess
e506eeb94ae9686f49f086911fc9078237ebffd7
90e0644ab86992bd4e8a06ab5389a2f80e6889be
refs/heads/main
2023-08-28T05:28:07.407000
2021-10-29T10:30:18
2021-10-29T10:30:18
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package game_tests; import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; import animalchess.*; import java.util.List; public class GameTest { private Game myGame; private Player p0; private Player p1; @Before public void setup() { p0 = new Player("Michael", 0); p1 = new Player("Oz", 1); myGame = new Game(p0, p1); } @Test public void testGameExists() { assertNotNull(myGame); } @Test public void testGetPlayer() { assertEquals(myGame.getPlayer(0), p0); assertEquals(myGame.getPlayer(1), p1); } @Test(expected = IllegalArgumentException.class) public void testGetPlayerBad() { myGame.getPlayer(3); fail("the last line was supposed to throw an IllegalArgumentException"); } @Test public void testGetWinnerNone() { assertNull(myGame.getWinner()); } @Test public void testGetWinnerP0() { p0.winGame(); assertNotNull(myGame.getWinner()); assertEquals(myGame.getWinner(), p0); } @Test public void testGetSquareEmpty() { Square emptySquare = myGame.getSquare(1,0); assertNull(emptySquare.getPiece()); } @Test public void testGetSquareLion() { Square lionSquare = myGame.getSquare(0,2); Piece p0Lion = lionSquare.getPiece(); assertNotNull(p0Lion); assertTrue(p0Lion instanceof Lion); } @Test public void fullGame() { // This last test plays out a full game, from the beginning, // checking various properties along the way. // P0 moves first, moves his right-side chick to (3,3) (takes P1's chick) Chick chick0r = (Chick) myGame.getSquare(2, 3).getPiece(); chick0r.move(myGame.getSquare(3, 3)); assertEquals(1, p0.getHand().size()); assertFalse(chick0r.getIsPromoted()); // P1 moves right-side cat diagonally forward to (4,3) Piece cat1r = myGame.getSquare(5, 4).getPiece(); cat1r.move(myGame.getSquare(4, 3)); assertEquals(0, p1.getHand().size()); assertEquals(4, cat1r.getSquare().getRow()); // P0 moves his lion forward to (1,2) Piece lion0 = myGame.getSquare(0, 2).getPiece(); assertTrue(lion0 instanceof Lion); assertEquals(3, lion0.getLegalMoves().size()); lion0.move(myGame.getSquare(1, 2)); assertEquals(4, lion0.getLegalMoves().size()); // P1 moves his right-hand giraffe sideways Giraffe giraffe1r = (Giraffe) myGame.getSquare(5, 3).getPiece(); giraffe1r.move(myGame.getSquare(5, 4)); assertEquals(4, giraffe1r.getSquare().getCol()); assertNull(myGame.getSquare(5, 3).getPiece()); // P0's right-hand chick takes P1's cat, and promotes chick0r.move(cat1r.getSquare()); assertEquals(4, chick0r.getSquare().getRow()); assertEquals(2, p0.getHand().size()); assertTrue(p0.getHand().contains(cat1r)); assertTrue(chick0r.getIsPromoted()); // P1 takes back with his right-hand giraffe giraffe1r.move(myGame.getSquare(4, 3)); // Note: this move is illegal. assertFalse(chick0r.getIsPromoted()); // chick unpromotes when taken assertEquals(p1, chick0r.getOwner()); // P1 owns the chick now assertEquals(1, p1.getHand().size()); // P0 drops the cat he captured earlier assertNull(cat1r.getSquare()); p0.dropPiece(cat1r, myGame.getSquare(4, 2)); assertEquals(1, p0.getHand().size()); // P1 advances his central chick Chick chick1c = (Chick) myGame.getSquare(3, 2).getPiece(); List<Square> moves = chick1c.getLegalMoves(); assertEquals(1, moves.size()); Square toSquare = moves.get(0); assertNotNull(toSquare.getPiece()); // contains P0's chick chick1c.move(toSquare); // take P0's chick assertEquals(2, p1.getHand().size()); // P0 moves his lion to the right Square square12 = myGame.getSquare(1, 2); assertEquals(lion0, square12.getPiece()); assertEquals(5, lion0.getLegalMoves().size()); lion0.move(myGame.getSquare(1, 3)); assertEquals(3, lion0.getSquare().getCol()); // P1 advances his central chick into the gap and it promotes assertFalse(chick1c.getIsPromoted()); assertNull(square12.getPiece()); chick1c.move(square12); assertNotNull(square12.getPiece()); assertTrue(chick1c.getIsPromoted()); // P0 drops a chick on the centre file Piece chick0new = p0.getHand().get(0); p0.dropPiece(chick0new, myGame.getSquare(3, 2)); assertTrue(p0.getHand().isEmpty()); assertTrue(chick0new.getLegalMoves().isEmpty()); // P1's promoted chick takes P0's lion! chick1c.move(lion0.getSquare()); assertEquals(p1, myGame.getWinner()); assertTrue(p1.hasWon()); assertFalse(p0.hasWon()); } }
UTF-8
Java
5,039
java
GameTest.java
Java
[ { "context": " public void setup() {\n p0 = new Player(\"Michael\", 0);\n p1 = new Player(\"Oz\", 1);\n m", "end": 319, "score": 0.9996446967124939, "start": 312, "tag": "NAME", "value": "Michael" }, { "context": "ew Player(\"Michael\", 0);\n p1 = new Pl...
null
[]
package game_tests; import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; import animalchess.*; import java.util.List; public class GameTest { private Game myGame; private Player p0; private Player p1; @Before public void setup() { p0 = new Player("Michael", 0); p1 = new Player("Oz", 1); myGame = new Game(p0, p1); } @Test public void testGameExists() { assertNotNull(myGame); } @Test public void testGetPlayer() { assertEquals(myGame.getPlayer(0), p0); assertEquals(myGame.getPlayer(1), p1); } @Test(expected = IllegalArgumentException.class) public void testGetPlayerBad() { myGame.getPlayer(3); fail("the last line was supposed to throw an IllegalArgumentException"); } @Test public void testGetWinnerNone() { assertNull(myGame.getWinner()); } @Test public void testGetWinnerP0() { p0.winGame(); assertNotNull(myGame.getWinner()); assertEquals(myGame.getWinner(), p0); } @Test public void testGetSquareEmpty() { Square emptySquare = myGame.getSquare(1,0); assertNull(emptySquare.getPiece()); } @Test public void testGetSquareLion() { Square lionSquare = myGame.getSquare(0,2); Piece p0Lion = lionSquare.getPiece(); assertNotNull(p0Lion); assertTrue(p0Lion instanceof Lion); } @Test public void fullGame() { // This last test plays out a full game, from the beginning, // checking various properties along the way. // P0 moves first, moves his right-side chick to (3,3) (takes P1's chick) Chick chick0r = (Chick) myGame.getSquare(2, 3).getPiece(); chick0r.move(myGame.getSquare(3, 3)); assertEquals(1, p0.getHand().size()); assertFalse(chick0r.getIsPromoted()); // P1 moves right-side cat diagonally forward to (4,3) Piece cat1r = myGame.getSquare(5, 4).getPiece(); cat1r.move(myGame.getSquare(4, 3)); assertEquals(0, p1.getHand().size()); assertEquals(4, cat1r.getSquare().getRow()); // P0 moves his lion forward to (1,2) Piece lion0 = myGame.getSquare(0, 2).getPiece(); assertTrue(lion0 instanceof Lion); assertEquals(3, lion0.getLegalMoves().size()); lion0.move(myGame.getSquare(1, 2)); assertEquals(4, lion0.getLegalMoves().size()); // P1 moves his right-hand giraffe sideways Giraffe giraffe1r = (Giraffe) myGame.getSquare(5, 3).getPiece(); giraffe1r.move(myGame.getSquare(5, 4)); assertEquals(4, giraffe1r.getSquare().getCol()); assertNull(myGame.getSquare(5, 3).getPiece()); // P0's right-hand chick takes P1's cat, and promotes chick0r.move(cat1r.getSquare()); assertEquals(4, chick0r.getSquare().getRow()); assertEquals(2, p0.getHand().size()); assertTrue(p0.getHand().contains(cat1r)); assertTrue(chick0r.getIsPromoted()); // P1 takes back with his right-hand giraffe giraffe1r.move(myGame.getSquare(4, 3)); // Note: this move is illegal. assertFalse(chick0r.getIsPromoted()); // chick unpromotes when taken assertEquals(p1, chick0r.getOwner()); // P1 owns the chick now assertEquals(1, p1.getHand().size()); // P0 drops the cat he captured earlier assertNull(cat1r.getSquare()); p0.dropPiece(cat1r, myGame.getSquare(4, 2)); assertEquals(1, p0.getHand().size()); // P1 advances his central chick Chick chick1c = (Chick) myGame.getSquare(3, 2).getPiece(); List<Square> moves = chick1c.getLegalMoves(); assertEquals(1, moves.size()); Square toSquare = moves.get(0); assertNotNull(toSquare.getPiece()); // contains P0's chick chick1c.move(toSquare); // take P0's chick assertEquals(2, p1.getHand().size()); // P0 moves his lion to the right Square square12 = myGame.getSquare(1, 2); assertEquals(lion0, square12.getPiece()); assertEquals(5, lion0.getLegalMoves().size()); lion0.move(myGame.getSquare(1, 3)); assertEquals(3, lion0.getSquare().getCol()); // P1 advances his central chick into the gap and it promotes assertFalse(chick1c.getIsPromoted()); assertNull(square12.getPiece()); chick1c.move(square12); assertNotNull(square12.getPiece()); assertTrue(chick1c.getIsPromoted()); // P0 drops a chick on the centre file Piece chick0new = p0.getHand().get(0); p0.dropPiece(chick0new, myGame.getSquare(3, 2)); assertTrue(p0.getHand().isEmpty()); assertTrue(chick0new.getLegalMoves().isEmpty()); // P1's promoted chick takes P0's lion! chick1c.move(lion0.getSquare()); assertEquals(p1, myGame.getWinner()); assertTrue(p1.hasWon()); assertFalse(p0.hasWon()); } }
5,039
0.620758
0.589601
151
32.370861
22.511106
81
false
false
0
0
0
0
0
0
0.860927
false
false
7
5f0e45ecd1a0930156d9a20b8f28aad403c1d859
4,724,464,060,405
febd4d6ce30895758001196383d2c710dc74a592
/Challenges-Arrays/src/TargetSumriplets.java
47be5b3408bfd8edfa306074b5ce25ad21ef6080
[]
no_license
anugrahrastogi123/Java-Programming
https://github.com/anugrahrastogi123/Java-Programming
49c1777840e4d1f3e09dd9c553fbd55b692c0427
bd99ba1a95f71e93da449a4c3ae065ca3a2c7bef
refs/heads/master
2021-04-11T23:26:55.056000
2021-03-11T20:25:15
2021-03-11T20:25:15
249,064,277
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Arrays; import java.util.Scanner; public class TargetSumriplets { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int[] arr = new int[n]; for(int i = 0; i < n; i++) { arr[i] = s.nextInt(); } Arrays.sort(arr); int target = s.nextInt(); for(int i = 0; i <= n - 3; i++) { int sum = target - arr[i]; int left = i+1, right = n-1; while(left < right) { if(arr[left] + arr[right] == sum) { System.out.println(arr[i]+", "+arr[left]+" and "+arr[right]); left++; right--; } else if(arr[left] + arr[right] > sum) { right--; } else { left++; } } } } }
UTF-8
Java
729
java
TargetSumriplets.java
Java
[]
null
[]
import java.util.Arrays; import java.util.Scanner; public class TargetSumriplets { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int[] arr = new int[n]; for(int i = 0; i < n; i++) { arr[i] = s.nextInt(); } Arrays.sort(arr); int target = s.nextInt(); for(int i = 0; i <= n - 3; i++) { int sum = target - arr[i]; int left = i+1, right = n-1; while(left < right) { if(arr[left] + arr[right] == sum) { System.out.println(arr[i]+", "+arr[left]+" and "+arr[right]); left++; right--; } else if(arr[left] + arr[right] > sum) { right--; } else { left++; } } } } }
729
0.499314
0.492455
45
15.2
15.435313
66
false
false
0
0
0
0
0
0
2.866667
false
false
7
730246744c9021c3c2853a5683e4b0b852da8c34
23,192,823,424,533
4f79d163f4f4dc6e6032d1de8b86deb3abd7cf29
/app/src/main/java/com/djacoronel/tasknotes/Tab1Fragment.java
69956833e0907a9a6cbc6628e60fd070d2d03df3
[]
no_license
djacoronel/TaskNotes
https://github.com/djacoronel/TaskNotes
308a5335bf3a6bd89048a1860700f0b95257635f
06fc15f49960c5c20dc7005400316478d2d7eaea
refs/heads/master
2021-01-19T13:03:41.324000
2017-09-17T05:50:26
2017-09-17T05:50:26
82,362,560
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.djacoronel.tasknotes; import android.content.DialogInterface; import android.database.Cursor; import android.os.Bundle; import android.app.Fragment; import android.support.design.widget.Snackbar; import android.support.v7.app.AlertDialog; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearSmoothScroller; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.helper.ItemTouchHelper; import android.util.DisplayMetrics; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; import java.util.Comparator; import java.util.GregorianCalendar; public class Tab1Fragment extends Fragment implements DatePickerDialog.OnDateSetListener, RecyclerAdapter.MethodCaller, TagAdapter.MethodCaller{ RecyclerView recyclerView; RecyclerView.LayoutManager layoutManager; RecyclerAdapter adapter; TasksDbAdapter mDbAdapter; RelativeLayout emptyScreen; ArrayList<Task> tasks = new ArrayList<>(); public Tab1Fragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.fragment_tab1, container, false); emptyScreen = (RelativeLayout) rootView.findViewById(R.id.empty_screen); mDbAdapter = new TasksDbAdapter(rootView.getContext()); mDbAdapter.open(); fillData(); layoutManager = new LinearLayoutManager(rootView.getContext()) { @Override public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, int position) { LinearSmoothScroller smoothScroller = new LinearSmoothScroller(rootView.getContext()) { @Override protected float calculateSpeedPerPixel(DisplayMetrics displayMetrics) { return 75f / displayMetrics.densityDpi; } }; smoothScroller.setTargetPosition(position); startSmoothScroll(smoothScroller); } }; adapter = new RecyclerAdapter(tasks, mDbAdapter, this); adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() { @Override public void onChanged() { super.onChanged(); checkAdapterIsEmpty(); } @Override public void onItemRangeInserted(int positionStart, int itemCount) { super.onItemRangeInserted(positionStart, itemCount); checkAdapterIsEmpty(); } @Override public void onItemRangeChanged(int positionStart, int itemCount) { super.onItemRangeChanged(positionStart, itemCount); checkAdapterIsEmpty(); } @Override public void onItemRangeRemoved(int positionStart, int itemCount) { super.onItemRangeRemoved(positionStart, itemCount); checkAdapterIsEmpty(); } }); recyclerView = (RecyclerView) rootView.findViewById(R.id.recycler_view); recyclerView.setLayoutManager(layoutManager); recyclerView.setAdapter(adapter); ItemTouchHelper.Callback callback = new SwipeRightHelper(adapter, listener); ItemTouchHelper helper = new ItemTouchHelper(callback); helper.attachToRecyclerView(recyclerView); checkAdapterIsEmpty(); return rootView; } private void fillData() { Cursor notesCursor = mDbAdapter.fetchAllTasks(); if (notesCursor != null && notesCursor.moveToFirst()) { do { long id = notesCursor.getLong(notesCursor.getColumnIndex("_id")); String title = notesCursor.getString(notesCursor.getColumnIndex("title")); String text = notesCursor.getString(notesCursor.getColumnIndex("body")); String date = notesCursor.getString(notesCursor.getColumnIndex("date")); String tag = notesCursor.getString(notesCursor.getColumnIndex("tag")); String dateFinished = ""; String priority = notesCursor.getString(notesCursor.getColumnIndex("priority")); tasks.add(new Task(id, title, text, date, dateFinished, priority, tag)); } while (notesCursor.moveToNext()); sortTasks(); } } public void checkAdapterIsEmpty() { if (tasks.isEmpty()) { emptyScreen.setVisibility(View.VISIBLE); } else { emptyScreen.setVisibility(View.GONE); } } public void sortTasks() { Collections.sort(tasks, new Comparator<Task>() { @Override public int compare(Task t1, Task t2) { int returnVal = 0; if (!t1.getDate().isEmpty() && !t2.getDate().isEmpty()) { String dayDate1[] = t1.getDate().split(" "); String date1[] = dayDate1[1].split("/"); String dayDate2[] = t2.getDate().split(" "); String date2[] = dayDate2[1].split("/"); if (Integer.parseInt(date1[0]) < Integer.parseInt(date2[0])) { returnVal = -1; } else if (Integer.parseInt(date1[0]) > Integer.parseInt(date2[0])) { returnVal = 1; } else if (Integer.parseInt(date1[0]) == Integer.parseInt(date2[0])) { if (Integer.parseInt(date1[1]) < Integer.parseInt(date2[1])) { returnVal = -1; } else if (Integer.parseInt(date1[1]) > Integer.parseInt(date2[1])) { returnVal = 1; } else if (Integer.parseInt(date1[1]) == Integer.parseInt(date2[1])) { if (!t1.getPriority().isEmpty() && !t2.getPriority().isEmpty()) { returnVal = -t1.getPriority().compareTo(t2.getPriority()); } else if (t1.getPriority().isEmpty() && !t2.getPriority().isEmpty()) { returnVal = 1; } else if (!t1.getPriority().isEmpty() && t2.getPriority().isEmpty()) { returnVal = -1; } } } } else if (!t1.getDate().isEmpty() && t2.getDate().isEmpty()) { returnVal = -1; } else if (t1.getDate().isEmpty() && !t2.getDate().isEmpty()) { returnVal = 1; } else if (t1.getDate().isEmpty() && t2.getDate().isEmpty()) { if (!t1.getPriority().isEmpty() && !t2.getPriority().isEmpty()) { returnVal = -t1.getPriority().compareTo(t2.getPriority()); } else if (t1.getPriority().isEmpty() && !t2.getPriority().isEmpty()) { returnVal = 1; } else if (!t1.getPriority().isEmpty() && t2.getPriority().isEmpty()) { returnVal = -1; } } return returnVal; } }); } EditText editTitle, editText; TextView setDue, setPriority, setTag; String selectedTag = "All Tasks"; public void addTask() { LayoutInflater layoutInflaterAndroid = LayoutInflater.from(getActivity()); final View mView = layoutInflaterAndroid.inflate(R.layout.add_task_layout, null); editTitle = (EditText) mView.findViewById(R.id.edit_title); editText = (EditText) mView.findViewById(R.id.edit_text); setDue = (TextView) mView.findViewById(R.id.set_due); setPriority = (TextView) mView.findViewById(R.id.set_priority); setTag = (TextView) mView.findViewById(R.id.set_tag); if(!selectedTag.equals("All Tasks")) setTag.setText(selectedTag); setDue.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { setDue(); return false; } }); setPriority.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { setPriority(); return false; } }); setTag.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { setTag(); return false; } }); final AlertDialog addTaskDialog = new AlertDialog .Builder(mView.getContext()) .setView(mView) .setCancelable(true) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogBox, int id) { dialogBox.cancel(); } }) .setPositiveButton("Add", null) .create(); addTaskDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); addTaskDialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { final Button buttonPositive = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE); buttonPositive.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String title = editTitle.getText().toString(); String text = editText.getText().toString(); String due; String priority; String tag; if (!title.isEmpty() || !text.isEmpty()) { if (!setDue.getText().toString().equals("Set Due")) due = setDue.getText().toString(); else due = ""; if (!setPriority.getText().toString().trim().equals("Set Priority")) priority = setPriority.getText().toString(); else priority = ""; if (!setTag.getText().toString().trim().equals("Set Tag")) tag = setTag.getText().toString(); else tag = ""; layoutManager.smoothScrollToPosition(recyclerView, null, adapter.add(title, text, due, priority, tag)); addTaskDialog.dismiss(); } else { final Snackbar snackbar = Snackbar.make(mView, "ADD TASK CONTENT", Snackbar.LENGTH_LONG); snackbar.setAction("OKAY", new View.OnClickListener() { @Override public void onClick(View v) { snackbar.dismiss(); } }); snackbar.show(); } } }); } }); addTaskDialog.show(); } public void viewTask(final int position) { LayoutInflater layoutInflaterAndroid = LayoutInflater.from(getActivity()); View mView = layoutInflaterAndroid.inflate(R.layout.view_task_layout, null); editTitle = (EditText) mView.findViewById(R.id.edit_title); editText = (EditText) mView.findViewById(R.id.edit_text); setDue = (TextView) mView.findViewById(R.id.set_due); setTag = (TextView) mView.findViewById(R.id.set_tag); setPriority = (TextView) mView.findViewById(R.id.set_priority); final Task task = tasks.get(position); setDue.setText(task.getDate()); setPriority.setText(task.getPriority()); setTag.setText(task.getTag()); editTitle.setText(task.getTitle()); editText.setText(task.getText()); editTitle.setFocusable(false); editText.setFocusable(false); if (setDue.getText().toString().isEmpty()) setDue.setVisibility(View.GONE); if (setPriority.getText().toString().isEmpty()) setPriority.setVisibility(View.GONE); if (setTag.getText().toString().isEmpty()) setTag.setVisibility(View.GONE); if (editTitle.getText().toString().isEmpty()) editTitle.setVisibility(View.GONE); if (editText.getText().toString().isEmpty()) editText.setVisibility(View.GONE); final AlertDialog viewTaskDialog = new AlertDialog .Builder(mView.getContext()) .setView(mView) .setCancelable(true) .setPositiveButton("Edit", null) .setNegativeButton("Close", null) .setNeutralButton("Delete", null) .create(); viewTaskDialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { final Button buttonPositive = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE); final Button buttonNegative = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_NEGATIVE); final Button buttonNeutral = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_NEUTRAL); buttonNeutral.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { adapter.onItemRemove(position, recyclerView, true); viewTaskDialog.dismiss(); } }); buttonNegative.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (buttonPositive.getText().equals("Save")) { setDue.setOnTouchListener(null); setPriority.setOnTouchListener(null); editTitle.clearFocus(); editText.clearFocus(); editTitle.setText(tasks.get(position).getTitle()); editText.setText(tasks.get(position).getText()); if (tasks.get(position).getDate().isEmpty()) setDue.setText("Set Due"); else setDue.setText(tasks.get(position).getDate()); if (tasks.get(position).getPriority().isEmpty()) setPriority.setText("Set Priority"); else setPriority.setText(tasks.get(position).getPriority()); if(tasks.get(position).getTag().isEmpty()) setTag.setText("Set Tag"); else setTag.setText(tasks.get(position).getTag()); if (setDue.getText().toString().equals("Set Due")) setDue.setVisibility(View.GONE); if (setPriority.getText().toString().equals("Set Priority")) setPriority.setVisibility(View.GONE); if (setTag.getText().toString().equals("Set Tag")) setTag.setVisibility(View.GONE); if (editTitle.getText().toString().isEmpty()) editTitle.setVisibility(View.GONE); if (editText.getText().toString().isEmpty()) editText.setVisibility(View.GONE); editTitle.setFocusable(false); editText.setFocusable(false); buttonPositive.setText("Edit"); buttonNegative.setText(("Close")); } else { viewTaskDialog.dismiss(); } } }); buttonPositive.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (buttonPositive.getText().equals("Edit")) { editTitle.setFocusableInTouchMode(true); editText.setFocusableInTouchMode(true); editTitle.setVisibility(View.VISIBLE); editText.setVisibility(View.VISIBLE); editText.requestFocus(); if (setDue.getVisibility() == View.GONE) { setDue.setText("Set Due"); setDue.setVisibility(View.VISIBLE); } if (setPriority.getVisibility() == View.GONE) { setPriority.setText("Set Priority"); setPriority.setVisibility(View.VISIBLE); } if (setTag.getVisibility() == View.GONE) { setTag.setText("Set Tag"); setTag.setVisibility(View.VISIBLE); } setDue.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { setDue(); return false; } }); setPriority.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { setPriority(); return false; } }); setTag.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { setTag(); return false; } }); buttonPositive.setText("Save"); buttonNegative.setText("Cancel"); } else { setDue.setOnTouchListener(null); setPriority.setOnTouchListener(null); setTag.setOnTouchListener(null); editTitle.clearFocus(); editText.clearFocus(); String date = "", priority = "", tag = ""; if (!setDue.getText().toString().equals("Set Due")) date = setDue.getText().toString(); else setDue.setVisibility(View.GONE); if (!setPriority.getText().toString().equals("Set Priority")) priority = setPriority.getText().toString(); else setPriority.setVisibility(View.GONE); if(!setTag.getText().toString().equals("Set Tag")) tag = setTag.getText().toString(); else setTag.setVisibility(View.GONE); if (editTitle.getText().toString().isEmpty()) editTitle.setVisibility(View.GONE); if (editText.getText().toString().isEmpty()) editText.setVisibility(View.GONE); adapter.update(position, editTitle.getText().toString(), editText.getText().toString(), date, priority, tag); adapter.notifyItemChanged(position); editTitle.setFocusable(false); editText.setFocusable(false); buttonPositive.setText("Edit"); buttonNegative.setText(("Close")); } } }); } }); viewTaskDialog.show(); } public void setPriority() { LayoutInflater layoutInflaterAndroid = LayoutInflater.from(getActivity()); View mView = layoutInflaterAndroid.inflate(R.layout.set_priority_layout, null); View priority1 = mView.findViewById(R.id.priority_1); View priority2 = mView.findViewById(R.id.priority_2); View priority3 = mView.findViewById(R.id.priority_3); final AlertDialog viewDialog = new AlertDialog .Builder(mView.getContext()) .setView(mView) .setCancelable(true) .setPositiveButton("Clear", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { setPriority.setText("Set Priority"); } }) .create(); viewDialog.show(); priority1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setPriority.setText("Priority: !"); viewDialog.dismiss(); } }); priority2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setPriority.setText("Priority: !!"); viewDialog.dismiss(); } }); priority3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setPriority.setText("Priority: !!!"); viewDialog.dismiss(); } }); } public void setDue() { Calendar now = Calendar.getInstance(); DatePickerDialog dpd = DatePickerDialog.newInstance( Tab1Fragment.this, now.get(Calendar.YEAR), now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH) ); dpd.setVersion(DatePickerDialog.Version.VERSION_2); dpd.setCancelText("Clear"); dpd.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { setDue.setText("Set Due"); } }); dpd.show(getFragmentManager(), "Datepickerdialog"); } @Override public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) { String dayOfWeek; Calendar calendar = new GregorianCalendar(year, monthOfYear, dayOfMonth); int result = calendar.get(Calendar.DAY_OF_WEEK); switch (result) { case Calendar.SUNDAY: dayOfWeek = "Sunday"; break; case Calendar.MONDAY: dayOfWeek = "Monday"; break; case Calendar.TUESDAY: dayOfWeek = "Tuesday"; break; case Calendar.WEDNESDAY: dayOfWeek = "Wednesday"; break; case Calendar.THURSDAY: dayOfWeek = "Thursday"; break; case Calendar.FRIDAY: dayOfWeek = "Friday"; break; case Calendar.SATURDAY: dayOfWeek = "Saturday"; break; default: dayOfWeek = ""; } setDue.setText(dayOfWeek + " " + (monthOfYear + 1) + "/" + dayOfMonth); } Tab1Listener listener; public interface Tab1Listener { void refreshAdapter(Task task); } public void setTab1Listener(Tab1Listener listener) { this.listener = listener; } public void refresh(Task task) { tasks.add(task); sortTasks(); adapter.notifyDataSetChanged(); layoutManager.scrollToPosition(tasks.indexOf(task)); } public void selectTag(String selectedTag){ this.selectedTag = selectedTag; Cursor notesCursor = mDbAdapter.fetchAllTasks(); tasks.clear(); if (notesCursor != null && notesCursor.moveToFirst()) { do { long id = notesCursor.getLong(notesCursor.getColumnIndex("_id")); String title = notesCursor.getString(notesCursor.getColumnIndex("title")); String text = notesCursor.getString(notesCursor.getColumnIndex("body")); String date = notesCursor.getString(notesCursor.getColumnIndex("date")); String priority = notesCursor.getString(notesCursor.getColumnIndex("priority")); String tag = notesCursor.getString(notesCursor.getColumnIndex("tag")); if(selectedTag.equals("All Tasks")){ if(adapter.tempTask == null || id != adapter.tempTask.getId()) tasks.add(new Task(id, title, text, date, "", priority, tag)); } else { if(tag.equals(selectedTag)) if(adapter.tempTask == null || id != adapter.tempTask.getId()) tasks.add(new Task(id, title, text, date, "", priority, tag)); } } while (notesCursor.moveToNext()); sortTasks(); adapter.notifyDataSetChanged(); } } AlertDialog editTagsDialog; public void setTag(String tag){ setTag.setText(tag); editTagsDialog.dismiss(); } public void setTag(){ LayoutInflater layoutInflaterAndroid = LayoutInflater.from(getActivity()); View mView = layoutInflaterAndroid.inflate(R.layout.edit_tags_layout, null); final ArrayList<Tag> tags = new ArrayList<>(); Cursor mCursor = mDbAdapter.fetchTags(); if (mCursor != null && mCursor.moveToFirst()) { do { long id = mCursor.getLong(mCursor.getColumnIndex("_id")); String name = mCursor.getString(mCursor.getColumnIndex("name")); String color = mCursor.getString(mCursor.getColumnIndex("color")); String pinned = mCursor.getString(mCursor.getColumnIndex("pinned")); tags.add(new Tag(id, name, color, pinned)); } while (mCursor.moveToNext()); } final RecyclerView mRecycler = (RecyclerView) mView.findViewById(R.id.edit_tags_recycler); final TagAdapter mAdapter = new TagAdapter(getActivity(), tags, this, false); final RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity()); mRecycler.setAdapter(mAdapter); mRecycler.setLayoutManager(layoutManager); EditText tagName = (EditText) mView.findViewById(R.id.add_tag_text); ImageView tagButton = (ImageView) mView.findViewById(R.id.add_tag_button); tagName.setVisibility(View.GONE); tagButton.setVisibility(View.GONE); editTagsDialog = new AlertDialog .Builder(mView.getContext()) .setView(mView) .setCancelable(true) .setPositiveButton("Clear", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { setTag.setText("Set Tag"); } }) .create(); editTagsDialog.show(); } }
UTF-8
Java
28,982
java
Tab1Fragment.java
Java
[ { "context": "package com.djacoronel.tasknotes;\n\nimport android.content.DialogInterf", "end": 20, "score": 0.5520762205123901, "start": 18, "tag": "USERNAME", "value": "on" } ]
null
[]
package com.djacoronel.tasknotes; import android.content.DialogInterface; import android.database.Cursor; import android.os.Bundle; import android.app.Fragment; import android.support.design.widget.Snackbar; import android.support.v7.app.AlertDialog; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearSmoothScroller; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.helper.ItemTouchHelper; import android.util.DisplayMetrics; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; import java.util.Comparator; import java.util.GregorianCalendar; public class Tab1Fragment extends Fragment implements DatePickerDialog.OnDateSetListener, RecyclerAdapter.MethodCaller, TagAdapter.MethodCaller{ RecyclerView recyclerView; RecyclerView.LayoutManager layoutManager; RecyclerAdapter adapter; TasksDbAdapter mDbAdapter; RelativeLayout emptyScreen; ArrayList<Task> tasks = new ArrayList<>(); public Tab1Fragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.fragment_tab1, container, false); emptyScreen = (RelativeLayout) rootView.findViewById(R.id.empty_screen); mDbAdapter = new TasksDbAdapter(rootView.getContext()); mDbAdapter.open(); fillData(); layoutManager = new LinearLayoutManager(rootView.getContext()) { @Override public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, int position) { LinearSmoothScroller smoothScroller = new LinearSmoothScroller(rootView.getContext()) { @Override protected float calculateSpeedPerPixel(DisplayMetrics displayMetrics) { return 75f / displayMetrics.densityDpi; } }; smoothScroller.setTargetPosition(position); startSmoothScroll(smoothScroller); } }; adapter = new RecyclerAdapter(tasks, mDbAdapter, this); adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() { @Override public void onChanged() { super.onChanged(); checkAdapterIsEmpty(); } @Override public void onItemRangeInserted(int positionStart, int itemCount) { super.onItemRangeInserted(positionStart, itemCount); checkAdapterIsEmpty(); } @Override public void onItemRangeChanged(int positionStart, int itemCount) { super.onItemRangeChanged(positionStart, itemCount); checkAdapterIsEmpty(); } @Override public void onItemRangeRemoved(int positionStart, int itemCount) { super.onItemRangeRemoved(positionStart, itemCount); checkAdapterIsEmpty(); } }); recyclerView = (RecyclerView) rootView.findViewById(R.id.recycler_view); recyclerView.setLayoutManager(layoutManager); recyclerView.setAdapter(adapter); ItemTouchHelper.Callback callback = new SwipeRightHelper(adapter, listener); ItemTouchHelper helper = new ItemTouchHelper(callback); helper.attachToRecyclerView(recyclerView); checkAdapterIsEmpty(); return rootView; } private void fillData() { Cursor notesCursor = mDbAdapter.fetchAllTasks(); if (notesCursor != null && notesCursor.moveToFirst()) { do { long id = notesCursor.getLong(notesCursor.getColumnIndex("_id")); String title = notesCursor.getString(notesCursor.getColumnIndex("title")); String text = notesCursor.getString(notesCursor.getColumnIndex("body")); String date = notesCursor.getString(notesCursor.getColumnIndex("date")); String tag = notesCursor.getString(notesCursor.getColumnIndex("tag")); String dateFinished = ""; String priority = notesCursor.getString(notesCursor.getColumnIndex("priority")); tasks.add(new Task(id, title, text, date, dateFinished, priority, tag)); } while (notesCursor.moveToNext()); sortTasks(); } } public void checkAdapterIsEmpty() { if (tasks.isEmpty()) { emptyScreen.setVisibility(View.VISIBLE); } else { emptyScreen.setVisibility(View.GONE); } } public void sortTasks() { Collections.sort(tasks, new Comparator<Task>() { @Override public int compare(Task t1, Task t2) { int returnVal = 0; if (!t1.getDate().isEmpty() && !t2.getDate().isEmpty()) { String dayDate1[] = t1.getDate().split(" "); String date1[] = dayDate1[1].split("/"); String dayDate2[] = t2.getDate().split(" "); String date2[] = dayDate2[1].split("/"); if (Integer.parseInt(date1[0]) < Integer.parseInt(date2[0])) { returnVal = -1; } else if (Integer.parseInt(date1[0]) > Integer.parseInt(date2[0])) { returnVal = 1; } else if (Integer.parseInt(date1[0]) == Integer.parseInt(date2[0])) { if (Integer.parseInt(date1[1]) < Integer.parseInt(date2[1])) { returnVal = -1; } else if (Integer.parseInt(date1[1]) > Integer.parseInt(date2[1])) { returnVal = 1; } else if (Integer.parseInt(date1[1]) == Integer.parseInt(date2[1])) { if (!t1.getPriority().isEmpty() && !t2.getPriority().isEmpty()) { returnVal = -t1.getPriority().compareTo(t2.getPriority()); } else if (t1.getPriority().isEmpty() && !t2.getPriority().isEmpty()) { returnVal = 1; } else if (!t1.getPriority().isEmpty() && t2.getPriority().isEmpty()) { returnVal = -1; } } } } else if (!t1.getDate().isEmpty() && t2.getDate().isEmpty()) { returnVal = -1; } else if (t1.getDate().isEmpty() && !t2.getDate().isEmpty()) { returnVal = 1; } else if (t1.getDate().isEmpty() && t2.getDate().isEmpty()) { if (!t1.getPriority().isEmpty() && !t2.getPriority().isEmpty()) { returnVal = -t1.getPriority().compareTo(t2.getPriority()); } else if (t1.getPriority().isEmpty() && !t2.getPriority().isEmpty()) { returnVal = 1; } else if (!t1.getPriority().isEmpty() && t2.getPriority().isEmpty()) { returnVal = -1; } } return returnVal; } }); } EditText editTitle, editText; TextView setDue, setPriority, setTag; String selectedTag = "All Tasks"; public void addTask() { LayoutInflater layoutInflaterAndroid = LayoutInflater.from(getActivity()); final View mView = layoutInflaterAndroid.inflate(R.layout.add_task_layout, null); editTitle = (EditText) mView.findViewById(R.id.edit_title); editText = (EditText) mView.findViewById(R.id.edit_text); setDue = (TextView) mView.findViewById(R.id.set_due); setPriority = (TextView) mView.findViewById(R.id.set_priority); setTag = (TextView) mView.findViewById(R.id.set_tag); if(!selectedTag.equals("All Tasks")) setTag.setText(selectedTag); setDue.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { setDue(); return false; } }); setPriority.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { setPriority(); return false; } }); setTag.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { setTag(); return false; } }); final AlertDialog addTaskDialog = new AlertDialog .Builder(mView.getContext()) .setView(mView) .setCancelable(true) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogBox, int id) { dialogBox.cancel(); } }) .setPositiveButton("Add", null) .create(); addTaskDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); addTaskDialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { final Button buttonPositive = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE); buttonPositive.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String title = editTitle.getText().toString(); String text = editText.getText().toString(); String due; String priority; String tag; if (!title.isEmpty() || !text.isEmpty()) { if (!setDue.getText().toString().equals("Set Due")) due = setDue.getText().toString(); else due = ""; if (!setPriority.getText().toString().trim().equals("Set Priority")) priority = setPriority.getText().toString(); else priority = ""; if (!setTag.getText().toString().trim().equals("Set Tag")) tag = setTag.getText().toString(); else tag = ""; layoutManager.smoothScrollToPosition(recyclerView, null, adapter.add(title, text, due, priority, tag)); addTaskDialog.dismiss(); } else { final Snackbar snackbar = Snackbar.make(mView, "ADD TASK CONTENT", Snackbar.LENGTH_LONG); snackbar.setAction("OKAY", new View.OnClickListener() { @Override public void onClick(View v) { snackbar.dismiss(); } }); snackbar.show(); } } }); } }); addTaskDialog.show(); } public void viewTask(final int position) { LayoutInflater layoutInflaterAndroid = LayoutInflater.from(getActivity()); View mView = layoutInflaterAndroid.inflate(R.layout.view_task_layout, null); editTitle = (EditText) mView.findViewById(R.id.edit_title); editText = (EditText) mView.findViewById(R.id.edit_text); setDue = (TextView) mView.findViewById(R.id.set_due); setTag = (TextView) mView.findViewById(R.id.set_tag); setPriority = (TextView) mView.findViewById(R.id.set_priority); final Task task = tasks.get(position); setDue.setText(task.getDate()); setPriority.setText(task.getPriority()); setTag.setText(task.getTag()); editTitle.setText(task.getTitle()); editText.setText(task.getText()); editTitle.setFocusable(false); editText.setFocusable(false); if (setDue.getText().toString().isEmpty()) setDue.setVisibility(View.GONE); if (setPriority.getText().toString().isEmpty()) setPriority.setVisibility(View.GONE); if (setTag.getText().toString().isEmpty()) setTag.setVisibility(View.GONE); if (editTitle.getText().toString().isEmpty()) editTitle.setVisibility(View.GONE); if (editText.getText().toString().isEmpty()) editText.setVisibility(View.GONE); final AlertDialog viewTaskDialog = new AlertDialog .Builder(mView.getContext()) .setView(mView) .setCancelable(true) .setPositiveButton("Edit", null) .setNegativeButton("Close", null) .setNeutralButton("Delete", null) .create(); viewTaskDialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { final Button buttonPositive = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE); final Button buttonNegative = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_NEGATIVE); final Button buttonNeutral = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_NEUTRAL); buttonNeutral.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { adapter.onItemRemove(position, recyclerView, true); viewTaskDialog.dismiss(); } }); buttonNegative.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (buttonPositive.getText().equals("Save")) { setDue.setOnTouchListener(null); setPriority.setOnTouchListener(null); editTitle.clearFocus(); editText.clearFocus(); editTitle.setText(tasks.get(position).getTitle()); editText.setText(tasks.get(position).getText()); if (tasks.get(position).getDate().isEmpty()) setDue.setText("Set Due"); else setDue.setText(tasks.get(position).getDate()); if (tasks.get(position).getPriority().isEmpty()) setPriority.setText("Set Priority"); else setPriority.setText(tasks.get(position).getPriority()); if(tasks.get(position).getTag().isEmpty()) setTag.setText("Set Tag"); else setTag.setText(tasks.get(position).getTag()); if (setDue.getText().toString().equals("Set Due")) setDue.setVisibility(View.GONE); if (setPriority.getText().toString().equals("Set Priority")) setPriority.setVisibility(View.GONE); if (setTag.getText().toString().equals("Set Tag")) setTag.setVisibility(View.GONE); if (editTitle.getText().toString().isEmpty()) editTitle.setVisibility(View.GONE); if (editText.getText().toString().isEmpty()) editText.setVisibility(View.GONE); editTitle.setFocusable(false); editText.setFocusable(false); buttonPositive.setText("Edit"); buttonNegative.setText(("Close")); } else { viewTaskDialog.dismiss(); } } }); buttonPositive.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (buttonPositive.getText().equals("Edit")) { editTitle.setFocusableInTouchMode(true); editText.setFocusableInTouchMode(true); editTitle.setVisibility(View.VISIBLE); editText.setVisibility(View.VISIBLE); editText.requestFocus(); if (setDue.getVisibility() == View.GONE) { setDue.setText("Set Due"); setDue.setVisibility(View.VISIBLE); } if (setPriority.getVisibility() == View.GONE) { setPriority.setText("Set Priority"); setPriority.setVisibility(View.VISIBLE); } if (setTag.getVisibility() == View.GONE) { setTag.setText("Set Tag"); setTag.setVisibility(View.VISIBLE); } setDue.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { setDue(); return false; } }); setPriority.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { setPriority(); return false; } }); setTag.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { setTag(); return false; } }); buttonPositive.setText("Save"); buttonNegative.setText("Cancel"); } else { setDue.setOnTouchListener(null); setPriority.setOnTouchListener(null); setTag.setOnTouchListener(null); editTitle.clearFocus(); editText.clearFocus(); String date = "", priority = "", tag = ""; if (!setDue.getText().toString().equals("Set Due")) date = setDue.getText().toString(); else setDue.setVisibility(View.GONE); if (!setPriority.getText().toString().equals("Set Priority")) priority = setPriority.getText().toString(); else setPriority.setVisibility(View.GONE); if(!setTag.getText().toString().equals("Set Tag")) tag = setTag.getText().toString(); else setTag.setVisibility(View.GONE); if (editTitle.getText().toString().isEmpty()) editTitle.setVisibility(View.GONE); if (editText.getText().toString().isEmpty()) editText.setVisibility(View.GONE); adapter.update(position, editTitle.getText().toString(), editText.getText().toString(), date, priority, tag); adapter.notifyItemChanged(position); editTitle.setFocusable(false); editText.setFocusable(false); buttonPositive.setText("Edit"); buttonNegative.setText(("Close")); } } }); } }); viewTaskDialog.show(); } public void setPriority() { LayoutInflater layoutInflaterAndroid = LayoutInflater.from(getActivity()); View mView = layoutInflaterAndroid.inflate(R.layout.set_priority_layout, null); View priority1 = mView.findViewById(R.id.priority_1); View priority2 = mView.findViewById(R.id.priority_2); View priority3 = mView.findViewById(R.id.priority_3); final AlertDialog viewDialog = new AlertDialog .Builder(mView.getContext()) .setView(mView) .setCancelable(true) .setPositiveButton("Clear", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { setPriority.setText("Set Priority"); } }) .create(); viewDialog.show(); priority1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setPriority.setText("Priority: !"); viewDialog.dismiss(); } }); priority2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setPriority.setText("Priority: !!"); viewDialog.dismiss(); } }); priority3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setPriority.setText("Priority: !!!"); viewDialog.dismiss(); } }); } public void setDue() { Calendar now = Calendar.getInstance(); DatePickerDialog dpd = DatePickerDialog.newInstance( Tab1Fragment.this, now.get(Calendar.YEAR), now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH) ); dpd.setVersion(DatePickerDialog.Version.VERSION_2); dpd.setCancelText("Clear"); dpd.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { setDue.setText("Set Due"); } }); dpd.show(getFragmentManager(), "Datepickerdialog"); } @Override public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) { String dayOfWeek; Calendar calendar = new GregorianCalendar(year, monthOfYear, dayOfMonth); int result = calendar.get(Calendar.DAY_OF_WEEK); switch (result) { case Calendar.SUNDAY: dayOfWeek = "Sunday"; break; case Calendar.MONDAY: dayOfWeek = "Monday"; break; case Calendar.TUESDAY: dayOfWeek = "Tuesday"; break; case Calendar.WEDNESDAY: dayOfWeek = "Wednesday"; break; case Calendar.THURSDAY: dayOfWeek = "Thursday"; break; case Calendar.FRIDAY: dayOfWeek = "Friday"; break; case Calendar.SATURDAY: dayOfWeek = "Saturday"; break; default: dayOfWeek = ""; } setDue.setText(dayOfWeek + " " + (monthOfYear + 1) + "/" + dayOfMonth); } Tab1Listener listener; public interface Tab1Listener { void refreshAdapter(Task task); } public void setTab1Listener(Tab1Listener listener) { this.listener = listener; } public void refresh(Task task) { tasks.add(task); sortTasks(); adapter.notifyDataSetChanged(); layoutManager.scrollToPosition(tasks.indexOf(task)); } public void selectTag(String selectedTag){ this.selectedTag = selectedTag; Cursor notesCursor = mDbAdapter.fetchAllTasks(); tasks.clear(); if (notesCursor != null && notesCursor.moveToFirst()) { do { long id = notesCursor.getLong(notesCursor.getColumnIndex("_id")); String title = notesCursor.getString(notesCursor.getColumnIndex("title")); String text = notesCursor.getString(notesCursor.getColumnIndex("body")); String date = notesCursor.getString(notesCursor.getColumnIndex("date")); String priority = notesCursor.getString(notesCursor.getColumnIndex("priority")); String tag = notesCursor.getString(notesCursor.getColumnIndex("tag")); if(selectedTag.equals("All Tasks")){ if(adapter.tempTask == null || id != adapter.tempTask.getId()) tasks.add(new Task(id, title, text, date, "", priority, tag)); } else { if(tag.equals(selectedTag)) if(adapter.tempTask == null || id != adapter.tempTask.getId()) tasks.add(new Task(id, title, text, date, "", priority, tag)); } } while (notesCursor.moveToNext()); sortTasks(); adapter.notifyDataSetChanged(); } } AlertDialog editTagsDialog; public void setTag(String tag){ setTag.setText(tag); editTagsDialog.dismiss(); } public void setTag(){ LayoutInflater layoutInflaterAndroid = LayoutInflater.from(getActivity()); View mView = layoutInflaterAndroid.inflate(R.layout.edit_tags_layout, null); final ArrayList<Tag> tags = new ArrayList<>(); Cursor mCursor = mDbAdapter.fetchTags(); if (mCursor != null && mCursor.moveToFirst()) { do { long id = mCursor.getLong(mCursor.getColumnIndex("_id")); String name = mCursor.getString(mCursor.getColumnIndex("name")); String color = mCursor.getString(mCursor.getColumnIndex("color")); String pinned = mCursor.getString(mCursor.getColumnIndex("pinned")); tags.add(new Tag(id, name, color, pinned)); } while (mCursor.moveToNext()); } final RecyclerView mRecycler = (RecyclerView) mView.findViewById(R.id.edit_tags_recycler); final TagAdapter mAdapter = new TagAdapter(getActivity(), tags, this, false); final RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity()); mRecycler.setAdapter(mAdapter); mRecycler.setLayoutManager(layoutManager); EditText tagName = (EditText) mView.findViewById(R.id.add_tag_text); ImageView tagButton = (ImageView) mView.findViewById(R.id.add_tag_button); tagName.setVisibility(View.GONE); tagButton.setVisibility(View.GONE); editTagsDialog = new AlertDialog .Builder(mView.getContext()) .setView(mView) .setCancelable(true) .setPositiveButton("Clear", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { setTag.setText("Set Tag"); } }) .create(); editTagsDialog.show(); } }
28,982
0.520737
0.51739
701
40.343796
29.840759
144
false
false
0
0
0
0
0
0
0.600571
false
false
7
9c30df4f822850b3b22ab01c6de6c0bb9a848725
1,142,461,360,481
089337b6ea2cfc138f0961c33d1b37038e5b0530
/era_bcb_sample/4/selected/315013.java
69cbb84476e68c84df21e5b1e1ea563343686c48
[]
no_license
manzibanishi/Parallel_Code_detection
https://github.com/manzibanishi/Parallel_Code_detection
7b88a49885bde22be3b4dd3c5ae04a1b65e75004
b93dd45f9e19e79584fa1c3ed98b7e6a74214e75
refs/heads/master
2018-01-06T19:12:22.349000
2016-10-01T02:24:58
2016-10-01T02:24:58
69,706,822
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package so.n_3.musicbox.model; import java.util.Vector; import java.util.logging.Level; import java.util.logging.Logger; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import org.w3c.dom.*; import javax.xml.parsers.*; import java.io.*; import java.util.Enumeration; import javax.servlet.ServletContext; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.apache.commons.io.FileUtils; import org.xml.sax.SAXException; /** * * @author oasynnoum */ public class MusicBox { private static String playlistXmlPath; private static MusicBox instance = new MusicBox(); private Vector<Playlist> playlists; private MusicBox() { this.playlists = new Vector<Playlist>(); } public Playlist getDefaultPlaylist() { return this.playlists.get(0); } public static String getPlaylistXmlPath() { return MusicBox.playlistXmlPath; } public Music getDefaultMusic() { Playlist playlist = this.playlists.get(0); if (playlist == null) { return null; } return playlist.getMusic(0); } public Playlist getPlaylistById(String playlistId) { Playlist playlist = null; for (int i = 0; i < this.playlists.size(); i++) { Playlist _playlist = this.playlists.get(i); String _playlistId = _playlist.getId(); if (_playlistId.equals(playlistId)) { playlist = _playlist; break; } } return playlist; } private static synchronized void initPlaylistXmlPath(ServletContext servletContext) { String tmporaryDirectoryPath = System.getProperty("java.io.tmpdir"); File playlistXml = new File(tmporaryDirectoryPath + System.getProperty("file.separator") + "playlist.xml"); if (!playlistXml.exists()) { try { File playlistTemplateXml = new File(servletContext.getRealPath("playlist.xml")); FileUtils.copyFile(playlistTemplateXml, playlistXml); } catch (IOException ex) { Logger.getLogger(MusicBox.class.getName()).log(Level.SEVERE, null, ex); } } MusicBox.playlistXmlPath = playlistXml.getAbsolutePath(); } public static synchronized void init(ServletContext servletContext) { initPlaylistXmlPath(servletContext); init(playlistXmlPath); } public static synchronized void init(String playlistXmlPath) { MusicBox.playlistXmlPath = playlistXmlPath; File fileObject; try { MusicBox.instance.playlists.clear(); fileObject = new File(MusicBox.playlistXmlPath); DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document document = docBuilder.parse(fileObject); NodeList playlistNodes = document.getElementsByTagName("playlist"); for (int i = 0; i < playlistNodes.getLength(); i++) { Playlist playlist = new Playlist(); Element playlistElem = (Element) playlistNodes.item(i); playlist.setId(playlistElem.getAttribute("id")); playlist.setName(playlistElem.getAttribute("name")); playlist.setUrl(playlistElem.getAttribute("url")); NodeList musicNodes = playlistElem.getElementsByTagName("music"); for (int j = 0; j < musicNodes.getLength(); j++) { Element musicElem = (Element) musicNodes.item(j); Music music = new Music(musicElem.getAttribute("url"), Integer.parseInt(musicElem.getAttribute("order"))); playlist.addMusic(music); } MusicBox.instance.playlists.add(playlist); } } catch (SAXException ex) { Logger.getLogger(MusicBox.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(MusicBox.class.getName()).log(Level.SEVERE, null, ex); } catch (ParserConfigurationException ex) { Logger.getLogger(MusicBox.class.getName()).log(Level.SEVERE, null, ex); } finally { } } public synchronized boolean createPlaylist(String method, String playlistName, String sourceDirectoryPath) { boolean result = false; try { File playlistXml = new File(MusicBox.playlistXmlPath); DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document document = docBuilder.parse(playlistXml); Element musicboxElem = (Element) document.getElementsByTagName("musicbox").item(0); Element playlistElem = document.createElement("playlist"); playlistElem.setAttribute("id", Playlist.generateId()); playlistElem.setAttribute("name", playlistName); if (method.equalsIgnoreCase("empty")) { } else if (method.equalsIgnoreCase("directory")) { playlistElem.setAttribute("url", sourceDirectoryPath); File sourceDirectory = new File(sourceDirectoryPath); File[] mp3Files = sourceDirectory.listFiles(MusicBox.getMP3FileFilter()); for (int i = 0; i < mp3Files.length; i++) { File mp3File = mp3Files[i]; Element musicElem = document.createElement("music"); musicElem.setAttribute("url", mp3File.getAbsolutePath()); musicElem.setAttribute("order", Integer.toString(i)); playlistElem.appendChild(musicElem); } } musicboxElem.appendChild(playlistElem); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.transform(new DOMSource(document), new StreamResult(playlistXml)); MusicBox.init(MusicBox.playlistXmlPath); result = true; } catch (Exception ex) { Logger.getLogger(MusicBox.class.getName()).log(Level.SEVERE, null, ex); } return result; } public synchronized Document getPlaylistXmlDocument() { Document document = null; try { File playlistXml = new File(MusicBox.playlistXmlPath); DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); document = docBuilder.parse(playlistXml); } catch (ParserConfigurationException ex) { Logger.getLogger(MusicBox.class.getName()).log(Level.SEVERE, null, ex); } catch (SAXException ex) { Logger.getLogger(MusicBox.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(MusicBox.class.getName()).log(Level.SEVERE, null, ex); } return document; } public synchronized boolean savePlaylistXmlDocument(Document playlistXmlDocument) { boolean result = false; try { Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.transform(new DOMSource(playlistXmlDocument), new StreamResult(new File(playlistXmlPath))); MusicBox.init(playlistXmlPath); result = true; } catch (TransformerConfigurationException ex) { Logger.getLogger(MusicBox.class.getName()).log(Level.SEVERE, null, ex); } catch (TransformerException ex) { Logger.getLogger(MusicBox.class.getName()).log(Level.SEVERE, null, ex); } return result; } public static FileFilter getMP3FileFilter() { return new FileFilter() { @Override public boolean accept(File path) { return path.getName().matches("^.*\\.mp3$"); } }; } public static MusicBox getInstance() { return MusicBox.instance; } }
UTF-8
Java
8,106
java
315013.java
Java
[ { "context": "mport org.xml.sax.SAXException;\n\n/**\n *\n * @author oasynnoum\n */\npublic class MusicBox {\n\n private static S", "end": 646, "score": 0.9996637105941772, "start": 637, "tag": "USERNAME", "value": "oasynnoum" } ]
null
[]
package so.n_3.musicbox.model; import java.util.Vector; import java.util.logging.Level; import java.util.logging.Logger; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import org.w3c.dom.*; import javax.xml.parsers.*; import java.io.*; import java.util.Enumeration; import javax.servlet.ServletContext; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.apache.commons.io.FileUtils; import org.xml.sax.SAXException; /** * * @author oasynnoum */ public class MusicBox { private static String playlistXmlPath; private static MusicBox instance = new MusicBox(); private Vector<Playlist> playlists; private MusicBox() { this.playlists = new Vector<Playlist>(); } public Playlist getDefaultPlaylist() { return this.playlists.get(0); } public static String getPlaylistXmlPath() { return MusicBox.playlistXmlPath; } public Music getDefaultMusic() { Playlist playlist = this.playlists.get(0); if (playlist == null) { return null; } return playlist.getMusic(0); } public Playlist getPlaylistById(String playlistId) { Playlist playlist = null; for (int i = 0; i < this.playlists.size(); i++) { Playlist _playlist = this.playlists.get(i); String _playlistId = _playlist.getId(); if (_playlistId.equals(playlistId)) { playlist = _playlist; break; } } return playlist; } private static synchronized void initPlaylistXmlPath(ServletContext servletContext) { String tmporaryDirectoryPath = System.getProperty("java.io.tmpdir"); File playlistXml = new File(tmporaryDirectoryPath + System.getProperty("file.separator") + "playlist.xml"); if (!playlistXml.exists()) { try { File playlistTemplateXml = new File(servletContext.getRealPath("playlist.xml")); FileUtils.copyFile(playlistTemplateXml, playlistXml); } catch (IOException ex) { Logger.getLogger(MusicBox.class.getName()).log(Level.SEVERE, null, ex); } } MusicBox.playlistXmlPath = playlistXml.getAbsolutePath(); } public static synchronized void init(ServletContext servletContext) { initPlaylistXmlPath(servletContext); init(playlistXmlPath); } public static synchronized void init(String playlistXmlPath) { MusicBox.playlistXmlPath = playlistXmlPath; File fileObject; try { MusicBox.instance.playlists.clear(); fileObject = new File(MusicBox.playlistXmlPath); DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document document = docBuilder.parse(fileObject); NodeList playlistNodes = document.getElementsByTagName("playlist"); for (int i = 0; i < playlistNodes.getLength(); i++) { Playlist playlist = new Playlist(); Element playlistElem = (Element) playlistNodes.item(i); playlist.setId(playlistElem.getAttribute("id")); playlist.setName(playlistElem.getAttribute("name")); playlist.setUrl(playlistElem.getAttribute("url")); NodeList musicNodes = playlistElem.getElementsByTagName("music"); for (int j = 0; j < musicNodes.getLength(); j++) { Element musicElem = (Element) musicNodes.item(j); Music music = new Music(musicElem.getAttribute("url"), Integer.parseInt(musicElem.getAttribute("order"))); playlist.addMusic(music); } MusicBox.instance.playlists.add(playlist); } } catch (SAXException ex) { Logger.getLogger(MusicBox.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(MusicBox.class.getName()).log(Level.SEVERE, null, ex); } catch (ParserConfigurationException ex) { Logger.getLogger(MusicBox.class.getName()).log(Level.SEVERE, null, ex); } finally { } } public synchronized boolean createPlaylist(String method, String playlistName, String sourceDirectoryPath) { boolean result = false; try { File playlistXml = new File(MusicBox.playlistXmlPath); DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document document = docBuilder.parse(playlistXml); Element musicboxElem = (Element) document.getElementsByTagName("musicbox").item(0); Element playlistElem = document.createElement("playlist"); playlistElem.setAttribute("id", Playlist.generateId()); playlistElem.setAttribute("name", playlistName); if (method.equalsIgnoreCase("empty")) { } else if (method.equalsIgnoreCase("directory")) { playlistElem.setAttribute("url", sourceDirectoryPath); File sourceDirectory = new File(sourceDirectoryPath); File[] mp3Files = sourceDirectory.listFiles(MusicBox.getMP3FileFilter()); for (int i = 0; i < mp3Files.length; i++) { File mp3File = mp3Files[i]; Element musicElem = document.createElement("music"); musicElem.setAttribute("url", mp3File.getAbsolutePath()); musicElem.setAttribute("order", Integer.toString(i)); playlistElem.appendChild(musicElem); } } musicboxElem.appendChild(playlistElem); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.transform(new DOMSource(document), new StreamResult(playlistXml)); MusicBox.init(MusicBox.playlistXmlPath); result = true; } catch (Exception ex) { Logger.getLogger(MusicBox.class.getName()).log(Level.SEVERE, null, ex); } return result; } public synchronized Document getPlaylistXmlDocument() { Document document = null; try { File playlistXml = new File(MusicBox.playlistXmlPath); DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); document = docBuilder.parse(playlistXml); } catch (ParserConfigurationException ex) { Logger.getLogger(MusicBox.class.getName()).log(Level.SEVERE, null, ex); } catch (SAXException ex) { Logger.getLogger(MusicBox.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(MusicBox.class.getName()).log(Level.SEVERE, null, ex); } return document; } public synchronized boolean savePlaylistXmlDocument(Document playlistXmlDocument) { boolean result = false; try { Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.transform(new DOMSource(playlistXmlDocument), new StreamResult(new File(playlistXmlPath))); MusicBox.init(playlistXmlPath); result = true; } catch (TransformerConfigurationException ex) { Logger.getLogger(MusicBox.class.getName()).log(Level.SEVERE, null, ex); } catch (TransformerException ex) { Logger.getLogger(MusicBox.class.getName()).log(Level.SEVERE, null, ex); } return result; } public static FileFilter getMP3FileFilter() { return new FileFilter() { @Override public boolean accept(File path) { return path.getName().matches("^.*\\.mp3$"); } }; } public static MusicBox getInstance() { return MusicBox.instance; } }
8,106
0.632248
0.630027
195
40.569229
30.075787
126
false
false
0
0
0
0
0
0
0.723077
false
false
7
8365e4135bbdc3f798303dffb8bc73df05a86e6a
31,258,772,046,712
a0dfabe641307dc45819fd11443781a82b855f00
/src/com/mars/PersonsDemo.java
1bfb475c3f3cfe66671b578d387022ea584dbf0d
[]
no_license
rameshsagarr/PlainJavaTask
https://github.com/rameshsagarr/PlainJavaTask
9caa015366b82b2b942e72515a9dbc38170b9226
8fb8d49c57cc9c4d001916de289054831a765a6e
refs/heads/master
2023-02-02T18:03:02.333000
2020-12-16T05:40:14
2020-12-16T05:40:14
321,624,913
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mars; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Scanner; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class PersonsDemo { private static final Logger logger = LogManager.getLogger(PersonsDemo.class); public static void main(String[] args) throws SQLException { DatabaseUtility.createPersonTable(); int option = runAgain(); Connection con = null; Statement st = null; PreparedStatement pst = null; do { switch (option) { case 1: logger.debug("case 1"); con = DatabaseUtility.getDBConnection(); st = con.createStatement(); addPerson(con, st); con = DatabaseUtility.getDBConnection(); allPersons(con, pst); option = runAgain(); break; case 2: logger.debug("case 2:"); con = DatabaseUtility.getDBConnection(); st = con.createStatement(); logger.debug("before editing person list::"); allPersons(con, pst); con = DatabaseUtility.getDBConnection(); st = con.createStatement(); editPerson(con, st, pst); logger.debug("after editing person list::"); con = DatabaseUtility.getDBConnection(); st = con.createStatement(); allPersons(con, pst); option = runAgain(); break; case 3: logger.debug("case 3:"); con = DatabaseUtility.getDBConnection(); st = con.createStatement(); logger.debug("before deleting person list::"); allPersons(con, pst); con = DatabaseUtility.getDBConnection(); st = con.createStatement(); deletePerson(con, pst); logger.debug("after deleting person list::"); allPersons(con, pst); option = runAgain(); break; // if 4 no of persons case 4: logger.debug("case 4::"); con = DatabaseUtility.getDBConnection(); st = con.createStatement(); personCount(con, pst); option = runAgain(); break; case 5: logger.debug("case 5:"); con = DatabaseUtility.getDBConnection(); st = con.createStatement(); allPersons(con, pst); option = runAgain(); break; default: System.exit(6); logger.debug("exit from program"); } } while (option <= 5); } public static int runAgain() { String myObj = chooseOption(); int option = 0; option = validateIntValue(myObj); System.out.println("your chossen option is: " + option); return option; } public static void editPerson(Connection con, Statement st, PreparedStatement ps) { Scanner scannerObj = new Scanner(System.in); System.out.println("please enter pid"); String sid = scannerObj.nextLine(); int Personid = validateIntValue(sid); Scanner scannerObj2 = new Scanner(System.in); System.out.println("please enter firstname"); String firstname = scannerObj.nextLine(); Scanner scannerObj3 = new Scanner(System.in); System.out.println("please enter surname"); String surname = scannerObj3.nextLine(); Person p = null; String sql = "SELECT * FROM persons where pid=?"; try { PreparedStatement pst = con.prepareStatement(sql); pst.setInt(1, Personid); ResultSet rs = pst.executeQuery(); Person dbPerson = null; while (rs.next()) { String updateuserquery = "UPDATE persons SET firstname=? , surname=? where pid=?"; PreparedStatement pstt = con.prepareStatement(updateuserquery); pstt.setString(1, firstname); pstt.setString(2, surname); pstt.setInt(3, Personid); int rowsUpdated = pstt.executeUpdate(); if (rowsUpdated > 0) { logger.debug("An existing person was updated successfully!"); } else { logger.debug("update not done"); } } rs.close(); st.close(); pst.close(); } catch (SQLException e) { logger.error(e.getMessage()); } } public static void deletePerson(Connection con, PreparedStatement st) { Scanner scannerObj = new Scanner(System.in); System.out.println("please enter pid"); String sid = scannerObj.nextLine(); int Personid = validateIntValue(sid); Person p = null; try { String sql = "DELETE FROM persons " + "WHERE pid = ?"; PreparedStatement pstt = con.prepareStatement(sql); pstt.setInt(1, Personid); int rowsUpdated = pstt.executeUpdate(); if (rowsUpdated > 0) { logger.debug("An existing person was deleted successfully!"); } else { logger.debug("delete not done"); } } catch (SQLException e) { logger.error(e.getMessage()); } } public static void addPerson(Connection con, Statement st) { Scanner scannerObj = new Scanner(System.in); System.out.println("please enter pid"); String sid = scannerObj.nextLine(); int Personid = validateIntValue(sid); Scanner scannerObj2 = new Scanner(System.in); System.out.println("please enter firstname"); String firstname = scannerObj2.nextLine(); Scanner scannerObj3 = new Scanner(System.in); System.out.println("please enter surname"); String surname = scannerObj3.nextLine(); int m = 0; try { m = st.executeUpdate( "insert into PERSONS (firstname,surname)values('" + firstname + "','" + surname + "')"); } catch (SQLException e) { logger.error(e.getMessage()); } if (m == 1) logger.debug("inserted successfully : " + m); else logger.debug("insertion failed"); try { con.close(); st.close(); } catch (SQLException e) { logger.error(e.getMessage()); } } public static int validateIntValue(String sc) { int option = 0; try { option = Integer.parseInt(sc); } catch (NumberFormatException ex) { System.out.println("Please enter non String value"); } catch (Exception e) { logger.error(e.getMessage()); } return option; } public static String chooseOption() { Scanner myObj = new Scanner(System.in); System.out.println("please enter your option from the following:"); System.out.println("enter 1 as add the person"); System.out.println("enter 2 as edit the person"); System.out.println("enter 3 as delete the person"); System.out.println("enter 4 as count the no of person"); System.out.println("enter 5 as to print the persons list"); String SringObj = myObj.nextLine(); return SringObj; } public static void personCount(Connection con, PreparedStatement pst) { List<Person> personList = new ArrayList<Person>(); personList = allPersons(con, pst); logger.debug("persons count=" + personList.size()); } public static List<Person> allPersons(Connection con, PreparedStatement pst) { String sql = "SELECT pid,firstname,surname FROM persons"; List<Person> personList = new ArrayList<Person>(); try { pst = con.prepareStatement(sql); ResultSet rs = pst.executeQuery(); while (rs.next()) { Person dbPerson = new Person(); int pid = rs.getInt(1); dbPerson.setPid(pid); String fname = rs.getString(2); dbPerson.setFirstname(fname); dbPerson.setSurname(rs.getString(3)); personList.add(dbPerson); } logger.debug("list of persons data=" + personList); rs.close(); pst.close(); con.close(); } catch (Exception e) { logger.error(e.getMessage()); } return personList; } }
UTF-8
Java
7,231
java
PersonsDemo.java
Java
[]
null
[]
package com.mars; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Scanner; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class PersonsDemo { private static final Logger logger = LogManager.getLogger(PersonsDemo.class); public static void main(String[] args) throws SQLException { DatabaseUtility.createPersonTable(); int option = runAgain(); Connection con = null; Statement st = null; PreparedStatement pst = null; do { switch (option) { case 1: logger.debug("case 1"); con = DatabaseUtility.getDBConnection(); st = con.createStatement(); addPerson(con, st); con = DatabaseUtility.getDBConnection(); allPersons(con, pst); option = runAgain(); break; case 2: logger.debug("case 2:"); con = DatabaseUtility.getDBConnection(); st = con.createStatement(); logger.debug("before editing person list::"); allPersons(con, pst); con = DatabaseUtility.getDBConnection(); st = con.createStatement(); editPerson(con, st, pst); logger.debug("after editing person list::"); con = DatabaseUtility.getDBConnection(); st = con.createStatement(); allPersons(con, pst); option = runAgain(); break; case 3: logger.debug("case 3:"); con = DatabaseUtility.getDBConnection(); st = con.createStatement(); logger.debug("before deleting person list::"); allPersons(con, pst); con = DatabaseUtility.getDBConnection(); st = con.createStatement(); deletePerson(con, pst); logger.debug("after deleting person list::"); allPersons(con, pst); option = runAgain(); break; // if 4 no of persons case 4: logger.debug("case 4::"); con = DatabaseUtility.getDBConnection(); st = con.createStatement(); personCount(con, pst); option = runAgain(); break; case 5: logger.debug("case 5:"); con = DatabaseUtility.getDBConnection(); st = con.createStatement(); allPersons(con, pst); option = runAgain(); break; default: System.exit(6); logger.debug("exit from program"); } } while (option <= 5); } public static int runAgain() { String myObj = chooseOption(); int option = 0; option = validateIntValue(myObj); System.out.println("your chossen option is: " + option); return option; } public static void editPerson(Connection con, Statement st, PreparedStatement ps) { Scanner scannerObj = new Scanner(System.in); System.out.println("please enter pid"); String sid = scannerObj.nextLine(); int Personid = validateIntValue(sid); Scanner scannerObj2 = new Scanner(System.in); System.out.println("please enter firstname"); String firstname = scannerObj.nextLine(); Scanner scannerObj3 = new Scanner(System.in); System.out.println("please enter surname"); String surname = scannerObj3.nextLine(); Person p = null; String sql = "SELECT * FROM persons where pid=?"; try { PreparedStatement pst = con.prepareStatement(sql); pst.setInt(1, Personid); ResultSet rs = pst.executeQuery(); Person dbPerson = null; while (rs.next()) { String updateuserquery = "UPDATE persons SET firstname=? , surname=? where pid=?"; PreparedStatement pstt = con.prepareStatement(updateuserquery); pstt.setString(1, firstname); pstt.setString(2, surname); pstt.setInt(3, Personid); int rowsUpdated = pstt.executeUpdate(); if (rowsUpdated > 0) { logger.debug("An existing person was updated successfully!"); } else { logger.debug("update not done"); } } rs.close(); st.close(); pst.close(); } catch (SQLException e) { logger.error(e.getMessage()); } } public static void deletePerson(Connection con, PreparedStatement st) { Scanner scannerObj = new Scanner(System.in); System.out.println("please enter pid"); String sid = scannerObj.nextLine(); int Personid = validateIntValue(sid); Person p = null; try { String sql = "DELETE FROM persons " + "WHERE pid = ?"; PreparedStatement pstt = con.prepareStatement(sql); pstt.setInt(1, Personid); int rowsUpdated = pstt.executeUpdate(); if (rowsUpdated > 0) { logger.debug("An existing person was deleted successfully!"); } else { logger.debug("delete not done"); } } catch (SQLException e) { logger.error(e.getMessage()); } } public static void addPerson(Connection con, Statement st) { Scanner scannerObj = new Scanner(System.in); System.out.println("please enter pid"); String sid = scannerObj.nextLine(); int Personid = validateIntValue(sid); Scanner scannerObj2 = new Scanner(System.in); System.out.println("please enter firstname"); String firstname = scannerObj2.nextLine(); Scanner scannerObj3 = new Scanner(System.in); System.out.println("please enter surname"); String surname = scannerObj3.nextLine(); int m = 0; try { m = st.executeUpdate( "insert into PERSONS (firstname,surname)values('" + firstname + "','" + surname + "')"); } catch (SQLException e) { logger.error(e.getMessage()); } if (m == 1) logger.debug("inserted successfully : " + m); else logger.debug("insertion failed"); try { con.close(); st.close(); } catch (SQLException e) { logger.error(e.getMessage()); } } public static int validateIntValue(String sc) { int option = 0; try { option = Integer.parseInt(sc); } catch (NumberFormatException ex) { System.out.println("Please enter non String value"); } catch (Exception e) { logger.error(e.getMessage()); } return option; } public static String chooseOption() { Scanner myObj = new Scanner(System.in); System.out.println("please enter your option from the following:"); System.out.println("enter 1 as add the person"); System.out.println("enter 2 as edit the person"); System.out.println("enter 3 as delete the person"); System.out.println("enter 4 as count the no of person"); System.out.println("enter 5 as to print the persons list"); String SringObj = myObj.nextLine(); return SringObj; } public static void personCount(Connection con, PreparedStatement pst) { List<Person> personList = new ArrayList<Person>(); personList = allPersons(con, pst); logger.debug("persons count=" + personList.size()); } public static List<Person> allPersons(Connection con, PreparedStatement pst) { String sql = "SELECT pid,firstname,surname FROM persons"; List<Person> personList = new ArrayList<Person>(); try { pst = con.prepareStatement(sql); ResultSet rs = pst.executeQuery(); while (rs.next()) { Person dbPerson = new Person(); int pid = rs.getInt(1); dbPerson.setPid(pid); String fname = rs.getString(2); dbPerson.setFirstname(fname); dbPerson.setSurname(rs.getString(3)); personList.add(dbPerson); } logger.debug("list of persons data=" + personList); rs.close(); pst.close(); con.close(); } catch (Exception e) { logger.error(e.getMessage()); } return personList; } }
7,231
0.676808
0.671138
265
26.286793
20.072153
93
false
false
0
0
0
0
0
0
2.966038
false
false
7
4b5dcc2065bfa2b107c4ea827e30151e15ffd555
1,778,116,528,786
ce068cc72cd60b955f152cb8fae2b28080bfb7bd
/system-test/src/main/java/org/apache/mesos/elasticsearch/systemtest/Main.java
061d6cb901dc3b51fd532495a661cfcc910d88d4
[ "Apache-2.0" ]
permissive
mariobyn/elasticsearch
https://github.com/mariobyn/elasticsearch
56133a8fc44404f81d9b2771b0a86e15dbd7a20b
2d6df867c66f37953f4ed2264c067860f70bd162
refs/heads/master
2021-01-22T15:22:17.032000
2015-07-21T14:45:54
2015-07-21T14:45:54
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.apache.mesos.elasticsearch.systemtest; import com.github.dockerjava.api.DockerClient; import com.github.dockerjava.api.command.CreateContainerCmd; import org.apache.log4j.Logger; import org.apache.mesos.mini.MesosCluster; import org.apache.mesos.mini.docker.DockerUtil; import org.apache.mesos.mini.mesos.MesosClusterConfig; import java.util.stream.IntStream; /** * Main app to run Mesos Elasticsearch with Mini Mesos. */ public class Main { public static final Logger LOGGER = Logger.getLogger(Main.class); private static DockerClient docker; public static final String MESOS_PORT = "5050"; private static String schedulerId; public static void main(String[] args) throws InterruptedException { MesosClusterConfig config = MesosClusterConfig.builder() .numberOfSlaves(3) .privateRegistryPort(15000) // Currently you have to choose an available port by yourself .slaveResources(new String[]{"ports(*):[9200-9200,9300-9300]", "ports(*):[9201-9201,9301-9301]", "ports(*):[9202-9202,9302-9302]"}) .build(); docker = config.dockerClient; Runtime.getRuntime().addShutdownHook(new Thread(Main::shutdown)); MesosCluster cluster = new MesosCluster(config); cluster.start(); cluster.injectImage("mesos/elasticsearch-executor"); String ipAddress = cluster.getMesosContainer().getMesosMasterURL().replace(":" + MESOS_PORT, ""); final String schedulerImage = "mesos/elasticsearch-scheduler"; CreateContainerCmd createCommand = docker .createContainerCmd(schedulerImage) .withExtraHosts(IntStream.rangeClosed(1, config.numberOfSlaves).mapToObj(value -> "slave" + value + ":" + ipAddress).toArray(String[]::new)) .withCmd("-zk", "zk://" + ipAddress + ":2181/mesos", "-n", "3", "-m", "9999", "-ram", "64"); DockerUtil dockerUtil = new DockerUtil(config.dockerClient); schedulerId = dockerUtil.createAndStart(createCommand); LOGGER.info("Type CTRL-C to quit"); while (true) { Thread.sleep(1000); } } private static void shutdown() { docker.removeContainerCmd(schedulerId).withForce().exec(); } }
UTF-8
Java
2,289
java
Main.java
Java
[]
null
[]
package org.apache.mesos.elasticsearch.systemtest; import com.github.dockerjava.api.DockerClient; import com.github.dockerjava.api.command.CreateContainerCmd; import org.apache.log4j.Logger; import org.apache.mesos.mini.MesosCluster; import org.apache.mesos.mini.docker.DockerUtil; import org.apache.mesos.mini.mesos.MesosClusterConfig; import java.util.stream.IntStream; /** * Main app to run Mesos Elasticsearch with Mini Mesos. */ public class Main { public static final Logger LOGGER = Logger.getLogger(Main.class); private static DockerClient docker; public static final String MESOS_PORT = "5050"; private static String schedulerId; public static void main(String[] args) throws InterruptedException { MesosClusterConfig config = MesosClusterConfig.builder() .numberOfSlaves(3) .privateRegistryPort(15000) // Currently you have to choose an available port by yourself .slaveResources(new String[]{"ports(*):[9200-9200,9300-9300]", "ports(*):[9201-9201,9301-9301]", "ports(*):[9202-9202,9302-9302]"}) .build(); docker = config.dockerClient; Runtime.getRuntime().addShutdownHook(new Thread(Main::shutdown)); MesosCluster cluster = new MesosCluster(config); cluster.start(); cluster.injectImage("mesos/elasticsearch-executor"); String ipAddress = cluster.getMesosContainer().getMesosMasterURL().replace(":" + MESOS_PORT, ""); final String schedulerImage = "mesos/elasticsearch-scheduler"; CreateContainerCmd createCommand = docker .createContainerCmd(schedulerImage) .withExtraHosts(IntStream.rangeClosed(1, config.numberOfSlaves).mapToObj(value -> "slave" + value + ":" + ipAddress).toArray(String[]::new)) .withCmd("-zk", "zk://" + ipAddress + ":2181/mesos", "-n", "3", "-m", "9999", "-ram", "64"); DockerUtil dockerUtil = new DockerUtil(config.dockerClient); schedulerId = dockerUtil.createAndStart(createCommand); LOGGER.info("Type CTRL-C to quit"); while (true) { Thread.sleep(1000); } } private static void shutdown() { docker.removeContainerCmd(schedulerId).withForce().exec(); } }
2,289
0.671909
0.639144
63
35.333332
36.645882
156
false
false
0
0
0
0
0
0
0.634921
false
false
7
fc3b5e1e35dbd45c697769d28938cdb70a32979a
11,647,951,377,522
c1bd1be5cf6eaacea93d7061039fe383aaed02c4
/app/src/main/java/com/benitez/goddamncourier/DataAccess/DeliveryDataAccess.java
e6bfb7b39d27324c72d23e54e2691b641101e3f9
[]
no_license
marianamqb/GoddamnCourier
https://github.com/marianamqb/GoddamnCourier
6e2e807ba2883e51b9090cc1dc26b17b5849a5b7
69bb7d9dd113d68f65d7e441342fbbef49db1244
refs/heads/master
2016-09-12T13:34:37.108000
2016-07-08T20:24:03
2016-07-08T20:24:03
61,166,574
0
2
null
false
2016-06-23T23:24:03
2016-06-15T01:00:50
2016-06-15T01:02:32
2016-06-23T23:24:02
95
0
2
0
Java
null
null
package com.benitez.goddamncourier.DataAccess; import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteConstraintException; import android.database.sqlite.SQLiteDatabase; import android.util.Log; import com.benitez.goddamncourier.DataProvider.DbContentProvider; import com.benitez.goddamncourier.IDataAccess.IDeliveryDataAccess; import com.benitez.goddamncourier.Models.Delivery; import com.benitez.goddamncourier.Models.DeliveryItem; import com.benitez.goddamncourier.Schemas.IDeliverySchema; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; /** * Created by Mariana on 26/06/2016. */ public class DeliveryDataAccess extends DbContentProvider implements IDeliverySchema, IDeliveryDataAccess { //region [ Fields ] private Cursor cursor; private ContentValues initialValues; private SQLiteDatabase db; //endregion [ Fields ] //region [ Constructor ] public DeliveryDataAccess(SQLiteDatabase db) { super(db); this.db = db; } //endregion [ Constructor ] //region [ DbContentProvider ] @Override protected Delivery cursorToEntity(Cursor cursor) { Delivery delivery = new Delivery(); int idIndex; int courierIdIndex; int dueDateIndex; int shippedDateIndex; int deliveryDateIndex; int addressIndex; int statusIndex; if (cursor != null) { if (cursor.getColumnIndex(COLUMN_ID) != -1) { idIndex = cursor.getColumnIndexOrThrow(COLUMN_ID); delivery.setId(cursor.getInt(idIndex)); } if (cursor.getColumnIndex(COLUMN_COURIER_ID) != -1) { courierIdIndex = cursor.getColumnIndexOrThrow(COLUMN_COURIER_ID); delivery.setCourierId(cursor.getInt(courierIdIndex)); } if (cursor.getColumnIndex(COLUMN_DUE_DATE) != -1) { dueDateIndex = cursor.getColumnIndexOrThrow(COLUMN_DUE_DATE); delivery.setDueDate(new Date(cursor.getLong(dueDateIndex))); } if (cursor.getColumnIndex(COLUMN_SHIPPED_DATE) != -1) { shippedDateIndex = cursor.getColumnIndexOrThrow(COLUMN_SHIPPED_DATE); delivery.setShippedDate(new Date(cursor.getLong(shippedDateIndex))); } if (cursor.getColumnIndex(COLUMN_DELIVERY_DATE) != -1) { deliveryDateIndex = cursor.getColumnIndexOrThrow(COLUMN_DELIVERY_DATE); delivery.setDeliveryDate(new Date(cursor.getLong(deliveryDateIndex))); } if (cursor.getColumnIndex(COLUMN_ADDRESS) != -1) { addressIndex = cursor.getColumnIndexOrThrow(COLUMN_ADDRESS); delivery.setAddress(cursor.getString(addressIndex)); } if (cursor.getColumnIndex(COLUMN_STATUS) != -1) { statusIndex = cursor.getColumnIndexOrThrow(COLUMN_STATUS); delivery.setStatus(cursor.getInt(statusIndex)); } } return delivery; } //endregion [ DbContentProvider ] //region [ IDeliveryDataAccess ] @Override public boolean add(Delivery delivery) { setContentValue(delivery); try { return super.insert(DELIVERY_TABLE, getContentValue()) > 0; } catch (SQLiteConstraintException ex) { Log.w("Database", ex.getMessage()); return false; } } @Override public boolean update(Delivery updatedDelivery) { final String selectionArgs[] = { String.valueOf(updatedDelivery.getId()) }; final String selection = COLUMN_ID + " = ?"; setContentValue(updatedDelivery); try { return super.update(DELIVERY_TABLE, getContentValue(), selection, selectionArgs) > 0; } catch (SQLiteConstraintException ex) { Log.w("Database", ex.getMessage()); return false; } } @Override public Delivery getById(int id) { Delivery delivery = new Delivery(); final String selectionArgs[] = { String.valueOf(id) }; final String selection = COLUMN_ID + " = ?"; try { cursor = super.query(DELIVERY_TABLE, DELIVERY_COLUMNS, selection, selectionArgs, COLUMN_ID); if (cursor != null) { cursor.moveToFirst(); while (!cursor.isAfterLast()) { delivery = cursorToEntity(cursor); delivery.setDeliveryItemList(new DeliveryItemDataAccess(db).getByDeliveryId(delivery.getId())); cursor.moveToNext(); } cursor.close(); } } catch(Exception ex){ String e = ex.getMessage(); e = e + " "; } return delivery; } @Override public ArrayList<Delivery> getAllByCourierId(int id) { ArrayList<Delivery> deliveryItemList = new ArrayList<>(); final String selectionArgs[] = { String.valueOf(id) }; final String selection = COLUMN_COURIER_ID + " = ?"; cursor = super.query(DELIVERY_TABLE, DELIVERY_COLUMNS, selection, selectionArgs, COLUMN_ID); if (cursor != null) { cursor.moveToFirst(); while (!cursor.isAfterLast()) { Delivery delivery = cursorToEntity(cursor); delivery.setDeliveryItemList(new DeliveryItemDataAccess(db).getByDeliveryId(delivery.getId())); deliveryItemList.add(delivery); cursor.moveToNext(); } cursor.close(); } return deliveryItemList; } //endregion [ IDeliveryDataAccess ] //region [ Private Methods ] private void setContentValue(Delivery delivery) { SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); initialValues = new ContentValues(); initialValues.put(COLUMN_ID, delivery.getId()); initialValues.put(COLUMN_COURIER_ID, delivery.getCourierId()); initialValues.put(COLUMN_DUE_DATE, parser.format(delivery.getDueDate())); initialValues.put(COLUMN_SHIPPED_DATE, parser.format(delivery.getShippedDate())); initialValues.put(COLUMN_DELIVERY_DATE, parser.format(delivery.getDeliveryDate())); initialValues.put(COLUMN_ADDRESS, delivery.getAddress()); initialValues.put(COLUMN_STATUS, delivery.getStatusValue()); } private ContentValues getContentValue() { return initialValues; } //endregion [ Private Methods ] }
UTF-8
Java
6,854
java
DeliveryDataAccess.java
Java
[ { "context": "rayList;\nimport java.util.Date;\n\n/**\n * Created by Mariana on 26/06/2016.\n */\npublic class DeliveryDataAcces", "end": 660, "score": 0.9981276988983154, "start": 653, "tag": "NAME", "value": "Mariana" } ]
null
[]
package com.benitez.goddamncourier.DataAccess; import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteConstraintException; import android.database.sqlite.SQLiteDatabase; import android.util.Log; import com.benitez.goddamncourier.DataProvider.DbContentProvider; import com.benitez.goddamncourier.IDataAccess.IDeliveryDataAccess; import com.benitez.goddamncourier.Models.Delivery; import com.benitez.goddamncourier.Models.DeliveryItem; import com.benitez.goddamncourier.Schemas.IDeliverySchema; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; /** * Created by Mariana on 26/06/2016. */ public class DeliveryDataAccess extends DbContentProvider implements IDeliverySchema, IDeliveryDataAccess { //region [ Fields ] private Cursor cursor; private ContentValues initialValues; private SQLiteDatabase db; //endregion [ Fields ] //region [ Constructor ] public DeliveryDataAccess(SQLiteDatabase db) { super(db); this.db = db; } //endregion [ Constructor ] //region [ DbContentProvider ] @Override protected Delivery cursorToEntity(Cursor cursor) { Delivery delivery = new Delivery(); int idIndex; int courierIdIndex; int dueDateIndex; int shippedDateIndex; int deliveryDateIndex; int addressIndex; int statusIndex; if (cursor != null) { if (cursor.getColumnIndex(COLUMN_ID) != -1) { idIndex = cursor.getColumnIndexOrThrow(COLUMN_ID); delivery.setId(cursor.getInt(idIndex)); } if (cursor.getColumnIndex(COLUMN_COURIER_ID) != -1) { courierIdIndex = cursor.getColumnIndexOrThrow(COLUMN_COURIER_ID); delivery.setCourierId(cursor.getInt(courierIdIndex)); } if (cursor.getColumnIndex(COLUMN_DUE_DATE) != -1) { dueDateIndex = cursor.getColumnIndexOrThrow(COLUMN_DUE_DATE); delivery.setDueDate(new Date(cursor.getLong(dueDateIndex))); } if (cursor.getColumnIndex(COLUMN_SHIPPED_DATE) != -1) { shippedDateIndex = cursor.getColumnIndexOrThrow(COLUMN_SHIPPED_DATE); delivery.setShippedDate(new Date(cursor.getLong(shippedDateIndex))); } if (cursor.getColumnIndex(COLUMN_DELIVERY_DATE) != -1) { deliveryDateIndex = cursor.getColumnIndexOrThrow(COLUMN_DELIVERY_DATE); delivery.setDeliveryDate(new Date(cursor.getLong(deliveryDateIndex))); } if (cursor.getColumnIndex(COLUMN_ADDRESS) != -1) { addressIndex = cursor.getColumnIndexOrThrow(COLUMN_ADDRESS); delivery.setAddress(cursor.getString(addressIndex)); } if (cursor.getColumnIndex(COLUMN_STATUS) != -1) { statusIndex = cursor.getColumnIndexOrThrow(COLUMN_STATUS); delivery.setStatus(cursor.getInt(statusIndex)); } } return delivery; } //endregion [ DbContentProvider ] //region [ IDeliveryDataAccess ] @Override public boolean add(Delivery delivery) { setContentValue(delivery); try { return super.insert(DELIVERY_TABLE, getContentValue()) > 0; } catch (SQLiteConstraintException ex) { Log.w("Database", ex.getMessage()); return false; } } @Override public boolean update(Delivery updatedDelivery) { final String selectionArgs[] = { String.valueOf(updatedDelivery.getId()) }; final String selection = COLUMN_ID + " = ?"; setContentValue(updatedDelivery); try { return super.update(DELIVERY_TABLE, getContentValue(), selection, selectionArgs) > 0; } catch (SQLiteConstraintException ex) { Log.w("Database", ex.getMessage()); return false; } } @Override public Delivery getById(int id) { Delivery delivery = new Delivery(); final String selectionArgs[] = { String.valueOf(id) }; final String selection = COLUMN_ID + " = ?"; try { cursor = super.query(DELIVERY_TABLE, DELIVERY_COLUMNS, selection, selectionArgs, COLUMN_ID); if (cursor != null) { cursor.moveToFirst(); while (!cursor.isAfterLast()) { delivery = cursorToEntity(cursor); delivery.setDeliveryItemList(new DeliveryItemDataAccess(db).getByDeliveryId(delivery.getId())); cursor.moveToNext(); } cursor.close(); } } catch(Exception ex){ String e = ex.getMessage(); e = e + " "; } return delivery; } @Override public ArrayList<Delivery> getAllByCourierId(int id) { ArrayList<Delivery> deliveryItemList = new ArrayList<>(); final String selectionArgs[] = { String.valueOf(id) }; final String selection = COLUMN_COURIER_ID + " = ?"; cursor = super.query(DELIVERY_TABLE, DELIVERY_COLUMNS, selection, selectionArgs, COLUMN_ID); if (cursor != null) { cursor.moveToFirst(); while (!cursor.isAfterLast()) { Delivery delivery = cursorToEntity(cursor); delivery.setDeliveryItemList(new DeliveryItemDataAccess(db).getByDeliveryId(delivery.getId())); deliveryItemList.add(delivery); cursor.moveToNext(); } cursor.close(); } return deliveryItemList; } //endregion [ IDeliveryDataAccess ] //region [ Private Methods ] private void setContentValue(Delivery delivery) { SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); initialValues = new ContentValues(); initialValues.put(COLUMN_ID, delivery.getId()); initialValues.put(COLUMN_COURIER_ID, delivery.getCourierId()); initialValues.put(COLUMN_DUE_DATE, parser.format(delivery.getDueDate())); initialValues.put(COLUMN_SHIPPED_DATE, parser.format(delivery.getShippedDate())); initialValues.put(COLUMN_DELIVERY_DATE, parser.format(delivery.getDeliveryDate())); initialValues.put(COLUMN_ADDRESS, delivery.getAddress()); initialValues.put(COLUMN_STATUS, delivery.getStatusValue()); } private ContentValues getContentValue() { return initialValues; } //endregion [ Private Methods ] }
6,854
0.607383
0.604902
215
30.87907
27.8682
115
false
false
0
0
0
0
0
0
0.497674
false
false
7
4a8023519a91f9e0e293f21b992d5a24f73af125
11,716,670,812,129
84780f2b5a0ecc78aae8dc2bc24554ad8eaaf928
/src/main/java/com/example/demo/model/NewTaxi/NewTaxiElement.java
0203c37305645f6a46950bbcfdd64c6cfe6c8631
[]
no_license
TheBigPancake/FirstSpringServer.iml
https://github.com/TheBigPancake/FirstSpringServer.iml
a1bb2572c06212e69c0105986bf94acc7eb27e1a
a23063dd89f9d9425d14037c2f5bcfb57b26677b
refs/heads/master
2023-05-09T19:08:35.901000
2021-06-07T07:52:25
2021-06-07T07:52:25
374,580,650
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.demo.model.NewTaxi; public interface NewTaxiElement { public NewTaxiElement clone(); public String toHTML(); public int compareTo(NewTaxiElement elem); }
UTF-8
Java
187
java
NewTaxiElement.java
Java
[]
null
[]
package com.example.demo.model.NewTaxi; public interface NewTaxiElement { public NewTaxiElement clone(); public String toHTML(); public int compareTo(NewTaxiElement elem); }
187
0.754011
0.754011
7
25.714285
16.832912
46
false
false
0
0
0
0
0
0
0.571429
false
false
7
e8b5cb65ee1e86011e7c94e2fdfb14ae3d9d2a4c
24,172,075,975,086
19688c536e3e23d40ed58d7a5ad25dcacf80358e
/src/model/Followup.java
198e7f1ef7de39e82c8ee5d21751425911acbafd
[]
no_license
julioizidoro/systm
https://github.com/julioizidoro/systm
0a8e9817dda18d9c33cf1c78d8b120cade55b13f
023acf52bdcc2489f9696f4934bbc304ab55f82a
refs/heads/master
2021-01-17T13:11:40.575000
2016-05-17T19:36:36
2016-05-17T19:36:36
22,035,771
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package model; import java.io.Serializable; import java.util.Date; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Lob; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; /** * * @author Wolverine */ @Entity @Table(name = "followup") public class Followup implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "idfollowup") private Integer idfollowup; @Column(name = "situacao") private String situacao; @Column(name = "dataProximoContato") @Temporal(TemporalType.DATE) private Date dataProximoContato; @Column(name = "horaproximocontato") @Temporal(TemporalType.TIME) private Date horaproximocontato; @Column(name = "nomeConcorrencia") private String nomeConcorrencia; @Column(name = "nivelInteresse") private String nivelInteresse; @Column(name = "pais") private String pais; @Lob @Column(name = "historico") private String historico; @Column(name = "usuario_idusuario") private int usuario; @Column(name = "unidadeNegocio_idunidadeNegocio") private int unidadenegocio; @Column(name = "cliente_idcliente") private int cliente; @Column(name = "produtos_idprodutos") private int produto; @Column(name = "dataInicio") @Temporal(TemporalType.DATE) private Date dataInicio; @Column(name = "dataFechamento") @Temporal(TemporalType.DATE) private Date dataFechamneto; @Column(name = "Fechou") private String fechou; public Followup() { } public Followup(Integer idfollowup) { this.idfollowup = idfollowup; } public Integer getIdfollowup() { return idfollowup; } public void setIdfollowup(Integer idfollowup) { this.idfollowup = idfollowup; } public String getHistorico() { return historico; } public void setHistorico(String historico) { this.historico = historico; } public Date getDataInicio() { return dataInicio; } public Date getDataFechamneto() { return dataFechamneto; } public void setDataFechamneto(Date dataFechamneto) { this.dataFechamneto = dataFechamneto; } public String getFechou() { return fechou; } public void setFechou(String fechou) { this.fechou = fechou; } public void setDataInicio(Date dataInicio) { this.dataInicio = dataInicio; } public int getProduto() { return produto; } public void setProduto(int produto) { this.produto = produto; } public Date getHoraproximocontato() { return horaproximocontato; } public void setHoraproximocontato(Date horaproximocontato) { this.horaproximocontato = horaproximocontato; } public String getPais() { return pais; } public void setPais(String pais) { this.pais = pais; } public String getSituacao() { return situacao; } public void setSituacao(String situacao) { this.situacao = situacao; } public Date getDataProximoContato() { return dataProximoContato; } public void setDataProximoContato(Date dataProximoContato) { this.dataProximoContato = dataProximoContato; } public String getNomeConcorrencia() { return nomeConcorrencia; } public void setNomeConcorrencia(String nomeConcorrencia) { this.nomeConcorrencia = nomeConcorrencia; } public String getNivelInteresse() { return nivelInteresse; } public void setNivelInteresse(String nivelInteresse) { this.nivelInteresse = nivelInteresse; } public int getUsuario() { return usuario; } public void setUsuario(int usuario) { this.usuario = usuario; } public int getUnidadenegocio() { return unidadenegocio; } public void setUnidadenegocio(int unidadenegocio) { this.unidadenegocio = unidadenegocio; } public int getCliente() { return cliente; } public void setCliente(int cliente) { this.cliente = cliente; } @Override public int hashCode() { int hash = 0; hash += (idfollowup != null ? idfollowup.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Followup)) { return false; } Followup other = (Followup) object; if ((this.idfollowup == null && other.idfollowup != null) || (this.idfollowup != null && !this.idfollowup.equals(other.idfollowup))) { return false; } return true; } @Override public String toString() { return "model.Followup[ idfollowup=" + idfollowup + " ]"; } }
UTF-8
Java
5,342
java
Followup.java
Java
[ { "context": "javax.persistence.TemporalType;\n\n/**\n *\n * @author Wolverine\n */\n@Entity\n@Table(name = \"followup\")\npublic clas", "end": 541, "score": 0.7218244671821594, "start": 532, "tag": "USERNAME", "value": "Wolverine" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package model; import java.io.Serializable; import java.util.Date; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Lob; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; /** * * @author Wolverine */ @Entity @Table(name = "followup") public class Followup implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "idfollowup") private Integer idfollowup; @Column(name = "situacao") private String situacao; @Column(name = "dataProximoContato") @Temporal(TemporalType.DATE) private Date dataProximoContato; @Column(name = "horaproximocontato") @Temporal(TemporalType.TIME) private Date horaproximocontato; @Column(name = "nomeConcorrencia") private String nomeConcorrencia; @Column(name = "nivelInteresse") private String nivelInteresse; @Column(name = "pais") private String pais; @Lob @Column(name = "historico") private String historico; @Column(name = "usuario_idusuario") private int usuario; @Column(name = "unidadeNegocio_idunidadeNegocio") private int unidadenegocio; @Column(name = "cliente_idcliente") private int cliente; @Column(name = "produtos_idprodutos") private int produto; @Column(name = "dataInicio") @Temporal(TemporalType.DATE) private Date dataInicio; @Column(name = "dataFechamento") @Temporal(TemporalType.DATE) private Date dataFechamneto; @Column(name = "Fechou") private String fechou; public Followup() { } public Followup(Integer idfollowup) { this.idfollowup = idfollowup; } public Integer getIdfollowup() { return idfollowup; } public void setIdfollowup(Integer idfollowup) { this.idfollowup = idfollowup; } public String getHistorico() { return historico; } public void setHistorico(String historico) { this.historico = historico; } public Date getDataInicio() { return dataInicio; } public Date getDataFechamneto() { return dataFechamneto; } public void setDataFechamneto(Date dataFechamneto) { this.dataFechamneto = dataFechamneto; } public String getFechou() { return fechou; } public void setFechou(String fechou) { this.fechou = fechou; } public void setDataInicio(Date dataInicio) { this.dataInicio = dataInicio; } public int getProduto() { return produto; } public void setProduto(int produto) { this.produto = produto; } public Date getHoraproximocontato() { return horaproximocontato; } public void setHoraproximocontato(Date horaproximocontato) { this.horaproximocontato = horaproximocontato; } public String getPais() { return pais; } public void setPais(String pais) { this.pais = pais; } public String getSituacao() { return situacao; } public void setSituacao(String situacao) { this.situacao = situacao; } public Date getDataProximoContato() { return dataProximoContato; } public void setDataProximoContato(Date dataProximoContato) { this.dataProximoContato = dataProximoContato; } public String getNomeConcorrencia() { return nomeConcorrencia; } public void setNomeConcorrencia(String nomeConcorrencia) { this.nomeConcorrencia = nomeConcorrencia; } public String getNivelInteresse() { return nivelInteresse; } public void setNivelInteresse(String nivelInteresse) { this.nivelInteresse = nivelInteresse; } public int getUsuario() { return usuario; } public void setUsuario(int usuario) { this.usuario = usuario; } public int getUnidadenegocio() { return unidadenegocio; } public void setUnidadenegocio(int unidadenegocio) { this.unidadenegocio = unidadenegocio; } public int getCliente() { return cliente; } public void setCliente(int cliente) { this.cliente = cliente; } @Override public int hashCode() { int hash = 0; hash += (idfollowup != null ? idfollowup.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Followup)) { return false; } Followup other = (Followup) object; if ((this.idfollowup == null && other.idfollowup != null) || (this.idfollowup != null && !this.idfollowup.equals(other.idfollowup))) { return false; } return true; } @Override public String toString() { return "model.Followup[ idfollowup=" + idfollowup + " ]"; } }
5,342
0.651254
0.650693
222
23.063063
20.073864
142
false
false
0
0
0
0
0
0
0.324324
false
false
7
e62501e5a179771e000857aa2548f66247c80935
2,843,268,396,418
91a37ddbb87dfb6b5394ed9c2bb40effc97d1b52
/src/java/data/BdAlunos.java
7a43a4f3e8716b892aefda246b864586a3f0b5ac
[]
no_license
Anpix/WebBiblioteca
https://github.com/Anpix/WebBiblioteca
3792b9d5b8b96d2e7afa4eb623d5a944c8916416
b175fe480212a97fe7ec4462d1e340c317905452
refs/heads/master
2021-01-13T00:53:08.376000
2015-09-25T03:47:04
2015-09-25T03:47:04
43,103,934
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package data; // @author Anpix import java.util.ArrayList; import java.util.List; import model.Aluno; public abstract class BdAlunos { private static List<Aluno> alunos = new ArrayList(); public static List<Aluno> getAlunos(){ return alunos; } public static void gravar(Aluno aluno){ alunos.add(aluno); } public static void remover(Aluno aluno){ alunos.remove(aluno); } }
UTF-8
Java
465
java
BdAlunos.java
Java
[ { "context": "package data;\r\n\r\n// @author Anpix\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.", "end": 33, "score": 0.971210777759552, "start": 28, "tag": "NAME", "value": "Anpix" } ]
null
[]
package data; // @author Anpix import java.util.ArrayList; import java.util.List; import model.Aluno; public abstract class BdAlunos { private static List<Aluno> alunos = new ArrayList(); public static List<Aluno> getAlunos(){ return alunos; } public static void gravar(Aluno aluno){ alunos.add(aluno); } public static void remover(Aluno aluno){ alunos.remove(aluno); } }
465
0.610753
0.610753
23
18.217392
16.418325
56
false
false
0
0
0
0
0
0
0.347826
false
false
7
e2b7de0ad15cd5c194c096a712cb2511d97a6f3e
15,427,522,578,787
26d5db2b87ade205de3df079c18bf8cbd9204dbd
/mplus-security/src/main/java/com/mplus/security/config/WebSecurityConfig.java
8d646fe89f3946e25829cd015adc6e8f0482f477
[ "Apache-2.0" ]
permissive
wuwj-cn/mplus
https://github.com/wuwj-cn/mplus
65ba77bad6885edfb4cf1302bbc3b39833504709
1c65ad715dab0e5174f9ef045c599bfa4aa07324
refs/heads/master
2023-05-01T12:33:48.791000
2020-01-03T03:17:34
2020-01-03T03:17:34
198,807,687
0
0
Apache-2.0
false
2022-06-17T02:20:10
2019-07-25T10:09:24
2020-01-03T03:17:53
2022-06-17T02:20:10
401
0
0
2
Java
false
false
package com.mplus.security.config; import java.util.Arrays; import java.util.List; import com.mplus.security.filter.MyFilterSecurityInterceptor; import com.mplus.security.filter.MyUsernamePasswordAuthenticationFilter; import com.mplus.security.handler.MyAccessDeniedHandler; import com.mplus.security.handler.MyAuthenticationFailureHandler; import com.mplus.security.handler.MyAuthenticationSuccessHandler; import com.mplus.security.handler.MyLogoutSuccessHandler; import com.mplus.security.service.MyUserDetailService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.BeanIds; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.security.web.access.AccessDeniedHandler; import org.springframework.security.web.access.intercept.FilterSecurityInterceptor; import org.springframework.security.web.authentication.AuthenticationFailureHandler; import org.springframework.security.web.authentication.AuthenticationSuccessHandler; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; import com.mplus.security.jwt.JwtAuthenticationEntryPoint; import com.mplus.security.jwt.JwtAuthenticationTokenFilter; import com.mplus.security.utils.SkipPathRequestMatcher; /** * web 安全性配置 * 当用户登录时会进入此类的loadUserByUsername方法对用户进行验证,验证成功后会被保存在当前回话的principal对象中 * 系统获取当前登录对象信息方法 WebUserDetails webUserDetails = (WebUserDetails)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); * @author wuwj * */ @Configuration @EnableWebSecurity //启动web安全性 @EnableGlobalMethodSecurity(prePostEnabled = true) //开启方法级的权限注解 性设置后控制器层的方法前的@PreAuthorize("hasRole('admin')") 注解才能起效 public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private MyUserDetailService myUserDetailService; @Autowired private MyFilterSecurityInterceptor myFilterSecurityInterceptor; @Value("${jwt.route.auth.login}") private String loginUrl; @Value("${jwt.route.auth.logout}") private String logoutUrl; // 不需要认证的接口 @Value("${com.mplus.security.antMatchers}") private String antMatchers; /** * 置user-detail服务 * * 方法描述 * accountExpired(boolean) 定义账号是否已经过期 * accountLocked(boolean) 定义账号是否已经锁定 * and() 用来连接配置 * authorities(GrantedAuthority...) 授予某个用户一项或多项权限 * authorities(List) 授予某个用户一项或多项权限 * authorities(String...) 授予某个用户一项或多项权限 * disabled(boolean) 定义账号是否已被禁用 * withUser(String) 定义用户的用户名 * password(String) 定义用户的密码 * roles(String...) 授予某个用户一项或多项角色 * * @param auth * @throws Exception */ @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { //super.configure(auth); // 配置指定用户权限信息 通常生产环境都是从数据库中读取用户权限信息而不是在这里配置 //auth.inMemoryAuthentication().withUser("username1").password("123456").roles("USER").and().withUser("username2").password("123456").roles("USER","AMDIN"); // **************** 基于数据库中的用户权限信息 进行认证 //指定密码加密所使用的加密器为 bCryptPasswordEncoder() //需要将密码加密后写入数据库 // myUserDetailService 类中获取了用户的用户名、密码以及是否启用的信息,查询用户所授予的权限,用来进行鉴权,查询用户作为群组成员所授予的权限 auth.userDetailsService(myUserDetailService).passwordEncoder(bCryptPasswordEncoder()); //不删除凭据,以便记住用户 auth.eraseCredentials(false); } /** * 配置Spring Security的Filter链 * @param web * @throws Exception */ @Override public void configure(WebSecurity web) throws Exception { //解决静态资源被拦截的问题 web.ignoring().antMatchers("/favicon.ico"); web.ignoring().antMatchers("/error"); super.configure(web); } /** * 解决 无法直接注入 AuthenticationManager * @return * @throws Exception */ @Bean(name = BeanIds.AUTHENTICATION_MANAGER) @Override public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } /** * 配置如何通过拦截器保护请求 * 指定哪些请求需要认证,哪些请求不需要认证,以及所需要的权限 * 通过调用authorizeRequests()和anyRequest().authenticated()就会要求所有进入应用的HTTP请求都要进行认证 * * 方法描述 * anonymous() 允许匿名用户访问 * authenticated() 允许经过认证的用户访问 * denyAll() 无条件拒绝所有访问 * fullyAuthenticated() 如果用户是完整的话(不是通过Remember-me功能认证的),就允许访问 * hasAnyAuthority(String...) 如果用户具备给定权限中的某一个的话,就允许访问 * hasAnyRole(String...) 如果用户具备给定角色中的某一个的话,就允许访问 * hasAuthority(String) 如果用户具备给定权限的话,就允许访问 * hasIpAddress(String) 如果请求来自给定IP地址的话,就允许访问 * hasRole(String) 如果用户具备给定角色的话,就允许访问 * not() 对其他访问方法的结果求反 * permitAll() 无条件允许访问 * rememberMe() 如果用户是通过Remember-me功能认证的,就允许访问 * * * @param http * @throws Exception */ @Override protected void configure(HttpSecurity http) throws Exception { System.out.println("不需要认证的url:"+antMatchers); //super.configure(http); //关闭csrf验证 http.csrf().disable() // 基于token,所以不需要session 如果基于session 则表使用这段代码 .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() //对请求进行认证 url认证配置顺序为:1.先配置放行不需要认证的 permitAll() 2.然后配置 需要特定权限的 hasRole() 3.最后配置 anyRequest().authenticated() .authorizeRequests() // 所有 /oauth/v1/api/login/ 请求的都放行 不做认证即不需要登录即可访问 .antMatchers(antMatchers.split(",")).permitAll() //.antMatchers("/auth/v1/api/login/**","/auth/v1/api/module/tree/**","/auth/v1/api/grid/**").permitAll() // 对于获取token的rest api要允许匿名访问 .antMatchers("oauth/**").permitAll() // 其他请求都需要进行认证,认证通过够才能访问 待考证:如果使用重定向 httpServletRequest.getRequestDispatcher(url).forward(httpServletRequest,httpServletResponse); 重定向跳转的url不会被拦截(即在这里配置了重定向的url需要特定权限认证不起效),但是如果在Controller 方法上配置了方法级的权限则会进行拦截 .anyRequest().authenticated() .and().exceptionHandling() // 认证配置当用户请求了一个受保护的资源,但是用户没有通过登录认证,则抛出登录认证异常,MyAuthenticationEntryPointHandler类中commence()就会调用 .authenticationEntryPoint(myAuthenticationEntryPoint()) //用户已经通过了登录认证,在访问一个受保护的资源,但是权限不够,则抛出授权异常,MyAccessDeniedHandler类中handle()就会调用 .accessDeniedHandler(myAccessDeniedHandler()) .and() // .formLogin() // 登录url // .loginProcessingUrl("/auth/v1/api/login/entry") // 此登录url 和Controller 无关系 .loginProcessingUrl(this.loginUrl) // .loginProcessingUrl("/auth/v1/api/login/enter") //使用自己定义的Controller 中的方法 登录会进入Controller 中的方法 // username参数名称 后台接收前端的参数名 .usernameParameter("userAccount") //登录密码参数名称 后台接收前端的参数名 .passwordParameter("userPwd") //登录成功跳转路径 .successForwardUrl("/") //登录失败跳转路径 .failureUrl("/") //登录页面路径 .loginPage("/") .permitAll() //登录成功后 MyAuthenticationSuccessHandler类中onAuthenticationSuccess()被调用 .successHandler(myAuthenticationSuccessHandler()) //登录失败后 MyAuthenticationFailureHandler 类中onAuthenticationFailure()被调用 .failureHandler(myAuthenticationFailureHandler()) .and() .logout() //退出系统url // .logoutUrl("/auth/v1/api/login/logout") .logoutUrl(this.logoutUrl) //退出系统后的url跳转 .logoutSuccessUrl("/") //退出系统后的 业务处理 .logoutSuccessHandler(myLogoutSuccessHandler()) .permitAll() .invalidateHttpSession(true) .and() //登录后记住用户,下次自动登录,数据库中必须存在名为persistent_logins的表 // 勾选Remember me登录会在PERSISTENT_LOGINS表中,生成一条记录 .rememberMe() //cookie的有效期(秒为单位 .tokenValiditySeconds(3600); // 加入自定义UsernamePasswordAuthenticationFilter替代原有Filter http.addFilterAt(myUsernamePasswordAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class); //在 beforeFilter 之前添加 自定义 filter http.addFilterBefore(myFilterSecurityInterceptor, FilterSecurityInterceptor.class); // 添加JWT filter 验证其他请求的Token是否合法 http.addFilterBefore(authenticationTokenFilterBean(), FilterSecurityInterceptor.class); // 禁用缓存 http.headers().cacheControl(); } /** * 密码加密方式 * @return */ @Bean public BCryptPasswordEncoder bCryptPasswordEncoder() { return new BCryptPasswordEncoder(); } /** * 注册 登录认证 bean * @return */ @Bean public AuthenticationEntryPoint myAuthenticationEntryPoint(){ //return new MyAuthenticationEntryPointHandler(); return new JwtAuthenticationEntryPoint(); } /** * 注册 认证权限不足处理 bean * @return */ @Bean public AccessDeniedHandler myAccessDeniedHandler(){ return new MyAccessDeniedHandler(); } /** * 注册 登录成功 处理 bean * @return */ @Bean public AuthenticationSuccessHandler myAuthenticationSuccessHandler(){ return new MyAuthenticationSuccessHandler(); } /** * 注册 登录失败 处理 bean * @return */ @Bean public AuthenticationFailureHandler myAuthenticationFailureHandler(){ return new MyAuthenticationFailureHandler(); } /** * 注册 退出系统成功 处理bean * @return */ @Bean public LogoutSuccessHandler myLogoutSuccessHandler(){ return new MyLogoutSuccessHandler(); } /** * 注册jwt 认证 * @return * @throws Exception */ @Bean public JwtAuthenticationTokenFilter authenticationTokenFilterBean() throws Exception { // JwtAuthenticationTokenFilter 过滤器被配置为跳过这个点:/auth/v1/api/login/retrieve/pwd 和 /auth/v1/api/login/entry 不进行token 验证. 通过 SkipPathRequestMatcher 实现 RequestMatcher 接口来实现。 List<String> pathsToSkip = Arrays.asList( "/auth/v1/api/login/retrieve/pwd", "/auth/v1/api/login", "/auth/v1/api/login/enter"); //不需要token 验证的url String processingPath = "/auth/v1/api/**"; // 需要验证token 的url SkipPathRequestMatcher matcher = new SkipPathRequestMatcher(pathsToSkip, processingPath); return new JwtAuthenticationTokenFilter(matcher); } /** * 验证登录验证码 * @return * @throws Exception */ @Bean public UsernamePasswordAuthenticationFilter myUsernamePasswordAuthenticationFilter() throws Exception { return new MyUsernamePasswordAuthenticationFilter( this.loginUrl, authenticationManagerBean(), myAuthenticationSuccessHandler(), myAuthenticationFailureHandler()); } }
UTF-8
Java
14,901
java
WebSecurityConfig.java
Java
[ { "context": "t().getAuthentication().getPrincipal();\n * @author wuwj\n *\n */\n@Configuration\n@EnableWebSecurity //启动web", "end": 2574, "score": 0.9995827078819275, "start": 2570, "tag": "USERNAME", "value": "wuwj" }, { "context": " //auth.inMemoryAuthentication().withUser...
null
[]
package com.mplus.security.config; import java.util.Arrays; import java.util.List; import com.mplus.security.filter.MyFilterSecurityInterceptor; import com.mplus.security.filter.MyUsernamePasswordAuthenticationFilter; import com.mplus.security.handler.MyAccessDeniedHandler; import com.mplus.security.handler.MyAuthenticationFailureHandler; import com.mplus.security.handler.MyAuthenticationSuccessHandler; import com.mplus.security.handler.MyLogoutSuccessHandler; import com.mplus.security.service.MyUserDetailService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.BeanIds; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.security.web.access.AccessDeniedHandler; import org.springframework.security.web.access.intercept.FilterSecurityInterceptor; import org.springframework.security.web.authentication.AuthenticationFailureHandler; import org.springframework.security.web.authentication.AuthenticationSuccessHandler; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; import com.mplus.security.jwt.JwtAuthenticationEntryPoint; import com.mplus.security.jwt.JwtAuthenticationTokenFilter; import com.mplus.security.utils.SkipPathRequestMatcher; /** * web 安全性配置 * 当用户登录时会进入此类的loadUserByUsername方法对用户进行验证,验证成功后会被保存在当前回话的principal对象中 * 系统获取当前登录对象信息方法 WebUserDetails webUserDetails = (WebUserDetails)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); * @author wuwj * */ @Configuration @EnableWebSecurity //启动web安全性 @EnableGlobalMethodSecurity(prePostEnabled = true) //开启方法级的权限注解 性设置后控制器层的方法前的@PreAuthorize("hasRole('admin')") 注解才能起效 public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private MyUserDetailService myUserDetailService; @Autowired private MyFilterSecurityInterceptor myFilterSecurityInterceptor; @Value("${jwt.route.auth.login}") private String loginUrl; @Value("${jwt.route.auth.logout}") private String logoutUrl; // 不需要认证的接口 @Value("${com.mplus.security.antMatchers}") private String antMatchers; /** * 置user-detail服务 * * 方法描述 * accountExpired(boolean) 定义账号是否已经过期 * accountLocked(boolean) 定义账号是否已经锁定 * and() 用来连接配置 * authorities(GrantedAuthority...) 授予某个用户一项或多项权限 * authorities(List) 授予某个用户一项或多项权限 * authorities(String...) 授予某个用户一项或多项权限 * disabled(boolean) 定义账号是否已被禁用 * withUser(String) 定义用户的用户名 * password(String) 定义用户的密码 * roles(String...) 授予某个用户一项或多项角色 * * @param auth * @throws Exception */ @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { //super.configure(auth); // 配置指定用户权限信息 通常生产环境都是从数据库中读取用户权限信息而不是在这里配置 //auth.inMemoryAuthentication().withUser("username1").password("<PASSWORD>").roles("USER").and().withUser("username2").password("<PASSWORD>").roles("USER","AMDIN"); // **************** 基于数据库中的用户权限信息 进行认证 //指定密码加密所使用的加密器为 bCryptPasswordEncoder() //需要将密码加密后写入数据库 // myUserDetailService 类中获取了用户的用户名、密码以及是否启用的信息,查询用户所授予的权限,用来进行鉴权,查询用户作为群组成员所授予的权限 auth.userDetailsService(myUserDetailService).passwordEncoder(bCryptPasswordEncoder()); //不删除凭据,以便记住用户 auth.eraseCredentials(false); } /** * 配置Spring Security的Filter链 * @param web * @throws Exception */ @Override public void configure(WebSecurity web) throws Exception { //解决静态资源被拦截的问题 web.ignoring().antMatchers("/favicon.ico"); web.ignoring().antMatchers("/error"); super.configure(web); } /** * 解决 无法直接注入 AuthenticationManager * @return * @throws Exception */ @Bean(name = BeanIds.AUTHENTICATION_MANAGER) @Override public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } /** * 配置如何通过拦截器保护请求 * 指定哪些请求需要认证,哪些请求不需要认证,以及所需要的权限 * 通过调用authorizeRequests()和anyRequest().authenticated()就会要求所有进入应用的HTTP请求都要进行认证 * * 方法描述 * anonymous() 允许匿名用户访问 * authenticated() 允许经过认证的用户访问 * denyAll() 无条件拒绝所有访问 * fullyAuthenticated() 如果用户是完整的话(不是通过Remember-me功能认证的),就允许访问 * hasAnyAuthority(String...) 如果用户具备给定权限中的某一个的话,就允许访问 * hasAnyRole(String...) 如果用户具备给定角色中的某一个的话,就允许访问 * hasAuthority(String) 如果用户具备给定权限的话,就允许访问 * hasIpAddress(String) 如果请求来自给定IP地址的话,就允许访问 * hasRole(String) 如果用户具备给定角色的话,就允许访问 * not() 对其他访问方法的结果求反 * permitAll() 无条件允许访问 * rememberMe() 如果用户是通过Remember-me功能认证的,就允许访问 * * * @param http * @throws Exception */ @Override protected void configure(HttpSecurity http) throws Exception { System.out.println("不需要认证的url:"+antMatchers); //super.configure(http); //关闭csrf验证 http.csrf().disable() // 基于token,所以不需要session 如果基于session 则表使用这段代码 .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() //对请求进行认证 url认证配置顺序为:1.先配置放行不需要认证的 permitAll() 2.然后配置 需要特定权限的 hasRole() 3.最后配置 anyRequest().authenticated() .authorizeRequests() // 所有 /oauth/v1/api/login/ 请求的都放行 不做认证即不需要登录即可访问 .antMatchers(antMatchers.split(",")).permitAll() //.antMatchers("/auth/v1/api/login/**","/auth/v1/api/module/tree/**","/auth/v1/api/grid/**").permitAll() // 对于获取token的rest api要允许匿名访问 .antMatchers("oauth/**").permitAll() // 其他请求都需要进行认证,认证通过够才能访问 待考证:如果使用重定向 httpServletRequest.getRequestDispatcher(url).forward(httpServletRequest,httpServletResponse); 重定向跳转的url不会被拦截(即在这里配置了重定向的url需要特定权限认证不起效),但是如果在Controller 方法上配置了方法级的权限则会进行拦截 .anyRequest().authenticated() .and().exceptionHandling() // 认证配置当用户请求了一个受保护的资源,但是用户没有通过登录认证,则抛出登录认证异常,MyAuthenticationEntryPointHandler类中commence()就会调用 .authenticationEntryPoint(myAuthenticationEntryPoint()) //用户已经通过了登录认证,在访问一个受保护的资源,但是权限不够,则抛出授权异常,MyAccessDeniedHandler类中handle()就会调用 .accessDeniedHandler(myAccessDeniedHandler()) .and() // .formLogin() // 登录url // .loginProcessingUrl("/auth/v1/api/login/entry") // 此登录url 和Controller 无关系 .loginProcessingUrl(this.loginUrl) // .loginProcessingUrl("/auth/v1/api/login/enter") //使用自己定义的Controller 中的方法 登录会进入Controller 中的方法 // username参数名称 后台接收前端的参数名 .usernameParameter("userAccount") //登录密码参数名称 后台接收前端的参数名 .passwordParameter("<PASSWORD>") //登录成功跳转路径 .successForwardUrl("/") //登录失败跳转路径 .failureUrl("/") //登录页面路径 .loginPage("/") .permitAll() //登录成功后 MyAuthenticationSuccessHandler类中onAuthenticationSuccess()被调用 .successHandler(myAuthenticationSuccessHandler()) //登录失败后 MyAuthenticationFailureHandler 类中onAuthenticationFailure()被调用 .failureHandler(myAuthenticationFailureHandler()) .and() .logout() //退出系统url // .logoutUrl("/auth/v1/api/login/logout") .logoutUrl(this.logoutUrl) //退出系统后的url跳转 .logoutSuccessUrl("/") //退出系统后的 业务处理 .logoutSuccessHandler(myLogoutSuccessHandler()) .permitAll() .invalidateHttpSession(true) .and() //登录后记住用户,下次自动登录,数据库中必须存在名为persistent_logins的表 // 勾选Remember me登录会在PERSISTENT_LOGINS表中,生成一条记录 .rememberMe() //cookie的有效期(秒为单位 .tokenValiditySeconds(3600); // 加入自定义UsernamePasswordAuthenticationFilter替代原有Filter http.addFilterAt(myUsernamePasswordAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class); //在 beforeFilter 之前添加 自定义 filter http.addFilterBefore(myFilterSecurityInterceptor, FilterSecurityInterceptor.class); // 添加JWT filter 验证其他请求的Token是否合法 http.addFilterBefore(authenticationTokenFilterBean(), FilterSecurityInterceptor.class); // 禁用缓存 http.headers().cacheControl(); } /** * 密码加密方式 * @return */ @Bean public BCryptPasswordEncoder bCryptPasswordEncoder() { return new BCryptPasswordEncoder(); } /** * 注册 登录认证 bean * @return */ @Bean public AuthenticationEntryPoint myAuthenticationEntryPoint(){ //return new MyAuthenticationEntryPointHandler(); return new JwtAuthenticationEntryPoint(); } /** * 注册 认证权限不足处理 bean * @return */ @Bean public AccessDeniedHandler myAccessDeniedHandler(){ return new MyAccessDeniedHandler(); } /** * 注册 登录成功 处理 bean * @return */ @Bean public AuthenticationSuccessHandler myAuthenticationSuccessHandler(){ return new MyAuthenticationSuccessHandler(); } /** * 注册 登录失败 处理 bean * @return */ @Bean public AuthenticationFailureHandler myAuthenticationFailureHandler(){ return new MyAuthenticationFailureHandler(); } /** * 注册 退出系统成功 处理bean * @return */ @Bean public LogoutSuccessHandler myLogoutSuccessHandler(){ return new MyLogoutSuccessHandler(); } /** * 注册jwt 认证 * @return * @throws Exception */ @Bean public JwtAuthenticationTokenFilter authenticationTokenFilterBean() throws Exception { // JwtAuthenticationTokenFilter 过滤器被配置为跳过这个点:/auth/v1/api/login/retrieve/pwd 和 /auth/v1/api/login/entry 不进行token 验证. 通过 SkipPathRequestMatcher 实现 RequestMatcher 接口来实现。 List<String> pathsToSkip = Arrays.asList( "/auth/v1/api/login/retrieve/pwd", "/auth/v1/api/login", "/auth/v1/api/login/enter"); //不需要token 验证的url String processingPath = "/auth/v1/api/**"; // 需要验证token 的url SkipPathRequestMatcher matcher = new SkipPathRequestMatcher(pathsToSkip, processingPath); return new JwtAuthenticationTokenFilter(matcher); } /** * 验证登录验证码 * @return * @throws Exception */ @Bean public UsernamePasswordAuthenticationFilter myUsernamePasswordAuthenticationFilter() throws Exception { return new MyUsernamePasswordAuthenticationFilter( this.loginUrl, authenticationManagerBean(), myAuthenticationSuccessHandler(), myAuthenticationFailureHandler()); } }
14,912
0.659085
0.656343
306
39.519608
33.642895
225
false
false
0
0
0
0
0
0
0.323529
false
false
7
f439cbfdb48a52cc92e1a274389c633762e1d638
30,253,749,680,538
e08d95b8b180abf2333f336c1e74e5524daeecf9
/Character_Generic/src/net/sf/anathema/character/generic/additionaltemplate/AdditionalModelType.java
9bc25ff09a9596322fc9c6ce518ba44324743556
[]
no_license
arclightop/anathema
https://github.com/arclightop/anathema
cfcf6651e0f21d51fcf4abf770c829bb287dbd45
1cee7aa7db7306dbbd016de8a3dfac3d3b1b39f2
refs/heads/master
2020-12-25T05:45:47.712000
2012-05-17T16:17:19
2012-05-17T16:17:20
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.sf.anathema.character.generic.additionaltemplate; public enum AdditionalModelType { Abilities, Advantages, Attributes, Concept, Experience, Magic, Miscellaneous }
UTF-8
Java
183
java
AdditionalModelType.java
Java
[]
null
[]
package net.sf.anathema.character.generic.additionaltemplate; public enum AdditionalModelType { Abilities, Advantages, Attributes, Concept, Experience, Magic, Miscellaneous }
183
0.803279
0.803279
6
28.833334
31.376301
78
false
false
0
0
0
0
0
0
1.166667
false
false
13
b4f1b1df92d1317307eafc02ee59d01a01c905aa
23,038,204,598,898
a801f487161419cfbd41c59667417715d3ad8366
/src/main/java/designPattern/structure/proxy/dynamic/define/DynamicProxy.java
2a13a7cdbce23a64441bf1e35e7e85bbcce6ec14
[]
no_license
sos303sos/DesignPatten
https://github.com/sos303sos/DesignPatten
60319f25046cf306984b1d863da62cc2f819b3d0
a6c98251cd6887fef9cee904c5db4b79e1925dd8
refs/heads/master
2020-04-01T06:06:51.510000
2018-12-31T07:22:22
2018-12-31T07:22:22
152,933,712
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * project: designPatten * package: designPattern.structure.proxy.dynamic.define * file: DynamicProxy.java * description: TODO * Senyint * Copyright 2018 All rights Reserved * * author: 95129 * version: V3.0 * date: 2018年11月26日 下午2:07:34 * * history: * date author version description * ----------------------------------------------------------------------------------- * 2018年11月26日 95129 3.0 1.0 * modification */ package designPattern.structure.proxy.dynamic.define; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Proxy; /** * class: DynamicProxy<BR> * description: TODO<BR> * author: 95129<BR> * date: 2018年11月26日 下午2:07:34<BR> * */ public class DynamicProxy<T> { public static <T> T newProxyInstance(ClassLoader loader, Class<?>[] interfaces, InvocationHandler h) { if (true) { (new BeforeAdvice()).exec(); } return (T) Proxy.newProxyInstance(loader, interfaces, h); } }
UTF-8
Java
1,098
java
DynamicProxy.java
Java
[ { "context": "pyright 2018 All rights Reserved\r\n * \r\n * author: 95129\r\n * version: V3.0\r\n * date: 2018年11月26日 下午2:07:34", "end": 211, "score": 0.999600887298584, "start": 206, "tag": "USERNAME", "value": "95129" }, { "context": "Proxy<BR>\r\n * description: TODO<BR>\r\n * a...
null
[]
/** * project: designPatten * package: designPattern.structure.proxy.dynamic.define * file: DynamicProxy.java * description: TODO * Senyint * Copyright 2018 All rights Reserved * * author: 95129 * version: V3.0 * date: 2018年11月26日 下午2:07:34 * * history: * date author version description * ----------------------------------------------------------------------------------- * 2018年11月26日 95129 3.0 1.0 * modification */ package designPattern.structure.proxy.dynamic.define; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Proxy; /** * class: DynamicProxy<BR> * description: TODO<BR> * author: 95129<BR> * date: 2018年11月26日 下午2:07:34<BR> * */ public class DynamicProxy<T> { public static <T> T newProxyInstance(ClassLoader loader, Class<?>[] interfaces, InvocationHandler h) { if (true) { (new BeforeAdvice()).exec(); } return (T) Proxy.newProxyInstance(loader, interfaces, h); } }
1,098
0.565298
0.510261
39
25.487179
24.784063
106
false
false
0
0
0
0
0
0
0.230769
false
false
13
931ed54d2bd9e1408b0b0f424f5ab0be2d6f27ac
10,711,648,502,132
510eafe6533bb76914003b6adc04df2502a88df0
/src/persons/LegalPerson.java
973c0382bd22fbf1c85d2e4b0b3d24b26d1d3acc
[]
no_license
pedroArtico/Sistema-para-uma-vidracaria
https://github.com/pedroArtico/Sistema-para-uma-vidracaria
d35710567613aeb5661062905dc1124354703770
5bab6cba5a33b71b45bf469dac1384e5ee1c3436
refs/heads/main
2022-12-25T08:00:04.381000
2020-10-07T08:15:40
2020-10-07T08:15:40
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package persons; import java.io.Serializable; import view.tableModel.Arrayable; /** * This is the LegalPerson class, derived from the Client class * @author Pedro */ public class LegalPerson extends Client implements Serializable, Cloneable, Arrayable{ private int cnpj; private String companyType; private String conpanyDescription; /** * This is the constructor of the LegalPerson class. This constructor * has seven parameters * @param cnpj this is a cnpj of LegalPerson class * @param companyType this is a companyType of LegalPerson class * @param conpanyDescription this is a conpanyDescription of LegalPerson * class * @param address this is an address of LegalPerson * @param name this is a name of LegalPerson * @param email this is an email of LegalPerson * @param contact this is a contact of LegalPerson */ public LegalPerson(int cnpj, String companyType, String conpanyDescription, String address, String name, String email, String contact) { super(address, name, email, contact); this.cnpj = cnpj; this.companyType = companyType; this.conpanyDescription = conpanyDescription; } /** * This method get the LegalPerson's cnpj * @return int */ public int getCnpj() { return cnpj; } /** * This method set the LegalPerson's cnpj * @param cnpj this is a cnpj of LegalPerson */ public void setCnpj(int cnpj) { this.cnpj = cnpj; } /** * This method get the LegalPerson's companyType * @return String */ public String getCompanyType() { return companyType; } /** * This method set the LegalPerson's companyType * @param companyType this is a companyType of LegalPerson */ public void setCompanyType(String companyType) { this.companyType = companyType; } /** * This method get the LegalPerson's companyDescription * @return String */ public String getConpanyDescription() { return conpanyDescription; } /** * This method set the LegalPerson's companyDescription * @param conpanyDescription this is a companyDescription of LegalPerson */ public void setConpanyDescription(String conpanyDescription) { this.conpanyDescription = conpanyDescription; } @Override public String describe() { return this.getName() + sep + this.getEmail() + sep + this.getAddress() + sep + this.getCnpj() + sep + this.getCompanyType()+ sep + this.getConpanyDescription()+ sep + this.getContact(); } @Override public Object[] attributesToArray(String[] order) { Object[] rsp = new Object[7]; int rspCount = 0; for (String s : order) { switch (s) { case "nome": rsp[rspCount] = this.getName(); break; case "email": rsp[rspCount] = this.getEmail(); break; case "endereco": rsp[rspCount] = this.getAddress(); break; case "cnpj": rsp[rspCount] = this.getCnpj(); break; case "tipo": rsp[rspCount] = this.getCompanyType(); break; case "descricao": rsp[rspCount] = this.getConpanyDescription(); break; case "contato": rsp[rspCount] = this.getContact(); break; default: rsp[rspCount] = ""; break; } rspCount++; } return rsp; } @Override public Object setValue(String variable, Object value) { switch (variable) { case "nome": this.setName((String) value); break; case "email": this.setEmail(((String) value)); break; case "endereco": this.setAddress((String) value); break; case "cnpj": this.setCnpj(((int) value)); break; case "tipo": this.setCompanyType((String) value); break; case "descricao": this.setConpanyDescription((String) value); break; case "contato": this.setContact((String) value); break; default: break; } return this; } }
UTF-8
Java
4,837
java
LegalPerson.java
Java
[ { "context": "n class, derived from the Client class\r\n * @author Pedro\r\n */\r\npublic class LegalPerson extends Client imp", "end": 173, "score": 0.9992290735244751, "start": 168, "tag": "NAME", "value": "Pedro" }, { "context": "alue);\r\n break;\r\n cas...
null
[]
package persons; import java.io.Serializable; import view.tableModel.Arrayable; /** * This is the LegalPerson class, derived from the Client class * @author Pedro */ public class LegalPerson extends Client implements Serializable, Cloneable, Arrayable{ private int cnpj; private String companyType; private String conpanyDescription; /** * This is the constructor of the LegalPerson class. This constructor * has seven parameters * @param cnpj this is a cnpj of LegalPerson class * @param companyType this is a companyType of LegalPerson class * @param conpanyDescription this is a conpanyDescription of LegalPerson * class * @param address this is an address of LegalPerson * @param name this is a name of LegalPerson * @param email this is an email of LegalPerson * @param contact this is a contact of LegalPerson */ public LegalPerson(int cnpj, String companyType, String conpanyDescription, String address, String name, String email, String contact) { super(address, name, email, contact); this.cnpj = cnpj; this.companyType = companyType; this.conpanyDescription = conpanyDescription; } /** * This method get the LegalPerson's cnpj * @return int */ public int getCnpj() { return cnpj; } /** * This method set the LegalPerson's cnpj * @param cnpj this is a cnpj of LegalPerson */ public void setCnpj(int cnpj) { this.cnpj = cnpj; } /** * This method get the LegalPerson's companyType * @return String */ public String getCompanyType() { return companyType; } /** * This method set the LegalPerson's companyType * @param companyType this is a companyType of LegalPerson */ public void setCompanyType(String companyType) { this.companyType = companyType; } /** * This method get the LegalPerson's companyDescription * @return String */ public String getConpanyDescription() { return conpanyDescription; } /** * This method set the LegalPerson's companyDescription * @param conpanyDescription this is a companyDescription of LegalPerson */ public void setConpanyDescription(String conpanyDescription) { this.conpanyDescription = conpanyDescription; } @Override public String describe() { return this.getName() + sep + this.getEmail() + sep + this.getAddress() + sep + this.getCnpj() + sep + this.getCompanyType()+ sep + this.getConpanyDescription()+ sep + this.getContact(); } @Override public Object[] attributesToArray(String[] order) { Object[] rsp = new Object[7]; int rspCount = 0; for (String s : order) { switch (s) { case "nome": rsp[rspCount] = this.getName(); break; case "email": rsp[rspCount] = this.getEmail(); break; case "endereco": rsp[rspCount] = this.getAddress(); break; case "cnpj": rsp[rspCount] = this.getCnpj(); break; case "tipo": rsp[rspCount] = this.getCompanyType(); break; case "descricao": rsp[rspCount] = this.getConpanyDescription(); break; case "contato": rsp[rspCount] = this.getContact(); break; default: rsp[rspCount] = ""; break; } rspCount++; } return rsp; } @Override public Object setValue(String variable, Object value) { switch (variable) { case "nome": this.setName((String) value); break; case "email": this.setEmail(((String) value)); break; case "endereco": this.setAddress((String) value); break; case "cnpj": this.setCnpj(((int) value)); break; case "tipo": this.setCompanyType((String) value); break; case "descricao": this.setConpanyDescription((String) value); break; case "contato": this.setContact((String) value); break; default: break; } return this; } }
4,837
0.528427
0.528013
153
29.61438
25.86974
194
false
false
0
0
0
0
0
0
0.431373
false
false
13
00b54490f127a560d7d973cfa10d569a3662aea5
7,421,703,545,438
ca8d88f6368275cf91f800ed59cb2cdc9607e051
/framework-authority/src/main/java/com/myland/framework/authority/dic/DicService.java
8dbcace13c1493305c9fb0d1802ee0ea4ae78b2d
[ "MIT" ]
permissive
syq891015/framework-v3
https://github.com/syq891015/framework-v3
b4ccc496c08eec10e1041c9b92488e14981f0f6b
5c6518a039e33204958e54010fa4f5675529700d
refs/heads/master
2022-06-24T12:15:33.878000
2019-12-17T01:08:50
2019-12-17T01:08:50
160,767,528
0
0
MIT
false
2022-06-17T02:05:08
2018-12-07T03:46:46
2019-12-17T01:09:58
2022-06-17T02:05:08
4,130
0
0
6
Java
false
false
package com.myland.framework.authority.dic; import com.github.pagehelper.PageInfo; import com.myland.framework.authority.po.Dic; import java.util.List; import java.util.Map; /** * 字典 * * @author SunYanQing * @version 1.0 * @date 2018-11-30 16:29:33 */ public interface DicService { void save(Dic dic); void delete(Long id); void update(Dic dic); Dic getObjById(Long id); PageInfo<Dic> getList4Page(Map<String, Object> map); List<Dic> getAll(); /** * 检查同种字典目录下字典编码的唯一性 * @param baseId 字典目录ID * @param id 字典目录ID * @param val 字典编码值 * @return true字典编码有效,false字典编码无效 */ boolean checkDicVal(Long baseId, Long id, String val); /** * 启用 * @param ids 系统配置项ID */ void enable(List<Long> ids); /** * 禁用 * @param ids 系统配置项ID */ void disable(List<Long> ids); /** * 查询字典目录下的字典集合 * @param baseDicId 字典目录ID * @return 字典集合 */ List<Dic> getListByBaseDic(Long baseDicId); /** * 获得字典名称哈希表 * @return [BaseDic.code]-[Dic.value]: [Dic.name] */ Map<String,String> getDicNameMap(); /** * 获得字典哈希表 * @return [BaseDic.code]: [List<Dic>] */ Map<String,List> getDicListMap(); }
UTF-8
Java
1,320
java
DicService.java
Java
[ { "context": "st;\nimport java.util.Map;\n\n/**\n * 字典\n *\n * @author SunYanQing\n * @version 1.0\n * @date 2018-11-30 16:29:33\n */\n", "end": 211, "score": 0.999517560005188, "start": 201, "tag": "NAME", "value": "SunYanQing" } ]
null
[]
package com.myland.framework.authority.dic; import com.github.pagehelper.PageInfo; import com.myland.framework.authority.po.Dic; import java.util.List; import java.util.Map; /** * 字典 * * @author SunYanQing * @version 1.0 * @date 2018-11-30 16:29:33 */ public interface DicService { void save(Dic dic); void delete(Long id); void update(Dic dic); Dic getObjById(Long id); PageInfo<Dic> getList4Page(Map<String, Object> map); List<Dic> getAll(); /** * 检查同种字典目录下字典编码的唯一性 * @param baseId 字典目录ID * @param id 字典目录ID * @param val 字典编码值 * @return true字典编码有效,false字典编码无效 */ boolean checkDicVal(Long baseId, Long id, String val); /** * 启用 * @param ids 系统配置项ID */ void enable(List<Long> ids); /** * 禁用 * @param ids 系统配置项ID */ void disable(List<Long> ids); /** * 查询字典目录下的字典集合 * @param baseDicId 字典目录ID * @return 字典集合 */ List<Dic> getListByBaseDic(Long baseDicId); /** * 获得字典名称哈希表 * @return [BaseDic.code]-[Dic.value]: [Dic.name] */ Map<String,String> getDicNameMap(); /** * 获得字典哈希表 * @return [BaseDic.code]: [List<Dic>] */ Map<String,List> getDicListMap(); }
1,320
0.657522
0.642478
69
15.376812
15.407603
55
false
false
0
0
0
0
0
0
0.898551
false
false
13
f544dca036470233110c922561fda1dddbd12e69
7,481,833,095,891
1e79ca036c5d4396ff44e0f3ee744b6f285cab6f
/app/src/main/java/com/jorgegallego/jumpingsquare/state/PlayState.java
3c3b9561a2d5b4d006d36ec294e2480565c8d699
[]
no_license
squaredy1/JumpingSquare
https://github.com/squaredy1/JumpingSquare
f850ee12462f8e72477d31a46236ee9f8a3d16e6
7479cede8ba952f753d75d860cc572b50719f4ab
refs/heads/master
2020-06-30T00:11:03.495000
2019-08-05T13:47:37
2019-08-05T13:47:37
200,664,133
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jorgegallego.jumpingsquare.state; import android.graphics.Color; import android.graphics.Rect; import android.graphics.Typeface; import android.hardware.SensorEvent; import android.view.MotionEvent; import java.util.ArrayList; import com.google.android.gms.common.api.GoogleApiClient; import com.jorgegallego.framework.util.Painter; import com.jorgegallego.framework.util.RandomNumberGenerator; import com.jorgegallego.jumpingsquare.main.DataManager; import com.jorgegallego.jumpingsquare.main.GameMainActivity; import com.jorgegallego.jumpingsquare.main.Assets; import com.jorgegallego.jumpingsquare.main.GameView; import com.jorgegallego.jumpingsquare.model.Bolitas; import com.jorgegallego.jumpingsquare.model.Cloud; import com.jorgegallego.jumpingsquare.model.Mages.Mage; import com.jorgegallego.jumpingsquare.model.Mages.PlatDestroyer; import com.jorgegallego.jumpingsquare.model.Mages.SpikeLeaver; import com.jorgegallego.jumpingsquare.model.Plataform; import com.jorgegallego.jumpingsquare.model.Squaredy; public class PlayState extends State { private final int GAME_WIDTH = GameMainActivity.GAME_WIDTH; private final int GAME_HEIGHT = GameMainActivity.GAME_HEIGHT; private Typeface font = Typeface.create("Arial", Typeface.BOLD); private int lineWidth = (int) (15 * X_CONSTANT); private int lineHeight = GAME_HEIGHT/20; private int lineX = GAME_WIDTH/2 - lineWidth/2; private Squaredy ball; private final int BALL_DIAMETER = Math.round(55 * Y_CONSTANT); private final int BORDER_SIZE = Math.round(11 *Y_CONSTANT); private final int[] PLATAFORM_WIDTH_RANGE = new int[]{Math.round(106 * X_CONSTANT), Math.round(185*X_CONSTANT)};// inclusive both //lower and upper bounds of plataform width private final int PLATAFORM_HEIGHT = Math.round(25*Y_CONSTANT), PLAT_SEPARATION_DISTANCE = Math.round(119*Y_CONSTANT); private ArrayList<ArrayList<Plataform>> plataforms; private ArrayList<Integer> levelsDoublePlat = new ArrayList<>(); private int platNumOfLevels; private boolean hasStarted = false; private int objectsDownVel; private int greyIncrement = 4, greyNumber = 80; private int score, currency; private Bolitas[] bolitas; private final int NUMBER_OF_BOLITAS = 2 + GameMainActivity.retrieveUpLvl("MBLVL"); private int waitingBalls, waitingBallNum, blackBallScore = 1, redBallScore = 3; private boolean readyToJump; private Plataform jumpPlat; //variables needed for removing platforms private double startRemovingTime = 0; private boolean removeProcessOn = false, crossesVisible = false; private int firstRemPlatNum, secondRemPlatNum, thirdRemPlatNum; //private final int NUM_OF_CLOUDS = 3; //private Cloud[] clouds = new Cloud[NUM_OF_CLOUDS]; private Mage mage; private int mageHP = 55 - GameMainActivity.retrieveUpLvl("LLMLVL") * 5; private String spikerID = "Spiker", platDestroyerID = "Platform destroyer"; private int song, songID; @Override public void init() { currency = DataManager.getCurrency(); ball = new Squaredy((GAME_WIDTH - BALL_DIAMETER) / 2, GAME_HEIGHT * 0.85f - BALL_DIAMETER, BALL_DIAMETER, BALL_DIAMETER, BORDER_SIZE); bolitas = new Bolitas[NUMBER_OF_BOLITAS]; DataManager.resetScore(); score = 0; initPlataforms(); int o = RandomNumberGenerator.getRandInt(5); for (int i = 0; i < NUMBER_OF_BOLITAS; i++) { bolitas[i] = new Bolitas(plataforms.get(o + i).get(0).getX(), plataforms.get(o + i).get(0).getWidth(), plataforms.get(o + i).get(0)); } //initClouds(); GameMainActivity.playMusic(true); if (RandomNumberGenerator.getRandInt(2) == 1) { mage = new PlatDestroyer(Assets.redMage, Assets.mageHurt, Assets.redMage, Assets.angryMageHurt, (int) (160 * X_CONSTANT), (int) (229 * X_CONSTANT), X_CONSTANT, mageHP, this, platDestroyerID, plataforms, platNumOfLevels, levelsDoublePlat); } else { mage = new SpikeLeaver(Assets.blueMage, Assets.mageHurt, Assets.blueMage, Assets.angryMageHurt, (int) (160 * X_CONSTANT), (int) (229 * X_CONSTANT), X_CONSTANT, mageHP, ball, this, spikerID); } mage.enter(); GameMainActivity.sGame.playOn(true); } private void initPlataforms() { plataforms = new ArrayList<>(); for (int i = 0; i < GAME_HEIGHT / PLAT_SEPARATION_DISTANCE + 1; i++) { ArrayList<Plataform> currentArray = new ArrayList<>(); Plataform currentPlataform = new Plataform(i * PLAT_SEPARATION_DISTANCE, PLATAFORM_WIDTH_RANGE, PLATAFORM_HEIGHT, X_CONSTANT); currentArray.add(currentPlataform); if (RandomNumberGenerator.getRandInt(4) == 1) { Plataform currentPlataform2 = new Plataform(i * PLAT_SEPARATION_DISTANCE, PLATAFORM_WIDTH_RANGE, PLATAFORM_HEIGHT, X_CONSTANT); currentArray.add(currentPlataform2); levelsDoublePlat.add(i); } plataforms.add(currentArray); platNumOfLevels++; } } /*private void initClouds() { int[] bounds = new int[]{Math.round(110*X_CONSTANT), Math.round(170*X_CONSTANT)}; for(int i = 0; i < NUM_OF_CLOUDS; i++) { Cloud currentCloud = new Cloud(bounds); clouds[i] = currentCloud; } }*/ @Override public void update(double delta) { //actualizar plataformas + comprobar si la bola esta tocando una y saltar + o y bajar plataformas if (ball.getVelY() > 150 * X_CONSTANT) { for (int i = 0; i < plataforms.size(); i++) { if (plataforms.get(i).get(0).getY() > GAME_HEIGHT / 2) { for (int a = 0; a < plataforms.get(i).size(); a++) { if (Rect.intersects(plataforms.get(i).get(a).getRect(), ball.getRect()) && ball.getY() + BALL_DIAMETER <= plataforms.get(i).get(a).getY() + 10 * X_CONSTANT) { //jumpPlat = plataforms.get(i).get(a); //.getY() - PLATAFORM_HEIGHT ball.jump(); //ball.setJumpHeight(jumpPlat.getY() - 30, jumpPlat.getX(), jumpPlat.getX() + jumpPlat.getWidth()); //readyToJump = true; } } } } } //check if squaredy is touching a ball if (hasStarted) { for (int i = 0; i < NUMBER_OF_BOLITAS; i++) { if (bolitas[i].isTouching(ball.getRect()) && !bolitas[i].isFlyingToMage()) { bolitas[i].die(mage); score += bolitas[i].isSpecial()?redBallScore:blackBallScore; currency += bolitas[i].isSpecial()?redBallScore:blackBallScore; DataManager.changeCurrentScore(bolitas[i].isSpecial()?redBallScore:blackBallScore); DataManager.changeCurrency(bolitas[i].isSpecial()?redBallScore:blackBallScore); } } } ball.update(delta); checkIfDead(); //sets plataform/bolitas vel to the balls vel (comprobar si bola ha llegado al centro) if (hasStarted && ball.getY() <= GAME_HEIGHT / 2 && ball.getVelY() < 0) { objectsDownVel = ball.getVelY(); for (int i = 0; i < plataforms.size(); i++) { for (int a = 0; a < plataforms.get(i).size(); a++) { if (plataforms.get(i).get(a).getY() >= GAME_HEIGHT) { plataforms.get(i).get(a).reset(); if ((waitingBalls > 0) && (RandomNumberGenerator.getRandInt(3) == 1)) { bolitas[waitingBallNum].reset(plataforms.get(i).get(a).getX(), plataforms.get(i).get(a).getWidth(), plataforms.get(i).get(a)); } } plataforms.get(i).get(a).update(delta, objectsDownVel); } } } mage.update(delta); waitingBalls = 0; //actualizar bolitas for (int i = 0; i < NUMBER_OF_BOLITAS; i++) { bolitas[i].update(delta); if (bolitas[i].getWaiting()) { waitingBalls++; waitingBallNum = i; } } //actualizar nubes /*for (int i = 0; i < NUM_OF_CLOUDS; i++) { clouds[i].update(delta, objectsDownVel); }*/ /* if (ball.getVelY() > 0 && readyToJump && jumpPlat.getY() >= ball.getY() + BALL_DIAMETER ) { readyToJump = false; ball.setJumpHeight(jumpPlat.getY() - 30, jumpPlat.getX(), jumpPlat.getX() + jumpPlat.getWidth()); jumpPlat = null; }*/ //if (removeProcessOn) { // mage1.removePlats(); //} } private void checkIfDead(){ if (ball.getY() > GAME_HEIGHT + 20 * X_CONSTANT) { die(); } } public void die() { DataManager.save(); GameView.vibrate(750); GameMainActivity.stopMusic(); GameMainActivity.sGame.playOn(false); setCurrentState(new GameOverState()); } public void mageKilled(String mageID) { if (mageID.equals(spikerID)) { mage = new PlatDestroyer(Assets.redMage, Assets.mageHurt, Assets.redMage, Assets.angryMageHurt, (int) (160 * X_CONSTANT), (int) (229 * X_CONSTANT), X_CONSTANT, mageHP, this, platDestroyerID, plataforms, platNumOfLevels, levelsDoublePlat); } else { mage = new SpikeLeaver(Assets.blueMage, Assets.mageHurt, Assets.blueMage, Assets.angryMageHurt, (int) (160 * X_CONSTANT), (int) (229 * X_CONSTANT), X_CONSTANT, mageHP, ball, this, spikerID); } mage.enter(); } @Override public void render(Painter g) { //fondo: g.setColor(Assets.backgroundColor); g.fillRect(0, 0, GAME_WIDTH, GAME_HEIGHT); /*Score (big) Typeface font = Typeface.create("Arial", Typeface.BOLD); textSize = (int) ((370 - score * 2) * X_RATIO_CONSTANT); g.setFont(font, textSize); g.setColor(Assets.backgroundScoreColor); int textWidth = g.measureText("" + score, Math.round((370 - score * 2) * X_RATIO_CONSTANT)); g.drawString("" + score, GAME_WIDTH / 2 - (textWidth / 2), Math.round(GAME_HEIGHT - 140/194)); */ //score /*bestScore font = Typeface.create("Arial", Typeface.BOLD); g.setFont(font, 50 * X_RATIO_CONSTANT); g.setColor(Assets.bestScoreColor); textWidth = g.measureText("Best score: " + DataManager.getBestScore(), Math.round(50 * X_RATIO_CONSTANT)); g.drawString("Best score: " + DataManager.getBestScore(),(GAME_WIDTH / 2 - (textWidth / 2)), (int) Math.round(0.08 * GAME_HEIGHT)); */ /*for (int i = 0; i < NUM_OF_CLOUDS; i++) { clouds[i].render(g); }*/ mage.render(g); //Plataforms for (int i = 0; i < plataforms.size(); i++) { for (int a = 0; a < plataforms.get(i).size(); a++) { //g.fillRect(plataforms.get(i).get(a).getX(), plataforms.get(i).get(a).getY(), plataforms.get(i).get(a).getWidth(), plataforms.get(i).get(a).getHeight()); plataforms.get(i).get(a).render(g); } } mage.renderExtras(g, X_CONSTANT); //squaredy ball.render(g); //bolitas for (int i = 0; i < NUMBER_OF_BOLITAS; i++) { bolitas[i].render(g); } //press-key-to-start text if (!hasStarted) { if (greyNumber <= 6 || greyNumber >= 140) { greyIncrement *= -1; } greyNumber += greyIncrement; g.setFont(font, 60 * X_CONSTANT); g.setColor(Color.rgb(greyNumber, greyNumber, greyNumber)); String startTextString = "Tap here to Tap here to "; int textWidth = g.measureText(startTextString, (int) (60 * X_CONSTANT))/3; g.setFont(font, 60 * X_CONSTANT); g.drawString(startTextString, (GAME_WIDTH / 2 - textWidth / 2), GAME_HEIGHT / 2 + (int) (25 * X_CONSTANT)); startTextString = "go left go right"; textWidth = g.measureText(startTextString, (int) (60 * X_CONSTANT))/3; g.setFont(font, 60 * X_CONSTANT); g.drawString(startTextString, (GAME_WIDTH / 2 - textWidth / 2), GAME_HEIGHT / 2 + (int) (75 * X_CONSTANT)); for (int lineY = 0; lineY < GAME_HEIGHT; lineY += GAME_HEIGHT/10) { g.fillRect(lineX, lineY, lineWidth, lineHeight); } } g.setFont(font, (int) (100 * X_CONSTANT)); g.setColor(Assets.backgroundScoreColor); int textWidth = g.measureText("" + score, (int) (25 * X_CONSTANT)); g.setFont(font, (int) (100 * X_CONSTANT)); g.drawString("" + score, GAME_WIDTH / 2 - (textWidth / 2), (int) (100 * X_CONSTANT)); g.setFont(Assets.currencyFont, (int) (60 * X_CONSTANT)); textWidth = g.measureText(DataManager.getCurrency() + "$", (int) (60 * X_CONSTANT))/3; g.setColor(Color.BLACK); g.setFont(Assets.currencyFont, (int) (60 * X_CONSTANT)); g.drawRect((int) (GameMainActivity.GAME_WIDTH - textWidth - 42 * X_CONSTANT), (int) (20 * X_CONSTANT), (int) (textWidth + 22 * X_CONSTANT), (int) (80 * X_CONSTANT), (int) (10 * X_CONSTANT)); g.drawString(DataManager.getCurrency() + "$", (int) (GameMainActivity.GAME_WIDTH - textWidth - 32 * X_CONSTANT), (int) (80 * X_CONSTANT)); //g.drawImage(Assets.blackBall, (int) (GAME_WIDTH - 65 * X_RATIO_CONSTANT), (int) (40 * X_RATIO_CONSTANT), (int) (35 * X_RATIO_CONSTANT), (int) (35 * X_RATIO_CONSTANT)); } @Override public boolean onTouch(MotionEvent e, int scaledX, int scaledY) { switch(e.getAction()) { case MotionEvent.ACTION_DOWN: if (scaledX < GAME_WIDTH / 2) { ball.onTouch(true); } else { ball.onTouch(false); } if (!hasStarted) { ball.jump(); hasStarted = true; } return true; case MotionEvent.ACTION_UP: if (e.getActionMasked() == MotionEvent.ACTION_UP) { ball.onTouchRelease(); } return true; } return false; } @Override public void onSensorChanged(SensorEvent sensorEvent) { //if(hasStarted) { // ball.onSensorChanged(sensorEvent); //} } public String name() { return "PlayState"; } @Override public void onPause() { if (hasStarted) { ball.onPause(); } } @Override public void onResume() { if (hasStarted) { ball.onResume(); } } public void setRemoveProcessOn(boolean removeProcessOn) { this.removeProcessOn = removeProcessOn; } public void setCrossesVisible(boolean crossesVisible) { this.crossesVisible = crossesVisible; } }
UTF-8
Java
13,338
java
PlayState.java
Java
[ { "context": "eUpLvl(\"LLMLVL\") * 5;\n\tprivate String spikerID = \"Spiker\", platDestroyerID = \"Platform destroyer\";\n\n\tpriva", "end": 2842, "score": 0.5283471345901489, "start": 2836, "tag": "USERNAME", "value": "Spiker" } ]
null
[]
package com.jorgegallego.jumpingsquare.state; import android.graphics.Color; import android.graphics.Rect; import android.graphics.Typeface; import android.hardware.SensorEvent; import android.view.MotionEvent; import java.util.ArrayList; import com.google.android.gms.common.api.GoogleApiClient; import com.jorgegallego.framework.util.Painter; import com.jorgegallego.framework.util.RandomNumberGenerator; import com.jorgegallego.jumpingsquare.main.DataManager; import com.jorgegallego.jumpingsquare.main.GameMainActivity; import com.jorgegallego.jumpingsquare.main.Assets; import com.jorgegallego.jumpingsquare.main.GameView; import com.jorgegallego.jumpingsquare.model.Bolitas; import com.jorgegallego.jumpingsquare.model.Cloud; import com.jorgegallego.jumpingsquare.model.Mages.Mage; import com.jorgegallego.jumpingsquare.model.Mages.PlatDestroyer; import com.jorgegallego.jumpingsquare.model.Mages.SpikeLeaver; import com.jorgegallego.jumpingsquare.model.Plataform; import com.jorgegallego.jumpingsquare.model.Squaredy; public class PlayState extends State { private final int GAME_WIDTH = GameMainActivity.GAME_WIDTH; private final int GAME_HEIGHT = GameMainActivity.GAME_HEIGHT; private Typeface font = Typeface.create("Arial", Typeface.BOLD); private int lineWidth = (int) (15 * X_CONSTANT); private int lineHeight = GAME_HEIGHT/20; private int lineX = GAME_WIDTH/2 - lineWidth/2; private Squaredy ball; private final int BALL_DIAMETER = Math.round(55 * Y_CONSTANT); private final int BORDER_SIZE = Math.round(11 *Y_CONSTANT); private final int[] PLATAFORM_WIDTH_RANGE = new int[]{Math.round(106 * X_CONSTANT), Math.round(185*X_CONSTANT)};// inclusive both //lower and upper bounds of plataform width private final int PLATAFORM_HEIGHT = Math.round(25*Y_CONSTANT), PLAT_SEPARATION_DISTANCE = Math.round(119*Y_CONSTANT); private ArrayList<ArrayList<Plataform>> plataforms; private ArrayList<Integer> levelsDoublePlat = new ArrayList<>(); private int platNumOfLevels; private boolean hasStarted = false; private int objectsDownVel; private int greyIncrement = 4, greyNumber = 80; private int score, currency; private Bolitas[] bolitas; private final int NUMBER_OF_BOLITAS = 2 + GameMainActivity.retrieveUpLvl("MBLVL"); private int waitingBalls, waitingBallNum, blackBallScore = 1, redBallScore = 3; private boolean readyToJump; private Plataform jumpPlat; //variables needed for removing platforms private double startRemovingTime = 0; private boolean removeProcessOn = false, crossesVisible = false; private int firstRemPlatNum, secondRemPlatNum, thirdRemPlatNum; //private final int NUM_OF_CLOUDS = 3; //private Cloud[] clouds = new Cloud[NUM_OF_CLOUDS]; private Mage mage; private int mageHP = 55 - GameMainActivity.retrieveUpLvl("LLMLVL") * 5; private String spikerID = "Spiker", platDestroyerID = "Platform destroyer"; private int song, songID; @Override public void init() { currency = DataManager.getCurrency(); ball = new Squaredy((GAME_WIDTH - BALL_DIAMETER) / 2, GAME_HEIGHT * 0.85f - BALL_DIAMETER, BALL_DIAMETER, BALL_DIAMETER, BORDER_SIZE); bolitas = new Bolitas[NUMBER_OF_BOLITAS]; DataManager.resetScore(); score = 0; initPlataforms(); int o = RandomNumberGenerator.getRandInt(5); for (int i = 0; i < NUMBER_OF_BOLITAS; i++) { bolitas[i] = new Bolitas(plataforms.get(o + i).get(0).getX(), plataforms.get(o + i).get(0).getWidth(), plataforms.get(o + i).get(0)); } //initClouds(); GameMainActivity.playMusic(true); if (RandomNumberGenerator.getRandInt(2) == 1) { mage = new PlatDestroyer(Assets.redMage, Assets.mageHurt, Assets.redMage, Assets.angryMageHurt, (int) (160 * X_CONSTANT), (int) (229 * X_CONSTANT), X_CONSTANT, mageHP, this, platDestroyerID, plataforms, platNumOfLevels, levelsDoublePlat); } else { mage = new SpikeLeaver(Assets.blueMage, Assets.mageHurt, Assets.blueMage, Assets.angryMageHurt, (int) (160 * X_CONSTANT), (int) (229 * X_CONSTANT), X_CONSTANT, mageHP, ball, this, spikerID); } mage.enter(); GameMainActivity.sGame.playOn(true); } private void initPlataforms() { plataforms = new ArrayList<>(); for (int i = 0; i < GAME_HEIGHT / PLAT_SEPARATION_DISTANCE + 1; i++) { ArrayList<Plataform> currentArray = new ArrayList<>(); Plataform currentPlataform = new Plataform(i * PLAT_SEPARATION_DISTANCE, PLATAFORM_WIDTH_RANGE, PLATAFORM_HEIGHT, X_CONSTANT); currentArray.add(currentPlataform); if (RandomNumberGenerator.getRandInt(4) == 1) { Plataform currentPlataform2 = new Plataform(i * PLAT_SEPARATION_DISTANCE, PLATAFORM_WIDTH_RANGE, PLATAFORM_HEIGHT, X_CONSTANT); currentArray.add(currentPlataform2); levelsDoublePlat.add(i); } plataforms.add(currentArray); platNumOfLevels++; } } /*private void initClouds() { int[] bounds = new int[]{Math.round(110*X_CONSTANT), Math.round(170*X_CONSTANT)}; for(int i = 0; i < NUM_OF_CLOUDS; i++) { Cloud currentCloud = new Cloud(bounds); clouds[i] = currentCloud; } }*/ @Override public void update(double delta) { //actualizar plataformas + comprobar si la bola esta tocando una y saltar + o y bajar plataformas if (ball.getVelY() > 150 * X_CONSTANT) { for (int i = 0; i < plataforms.size(); i++) { if (plataforms.get(i).get(0).getY() > GAME_HEIGHT / 2) { for (int a = 0; a < plataforms.get(i).size(); a++) { if (Rect.intersects(plataforms.get(i).get(a).getRect(), ball.getRect()) && ball.getY() + BALL_DIAMETER <= plataforms.get(i).get(a).getY() + 10 * X_CONSTANT) { //jumpPlat = plataforms.get(i).get(a); //.getY() - PLATAFORM_HEIGHT ball.jump(); //ball.setJumpHeight(jumpPlat.getY() - 30, jumpPlat.getX(), jumpPlat.getX() + jumpPlat.getWidth()); //readyToJump = true; } } } } } //check if squaredy is touching a ball if (hasStarted) { for (int i = 0; i < NUMBER_OF_BOLITAS; i++) { if (bolitas[i].isTouching(ball.getRect()) && !bolitas[i].isFlyingToMage()) { bolitas[i].die(mage); score += bolitas[i].isSpecial()?redBallScore:blackBallScore; currency += bolitas[i].isSpecial()?redBallScore:blackBallScore; DataManager.changeCurrentScore(bolitas[i].isSpecial()?redBallScore:blackBallScore); DataManager.changeCurrency(bolitas[i].isSpecial()?redBallScore:blackBallScore); } } } ball.update(delta); checkIfDead(); //sets plataform/bolitas vel to the balls vel (comprobar si bola ha llegado al centro) if (hasStarted && ball.getY() <= GAME_HEIGHT / 2 && ball.getVelY() < 0) { objectsDownVel = ball.getVelY(); for (int i = 0; i < plataforms.size(); i++) { for (int a = 0; a < plataforms.get(i).size(); a++) { if (plataforms.get(i).get(a).getY() >= GAME_HEIGHT) { plataforms.get(i).get(a).reset(); if ((waitingBalls > 0) && (RandomNumberGenerator.getRandInt(3) == 1)) { bolitas[waitingBallNum].reset(plataforms.get(i).get(a).getX(), plataforms.get(i).get(a).getWidth(), plataforms.get(i).get(a)); } } plataforms.get(i).get(a).update(delta, objectsDownVel); } } } mage.update(delta); waitingBalls = 0; //actualizar bolitas for (int i = 0; i < NUMBER_OF_BOLITAS; i++) { bolitas[i].update(delta); if (bolitas[i].getWaiting()) { waitingBalls++; waitingBallNum = i; } } //actualizar nubes /*for (int i = 0; i < NUM_OF_CLOUDS; i++) { clouds[i].update(delta, objectsDownVel); }*/ /* if (ball.getVelY() > 0 && readyToJump && jumpPlat.getY() >= ball.getY() + BALL_DIAMETER ) { readyToJump = false; ball.setJumpHeight(jumpPlat.getY() - 30, jumpPlat.getX(), jumpPlat.getX() + jumpPlat.getWidth()); jumpPlat = null; }*/ //if (removeProcessOn) { // mage1.removePlats(); //} } private void checkIfDead(){ if (ball.getY() > GAME_HEIGHT + 20 * X_CONSTANT) { die(); } } public void die() { DataManager.save(); GameView.vibrate(750); GameMainActivity.stopMusic(); GameMainActivity.sGame.playOn(false); setCurrentState(new GameOverState()); } public void mageKilled(String mageID) { if (mageID.equals(spikerID)) { mage = new PlatDestroyer(Assets.redMage, Assets.mageHurt, Assets.redMage, Assets.angryMageHurt, (int) (160 * X_CONSTANT), (int) (229 * X_CONSTANT), X_CONSTANT, mageHP, this, platDestroyerID, plataforms, platNumOfLevels, levelsDoublePlat); } else { mage = new SpikeLeaver(Assets.blueMage, Assets.mageHurt, Assets.blueMage, Assets.angryMageHurt, (int) (160 * X_CONSTANT), (int) (229 * X_CONSTANT), X_CONSTANT, mageHP, ball, this, spikerID); } mage.enter(); } @Override public void render(Painter g) { //fondo: g.setColor(Assets.backgroundColor); g.fillRect(0, 0, GAME_WIDTH, GAME_HEIGHT); /*Score (big) Typeface font = Typeface.create("Arial", Typeface.BOLD); textSize = (int) ((370 - score * 2) * X_RATIO_CONSTANT); g.setFont(font, textSize); g.setColor(Assets.backgroundScoreColor); int textWidth = g.measureText("" + score, Math.round((370 - score * 2) * X_RATIO_CONSTANT)); g.drawString("" + score, GAME_WIDTH / 2 - (textWidth / 2), Math.round(GAME_HEIGHT - 140/194)); */ //score /*bestScore font = Typeface.create("Arial", Typeface.BOLD); g.setFont(font, 50 * X_RATIO_CONSTANT); g.setColor(Assets.bestScoreColor); textWidth = g.measureText("Best score: " + DataManager.getBestScore(), Math.round(50 * X_RATIO_CONSTANT)); g.drawString("Best score: " + DataManager.getBestScore(),(GAME_WIDTH / 2 - (textWidth / 2)), (int) Math.round(0.08 * GAME_HEIGHT)); */ /*for (int i = 0; i < NUM_OF_CLOUDS; i++) { clouds[i].render(g); }*/ mage.render(g); //Plataforms for (int i = 0; i < plataforms.size(); i++) { for (int a = 0; a < plataforms.get(i).size(); a++) { //g.fillRect(plataforms.get(i).get(a).getX(), plataforms.get(i).get(a).getY(), plataforms.get(i).get(a).getWidth(), plataforms.get(i).get(a).getHeight()); plataforms.get(i).get(a).render(g); } } mage.renderExtras(g, X_CONSTANT); //squaredy ball.render(g); //bolitas for (int i = 0; i < NUMBER_OF_BOLITAS; i++) { bolitas[i].render(g); } //press-key-to-start text if (!hasStarted) { if (greyNumber <= 6 || greyNumber >= 140) { greyIncrement *= -1; } greyNumber += greyIncrement; g.setFont(font, 60 * X_CONSTANT); g.setColor(Color.rgb(greyNumber, greyNumber, greyNumber)); String startTextString = "Tap here to Tap here to "; int textWidth = g.measureText(startTextString, (int) (60 * X_CONSTANT))/3; g.setFont(font, 60 * X_CONSTANT); g.drawString(startTextString, (GAME_WIDTH / 2 - textWidth / 2), GAME_HEIGHT / 2 + (int) (25 * X_CONSTANT)); startTextString = "go left go right"; textWidth = g.measureText(startTextString, (int) (60 * X_CONSTANT))/3; g.setFont(font, 60 * X_CONSTANT); g.drawString(startTextString, (GAME_WIDTH / 2 - textWidth / 2), GAME_HEIGHT / 2 + (int) (75 * X_CONSTANT)); for (int lineY = 0; lineY < GAME_HEIGHT; lineY += GAME_HEIGHT/10) { g.fillRect(lineX, lineY, lineWidth, lineHeight); } } g.setFont(font, (int) (100 * X_CONSTANT)); g.setColor(Assets.backgroundScoreColor); int textWidth = g.measureText("" + score, (int) (25 * X_CONSTANT)); g.setFont(font, (int) (100 * X_CONSTANT)); g.drawString("" + score, GAME_WIDTH / 2 - (textWidth / 2), (int) (100 * X_CONSTANT)); g.setFont(Assets.currencyFont, (int) (60 * X_CONSTANT)); textWidth = g.measureText(DataManager.getCurrency() + "$", (int) (60 * X_CONSTANT))/3; g.setColor(Color.BLACK); g.setFont(Assets.currencyFont, (int) (60 * X_CONSTANT)); g.drawRect((int) (GameMainActivity.GAME_WIDTH - textWidth - 42 * X_CONSTANT), (int) (20 * X_CONSTANT), (int) (textWidth + 22 * X_CONSTANT), (int) (80 * X_CONSTANT), (int) (10 * X_CONSTANT)); g.drawString(DataManager.getCurrency() + "$", (int) (GameMainActivity.GAME_WIDTH - textWidth - 32 * X_CONSTANT), (int) (80 * X_CONSTANT)); //g.drawImage(Assets.blackBall, (int) (GAME_WIDTH - 65 * X_RATIO_CONSTANT), (int) (40 * X_RATIO_CONSTANT), (int) (35 * X_RATIO_CONSTANT), (int) (35 * X_RATIO_CONSTANT)); } @Override public boolean onTouch(MotionEvent e, int scaledX, int scaledY) { switch(e.getAction()) { case MotionEvent.ACTION_DOWN: if (scaledX < GAME_WIDTH / 2) { ball.onTouch(true); } else { ball.onTouch(false); } if (!hasStarted) { ball.jump(); hasStarted = true; } return true; case MotionEvent.ACTION_UP: if (e.getActionMasked() == MotionEvent.ACTION_UP) { ball.onTouchRelease(); } return true; } return false; } @Override public void onSensorChanged(SensorEvent sensorEvent) { //if(hasStarted) { // ball.onSensorChanged(sensorEvent); //} } public String name() { return "PlayState"; } @Override public void onPause() { if (hasStarted) { ball.onPause(); } } @Override public void onResume() { if (hasStarted) { ball.onResume(); } } public void setRemoveProcessOn(boolean removeProcessOn) { this.removeProcessOn = removeProcessOn; } public void setCrossesVisible(boolean crossesVisible) { this.crossesVisible = crossesVisible; } }
13,338
0.67259
0.656395
384
33.734375
36.188557
194
false
false
0
0
0
0
0
0
2.627604
false
false
13
7f47334efd0c8655eabb9ac480c62d96ddf780b7
21,242,908,286,477
6fcfa7606fdc8349bf32f36226ae1297bc3d2fcc
/src/main/java/com/wallet/util/Constants.java
b7773d7c017ff51353c1cf5c88ef64da62f313f7
[]
no_license
Sandeep-108/Wallet-System
https://github.com/Sandeep-108/Wallet-System
9065b20d374e2a896815bc285587ff67258fca2a
564c2dbef0682dd7f788a2e96a437f09c7c69c32
refs/heads/master
2021-06-25T15:28:47.006000
2019-04-01T18:47:34
2019-04-01T18:47:34
178,734,122
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wallet.util; public class Constants { public static final String USER_LOGIN_FAILED = "U1001"; public static final String U1001_MSG = "Email or Password Incorrect"; public static final String USER_NOT_FOUND = "U1002"; public static final String U1002_MSG = "User Not Found"; public static final String INVALID_AMOUNT = "W1001"; public static final String W1001_MSG = "Enter a valid Amount"; public static final String SAME_WALLET = "W1002"; public static final String W1002_MSG = "payment Not allow on same wallet"; public static final String LOW_BALANCE = "W1003"; public static final String W1003_MSG = "Add money to complete payment"; public static final String USER_ID = "userId"; public static final String WALLET_ID = "WalletId"; public static final String NULL_POINTER_EXCEPTIO = "NE1001"; public static final String SQL_ERROR = "DB1001"; public static final String RUNTIME_EXECEPTION = "RN1001"; }
UTF-8
Java
959
java
Constants.java
Java
[ { "context": "payment\";\r\n\tpublic static final String USER_ID = \"userId\";\r\n\tpublic static final String WALLET_ID = \"Walle", "end": 720, "score": 0.9958726763725281, "start": 714, "tag": "USERNAME", "value": "userId" } ]
null
[]
package com.wallet.util; public class Constants { public static final String USER_LOGIN_FAILED = "U1001"; public static final String U1001_MSG = "Email or Password Incorrect"; public static final String USER_NOT_FOUND = "U1002"; public static final String U1002_MSG = "User Not Found"; public static final String INVALID_AMOUNT = "W1001"; public static final String W1001_MSG = "Enter a valid Amount"; public static final String SAME_WALLET = "W1002"; public static final String W1002_MSG = "payment Not allow on same wallet"; public static final String LOW_BALANCE = "W1003"; public static final String W1003_MSG = "Add money to complete payment"; public static final String USER_ID = "userId"; public static final String WALLET_ID = "WalletId"; public static final String NULL_POINTER_EXCEPTIO = "NE1001"; public static final String SQL_ERROR = "DB1001"; public static final String RUNTIME_EXECEPTION = "RN1001"; }
959
0.735141
0.680918
22
41.590908
25.294014
75
false
false
0
0
0
0
0
0
1.454545
false
false
13
d83d9812bb352a8491ae7cdbec1fbf5af9dde659
35,716,948,043,596
607ad15a1024506289e0f5152e5247e4f397645d
/sjk-jfr-standalone/src/main/java/org/openjdk/jmc/flightrecorder/jdk/JdkTypeIDs.java
91cf0b7ad305d6bb697525b891c04c39e11111f7
[ "Apache-2.0" ]
permissive
aragozin/sjk-extra-parsers
https://github.com/aragozin/sjk-extra-parsers
48743fa8f3e85d4f7ef9fc804fbb814b82c4f99a
d41dbea117d34d87294a9a4280f52318add5d031
refs/heads/master
2022-12-30T11:16:25.267000
2020-01-07T08:03:16
2020-01-07T08:03:16
93,279,879
1
1
Apache-2.0
false
2020-10-12T22:26:35
2017-06-03T23:50:35
2020-01-07T08:03:23
2020-10-12T22:26:34
572
0
1
3
Java
false
false
/* * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * The contents of this file are subject to the terms of either the Universal Permissive License * v 1.0 as shown at http://oss.oracle.com/licenses/upl * * or the following license: * * Redistribution and use in source and binary forms, with or without modification, are permitted * provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of conditions * and the following disclaimer. * * 2. 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. * * 3. Neither the name of the copyright holder nor the names of its contributors may be used to * endorse or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 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.openjdk.jmc.flightrecorder.jdk; import org.openjdk.jmc.common.item.IType; /** * Contains type IDs for events that are produced by JDK 11+. These strings can be compared to the * result of {@link IType#getIdentifier()} and for creating filters with * {@link ItemFilters#type(String)}. */ @SuppressWarnings("nls") public final class JdkTypeIDs { /* * Whenever the PREFIX is changed, corresponding changes must be made in * application/org.openjdk.jmc.flightrecorder.ui/defaultPages.xml */ private final static String PREFIX = "jdk."; public static final String CPU_LOAD = PREFIX + "CPULoad"; public static final String EXECUTION_SAMPLE = PREFIX + "ExecutionSample"; public static final String EXECUTION_SAMPLING_INFO_EVENT_ID = PREFIX + "ExecutionSampling"; public static final String NATIVE_METHOD_SAMPLE = PREFIX + "NativeMethodSample"; public static final String PROCESSES = PREFIX + "SystemProcess"; public static final String OS_MEMORY_SUMMARY = PREFIX + "PhysicalMemory"; public static final String OS_INFORMATION = PREFIX + "OSInformation"; public static final String CPU_INFORMATION = PREFIX + "CPUInformation"; public static final String THREAD_ALLOCATION_STATISTICS = PREFIX + "ThreadAllocationStatistics"; public static final String HEAP_CONF = PREFIX + "GCHeapConfiguration"; public static final String GC_CONF = PREFIX + "GCConfiguration"; public static final String HEAP_SUMMARY = PREFIX + "GCHeapSummary"; public static final String ALLOC_INSIDE_TLAB = PREFIX + "ObjectAllocationInNewTLAB"; public static final String ALLOC_OUTSIDE_TLAB = PREFIX + "ObjectAllocationOutsideTLAB"; public static final String VM_INFO = PREFIX + "JVMInformation"; public static final String CLASS_DEFINE = PREFIX + "ClassDefine"; public static final String CLASS_LOAD = PREFIX + "ClassLoad"; public static final String CLASS_UNLOAD = PREFIX + "ClassUnload"; public static final String CLASS_LOAD_STATISTICS = PREFIX + "ClassLoadingStatistics"; public static final String CLASS_LOADER_STATISTICS = PREFIX + "ClassLoaderStatistics"; public static final String COMPILATION = PREFIX + "Compilation"; public static final String FILE_WRITE = PREFIX + "FileWrite"; public static final String FILE_READ = PREFIX + "FileRead"; public static final String SOCKET_WRITE = PREFIX + "SocketWrite"; public static final String SOCKET_READ = PREFIX + "SocketRead"; public static final String THREAD_PARK = PREFIX + "ThreadPark"; public static final String THREAD_SLEEP = PREFIX + "ThreadSleep"; public static final String MONITOR_ENTER = PREFIX + "JavaMonitorEnter"; public static final String MONITOR_WAIT = PREFIX + "JavaMonitorWait"; public static final String METASPACE_OOM = PREFIX + "MetaspaceOOM"; public static final String CODE_CACHE_FULL = PREFIX + "CodeCacheFull"; public static final String CODE_CACHE_STATISTICS = PREFIX + "CodeCacheStatistics"; public static final String CODE_SWEEPER_STATISTICS = PREFIX + "CodeSweeperStatistics"; public static final String SWEEP_CODE_CACHE = PREFIX + "SweepCodeCache"; public static final String ENVIRONMENT_VARIABLE = PREFIX + "InitialEnvironmentVariable"; public static final String SYSTEM_PROPERTIES = PREFIX + "InitialSystemProperty"; public static final String OBJECT_COUNT = PREFIX + "ObjectCount"; public static final String GC_REFERENCE_STATISTICS = PREFIX + "GCReferenceStatistics"; public static final String OLD_OBJECT_SAMPLE = PREFIX + "OldObjectSample"; public static final String GC_PAUSE_L4 = PREFIX + "GCPhasePauseLevel4"; public static final String GC_PAUSE_L3 = PREFIX + "GCPhasePauseLevel3"; public static final String GC_PAUSE_L2 = PREFIX + "GCPhasePauseLevel2"; public static final String GC_PAUSE_L1 = PREFIX + "GCPhasePauseLevel1"; public static final String GC_PAUSE = PREFIX + "GCPhasePause"; public static final String METASPACE_SUMMARY = PREFIX + "MetaspaceSummary"; public static final String GARBAGE_COLLECTION = PREFIX + "GarbageCollection"; public static final String CONCURRENT_MODE_FAILURE = PREFIX + "ConcurrentModeFailure"; public static final String THROWABLES_STATISTICS = PREFIX + "ExceptionStatistics"; public static final String ERRORS_THROWN = PREFIX + "JavaErrorThrow"; /* * NOTE: The parser filters all JavaExceptionThrow events created from the Error constructor to * avoid duplicates, so this event type represents 'non error throwables' rather than * exceptions. See note in SyntheticAttributeExtension which does the duplicate filtering. */ public static final String EXCEPTIONS_THROWN = PREFIX + "JavaExceptionThrow"; public static final String COMPILER_STATS = PREFIX + "CompilerStatistics"; public static final String COMPILER_FAILURE = PREFIX + "CompilationFailure"; public static final String ULONG_FLAG = PREFIX + "UnsignedLongFlag"; public static final String BOOLEAN_FLAG = PREFIX + "BooleanFlag"; public static final String STRING_FLAG = PREFIX + "StringFlag"; public static final String DOUBLE_FLAG = PREFIX + "DoubleFlag"; public static final String LONG_FLAG = PREFIX + "LongFlag"; public static final String INT_FLAG = PREFIX + "IntFlag"; public static final String UINT_FLAG = PREFIX + "UnsignedIntFlag"; public static final String ULONG_FLAG_CHANGED = PREFIX + "UnsignedLongFlagChanged"; public static final String BOOLEAN_FLAG_CHANGED = PREFIX + "BooleanFlagChanged"; public static final String STRING_FLAG_CHANGED = PREFIX + "StringFlagChanged"; public static final String DOUBLE_FLAG_CHANGED = PREFIX + "DoubleFlagChanged"; public static final String LONG_FLAG_CHANGED = PREFIX + "LongFlagChanged"; public static final String INT_FLAG_CHANGED = PREFIX + "IntFlagChanged"; public static final String UINT_FLAG_CHANGED = PREFIX + "UnsignedIntFlagChanged"; public static final String TIME_CONVERSION = PREFIX + "CPUTimeStampCounter"; public static final String THREAD_DUMP = PREFIX + "ThreadDump"; public static final String JFR_DATA_LOST = PREFIX + "DataLoss"; public static final String DUMP_REASON = PREFIX + "DumpReason"; public static final String GC_CONF_YOUNG_GENERATION = PREFIX + "YoungGenerationConfiguration"; public static final String GC_CONF_SURVIVOR = PREFIX + "GCSurvivorConfiguration"; public static final String GC_CONF_TLAB = PREFIX + "GCTLABConfiguration"; public static final String JAVA_THREAD_START = PREFIX + "ThreadStart"; public static final String JAVA_THREAD_END = PREFIX + "ThreadEnd"; public static final String VM_OPERATIONS = PREFIX + "ExecuteVMOperation"; public static final String VM_SHUTDOWN = PREFIX + "Shutdown"; public static final String THREAD_STATISTICS = PREFIX + "JavaThreadStatistics"; public static final String CONTEXT_SWITCH_RATE = PREFIX + "ThreadContextSwitchRate"; public static final String COMPILER_CONFIG = PREFIX + "CompilerConfiguration"; public static final String CODE_CACHE_CONFIG = PREFIX + "CodeCacheConfiguration"; public static final String CODE_SWEEPER_CONFIG = PREFIX + "CodeSweeperConfiguration"; public static final String COMPILER_PHASE = PREFIX + "CompilerPhase"; public static final String GC_COLLECTOR_G1_GARBAGE_COLLECTION = PREFIX + "G1GarbageCollection"; public static final String GC_COLLECTOR_OLD_GARBAGE_COLLECTION = PREFIX + "OldGarbageCollection"; public static final String GC_COLLECTOR_PAROLD_GARBAGE_COLLECTION = PREFIX + "ParallelOldGarbageCollection"; public static final String GC_COLLECTOR_YOUNG_GARBAGE_COLLECTION = PREFIX + "YoungGarbageCollection"; public static final String GC_DETAILED_ALLOCATION_REQUIRING_GC = PREFIX + "AllocationRequiringGC"; public static final String GC_DETAILED_EVACUATION_FAILED = PREFIX + "EvacuationFailed"; public static final String GC_DETAILED_EVACUATION_INFO = PREFIX + "EvacuationInformation"; public static final String GC_DETAILED_OBJECT_COUNT_AFTER_GC = PREFIX + "ObjectCountAfterGC"; public static final String GC_DETAILED_PROMOTION_FAILED = PREFIX + "PromotionFailed"; public static final String GC_HEAP_PS_SUMMARY = PREFIX + "PSHeapSummary"; public static final String GC_METASPACE_ALLOCATION_FAILURE = PREFIX + "MetaspaceAllocationFailure"; public static final String GC_METASPACE_CHUNK_FREE_LIST_SUMMARY = PREFIX + "MetaspaceChunkFreeListSummary"; public static final String GC_METASPACE_GC_THRESHOLD = PREFIX + "MetaspaceGCThreshold"; public static final String GC_G1MMU = PREFIX + "G1MMU"; public static final String GC_G1_EVACUATION_YOUNG_STATS = PREFIX + "G1EvacuationYoungStatistics"; public static final String GC_G1_EVACUATION_OLD_STATS = PREFIX + "G1EvacuationOldStatistics"; public static final String GC_G1_BASIC_IHOP = PREFIX + "G1BasicIHOP"; public static final String GC_G1_HEAP_REGION_TYPE_CHANGE = PREFIX + "G1HeapRegionTypeChange"; public static final String GC_G1_HEAP_REGION_INFORMATION = PREFIX + "G1HeapRegionInformation"; public static final String BIASED_LOCK_SELF_REVOCATION = PREFIX + "BiasedLockSelfRevocation"; public static final String BIASED_LOCK_REVOCATION = PREFIX + "BiasedLockRevocation"; public static final String BIASED_LOCK_CLASS_REVOCATION = PREFIX + "BiasedLockClassRevocation"; public static final String GC_G1_ADAPTIVE_IHOP = PREFIX + "G1AdaptiveIHOP"; public static final String RECORDINGS = PREFIX + "ActiveRecording"; public static final String RECORDING_SETTING = PREFIX + "ActiveSetting"; // Safepointing begin public static final String SAFEPOINT_BEGIN = PREFIX + "SafepointBegin"; // Synchronize run state of threads public static final String SAFEPOINT_STATE_SYNC = PREFIX + "SafepointStateSynchronization"; // Safepointing begin waiting on running threads to block public static final String SAFEPOINT_WAIT_BLOCKED = PREFIX + "SafepointWaitBlocked"; // Safepointing begin running cleanup (parent) public static final String SAFEPOINT_CLEANUP = PREFIX + "SafepointCleanup"; // Safepointing begin running cleanup task, individual subtasks public static final String SAFEPOINT_CLEANUP_TASK = PREFIX + "SafepointCleanupTask"; // Safepointing end public static final String SAFEPOINT_END = PREFIX + "SafepointEnd"; public static final String MODULE_EXPORT = PREFIX + "ModuleExport"; public static final String MODULE_REQUIRE = PREFIX + "ModuleRequire"; public static final String NATIVE_LIBRARY = PREFIX + "NativeLibrary"; }
UTF-8
Java
12,097
java
JdkTypeIDs.java
Java
[]
null
[]
/* * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * The contents of this file are subject to the terms of either the Universal Permissive License * v 1.0 as shown at http://oss.oracle.com/licenses/upl * * or the following license: * * Redistribution and use in source and binary forms, with or without modification, are permitted * provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of conditions * and the following disclaimer. * * 2. 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. * * 3. Neither the name of the copyright holder nor the names of its contributors may be used to * endorse or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 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.openjdk.jmc.flightrecorder.jdk; import org.openjdk.jmc.common.item.IType; /** * Contains type IDs for events that are produced by JDK 11+. These strings can be compared to the * result of {@link IType#getIdentifier()} and for creating filters with * {@link ItemFilters#type(String)}. */ @SuppressWarnings("nls") public final class JdkTypeIDs { /* * Whenever the PREFIX is changed, corresponding changes must be made in * application/org.openjdk.jmc.flightrecorder.ui/defaultPages.xml */ private final static String PREFIX = "jdk."; public static final String CPU_LOAD = PREFIX + "CPULoad"; public static final String EXECUTION_SAMPLE = PREFIX + "ExecutionSample"; public static final String EXECUTION_SAMPLING_INFO_EVENT_ID = PREFIX + "ExecutionSampling"; public static final String NATIVE_METHOD_SAMPLE = PREFIX + "NativeMethodSample"; public static final String PROCESSES = PREFIX + "SystemProcess"; public static final String OS_MEMORY_SUMMARY = PREFIX + "PhysicalMemory"; public static final String OS_INFORMATION = PREFIX + "OSInformation"; public static final String CPU_INFORMATION = PREFIX + "CPUInformation"; public static final String THREAD_ALLOCATION_STATISTICS = PREFIX + "ThreadAllocationStatistics"; public static final String HEAP_CONF = PREFIX + "GCHeapConfiguration"; public static final String GC_CONF = PREFIX + "GCConfiguration"; public static final String HEAP_SUMMARY = PREFIX + "GCHeapSummary"; public static final String ALLOC_INSIDE_TLAB = PREFIX + "ObjectAllocationInNewTLAB"; public static final String ALLOC_OUTSIDE_TLAB = PREFIX + "ObjectAllocationOutsideTLAB"; public static final String VM_INFO = PREFIX + "JVMInformation"; public static final String CLASS_DEFINE = PREFIX + "ClassDefine"; public static final String CLASS_LOAD = PREFIX + "ClassLoad"; public static final String CLASS_UNLOAD = PREFIX + "ClassUnload"; public static final String CLASS_LOAD_STATISTICS = PREFIX + "ClassLoadingStatistics"; public static final String CLASS_LOADER_STATISTICS = PREFIX + "ClassLoaderStatistics"; public static final String COMPILATION = PREFIX + "Compilation"; public static final String FILE_WRITE = PREFIX + "FileWrite"; public static final String FILE_READ = PREFIX + "FileRead"; public static final String SOCKET_WRITE = PREFIX + "SocketWrite"; public static final String SOCKET_READ = PREFIX + "SocketRead"; public static final String THREAD_PARK = PREFIX + "ThreadPark"; public static final String THREAD_SLEEP = PREFIX + "ThreadSleep"; public static final String MONITOR_ENTER = PREFIX + "JavaMonitorEnter"; public static final String MONITOR_WAIT = PREFIX + "JavaMonitorWait"; public static final String METASPACE_OOM = PREFIX + "MetaspaceOOM"; public static final String CODE_CACHE_FULL = PREFIX + "CodeCacheFull"; public static final String CODE_CACHE_STATISTICS = PREFIX + "CodeCacheStatistics"; public static final String CODE_SWEEPER_STATISTICS = PREFIX + "CodeSweeperStatistics"; public static final String SWEEP_CODE_CACHE = PREFIX + "SweepCodeCache"; public static final String ENVIRONMENT_VARIABLE = PREFIX + "InitialEnvironmentVariable"; public static final String SYSTEM_PROPERTIES = PREFIX + "InitialSystemProperty"; public static final String OBJECT_COUNT = PREFIX + "ObjectCount"; public static final String GC_REFERENCE_STATISTICS = PREFIX + "GCReferenceStatistics"; public static final String OLD_OBJECT_SAMPLE = PREFIX + "OldObjectSample"; public static final String GC_PAUSE_L4 = PREFIX + "GCPhasePauseLevel4"; public static final String GC_PAUSE_L3 = PREFIX + "GCPhasePauseLevel3"; public static final String GC_PAUSE_L2 = PREFIX + "GCPhasePauseLevel2"; public static final String GC_PAUSE_L1 = PREFIX + "GCPhasePauseLevel1"; public static final String GC_PAUSE = PREFIX + "GCPhasePause"; public static final String METASPACE_SUMMARY = PREFIX + "MetaspaceSummary"; public static final String GARBAGE_COLLECTION = PREFIX + "GarbageCollection"; public static final String CONCURRENT_MODE_FAILURE = PREFIX + "ConcurrentModeFailure"; public static final String THROWABLES_STATISTICS = PREFIX + "ExceptionStatistics"; public static final String ERRORS_THROWN = PREFIX + "JavaErrorThrow"; /* * NOTE: The parser filters all JavaExceptionThrow events created from the Error constructor to * avoid duplicates, so this event type represents 'non error throwables' rather than * exceptions. See note in SyntheticAttributeExtension which does the duplicate filtering. */ public static final String EXCEPTIONS_THROWN = PREFIX + "JavaExceptionThrow"; public static final String COMPILER_STATS = PREFIX + "CompilerStatistics"; public static final String COMPILER_FAILURE = PREFIX + "CompilationFailure"; public static final String ULONG_FLAG = PREFIX + "UnsignedLongFlag"; public static final String BOOLEAN_FLAG = PREFIX + "BooleanFlag"; public static final String STRING_FLAG = PREFIX + "StringFlag"; public static final String DOUBLE_FLAG = PREFIX + "DoubleFlag"; public static final String LONG_FLAG = PREFIX + "LongFlag"; public static final String INT_FLAG = PREFIX + "IntFlag"; public static final String UINT_FLAG = PREFIX + "UnsignedIntFlag"; public static final String ULONG_FLAG_CHANGED = PREFIX + "UnsignedLongFlagChanged"; public static final String BOOLEAN_FLAG_CHANGED = PREFIX + "BooleanFlagChanged"; public static final String STRING_FLAG_CHANGED = PREFIX + "StringFlagChanged"; public static final String DOUBLE_FLAG_CHANGED = PREFIX + "DoubleFlagChanged"; public static final String LONG_FLAG_CHANGED = PREFIX + "LongFlagChanged"; public static final String INT_FLAG_CHANGED = PREFIX + "IntFlagChanged"; public static final String UINT_FLAG_CHANGED = PREFIX + "UnsignedIntFlagChanged"; public static final String TIME_CONVERSION = PREFIX + "CPUTimeStampCounter"; public static final String THREAD_DUMP = PREFIX + "ThreadDump"; public static final String JFR_DATA_LOST = PREFIX + "DataLoss"; public static final String DUMP_REASON = PREFIX + "DumpReason"; public static final String GC_CONF_YOUNG_GENERATION = PREFIX + "YoungGenerationConfiguration"; public static final String GC_CONF_SURVIVOR = PREFIX + "GCSurvivorConfiguration"; public static final String GC_CONF_TLAB = PREFIX + "GCTLABConfiguration"; public static final String JAVA_THREAD_START = PREFIX + "ThreadStart"; public static final String JAVA_THREAD_END = PREFIX + "ThreadEnd"; public static final String VM_OPERATIONS = PREFIX + "ExecuteVMOperation"; public static final String VM_SHUTDOWN = PREFIX + "Shutdown"; public static final String THREAD_STATISTICS = PREFIX + "JavaThreadStatistics"; public static final String CONTEXT_SWITCH_RATE = PREFIX + "ThreadContextSwitchRate"; public static final String COMPILER_CONFIG = PREFIX + "CompilerConfiguration"; public static final String CODE_CACHE_CONFIG = PREFIX + "CodeCacheConfiguration"; public static final String CODE_SWEEPER_CONFIG = PREFIX + "CodeSweeperConfiguration"; public static final String COMPILER_PHASE = PREFIX + "CompilerPhase"; public static final String GC_COLLECTOR_G1_GARBAGE_COLLECTION = PREFIX + "G1GarbageCollection"; public static final String GC_COLLECTOR_OLD_GARBAGE_COLLECTION = PREFIX + "OldGarbageCollection"; public static final String GC_COLLECTOR_PAROLD_GARBAGE_COLLECTION = PREFIX + "ParallelOldGarbageCollection"; public static final String GC_COLLECTOR_YOUNG_GARBAGE_COLLECTION = PREFIX + "YoungGarbageCollection"; public static final String GC_DETAILED_ALLOCATION_REQUIRING_GC = PREFIX + "AllocationRequiringGC"; public static final String GC_DETAILED_EVACUATION_FAILED = PREFIX + "EvacuationFailed"; public static final String GC_DETAILED_EVACUATION_INFO = PREFIX + "EvacuationInformation"; public static final String GC_DETAILED_OBJECT_COUNT_AFTER_GC = PREFIX + "ObjectCountAfterGC"; public static final String GC_DETAILED_PROMOTION_FAILED = PREFIX + "PromotionFailed"; public static final String GC_HEAP_PS_SUMMARY = PREFIX + "PSHeapSummary"; public static final String GC_METASPACE_ALLOCATION_FAILURE = PREFIX + "MetaspaceAllocationFailure"; public static final String GC_METASPACE_CHUNK_FREE_LIST_SUMMARY = PREFIX + "MetaspaceChunkFreeListSummary"; public static final String GC_METASPACE_GC_THRESHOLD = PREFIX + "MetaspaceGCThreshold"; public static final String GC_G1MMU = PREFIX + "G1MMU"; public static final String GC_G1_EVACUATION_YOUNG_STATS = PREFIX + "G1EvacuationYoungStatistics"; public static final String GC_G1_EVACUATION_OLD_STATS = PREFIX + "G1EvacuationOldStatistics"; public static final String GC_G1_BASIC_IHOP = PREFIX + "G1BasicIHOP"; public static final String GC_G1_HEAP_REGION_TYPE_CHANGE = PREFIX + "G1HeapRegionTypeChange"; public static final String GC_G1_HEAP_REGION_INFORMATION = PREFIX + "G1HeapRegionInformation"; public static final String BIASED_LOCK_SELF_REVOCATION = PREFIX + "BiasedLockSelfRevocation"; public static final String BIASED_LOCK_REVOCATION = PREFIX + "BiasedLockRevocation"; public static final String BIASED_LOCK_CLASS_REVOCATION = PREFIX + "BiasedLockClassRevocation"; public static final String GC_G1_ADAPTIVE_IHOP = PREFIX + "G1AdaptiveIHOP"; public static final String RECORDINGS = PREFIX + "ActiveRecording"; public static final String RECORDING_SETTING = PREFIX + "ActiveSetting"; // Safepointing begin public static final String SAFEPOINT_BEGIN = PREFIX + "SafepointBegin"; // Synchronize run state of threads public static final String SAFEPOINT_STATE_SYNC = PREFIX + "SafepointStateSynchronization"; // Safepointing begin waiting on running threads to block public static final String SAFEPOINT_WAIT_BLOCKED = PREFIX + "SafepointWaitBlocked"; // Safepointing begin running cleanup (parent) public static final String SAFEPOINT_CLEANUP = PREFIX + "SafepointCleanup"; // Safepointing begin running cleanup task, individual subtasks public static final String SAFEPOINT_CLEANUP_TASK = PREFIX + "SafepointCleanupTask"; // Safepointing end public static final String SAFEPOINT_END = PREFIX + "SafepointEnd"; public static final String MODULE_EXPORT = PREFIX + "ModuleExport"; public static final String MODULE_REQUIRE = PREFIX + "ModuleRequire"; public static final String NATIVE_LIBRARY = PREFIX + "NativeLibrary"; }
12,097
0.779615
0.776721
200
59.485001
34.154938
109
false
false
0
0
0
0
0
0
1.405
false
false
13
8d891bff0f1d1c4a22803e762ef02f8db3b9811a
16,140,487,166,454
57cd4a29f89e41118a10cdef84b180af9ca40e70
/src/main/java/com/raizunne/redstonic/RedstonicRecipes.java
3527947a90f4d538213709524651c981b8379dc3
[]
no_license
screnex/Redstonic
https://github.com/screnex/Redstonic
da14feeeb249624e122e6b6e8bc3d3257aeb3350
ad1b64b719b2ba78f1889f794834e48230c7d4ac
refs/heads/master
2021-01-18T11:59:31.069000
2016-02-20T11:00:37
2016-02-20T11:00:37
52,148,841
0
0
null
true
2016-02-20T10:50:22
2016-02-20T10:50:22
2015-12-04T15:35:57
2015-09-09T16:34:07
817
0
0
0
null
null
null
package com.raizunne.redstonic; import com.raizunne.redstonic.Item.IRecipes.ContainerSet; import com.raizunne.redstonic.Item.IRecipes.EnergeticBattery; import com.raizunne.redstonic.Item.IRecipes.HotswapSet; import com.raizunne.redstonic.Util.EIOHelper; import com.raizunne.redstonic.Util.TEHelper; import com.raizunne.redstonic.Util.Util; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; /** * Created by Raizunne as a part of Redstonic * on 06/02/2015, 09:56 PM. */ public class RedstonicRecipes { public static void init(){ GameRegistry.addShapelessRecipe(new ItemStack(RedstonicItems.ManualBook), new Object[]{Items.book, Items.stone_pickaxe}); //MOD RECIPES GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.IronHead), new Object[]{ " I ", "IBI", "IBI", 'I', "ingotIron", 'B', "blockIron"})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.GoldHead), new Object[]{ " I ", "IBI", "IBI", 'I', "ingotGold", 'B', "blockGold"})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.DiamondHead), new Object[]{ " I ", "III", "IBI", 'I', "gemDiamond", 'B', "blockDiamond"})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.HeavyHead), new Object[]{ " I ", "IDI", "GBH", 'D', RedstonicItems.DiamondHead, 'G', RedstonicItems.GoldHead, 'H', RedstonicItems.IronHead, 'I', "ingotIron", 'B', "blockIron"})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.FortuitousHead), new Object[]{ " I ", "IDI", "GBH", 'D', RedstonicItems.DiamondHead, 'G', RedstonicItems.GoldHead, 'H', RedstonicItems.IronHead, 'I', "ingotIron", 'B', "blockLapis"})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.SpeedAugment), new Object[]{ "III", "IBI", "III", 'I', "ironIngot", 'B', RedstonicItems.GoldHead})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.SpeedIIAugment), new Object[]{ "I I", "BAB", "I I", 'I', "ingotIron", 'A', RedstonicItems.SpeedAugment, 'B', "blockIron", 'D', RedstonicItems.GoldHead})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.HotswapAugment), new Object[]{ "III", "DCD", "III", 'C', Blocks.chest, 'D', RedstonicItems.IronHead, 'I', "ingotIron"})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.SilkyHead), new Object[]{ " E ", "EGE", "GDG", 'E', "gemEmerald", 'G', "ingotGold", 'D', RedstonicItems.DiamondHead})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.BlazerHead), new Object[]{ " C ", "CGC", "EDE", 'C', "blockCoal", 'E', "gemEmerald", 'G', RedstonicItems.DiamondHead, 'D', RedstonicItems.GoldHead})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicBlocks.Modifier), "WIW", "IGI", "WIW", 'W', Blocks.log, 'I', "ingotIron", 'G', "gearIron")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.BlockAugment), new Object[]{ "I I", " B ", "I I", 'I', "ingotIron", 'B', Blocks.stonebrick})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.capacitor), " R ", "RCR", "GRG", 'R', "dustRedstone", 'C', "ingotCopper", 'G', "nuggetGold")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.basicBattery), " R ", "SCS", "RAR", 'R', "blockRedstone", 'S', "ingotInvar", 'C', "ingotCopper", 'A', RedstonicItems.capacitor)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.infiniteBattery), "III", "III", "III", 'I', RedstonicItems.infiniteBattery)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicBlocks.Driller), "CEC", "IBI", "CCC", 'C', "cobblestone", 'E', RedstonicItems.EnergizerFull, 'I', "blockIron", 'B', "redstonicMidTierBody")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.MagnetAugment), "III", " LB", "III", 'I', "ingotIron", 'L', "ingotLumium", 'B', RedstonicItems.basicBattery)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.IronHandle), " I ", "ISI", "BI ", 'I', "ingotIron", 'S', RedstonicItems.redstoneStick, 'B', "blockIron")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.WoodHandle), " I ", "ISI", "II ", 'I', "logWood", 'S', "stickWood")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.IronBlade), " I", " B ", "B ", 'I', "ingotIron", 'B', "blockIron")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.DiamondBlade), " I", " B ", "B ", 'I', "gemDiamond", 'B', "blockDiamond")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.BerserkSwordAugment), "III", "KBK", "III", 'I', "ingotIron", 'B', RedstonicItems.IronBlade, 'K', "blockIron")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.BerserkIISwordAugment), "IKI", "IBI", "III", 'I', "ingotIron", 'B', "redstonicMidTierBlade", 'K', RedstonicItems.BerserkSwordAugment)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.BlazerSwordAugment), "CIC", "IBI", "CIC", 'I', "ingotIron", 'B', "redstonicMidTierBlade", 'C', Items.fire_charge)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.FortuitousSwordAugment), "CIC", "IBI", "CIC", 'I', "ingotIron", 'B', "gemLapis", 'C', "blockLapis")); //TE RECIPES if(Loader.isModLoaded("ThermalExpansion")) { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.Energizer), "LUL", "UHU", "LUL", 'L', "ingotLead", 'U', "ingotLumium", 'H', "blockGlassHardened", 'D', RedstonicItems.GoldHead)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.EnergyAugment), "III", "IBI", "III", 'I', "ingotIron", 'B', TEHelper.capacitorRedstone)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.IronBody), " G ", "IBG", "II ", 'I', "ingotIron", 'B', TEHelper.coilElectrum, 'G', "gearIron")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.ElectrumBody), " G ", "IBG", "II ", 'I', "ingotElectrum", 'B', TEHelper.coilElectrum, 'G', "gearElectrum")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.EnderiumBody), " G ", "IBG", "II ", 'I', "ingotEnderium", 'B', TEHelper.coilElectrum, 'G', TEHelper.gearEnderium)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.ElectrumHandle), " I ", "ISI", "II ", 'I', TEHelper.ingotElectrum, 'S', RedstonicItems.redstoneStick)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.EnderiumHandle), " I ", "ISI", "II ", 'I', TEHelper.ingotEnderium, 'S', RedstonicItems.redstoneStick)); GameRegistry.addRecipe(new ItemStack(RedstonicItems.EndHead), new Object[]{ " D ", "IWG", "ECE", 'D', RedstonicItems.DiamondHead, 'I', RedstonicItems.IronHead, 'W', Items.nether_star, 'G', RedstonicItems.GoldHead, 'E', RedstonicItems.EnergizerFull, 'C', TEHelper.coilElectrum}); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.UltimateBody), " G ", "IWG", "II ", 'W', Items.nether_star, 'I', "ingotPlatinum", 'G', RedstonicItems.EnergizerFull)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.ElectrumBlade), " I", " B ", "B ", 'I', TEHelper.ingotElectrum, 'B', TEHelper.blockElectrum)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.EnderiumBlade), " I", " I ", "B ", 'I', TEHelper.ingotEnderium, 'B', TEHelper.blockEnderium)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.MagnetAugment), "III", " LB", "III", 'I', "ingotIron", 'L', "ingotLumium", 'B', TEHelper.capacitorHardened)); TEHelper.addSmelterRecipe(32000, new ItemStack(RedstonicItems.Energizer), new ItemStack(Blocks.redstone_block, 40), new ItemStack(RedstonicItems.EnergizerFull)); TEHelper.addSmelterRecipe(1600, new ItemStack(Items.stick), new ItemStack(Items.redstone, 20), new ItemStack(RedstonicItems.redstoneStick)); // TEHelper.addTransposerFill(32000, new ItemStack(RedstonicItems.Energizer), new ItemStack(RedstonicItems.EnergizerFull), new FluidStack(FluidRegistry.getFluid("redstone"), 32000), false); // TEHelper.addTransposerFill(1600, new ItemStack(Items.stick), new ItemStack(RedstonicItems.redstoneStick), new FluidStack(FluidRegistry.getFluid("redstone"), 2000), false); } //ENDER IO RECIPES if(Loader.isModLoaded("EnderIO")){ EIOHelper.addAlloySmelterRecipe("Energizer Filling", 32000, Util.toStack(Blocks.redstone_block, 20, 0), Util.toStack(RedstonicItems.Energizer), Util.toStack(Blocks.redstone_block, 20, 0), Util.toStack(RedstonicItems.EnergizerFull)); EIOHelper.addAlloySmelterRecipe("Vibrantium", 16000, Util.sizedStack(EIOHelper.ingotVibrant, 8), Util.sizedStack(EIOHelper.etchingCrystal, 2), Util.sizedStack(EIOHelper.ingotSoularium, 32), Util.toStack(RedstonicItems.ingotVibrantium)); EIOHelper.addAlloySmelterRecipe("Glowstone Infused Steel", 8000, Util.sizedStack(EIOHelper.ingotElectrical, 2), Util.sizedStack(Util.toStack(Items.glowstone_dust), 8), null, Util.toStack(RedstonicItems.ingotGlowSteel)); EIOHelper.addAlloySmelterRecipe("Redstone Stick", 2000, Util.toStack(Items.redstone, 20, 0), Util.toStack(Items.stick, 1, 0), null, Util.toStack(RedstonicItems.redstoneStick)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.Energizer), "LUL", "UHU", "LUL", 'L', "ingotConductiveIron", 'U', "ingotLumium", 'H', "blockGlassHardened", 'D', RedstonicItems.GoldHead)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.UltimateBody), " G ", "IWG", "II ", 'W', Items.nether_star, 'I', RedstonicItems.ingotVibrantium, 'G', RedstonicItems.EnergizerFull)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.EndHead), new Object[]{ " D ", "IWG", "ECE", 'D', RedstonicItems.DiamondHead, 'I', RedstonicItems.IronHead, 'W', Items.nether_star, 'G', RedstonicItems.GoldHead, 'E', RedstonicItems.EnergizerFull, 'C', EIOHelper.basicCapacitor})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.gearIron), new Object[]{ " I ", "IGI", " I ", 'I', "ingotIron", 'G', EIOHelper.basicGear})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.gearEnergized), " I ", "IGI", " I ", 'I', EIOHelper.ingotEnergized, 'G', "gearIron")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.gearVibrant), " I ", "IGI", " I ", 'I', EIOHelper.ingotVibrant, 'G', "gearEnergized")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.IronBody), " G ", "IBG", "II ", 'I', "ingotIron", 'B', EIOHelper.basicCapacitor, 'G', "gearIron")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.EnergeticBody), " G ", "IBG", "II ", 'I', EIOHelper.ingotEnergized, 'B', EIOHelper.doubleCapacitor, 'G', RedstonicItems.gearEnergized)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.VibrantBody), " G ", "IBG", "II ", 'I', EIOHelper.ingotVibrant, 'B', EIOHelper.octadicCapacitor, 'G', RedstonicItems.gearVibrant)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.EnergizedHandle), " I ", "ISI", "II ", 'I', EIOHelper.ingotEnergized, 'S', RedstonicItems.redstoneStick)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.VibrantHandle), " I ", "ISI", "II ", 'I', EIOHelper.ingotVibrant, 'S', RedstonicItems.redstoneStick)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.basicBattery), " R ", "SCS", "RAR", 'R', Blocks.redstone_block, 'S', "ingotElectricalSteel", 'C', "ingotConductiveIron", 'A', EIOHelper.basicCapacitor)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.EnergizedBlade), " I", " B ", "B ", 'I', EIOHelper.ingotEnergized, 'B', EIOHelper.blockEnergetic)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.VibrantBlade), " I", " B ", "B ", 'I', EIOHelper.ingotVibrant, 'B', EIOHelper.blockVibrantium)); ItemStack basicBattery = new ItemStack(RedstonicItems.basicBattery); basicBattery.setItemDamage(OreDictionary.WILDCARD_VALUE); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.energizedBattery), " R ", "SCS", "RAR", 'R', "blockRedstone", 'S', "ingotEnergeticAlloy", 'C', "blockPhasedIron", 'A', basicBattery)); ItemStack energizedBattery = new ItemStack(RedstonicItems.energizedBattery); energizedBattery.setItemDamage(OreDictionary.WILDCARD_VALUE); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.greatBattery), " R ", "SCS", "RAR", 'R', "blockRedstone", 'S', RedstonicItems.ingotGlowSteel, 'C', "blockPhasedGold" , 'A', energizedBattery)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.EnergyAugment), new Object[]{ "III", "IBI", "III", 'I', "ingotIron", 'B', RedstonicItems.energizedBattery})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicBlocks.GlowSteel), "III", "III", "III", 'I', RedstonicItems.ingotGlowSteel)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicBlocks.Vibrantium), "III", "III", "III", 'I', RedstonicItems.ingotVibrantium)); GameRegistry.addShapelessRecipe(new ItemStack(RedstonicItems.ingotGlowSteel, 9), new ItemStack(RedstonicBlocks.GlowSteel)); GameRegistry.addShapelessRecipe(new ItemStack(RedstonicItems.ingotVibrantium, 9), new ItemStack(RedstonicBlocks.Vibrantium)); } GameRegistry.addRecipe(new HotswapSet()); GameRegistry.addRecipe(new ContainerSet()); } }
UTF-8
Java
17,613
java
RedstonicRecipes.java
Java
[ { "context": "tforge.oredict.ShapedOreRecipe;\n\n/**\n * Created by Raizunne as a part of Redstonic\n * on 06/02/2015, 09:56 PM", "end": 826, "score": 0.9992062449455261, "start": 818, "tag": "NAME", "value": "Raizunne" } ]
null
[]
package com.raizunne.redstonic; import com.raizunne.redstonic.Item.IRecipes.ContainerSet; import com.raizunne.redstonic.Item.IRecipes.EnergeticBattery; import com.raizunne.redstonic.Item.IRecipes.HotswapSet; import com.raizunne.redstonic.Util.EIOHelper; import com.raizunne.redstonic.Util.TEHelper; import com.raizunne.redstonic.Util.Util; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; /** * Created by Raizunne as a part of Redstonic * on 06/02/2015, 09:56 PM. */ public class RedstonicRecipes { public static void init(){ GameRegistry.addShapelessRecipe(new ItemStack(RedstonicItems.ManualBook), new Object[]{Items.book, Items.stone_pickaxe}); //MOD RECIPES GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.IronHead), new Object[]{ " I ", "IBI", "IBI", 'I', "ingotIron", 'B', "blockIron"})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.GoldHead), new Object[]{ " I ", "IBI", "IBI", 'I', "ingotGold", 'B', "blockGold"})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.DiamondHead), new Object[]{ " I ", "III", "IBI", 'I', "gemDiamond", 'B', "blockDiamond"})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.HeavyHead), new Object[]{ " I ", "IDI", "GBH", 'D', RedstonicItems.DiamondHead, 'G', RedstonicItems.GoldHead, 'H', RedstonicItems.IronHead, 'I', "ingotIron", 'B', "blockIron"})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.FortuitousHead), new Object[]{ " I ", "IDI", "GBH", 'D', RedstonicItems.DiamondHead, 'G', RedstonicItems.GoldHead, 'H', RedstonicItems.IronHead, 'I', "ingotIron", 'B', "blockLapis"})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.SpeedAugment), new Object[]{ "III", "IBI", "III", 'I', "ironIngot", 'B', RedstonicItems.GoldHead})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.SpeedIIAugment), new Object[]{ "I I", "BAB", "I I", 'I', "ingotIron", 'A', RedstonicItems.SpeedAugment, 'B', "blockIron", 'D', RedstonicItems.GoldHead})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.HotswapAugment), new Object[]{ "III", "DCD", "III", 'C', Blocks.chest, 'D', RedstonicItems.IronHead, 'I', "ingotIron"})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.SilkyHead), new Object[]{ " E ", "EGE", "GDG", 'E', "gemEmerald", 'G', "ingotGold", 'D', RedstonicItems.DiamondHead})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.BlazerHead), new Object[]{ " C ", "CGC", "EDE", 'C', "blockCoal", 'E', "gemEmerald", 'G', RedstonicItems.DiamondHead, 'D', RedstonicItems.GoldHead})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicBlocks.Modifier), "WIW", "IGI", "WIW", 'W', Blocks.log, 'I', "ingotIron", 'G', "gearIron")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.BlockAugment), new Object[]{ "I I", " B ", "I I", 'I', "ingotIron", 'B', Blocks.stonebrick})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.capacitor), " R ", "RCR", "GRG", 'R', "dustRedstone", 'C', "ingotCopper", 'G', "nuggetGold")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.basicBattery), " R ", "SCS", "RAR", 'R', "blockRedstone", 'S', "ingotInvar", 'C', "ingotCopper", 'A', RedstonicItems.capacitor)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.infiniteBattery), "III", "III", "III", 'I', RedstonicItems.infiniteBattery)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicBlocks.Driller), "CEC", "IBI", "CCC", 'C', "cobblestone", 'E', RedstonicItems.EnergizerFull, 'I', "blockIron", 'B', "redstonicMidTierBody")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.MagnetAugment), "III", " LB", "III", 'I', "ingotIron", 'L', "ingotLumium", 'B', RedstonicItems.basicBattery)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.IronHandle), " I ", "ISI", "BI ", 'I', "ingotIron", 'S', RedstonicItems.redstoneStick, 'B', "blockIron")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.WoodHandle), " I ", "ISI", "II ", 'I', "logWood", 'S', "stickWood")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.IronBlade), " I", " B ", "B ", 'I', "ingotIron", 'B', "blockIron")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.DiamondBlade), " I", " B ", "B ", 'I', "gemDiamond", 'B', "blockDiamond")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.BerserkSwordAugment), "III", "KBK", "III", 'I', "ingotIron", 'B', RedstonicItems.IronBlade, 'K', "blockIron")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.BerserkIISwordAugment), "IKI", "IBI", "III", 'I', "ingotIron", 'B', "redstonicMidTierBlade", 'K', RedstonicItems.BerserkSwordAugment)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.BlazerSwordAugment), "CIC", "IBI", "CIC", 'I', "ingotIron", 'B', "redstonicMidTierBlade", 'C', Items.fire_charge)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.FortuitousSwordAugment), "CIC", "IBI", "CIC", 'I', "ingotIron", 'B', "gemLapis", 'C', "blockLapis")); //TE RECIPES if(Loader.isModLoaded("ThermalExpansion")) { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.Energizer), "LUL", "UHU", "LUL", 'L', "ingotLead", 'U', "ingotLumium", 'H', "blockGlassHardened", 'D', RedstonicItems.GoldHead)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.EnergyAugment), "III", "IBI", "III", 'I', "ingotIron", 'B', TEHelper.capacitorRedstone)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.IronBody), " G ", "IBG", "II ", 'I', "ingotIron", 'B', TEHelper.coilElectrum, 'G', "gearIron")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.ElectrumBody), " G ", "IBG", "II ", 'I', "ingotElectrum", 'B', TEHelper.coilElectrum, 'G', "gearElectrum")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.EnderiumBody), " G ", "IBG", "II ", 'I', "ingotEnderium", 'B', TEHelper.coilElectrum, 'G', TEHelper.gearEnderium)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.ElectrumHandle), " I ", "ISI", "II ", 'I', TEHelper.ingotElectrum, 'S', RedstonicItems.redstoneStick)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.EnderiumHandle), " I ", "ISI", "II ", 'I', TEHelper.ingotEnderium, 'S', RedstonicItems.redstoneStick)); GameRegistry.addRecipe(new ItemStack(RedstonicItems.EndHead), new Object[]{ " D ", "IWG", "ECE", 'D', RedstonicItems.DiamondHead, 'I', RedstonicItems.IronHead, 'W', Items.nether_star, 'G', RedstonicItems.GoldHead, 'E', RedstonicItems.EnergizerFull, 'C', TEHelper.coilElectrum}); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.UltimateBody), " G ", "IWG", "II ", 'W', Items.nether_star, 'I', "ingotPlatinum", 'G', RedstonicItems.EnergizerFull)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.ElectrumBlade), " I", " B ", "B ", 'I', TEHelper.ingotElectrum, 'B', TEHelper.blockElectrum)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.EnderiumBlade), " I", " I ", "B ", 'I', TEHelper.ingotEnderium, 'B', TEHelper.blockEnderium)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.MagnetAugment), "III", " LB", "III", 'I', "ingotIron", 'L', "ingotLumium", 'B', TEHelper.capacitorHardened)); TEHelper.addSmelterRecipe(32000, new ItemStack(RedstonicItems.Energizer), new ItemStack(Blocks.redstone_block, 40), new ItemStack(RedstonicItems.EnergizerFull)); TEHelper.addSmelterRecipe(1600, new ItemStack(Items.stick), new ItemStack(Items.redstone, 20), new ItemStack(RedstonicItems.redstoneStick)); // TEHelper.addTransposerFill(32000, new ItemStack(RedstonicItems.Energizer), new ItemStack(RedstonicItems.EnergizerFull), new FluidStack(FluidRegistry.getFluid("redstone"), 32000), false); // TEHelper.addTransposerFill(1600, new ItemStack(Items.stick), new ItemStack(RedstonicItems.redstoneStick), new FluidStack(FluidRegistry.getFluid("redstone"), 2000), false); } //ENDER IO RECIPES if(Loader.isModLoaded("EnderIO")){ EIOHelper.addAlloySmelterRecipe("Energizer Filling", 32000, Util.toStack(Blocks.redstone_block, 20, 0), Util.toStack(RedstonicItems.Energizer), Util.toStack(Blocks.redstone_block, 20, 0), Util.toStack(RedstonicItems.EnergizerFull)); EIOHelper.addAlloySmelterRecipe("Vibrantium", 16000, Util.sizedStack(EIOHelper.ingotVibrant, 8), Util.sizedStack(EIOHelper.etchingCrystal, 2), Util.sizedStack(EIOHelper.ingotSoularium, 32), Util.toStack(RedstonicItems.ingotVibrantium)); EIOHelper.addAlloySmelterRecipe("Glowstone Infused Steel", 8000, Util.sizedStack(EIOHelper.ingotElectrical, 2), Util.sizedStack(Util.toStack(Items.glowstone_dust), 8), null, Util.toStack(RedstonicItems.ingotGlowSteel)); EIOHelper.addAlloySmelterRecipe("Redstone Stick", 2000, Util.toStack(Items.redstone, 20, 0), Util.toStack(Items.stick, 1, 0), null, Util.toStack(RedstonicItems.redstoneStick)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.Energizer), "LUL", "UHU", "LUL", 'L', "ingotConductiveIron", 'U', "ingotLumium", 'H', "blockGlassHardened", 'D', RedstonicItems.GoldHead)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.UltimateBody), " G ", "IWG", "II ", 'W', Items.nether_star, 'I', RedstonicItems.ingotVibrantium, 'G', RedstonicItems.EnergizerFull)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.EndHead), new Object[]{ " D ", "IWG", "ECE", 'D', RedstonicItems.DiamondHead, 'I', RedstonicItems.IronHead, 'W', Items.nether_star, 'G', RedstonicItems.GoldHead, 'E', RedstonicItems.EnergizerFull, 'C', EIOHelper.basicCapacitor})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.gearIron), new Object[]{ " I ", "IGI", " I ", 'I', "ingotIron", 'G', EIOHelper.basicGear})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.gearEnergized), " I ", "IGI", " I ", 'I', EIOHelper.ingotEnergized, 'G', "gearIron")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.gearVibrant), " I ", "IGI", " I ", 'I', EIOHelper.ingotVibrant, 'G', "gearEnergized")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.IronBody), " G ", "IBG", "II ", 'I', "ingotIron", 'B', EIOHelper.basicCapacitor, 'G', "gearIron")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.EnergeticBody), " G ", "IBG", "II ", 'I', EIOHelper.ingotEnergized, 'B', EIOHelper.doubleCapacitor, 'G', RedstonicItems.gearEnergized)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.VibrantBody), " G ", "IBG", "II ", 'I', EIOHelper.ingotVibrant, 'B', EIOHelper.octadicCapacitor, 'G', RedstonicItems.gearVibrant)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.EnergizedHandle), " I ", "ISI", "II ", 'I', EIOHelper.ingotEnergized, 'S', RedstonicItems.redstoneStick)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.VibrantHandle), " I ", "ISI", "II ", 'I', EIOHelper.ingotVibrant, 'S', RedstonicItems.redstoneStick)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.basicBattery), " R ", "SCS", "RAR", 'R', Blocks.redstone_block, 'S', "ingotElectricalSteel", 'C', "ingotConductiveIron", 'A', EIOHelper.basicCapacitor)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.EnergizedBlade), " I", " B ", "B ", 'I', EIOHelper.ingotEnergized, 'B', EIOHelper.blockEnergetic)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.VibrantBlade), " I", " B ", "B ", 'I', EIOHelper.ingotVibrant, 'B', EIOHelper.blockVibrantium)); ItemStack basicBattery = new ItemStack(RedstonicItems.basicBattery); basicBattery.setItemDamage(OreDictionary.WILDCARD_VALUE); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.energizedBattery), " R ", "SCS", "RAR", 'R', "blockRedstone", 'S', "ingotEnergeticAlloy", 'C', "blockPhasedIron", 'A', basicBattery)); ItemStack energizedBattery = new ItemStack(RedstonicItems.energizedBattery); energizedBattery.setItemDamage(OreDictionary.WILDCARD_VALUE); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.greatBattery), " R ", "SCS", "RAR", 'R', "blockRedstone", 'S', RedstonicItems.ingotGlowSteel, 'C', "blockPhasedGold" , 'A', energizedBattery)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicItems.EnergyAugment), new Object[]{ "III", "IBI", "III", 'I', "ingotIron", 'B', RedstonicItems.energizedBattery})); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicBlocks.GlowSteel), "III", "III", "III", 'I', RedstonicItems.ingotGlowSteel)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RedstonicBlocks.Vibrantium), "III", "III", "III", 'I', RedstonicItems.ingotVibrantium)); GameRegistry.addShapelessRecipe(new ItemStack(RedstonicItems.ingotGlowSteel, 9), new ItemStack(RedstonicBlocks.GlowSteel)); GameRegistry.addShapelessRecipe(new ItemStack(RedstonicItems.ingotVibrantium, 9), new ItemStack(RedstonicBlocks.Vibrantium)); } GameRegistry.addRecipe(new HotswapSet()); GameRegistry.addRecipe(new ContainerSet()); } }
17,613
0.592687
0.588145
323
53.532509
49.126877
248
false
false
0
0
0
0
0
0
1.972136
false
false
13
681a470c7e9c998407b26e09eb55486f278059d4
25,993,142,141,269
4f2b883644e8a1cef81a0d48a27e362885eadca6
/Experiments/GUIExperiment/src/main/java/org/teamyeah/cheapaviasales/FlightModel.java
78667d1ecab3b56020491b9c50dfc209550fc051
[]
no_license
aleksix/cheapaviasales
https://github.com/aleksix/cheapaviasales
b872fccc0743d3a716760a77d31cce8eb02613b8
31f98bbe19b63fcbeb7b50362f869587970b5d9f
refs/heads/master
2020-02-05T15:15:08.728000
2015-07-02T08:39:43
2015-07-02T08:39:43
38,258,021
1
2
null
false
2015-07-02T08:39:43
2015-06-29T16:28:06
2015-07-01T09:31:14
2015-07-02T08:39:43
0
1
2
1
Java
null
null
package org.teamyeah.cheapaviasales; import javafx.beans.property.ListProperty; import javafx.beans.property.SimpleListProperty; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; public class FlightModel { private ListProperty<Flight> flights; public FlightModel() { FlightModel model = this; flights = new SimpleListProperty<>(); flights.addListener(new ListChangeListener<Flight>() { @Override public void onChanged(Change<? extends Flight> c) { while (c.next()) { if (c.wasAdded()) { c.getAddedSubList().stream().forEach(item -> item.setModel(model)); } else if (c.wasRemoved()) { c.getRemoved().stream().forEach(item -> item.setModel(null)); } } } }); } public ObservableList<Flight> getFlights() { return flights.get(); } public ListProperty<Flight> flightsProperty() { return flights; } public void setFlights(ObservableList<Flight> flights) { this.flights.set(flights); } }
UTF-8
Java
1,194
java
FlightModel.java
Java
[]
null
[]
package org.teamyeah.cheapaviasales; import javafx.beans.property.ListProperty; import javafx.beans.property.SimpleListProperty; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; public class FlightModel { private ListProperty<Flight> flights; public FlightModel() { FlightModel model = this; flights = new SimpleListProperty<>(); flights.addListener(new ListChangeListener<Flight>() { @Override public void onChanged(Change<? extends Flight> c) { while (c.next()) { if (c.wasAdded()) { c.getAddedSubList().stream().forEach(item -> item.setModel(model)); } else if (c.wasRemoved()) { c.getRemoved().stream().forEach(item -> item.setModel(null)); } } } }); } public ObservableList<Flight> getFlights() { return flights.get(); } public ListProperty<Flight> flightsProperty() { return flights; } public void setFlights(ObservableList<Flight> flights) { this.flights.set(flights); } }
1,194
0.590452
0.590452
40
28.85
23.883625
91
false
false
0
0
0
0
0
0
0.35
false
false
13