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
174c320622f7baa7b4cc7c8406e603e5cc91a57b
7,473,243,125,666
04b0086552fad6a6f207ccb3223962acffbd16cd
/expressui-core/src/main/java/com/expressui/core/view/form/ResultsConnectedEntityForm.java
0a8727a4c6560a66b43a246c52910fb213261fcf
[]
no_license
iamsowmyan/expressui-framework
https://github.com/iamsowmyan/expressui-framework
1673664036569062109729b63a6e1ec6bb1c8864
354fce9d66b314fdaca75e1b1de3575721e812a4
refs/heads/master
2020-12-06T19:09:40.955000
2012-08-18T08:40:13
2012-08-18T08:40:13
43,866,663
1
0
null
true
2015-10-08T06:14:41
2015-10-08T06:14:41
2014-08-31T08:45:52
2013-03-09T05:01:23
3,115
0
0
0
null
null
null
/* * Copyright (c) 2012 Brown Bag Consulting. * This file is part of the ExpressUI project. * Author: Juan Osuna * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License Version 3 * as published by the Free Software Foundation with the addition of the * following permission added to Section 15 as permitted in Section 7(a): * FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY * Brown Bag Consulting, Brown Bag Consulting DISCLAIMS THE WARRANTY OF * NON INFRINGEMENT OF THIRD PARTY RIGHTS. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License. * * You can be released from the requirements of the license by purchasing * a commercial license. Buying such a license is mandatory as soon as you * develop commercial activities involving the ExpressUI software without * disclosing the source code of your own applications. These activities * include: offering paid services to customers as an ASP, providing * services from a web application, shipping ExpressUI with a closed * source product. * * For more information, please contact Brown Bag Consulting at this * address: juan@brownbagconsulting.com. */ package com.expressui.core.view.form; import com.expressui.core.util.MethodDelegate; import com.expressui.core.util.StringUtil; import com.expressui.core.view.results.WalkableResults; import com.vaadin.terminal.ThemeResource; import com.vaadin.ui.*; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.Set; /** * An entity form connected to results, allowing user to walk through the current * results using next or previous buttons. * * @param <T> type of entity in the entity form and results */ public class ResultsConnectedEntityForm<T> extends CustomComponent { private EntityForm<T> entityForm; private WalkableResults results; private Set<MethodDelegate> walkListeners = new LinkedHashSet<MethodDelegate>(); public ResultsConnectedEntityForm(EntityForm<T> entityForm, WalkableResults results) { this.entityForm = entityForm; this.results = results; initialize(); } private void initialize() { setCompositionRoot(createNavigationFormLayout()); setSizeUndefined(); } private HorizontalLayout createNavigationFormLayout() { HorizontalLayout navigationFormLayout = new HorizontalLayout(); String id = StringUtil.generateDebugId("e", this, navigationFormLayout, "navigationFormLayout"); navigationFormLayout.setDebugId(id); navigationFormLayout.setSizeUndefined(); VerticalLayout previousButtonLayout = new VerticalLayout(); id = StringUtil.generateDebugId("e", this, previousButtonLayout, "previousButtonLayout"); previousButtonLayout.setDebugId(id); previousButtonLayout.setSizeUndefined(); previousButtonLayout.setMargin(false); previousButtonLayout.setSpacing(false); Label spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML); spaceLabel.setSizeUndefined(); previousButtonLayout.addComponent(spaceLabel); Button previousButton = new Button(null, this, "previousItem"); previousButton.setDescription(entityForm.uiMessageSource.getToolTip("entityForm.previous.toolTip")); previousButton.setSizeUndefined(); previousButton.addStyleName("borderless"); previousButton.setIcon(new ThemeResource("../expressui/icons/16/previous.png")); if (entityForm.getViewableToManyRelationships().size() == 0) { HorizontalLayout previousButtonHorizontalLayout = new HorizontalLayout(); id = StringUtil.generateDebugId("e", this, previousButtonHorizontalLayout, "previousButtonHorizontalLayout"); previousButtonHorizontalLayout.setDebugId(id); previousButtonHorizontalLayout.setSizeUndefined(); Label horizontalSpaceLabel = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML); horizontalSpaceLabel.setSizeUndefined(); previousButtonHorizontalLayout.addComponent(previousButton); previousButtonHorizontalLayout.addComponent(horizontalSpaceLabel); previousButtonLayout.addComponent(previousButtonHorizontalLayout); } else { previousButtonLayout.addComponent(previousButton); } navigationFormLayout.addComponent(previousButtonLayout); navigationFormLayout.setComponentAlignment(previousButtonLayout, Alignment.TOP_LEFT); navigationFormLayout.addComponent(entityForm); VerticalLayout nextButtonLayout = new VerticalLayout(); id = StringUtil.generateDebugId("e", this, nextButtonLayout, "nextButtonLayout"); nextButtonLayout.setDebugId(id); nextButtonLayout.setSizeUndefined(); nextButtonLayout.setMargin(false); nextButtonLayout.setSpacing(false); spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML); spaceLabel.setSizeUndefined(); previousButtonLayout.addComponent(spaceLabel); nextButtonLayout.addComponent(spaceLabel); Button nextButton = new Button(null, this, "nextItem"); nextButton.setDescription(entityForm.uiMessageSource.getToolTip("entityForm.next.toolTip")); nextButton.setSizeUndefined(); nextButton.addStyleName("borderless"); nextButton.setIcon(new ThemeResource("../expressui/icons/16/next.png")); HorizontalLayout nextButtonHorizontalLayout = new HorizontalLayout(); id = StringUtil.generateDebugId("e", this, nextButtonHorizontalLayout, "nextButtonHorizontalLayout"); nextButtonHorizontalLayout.setDebugId(id); nextButtonHorizontalLayout.setSizeUndefined(); Label horizontalSpaceLabel = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML); horizontalSpaceLabel.setSizeUndefined(); nextButtonHorizontalLayout.addComponent(horizontalSpaceLabel); nextButtonHorizontalLayout.addComponent(nextButton); nextButtonLayout.addComponent(nextButtonHorizontalLayout); navigationFormLayout.addComponent(nextButtonLayout); navigationFormLayout.setComponentAlignment(nextButtonLayout, Alignment.TOP_RIGHT); navigationFormLayout.setSpacing(false); navigationFormLayout.setMargin(false); return navigationFormLayout; } /** * Go to previous item in the current results */ public void previousItem() { results.editOrViewPreviousItem(); onWalk(); } /** * Go to next item in the current results */ public void nextItem() { results.editOrViewNextItem(); onWalk(); } /** * Gets the underlying entity form that is connected to results. */ public EntityForm<T> getEntityForm() { return entityForm; } private void onWalk() { for (MethodDelegate walkListener : walkListeners) { walkListener.execute(); } } /** * Adds a listener to detect any time user goes to next or previous records in results. * * @param target target object to invoke * @param methodName name of method to invoke */ public void addWalkListener(Object target, String methodName) { walkListeners.add(new MethodDelegate(target, methodName)); } /** * Removes all listeners defined on a given target. * * @param target target object from which to remove all listeners */ public void removeListeners(Object target) { Set<MethodDelegate> listenersToRemove; listenersToRemove = new HashSet<MethodDelegate>(); for (MethodDelegate walkListener : walkListeners) { if (walkListener.getTarget().equals(target)) { listenersToRemove.add(walkListener); } } for (MethodDelegate listener : listenersToRemove) { walkListeners.remove(listener); } } }
UTF-8
Java
8,625
java
ResultsConnectedEntityForm.java
Java
[ { "context": " file is part of the ExpressUI project.\n * Author: Juan Osuna\n *\n * This program is free software: you can redi", "end": 115, "score": 0.9998480081558228, "start": 105, "tag": "NAME", "value": "Juan Osuna" }, { "context": "e contact Brown Bag Consulting at this\n * address: juan@brownbagconsulting.com.\n */\n\npackage com.expressui.core.view.form;\n\nimpo", "end": 1785, "score": 0.9999268054962158, "start": 1758, "tag": "EMAIL", "value": "juan@brownbagconsulting.com" } ]
null
[]
/* * Copyright (c) 2012 Brown Bag Consulting. * This file is part of the ExpressUI project. * Author: <NAME> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License Version 3 * as published by the Free Software Foundation with the addition of the * following permission added to Section 15 as permitted in Section 7(a): * FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY * Brown Bag Consulting, Brown Bag Consulting DISCLAIMS THE WARRANTY OF * NON INFRINGEMENT OF THIRD PARTY RIGHTS. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License. * * You can be released from the requirements of the license by purchasing * a commercial license. Buying such a license is mandatory as soon as you * develop commercial activities involving the ExpressUI software without * disclosing the source code of your own applications. These activities * include: offering paid services to customers as an ASP, providing * services from a web application, shipping ExpressUI with a closed * source product. * * For more information, please contact Brown Bag Consulting at this * address: <EMAIL>. */ package com.expressui.core.view.form; import com.expressui.core.util.MethodDelegate; import com.expressui.core.util.StringUtil; import com.expressui.core.view.results.WalkableResults; import com.vaadin.terminal.ThemeResource; import com.vaadin.ui.*; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.Set; /** * An entity form connected to results, allowing user to walk through the current * results using next or previous buttons. * * @param <T> type of entity in the entity form and results */ public class ResultsConnectedEntityForm<T> extends CustomComponent { private EntityForm<T> entityForm; private WalkableResults results; private Set<MethodDelegate> walkListeners = new LinkedHashSet<MethodDelegate>(); public ResultsConnectedEntityForm(EntityForm<T> entityForm, WalkableResults results) { this.entityForm = entityForm; this.results = results; initialize(); } private void initialize() { setCompositionRoot(createNavigationFormLayout()); setSizeUndefined(); } private HorizontalLayout createNavigationFormLayout() { HorizontalLayout navigationFormLayout = new HorizontalLayout(); String id = StringUtil.generateDebugId("e", this, navigationFormLayout, "navigationFormLayout"); navigationFormLayout.setDebugId(id); navigationFormLayout.setSizeUndefined(); VerticalLayout previousButtonLayout = new VerticalLayout(); id = StringUtil.generateDebugId("e", this, previousButtonLayout, "previousButtonLayout"); previousButtonLayout.setDebugId(id); previousButtonLayout.setSizeUndefined(); previousButtonLayout.setMargin(false); previousButtonLayout.setSpacing(false); Label spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML); spaceLabel.setSizeUndefined(); previousButtonLayout.addComponent(spaceLabel); Button previousButton = new Button(null, this, "previousItem"); previousButton.setDescription(entityForm.uiMessageSource.getToolTip("entityForm.previous.toolTip")); previousButton.setSizeUndefined(); previousButton.addStyleName("borderless"); previousButton.setIcon(new ThemeResource("../expressui/icons/16/previous.png")); if (entityForm.getViewableToManyRelationships().size() == 0) { HorizontalLayout previousButtonHorizontalLayout = new HorizontalLayout(); id = StringUtil.generateDebugId("e", this, previousButtonHorizontalLayout, "previousButtonHorizontalLayout"); previousButtonHorizontalLayout.setDebugId(id); previousButtonHorizontalLayout.setSizeUndefined(); Label horizontalSpaceLabel = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML); horizontalSpaceLabel.setSizeUndefined(); previousButtonHorizontalLayout.addComponent(previousButton); previousButtonHorizontalLayout.addComponent(horizontalSpaceLabel); previousButtonLayout.addComponent(previousButtonHorizontalLayout); } else { previousButtonLayout.addComponent(previousButton); } navigationFormLayout.addComponent(previousButtonLayout); navigationFormLayout.setComponentAlignment(previousButtonLayout, Alignment.TOP_LEFT); navigationFormLayout.addComponent(entityForm); VerticalLayout nextButtonLayout = new VerticalLayout(); id = StringUtil.generateDebugId("e", this, nextButtonLayout, "nextButtonLayout"); nextButtonLayout.setDebugId(id); nextButtonLayout.setSizeUndefined(); nextButtonLayout.setMargin(false); nextButtonLayout.setSpacing(false); spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML); spaceLabel.setSizeUndefined(); previousButtonLayout.addComponent(spaceLabel); nextButtonLayout.addComponent(spaceLabel); Button nextButton = new Button(null, this, "nextItem"); nextButton.setDescription(entityForm.uiMessageSource.getToolTip("entityForm.next.toolTip")); nextButton.setSizeUndefined(); nextButton.addStyleName("borderless"); nextButton.setIcon(new ThemeResource("../expressui/icons/16/next.png")); HorizontalLayout nextButtonHorizontalLayout = new HorizontalLayout(); id = StringUtil.generateDebugId("e", this, nextButtonHorizontalLayout, "nextButtonHorizontalLayout"); nextButtonHorizontalLayout.setDebugId(id); nextButtonHorizontalLayout.setSizeUndefined(); Label horizontalSpaceLabel = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML); horizontalSpaceLabel.setSizeUndefined(); nextButtonHorizontalLayout.addComponent(horizontalSpaceLabel); nextButtonHorizontalLayout.addComponent(nextButton); nextButtonLayout.addComponent(nextButtonHorizontalLayout); navigationFormLayout.addComponent(nextButtonLayout); navigationFormLayout.setComponentAlignment(nextButtonLayout, Alignment.TOP_RIGHT); navigationFormLayout.setSpacing(false); navigationFormLayout.setMargin(false); return navigationFormLayout; } /** * Go to previous item in the current results */ public void previousItem() { results.editOrViewPreviousItem(); onWalk(); } /** * Go to next item in the current results */ public void nextItem() { results.editOrViewNextItem(); onWalk(); } /** * Gets the underlying entity form that is connected to results. */ public EntityForm<T> getEntityForm() { return entityForm; } private void onWalk() { for (MethodDelegate walkListener : walkListeners) { walkListener.execute(); } } /** * Adds a listener to detect any time user goes to next or previous records in results. * * @param target target object to invoke * @param methodName name of method to invoke */ public void addWalkListener(Object target, String methodName) { walkListeners.add(new MethodDelegate(target, methodName)); } /** * Removes all listeners defined on a given target. * * @param target target object from which to remove all listeners */ public void removeListeners(Object target) { Set<MethodDelegate> listenersToRemove; listenersToRemove = new HashSet<MethodDelegate>(); for (MethodDelegate walkListener : walkListeners) { if (walkListener.getTarget().equals(target)) { listenersToRemove.add(walkListener); } } for (MethodDelegate listener : listenersToRemove) { walkListeners.remove(listener); } } }
8,601
0.715246
0.713623
210
40.07143
31.005678
121
false
false
0
0
0
0
0
0
0.652381
false
false
11
fb07c4dae3da594d1a429aa28ed14848b5b7059c
21,655,225,158,633
612194d52611ca2c4163e8f4bebfb0cf4b5519dd
/Assignment_8/ReverseString.java
40385f21e51e196be10ad4754305cb074ee2a430
[]
no_license
patilaarti15/CorJava
https://github.com/patilaarti15/CorJava
a5354cdb476cfa4486ef786ad6a3fb6120ee3993
a04e2097de62a5a4980fba7347da2dc93f5d33c1
refs/heads/master
2023-02-20T16:41:27.133000
2021-01-24T06:54:54
2021-01-24T06:54:54
296,659,321
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pkg_52; import java.util.Scanner; public class ReverseString { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter the string for reverse it."); String inp = sc.nextLine(); String rev = ""; for(int i=input.length()-1; i>=0; i--) { rev = rev + input.charAt(i); } System.out.println(rev); } }
UTF-8
Java
452
java
ReverseString.java
Java
[]
null
[]
package pkg_52; import java.util.Scanner; public class ReverseString { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter the string for reverse it."); String inp = sc.nextLine(); String rev = ""; for(int i=input.length()-1; i>=0; i--) { rev = rev + input.charAt(i); } System.out.println(rev); } }
452
0.537611
0.528761
20
20.700001
20.176968
70
false
false
0
0
0
0
0
0
1.85
false
false
11
7501db5f5a29dcb75ae1ce55861a7252a5d43dbb
21,655,225,156,091
12f5da89ca8d6c7b1908e40a4fe236c732a39dc5
/Implementations/BIT.java
75ca4e56c4ed803ba3689fc7e5a55a67c63a2575
[]
no_license
gp28896/DSA
https://github.com/gp28896/DSA
be44058f7bb1093b85c85ecf537c9f0f8014b065
737afd4f50b56812b2f7b0d9b942d05cfcbc3d7f
refs/heads/main
2023-03-05T02:58:16.072000
2021-02-15T09:15:56
2021-02-15T09:15:56
339,017,276
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 binaryIndexedTree; /** * * @author Gaurav */ /* calculate prefix sum (one of the funtions) point update operations the operation or the funtion must be associative */ class BIT{ int bit[],a[],n=-1; BIT(int size){ this.bit=new int[size]; this.a=new int[size]; this.n=size; } void update(int index,int val){ for(;index<=this.n;index+=index & (-index)){ bit[index]+=val; } System.out.println("updated: "+ val+"at "+index); } int prefixSumUptoIndex(int index){//O(logn) int sum=0; for(;index>0;index-=index & (-index)){ sum+=bit[index]; } //System.out.println("updated: " +index); return sum; } public static void main(String args[]){ int arr[] = {-666 ,1, 3, 5, 7, 9, 11}; int n = arr.length; System.out.println(n); BIT binaryIndexedTree=new BIT(n); //start from index 1 or else infinite loop when performing index+=index & (-index) for(int i=1;i<n;i++)binaryIndexedTree.update(i,arr[i]); System.out.println(binaryIndexedTree.prefixSumUptoIndex(4)); for(int i=0;i<n;i++)System.out.println(binaryIndexedTree.bit[i]); } }
UTF-8
Java
1,353
java
BIT.java
Java
[ { "context": " */\npackage binaryIndexedTree;\n\n\n/**\n *\n * @author Gaurav\n */\n/*\ncalculate prefix sum (one of the funtions)", "end": 238, "score": 0.9993491172790527, "start": 232, "tag": "NAME", "value": "Gaurav" } ]
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 binaryIndexedTree; /** * * @author Gaurav */ /* calculate prefix sum (one of the funtions) point update operations the operation or the funtion must be associative */ class BIT{ int bit[],a[],n=-1; BIT(int size){ this.bit=new int[size]; this.a=new int[size]; this.n=size; } void update(int index,int val){ for(;index<=this.n;index+=index & (-index)){ bit[index]+=val; } System.out.println("updated: "+ val+"at "+index); } int prefixSumUptoIndex(int index){//O(logn) int sum=0; for(;index>0;index-=index & (-index)){ sum+=bit[index]; } //System.out.println("updated: " +index); return sum; } public static void main(String args[]){ int arr[] = {-666 ,1, 3, 5, 7, 9, 11}; int n = arr.length; System.out.println(n); BIT binaryIndexedTree=new BIT(n); //start from index 1 or else infinite loop when performing index+=index & (-index) for(int i=1;i<n;i++)binaryIndexedTree.update(i,arr[i]); System.out.println(binaryIndexedTree.prefixSumUptoIndex(4)); for(int i=0;i<n;i++)System.out.println(binaryIndexedTree.bit[i]); } }
1,353
0.628234
0.615669
53
24.547171
23.886971
90
false
false
0
0
0
0
0
0
1.528302
false
false
11
019ddd1ccb3cd5cfffec3c99067eed2a5f18699d
24,034,637,039,605
9bcd58ae2492e069b928ad02283ac42def0a2621
/src/main/java/com/sabina/textractor/converters/DocxConverter.java
036eac4aaccb9ba85fe7f087c2c32b9ed88d9dfa
[]
no_license
sabinadayanova/text-extractor
https://github.com/sabinadayanova/text-extractor
ab3cd0e03002289039c960e6a55ab90285734547
9de422649bae94aca8a88289cef868af2967de96
refs/heads/main
2023-05-01T18:56:21.063000
2021-05-21T01:39:22
2021-05-21T01:39:22
342,017,104
0
0
null
false
2021-05-21T01:30:35
2021-02-24T19:49:10
2021-05-20T23:48:24
2021-05-21T01:30:35
250
0
0
3
Java
false
false
package com.sabina.textractor.converters; import com.sabina.textractor.exceptions.ExtractionException; import java.io.IOException; import java.io.InputStream; import org.apache.poi.xwpf.extractor.XWPFWordExtractor; import org.apache.poi.xwpf.usermodel.XWPFDocument; public class DocxConverter implements Converter { @Override public String convert(InputStream is) { try { XWPFDocument document = new XWPFDocument(is); XWPFWordExtractor wordExtractor = new XWPFWordExtractor(document); String text = wordExtractor.getText(); wordExtractor.close(); return text; } catch (IOException e) { throw new ExtractionException("IOException occurred when extracting text from DOCX file", e); } } }
UTF-8
Java
743
java
DocxConverter.java
Java
[]
null
[]
package com.sabina.textractor.converters; import com.sabina.textractor.exceptions.ExtractionException; import java.io.IOException; import java.io.InputStream; import org.apache.poi.xwpf.extractor.XWPFWordExtractor; import org.apache.poi.xwpf.usermodel.XWPFDocument; public class DocxConverter implements Converter { @Override public String convert(InputStream is) { try { XWPFDocument document = new XWPFDocument(is); XWPFWordExtractor wordExtractor = new XWPFWordExtractor(document); String text = wordExtractor.getText(); wordExtractor.close(); return text; } catch (IOException e) { throw new ExtractionException("IOException occurred when extracting text from DOCX file", e); } } }
743
0.753701
0.753701
23
31.304348
25.972284
99
false
false
0
0
0
0
0
0
0.565217
false
false
11
368f554f265c3db87d27fd4424275ff0dce55b70
25,297,357,412,796
b310ab09e4ea9d5024ffe53dffc7073c01439823
/AndroidAnimations/src/com/example/androidanimations/SlidingFragments/TextFrag.java
8a2fbaed3f9846e8c92f35cc8646c9619f15eaba
[]
no_license
jockmahon/androidWorkSpace
https://github.com/jockmahon/androidWorkSpace
69d5cad25db79c36011b5eddbc1c55e8a01ed2bb
4b532879359b9b1acef6bdc9a14eefc76682f3f6
refs/heads/master
2016-09-11T03:15:27.748000
2014-09-18T12:44:50
2014-09-18T12:44:50
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.androidanimations.SlidingFragments; import android.animation.Animator; import android.animation.AnimatorInflater; import android.animation.AnimatorListenerAdapter; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.example.androidanimations.R; public class TextFrag extends Fragment { View.OnClickListener clickListener; OnTextFragmentAnimationEndListener mListener; @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState ) { View view = inflater.inflate( R.layout.text_fragment, container, false ); view.setOnClickListener( clickListener ); return view; } public void setClickListener( View.OnClickListener clickListener ) { this.clickListener = clickListener; } @Override public Animator onCreateAnimator( int transit, boolean enter, int nextAnim ) { int id = enter ? R.animator.slide_fragment_in : R.animator.slide_fragment_out; final Animator anim = AnimatorInflater.loadAnimator( getActivity(), id ); if( enter ) { anim.addListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd( Animator animation ) { mListener.onAnimationEnd(); } } ); } return anim; } public void setOnTextFragmentAnimationEnd( OnTextFragmentAnimationEndListener listener ) { mListener = listener; } }
UTF-8
Java
1,460
java
TextFrag.java
Java
[]
null
[]
package com.example.androidanimations.SlidingFragments; import android.animation.Animator; import android.animation.AnimatorInflater; import android.animation.AnimatorListenerAdapter; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.example.androidanimations.R; public class TextFrag extends Fragment { View.OnClickListener clickListener; OnTextFragmentAnimationEndListener mListener; @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState ) { View view = inflater.inflate( R.layout.text_fragment, container, false ); view.setOnClickListener( clickListener ); return view; } public void setClickListener( View.OnClickListener clickListener ) { this.clickListener = clickListener; } @Override public Animator onCreateAnimator( int transit, boolean enter, int nextAnim ) { int id = enter ? R.animator.slide_fragment_in : R.animator.slide_fragment_out; final Animator anim = AnimatorInflater.loadAnimator( getActivity(), id ); if( enter ) { anim.addListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd( Animator animation ) { mListener.onAnimationEnd(); } } ); } return anim; } public void setOnTextFragmentAnimationEnd( OnTextFragmentAnimationEndListener listener ) { mListener = listener; } }
1,460
0.772603
0.772603
59
23.745762
26.89439
100
false
false
0
0
0
0
0
0
1.644068
false
false
11
364de5cb7637d71cc8848817ee37781983a6f1e9
20,031,727,528,231
c81694aa1ceb674e938d3283e81c576f1067bb13
/shop-admin/admin-server/admin-application/src/main/java/vn/smart/admin/application/WebApplication.java
d7c521fc5f7f4a3633d6dbb6caaf2de99761607e
[]
no_license
anhdang094/sieuthimega
https://github.com/anhdang094/sieuthimega
a1b8272c0bce3f0de7b7a2c9cf62b998629f56b3
13d5d2d0444a87891b7a1d020c228b69778fb196
refs/heads/main
2023-03-06T13:07:37.652000
2021-02-17T04:24:34
2021-02-17T04:24:34
339,597,716
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package vn.smart.admin.application; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.PropertySource; @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class}) @PropertySource(value = {"classpath:config.properties"}) public class WebApplication { private static Logger logger = LoggerFactory.getLogger(WebApplication.class); private static ApplicationContext ctx; public static ApplicationContext getCtx() { return ctx; } public static void main(String[] args) { ctx = SpringApplication.run(WebApplication.class, args); } }
UTF-8
Java
1,151
java
WebApplication.java
Java
[]
null
[]
package vn.smart.admin.application; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.PropertySource; @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class}) @PropertySource(value = {"classpath:config.properties"}) public class WebApplication { private static Logger logger = LoggerFactory.getLogger(WebApplication.class); private static ApplicationContext ctx; public static ApplicationContext getCtx() { return ctx; } public static void main(String[] args) { ctx = SpringApplication.run(WebApplication.class, args); } }
1,151
0.834057
0.83232
30
37.366665
29.588831
97
false
false
0
0
0
0
0
0
0.566667
false
false
11
937179db4977040b75c10bbbc25738dc906da484
15,522,011,850,066
d0cce056e8313ff5ae86a616855f19495993cbf8
/app/src/main/java/com/suraku/trafficalarm/models/Address.java
dff03e226f11857ede7a49e5a991c3ccedda1a23
[]
no_license
Suraku/trafficalarm
https://github.com/Suraku/trafficalarm
62cf9c10dc5086b85dcd2c098f743036c3db589c
ca6a3da4d5ed87db574d512193def00efa8e079b
refs/heads/master
2020-03-24T05:52:00.127000
2018-07-26T23:49:29
2018-07-26T23:49:29
142,505,177
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.suraku.trafficalarm.models; import android.content.Context; import android.databinding.BaseObservable; import android.databinding.Bindable; import com.suraku.dev.sqlite.SQLiteModelMetadata; import com.suraku.trafficalarm.Helper; import com.suraku.trafficalarm.data.storage.DataStorageFactory; import com.suraku.trafficalarm.data.storage.ILocalStorageProvider; import java.util.Calendar; import java.util.UUID; /** * Model */ public class Address extends BaseObservable implements Comparable<Address> { /* * Default empty constructor for type instantiation */ public Address() { this.addressPK = UUID.randomUUID(); this.addressLineOne = ""; this.addressLineTwo = ""; this.city = ""; this.county = ""; this.postcode = ""; this.createdDate = Calendar.getInstance(); } public Address(User user) { this(); this.setUser(user); } @Override public int compareTo(Address item) { return this.toString().compareTo(item.toString()); } private User user; @SQLiteModelMetadata private UUID addressPK; @SQLiteModelMetadata private String addressLineOne; @SQLiteModelMetadata private String addressLineTwo; @SQLiteModelMetadata private String city; @SQLiteModelMetadata private String county; @SQLiteModelMetadata private String postcode; @SQLiteModelMetadata private Calendar createdDate; @SQLiteModelMetadata private UUID userFK; // ~~ Getters & Setters ~~ \\ public UUID getAddressPK() { return addressPK; } public void setAddressPK(UUID val) { this.addressPK = val; } public UUID getUserFK() { return userFK; } public void setUserFK(UUID val) { this.userFK = val; } @Bindable public String getAddressLineOne() { return addressLineOne; } public void setAddressLineOne(String val) { this.addressLineOne = val; } @Bindable public String getAddressLineTwo() { return addressLineTwo; } public void setAddressLineTwo(String val) { this.addressLineTwo = val; } @Bindable public String getCity() { return city; } public void setCity(String val) { this.city = val; } @Bindable public String getCounty() { return county; } public void setCounty(String val) { this.county = val; } @Bindable public String getPostcode() { return postcode; } public void setPostcode(String val) { this.postcode = val; } public Calendar getCreatedDate() { return this.createdDate; } public void setCreatedDate(Calendar val) { this.createdDate = val; } // ~~ Extras ~~ \\ public User getUser() { return this.user; } public void setUser(User model) { this.user = model; this.setUserFK(model.getUserPK()); } public int saveChanges(Context context) { if (Helper.isNullOrEmpty(this.toString())) { return -2; // Because -1 already used for if update method fails } ILocalStorageProvider<Address> repository = DataStorageFactory.getProvider(context, Address.class); return repository.update(this); } public static boolean isEqual(Address item1, Address item2) { if (item1 == null && item2 == null) { return true; } return (item1 != null && item2 != null && item1.getAddressPK().equals(item2.addressPK)); } @Override public String toString() { return _toStringSeparatedBy(", "); } public String toStringUrl() { return _toStringSeparatedBy(" "); } private String _toStringSeparatedBy(String separator) { String[] addressParts = new String[] { addressLineOne, addressLineTwo, city, county, postcode }; String ret = ""; for (int i = 0; i < addressParts.length; i++) { ret += (!Helper.isNullOrEmpty(addressParts[i]) ? addressParts[i] + separator : ""); } if (ret.endsWith(", ")) { ret = ret.substring(0, ret.length() - 2); } return ret; } }
UTF-8
Java
4,091
java
Address.java
Java
[]
null
[]
package com.suraku.trafficalarm.models; import android.content.Context; import android.databinding.BaseObservable; import android.databinding.Bindable; import com.suraku.dev.sqlite.SQLiteModelMetadata; import com.suraku.trafficalarm.Helper; import com.suraku.trafficalarm.data.storage.DataStorageFactory; import com.suraku.trafficalarm.data.storage.ILocalStorageProvider; import java.util.Calendar; import java.util.UUID; /** * Model */ public class Address extends BaseObservable implements Comparable<Address> { /* * Default empty constructor for type instantiation */ public Address() { this.addressPK = UUID.randomUUID(); this.addressLineOne = ""; this.addressLineTwo = ""; this.city = ""; this.county = ""; this.postcode = ""; this.createdDate = Calendar.getInstance(); } public Address(User user) { this(); this.setUser(user); } @Override public int compareTo(Address item) { return this.toString().compareTo(item.toString()); } private User user; @SQLiteModelMetadata private UUID addressPK; @SQLiteModelMetadata private String addressLineOne; @SQLiteModelMetadata private String addressLineTwo; @SQLiteModelMetadata private String city; @SQLiteModelMetadata private String county; @SQLiteModelMetadata private String postcode; @SQLiteModelMetadata private Calendar createdDate; @SQLiteModelMetadata private UUID userFK; // ~~ Getters & Setters ~~ \\ public UUID getAddressPK() { return addressPK; } public void setAddressPK(UUID val) { this.addressPK = val; } public UUID getUserFK() { return userFK; } public void setUserFK(UUID val) { this.userFK = val; } @Bindable public String getAddressLineOne() { return addressLineOne; } public void setAddressLineOne(String val) { this.addressLineOne = val; } @Bindable public String getAddressLineTwo() { return addressLineTwo; } public void setAddressLineTwo(String val) { this.addressLineTwo = val; } @Bindable public String getCity() { return city; } public void setCity(String val) { this.city = val; } @Bindable public String getCounty() { return county; } public void setCounty(String val) { this.county = val; } @Bindable public String getPostcode() { return postcode; } public void setPostcode(String val) { this.postcode = val; } public Calendar getCreatedDate() { return this.createdDate; } public void setCreatedDate(Calendar val) { this.createdDate = val; } // ~~ Extras ~~ \\ public User getUser() { return this.user; } public void setUser(User model) { this.user = model; this.setUserFK(model.getUserPK()); } public int saveChanges(Context context) { if (Helper.isNullOrEmpty(this.toString())) { return -2; // Because -1 already used for if update method fails } ILocalStorageProvider<Address> repository = DataStorageFactory.getProvider(context, Address.class); return repository.update(this); } public static boolean isEqual(Address item1, Address item2) { if (item1 == null && item2 == null) { return true; } return (item1 != null && item2 != null && item1.getAddressPK().equals(item2.addressPK)); } @Override public String toString() { return _toStringSeparatedBy(", "); } public String toStringUrl() { return _toStringSeparatedBy(" "); } private String _toStringSeparatedBy(String separator) { String[] addressParts = new String[] { addressLineOne, addressLineTwo, city, county, postcode }; String ret = ""; for (int i = 0; i < addressParts.length; i++) { ret += (!Helper.isNullOrEmpty(addressParts[i]) ? addressParts[i] + separator : ""); } if (ret.endsWith(", ")) { ret = ret.substring(0, ret.length() - 2); } return ret; } }
4,091
0.647519
0.644341
155
25.393549
25.366093
107
false
false
0
0
0
0
0
0
0.458065
false
false
11
d52fd407eae1ce17b09888d7fbdbfcabe0abcb32
30,442,728,248,062
aebf4b14cd6978ec6d7c84795c33b21ffdbe264c
/News/android端/News/src/com/news/data/news/DataProvider.java
b3f9c7a1905a6f9eb218f6068dd0d25954a91c08
[]
no_license
Bonsen/2015-Government-News
https://github.com/Bonsen/2015-Government-News
25b42d2fb23c37db737891d38b407ef6d6af655f
c384a3e03738a1def94c84724cfd8c9f914c4232
refs/heads/master
2020-09-28T07:00:34.157000
2016-10-27T07:59:38
2016-10-27T07:59:38
65,964,117
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.news.data.news; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.json.JSONException; import android.content.Context; import android.content.SharedPreferences; import android.database.Cursor; import com.news.DB.NewsDetailDB; import com.news.code.NewsCode; import com.news.content.bean.NewsContentBean; import com.news.http.HttpUtils; import com.news.json.JsonToObject; import com.news.json.ObjectToJson; public class DataProvider { private static NewsDetailDB dop; // 根据点击不同栏目获取不同新闻列表 public static List<Map<String, Object>> GetNewsListByColumn( String jsonStirng) throws JSONException { return JsonToObject.GetNewsByColumn(jsonStirng); } // 管理员根据点击不同栏目获取不同新闻列表 public static List<Map<String, Object>> GetNewsListByColumnAmin( String jsonStirng) throws JSONException { return JsonToObject.GetNewsByColumn(jsonStirng); } // 添加新闻 public static String AddNews(NewsContentBean newsContentBean) throws JSONException { return HttpUtils.AddNews(NewsCode.URL, ObjectToJson.AddNews(newsContentBean)); } // 删除新闻 public static String DeleteNews(int id) throws JSONException { return HttpUtils.DeleteNews(NewsCode.URL, ObjectToJson.DeleteNews(id)); } // 更新新闻 public static String UpdateNews(NewsContentBean newsContentBean) throws JSONException { return HttpUtils.AddNews(NewsCode.URL, ObjectToJson.UpdateNews(newsContentBean)); } // 搜索新闻 public static List<Map<String, Object>> SearchNews(String jsonString) throws JSONException { return JsonToObject.GetNewsByColumn(jsonString); } }
GB18030
Java
1,774
java
DataProvider.java
Java
[]
null
[]
package com.news.data.news; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.json.JSONException; import android.content.Context; import android.content.SharedPreferences; import android.database.Cursor; import com.news.DB.NewsDetailDB; import com.news.code.NewsCode; import com.news.content.bean.NewsContentBean; import com.news.http.HttpUtils; import com.news.json.JsonToObject; import com.news.json.ObjectToJson; public class DataProvider { private static NewsDetailDB dop; // 根据点击不同栏目获取不同新闻列表 public static List<Map<String, Object>> GetNewsListByColumn( String jsonStirng) throws JSONException { return JsonToObject.GetNewsByColumn(jsonStirng); } // 管理员根据点击不同栏目获取不同新闻列表 public static List<Map<String, Object>> GetNewsListByColumnAmin( String jsonStirng) throws JSONException { return JsonToObject.GetNewsByColumn(jsonStirng); } // 添加新闻 public static String AddNews(NewsContentBean newsContentBean) throws JSONException { return HttpUtils.AddNews(NewsCode.URL, ObjectToJson.AddNews(newsContentBean)); } // 删除新闻 public static String DeleteNews(int id) throws JSONException { return HttpUtils.DeleteNews(NewsCode.URL, ObjectToJson.DeleteNews(id)); } // 更新新闻 public static String UpdateNews(NewsContentBean newsContentBean) throws JSONException { return HttpUtils.AddNews(NewsCode.URL, ObjectToJson.UpdateNews(newsContentBean)); } // 搜索新闻 public static List<Map<String, Object>> SearchNews(String jsonString) throws JSONException { return JsonToObject.GetNewsByColumn(jsonString); } }
1,774
0.761962
0.761962
61
25.409836
21.804178
73
false
false
0
0
0
0
0
0
1.344262
false
false
11
6fed85bf85fcc2d418848bbbf32bdb85b8dad053
36,764,920,054,514
b2f051bf501ccf6bcba2b2f3f8e513550c79fa98
/app/src/main/java/com/aliang/imitatewechat/ui/base/BaseActivity.java
d2feaa174866a0c3d46bdcd0271e746aff33b2b4
[]
no_license
MR-ALiang/ImitateWeChat
https://github.com/MR-ALiang/ImitateWeChat
09dddbfdaeba6d920a1c9bd7376a211ce5f8b55b
de06e2cebb8c3e03fbf64502eb8cc5d3cd644505
refs/heads/master
2020-03-13T12:56:19.826000
2018-04-27T09:59:32
2018-04-27T09:59:32
131,125,065
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.aliang.imitatewechat.ui.base; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import com.aliang.imitatewechat.app.MyApp; import butterknife.ButterKnife; /** * Created by AlvinMoon on 2018/4/26. */ public abstract class BaseActivity<V,T extends BasePresenter<V>> extends AppCompatActivity { protected T mPresenter; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); MyApp.activities.add(this); init(); /**判断是否使用MVP模式**/ mPresenter = createPresenter(); if(mPresenter != null){ //之后所有的子类都要实现对应的View接口 mPresenter.attachView((V) this); } /**子类不再需要设置布局ID,也不再需要使用ButterKnife.bind()**/ setContentView(provideContentViewId()); ButterKnife.bind(this); initView(); initData(); initListener(); } protected void initView() { } protected void initData() { } protected void initListener() { } /**得到当前界面的布局文件id(由子类实现)**/ protected abstract int provideContentViewId(); /**用于创建Presenter和判断是否使用MVP模式(由子类实现)**/ protected abstract T createPresenter(); //在setContentView()调用之前调用,可以设置WindowFeature(如:this.requestWindowFeature(Window.FEATURE_NO_TITLE);) protected void init() { } @Override protected void onDestroy() { super.onDestroy(); if(mPresenter != null){ mPresenter.detachView(); } } public void jumpToActivity(Class activity) { Intent intent = new Intent(this, activity); startActivity(intent); } }
UTF-8
Java
1,924
java
BaseActivity.java
Java
[ { "context": "import butterknife.ButterKnife;\n\n/**\n * Created by AlvinMoon on 2018/4/26.\n */\n\npublic abstract class BaseActi", "end": 298, "score": 0.9981741905212402, "start": 289, "tag": "USERNAME", "value": "AlvinMoon" } ]
null
[]
package com.aliang.imitatewechat.ui.base; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import com.aliang.imitatewechat.app.MyApp; import butterknife.ButterKnife; /** * Created by AlvinMoon on 2018/4/26. */ public abstract class BaseActivity<V,T extends BasePresenter<V>> extends AppCompatActivity { protected T mPresenter; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); MyApp.activities.add(this); init(); /**判断是否使用MVP模式**/ mPresenter = createPresenter(); if(mPresenter != null){ //之后所有的子类都要实现对应的View接口 mPresenter.attachView((V) this); } /**子类不再需要设置布局ID,也不再需要使用ButterKnife.bind()**/ setContentView(provideContentViewId()); ButterKnife.bind(this); initView(); initData(); initListener(); } protected void initView() { } protected void initData() { } protected void initListener() { } /**得到当前界面的布局文件id(由子类实现)**/ protected abstract int provideContentViewId(); /**用于创建Presenter和判断是否使用MVP模式(由子类实现)**/ protected abstract T createPresenter(); //在setContentView()调用之前调用,可以设置WindowFeature(如:this.requestWindowFeature(Window.FEATURE_NO_TITLE);) protected void init() { } @Override protected void onDestroy() { super.onDestroy(); if(mPresenter != null){ mPresenter.detachView(); } } public void jumpToActivity(Class activity) { Intent intent = new Intent(this, activity); startActivity(intent); } }
1,924
0.652523
0.647936
74
22.567568
21.960087
102
false
false
0
0
0
0
0
0
0.364865
false
false
11
a1c3d232e94c6e8eac4a86f6d993f2a6deb02f7d
1,932,735,318,531
4f25de6341b8941c96a52d82103cf8ad5c0c9e26
/src/main/java/com/ics/demo/models/MockAppointment.java
0fc5650a66f2cabc5874556a7906ddcfe0ca7c33
[]
no_license
AdrianKarani/DistributedObjectsCAT
https://github.com/AdrianKarani/DistributedObjectsCAT
c38d1e24f917b69913cc5b9385e4a67db7dda586
98019ebc9b71f1e5160ddfa61933ef5a0ff44440
refs/heads/master
2020-08-01T17:27:44.032000
2019-09-26T10:26:56
2019-09-26T10:26:56
211,060,131
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ics.demo.models; public class MockAppointment { private int BlinDateid; private int studentid; private String reason; public int getBlinDateid() { return BlinDateid; } public void setBlinDateid(int blinDateid) { BlinDateid = blinDateid; } public int getStudentid() { return studentid; } public void setStudentid(int studentid) { this.studentid = studentid; } public String getReason() { return reason; } public void setReason(String reason) { this.reason = reason; } }
UTF-8
Java
612
java
MockAppointment.java
Java
[]
null
[]
package com.ics.demo.models; public class MockAppointment { private int BlinDateid; private int studentid; private String reason; public int getBlinDateid() { return BlinDateid; } public void setBlinDateid(int blinDateid) { BlinDateid = blinDateid; } public int getStudentid() { return studentid; } public void setStudentid(int studentid) { this.studentid = studentid; } public String getReason() { return reason; } public void setReason(String reason) { this.reason = reason; } }
612
0.609477
0.609477
32
17.65625
15.571628
47
false
false
0
0
0
0
0
0
0.3125
false
false
11
10ed11dd78516db9a01c84ef8cdefaa6a2cb3990
19,963,008,035,078
b410147af2985c1d051cc950021b54a3dec4c217
/GameEngine/src/CurrentGameMemory/ActiveThings.java
c731e28101dc48c1d4aa2c6224d920ff1cfa43c4
[]
no_license
onurkulak/Syracuse-group-27
https://github.com/onurkulak/Syracuse-group-27
992f0b2effd56099247a18e4acf93e7f0633bb85
f4252d8968ce47bca9efec8a919a755ac62bb764
refs/heads/master
2021-01-19T03:52:18.020000
2016-12-24T21:27:45
2016-12-24T21:27:45
69,697,557
0
1
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 CurrentGameMemory; import gameengine.GameElementClasses.DiplomaticOffer; import gameengine.GameElementClasses.General; import gameengine.GameElementClasses.LandUnit; import gameengine.GameElementClasses.MercenaryArmy; import gameengine.GameElementClasses.Mission; import gameengine.GameElementClasses.Ship; import gameengine.GameElementClasses.TradeOffer; import gameengine.GameElementClasses.TradeShipment; import java.util.ArrayList; /** * * @author onur */ public class ActiveThings { private final ArrayList<Mission> missions; private final ArrayList<TradeOffer> tradeOffers; private final ArrayList<TradeShipment> shipments; private final ArrayList<General> availableGenerals; private final ArrayList<MercenaryArmy> availableMercenaries; private final ArrayList<LandUnit> landQueue; private final ArrayList<Integer> landQueueTimes; private final ArrayList<Ship> shipQueue; private final ArrayList<Integer> shipQueueTimes; private DiplomaticOffer diplomaticOffer; public ActiveThings(){ this.missions = new ArrayList(); this.tradeOffers = new ArrayList(); this.shipments = new ArrayList(); this.availableGenerals = new ArrayList(); this.availableMercenaries = new ArrayList(); this.landQueue = new ArrayList(); this.landQueueTimes = new ArrayList(); this.shipQueue = new ArrayList(); this.shipQueueTimes = new ArrayList(); diplomaticOffer=null; } public ArrayList<Mission> getMissions() { return missions; } public ArrayList<TradeOffer> getTradeOffers() { return tradeOffers; } public ArrayList<TradeShipment> getShipments() { return shipments; } public ArrayList<General> getAvailableGenerals() { return availableGenerals; } public ArrayList<MercenaryArmy> getAvailableMercenaries() { return availableMercenaries; } public ArrayList<LandUnit> getLandQueue() { return landQueue; } public ArrayList<Integer> getLandQueueTimes() { return landQueueTimes; } public ArrayList<Ship> getShipQueue() { return shipQueue; } public ArrayList<Integer> getShipQueueTimes() { return shipQueueTimes; } public DiplomaticOffer getDiplomaticOffer() { return diplomaticOffer; } public void setDiplomaticOffer(DiplomaticOffer diplomaticOffer) { this.diplomaticOffer = diplomaticOffer; } }
UTF-8
Java
2,789
java
ActiveThings.java
Java
[ { "context": "port java.util.ArrayList;\r\n\r\n\r\n/**\r\n *\r\n * @author onur\r\n */\r\npublic class ActiveThings {\r\n private fi", "end": 672, "score": 0.9985706806182861, "start": 668, "tag": "USERNAME", "value": "onur" } ]
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 CurrentGameMemory; import gameengine.GameElementClasses.DiplomaticOffer; import gameengine.GameElementClasses.General; import gameengine.GameElementClasses.LandUnit; import gameengine.GameElementClasses.MercenaryArmy; import gameengine.GameElementClasses.Mission; import gameengine.GameElementClasses.Ship; import gameengine.GameElementClasses.TradeOffer; import gameengine.GameElementClasses.TradeShipment; import java.util.ArrayList; /** * * @author onur */ public class ActiveThings { private final ArrayList<Mission> missions; private final ArrayList<TradeOffer> tradeOffers; private final ArrayList<TradeShipment> shipments; private final ArrayList<General> availableGenerals; private final ArrayList<MercenaryArmy> availableMercenaries; private final ArrayList<LandUnit> landQueue; private final ArrayList<Integer> landQueueTimes; private final ArrayList<Ship> shipQueue; private final ArrayList<Integer> shipQueueTimes; private DiplomaticOffer diplomaticOffer; public ActiveThings(){ this.missions = new ArrayList(); this.tradeOffers = new ArrayList(); this.shipments = new ArrayList(); this.availableGenerals = new ArrayList(); this.availableMercenaries = new ArrayList(); this.landQueue = new ArrayList(); this.landQueueTimes = new ArrayList(); this.shipQueue = new ArrayList(); this.shipQueueTimes = new ArrayList(); diplomaticOffer=null; } public ArrayList<Mission> getMissions() { return missions; } public ArrayList<TradeOffer> getTradeOffers() { return tradeOffers; } public ArrayList<TradeShipment> getShipments() { return shipments; } public ArrayList<General> getAvailableGenerals() { return availableGenerals; } public ArrayList<MercenaryArmy> getAvailableMercenaries() { return availableMercenaries; } public ArrayList<LandUnit> getLandQueue() { return landQueue; } public ArrayList<Integer> getLandQueueTimes() { return landQueueTimes; } public ArrayList<Ship> getShipQueue() { return shipQueue; } public ArrayList<Integer> getShipQueueTimes() { return shipQueueTimes; } public DiplomaticOffer getDiplomaticOffer() { return diplomaticOffer; } public void setDiplomaticOffer(DiplomaticOffer diplomaticOffer) { this.diplomaticOffer = diplomaticOffer; } }
2,789
0.694514
0.694514
92
28.315218
22.134436
79
false
false
0
0
0
0
0
0
0.478261
false
false
11
149957eebc4791b505c893ba4e0abc57a6266c6d
21,182,778,774,563
aea729864e9ccfab51a94215c3eb952bc03f5f10
/src/main/java/com/globalsight/ling/tm3/core/TM3Tu.java
679141e350ffc4265eef75333a138549dca5e91d
[ "Apache-2.0" ]
permissive
tingley/tm3
https://github.com/tingley/tm3
7810e3268ab7021f10fa33f122e89b12995b2c71
d0a3b8f9a944e6fe514f32c9d0a87ba083049e74
refs/heads/master
2016-09-06T18:39:24.932000
2013-07-30T16:54:13
2013-07-30T16:54:47
4,791,418
6
0
null
false
2013-07-13T03:03:22
2012-06-26T05:51:09
2013-07-13T03:03:22
2013-07-13T03:03:22
172
null
2
3
Java
null
null
package com.globalsight.ling.tm3.core; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; /** * Representation of a single TU/segment. * <p> * Note that all changes to a TU, its TUVs, and any of its * dependent data structures are considered transient and are not * persisted unless a subsequent call to {@link TM3Tm#modifyTu(TM3Tu, TM3Event)} * is made. */ public class TM3Tu<T extends TM3Data> { private Long id; private TM3Tuv<T> sourceTuv; private List<TM3Tuv<T>> targetTuvs = new ArrayList<TM3Tuv<T>>(); private TM3Tm<T> tm; private TuStorage<T> storage; private Map<TM3Attribute, Object> attributes = new HashMap<TM3Attribute, Object>(); TM3Tu() { } public Long getId() { return id; } void setId(Long id) { this.id = id; } public TM3Tu(TM3Tm<T> tm, TuStorage<T> storage, TM3Tuv<T> sourceTuv, Map<TM3Attribute, Object> attributes) { this.tm = tm; this.storage = storage; this.sourceTuv = sourceTuv; for (Map.Entry<TM3Attribute, Object> e : attributes.entrySet()) { e.getKey().getValueType().checkValue( e.getValue(), e.getKey().getName()); } this.attributes = attributes; sourceTuv.setTu(this); } // Storage layer ctor TM3Tu(TM3Tm<T> tm, TuStorage<T> storage, TM3Tuv<T> sourceTuv, List<TM3Tuv<T>> targetTuvs, Map<TM3Attribute, Object> attributes) { this.tm = tm; this.storage = storage; this.sourceTuv = sourceTuv; this.targetTuvs = targetTuvs; this.attributes = attributes; sourceTuv.setTu(this); } public TM3Tuv<T> getSourceTuv() { return sourceTuv; } void setSourceTuv(TM3Tuv<T> sourceTuv) { this.sourceTuv = sourceTuv; sourceTuv.setTu(this); } /** * Get all target TUVs contained in this TU. * @return set of TUVs */ public List<TM3Tuv<T>> getTargetTuvs() { return targetTuvs; } /** * Return a TUV for the specified locale. * @param locale desired locale * @return TUV, or null if no TUV exists for the locale */ public List<TM3Tuv<T>> getLocaleTuvs(TM3Locale locale) { if (sourceTuv.getLocale().equals(locale)) { return Collections.singletonList(sourceTuv); } List<TM3Tuv<T>> localeTuvs = new ArrayList<TM3Tuv<T>>(); for (TM3Tuv<T> tuv : targetTuvs) { if (tuv.getLocale().equals(locale)) { localeTuvs.add(tuv); } } return localeTuvs; } /** * Return all TUV in this TU, including both source and * targets. */ public List<TM3Tuv<T>> getAllTuv() { List<TM3Tuv<T>> allTuv = new ArrayList<TM3Tuv<T>>(); allTuv.add(getSourceTuv()); allTuv.addAll(getTargetTuvs()); return allTuv; } /** * Remove and return all TUV for the specified locale. * @param locale */ public void removeTargetTuvByLocale(TM3Locale locale) { for (Iterator<TM3Tuv<T>> it = targetTuvs.iterator(); it.hasNext(); ) { TM3Tuv<T> tgt = it.next(); if (tgt.getLocale().equals(locale)) { it.remove(); } } } /** * Remove a specific TUV. * @param locale locale of the TUV to remove * @param content content of the TUV to remove * @return true if the the TUV was found and removed, false * if it the specified TUV does not belong to this TU */ public boolean removeTargetTuv(TM3Locale locale, T content) { Iterator<TM3Tuv<T>> it = targetTuvs.iterator(); while (it.hasNext()) { TM3Tuv<T> tgt = it.next(); if (tgt.getLocale().equals(locale) && tgt.getContent().equals(content)) { it.remove(); return true; } } return false; } /** * Remove all target TUV. */ public void removeTargetTuvs() { this.targetTuvs.clear(); } TuStorage<T> getStorage() { return storage; } void setStorage(TuStorage<T> storage) { this.storage = storage; } TM3Tm<T> getTm() { return tm; } void setTm(TM3Tm<T> tm) { this.tm = tm; } /** * Add a new target TUV, unless an identical TUV already exists. * @param locale * @param content * @param event * @return Returns the new TUV, or null if an identical TUV already exists. */ public TM3Tuv<T> addTargetTuv(TM3Locale locale, T content, TM3Event event) { if (event == null) { throw new IllegalArgumentException("event can not be null"); } // Don't save identical (in both locale and content) targets for (TM3Tuv<T> tuv : targetTuvs) { if (tuv.getLocale().equals(locale) && tuv.getContent().equals(content)) { return null; } } TM3Tuv<T> tuv = new TM3Tuv<T>(locale, content, event); targetTuvs.add(tuv); tuv.setTu(this); return tuv; } public TM3EventLog getHistory() { throw new UnsupportedOperationException(); // TODO } /** * Return attributes for this TU. Only attributes for which a value is set * will be returned. */ public Map<TM3Attribute, Object> getAttributes() { return attributes; } /** * Return the value for a single attribute. * @param attribute */ public Object getAttribute(TM3Attribute attribute) { return attributes.get(attribute); } /** * Set the value for a given attribute on this TU. * @param attribute * @param value new attribute value. A value of null will remove the * attribute from this TU. */ public void setAttribute(TM3Attribute attribute, Object value) { attribute.getValueType().checkValue(value, attribute.getName()); attributes.put(attribute, value); } @SuppressWarnings("unchecked") @Override public boolean equals(Object o) { if (o == null || !(o instanceof TM3Tu)) { return false; } TM3Tu tu = (TM3Tu)o; if (getId() == null && tu.getId() == null) { return this == tu; } if (getId() != null && tu.getId() != null) { return getId().equals(tu.getId()); } return false; } @Override public int hashCode() { if (getId() == null) { return System.identityHashCode(this); } return getId().hashCode(); } }
UTF-8
Java
6,918
java
TM3Tu.java
Java
[]
null
[]
package com.globalsight.ling.tm3.core; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; /** * Representation of a single TU/segment. * <p> * Note that all changes to a TU, its TUVs, and any of its * dependent data structures are considered transient and are not * persisted unless a subsequent call to {@link TM3Tm#modifyTu(TM3Tu, TM3Event)} * is made. */ public class TM3Tu<T extends TM3Data> { private Long id; private TM3Tuv<T> sourceTuv; private List<TM3Tuv<T>> targetTuvs = new ArrayList<TM3Tuv<T>>(); private TM3Tm<T> tm; private TuStorage<T> storage; private Map<TM3Attribute, Object> attributes = new HashMap<TM3Attribute, Object>(); TM3Tu() { } public Long getId() { return id; } void setId(Long id) { this.id = id; } public TM3Tu(TM3Tm<T> tm, TuStorage<T> storage, TM3Tuv<T> sourceTuv, Map<TM3Attribute, Object> attributes) { this.tm = tm; this.storage = storage; this.sourceTuv = sourceTuv; for (Map.Entry<TM3Attribute, Object> e : attributes.entrySet()) { e.getKey().getValueType().checkValue( e.getValue(), e.getKey().getName()); } this.attributes = attributes; sourceTuv.setTu(this); } // Storage layer ctor TM3Tu(TM3Tm<T> tm, TuStorage<T> storage, TM3Tuv<T> sourceTuv, List<TM3Tuv<T>> targetTuvs, Map<TM3Attribute, Object> attributes) { this.tm = tm; this.storage = storage; this.sourceTuv = sourceTuv; this.targetTuvs = targetTuvs; this.attributes = attributes; sourceTuv.setTu(this); } public TM3Tuv<T> getSourceTuv() { return sourceTuv; } void setSourceTuv(TM3Tuv<T> sourceTuv) { this.sourceTuv = sourceTuv; sourceTuv.setTu(this); } /** * Get all target TUVs contained in this TU. * @return set of TUVs */ public List<TM3Tuv<T>> getTargetTuvs() { return targetTuvs; } /** * Return a TUV for the specified locale. * @param locale desired locale * @return TUV, or null if no TUV exists for the locale */ public List<TM3Tuv<T>> getLocaleTuvs(TM3Locale locale) { if (sourceTuv.getLocale().equals(locale)) { return Collections.singletonList(sourceTuv); } List<TM3Tuv<T>> localeTuvs = new ArrayList<TM3Tuv<T>>(); for (TM3Tuv<T> tuv : targetTuvs) { if (tuv.getLocale().equals(locale)) { localeTuvs.add(tuv); } } return localeTuvs; } /** * Return all TUV in this TU, including both source and * targets. */ public List<TM3Tuv<T>> getAllTuv() { List<TM3Tuv<T>> allTuv = new ArrayList<TM3Tuv<T>>(); allTuv.add(getSourceTuv()); allTuv.addAll(getTargetTuvs()); return allTuv; } /** * Remove and return all TUV for the specified locale. * @param locale */ public void removeTargetTuvByLocale(TM3Locale locale) { for (Iterator<TM3Tuv<T>> it = targetTuvs.iterator(); it.hasNext(); ) { TM3Tuv<T> tgt = it.next(); if (tgt.getLocale().equals(locale)) { it.remove(); } } } /** * Remove a specific TUV. * @param locale locale of the TUV to remove * @param content content of the TUV to remove * @return true if the the TUV was found and removed, false * if it the specified TUV does not belong to this TU */ public boolean removeTargetTuv(TM3Locale locale, T content) { Iterator<TM3Tuv<T>> it = targetTuvs.iterator(); while (it.hasNext()) { TM3Tuv<T> tgt = it.next(); if (tgt.getLocale().equals(locale) && tgt.getContent().equals(content)) { it.remove(); return true; } } return false; } /** * Remove all target TUV. */ public void removeTargetTuvs() { this.targetTuvs.clear(); } TuStorage<T> getStorage() { return storage; } void setStorage(TuStorage<T> storage) { this.storage = storage; } TM3Tm<T> getTm() { return tm; } void setTm(TM3Tm<T> tm) { this.tm = tm; } /** * Add a new target TUV, unless an identical TUV already exists. * @param locale * @param content * @param event * @return Returns the new TUV, or null if an identical TUV already exists. */ public TM3Tuv<T> addTargetTuv(TM3Locale locale, T content, TM3Event event) { if (event == null) { throw new IllegalArgumentException("event can not be null"); } // Don't save identical (in both locale and content) targets for (TM3Tuv<T> tuv : targetTuvs) { if (tuv.getLocale().equals(locale) && tuv.getContent().equals(content)) { return null; } } TM3Tuv<T> tuv = new TM3Tuv<T>(locale, content, event); targetTuvs.add(tuv); tuv.setTu(this); return tuv; } public TM3EventLog getHistory() { throw new UnsupportedOperationException(); // TODO } /** * Return attributes for this TU. Only attributes for which a value is set * will be returned. */ public Map<TM3Attribute, Object> getAttributes() { return attributes; } /** * Return the value for a single attribute. * @param attribute */ public Object getAttribute(TM3Attribute attribute) { return attributes.get(attribute); } /** * Set the value for a given attribute on this TU. * @param attribute * @param value new attribute value. A value of null will remove the * attribute from this TU. */ public void setAttribute(TM3Attribute attribute, Object value) { attribute.getValueType().checkValue(value, attribute.getName()); attributes.put(attribute, value); } @SuppressWarnings("unchecked") @Override public boolean equals(Object o) { if (o == null || !(o instanceof TM3Tu)) { return false; } TM3Tu tu = (TM3Tu)o; if (getId() == null && tu.getId() == null) { return this == tu; } if (getId() != null && tu.getId() != null) { return getId().equals(tu.getId()); } return false; } @Override public int hashCode() { if (getId() == null) { return System.identityHashCode(this); } return getId().hashCode(); } }
6,918
0.568372
0.560422
243
27.469135
22.029022
85
false
false
0
0
0
0
0
0
0.427984
false
false
11
9612026d49a43ec192b66827b3110cfa531c01f7
1,211,180,838,399
fb5eddea7bd9225cdd9c7ac7c2a9c2bcd537d7cc
/example/factory/SecureFactory.java
2dfa44cb13a0454c539616e7eb7bb01092fb7d84
[]
no_license
quanghuy192/DesignPattern
https://github.com/quanghuy192/DesignPattern
416559df41764790b6e85b4acb49727b2cd53dfb
848d01e257e0ed3b5e6f3de8606da053b3aef19a
refs/heads/master
2021-05-28T09:45:05.207000
2015-02-11T19:25:16
2015-02-11T19:25:16
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package factory; public class SecureFactory extends ConnectionFactory { @Override public Connection createConnection(String type) { // TODO Auto-generated method stub if(type.equals("Oracle")){ return new SecureOracleConnection(); }else if(type.equals("SQL serner")){ return new SecureSQLServerConnection(); }else { return new SecureMySqlConnection(); } } }
UTF-8
Java
404
java
SecureFactory.java
Java
[]
null
[]
package factory; public class SecureFactory extends ConnectionFactory { @Override public Connection createConnection(String type) { // TODO Auto-generated method stub if(type.equals("Oracle")){ return new SecureOracleConnection(); }else if(type.equals("SQL serner")){ return new SecureSQLServerConnection(); }else { return new SecureMySqlConnection(); } } }
404
0.695545
0.695545
18
20.444445
19.149187
54
false
false
0
0
0
0
0
0
1.555556
false
false
11
cb9eae8d4b5d813a5b1bb291dc0ce240c685dced
19,576,460,972,264
957ae271f572123520c54d42e804c856bf59e815
/Mobile/android/Tablet/src/nz/co/mcom/tablet/payments/popmoney/PopmoneyEndPointListItem.java
a4196a3e4a12d5a94dd180b1ae4197c37d38a785
[]
no_license
lchong0412/TrunkApp
https://github.com/lchong0412/TrunkApp
4c405e4254f8c19882195f3add6e6ff0bdfcab8c
9735704cb54aea7e1f1d41a760ad531428e308b8
refs/heads/master
2016-05-26T03:31:36.984000
2015-02-16T22:55:57
2015-02-16T22:55:57
30,893,198
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package nz.co.mcom.tablet.payments.popmoney; /** * @class PopmoneyEndPointListItem * @brief Container for the endpoints of a {@link nz.co.mcom.service.modules.payments.models.Contact} */ public class PopmoneyEndPointListItem { private String mPopmoneyEndpoint; private String mPopmoneyEndpointType; public PopmoneyEndPointListItem(String popmoneyEndpointType, String popmoneyEndpoint) { mPopmoneyEndpointType = popmoneyEndpointType; mPopmoneyEndpoint = popmoneyEndpoint; } public String getPopmoneyEndpoint() { return mPopmoneyEndpoint; } public void setPopmoneyEndpoint(String popmoneyEndpoint) { mPopmoneyEndpoint = popmoneyEndpoint; } public String getmPopmoneyEndpointType() { return mPopmoneyEndpointType; } public void setmPopmoneyEndpointType(String mPopmoneyEndpointType) { this.mPopmoneyEndpointType = mPopmoneyEndpointType; } }
UTF-8
Java
972
java
PopmoneyEndPointListItem.java
Java
[]
null
[]
package nz.co.mcom.tablet.payments.popmoney; /** * @class PopmoneyEndPointListItem * @brief Container for the endpoints of a {@link nz.co.mcom.service.modules.payments.models.Contact} */ public class PopmoneyEndPointListItem { private String mPopmoneyEndpoint; private String mPopmoneyEndpointType; public PopmoneyEndPointListItem(String popmoneyEndpointType, String popmoneyEndpoint) { mPopmoneyEndpointType = popmoneyEndpointType; mPopmoneyEndpoint = popmoneyEndpoint; } public String getPopmoneyEndpoint() { return mPopmoneyEndpoint; } public void setPopmoneyEndpoint(String popmoneyEndpoint) { mPopmoneyEndpoint = popmoneyEndpoint; } public String getmPopmoneyEndpointType() { return mPopmoneyEndpointType; } public void setmPopmoneyEndpointType(String mPopmoneyEndpointType) { this.mPopmoneyEndpointType = mPopmoneyEndpointType; } }
972
0.72428
0.72428
31
29.419355
28.44437
101
false
false
0
0
0
0
0
0
0.322581
false
false
11
85af3ba6bc81066016ee79de91c2b08234cb5c25
25,872,882,993,570
623d034ed7340ba84d328479b49c01aecfc3f6f5
/integration/src/main/java/net/firejack/platform/api/process/domain/ProcessField.java
892eae15c8f1e9aad86c3839dd882fa082e8f88a
[ "Apache-2.0" ]
permissive
junhuac/Firejack-Platform
https://github.com/junhuac/Firejack-Platform
011e990b0999daba2254886c76224a0a8890dc98
90bb686d8ba1f2055782a279d8236d438c0d0bc5
refs/heads/master
2020-03-29T07:28:41.032000
2014-03-05T14:42:10
2014-03-05T14:42:10
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package net.firejack.platform.api.process.domain; import net.firejack.platform.api.registry.domain.Entity; import net.firejack.platform.api.registry.field.Field; import net.firejack.platform.core.annotation.Property; import net.firejack.platform.core.domain.BaseEntity; import net.firejack.platform.core.validation.annotation.NotBlank; import net.firejack.platform.core.validation.annotation.NotNull; import net.firejack.platform.core.validation.constraint.RuleSource; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; @Component @Scope(BeanDefinition.SCOPE_PROTOTYPE) @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) @RuleSource("OPF.process.ProcessField") public class ProcessField extends BaseEntity { private static final long serialVersionUID = 1239798256177992840L; @Property private String name; @Property private Field field; @Property private Boolean global; @Property private String valueType; @Property private Integer orderPosition; @Property private Entity registryNodeType; @Property private String format; @NotBlank public String getName() { return name; } public void setName(String name) { this.name = name; } public Field getField() { return field; } public void setField(Field field) { this.field = field; } public Boolean getGlobal() { return global; } public void setGlobal(Boolean global) { this.global = global; } public String getValueType() { return valueType; } public void setValueType(String valueType) { this.valueType = valueType; } @NotNull public Integer getOrderPosition() { return orderPosition; } public void setOrderPosition(Integer orderPosition) { this.orderPosition = orderPosition; } public Entity getRegistryNodeType() { return registryNodeType; } public void setRegistryNodeType(Entity registryNodeType) { this.registryNodeType = registryNodeType; } public String getFormat() { return format; } public void setFormat(String format) { this.format = format; } }
UTF-8
Java
3,408
java
ProcessField.java
Java
[]
null
[]
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package net.firejack.platform.api.process.domain; import net.firejack.platform.api.registry.domain.Entity; import net.firejack.platform.api.registry.field.Field; import net.firejack.platform.core.annotation.Property; import net.firejack.platform.core.domain.BaseEntity; import net.firejack.platform.core.validation.annotation.NotBlank; import net.firejack.platform.core.validation.annotation.NotNull; import net.firejack.platform.core.validation.constraint.RuleSource; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; @Component @Scope(BeanDefinition.SCOPE_PROTOTYPE) @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) @RuleSource("OPF.process.ProcessField") public class ProcessField extends BaseEntity { private static final long serialVersionUID = 1239798256177992840L; @Property private String name; @Property private Field field; @Property private Boolean global; @Property private String valueType; @Property private Integer orderPosition; @Property private Entity registryNodeType; @Property private String format; @NotBlank public String getName() { return name; } public void setName(String name) { this.name = name; } public Field getField() { return field; } public void setField(Field field) { this.field = field; } public Boolean getGlobal() { return global; } public void setGlobal(Boolean global) { this.global = global; } public String getValueType() { return valueType; } public void setValueType(String valueType) { this.valueType = valueType; } @NotNull public Integer getOrderPosition() { return orderPosition; } public void setOrderPosition(Integer orderPosition) { this.orderPosition = orderPosition; } public Entity getRegistryNodeType() { return registryNodeType; } public void setRegistryNodeType(Entity registryNodeType) { this.registryNodeType = registryNodeType; } public String getFormat() { return format; } public void setFormat(String format) { this.format = format; } }
3,408
0.699237
0.692488
118
26.881355
22.328506
70
false
false
0
0
0
0
0
0
0.347458
false
false
11
a46ce8d652394e85be52ae2f3c19734f33bbf18f
4,638,564,711,778
1aa19ac1a80198652396d4baa1adbd0b39fa268b
/Ligi/app/src/main/java/com/nialine/ligi/mvp/presenters/BasePresenter.java
14614b22b0514ee75e84b84b533b32af830ada6b
[]
no_license
ckagiri/LigiPredictorAndroid
https://github.com/ckagiri/LigiPredictorAndroid
2fe7271bb12c50133cd71b570d342d7ce5cfeb01
ae702a868a9fd7ff6ac3d83a44c85edbfa8b436b
refs/heads/master
2019-01-22T21:18:33.768000
2017-03-31T09:39:49
2017-03-31T09:39:49
85,741,659
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.nialine.ligi.mvp.presenters; import com.nialine.ligi.mvp.views.View; import rx.Subscription; import rx.subscriptions.CompositeSubscription; /** * Created by Wagana on 3/30/2017. */ public abstract class BasePresenter<T extends View> implements Presenter<T> { protected T mView; @Override public void attachView(T view) { checkView(view); mView = view; onViewAttached(); } @Override public void detachView() { onViewDetached(); mView = null; } private void checkView(T view) { if (view == null) new IllegalArgumentException("view is null!"); } protected abstract void onViewAttached(); protected abstract void onViewDetached(); }
UTF-8
Java
744
java
BasePresenter.java
Java
[ { "context": "riptions.CompositeSubscription;\n\n/**\n * Created by Wagana on 3/30/2017.\n */\n\npublic abstract class BasePres", "end": 179, "score": 0.9652808308601379, "start": 173, "tag": "NAME", "value": "Wagana" } ]
null
[]
package com.nialine.ligi.mvp.presenters; import com.nialine.ligi.mvp.views.View; import rx.Subscription; import rx.subscriptions.CompositeSubscription; /** * Created by Wagana on 3/30/2017. */ public abstract class BasePresenter<T extends View> implements Presenter<T> { protected T mView; @Override public void attachView(T view) { checkView(view); mView = view; onViewAttached(); } @Override public void detachView() { onViewDetached(); mView = null; } private void checkView(T view) { if (view == null) new IllegalArgumentException("view is null!"); } protected abstract void onViewAttached(); protected abstract void onViewDetached(); }
744
0.662634
0.653226
35
20.257143
20.590349
77
false
false
0
0
0
0
0
0
0.371429
false
false
11
8be7bdc49d97d5dd9d2803c7e516e3a2b7c68075
26,594,437,559,122
c2cb903225bf07d2a4a99ba54ad5eeba710f3c6b
/SocietySpringBoot/src/main/java/microservices/DBUserVehicles.java
7a1b14bbb82dffd2f7c8f99d1b454a71244f843c
[]
no_license
PriyankaAbu/SocietyManagement
https://github.com/PriyankaAbu/SocietyManagement
fd6df5a2041d4f1d29837b07fb6eab80e0b0336b
ee69c0bc5c05d2773d830d88e1a33a001b6ab262
refs/heads/main
2023-08-13T03:23:09.536000
2021-09-30T11:09:00
2021-09-30T11:09:00
412,023,681
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package microservices; import java.util.List; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.query.Query; import hibernate.Houses; import hibernate.Societies; import hibernate.UserVehicles; import hibernate.Users; public class DBUserVehicles { public boolean createUserVehicles(Session s, UserVehicles user_vehicles,Users user,Societies society,Houses house) { Transaction t = s.beginTransaction(); try { user_vehicles.setUser(user); user_vehicles.setSociety(society); user_vehicles.setHouse(house); s.save(user_vehicles); t.commit(); return true; } catch(Exception e) { t.rollback(); e.printStackTrace(); } return false; } public boolean deleteUserVehicles(Session s, UserVehicles user_vehicles) { Transaction t = s.beginTransaction(); try { user_vehicles.setSociety(null); user_vehicles.setHouse(null); s.update(user_vehicles); s.delete(user_vehicles); t.commit(); return true; } catch(Exception e) { t.rollback(); e.printStackTrace(); } return false; } public UserVehicles readUserVehicles(Session s, int vehicles_id) { Transaction t = s.beginTransaction(); try { Query q=s.createQuery("from soc_user_vehicles as a where a.id=:c"); q.setParameter("c", vehicles_id); List<UserVehicles> list=q.list(); t.commit(); UserVehicles user_vehicles=null; for(UserVehicles u:list) { user_vehicles=u; } return user_vehicles; } catch(Exception e) { t.rollback(); e.printStackTrace(); } return null; } public List<UserVehicles> readUserVehiclesByUser(Session s, int user_id ) { Transaction t = s.beginTransaction(); try { Query q=s.createQuery("from soc_user_vehicles as a where a.user.id=:c"); q.setParameter("c", user_id); List<UserVehicles> list=q.list(); t.commit(); return list; } catch(Exception e) { t.rollback(); e.printStackTrace(); } return null; } public List<UserVehicles> readUserVehiclesByHouse(Session s, int house_id ) { Transaction t = s.beginTransaction(); try { Query q=s.createQuery("from soc_user_vehicles as a where a.house.id=:c"); q.setParameter("c", house_id); List<UserVehicles> list=q.list(); t.commit(); return list; } catch(Exception e) { t.rollback(); e.printStackTrace(); } return null; } }
UTF-8
Java
2,384
java
DBUserVehicles.java
Java
[]
null
[]
package microservices; import java.util.List; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.query.Query; import hibernate.Houses; import hibernate.Societies; import hibernate.UserVehicles; import hibernate.Users; public class DBUserVehicles { public boolean createUserVehicles(Session s, UserVehicles user_vehicles,Users user,Societies society,Houses house) { Transaction t = s.beginTransaction(); try { user_vehicles.setUser(user); user_vehicles.setSociety(society); user_vehicles.setHouse(house); s.save(user_vehicles); t.commit(); return true; } catch(Exception e) { t.rollback(); e.printStackTrace(); } return false; } public boolean deleteUserVehicles(Session s, UserVehicles user_vehicles) { Transaction t = s.beginTransaction(); try { user_vehicles.setSociety(null); user_vehicles.setHouse(null); s.update(user_vehicles); s.delete(user_vehicles); t.commit(); return true; } catch(Exception e) { t.rollback(); e.printStackTrace(); } return false; } public UserVehicles readUserVehicles(Session s, int vehicles_id) { Transaction t = s.beginTransaction(); try { Query q=s.createQuery("from soc_user_vehicles as a where a.id=:c"); q.setParameter("c", vehicles_id); List<UserVehicles> list=q.list(); t.commit(); UserVehicles user_vehicles=null; for(UserVehicles u:list) { user_vehicles=u; } return user_vehicles; } catch(Exception e) { t.rollback(); e.printStackTrace(); } return null; } public List<UserVehicles> readUserVehiclesByUser(Session s, int user_id ) { Transaction t = s.beginTransaction(); try { Query q=s.createQuery("from soc_user_vehicles as a where a.user.id=:c"); q.setParameter("c", user_id); List<UserVehicles> list=q.list(); t.commit(); return list; } catch(Exception e) { t.rollback(); e.printStackTrace(); } return null; } public List<UserVehicles> readUserVehiclesByHouse(Session s, int house_id ) { Transaction t = s.beginTransaction(); try { Query q=s.createQuery("from soc_user_vehicles as a where a.house.id=:c"); q.setParameter("c", house_id); List<UserVehicles> list=q.list(); t.commit(); return list; } catch(Exception e) { t.rollback(); e.printStackTrace(); } return null; } }
2,384
0.680369
0.680369
117
19.376068
20.391773
115
false
false
0
0
0
0
0
0
2.521368
false
false
11
4f5a563868ddc5640d7272664d0e696194e60d69
34,059,090,659,458
1183ab3c27a7fb3d925d0628f8b80d195a81f3d5
/rotate_matrix/Solution.java
d7a8b140d2825d2a46e1010886c8adb24c8cebe5
[]
no_license
ccy0013/Interview_Questions
https://github.com/ccy0013/Interview_Questions
a1c62ce67396a11f134d75121a92d787ee1614f5
561951705b2588cda6c36a11578ccb70c29224a7
refs/heads/master
2020-06-04T22:23:49.913000
2015-11-24T00:34:43
2015-11-24T00:34:43
37,608,892
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/************************************************************************* > File Name: Solution.java > Author: Chengyu Cui > Mail: ccy604080969@gmail.com > Created Time: Sun Nov 22 15:33:43 2015 ************************************************************************/ import java.util.Arrays; public class Solution { public static int[][] rotateMatrix(int[][] matrix, int dir) { if(matrix==null || matrix[0].length==0) return matrix; int m = matrix.length, n = matrix[0].length; int[][] result = new int[n][m]; for(int i=0; i<m; i++) { for(int j=0; j<n; j++) { if(dir==1) result[j][m-i-1] = matrix[i][j]; else result[n-j-1][i] = matrix[i][j]; } } return result; } public static void main(String[] args) { int[][] matrix = { {1, 2, 3}, {4, 5, 6} }; System.out.println("[Original Matrix]"); for(int i=0; i<matrix.length; i++) System.out.println(Arrays.toString(matrix[i])); System.out.println("[After rotate 90 degree to right]"); int[][] result = rotateMatrix(matrix, 1); for(int i=0; i<result.length; i++) { System.out.println(Arrays.toString(result[i])); } System.out.println("[After rotate 90 degree to left]"); result = rotateMatrix(matrix, 0); for(int i=0; i<result.length; i++) { System.out.println(Arrays.toString(result[i])); } } }
UTF-8
Java
1,343
java
Solution.java
Java
[ { "context": "*****\n > File Name: Solution.java\n > Author: Chengyu Cui\n > Mail: ccy604080969@gmail.com \n > Created", "end": 131, "score": 0.9998160600662231, "start": 120, "tag": "NAME", "value": "Chengyu Cui" }, { "context": "olution.java\n > Author: Chengyu Cui\n > Mail: ccy604080969@gmail.com \n > Created Time: Sun Nov 22 15:33:43 2015\n **", "end": 166, "score": 0.9999315142631531, "start": 144, "tag": "EMAIL", "value": "ccy604080969@gmail.com" } ]
null
[]
/************************************************************************* > File Name: Solution.java > Author: <NAME> > Mail: <EMAIL> > Created Time: Sun Nov 22 15:33:43 2015 ************************************************************************/ import java.util.Arrays; public class Solution { public static int[][] rotateMatrix(int[][] matrix, int dir) { if(matrix==null || matrix[0].length==0) return matrix; int m = matrix.length, n = matrix[0].length; int[][] result = new int[n][m]; for(int i=0; i<m; i++) { for(int j=0; j<n; j++) { if(dir==1) result[j][m-i-1] = matrix[i][j]; else result[n-j-1][i] = matrix[i][j]; } } return result; } public static void main(String[] args) { int[][] matrix = { {1, 2, 3}, {4, 5, 6} }; System.out.println("[Original Matrix]"); for(int i=0; i<matrix.length; i++) System.out.println(Arrays.toString(matrix[i])); System.out.println("[After rotate 90 degree to right]"); int[][] result = rotateMatrix(matrix, 1); for(int i=0; i<result.length; i++) { System.out.println(Arrays.toString(result[i])); } System.out.println("[After rotate 90 degree to left]"); result = rotateMatrix(matrix, 0); for(int i=0; i<result.length; i++) { System.out.println(Arrays.toString(result[i])); } } }
1,323
0.538347
0.505585
49
26.408163
22.389791
74
false
false
0
0
0
0
0
0
2.204082
false
false
11
0943f75af0e00f3cdc9e70a839f61b796c3530a4
24,369,644,466,949
99d97f8a9b56dde44054161328cbce8f670c952a
/MyRunnable.java
b8a4b1480398db9da7641ff18c16031c53b003da
[]
no_license
divprnc/my_java_prgms
https://github.com/divprnc/my_java_prgms
e407654625e6f06017d1eaf91cdf475612eec89c
002b19b869c0a8ed1f0de7f64f9123e6e1934da3
refs/heads/master
2020-05-29T17:13:05.568000
2019-05-29T17:37:01
2019-05-29T17:37:01
189,268,540
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
class MyRunnable implements Runnable { public void run() { System.out.println("From run"); } public static void main(String[] args) { MyRunnable mr = new MyRunnable(); Thread th = new Thread(mr); th.run(); System.out.println("From main"); } }
UTF-8
Java
276
java
MyRunnable.java
Java
[]
null
[]
class MyRunnable implements Runnable { public void run() { System.out.println("From run"); } public static void main(String[] args) { MyRunnable mr = new MyRunnable(); Thread th = new Thread(mr); th.run(); System.out.println("From main"); } }
276
0.623188
0.623188
14
17.714285
15.640737
40
false
false
0
0
0
0
0
0
1.5
false
false
11
0243a934dcf300046ca05a11eccaf0f4432de6e1
27,015,344,358,890
f8688e8381213974d093fc4b50b25c4bc0ed9384
/src/ObjectType.java
26a580fbaaa7543298ef36dc300de76ec8caba49
[]
no_license
karolkotkowski/MKCompiler
https://github.com/karolkotkowski/MKCompiler
f56bebeca282171b4227cd9c85f1616ac4cb0425
cbee6c134727384c73feabf873b5c54a2cb7ec31
refs/heads/master
2022-08-26T10:53:14.131000
2020-05-20T07:05:38
2020-05-20T07:05:38
257,803,722
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public enum ObjectType { VARIABLE, CONSTANT, ARRAY, ARRAY_ELEMENT, FUNCTION; }
UTF-8
Java
83
java
ObjectType.java
Java
[]
null
[]
public enum ObjectType { VARIABLE, CONSTANT, ARRAY, ARRAY_ELEMENT, FUNCTION; }
83
0.73494
0.73494
3
26.666666
22.125902
55
false
false
0
0
0
0
0
0
1.666667
false
false
11
5e240b3f44b8704da83a4662b058c9d7578e400a
14,310,831,070,487
8f179c939683e3b82d841e5f896a43e6f818880b
/common/src/main/java/net/thenightwolf/dm/common/model/message/Conversation.java
c2628be35f6bad0f6020988a2232ee41ed467625
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
wang9090980/DroidMessage
https://github.com/wang9090980/DroidMessage
334a6f261ef0df17414bdd01cb3d7272e7f250be
d6aa2c4033d7cfac6b03d3b8e9fa566f62e25911
refs/heads/master
2021-01-20T15:30:52.020000
2016-12-13T04:07:19
2016-12-13T04:07:19
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (c) 2016 Jordan Knott * License file can be found in the root directory (LICENSE.txt) * * For the project DroidMessage, which can be found at: www.github.com/paradox-software/droidmessage * */ package net.thenightwolf.dm.common.model.message; import java.util.ArrayList; public class Conversation { private int conversationId; private String address; private boolean hasUnread; private long lastMessageDate; private Message lastMessage; public Conversation(int conversationId, String address, boolean hasUnread, long lastMessageDate, Message lastMessage) { this.conversationId = conversationId; this.address = address; this.hasUnread = hasUnread; this.lastMessageDate = lastMessageDate; this.lastMessage = lastMessage; } public int getConversationId() { return conversationId; } public String getAddress() { return address; } public boolean isHasUnread() { return hasUnread; } public long getLastMessageDate() { return lastMessageDate; } public Message getLastMessage() { return lastMessage; } }
UTF-8
Java
1,174
java
Conversation.java
Java
[ { "context": "/*\n * Copyright (c) 2016 Jordan Knott\n * License file can be found in the root director", "end": 37, "score": 0.9998591542243958, "start": 25, "tag": "NAME", "value": "Jordan Knott" }, { "context": "oidMessage, which can be found at: www.github.com/paradox-software/droidmessage\n *\n */\n\npackage net.thenightwolf.dm.", "end": 193, "score": 0.9936640858650208, "start": 177, "tag": "USERNAME", "value": "paradox-software" } ]
null
[]
/* * Copyright (c) 2016 <NAME> * License file can be found in the root directory (LICENSE.txt) * * For the project DroidMessage, which can be found at: www.github.com/paradox-software/droidmessage * */ package net.thenightwolf.dm.common.model.message; import java.util.ArrayList; public class Conversation { private int conversationId; private String address; private boolean hasUnread; private long lastMessageDate; private Message lastMessage; public Conversation(int conversationId, String address, boolean hasUnread, long lastMessageDate, Message lastMessage) { this.conversationId = conversationId; this.address = address; this.hasUnread = hasUnread; this.lastMessageDate = lastMessageDate; this.lastMessage = lastMessage; } public int getConversationId() { return conversationId; } public String getAddress() { return address; } public boolean isHasUnread() { return hasUnread; } public long getLastMessageDate() { return lastMessageDate; } public Message getLastMessage() { return lastMessage; } }
1,168
0.687394
0.683986
47
23.978724
25.291904
123
false
false
0
0
0
0
0
0
0.468085
false
false
11
e78538f574f2a026754b1ab7853f7c75836282ba
19,155,554,186,457
73e930c0b8e92d5d218c384e40d48acb4272fdf8
/java-lean-tools/src/main/java/beanTool/customConstrans/MoneyValidatorTest.java
a4aafd355037c5a7e728b870e0cebae8457d4d8b
[]
no_license
hwy1782/JavaLearnProject
https://github.com/hwy1782/JavaLearnProject
314914334b3908df8199b767652d394d4f697afa
36f09367aa6df36068f313878b663a620f0446d8
refs/heads/master
2020-02-27T04:57:28.903000
2019-11-18T05:59:02
2019-11-18T05:59:02
8,282,697
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package beanTool.customConstrans; import com.google.common.base.Objects; import org.junit.Test; /** * Created with IntelliJ IDEA. * User: hongweiye * Date: 2014/11/12 14:23 */ public class MoneyValidatorTest { @Test public void test(){ User user = new User(); user.setSalary(-34.45); user.setName("tom"); System.out.printf("user is " + user); } class User{ private String name; @Money private Double salary; public String getName() { return name; } public void setName(String name) { this.name = name; } public Double getSalary() { return salary; } public void setSalary(Double salary) { this.salary = salary; } @Override public String toString() { return Objects.toStringHelper(this) .add("name", name) .add("salary", salary) .toString(); } } }
UTF-8
Java
1,047
java
MoneyValidatorTest.java
Java
[ { "context": "Test;\n\n/**\n * Created with IntelliJ IDEA.\n * User: hongweiye\n * Date: 2014/11/12 14:23\n */\npublic class MoneyV", "end": 151, "score": 0.9996289014816284, "start": 142, "tag": "USERNAME", "value": "hongweiye" }, { "context": " user.setSalary(-34.45);\n user.setName(\"tom\");\n\n System.out.printf(\"user is \" + user);", "end": 340, "score": 0.9226177930831909, "start": 337, "tag": "USERNAME", "value": "tom" } ]
null
[]
package beanTool.customConstrans; import com.google.common.base.Objects; import org.junit.Test; /** * Created with IntelliJ IDEA. * User: hongweiye * Date: 2014/11/12 14:23 */ public class MoneyValidatorTest { @Test public void test(){ User user = new User(); user.setSalary(-34.45); user.setName("tom"); System.out.printf("user is " + user); } class User{ private String name; @Money private Double salary; public String getName() { return name; } public void setName(String name) { this.name = name; } public Double getSalary() { return salary; } public void setSalary(Double salary) { this.salary = salary; } @Override public String toString() { return Objects.toStringHelper(this) .add("name", name) .add("salary", salary) .toString(); } } }
1,047
0.516714
0.501433
54
18.388889
15.442146
47
false
false
0
0
0
0
0
0
0.296296
false
false
11
833c8c05d510b661d6dbb5c5050dc6260734e435
4,475,355,978,886
d9a5da012c82e7700be15f53c429607f80c60d87
/RearEnd/SmallProfitManagement/src/main/java/cn/xgtd/domain/user/Role.java
5198404cf58e008413801450fcb425d0a5d6f19b
[]
no_license
fhx210114/SmallProfitMall
https://github.com/fhx210114/SmallProfitMall
6a42705d2e21ed6fc568b16af0c9826522a9c002
207721fda187f6f324552b871071b3f04f78024b
refs/heads/master
2023-01-19T12:54:25.567000
2020-11-19T06:16:33
2020-11-19T06:16:33
285,548,053
0
0
null
true
2020-08-06T11:02:39
2020-08-06T11:02:38
2020-08-06T03:02:24
2020-08-06T03:02:22
41,776
0
0
0
null
false
false
package cn.xgtd.domain.user; import lombok.Data; import java.io.Serializable; import java.util.Date; import java.util.List; /** * 角色管理 * @author Kite * @date 2020/6/3 */ public class Role implements Serializable { /**角色id**/ private Integer rId; /**管理范围,返回前端**/ private String[] menus; /**管理范围,数据库数据**/ private String databaseMenus; /**角色名称**/ private String name; /**创建时间**/ private Date createTime; /**创建人Id**/ private Integer createAuthorId; /**修改人名字**/ private String createAuthorName; /**上次修改时间**/ private Date lastTime; /**上次修改人**/ private Integer lastAuthorId; /**修改人名字**/ private String lastAuthorName; /**基本可选择角色 前端传入**/ private String[] roleIds; /**基本可选择角色 传入数据库**/ private String roleBasicsId; public String getRoleBasicsId() { return roleBasicsId; } public void setRoleBasicsId(String roleBasicsId) { this.roleBasicsId = roleBasicsId; } public String[] getRoleIds() { return roleIds; } public void setRoleIds(String[] roleIds) { this.roleIds = roleIds; } public Integer getrId() { return rId; } public void setrId(Integer rId) { this.rId = rId; } public String[] getMenus() { return menus; } public void setMenus(String[] menus) { this.menus = menus; } public String getDatabaseMenus() { return databaseMenus; } public void setDatabaseMenus(String databaseMenus) { this.databaseMenus = databaseMenus; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Integer getCreateAuthorId() { return createAuthorId; } public void setCreateAuthorId(Integer createAuthorId) { this.createAuthorId = createAuthorId; } public String getCreateAuthorName() { return createAuthorName; } public void setCreateAuthorName(String createAuthorName) { this.createAuthorName = createAuthorName; } public Date getLastTime() { return lastTime; } public void setLastTime(Date lastTime) { this.lastTime = lastTime; } public Integer getLastAuthorId() { return lastAuthorId; } public void setLastAuthorId(Integer lastAuthorId) { this.lastAuthorId = lastAuthorId; } public String getLastAuthorName() { return lastAuthorName; } public void setLastAuthorName(String lastAuthorName) { this.lastAuthorName = lastAuthorName; } }
UTF-8
Java
2,956
java
Role.java
Java
[ { "context": "te;\nimport java.util.List;\n\n/**\n * 角色管理\n * @author Kite\n * @date 2020/6/3\n */\npublic class Role implement", "end": 154, "score": 0.9991584420204163, "start": 150, "tag": "USERNAME", "value": "Kite" } ]
null
[]
package cn.xgtd.domain.user; import lombok.Data; import java.io.Serializable; import java.util.Date; import java.util.List; /** * 角色管理 * @author Kite * @date 2020/6/3 */ public class Role implements Serializable { /**角色id**/ private Integer rId; /**管理范围,返回前端**/ private String[] menus; /**管理范围,数据库数据**/ private String databaseMenus; /**角色名称**/ private String name; /**创建时间**/ private Date createTime; /**创建人Id**/ private Integer createAuthorId; /**修改人名字**/ private String createAuthorName; /**上次修改时间**/ private Date lastTime; /**上次修改人**/ private Integer lastAuthorId; /**修改人名字**/ private String lastAuthorName; /**基本可选择角色 前端传入**/ private String[] roleIds; /**基本可选择角色 传入数据库**/ private String roleBasicsId; public String getRoleBasicsId() { return roleBasicsId; } public void setRoleBasicsId(String roleBasicsId) { this.roleBasicsId = roleBasicsId; } public String[] getRoleIds() { return roleIds; } public void setRoleIds(String[] roleIds) { this.roleIds = roleIds; } public Integer getrId() { return rId; } public void setrId(Integer rId) { this.rId = rId; } public String[] getMenus() { return menus; } public void setMenus(String[] menus) { this.menus = menus; } public String getDatabaseMenus() { return databaseMenus; } public void setDatabaseMenus(String databaseMenus) { this.databaseMenus = databaseMenus; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Integer getCreateAuthorId() { return createAuthorId; } public void setCreateAuthorId(Integer createAuthorId) { this.createAuthorId = createAuthorId; } public String getCreateAuthorName() { return createAuthorName; } public void setCreateAuthorName(String createAuthorName) { this.createAuthorName = createAuthorName; } public Date getLastTime() { return lastTime; } public void setLastTime(Date lastTime) { this.lastTime = lastTime; } public Integer getLastAuthorId() { return lastAuthorId; } public void setLastAuthorId(Integer lastAuthorId) { this.lastAuthorId = lastAuthorId; } public String getLastAuthorName() { return lastAuthorName; } public void setLastAuthorName(String lastAuthorName) { this.lastAuthorName = lastAuthorName; } }
2,956
0.624106
0.62196
135
19.711111
16.976177
62
false
false
0
0
0
0
0
0
0.303704
false
false
11
6151c59740926060646bd2747bed2d37bed31ca3
4,475,355,978,229
3c7537fc579a958a99cac4dceb14fc760d26c9b3
/src/proyecto/dao/UsuarioDAO.java
556c3dc29209719b90ee7ea5bb936566b3384aea
[]
no_license
rMendozajy/assessmentSoftware
https://github.com/rMendozajy/assessmentSoftware
09341ef3749b5d1c5034cb7f6635ff04b658b959
3c464fc6043b092e88781fe7c6f1ac1addd91165
refs/heads/master
2021-01-18T13:49:14.107000
2013-12-17T02:21:32
2013-12-17T02:21:32
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package proyecto.dao; import java.util.ArrayList; import proyecto.bean.UsuarioBean; public interface UsuarioDAO { public UsuarioBean LogueoUsuarios(String User, String pwd)throws Exception; public void newUsuario(UsuarioBean bean)throws Exception; public void updUsuario(UsuarioBean bean) throws Exception; public void delUsuario(int id) throws Exception; public ArrayList listadousuarios()throws Exception; }
UTF-8
Java
428
java
UsuarioDAO.java
Java
[]
null
[]
package proyecto.dao; import java.util.ArrayList; import proyecto.bean.UsuarioBean; public interface UsuarioDAO { public UsuarioBean LogueoUsuarios(String User, String pwd)throws Exception; public void newUsuario(UsuarioBean bean)throws Exception; public void updUsuario(UsuarioBean bean) throws Exception; public void delUsuario(int id) throws Exception; public ArrayList listadousuarios()throws Exception; }
428
0.806075
0.806075
18
22.777779
25.435225
77
false
false
0
0
0
0
0
0
1.055556
false
false
11
fc84a22e2b42b694f7d535722a34d17e3e422177
29,772,713,354,025
171d31b07c96c2d55f34e82b24d04a3a7864f0c8
/src/main/java/com/qding/bigdata/ds/model/DsMonitorRules.java
2da02c916562ca0e1ee8b7397e15b145a6f4e84c
[]
no_license
cainiao22/qddata
https://github.com/cainiao22/qddata
9c1ffc50a3efb68f6ccf54102fc318fa54a34aca
e6622c31e831e824821a2872525a20335ed9a454
refs/heads/master
2023-03-07T21:27:57.130000
2019-09-20T06:27:04
2019-09-20T06:27:04
214,324,061
1
1
null
false
2023-02-22T02:51:46
2019-10-11T02:15:40
2022-06-23T06:13:37
2023-02-22T02:51:42
68,807
0
1
18
JavaScript
false
false
package com.qding.bigdata.ds.model; import java.util.Date; public class DsMonitorRules { private Long id; private String monitorName; private String ruleType; private Double offsetMin; private Double offestMax; private Integer offsetDay; private String owner; private Date createTime; private Date updateTime; private String parameters; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getMonitorName() { return monitorName; } public void setMonitorName(String monitorName) { this.monitorName = monitorName == null ? null : monitorName.trim(); } public String getRuleType() { return ruleType; } public void setRuleType(String ruleType) { this.ruleType = ruleType == null ? null : ruleType.trim(); } public Double getOffsetMin() { return offsetMin; } public void setOffsetMin(Double offsetMin) { this.offsetMin = offsetMin; } public Double getOffestMax() { return offestMax; } public void setOffestMax(Double offestMax) { this.offestMax = offestMax; } public Integer getOffsetDay() { return offsetDay; } public void setOffsetDay(Integer offsetDay) { this.offsetDay = offsetDay; } public String getOwner() { return owner; } public void setOwner(String owner) { this.owner = owner == null ? null : owner.trim(); } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public String getParameters() { return parameters; } public void setParameters(String parameters) { this.parameters = parameters == null ? null : parameters.trim(); } }
UTF-8
Java
2,071
java
DsMonitorRules.java
Java
[]
null
[]
package com.qding.bigdata.ds.model; import java.util.Date; public class DsMonitorRules { private Long id; private String monitorName; private String ruleType; private Double offsetMin; private Double offestMax; private Integer offsetDay; private String owner; private Date createTime; private Date updateTime; private String parameters; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getMonitorName() { return monitorName; } public void setMonitorName(String monitorName) { this.monitorName = monitorName == null ? null : monitorName.trim(); } public String getRuleType() { return ruleType; } public void setRuleType(String ruleType) { this.ruleType = ruleType == null ? null : ruleType.trim(); } public Double getOffsetMin() { return offsetMin; } public void setOffsetMin(Double offsetMin) { this.offsetMin = offsetMin; } public Double getOffestMax() { return offestMax; } public void setOffestMax(Double offestMax) { this.offestMax = offestMax; } public Integer getOffsetDay() { return offsetDay; } public void setOffsetDay(Integer offsetDay) { this.offsetDay = offsetDay; } public String getOwner() { return owner; } public void setOwner(String owner) { this.owner = owner == null ? null : owner.trim(); } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public String getParameters() { return parameters; } public void setParameters(String parameters) { this.parameters = parameters == null ? null : parameters.trim(); } }
2,071
0.622887
0.622887
105
18.733334
18.94215
75
false
false
0
0
0
0
0
0
0.304762
false
false
11
006f02e5177667337637df35f52a5f8d412a4653
29,772,713,349,371
f082277b6e3fd7b0325e05952a3d1ecc100a5f50
/src/scraper/config/ConfigParser.java
9bc3269f7b10227d89f1c67bdb2684fb95975f48
[]
no_license
brainsqueezer/jScraper
https://github.com/brainsqueezer/jScraper
476251b5c7587e7d8b120726eea691357e86ebf1
6d9b543cacb4ffdef0bd5cafce548c6967255fea
refs/heads/master
2021-01-01T18:28:06.068000
2012-05-24T15:36:59
2012-05-24T15:36:59
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package scraper.config; public class ConfigParser { public Mapping load(String filaname) { return null; } public void save(String filaname, Mapping map) { } }
UTF-8
Java
168
java
ConfigParser.java
Java
[]
null
[]
package scraper.config; public class ConfigParser { public Mapping load(String filaname) { return null; } public void save(String filaname, Mapping map) { } }
168
0.72619
0.72619
11
14.272727
16.895889
49
false
false
0
0
0
0
0
0
0.818182
false
false
11
e34e03e7bd4d5d0bac7a9c84027f4089b9a281b3
20,280,835,597,658
8ca7ef4c866548a0adeb204ba3791b278d230cc6
/src/CompetetiveProgramming/Codechef/SudoPlacement/Test.java
4cab1dcce155198668e89197807058bdcb38ad87
[]
no_license
codedsun/PrePractice
https://github.com/codedsun/PrePractice
ed71f00249c8a581a5806f6e4fb56e1a294c2933
74cb0c4b2806af37e5eea43784e5fd6ef111af33
refs/heads/master
2021-04-15T10:50:23.983000
2018-09-26T16:24:04
2018-09-26T16:24:04
126,486,939
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package CompetetiveProgramming.Codechef.SudoPlacement; import java.util.Scanner; import java.util.Stack; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); String s; while(t-- >=1){ Stack<String> stack = new Stack<>(); s = sc.nextLine(); for(int i =0; i<s.length(); i++){ if(s.charAt(i)=='('){ } if((s.charAt(i) == '+' || s.charAt(i)=='-' || s.charAt(i)== '/' || s.charAt(i)=='*')){ } } } } }
UTF-8
Java
626
java
Test.java
Java
[]
null
[]
package CompetetiveProgramming.Codechef.SudoPlacement; import java.util.Scanner; import java.util.Stack; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); String s; while(t-- >=1){ Stack<String> stack = new Stack<>(); s = sc.nextLine(); for(int i =0; i<s.length(); i++){ if(s.charAt(i)=='('){ } if((s.charAt(i) == '+' || s.charAt(i)=='-' || s.charAt(i)== '/' || s.charAt(i)=='*')){ } } } } }
626
0.455272
0.452077
24
25.083334
23.019768
102
false
false
0
0
0
0
0
0
0.666667
false
false
11
affbc18135dba56a3371ca3f96a15499f2c009b8
34,110,630,283,284
c6bda3ed04577d3f150531aaf7883cd531c24868
/demo-freemarker/src/main/java/org/demo/freemarker/configuration/ApplicationConfiguration.java
85780c224dfb18354a2b119231766c02a90b9855
[]
no_license
hardsnail/demo
https://github.com/hardsnail/demo
ff0fa0071d1e5b491b86c1dd37dd080550016c25
8418dadc9ce0b992fde686bd292f61a9723bb933
refs/heads/master
2020-02-27T15:26:44.062000
2019-12-27T09:24:34
2019-12-27T09:24:34
101,381,382
1
0
null
false
2020-06-30T20:41:31
2017-08-25T08:07:22
2020-06-17T01:12:54
2020-06-30T20:41:29
14,284
0
0
2
Java
false
false
package org.demo.freemarker.configuration; import java.io.File; import java.io.IOException; import org.springframework.context.annotation.Bean; import freemarker.template.Configuration; import freemarker.template.TemplateExceptionHandler; @org.springframework.context.annotation.Configuration public class ApplicationConfiguration { @Bean public Configuration configuration() { Configuration cfg = new Configuration(Configuration.VERSION_2_3_27); try { cfg.setDirectoryForTemplateLoading(new File("/Users/james/SourceCode/github/demo/demo-freemarker/src/main/resource/template")); } catch (IOException e) { throw new RuntimeException(e); } cfg.setDefaultEncoding("UTF-8"); cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); cfg.setLogTemplateExceptions(false); cfg.setWrapUncheckedExceptions(true); return cfg; } }
UTF-8
Java
872
java
ApplicationConfiguration.java
Java
[ { "context": "g.setDirectoryForTemplateLoading(new File(\"/Users/james/SourceCode/github/demo/demo-freemarker/src/main/r", "end": 524, "score": 0.996334433555603, "start": 519, "tag": "USERNAME", "value": "james" } ]
null
[]
package org.demo.freemarker.configuration; import java.io.File; import java.io.IOException; import org.springframework.context.annotation.Bean; import freemarker.template.Configuration; import freemarker.template.TemplateExceptionHandler; @org.springframework.context.annotation.Configuration public class ApplicationConfiguration { @Bean public Configuration configuration() { Configuration cfg = new Configuration(Configuration.VERSION_2_3_27); try { cfg.setDirectoryForTemplateLoading(new File("/Users/james/SourceCode/github/demo/demo-freemarker/src/main/resource/template")); } catch (IOException e) { throw new RuntimeException(e); } cfg.setDefaultEncoding("UTF-8"); cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); cfg.setLogTemplateExceptions(false); cfg.setWrapUncheckedExceptions(true); return cfg; } }
872
0.802752
0.797018
29
29.068966
29.365627
130
false
false
0
0
0
0
0
0
1.413793
false
false
11
442f1f20e8ea6ea3e5f65e4b42ded071e9587dcc
29,841,432,823,723
cac22d11c6c672549d9729e453804cd9072cd317
/app/src/main/java/nu/rolandsson/jakob/noterav5/component/PageComponent.java
50b9c5e39bd56878a9d7c219b1fe8425a3fbb331
[]
no_license
Kavzor/Notera
https://github.com/Kavzor/Notera
f819a44d880836281289b2d727f27a9c209afa9a
6ec3be5e323bc2a1bf196c5ad20e92b5855a3534
refs/heads/master
2020-03-17T21:27:03.565000
2018-05-18T13:37:18
2018-05-18T13:37:18
133,958,843
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package nu.rolandsson.jakob.noterav5.component; import android.content.Context; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.view.GestureDetectorCompat; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.util.Log; import android.view.GestureDetector; import android.view.MotionEvent; public class PageComponent extends ViewPager { public interface PageFlipper { void onNextPage(); void onPreviousPage(); } private float initialXPos; private static final String TAG = ViewPager.class.getName(); public PageComponent(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); } @Override public boolean onInterceptTouchEvent(MotionEvent event) { if(isLeftSwipe(event)) { return super.onInterceptTouchEvent(event); } return false; } @Override public boolean onTouchEvent(MotionEvent event) { if(isLeftSwipe(event)) { return super.onTouchEvent(event); } return false; } public void showNext() { setCurrentItem(getCurrentItem() + 1); } public void showPrevious() { setCurrentItem(getCurrentItem() - 1); } public boolean isLeftSwipe(MotionEvent event) { if(event.getAction() == MotionEvent.ACTION_DOWN) { initialXPos = event.getX(); return false; } if(event.getAction() == MotionEvent.ACTION_MOVE) { if(initialXPos > event.getX()) { return true; } } return false; } }
UTF-8
Java
1,691
java
PageComponent.java
Java
[ { "context": "package nu.rolandsson.jakob.noterav5.component;\n\nimport android.content", "end": 21, "score": 0.730215847492218, "start": 11, "tag": "USERNAME", "value": "rolandsson" } ]
null
[]
package nu.rolandsson.jakob.noterav5.component; import android.content.Context; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.view.GestureDetectorCompat; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.util.Log; import android.view.GestureDetector; import android.view.MotionEvent; public class PageComponent extends ViewPager { public interface PageFlipper { void onNextPage(); void onPreviousPage(); } private float initialXPos; private static final String TAG = ViewPager.class.getName(); public PageComponent(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); } @Override public boolean onInterceptTouchEvent(MotionEvent event) { if(isLeftSwipe(event)) { return super.onInterceptTouchEvent(event); } return false; } @Override public boolean onTouchEvent(MotionEvent event) { if(isLeftSwipe(event)) { return super.onTouchEvent(event); } return false; } public void showNext() { setCurrentItem(getCurrentItem() + 1); } public void showPrevious() { setCurrentItem(getCurrentItem() - 1); } public boolean isLeftSwipe(MotionEvent event) { if(event.getAction() == MotionEvent.ACTION_DOWN) { initialXPos = event.getX(); return false; } if(event.getAction() == MotionEvent.ACTION_MOVE) { if(initialXPos > event.getX()) { return true; } } return false; } }
1,691
0.651094
0.648137
64
25.421875
20.600975
82
false
false
0
0
0
0
0
0
0.421875
false
false
11
66a7e8bdec5d47235a620fde08fc8a6cb08a5dc4
30,382,598,680,755
13a757efa6774fe22aa90c0c899a2bfb2d1bc3cf
/jabc_01/src/main/java/com/yuanxinyi/ui/Client.java
34da19a308edc64d5362f208c5e3975d0e834a8c
[]
no_license
Yuanxinyi/Java-
https://github.com/Yuanxinyi/Java-
2eba27cd8f789bf5687f1e332203882e5c759da9
5f173670e871afc6a712b7922db90ad778bd2327
refs/heads/master
2022-07-04T02:44:27.563000
2020-02-24T09:21:52
2020-02-24T09:21:52
219,289,822
0
0
null
false
2022-06-21T02:51:06
2019-11-03T11:24:02
2020-02-24T09:22:30
2022-06-21T02:51:06
58
0
0
2
Java
false
false
package com.yuanxinyi.ui; import com.yuanxinyi.factory.BeanFactory; import com.yuanxinyi.service.IAccountService; /** * 模拟一个表现层,用于调用业务层 */ public class Client { public static void main(String[] args) { for (int i = 0;i < 5; i++ ) { IAccountService as = (IAccountService) BeanFactory.getBean("accountService"); System.out.println(as); as.saveAccount(); } } }
UTF-8
Java
452
java
Client.java
Java
[]
null
[]
package com.yuanxinyi.ui; import com.yuanxinyi.factory.BeanFactory; import com.yuanxinyi.service.IAccountService; /** * 模拟一个表现层,用于调用业务层 */ public class Client { public static void main(String[] args) { for (int i = 0;i < 5; i++ ) { IAccountService as = (IAccountService) BeanFactory.getBean("accountService"); System.out.println(as); as.saveAccount(); } } }
452
0.625592
0.620853
17
23.82353
22.835049
89
false
false
0
0
0
0
0
0
0.470588
false
false
11
fc1c50f3767fdd8caa2e3ec3bbb981755fd717b8
34,557,306,889,549
4a9eedc3a000c194ead3c9db6b7ba73924827e79
/src/Repository/MessageRepository.java
66d44ae797bb18e2a351ed41ddf371ce9887a172
[]
no_license
fiilmfilmm/JPMorgan
https://github.com/fiilmfilmm/JPMorgan
f922c24c06ae0cb8e93cae1cd0b77ecf63a92979
0b132bac4f4cecbb6d8bfc89dd7d38b0c180c73d
refs/heads/master
2020-03-23T00:59:28.847000
2018-07-16T01:03:24
2018-07-16T01:03:24
140,895,853
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Repository; import java.util.ArrayList; import java.util.HashMap; import Interface.IMessageRepository; public class MessageRepository implements IMessageRepository { private HashMap<String, ArrayList<String>> sales; private HashMap<String, ArrayList<String>> adjustments; public MessageRepository() { this.sales = new HashMap<String, ArrayList<String>>(); this.adjustments = new HashMap<String, ArrayList<String>>(); } // All message are recorded in Hashmap @Override public void updateSales(String key, String message) { storeSales(this.sales, key, message); } @Override public void adjustSales(String key, String message) { storeSales(this.adjustments, key, message); } private void storeSales(HashMap<String, ArrayList<String>> store, String key, String message) { // update existing product if(store.containsKey(key)) { ArrayList<String> itemsList = store.get(key); itemsList.add(message); store.put(key, itemsList); } else { // add new product ArrayList<String> messageList = new ArrayList<String>(); messageList.add(message); store.put(key, messageList); } } // Return all sales records @Override public HashMap<String, ArrayList<String>> getSales() { return this.sales; } // Return all adjustments @Override public HashMap<String, ArrayList<String>> getAgjustments() { return this.adjustments; } }
UTF-8
Java
1,444
java
MessageRepository.java
Java
[]
null
[]
package Repository; import java.util.ArrayList; import java.util.HashMap; import Interface.IMessageRepository; public class MessageRepository implements IMessageRepository { private HashMap<String, ArrayList<String>> sales; private HashMap<String, ArrayList<String>> adjustments; public MessageRepository() { this.sales = new HashMap<String, ArrayList<String>>(); this.adjustments = new HashMap<String, ArrayList<String>>(); } // All message are recorded in Hashmap @Override public void updateSales(String key, String message) { storeSales(this.sales, key, message); } @Override public void adjustSales(String key, String message) { storeSales(this.adjustments, key, message); } private void storeSales(HashMap<String, ArrayList<String>> store, String key, String message) { // update existing product if(store.containsKey(key)) { ArrayList<String> itemsList = store.get(key); itemsList.add(message); store.put(key, itemsList); } else { // add new product ArrayList<String> messageList = new ArrayList<String>(); messageList.add(message); store.put(key, messageList); } } // Return all sales records @Override public HashMap<String, ArrayList<String>> getSales() { return this.sales; } // Return all adjustments @Override public HashMap<String, ArrayList<String>> getAgjustments() { return this.adjustments; } }
1,444
0.706371
0.706371
54
24.74074
23.001759
96
false
false
0
0
0
0
0
0
1.888889
false
false
11
45c1ee55e527703197ceff7a70f896ee3d75210b
28,449,863,382,071
9adc2fc89fec59398a835aeeb058d9a273c51d51
/codes_and_notes/487_name-deduplication/name-deduplication.java
ac362b260f17b1fc8716567811cef6b70b3d5fc5
[]
no_license
YuanzhiBao/coding-questions
https://github.com/YuanzhiBao/coding-questions
d772e71b07c412f50bc4c2133b7b0abdeb260968
ebc226903ae4aa0ff7fe645c1bcaf80d2bf70f26
refs/heads/master
2020-07-04T12:57:20.217000
2016-10-30T19:38:15
2016-10-30T19:38:15
66,735,446
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* @Copyright:LintCode @Author: baoyu2017 @Problem: http://www.lintcode.com/problem/name-deduplication @Language: Java @Datetime: 16-07-16 16:06 */ public class Solution { /** * @param names a string array * @return a string array */ public List<String> nameDeduplication(String[] names) { // Write your code here HashSet<String> uniqueNameSet = new HashSet<String>(); List<String> res = new ArrayList<String>(); for (int i = 0; i < names.length; i++) { String temp = names[i].toLowerCase(); if (!uniqueNameSet.contains(temp) ) { uniqueNameSet.add(temp); res.add(temp); } } return res; } }
UTF-8
Java
760
java
name-deduplication.java
Java
[ { "context": "/*\n@Copyright:LintCode\n@Author: baoyu2017\n@Problem: http://www.lintcode.com/problem/name-d", "end": 43, "score": 0.9987648725509644, "start": 34, "tag": "USERNAME", "value": "baoyu2017" } ]
null
[]
/* @Copyright:LintCode @Author: baoyu2017 @Problem: http://www.lintcode.com/problem/name-deduplication @Language: Java @Datetime: 16-07-16 16:06 */ public class Solution { /** * @param names a string array * @return a string array */ public List<String> nameDeduplication(String[] names) { // Write your code here HashSet<String> uniqueNameSet = new HashSet<String>(); List<String> res = new ArrayList<String>(); for (int i = 0; i < names.length; i++) { String temp = names[i].toLowerCase(); if (!uniqueNameSet.contains(temp) ) { uniqueNameSet.add(temp); res.add(temp); } } return res; } }
760
0.55
0.530263
28
25.5
19.73304
62
false
false
0
0
0
0
0
0
0.285714
false
false
11
93dda8dafda33add6339f9cd1c5fe492a995d5af
30,253,749,688,303
9ed50919421bdeccf485451637a931a9900d2a37
/demo-p2/service/src/main/java/com/demo/p2/service/MQMessageService.java
3f2e50301fc972f622bfbab9891f2d6e907bf122
[]
no_license
Scarswan/rong-demo
https://github.com/Scarswan/rong-demo
be297ffc0ef6d07fd684d779e833bac70e5f7bbf
e84b1dfcc0e94cbd9f9d355a6cf412d1611cc3d5
refs/heads/master
2022-12-21T13:12:09.153000
2019-09-25T06:02:16
2019-09-25T06:02:16
201,157,929
1
0
null
false
2022-12-10T05:43:53
2019-08-08T01:55:46
2020-08-10T15:38:37
2022-12-10T05:43:52
266
0
0
7
JavaScript
false
false
package com.demo.p2.service; public interface MQMessageService { }
UTF-8
Java
68
java
MQMessageService.java
Java
[]
null
[]
package com.demo.p2.service; public interface MQMessageService { }
68
0.794118
0.779412
4
16
15.700318
35
false
false
0
0
0
0
0
0
0.25
false
false
11
711437a73d6130430b6c0ae272f16ee3ca22aea4
30,253,749,687,673
01340816f7165798fd857f33b4b4414fa9bf192c
/src/main/java/leetcode/One/Thousand/groupThePeople/Solution.java
f9fb7eb6b16f1b0ce9fc353d970e24f662620f72
[]
no_license
EarWheat/LeetCode
https://github.com/EarWheat/LeetCode
250f181c2c697af29ce6f76b1fdf7c7b0d7fb02c
f440e6c76efb4554e0404cacf137dc1f6677e2e1
refs/heads/master
2023-08-31T06:25:35.460000
2023-08-30T06:41:10
2023-08-30T06:41:10
145,558,499
2
1
null
false
2023-06-14T22:51:49
2018-08-21T12:05:56
2022-12-14T22:52:32
2023-06-14T22:51:49
2,822
2
1
2
Java
false
false
package leetcode.One.Thousand.groupThePeople; import org.apache.commons.collections.ListUtils; import java.util.*; /** * @Desc: * @Author: 泽露 * @Date: 2022/8/12 11:41 AM * @Version: 1.initial version; 2022/8/12 11:41 AM */ public class Solution { public List<List<Integer>> groupThePeople(int[] groupSizes) { // Map[多少人,List<人Id> Map<Integer, List<Integer>> groupMap = new HashMap<>(); for (int i = 0; i < groupSizes.length; i++) { int peopleId = i; int groupNum = groupSizes[i]; List<Integer> list; if (groupMap.containsKey(groupNum)) { list = groupMap.get(groupNum); } else { list = new ArrayList<>(); } list.add(peopleId); groupMap.put(groupNum, list); } List<List<Integer>> result = new ArrayList<>(); for (Map.Entry<Integer, List<Integer>> entry : groupMap.entrySet()) { Integer groupNum = entry.getKey(); List<Integer> peoples = entry.getValue(); if (peoples.size() > groupNum) { List<Integer> temp = new ArrayList<>(); for (Integer people : peoples) { temp.add(people); if (temp.size() == groupNum) { result.add(temp); temp = new ArrayList<>(); } } } else if(groupNum == peoples.size()){ result.add(peoples); } } return result; } public static void main(String[] args) { Solution solution = new Solution(); System.out.println(solution.groupThePeople(new int[]{3,3,3,3,3,1,3})); } }
UTF-8
Java
1,766
java
Solution.java
Java
[ { "context": ";\n\nimport java.util.*;\n\n/**\n * @Desc:\n * @Author: 泽露\n * @Date: 2022/8/12 11:41 AM\n * @Version: 1.initi", "end": 146, "score": 0.999577522277832, "start": 144, "tag": "NAME", "value": "泽露" } ]
null
[]
package leetcode.One.Thousand.groupThePeople; import org.apache.commons.collections.ListUtils; import java.util.*; /** * @Desc: * @Author: 泽露 * @Date: 2022/8/12 11:41 AM * @Version: 1.initial version; 2022/8/12 11:41 AM */ public class Solution { public List<List<Integer>> groupThePeople(int[] groupSizes) { // Map[多少人,List<人Id> Map<Integer, List<Integer>> groupMap = new HashMap<>(); for (int i = 0; i < groupSizes.length; i++) { int peopleId = i; int groupNum = groupSizes[i]; List<Integer> list; if (groupMap.containsKey(groupNum)) { list = groupMap.get(groupNum); } else { list = new ArrayList<>(); } list.add(peopleId); groupMap.put(groupNum, list); } List<List<Integer>> result = new ArrayList<>(); for (Map.Entry<Integer, List<Integer>> entry : groupMap.entrySet()) { Integer groupNum = entry.getKey(); List<Integer> peoples = entry.getValue(); if (peoples.size() > groupNum) { List<Integer> temp = new ArrayList<>(); for (Integer people : peoples) { temp.add(people); if (temp.size() == groupNum) { result.add(temp); temp = new ArrayList<>(); } } } else if(groupNum == peoples.size()){ result.add(peoples); } } return result; } public static void main(String[] args) { Solution solution = new Solution(); System.out.println(solution.groupThePeople(new int[]{3,3,3,3,3,1,3})); } }
1,766
0.510832
0.493158
53
32.094341
20.940405
78
false
false
0
0
0
0
0
0
0.660377
false
false
11
6b26424bcab3730f94f0f67a6fd3491e91d9384d
17,772,574,710,450
31198a7b948c6c41b956a7cbdbe5ad29fe6bfe3d
/AutomatedTravelAgency/src/main/java/com/capg/travelagency/dao/RouteDAOImpl.java
b0ac3a0b943b41827077916ebcdbf72793c8ef3e
[]
no_license
shahishrishti/AutomatedTravelAgency
https://github.com/shahishrishti/AutomatedTravelAgency
af86b4b9ba4f7200d84a1f47f5ecbe584e2bbc44
f3ff5467a07e78fd3e771f4555d945ca9561bc6e
refs/heads/master
2023-02-05T19:27:47.448000
2020-12-28T16:07:15
2020-12-28T16:07:15
318,489,777
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.capg.travelagency.dao; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import com.capg.travelagency.dto.Route; import com.capg.travelagency.entity.RouteEntity; import com.capg.travelagency.entity.VehicleEntity; import com.capg.travelagency.exceptions.InvalidRouteDataException; import com.capg.travelagency.exceptions.InvalidVehicleDataException; public class RouteDAOImpl implements RouteDAO{ private static Logger logger = LogManager.getLogger(RouteDAOImpl.class.getName()); private static EntityManager entityManager; static { EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("TravelAgencyPU"); entityManager = entityManagerFactory.createEntityManager(); } public RouteEntity viewRouteByID(int routeID) throws InvalidRouteDataException { entityManager.getTransaction().begin(); RouteEntity routeEntity = entityManager.find(RouteEntity.class, routeID); logger.info("Database returned RouteEntity: " + routeEntity); if(routeEntity==null) { entityManager.getTransaction().commit(); logger.error("Route entity was found null."); throw new InvalidRouteDataException("routeID: " + routeID); } else { logger.info("View route data from database"); System.out.println("route data :"+routeEntity); entityManager.getTransaction().commit(); } return routeEntity; } public RouteEntity addRoute(Route addedRoute) throws InvalidRouteDataException, InvalidVehicleDataException { entityManager.getTransaction().begin(); VehicleEntity newVehicleEntity = entityManager.find(VehicleEntity.class, addedRoute.getVehicleNo()); RouteEntity routeEntity = null; if(newVehicleEntity == null) { entityManager.getTransaction().commit(); throw new InvalidVehicleDataException("Invalid vehicle No: " +addedRoute.getVehicleNo()); } else { routeEntity =new RouteEntity(addedRoute.getSource(), addedRoute.getDestination(), addedRoute.getDistance(),addedRoute.getDuration(), newVehicleEntity);; entityManager.persist(routeEntity ); entityManager.getTransaction().commit(); } return routeEntity; } public RouteEntity deleteRoute(int routeId) throws InvalidRouteDataException { entityManager.getTransaction().begin(); RouteEntity routeEntity = entityManager.find(RouteEntity.class, routeId); logger.info("Database returned routeEntity: " + routeEntity); if(routeEntity==null) { entityManager.getTransaction().commit(); logger.error("Route entity was found null"); throw new InvalidRouteDataException("RouteId: " + routeId + " was not found."); } else { logger.info("Delete route data from database"); entityManager.remove(routeEntity); } entityManager.getTransaction().commit(); return routeEntity; } public RouteEntity modifyRoute(Route modifiedRoute) throws InvalidVehicleDataException, InvalidRouteDataException { entityManager.getTransaction().begin(); RouteEntity routeEntity = entityManager.find(RouteEntity.class, modifiedRoute.getRouteId()); if(routeEntity == null) { entityManager.getTransaction().commit(); throw new InvalidRouteDataException("Invalid RouteId: " + modifiedRoute.getRouteId()); } else { routeEntity.setSource(modifiedRoute.getSource()); routeEntity.setDestination(modifiedRoute.getDestination()); routeEntity.setDistance(modifiedRoute.getDistance()); routeEntity.setDuration(modifiedRoute.getDuration()); entityManager.getTransaction().commit(); logger.info("Updated RouteEntity: " + routeEntity); } return routeEntity; } }
UTF-8
Java
3,700
java
RouteDAOImpl.java
Java
[]
null
[]
package com.capg.travelagency.dao; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import com.capg.travelagency.dto.Route; import com.capg.travelagency.entity.RouteEntity; import com.capg.travelagency.entity.VehicleEntity; import com.capg.travelagency.exceptions.InvalidRouteDataException; import com.capg.travelagency.exceptions.InvalidVehicleDataException; public class RouteDAOImpl implements RouteDAO{ private static Logger logger = LogManager.getLogger(RouteDAOImpl.class.getName()); private static EntityManager entityManager; static { EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("TravelAgencyPU"); entityManager = entityManagerFactory.createEntityManager(); } public RouteEntity viewRouteByID(int routeID) throws InvalidRouteDataException { entityManager.getTransaction().begin(); RouteEntity routeEntity = entityManager.find(RouteEntity.class, routeID); logger.info("Database returned RouteEntity: " + routeEntity); if(routeEntity==null) { entityManager.getTransaction().commit(); logger.error("Route entity was found null."); throw new InvalidRouteDataException("routeID: " + routeID); } else { logger.info("View route data from database"); System.out.println("route data :"+routeEntity); entityManager.getTransaction().commit(); } return routeEntity; } public RouteEntity addRoute(Route addedRoute) throws InvalidRouteDataException, InvalidVehicleDataException { entityManager.getTransaction().begin(); VehicleEntity newVehicleEntity = entityManager.find(VehicleEntity.class, addedRoute.getVehicleNo()); RouteEntity routeEntity = null; if(newVehicleEntity == null) { entityManager.getTransaction().commit(); throw new InvalidVehicleDataException("Invalid vehicle No: " +addedRoute.getVehicleNo()); } else { routeEntity =new RouteEntity(addedRoute.getSource(), addedRoute.getDestination(), addedRoute.getDistance(),addedRoute.getDuration(), newVehicleEntity);; entityManager.persist(routeEntity ); entityManager.getTransaction().commit(); } return routeEntity; } public RouteEntity deleteRoute(int routeId) throws InvalidRouteDataException { entityManager.getTransaction().begin(); RouteEntity routeEntity = entityManager.find(RouteEntity.class, routeId); logger.info("Database returned routeEntity: " + routeEntity); if(routeEntity==null) { entityManager.getTransaction().commit(); logger.error("Route entity was found null"); throw new InvalidRouteDataException("RouteId: " + routeId + " was not found."); } else { logger.info("Delete route data from database"); entityManager.remove(routeEntity); } entityManager.getTransaction().commit(); return routeEntity; } public RouteEntity modifyRoute(Route modifiedRoute) throws InvalidVehicleDataException, InvalidRouteDataException { entityManager.getTransaction().begin(); RouteEntity routeEntity = entityManager.find(RouteEntity.class, modifiedRoute.getRouteId()); if(routeEntity == null) { entityManager.getTransaction().commit(); throw new InvalidRouteDataException("Invalid RouteId: " + modifiedRoute.getRouteId()); } else { routeEntity.setSource(modifiedRoute.getSource()); routeEntity.setDestination(modifiedRoute.getDestination()); routeEntity.setDistance(modifiedRoute.getDistance()); routeEntity.setDuration(modifiedRoute.getDuration()); entityManager.getTransaction().commit(); logger.info("Updated RouteEntity: " + routeEntity); } return routeEntity; } }
3,700
0.779459
0.778919
100
36
32.448421
154
false
false
0
0
0
0
0
0
2.29
false
false
11
1d4eba1004a8ef2634c1ac9ae0aca1e5bda18a68
10,075,993,318,973
37b1343af31f288c548c6d7704e7bbbca1cab2a8
/naavisEngage/src/com/versawork/http/utils/SecureMailSender.java
f4701379b52ae50e6182f86ae03f86e44d5ea4e9
[]
no_license
saubhagya1987/myproj3
https://github.com/saubhagya1987/myproj3
5ccb63ee3896fe0ed2c1b880261078ed8f9dcbe4
02424bbdf0695672bf4400318863abaaa7e9f5de
refs/heads/master
2021-01-13T15:32:10.944000
2017-03-17T19:01:30
2017-03-17T19:01:30
85,320,324
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.versawork.http.utils; import java.util.HashMap; import java.util.Locale; import javax.annotation.Resource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.MessageSource; import org.springframework.mail.MailSender; import org.springframework.mail.SimpleMailMessage; import org.springframework.stereotype.Component; import com.versawork.http.exception.BusinessException; @Resource(name = "secureMailSender") @Component public class SecureMailSender { private static final Logger LOGGER = LoggerFactory.getLogger(SecureMailSender.class); // from, to, subject and body @Autowired private MessageSource messageSource; @SuppressWarnings("unused") private MailSender mailSender; private SimpleMailMessage simpleMailMessage; private static Client client; public void setSimpleMailMessage(SimpleMailMessage simpleMailMessage) { this.simpleMailMessage = simpleMailMessage; } public void setMailSender(MailSender mailSender) { this.mailSender = mailSender; } public void secureTransmit(String to, String body, String subject, HashMap<String, byte[]> attachmentsMap, Locale locale) throws BusinessException { // SimpleMailMessage message = new SimpleMailMessage(simpleMailMessage); String provider = "versaworks";// args [0]; // final String username = "naavis.engage@gmail.com";//args [1]; final String password = "deedheeraj";// args [2]; // String to = "newuser@direct.healthvault.com";//args [4]; // String subject = "Medical Transmission";//args [5]; try { if (client == null) { if (provider.equalsIgnoreCase("versaworks")) { client = new SecureMailClient(simpleMailMessage.getFrom().toString(), password, "test.p12", "ireslab", "ireslab"); } else if (provider.equalsIgnoreCase("sendgrid")) { client = new SendGridClient(simpleMailMessage.getFrom().toString(), password, "classpath:HV_Ringful_Test.p12", "HV Ringful Test", "ringful"); } else { LOGGER.debug("We only support GMail and SendGrid as senders for now. To support your own sender, please consider contributing to this project!"); } } LOGGER.debug("This is in secureMailSender : " + messageSource.getMessage("transmit.from.direct.adress", null, locale)); client.sendMessage(messageSource.getMessage("transmit.from.direct.adress", null, locale), to, subject, body, attachmentsMap); LOGGER.debug("Success! Go check http://direct.healthvault-stage.com/ now"); } catch (Exception exp) { exp.printStackTrace(); LOGGER.error("Exception occoured on Secure Mail Sender Class (transmitEHR) : ", exp.getMessage()); throw new BusinessException("secure.mail.transmit.failed"); } } }
UTF-8
Java
2,781
java
SecureMailSender.java
Java
[ { "context": "works\";// args [0];\n\t\t// final String username = \"naavis.engage@gmail.com\";//args [1];\n\t\tfinal String password = \"deedheera", "end": 1423, "score": 0.9997325539588928, "start": 1400, "tag": "EMAIL", "value": "naavis.engage@gmail.com" }, { "context": "gmail.com\";//args [1];\n\t\tfinal String password = \"deedheeraj\";// args [2];\n\t\t// String to = \"newuser@direct.he", "end": 1474, "score": 0.9993923306465149, "start": 1464, "tag": "PASSWORD", "value": "deedheeraj" }, { "context": "ord = \"deedheeraj\";// args [2];\n\t\t// String to = \"newuser@direct.healthvault.com\";//args [4];\n\t\t// String subject = \"Medical Trans", "end": 1537, "score": 0.9999058842658997, "start": 1507, "tag": "EMAIL", "value": "newuser@direct.healthvault.com" }, { "context": "impleMailMessage.getFrom().toString(), password, \"test.p12\",\n\t\t\t\t\t\t\t\"ireslab\", \"ireslab\");\n\n\t\t\t\t} else if (p", "end": 1788, "score": 0.9860941171646118, "start": 1780, "tag": "PASSWORD", "value": "test.p12" } ]
null
[]
package com.versawork.http.utils; import java.util.HashMap; import java.util.Locale; import javax.annotation.Resource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.MessageSource; import org.springframework.mail.MailSender; import org.springframework.mail.SimpleMailMessage; import org.springframework.stereotype.Component; import com.versawork.http.exception.BusinessException; @Resource(name = "secureMailSender") @Component public class SecureMailSender { private static final Logger LOGGER = LoggerFactory.getLogger(SecureMailSender.class); // from, to, subject and body @Autowired private MessageSource messageSource; @SuppressWarnings("unused") private MailSender mailSender; private SimpleMailMessage simpleMailMessage; private static Client client; public void setSimpleMailMessage(SimpleMailMessage simpleMailMessage) { this.simpleMailMessage = simpleMailMessage; } public void setMailSender(MailSender mailSender) { this.mailSender = mailSender; } public void secureTransmit(String to, String body, String subject, HashMap<String, byte[]> attachmentsMap, Locale locale) throws BusinessException { // SimpleMailMessage message = new SimpleMailMessage(simpleMailMessage); String provider = "versaworks";// args [0]; // final String username = "<EMAIL>";//args [1]; final String password = "<PASSWORD>";// args [2]; // String to = "<EMAIL>";//args [4]; // String subject = "Medical Transmission";//args [5]; try { if (client == null) { if (provider.equalsIgnoreCase("versaworks")) { client = new SecureMailClient(simpleMailMessage.getFrom().toString(), password, "<PASSWORD>", "ireslab", "ireslab"); } else if (provider.equalsIgnoreCase("sendgrid")) { client = new SendGridClient(simpleMailMessage.getFrom().toString(), password, "classpath:HV_Ringful_Test.p12", "HV Ringful Test", "ringful"); } else { LOGGER.debug("We only support GMail and SendGrid as senders for now. To support your own sender, please consider contributing to this project!"); } } LOGGER.debug("This is in secureMailSender : " + messageSource.getMessage("transmit.from.direct.adress", null, locale)); client.sendMessage(messageSource.getMessage("transmit.from.direct.adress", null, locale), to, subject, body, attachmentsMap); LOGGER.debug("Success! Go check http://direct.healthvault-stage.com/ now"); } catch (Exception exp) { exp.printStackTrace(); LOGGER.error("Exception occoured on Secure Mail Sender Class (transmitEHR) : ", exp.getMessage()); throw new BusinessException("secure.mail.transmit.failed"); } } }
2,744
0.747573
0.743617
82
32.914635
32.44891
150
false
false
0
0
0
0
0
0
2.219512
false
false
11
55840afcf028749404ad6ba4802f45c9fad41e7f
30,227,979,877,889
dc14e73137a49dacb9662304c98b90eb29e41c4d
/src/test/java/aranyaszok/ResearcherSkillTests.java
3a2426ffde0a9a0e404ca4af8f929cf8fad048dc
[]
no_license
reattila/TheIceAdventure-aranyaszok-team
https://github.com/reattila/TheIceAdventure-aranyaszok-team
412890c498fc3c796bf2594e97ca64245f0ad89c
51e94f9ef44b4d8a3904778674bc3c67b4f43487
refs/heads/main
2023-05-28T07:49:48.317000
2021-06-15T16:06:54
2021-06-15T16:06:54
377,213,318
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package test.java.aranyaszok; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import main.java.aranyaszok.*; class ResearcherSkillTests { Researcher player = new Researcher(); Ice ice = new Ice(); @BeforeEach public void setUp() { player.SetFacing(ice); } @Test void test() { player.Skill(); assertEquals(true,ice.isResearched()); } }
UTF-8
Java
442
java
ResearcherSkillTests.java
Java
[]
null
[]
package test.java.aranyaszok; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import main.java.aranyaszok.*; class ResearcherSkillTests { Researcher player = new Researcher(); Ice ice = new Ice(); @BeforeEach public void setUp() { player.SetFacing(ice); } @Test void test() { player.Skill(); assertEquals(true,ice.isResearched()); } }
442
0.710407
0.710407
26
16
15.811388
49
false
false
0
0
0
0
0
0
1.230769
false
false
11
789550855a2534ac389b0c39656a37be4147f87e
15,710,990,418,222
eacc909dc1a1a0e16c58ab8ca3ce2f1246664217
/src/main/java/PrimeNumbers.java
84cdd58e26a222045be2bd8785bb80b84aa99688
[]
no_license
sailam1997/vonglap
https://github.com/sailam1997/vonglap
1092b9590e7c251799836db25b604d59c0e2fd94
94cc7fc3e7076eefd1fb96af69b93a9c778c2193
refs/heads/master
2020-03-23T04:15:46.586000
2018-07-17T03:17:27
2018-07-17T03:17:27
141,073,132
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; public class PrimeNumbers { public static void main(String[] args) { System.out.println("Cac so nguyen to nho hon 100 la :"); for ( int i = 0 ; i < 100 ; i ++ ){ if (isPrimeNumbers(i)){ System.out.println(i+ " "); } } } public static boolean isPrimeNumbers(int n){ if (n < 2){ return false; } int squareRoot = (int) Math.sqrt(n); for (int i = 2 ; i <= squareRoot; i++){ if (n%i==0){ return false; } } return true ; } }
UTF-8
Java
626
java
PrimeNumbers.java
Java
[]
null
[]
import java.util.Scanner; public class PrimeNumbers { public static void main(String[] args) { System.out.println("Cac so nguyen to nho hon 100 la :"); for ( int i = 0 ; i < 100 ; i ++ ){ if (isPrimeNumbers(i)){ System.out.println(i+ " "); } } } public static boolean isPrimeNumbers(int n){ if (n < 2){ return false; } int squareRoot = (int) Math.sqrt(n); for (int i = 2 ; i <= squareRoot; i++){ if (n%i==0){ return false; } } return true ; } }
626
0.453674
0.4377
24
25.083334
17.240738
64
false
false
0
0
0
0
0
0
0.458333
false
false
11
4948eba7716f6bd169df90185f06be216a73fdc1
15,710,990,417,355
68e488cee3dec40a03179e9600683255cc98a24d
/src/Pachyderm.java
b9fc8c32a1a0ceb0c77ebb6c07c53e5121ba3cd3
[]
no_license
jare4857/OOAD_Project_1
https://github.com/jare4857/OOAD_Project_1
9abc0ba28b1a802e0a64982aee054f54f471b55f
78afe316003c957b2c07723c60e85988b50c459f
refs/heads/master
2020-12-24T02:26:13.126000
2020-01-31T18:48:49
2020-01-31T18:48:49
237,350,368
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Pachyderm extends Animal { public Pachyderm(String name) { super(name); this.type = "Pachyderm"; } @Override public void roam() { System.out.println(this.name + " the " + this.type + " romps around like a pachyderm."); } }
UTF-8
Java
281
java
Pachyderm.java
Java
[]
null
[]
public class Pachyderm extends Animal { public Pachyderm(String name) { super(name); this.type = "Pachyderm"; } @Override public void roam() { System.out.println(this.name + " the " + this.type + " romps around like a pachyderm."); } }
281
0.590747
0.590747
11
24.545454
26.206743
96
false
false
0
0
0
0
0
0
0.272727
false
false
11
7d73b6d992cafaaa7e137713ead64008f6eea436
7,035,156,484,654
9a295e7ba53b91585ed3ee862b00e89a7a52e2ff
/TaskBagService.java
60c47994845cb0c1c08546258045e93fe35dcd64
[]
no_license
tiag0l0pes/TP1-CDN
https://github.com/tiag0l0pes/TP1-CDN
74612e2965589aaa986c714fe67b5c0b78ae7cad
abadb16087f98597e23856e2811c49b8826457e0
refs/heads/master
2021-05-26T17:28:58.584000
2013-11-20T16:59:53
2013-11-20T16:59:53
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.IOException; import java.net.MalformedURLException; import java.rmi.NotBoundException; import java.rmi.RMISecurityManager; import java.rmi.RemoteException; import java.rmi.registry.LocateRegistry; import java.rmi.server.UnicastRemoteObject; import static java.lang.System.setSecurityManager; import static java.rmi.Naming.rebind; import static java.rmi.Naming.unbind; public class TaskBagService { private static final int PORT = 2001; private static final String SERVICE = "//localhost:" + PORT + "/TaskBag"; private static TaskBag taskBag; public static void main(String args[]) { setSecurityManager(new RMISecurityManager()); taskBag = new TaskBag(); try { System.out.println("Opening Port: " + PORT); LocateRegistry.createRegistry(PORT); System.out.println("Port Open!!\nCreating binds..."); UnicastRemoteObject.exportObject(taskBag); rebind(SERVICE, taskBag); System.out.println("Bindings done successful!!!"); System.out.println("\nWaiting for requests..."); } catch (RemoteException e) { System.out.println("ERROR: An exception occur opening the Port!!"); cleanup(); e.printStackTrace(); System.exit(1); } catch (MalformedURLException e) { System.out.println("ERROR: An exception occur creating the bind!!"); cleanup(); e.printStackTrace(); System.exit(1); } System.out.println("Server started."); System.out.println("Enter <CR> to end."); try { System.in.read(); cleanup(); } catch (IOException ioException) { } System.exit(0); } private static void cleanup() { try { unbind(SERVICE); } catch (RemoteException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (NotBoundException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (MalformedURLException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } taskBag.terminateAllConnections(); } }
UTF-8
Java
2,429
java
TaskBagService.java
Java
[]
null
[]
import java.io.IOException; import java.net.MalformedURLException; import java.rmi.NotBoundException; import java.rmi.RMISecurityManager; import java.rmi.RemoteException; import java.rmi.registry.LocateRegistry; import java.rmi.server.UnicastRemoteObject; import static java.lang.System.setSecurityManager; import static java.rmi.Naming.rebind; import static java.rmi.Naming.unbind; public class TaskBagService { private static final int PORT = 2001; private static final String SERVICE = "//localhost:" + PORT + "/TaskBag"; private static TaskBag taskBag; public static void main(String args[]) { setSecurityManager(new RMISecurityManager()); taskBag = new TaskBag(); try { System.out.println("Opening Port: " + PORT); LocateRegistry.createRegistry(PORT); System.out.println("Port Open!!\nCreating binds..."); UnicastRemoteObject.exportObject(taskBag); rebind(SERVICE, taskBag); System.out.println("Bindings done successful!!!"); System.out.println("\nWaiting for requests..."); } catch (RemoteException e) { System.out.println("ERROR: An exception occur opening the Port!!"); cleanup(); e.printStackTrace(); System.exit(1); } catch (MalformedURLException e) { System.out.println("ERROR: An exception occur creating the bind!!"); cleanup(); e.printStackTrace(); System.exit(1); } System.out.println("Server started."); System.out.println("Enter <CR> to end."); try { System.in.read(); cleanup(); } catch (IOException ioException) { } System.exit(0); } private static void cleanup() { try { unbind(SERVICE); } catch (RemoteException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (NotBoundException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (MalformedURLException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } taskBag.terminateAllConnections(); } }
2,429
0.605599
0.602717
64
35.953125
25.183346
107
false
false
0
0
0
0
0
0
0.734375
false
false
11
100440c043e2124a98b4285a3eac02fd3a2c15b8
7,035,156,482,635
913ecc4789996405033c13cd0663019661b3bcf9
/src/main/java/weka/attributeSelection/AbstractConfirmationMeasure.java
203e1c15d3099d042e480a9fac67afb36456174a
[]
no_license
lincoln2491/Confirmation-measures
https://github.com/lincoln2491/Confirmation-measures
b8cbbaa746e11d650951f46b3c7219440df4d47a
08efd728d873802ccc2e8231f35f535f51dedb79
refs/heads/master
2021-01-01T15:35:12.340000
2017-02-27T19:34:01
2017-02-27T19:34:01
19,490,851
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package weka.attributeSelection; import java.io.Serializable; /** * * @author K. Surdyk * */ public abstract class AbstractConfirmationMeasure implements Serializable{ /** * */ private static final long serialVersionUID = 4847994895446157945L; public abstract double getValue(int a, int b, int c, int d); }
UTF-8
Java
326
java
AbstractConfirmationMeasure.java
Java
[ { "context": "\n\nimport java.io.Serializable;\n\n/**\n * \n * @author K. Surdyk\n * \n */\npublic abstract class AbstractConfirmatio", "end": 92, "score": 0.9998401403427124, "start": 83, "tag": "NAME", "value": "K. Surdyk" } ]
null
[]
package weka.attributeSelection; import java.io.Serializable; /** * * @author <NAME> * */ public abstract class AbstractConfirmationMeasure implements Serializable{ /** * */ private static final long serialVersionUID = 4847994895446157945L; public abstract double getValue(int a, int b, int c, int d); }
323
0.723926
0.665644
19
16.157894
24.081579
74
false
false
0
0
0
0
0
0
0.631579
false
false
11
640fd8c0dfe9236f8e039ed71f3c8e9456ad2f5d
28,656,021,857,289
0361bfa690f60411d19aea7135080f1c0720956e
/src/main/java/org/javaconfig/PropertyAdapter.java
a19d0ff6575fac6b32608297c1085ae949d1a0f7
[ "Apache-2.0" ]
permissive
dblevins/javaconfig-api
https://github.com/dblevins/javaconfig-api
03001c6c2c47cc01650aa5d5377f1340b2f94071
face647ef698b7d057f5c8d38ee09d6aa4828753
refs/heads/master
2021-01-15T10:52:37.885000
2014-10-30T18:44:44
2014-10-30T18:44:44
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2014 Credit Suisse and other (see authors). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.javaconfig; /** * Interface for an adapter that converts a configured String into something else. */ public interface PropertyAdapter<T>{ /** * Adapt the given configuration value to the required target type. * @param value * @return */ T adapt(String value); }
UTF-8
Java
929
java
PropertyAdapter.java
Java
[ { "context": "/*\n * Copyright 2014 Credit Suisse and other (see authors).\n *\n * Licensed under the", "end": 34, "score": 0.9998394250869751, "start": 21, "tag": "NAME", "value": "Credit Suisse" } ]
null
[]
/* * Copyright 2014 <NAME> and other (see authors). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.javaconfig; /** * Interface for an adapter that converts a configured String into something else. */ public interface PropertyAdapter<T>{ /** * Adapt the given configuration value to the required target type. * @param value * @return */ T adapt(String value); }
922
0.714747
0.706136
31
28.967741
29.037777
82
false
false
0
0
0
0
0
0
0.225806
false
false
11
9738899b75700423c3467edc129e0cbbf261faca
7,971,459,356,353
5af83ac6853cf915f4e7bc505152601f6e241cc0
/src/main/java/com/sparta/basicassignment/domain/Board.java
e4b7d1bce86f2b4ad59db3faaede45ff1180d8dc
[]
no_license
JangHyeonJun2/anonymous-Board
https://github.com/JangHyeonJun2/anonymous-Board
d57ce63e6c6417b6043a447807ca21d947303769
b614bee8f7e41e97660c42761c71f2bf27f83cbc
refs/heads/master
2023-03-31T00:35:31.534000
2021-04-01T19:44:23
2021-04-01T19:44:23
350,596,226
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sparta.basicassignment.domain; import com.sparta.basicassignment.dto.BoardDetailRequestDto; import com.sparta.basicassignment.dto.BoardRequestDto; import lombok.*; import javax.persistence.*; import java.util.ArrayList; import java.util.List; @Entity @Getter @Setter @NoArgsConstructor public class Board extends Timestamped{ @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "BOARD_ID") private Long id; private String title; @Lob private String contents; private String uuid; // @JsonIgnore //이부분은 Comment랑 양방향으로 할려고 했는데 java.lang.IllegalStateException: Cannot call sendError() after the response has been committed 이 에러 땜에... 진짜 // @OneToMany(mappedBy = "board",fetch = FetchType.EAGER)//, fetch = FetchType.EAGER // @ToString.Exclude // private List<Comment> comments = new ArrayList<>(); @ManyToOne @JoinColumn(name = "USER_ID") private User user; public Board(BoardRequestDto boardRequestDto) { this.title = boardRequestDto.getTitle(); this.contents = boardRequestDto.getContents(); } public void update(BoardDetailRequestDto requestDto) { this.title = requestDto.getTitle(); this.contents = requestDto.getContents(); } }
UTF-8
Java
1,314
java
Board.java
Java
[]
null
[]
package com.sparta.basicassignment.domain; import com.sparta.basicassignment.dto.BoardDetailRequestDto; import com.sparta.basicassignment.dto.BoardRequestDto; import lombok.*; import javax.persistence.*; import java.util.ArrayList; import java.util.List; @Entity @Getter @Setter @NoArgsConstructor public class Board extends Timestamped{ @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "BOARD_ID") private Long id; private String title; @Lob private String contents; private String uuid; // @JsonIgnore //이부분은 Comment랑 양방향으로 할려고 했는데 java.lang.IllegalStateException: Cannot call sendError() after the response has been committed 이 에러 땜에... 진짜 // @OneToMany(mappedBy = "board",fetch = FetchType.EAGER)//, fetch = FetchType.EAGER // @ToString.Exclude // private List<Comment> comments = new ArrayList<>(); @ManyToOne @JoinColumn(name = "USER_ID") private User user; public Board(BoardRequestDto boardRequestDto) { this.title = boardRequestDto.getTitle(); this.contents = boardRequestDto.getContents(); } public void update(BoardDetailRequestDto requestDto) { this.title = requestDto.getTitle(); this.contents = requestDto.getContents(); } }
1,314
0.716877
0.716877
46
26.565218
29.236406
156
false
false
0
0
0
0
0
0
0.413043
false
false
11
8325454e16ef860ae13551c17a3e9a87db6a6b92
16,149,077,101,679
5c98bfd3de3144c6904c918099ece8bc22bcb58a
/src/test/java/com/casumo/interview/videorental/resources/CustomerResourceTest.java
e1f7705f7ffcf8a3d3915a949af06220e4e94c1a
[]
no_license
hnguyen-mentormate/video-rental
https://github.com/hnguyen-mentormate/video-rental
2cadd1b536e788d17f15080ff8343f8e646d8eea
2fe088c5dcae55877363c6c218d598b4dda2ba8d
refs/heads/master
2021-05-30T14:26:00.466000
2016-02-26T22:17:59
2016-02-26T22:17:59
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.casumo.interview.videorental.resources; import com.casumo.interview.videorental.api.Customer; import com.casumo.interview.videorental.core.dao.CustomerDAO; import com.google.common.collect.Lists; import io.dropwizard.testing.junit.ResourceTestRule; import org.junit.After; import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.runners.MockitoJUnitRunner; import javax.ws.rs.client.Entity; import javax.ws.rs.core.GenericType; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.*; @RunWith(MockitoJUnitRunner.class) public class CustomerResourceTest { private static final CustomerDAO customerDAO = mock(CustomerDAO.class); @ClassRule public static final ResourceTestRule resources = ResourceTestRule.builder() .addResource(new CustomerResource(customerDAO)) .build(); @Captor private ArgumentCaptor<Customer> customerCaptor; private final Customer customer; private final List<Customer> customers; { customer = new Customer(); customer.setId(1); customer.setName("Malin Svensson"); customers = Lists.newArrayList(customer); } @Before public void setUp() throws Exception { when(customerDAO.findAll()).thenReturn(customers); when(customerDAO.create(any(Customer.class))).thenReturn(customer); } @After public void tearDown() throws Exception { reset(customerDAO); } @Test public void getAllFoundCorrectly() { final List<Customer> found = resources.client() .target("/customer/getAll") .request() .get(new GenericType<List<Customer>>() { }); assertThat(found.get(0).getId()).isEqualTo(customers.get(0).getId()); verify(customerDAO).findAll(); } @Test public void testCreatingWithParametersCreatedCorrectly() { final Response response = resources.client() .target("/customer/create") .request(MediaType.APPLICATION_JSON_TYPE) .post(Entity.entity(customer, MediaType.APPLICATION_JSON_TYPE)); assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK); verify(customerDAO).create(customerCaptor.capture()); assertThat(customerCaptor.getValue()).isEqualTo(customer); } }
UTF-8
Java
2,393
java
CustomerResourceTest.java
Java
[ { "context": "omer();\n\n\t\tcustomer.setId(1);\n\t\tcustomer.setName(\"Malin Svensson\");\n\n\t\tcustomers = Lists.newArrayList(customer);\n\t", "end": 1327, "score": 0.9996582865715027, "start": 1313, "tag": "NAME", "value": "Malin Svensson" } ]
null
[]
package com.casumo.interview.videorental.resources; import com.casumo.interview.videorental.api.Customer; import com.casumo.interview.videorental.core.dao.CustomerDAO; import com.google.common.collect.Lists; import io.dropwizard.testing.junit.ResourceTestRule; import org.junit.After; import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.runners.MockitoJUnitRunner; import javax.ws.rs.client.Entity; import javax.ws.rs.core.GenericType; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.*; @RunWith(MockitoJUnitRunner.class) public class CustomerResourceTest { private static final CustomerDAO customerDAO = mock(CustomerDAO.class); @ClassRule public static final ResourceTestRule resources = ResourceTestRule.builder() .addResource(new CustomerResource(customerDAO)) .build(); @Captor private ArgumentCaptor<Customer> customerCaptor; private final Customer customer; private final List<Customer> customers; { customer = new Customer(); customer.setId(1); customer.setName("<NAME>"); customers = Lists.newArrayList(customer); } @Before public void setUp() throws Exception { when(customerDAO.findAll()).thenReturn(customers); when(customerDAO.create(any(Customer.class))).thenReturn(customer); } @After public void tearDown() throws Exception { reset(customerDAO); } @Test public void getAllFoundCorrectly() { final List<Customer> found = resources.client() .target("/customer/getAll") .request() .get(new GenericType<List<Customer>>() { }); assertThat(found.get(0).getId()).isEqualTo(customers.get(0).getId()); verify(customerDAO).findAll(); } @Test public void testCreatingWithParametersCreatedCorrectly() { final Response response = resources.client() .target("/customer/create") .request(MediaType.APPLICATION_JSON_TYPE) .post(Entity.entity(customer, MediaType.APPLICATION_JSON_TYPE)); assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK); verify(customerDAO).create(customerCaptor.capture()); assertThat(customerCaptor.getValue()).isEqualTo(customer); } }
2,385
0.771417
0.770163
85
27.164705
22.68342
76
false
false
0
0
0
0
0
0
1.458824
false
false
11
5a7716a4aac7dbefcd7000e042c78a9772d6f8c7
29,300,266,937,278
2c1b630c560d966c63aa7bd1a5181f26bac4189f
/Project/Project/src/com/example/project/Items.java
669d37beb98c10fb418dfde2f36186c797327654
[]
no_license
haroonmaqsood/my_android_projects
https://github.com/haroonmaqsood/my_android_projects
11536030173b22f23e524716882dd8db87291418
0208c857229ad47b3843d56d9ab72e87cc761382
refs/heads/master
2021-01-25T08:54:18.274000
2015-02-20T23:37:56
2015-02-20T23:37:56
31,083,879
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.project; public class Items{ private String itemId = null; private String orderId = null; private String qty = null; private String amount = null; private String tableId = null; private String itemName = null; private String status = null; public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getItemName() { return itemName; } public void setItemName(String itemName) { this.itemName = itemName; } public Items(){ } /* * String itemId, String orderId, String qty, String amount, String tableId,String itemName,String status */ public Items(String itemId, String orderId, String qty, String amount, String tableId,String itemName,String status) { super(); this.itemId = itemId; this.orderId = orderId; this.qty = qty; this.amount = amount; this.tableId = tableId; this.itemName = itemName; this.status = status; } public String getItemId() { return itemId; } public void setItemId(String itemId) { this.itemId = itemId; } public String getOrderId() { return orderId; } public void setOrderId(String orderId) { this.orderId = orderId; } public String getQty() { return qty; } public void setQty(String qty) { this.qty = qty; } public String getAmount() { return amount; } public void setAmount(String amount) { this.amount = amount; } public String getTableId() { return tableId; } public void setTableId(String tableId) { this.tableId = tableId; } }
UTF-8
Java
1,556
java
Items.java
Java
[]
null
[]
package com.example.project; public class Items{ private String itemId = null; private String orderId = null; private String qty = null; private String amount = null; private String tableId = null; private String itemName = null; private String status = null; public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getItemName() { return itemName; } public void setItemName(String itemName) { this.itemName = itemName; } public Items(){ } /* * String itemId, String orderId, String qty, String amount, String tableId,String itemName,String status */ public Items(String itemId, String orderId, String qty, String amount, String tableId,String itemName,String status) { super(); this.itemId = itemId; this.orderId = orderId; this.qty = qty; this.amount = amount; this.tableId = tableId; this.itemName = itemName; this.status = status; } public String getItemId() { return itemId; } public void setItemId(String itemId) { this.itemId = itemId; } public String getOrderId() { return orderId; } public void setOrderId(String orderId) { this.orderId = orderId; } public String getQty() { return qty; } public void setQty(String qty) { this.qty = qty; } public String getAmount() { return amount; } public void setAmount(String amount) { this.amount = amount; } public String getTableId() { return tableId; } public void setTableId(String tableId) { this.tableId = tableId; } }
1,556
0.693445
0.693445
88
16.681818
16.140396
71
false
false
0
0
0
0
0
0
1.568182
false
false
11
6c73e8f5b99043b8da1492f4825df0cbc563154d
3,418,794,035,413
4961491eaee9e4dd792f0b33c4304b4ee98037fe
/ApplicationControllerPatternDemo/src/applicationcontrollerpatterndemo/ApplicationControllerPatternDemo.java
218f1418ee39af31403600b130abf4c4a61e3b0b
[]
no_license
kennedy-james/cit_360
https://github.com/kennedy-james/cit_360
9283e6bdc6af9a5ea3680f9a17a32df5b9d02ea6
7e0dad3503fbef31d35447f51379adc61ac2af89
refs/heads/master
2020-04-15T19:32:57.711000
2019-04-11T01:47:25
2019-04-11T01:47:25
164,954,716
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 applicationcontrollerpatterndemo; import java.util.Scanner; /** * * @author jamesK */ public class ApplicationControllerPatternDemo { /** * @param args the command line arguments */ public static void main(String[] args) { try { // input and controller Scanner input = new Scanner(System.in); Controller calc = new Controller(); // variables Integer inputA; Integer inputB; String operator; System.out.println("Enter the first Number"); inputA = Integer.parseInt(input.nextLine()); System.out.println("Enter the second Number"); inputB = Integer.parseInt(input.nextLine()); System.out.println("What Operation would you like to do?"); operator = input.nextLine(); System.out.println(inputA + " " + operator + " " + inputB + " = "); calc.handler(operator, inputA, inputB); } catch (NumberFormatException x) { System.out.println("******************************"); System.out.println("* Please Enter Valid Numbers *"); System.out.println("******************************"); Scanner input = new Scanner(System.in); Controller calc = new Controller(); // variables Integer inputA; Integer inputB; String operator; System.out.println("Enter the first Number"); inputA = Integer.parseInt(input.nextLine()); System.out.println("Enter the second Number"); inputB = Integer.parseInt(input.nextLine()); System.out.println("What Operation would you like to do?"); operator = input.nextLine(); System.out.println(inputA + " " + operator + " " + inputB + " = "); calc.handler(operator, inputA, inputB); } } }
UTF-8
Java
2,150
java
ApplicationControllerPatternDemo.java
Java
[ { "context": "emo;\n\nimport java.util.Scanner;\n\n/**\n *\n * @author jamesK\n */\npublic class ApplicationControllerPatternDemo", "end": 279, "score": 0.999464213848114, "start": 273, "tag": "USERNAME", "value": "jamesK" } ]
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 applicationcontrollerpatterndemo; import java.util.Scanner; /** * * @author jamesK */ public class ApplicationControllerPatternDemo { /** * @param args the command line arguments */ public static void main(String[] args) { try { // input and controller Scanner input = new Scanner(System.in); Controller calc = new Controller(); // variables Integer inputA; Integer inputB; String operator; System.out.println("Enter the first Number"); inputA = Integer.parseInt(input.nextLine()); System.out.println("Enter the second Number"); inputB = Integer.parseInt(input.nextLine()); System.out.println("What Operation would you like to do?"); operator = input.nextLine(); System.out.println(inputA + " " + operator + " " + inputB + " = "); calc.handler(operator, inputA, inputB); } catch (NumberFormatException x) { System.out.println("******************************"); System.out.println("* Please Enter Valid Numbers *"); System.out.println("******************************"); Scanner input = new Scanner(System.in); Controller calc = new Controller(); // variables Integer inputA; Integer inputB; String operator; System.out.println("Enter the first Number"); inputA = Integer.parseInt(input.nextLine()); System.out.println("Enter the second Number"); inputB = Integer.parseInt(input.nextLine()); System.out.println("What Operation would you like to do?"); operator = input.nextLine(); System.out.println(inputA + " " + operator + " " + inputB + " = "); calc.handler(operator, inputA, inputB); } } }
2,150
0.553023
0.553023
72
28.861111
25.84586
79
false
false
0
0
0
0
0
0
0.527778
false
false
11
833f492b48b127b1239d702ea782626fed7518f6
9,809,705,358,434
fe4189dd8eb215b27fdd2448a27d3e5d989d763c
/src/main/java/com/fenghuang/job/request/ReqUserSettingInfo.java
8f8d85f6676f406ecd61a4fc1d123de043eca67d
[]
no_license
waitforyouwtt/find-job
https://github.com/waitforyouwtt/find-job
014c86ad499d93b75d809a526588b19b65e7e5da
e9f39437a1bafc9b22b1250175e8bf2a9e200517
refs/heads/master
2022-11-19T23:51:52.010000
2020-06-23T10:33:57
2020-06-23T10:33:57
228,325,301
0
0
null
false
2022-11-16T01:25:26
2019-12-16T07:12:40
2020-06-23T10:34:25
2022-11-16T01:25:23
889
0
0
4
Java
false
false
package com.fenghuang.job.request; import lombok.Data; import java.util.Date; /** * @Author: 凤凰[小哥哥] * @Date: 2020/6/13 8:53 * @Version: 1.0 * @Email: 15290810931@163.com */ @Data public class ReqUserSettingInfo { private Integer id; private String token; private Integer userId; private Integer employmentIntention; private String personalSignature; private Integer sendLikeJob; private Integer sendEmail; private Integer sendMessage; private Integer sendWechat; private Integer sendPublicAccount; private String shieldCompanys; private Integer isPersonalInformationPublic; private Integer settingState; }
UTF-8
Java
691
java
ReqUserSettingInfo.java
Java
[ { "context": "ok.Data;\n\nimport java.util.Date;\n\n/**\n * @Author: 凤凰[小哥哥]\n * @Date: 2020/6/13 8:53\n * @Version: 1.0\n *", "end": 99, "score": 0.9995603561401367, "start": 97, "tag": "NAME", "value": "凤凰" }, { "context": "Data;\n\nimport java.util.Date;\n\n/**\n * @Author: 凤凰[小哥哥]\n * @Date: 2020/6/13 8:53\n * @Version: 1.0\n * @Em", "end": 103, "score": 0.6522156596183777, "start": 100, "tag": "USERNAME", "value": "小哥哥" }, { "context": "@Date: 2020/6/13 8:53\n * @Version: 1.0\n * @Email: 15290810931@163.com\n */\n@Data\npublic class ReqUserSettingInfo {\n\n ", "end": 177, "score": 0.9998143315315247, "start": 158, "tag": "EMAIL", "value": "15290810931@163.com" } ]
null
[]
package com.fenghuang.job.request; import lombok.Data; import java.util.Date; /** * @Author: 凤凰[小哥哥] * @Date: 2020/6/13 8:53 * @Version: 1.0 * @Email: <EMAIL> */ @Data public class ReqUserSettingInfo { private Integer id; private String token; private Integer userId; private Integer employmentIntention; private String personalSignature; private Integer sendLikeJob; private Integer sendEmail; private Integer sendMessage; private Integer sendWechat; private Integer sendPublicAccount; private String shieldCompanys; private Integer isPersonalInformationPublic; private Integer settingState; }
679
0.720999
0.682819
42
15.214286
15.628935
48
false
false
0
0
0
0
0
0
0.380952
false
false
11
18090342974696b0d9a540de6d6f8eb885a92fa6
30,064,771,124,421
ae5444f4745234c335f93996485ea801a7f3f37f
/Distrito.java
020ed6a68d1bea3303f977c09b4e8b4c2ac9b1ad
[]
no_license
jmellibosky/UTN-FRC-TSB.TPU
https://github.com/jmellibosky/UTN-FRC-TSB.TPU
3f8cdff6d7b003624299c05077194ef6b486f963
c10fdb2f818d4cd4a8e1e9278dbfe70fdc775d6b
refs/heads/master
2022-02-25T17:21:50.733000
2019-10-17T15:02:03
2019-10-17T15:02:03
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package estructura; import java.util.Hashtable; import java.util.Map; public class Distrito { Map<Integer, Seccion> secciones; Map<Integer, Integer> totales; public Distrito() { secciones = new Hashtable(); totales = new Hashtable(); } }
UTF-8
Java
287
java
Distrito.java
Java
[]
null
[]
package estructura; import java.util.Hashtable; import java.util.Map; public class Distrito { Map<Integer, Seccion> secciones; Map<Integer, Integer> totales; public Distrito() { secciones = new Hashtable(); totales = new Hashtable(); } }
287
0.627178
0.627178
14
18.5
13.957845
36
false
false
0
0
0
0
0
0
0.642857
false
false
11
397d5a0cdd4d6347b94cbdb120edfc07e963d1f2
24,249,385,406,396
0f345075e9e3600cc7e26ac27fca3717e6299ef3
/src/main/java/com/example/practicejavaannotation/entity/User.java
d9d5bac6cde56a1003340314f54df1246dfba1b8
[]
no_license
kimsikkong/springboot-prevent-xss
https://github.com/kimsikkong/springboot-prevent-xss
8aa077e222a32f2012866e40f6779dfaec2066d4
c65f182e2ed169ea3e3cb7183340af1e6b130ee1
refs/heads/main
2023-07-15T17:53:08.915000
2021-08-22T13:37:39
2021-08-22T13:37:39
395,673,501
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.practicejavaannotation.entity; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.*; import lombok.experimental.Accessors; import javax.persistence.*; import java.util.Collection; @NoArgsConstructor @Getter @Setter @Accessors(chain = true) @Entity public class User { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "user_id") private Long id; @JsonIgnore @OneToMany(mappedBy = "user") Collection<UserProfile> userProfiles; private String name; private Integer age; private String address; private String phoneNumber; private Long createdAt; public User(String name, Integer age, String address, String phoneNumber, Long createdAt) { this.name = name; this.age = age; this.address = address; this.phoneNumber = phoneNumber; this.createdAt = createdAt; } @Override public String toString() { return "User{" + "id=" + id + ", name='" + name + '\'' + ", age=" + age + ", address='" + address + '\'' + ", phoneNumber='" + phoneNumber + '\'' + ", createdAt=" + createdAt + '}'; } }
UTF-8
Java
1,275
java
User.java
Java
[]
null
[]
package com.example.practicejavaannotation.entity; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.*; import lombok.experimental.Accessors; import javax.persistence.*; import java.util.Collection; @NoArgsConstructor @Getter @Setter @Accessors(chain = true) @Entity public class User { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "user_id") private Long id; @JsonIgnore @OneToMany(mappedBy = "user") Collection<UserProfile> userProfiles; private String name; private Integer age; private String address; private String phoneNumber; private Long createdAt; public User(String name, Integer age, String address, String phoneNumber, Long createdAt) { this.name = name; this.age = age; this.address = address; this.phoneNumber = phoneNumber; this.createdAt = createdAt; } @Override public String toString() { return "User{" + "id=" + id + ", name='" + name + '\'' + ", age=" + age + ", address='" + address + '\'' + ", phoneNumber='" + phoneNumber + '\'' + ", createdAt=" + createdAt + '}'; } }
1,275
0.593726
0.593726
55
22.181818
19.257198
95
false
false
0
0
0
0
0
0
0.509091
false
false
11
44973c149588e17dbc5b92bdfaa67176420b942a
24,996,709,715,804
00eda2f94066ff2438611ee97fbed947f57bd120
/src/main/java/com/cenfotec/vitas/domain/enumeration/TipoUsuario.java
3e5751ce0a6217967c2a607510876105b9e9f5e5
[ "Apache-2.0" ]
permissive
ginocenfo/Vitas
https://github.com/ginocenfo/Vitas
e518b53fbe073b821c4f93abf84922c4883ca2df
3d555dfe61f49bed999c050f33cf4c6815f487c8
refs/heads/main
2023-06-12T00:36:27.985000
2021-07-07T22:04:15
2021-07-07T22:04:15
383,206,154
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cenfotec.vitas.domain.enumeration; /** * The TipoUsuario enumeration. */ public enum TipoUsuario { ADMIN, CENTINELA, ASEGURADO, }
UTF-8
Java
157
java
TipoUsuario.java
Java
[]
null
[]
package com.cenfotec.vitas.domain.enumeration; /** * The TipoUsuario enumeration. */ public enum TipoUsuario { ADMIN, CENTINELA, ASEGURADO, }
157
0.694268
0.694268
10
14.7
14.325152
46
false
false
0
0
0
0
0
0
0.4
false
false
11
4e211d1386043ebcb20c7d864bd7c1087463b2c0
15,238,544,014,791
7db8bf068479bc27502e5a6175adc2b627787e98
/src/com/example/TagApplication.java
7a6203d7af3cfd86af714e7fae845d64d694f503
[]
no_license
ap78/SimpleAndroidClient
https://github.com/ap78/SimpleAndroidClient
58dc3940738f46f31479d345400952c7463c7773
725ba4e515c9814b571ae2630c15be1d124e22d8
refs/heads/master
2016-09-16T00:52:35.039000
2011-10-11T05:59:35
2011-10-11T05:59:35
2,553,314
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example; import android.app.Application; import android.content.ContentValues; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.preference.PreferenceManager; import android.util.Log; public class TagApplication extends Application implements OnSharedPreferenceChangeListener { private static final String TRACETAG = TagApplication.class.getSimpleName(); public RESTClient restClient; private SharedPreferences prefs; private boolean serviceRunning; private TagData tagData; public TagData getTagData() { return tagData; } public boolean isServiceRunning() { return serviceRunning; } public void setServiceRunning(boolean serviceRunning) { this.serviceRunning = serviceRunning; } @Override public void onCreate() { super.onCreate(); this.prefs = PreferenceManager.getDefaultSharedPreferences(this); this.prefs.registerOnSharedPreferenceChangeListener(this); tagData = new TagData(this); Log.i(TRACETAG, "onCreated"); } @Override public void onTerminate() { super.onTerminate(); tagData.close(); Log.i(TRACETAG, "onTerminated"); } public synchronized RESTClient getRESTClient() { if (this.restClient == null) { String username = this.prefs.getString("username", ""); String password = this.prefs.getString("password", ""); String apiRoot = prefs.getString("apiRoot", ""); this.restClient = new RESTClient(); // this.restClient.setAPIRootUrl(apiRoot); } return this.restClient; } public synchronized void onSharedPreferenceChanged( SharedPreferences sharedPreferences, String key) { // this.restClient = null; } // Connects to the online service and puts the latest statuses into DB. // Returns the count of new statuses public synchronized void fetchTagUpdates() { // Log.d(TRACETAG, "Fetching status updates"); RESTClient restClient = this.getRESTClient(); if (restClient == null) { Log.d(TRACETAG, "REST connection info not initialized"); return; } try { String dbTestEntry = restClient.callWebService("DBTEST"); ContentValues values = new ContentValues(); values.put(TagData.C_TEXT, dbTestEntry); Log.d(TRACETAG, "Got update: " + dbTestEntry + ". Saving"); this.getTagData().insertOrIgnore(values); } catch (RuntimeException e) { Log.e(TRACETAG, "Failed to fetch status updates", e);; } } }
UTF-8
Java
2,499
java
TagApplication.java
Java
[]
null
[]
package com.example; import android.app.Application; import android.content.ContentValues; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.preference.PreferenceManager; import android.util.Log; public class TagApplication extends Application implements OnSharedPreferenceChangeListener { private static final String TRACETAG = TagApplication.class.getSimpleName(); public RESTClient restClient; private SharedPreferences prefs; private boolean serviceRunning; private TagData tagData; public TagData getTagData() { return tagData; } public boolean isServiceRunning() { return serviceRunning; } public void setServiceRunning(boolean serviceRunning) { this.serviceRunning = serviceRunning; } @Override public void onCreate() { super.onCreate(); this.prefs = PreferenceManager.getDefaultSharedPreferences(this); this.prefs.registerOnSharedPreferenceChangeListener(this); tagData = new TagData(this); Log.i(TRACETAG, "onCreated"); } @Override public void onTerminate() { super.onTerminate(); tagData.close(); Log.i(TRACETAG, "onTerminated"); } public synchronized RESTClient getRESTClient() { if (this.restClient == null) { String username = this.prefs.getString("username", ""); String password = this.prefs.getString("password", ""); String apiRoot = prefs.getString("apiRoot", ""); this.restClient = new RESTClient(); // this.restClient.setAPIRootUrl(apiRoot); } return this.restClient; } public synchronized void onSharedPreferenceChanged( SharedPreferences sharedPreferences, String key) { // this.restClient = null; } // Connects to the online service and puts the latest statuses into DB. // Returns the count of new statuses public synchronized void fetchTagUpdates() { // Log.d(TRACETAG, "Fetching status updates"); RESTClient restClient = this.getRESTClient(); if (restClient == null) { Log.d(TRACETAG, "REST connection info not initialized"); return; } try { String dbTestEntry = restClient.callWebService("DBTEST"); ContentValues values = new ContentValues(); values.put(TagData.C_TEXT, dbTestEntry); Log.d(TRACETAG, "Got update: " + dbTestEntry + ". Saving"); this.getTagData().insertOrIgnore(values); } catch (RuntimeException e) { Log.e(TRACETAG, "Failed to fetch status updates", e);; } } }
2,499
0.721889
0.721889
92
26.163044
24.121197
93
false
false
0
0
0
0
0
0
0.576087
false
false
11
98456aa5085c8929c0f7879494817f89eb1ac501
21,732,534,567,856
b9ef2e4510c27a4303ff30f39f5c4e6f8eb31375
/OS_Lab2/oslab2/Process.java
ff807ab1386fd632d12ae8bb6760ee5cae19b068
[]
no_license
rtolpin/Code
https://github.com/rtolpin/Code
94be0dcfab31813efc9db9c627facc3fdabdf4d1
748646ae48b076613f938b90c4bf0eb7f6dceb4d
refs/heads/master
2021-04-30T07:04:01.872000
2018-08-28T00:19:05
2018-08-28T00:19:05
79,974,481
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package oslab2; import java.util.ArrayList; public class Process { enum Status{READY, RUN, WAIT, TERMINATE}; int id; Status status; Specs specs; int remainingCPU; int turnaroundTime; int blockedTime; int waitTime; int burst; int cycleStart; Boolean paused; //private READY = ""; String toString(Status type) throws Exception{ String res = null; switch(type){ case READY: res = "ready"; break; case RUN: res = "running"; break; case WAIT: res = "blocked"; break; case TERMINATE: res = "terminated"; break; default: throw new Exception("Error: could not parse status of process: " + type); } return res; } public Process (int id, Specs specs){ this.id = id; this.specs = specs; remainingCPU = specs.C; turnaroundTime = 0; blockedTime = 0; waitTime = 0; burst = 0; status = Status.WAIT; cycleStart = specs.A; paused = false; } Boolean aboutToTerminate (int clock){ int cpuBurst = clock - cycleStart; return remainingCPU - cpuBurst <= 0; } int run(int clock, int cpuBurst, int readyTimer) throws Exception{ if(status.equals(Status.READY) && !paused){ waitTime += clock - cycleStart; } else{ throw new Exception("Error: not in Ready state, status=" + status); } cycleStart = clock; status = Status.RUN; turnaroundTime = clock - specs.A; burst = cpuBurst; int act_burst = burst; if (readyTimer > 0) act_burst = Math.min(readyTimer, burst); return clock + Math.min(act_burst, remainingCPU); } int unpause(int clock, int readyTimer) throws Exception{ if(status.equals(Status.READY) && paused) waitTime += clock - cycleStart; else{ throw new Exception("Error: not in Ready state, status=" + status); } paused = false; cycleStart = clock; status = Status.RUN; turnaroundTime = clock - specs.A; int act_burst = burst; if (readyTimer > 0) act_burst = Math.min(readyTimer, burst); return clock + Math.min(act_burst, remainingCPU); } int wait(int clock, int waitBurst) throws Exception{ if(!status.equals(Status.RUN)){ throw new Exception("Error: not in Ready state, status=" + status); } int cpuBurst = clock - cycleStart; remainingCPU = Math.max(remainingCPU - cpuBurst, 0); if(remainingCPU == 0){ status = Status.TERMINATE; waitBurst = 0; } else if(waitBurst > 0){ status = Status.WAIT; burst = waitBurst; } else if(waitBurst == 0){ burst -= clock - cycleStart; status = Status.READY; paused = true; } cycleStart = clock; turnaroundTime = clock - specs.A; return clock + waitBurst; } void ready(int clock) throws Exception{ if(status.equals(Status.WAIT)){ blockedTime += clock - cycleStart; } else{ throw new Exception("Error: not in Waiting state, status=" + status); } cycleStart = clock; status = Status.READY; turnaroundTime = clock - specs.A; burst = 0; } int remainingBurst(int clock){ int remBurst = 0; if(status.equals(Status.WAIT) || status.equals(Status.RUN)){ remBurst = burst - clock + 1 + cycleStart; } else if(paused){ remBurst = burst; } return remBurst; } int finishTime() throws Exception{ if(!status.equals(Status.TERMINATE)){ throw new Exception("Error: not in Terminate state, status=" + status); } return specs.A + turnaroundTime; } void print(){ int[] numArr = {specs.A, specs.B, specs.C, specs.IO}; System.out.println("\nProcess " + Integer.toString(id) + ":"); String line = "(A,B,C,IO) = ("; for(int i = 0; i < numArr.length; ++i){ line += Integer.toString(numArr[i]) + (i < numArr.length - 1 ? " ":")"); } System.out.println(line); System.out.println("\tFinishing time: " + Integer.toString(specs.A + turnaroundTime)); System.out.println("\tTurnaround time: " + Integer.toString(turnaroundTime)); System.out.println("\tI/O time: " + Integer.toString(blockedTime)); System.out.println("\tWaiting time: " + Integer.toString(waitTime)); } }
UTF-8
Java
3,970
java
Process.java
Java
[]
null
[]
package oslab2; import java.util.ArrayList; public class Process { enum Status{READY, RUN, WAIT, TERMINATE}; int id; Status status; Specs specs; int remainingCPU; int turnaroundTime; int blockedTime; int waitTime; int burst; int cycleStart; Boolean paused; //private READY = ""; String toString(Status type) throws Exception{ String res = null; switch(type){ case READY: res = "ready"; break; case RUN: res = "running"; break; case WAIT: res = "blocked"; break; case TERMINATE: res = "terminated"; break; default: throw new Exception("Error: could not parse status of process: " + type); } return res; } public Process (int id, Specs specs){ this.id = id; this.specs = specs; remainingCPU = specs.C; turnaroundTime = 0; blockedTime = 0; waitTime = 0; burst = 0; status = Status.WAIT; cycleStart = specs.A; paused = false; } Boolean aboutToTerminate (int clock){ int cpuBurst = clock - cycleStart; return remainingCPU - cpuBurst <= 0; } int run(int clock, int cpuBurst, int readyTimer) throws Exception{ if(status.equals(Status.READY) && !paused){ waitTime += clock - cycleStart; } else{ throw new Exception("Error: not in Ready state, status=" + status); } cycleStart = clock; status = Status.RUN; turnaroundTime = clock - specs.A; burst = cpuBurst; int act_burst = burst; if (readyTimer > 0) act_burst = Math.min(readyTimer, burst); return clock + Math.min(act_burst, remainingCPU); } int unpause(int clock, int readyTimer) throws Exception{ if(status.equals(Status.READY) && paused) waitTime += clock - cycleStart; else{ throw new Exception("Error: not in Ready state, status=" + status); } paused = false; cycleStart = clock; status = Status.RUN; turnaroundTime = clock - specs.A; int act_burst = burst; if (readyTimer > 0) act_burst = Math.min(readyTimer, burst); return clock + Math.min(act_burst, remainingCPU); } int wait(int clock, int waitBurst) throws Exception{ if(!status.equals(Status.RUN)){ throw new Exception("Error: not in Ready state, status=" + status); } int cpuBurst = clock - cycleStart; remainingCPU = Math.max(remainingCPU - cpuBurst, 0); if(remainingCPU == 0){ status = Status.TERMINATE; waitBurst = 0; } else if(waitBurst > 0){ status = Status.WAIT; burst = waitBurst; } else if(waitBurst == 0){ burst -= clock - cycleStart; status = Status.READY; paused = true; } cycleStart = clock; turnaroundTime = clock - specs.A; return clock + waitBurst; } void ready(int clock) throws Exception{ if(status.equals(Status.WAIT)){ blockedTime += clock - cycleStart; } else{ throw new Exception("Error: not in Waiting state, status=" + status); } cycleStart = clock; status = Status.READY; turnaroundTime = clock - specs.A; burst = 0; } int remainingBurst(int clock){ int remBurst = 0; if(status.equals(Status.WAIT) || status.equals(Status.RUN)){ remBurst = burst - clock + 1 + cycleStart; } else if(paused){ remBurst = burst; } return remBurst; } int finishTime() throws Exception{ if(!status.equals(Status.TERMINATE)){ throw new Exception("Error: not in Terminate state, status=" + status); } return specs.A + turnaroundTime; } void print(){ int[] numArr = {specs.A, specs.B, specs.C, specs.IO}; System.out.println("\nProcess " + Integer.toString(id) + ":"); String line = "(A,B,C,IO) = ("; for(int i = 0; i < numArr.length; ++i){ line += Integer.toString(numArr[i]) + (i < numArr.length - 1 ? " ":")"); } System.out.println(line); System.out.println("\tFinishing time: " + Integer.toString(specs.A + turnaroundTime)); System.out.println("\tTurnaround time: " + Integer.toString(turnaroundTime)); System.out.println("\tI/O time: " + Integer.toString(blockedTime)); System.out.println("\tWaiting time: " + Integer.toString(waitTime)); } }
3,970
0.657431
0.652897
163
23.343557
20.513763
88
false
false
0
0
0
0
0
0
2.552147
false
false
11
abf47e16992c2bbc12f1b145752a34dfd67a2d52
23,871,428,291,091
1668b42aa9a23c444a0cd144c736ba9d8801b2f5
/Laborator8 - Decorator Composite Flyweight/src/ro/ase/csie/cts/g1088/dp/decorator/Dragon.java
4b9028aaed1ec98ea62c5d76d8157103fb9c2f57
[]
no_license
demiliaa/CTS_seminarii
https://github.com/demiliaa/CTS_seminarii
1ba30a5bc1e045bd46b3c1f41d2ee1896d1fd8df
791eec5ebd2b5d7ccc34a9faa83a8492e29eb07c
refs/heads/main
2023-05-14T05:58:17.699000
2021-06-06T11:54:02
2021-06-06T11:54:02
342,210,314
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ro.ase.csie.cts.g1088.dp.decorator; public class Dragon { @Override public void alearga() { System.out.println("zboara catre o noua destinatie"); } @Override public void esteLovit(int puncte) { System.out.println(String.format("%s este lovit si pierde %d puncte", this.nume, puncte)); this.puncteViata -= puncte; } @Override public void seVindeca(int puncte) { System.out.println(String.format("%s este lovit si recupereaza %d puncte", this.nume, puncte)); this.puncteViata += puncte; } }
UTF-8
Java
520
java
Dragon.java
Java
[]
null
[]
package ro.ase.csie.cts.g1088.dp.decorator; public class Dragon { @Override public void alearga() { System.out.println("zboara catre o noua destinatie"); } @Override public void esteLovit(int puncte) { System.out.println(String.format("%s este lovit si pierde %d puncte", this.nume, puncte)); this.puncteViata -= puncte; } @Override public void seVindeca(int puncte) { System.out.println(String.format("%s este lovit si recupereaza %d puncte", this.nume, puncte)); this.puncteViata += puncte; } }
520
0.715385
0.707692
21
23.761906
28.025337
97
false
false
0
0
0
0
0
0
1.380952
false
false
11
051c015b267020af053b1e6bf4bfb5f134317782
21,517,786,200,324
f6a4dac379124c1e126613014b42b3c6bd4c5ba5
/src/com/ideaplaystudio/weather/MainActivity.java
600512521e32ac17a14d5ce66ea170034059ca8d
[]
no_license
luthfihariz/Cuancuk
https://github.com/luthfihariz/Cuancuk
e0c0e7484ef04fc8b7674d30ed28e939837be78e
ce73e3b047a9a1c39cbca18cf04661b78708abd4
refs/heads/master
2015-07-13T11:53:34
2013-06-15T10:10:11
2013-06-15T10:10:11
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ideaplaystudio.weather; import java.io.IOException; import org.apache.http.client.ClientProtocolException; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.content.Context; import android.location.Criteria; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ProgressBar; import android.widget.TextView; public class MainActivity extends Activity implements LocationListener { TextView locationView; TextView weatherView; TextView temperatureView; LocationManager locManager; String provider; ProgressBar progressBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); locationView = (TextView) findViewById(R.id.city); weatherView = (TextView) findViewById(R.id.weather); temperatureView = (TextView) findViewById(R.id.temp); progressBar = (ProgressBar) findViewById(R.id.progressBar1); // Get the location manager locManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); provider = locManager.getBestProvider(criteria, false); Location myLoc = locManager.getLastKnownLocation(provider); if (myLoc != null) { Log.d(Utils.TAG, "provider : " + provider); onLocationChanged(myLoc); } } @Override protected void onResume() { super.onResume(); } @Override protected void onPause() { super.onPause(); locManager.removeUpdates(this); } class AsyncGetWeatherTask extends AsyncTask<String, Void, Weather> { @Override protected void onPreExecute() { super.onPreExecute(); progressBar.setVisibility(View.VISIBLE); } @Override protected Weather doInBackground(String... params) { String res, country, city = null; JSONObject obj = null; JSONArray arr = null; Weather currentWeather = null; try { Utils.log("Searching for the nearest station..."); obj = Api.getNearestStation(params[0]); Utils.log("Response : " + obj.toString()); arr = obj.getJSONObject("location") .getJSONObject("nearby_weather_stations") .getJSONObject("pws").getJSONArray("station"); obj = arr.getJSONObject(0); Utils.log("Country : " + obj.getString("country")); country = obj.getString("country"); city = obj.getString("city"); obj = Api.getCurrentWeather(country, city); JSONObject currentObservation = obj .getJSONObject("current_observation"); JSONObject forecast = obj.getJSONObject("forecast"); String displayLoc = currentObservation.getJSONObject( "display_location").getString("full"); String weather = currentObservation.getString("weather"); String temp = currentObservation .getString("temperature_string"); currentWeather = new Weather(weather, displayLoc, temp, city, country); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } return currentWeather; } @Override protected void onPostExecute(Weather weather) { progressBar.setVisibility(View.INVISIBLE); super.onPostExecute(weather); locationView.setText(weather.getDisplayLocation()); weatherView.setText(weather.getWeather()); temperatureView.setText(weather.getTemp()); } } @Override public void onLocationChanged(Location location) { String coordinate = location.getLatitude() + "," + location.getLongitude(); new AsyncGetWeatherTask().execute(coordinate); } @Override public void onProviderDisabled(String provider) { } @Override public void onProviderEnabled(String provider) { } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } }
UTF-8
Java
3,999
java
MainActivity.java
Java
[]
null
[]
package com.ideaplaystudio.weather; import java.io.IOException; import org.apache.http.client.ClientProtocolException; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.content.Context; import android.location.Criteria; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ProgressBar; import android.widget.TextView; public class MainActivity extends Activity implements LocationListener { TextView locationView; TextView weatherView; TextView temperatureView; LocationManager locManager; String provider; ProgressBar progressBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); locationView = (TextView) findViewById(R.id.city); weatherView = (TextView) findViewById(R.id.weather); temperatureView = (TextView) findViewById(R.id.temp); progressBar = (ProgressBar) findViewById(R.id.progressBar1); // Get the location manager locManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); provider = locManager.getBestProvider(criteria, false); Location myLoc = locManager.getLastKnownLocation(provider); if (myLoc != null) { Log.d(Utils.TAG, "provider : " + provider); onLocationChanged(myLoc); } } @Override protected void onResume() { super.onResume(); } @Override protected void onPause() { super.onPause(); locManager.removeUpdates(this); } class AsyncGetWeatherTask extends AsyncTask<String, Void, Weather> { @Override protected void onPreExecute() { super.onPreExecute(); progressBar.setVisibility(View.VISIBLE); } @Override protected Weather doInBackground(String... params) { String res, country, city = null; JSONObject obj = null; JSONArray arr = null; Weather currentWeather = null; try { Utils.log("Searching for the nearest station..."); obj = Api.getNearestStation(params[0]); Utils.log("Response : " + obj.toString()); arr = obj.getJSONObject("location") .getJSONObject("nearby_weather_stations") .getJSONObject("pws").getJSONArray("station"); obj = arr.getJSONObject(0); Utils.log("Country : " + obj.getString("country")); country = obj.getString("country"); city = obj.getString("city"); obj = Api.getCurrentWeather(country, city); JSONObject currentObservation = obj .getJSONObject("current_observation"); JSONObject forecast = obj.getJSONObject("forecast"); String displayLoc = currentObservation.getJSONObject( "display_location").getString("full"); String weather = currentObservation.getString("weather"); String temp = currentObservation .getString("temperature_string"); currentWeather = new Weather(weather, displayLoc, temp, city, country); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } return currentWeather; } @Override protected void onPostExecute(Weather weather) { progressBar.setVisibility(View.INVISIBLE); super.onPostExecute(weather); locationView.setText(weather.getDisplayLocation()); weatherView.setText(weather.getWeather()); temperatureView.setText(weather.getTemp()); } } @Override public void onLocationChanged(Location location) { String coordinate = location.getLatitude() + "," + location.getLongitude(); new AsyncGetWeatherTask().execute(coordinate); } @Override public void onProviderDisabled(String provider) { } @Override public void onProviderEnabled(String provider) { } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } }
3,999
0.737684
0.736934
143
26.965034
20.605999
76
false
false
0
0
0
0
0
0
2.356643
false
false
11
3f9428e8b491ef13b0f01bba5d39cd296cd45d6c
15,075,335,257,535
2a1609bb2fd757a7de82a9d9fa29464a222c83bd
/desktop/github/CCMTV_AR_SHISHAN/app/src/main/java/com/linlic/ccmtv/yx/utils/GalleryAdapter.java
b605abae4a25741a10c98bfcf8413a6a2326e367
[]
no_license
sunlightAndroid/CCMTV
https://github.com/sunlightAndroid/CCMTV
970e7339f0099cbe3573eae1a2b07e3215c95ac2
bb5201a2caf2a81f6ba4112d7f2b01c38323d12d
refs/heads/master
2020-06-21T16:39:54.467000
2019-12-11T12:23:27
2019-12-11T12:23:27
197,503,739
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.linlic.ccmtv.yx.utils; /** * Created by Administrator on 2016/7/8. */ import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.linlic.ccmtv.yx.R; import java.util.List; public class GalleryAdapter extends RecyclerView.Adapter<GalleryAdapter.ViewHolder> { /** * ItemClick的回调接口 * @author zhy * */ public interface OnItemClickLitener { void onItemClick(View view, int position); } private OnItemClickLitener mOnItemClickLitener; public void setOnItemClickLitener(OnItemClickLitener mOnItemClickLitener) { this.mOnItemClickLitener = mOnItemClickLitener; } private LayoutInflater mInflater; private List<Video_menu_expert> mDatas; public GalleryAdapter(Context context, List<Video_menu_expert> datats) { mInflater = LayoutInflater.from(context); mDatas = datats; } public static class ViewHolder extends RecyclerView.ViewHolder { public ViewHolder(View arg0) { super(arg0); } private TextView department_id; private TextView title ; private TextView tv_ks ; private TextView tv_zc ; private ImageView im; } @Override public int getItemCount() { return mDatas.size(); } /** * 创建ViewHolder */ @Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View view = mInflater.inflate(R.layout.horizontallistview_item2, viewGroup, false); ViewHolder viewHolder = new ViewHolder(view); viewHolder.im = (ImageView) view .findViewById(R.id.iv_pic); viewHolder.title = (TextView) view .findViewById(R.id.tv_name); viewHolder.department_id = (TextView) view .findViewById(R.id.department_id); viewHolder.tv_ks = (TextView) view .findViewById(R.id.tv_ks); viewHolder.tv_zc = (TextView) view .findViewById(R.id.tv_zc); return viewHolder; } /** * 设置值 */ @Override public void onBindViewHolder(final ViewHolder viewHolder, final int i) { loadImg(viewHolder.im, mDatas.get(i).getVideo_menu_expert_img()); viewHolder.title.setText(mDatas.get(i).getVideo_menu_expert_name()); viewHolder.department_id.setText(mDatas.get(i).getVideo_menu_expert_id()); viewHolder.tv_ks.setText(mDatas.get(i).getVideo_menu_expert_keywords()); viewHolder.tv_zc.setText(mDatas.get(i).getVideo_menu_expert_smalltitle()); //如果设置了回调,则设置点击事件 if (mOnItemClickLitener != null) { viewHolder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mOnItemClickLitener.onItemClick(viewHolder.itemView, i); } }); } } /** * name:使用xutils 夹在图片 author:Tom 2016-1-7下午1:28:03 * * @param img 图片控件 * @param path 图片网络地址 */ public void loadImg(ImageView img, String path) { XUtilsImageLoader xUtilsImageLoader = new XUtilsImageLoader(img.getContext()); xUtilsImageLoader.display(img, FirstLetter.getSpells(path)); } }
UTF-8
Java
3,615
java
GalleryAdapter.java
Java
[ { "context": "r>\n{\n\n /**\n * ItemClick的回调接口\n * @author zhy\n *\n */\n public interface OnItemClickLi", "end": 522, "score": 0.9996418952941895, "start": 519, "tag": "USERNAME", "value": "zhy" }, { "context": " }\n }\n /**\n * name:使用xutils 夹在图片 author:Tom 2016-1-7下午1:28:03\n *\n * @param img 图片控件\n", "end": 3227, "score": 0.9975253343582153, "start": 3224, "tag": "NAME", "value": "Tom" } ]
null
[]
package com.linlic.ccmtv.yx.utils; /** * Created by Administrator on 2016/7/8. */ import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.linlic.ccmtv.yx.R; import java.util.List; public class GalleryAdapter extends RecyclerView.Adapter<GalleryAdapter.ViewHolder> { /** * ItemClick的回调接口 * @author zhy * */ public interface OnItemClickLitener { void onItemClick(View view, int position); } private OnItemClickLitener mOnItemClickLitener; public void setOnItemClickLitener(OnItemClickLitener mOnItemClickLitener) { this.mOnItemClickLitener = mOnItemClickLitener; } private LayoutInflater mInflater; private List<Video_menu_expert> mDatas; public GalleryAdapter(Context context, List<Video_menu_expert> datats) { mInflater = LayoutInflater.from(context); mDatas = datats; } public static class ViewHolder extends RecyclerView.ViewHolder { public ViewHolder(View arg0) { super(arg0); } private TextView department_id; private TextView title ; private TextView tv_ks ; private TextView tv_zc ; private ImageView im; } @Override public int getItemCount() { return mDatas.size(); } /** * 创建ViewHolder */ @Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View view = mInflater.inflate(R.layout.horizontallistview_item2, viewGroup, false); ViewHolder viewHolder = new ViewHolder(view); viewHolder.im = (ImageView) view .findViewById(R.id.iv_pic); viewHolder.title = (TextView) view .findViewById(R.id.tv_name); viewHolder.department_id = (TextView) view .findViewById(R.id.department_id); viewHolder.tv_ks = (TextView) view .findViewById(R.id.tv_ks); viewHolder.tv_zc = (TextView) view .findViewById(R.id.tv_zc); return viewHolder; } /** * 设置值 */ @Override public void onBindViewHolder(final ViewHolder viewHolder, final int i) { loadImg(viewHolder.im, mDatas.get(i).getVideo_menu_expert_img()); viewHolder.title.setText(mDatas.get(i).getVideo_menu_expert_name()); viewHolder.department_id.setText(mDatas.get(i).getVideo_menu_expert_id()); viewHolder.tv_ks.setText(mDatas.get(i).getVideo_menu_expert_keywords()); viewHolder.tv_zc.setText(mDatas.get(i).getVideo_menu_expert_smalltitle()); //如果设置了回调,则设置点击事件 if (mOnItemClickLitener != null) { viewHolder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mOnItemClickLitener.onItemClick(viewHolder.itemView, i); } }); } } /** * name:使用xutils 夹在图片 author:Tom 2016-1-7下午1:28:03 * * @param img 图片控件 * @param path 图片网络地址 */ public void loadImg(ImageView img, String path) { XUtilsImageLoader xUtilsImageLoader = new XUtilsImageLoader(img.getContext()); xUtilsImageLoader.display(img, FirstLetter.getSpells(path)); } }
3,615
0.626523
0.620572
129
26.364342
24.340904
86
false
false
0
0
0
0
0
0
0.395349
false
false
11
e812d7e7fd7b8bc504216716b3a1cc6ccbf2ea38
5,153,960,815,956
4029264e06c1b80ea78c6a692acbd4248b16b300
/app/src/main/java/com/VURVhealth/vurvhealth/authentication/VURVHealthIDCreateActivity.java
e390efc3e14442ffef00394c459af825263c2255
[]
no_license
kiran0912/VURVhealth-A-New
https://github.com/kiran0912/VURVhealth-A-New
71d91023cab86f7cc2fc7a709905a38ef3b2497f
f1fd3f98d829f04871c8a669f53c46b98275e3bc
refs/heads/master
2023-06-12T15:40:33.161000
2021-07-01T10:34:05
2021-07-01T10:34:05
362,692,204
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.VURVhealth.vurvhealth.authentication; import android.app.DatePickerDialog; import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.view.Gravity; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.DatePicker; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.VURVhealth.vurvhealth.retrofit.Application_holder; import com.VURVhealth.vurvhealth.R; import com.VURVhealth.vurvhealth.StartScreenActivity; import com.VURVhealth.vurvhealth.authentication.registrationPojo.RegistrationResPayLoad; import com.VURVhealth.vurvhealth.authentication.vurvIdPojos.VurvIdReqPayLoad; import com.VURVhealth.vurvhealth.authentication.vurvIdPojos.VurvIdResPayLoad; import com.VURVhealth.vurvhealth.retrofit.ApiClient; import com.VURVhealth.vurvhealth.retrofit.ApiInterface; import com.VURVhealth.vurvhealth.superappcompact.SuperAppCompactActivity; import org.json.JSONObject; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.Locale; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; /** * Created by yqlabs on 1/12/16. */ public class VURVHealthIDCreateActivity extends SuperAppCompactActivity { private static final String TAG = VURVHealthIDCreateActivity.class.getSimpleName(); private EditText tvFirstName, tvMiddleName, tvlastName; private TextView text_hint; private Button btn_done, btn_done_active, tvDoB; private CheckBox chkMale, chkFemale; private ImageView backBtn; private String firstName, lastName, dob, middlename; private String email,userName, password, nonceValue; private SharedPreferences sharedPreferences; private SharedPreferences.Editor editor; public RegistrationResPayLoad registrationResPayLoad; private Calendar myCalendar; private VurvIdResPayLoad vurvIdResPayLoads; String dobFormat; /** Called when the activity is first created. */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.vurvhealthid_create_screen); tvFirstName = (EditText) findViewById(R.id.tvFirstName); tvMiddleName = (EditText) findViewById(R.id.tvMiddleName); tvlastName = (EditText) findViewById(R.id.tvlastName); tvDoB = (Button) findViewById(R.id.tvDoB); btn_done = (Button) findViewById(R.id.btn_done); btn_done_active = (Button) findViewById(R.id.btn_done_active); chkMale = (CheckBox) findViewById(R.id.chkMale); chkFemale = (CheckBox) findViewById(R.id.chkFemale); backBtn = (ImageView) findViewById(R.id.backBtn); text_hint = (TextView) findViewById(R.id.text_hint); //adding text watcher for the fields tvFirstName.addTextChangedListener(textWatcher); tvlastName.addTextChangedListener(textWatcher); tvDoB.addTextChangedListener(textWatcher); checkFieldsForEmptyValues(); //get the calender instance myCalendar = Calendar.getInstance(); //add text watcher for middle name for optional text tvMiddleName.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (tvMiddleName.getText().toString().length() == 0) { text_hint.setVisibility(View.VISIBLE); } else text_hint.setVisibility(View.GONE); } @Override public void afterTextChanged(Editable s) { } }); // setting the date picker dialog here final DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() { final long today = System.currentTimeMillis() - 1000; @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { // TODO Auto-generated method stub myCalendar.set(Calendar.YEAR, year); myCalendar.set(Calendar.MONTH, monthOfYear); myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); if (myCalendar.getTimeInMillis() >= today) { //Make them try again tvDoB.setText(""); Toast.makeText(getApplicationContext(), "Invalid date, please try again", Toast.LENGTH_LONG).show(); } else { updateLabel(); } } }; if (getIntent() != null) { if (getIntent().getStringExtra("mobile") != null){ userName = getIntent().getStringExtra("mobile"); email = getIntent().getStringExtra("mobile") + "@vurvhealth.com"; }else { email = getIntent().getStringExtra("email"); String[] usernameEmail = email.split("@"); userName = usernameEmail[0]; Application_holder.userEmail = email; } password = getIntent().getStringExtra("password"); nonceValue = getIntent().getStringExtra("nonceValue"); } chkMale.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { chkFemale.setChecked(false); SharedPreferences settings = getSharedPreferences(Application_holder.LOGIN_PREFERENCES, 0); settings.edit().putBoolean("check",true).commit(); } } }); chkFemale.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { chkMale.setChecked(false); SharedPreferences settings = getSharedPreferences(Application_holder.LOGIN_PREFERENCES, 0); settings.edit().putBoolean("check",true).commit(); } } }); //When button is clicked tvDoB.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DatePickerDialog dialog = new DatePickerDialog(VURVHealthIDCreateActivity.this, date, myCalendar .get(Calendar.YEAR), myCalendar.get(Calendar.MONTH), myCalendar.get(Calendar.DAY_OF_MONTH)); dialog.getDatePicker().setMaxDate(new Date().getTime()); // dialog.getDatePicker().setMaxDate(System.currentTimeMillis()); dialog.show(); } }); //When button is clicked backBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); //When button is clicked btn_done_active.setOnClickListener(new View.OnClickListener() { //Run when button is clicked @Override public void onClick(View v) { firstName = tvFirstName.getText().toString().trim(); middlename = tvMiddleName.getText().toString().trim(); lastName = tvlastName.getText().toString().trim(); dob = tvDoB.getText().toString(); try { SimpleDateFormat dt = new SimpleDateFormat("MM-dd-yyyy"); Date date = dt.parse(dob); SimpleDateFormat sm = new SimpleDateFormat("yyyy-MM-dd"); dobFormat = sm.format(date); } catch (Exception e) { e.printStackTrace(); } StringBuffer result = new StringBuffer(); if (firstName.length() == 0) { Toast.makeText(VURVHealthIDCreateActivity.this, "Please enter first name", Toast.LENGTH_SHORT).show(); } else if (tvFirstName.getText().toString().trim().length() < 3 || tvFirstName.getText().toString().trim().length() > 25) { Toast.makeText(VURVHealthIDCreateActivity.this, "Please enter minimum 3 and maximum 25 characters", Toast.LENGTH_SHORT).show(); } else if (lastName.length() == 0) { Toast.makeText(VURVHealthIDCreateActivity.this, "Please enter last name", Toast.LENGTH_SHORT).show(); } else if (dob.length() == 0) { Toast.makeText(VURVHealthIDCreateActivity.this, "Please enter Date of Birth (MM/ DD/ YY)", Toast.LENGTH_SHORT).show(); } else if ((!chkMale.isChecked() && !chkFemale.isChecked()) || (chkFemale.isChecked() && chkMale.isChecked())) { Toast.makeText(VURVHealthIDCreateActivity.this, "Please select gender", Toast.LENGTH_SHORT).show(); } else { if (checkInternet()) { //Here, we are calling register service getRegistrationService(userName, password, email, nonceValue, firstName, "yes", "cool"); } else { Toast.makeText(VURVHealthIDCreateActivity.this, getResources().getString(R.string.no_network), Toast.LENGTH_SHORT).show(); } } } }); } //set the date format here private void updateLabel() { String myFormat = "MM-dd-yyyy"; //In which format need to put here // String myFormat = "yyyy-MM-dd"; //In which format need to put here SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.US); tvDoB.setText(sdf.format(myCalendar.getTime())); } // Consuming Register service here private void getRegistrationService(String username, final String password,final String email, final String nonceValue, String firstName, String notify, String insecure) { try { showProgressDialog(VURVHealthIDCreateActivity.this); ApiInterface apiService = ApiClient.getClient(VURVHealthIDCreateActivity.this).create(ApiInterface.class); Call<RegistrationResPayLoad> call = apiService.getRegistration(username, password, email, nonceValue, firstName/*, notify, insecure*/); call.enqueue(new Callback<RegistrationResPayLoad>() { @Override public void onResponse(Call<RegistrationResPayLoad> call, Response<RegistrationResPayLoad> response) { if (response.isSuccessful()) { registrationResPayLoad = response.body(); // dismissProgressDialog(); if (checkInternet()) { //Calling the VURVID service for vurvid creation getVURVIDService(); } else { Toast.makeText(VURVHealthIDCreateActivity.this, getResources().getString(R.string.no_network), Toast.LENGTH_SHORT).show(); } } else { dismissProgressDialog(); try { JSONObject jObjError = new JSONObject(response.errorBody().string()); if (jObjError.getString("error").equalsIgnoreCase("Username already exists.")){ if (email.equalsIgnoreCase(getIntent().getStringExtra("mobile") + "@vurvhealth.com")) Toast.makeText(getApplicationContext(), "Mobile Number already exists.", Toast.LENGTH_LONG).show(); else Toast.makeText(getApplicationContext(), "Email already exists.", Toast.LENGTH_LONG).show(); }else { Toast.makeText(getApplicationContext(), jObjError.getString("error"), Toast.LENGTH_LONG).show(); } } catch (Exception e) { Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); } } } @Override public void onFailure(Call<RegistrationResPayLoad> call, Throwable t) { Log.e(TAG, t.toString()); dismissProgressDialog(); Toast.makeText(VURVHealthIDCreateActivity.this, getResources().getString(R.string.server_not_found), Toast.LENGTH_SHORT).show(); } }); } catch (Exception e) { Log.v(TAG, e.getMessage()); } } // Consuming VURVID service here private void getVURVIDService() { try { // showProgressDialog(VURVHealthIDCreateActivity.this); String user_Id = registrationResPayLoad.getUserId(); ApiInterface apiService = ApiClient.getClient(VURVHealthIDCreateActivity.this).create(ApiInterface.class); VurvIdReqPayLoad vurvIdReqPayLoad = new VurvIdReqPayLoad(); vurvIdReqPayLoad.setId(user_Id); vurvIdReqPayLoad.setDisplayName(firstName + " " + lastName); vurvIdReqPayLoad.setMiddleName(middlename); vurvIdReqPayLoad.setDateOfBirth(dobFormat); vurvIdReqPayLoad.setGender(chkMale.isChecked() ? "M" : "F"); vurvIdReqPayLoad.setUserNicename(firstName); vurvIdReqPayLoad.setFirstName(firstName); vurvIdReqPayLoad.setLastName(lastName); ArrayList<VurvIdReqPayLoad> listVurv = new ArrayList<>(); listVurv.add(vurvIdReqPayLoad); Call<VurvIdResPayLoad> call = apiService.getVURVIDService(listVurv); call.enqueue(new Callback<VurvIdResPayLoad>() { @Override public void onResponse(Call<VurvIdResPayLoad> call, Response<VurvIdResPayLoad> response) { if (response.isSuccessful()) { vurvIdResPayLoads = response.body(); dismissProgressDialog(); sharedPreferences = getSharedPreferences(Application_holder.LOGIN_PREFERENCES, Context.MODE_PRIVATE); editor = sharedPreferences.edit(); editor.putString("firstName", vurvIdResPayLoads.getSubscriberDetail().get(0).getFirstName()); editor.putString("lastName",vurvIdResPayLoads.getSubscriberDetail().get(0).getLastName()); editor.putString("fullName", vurvIdResPayLoads.getSubscriberDetail().get(0).getFirstName()+" "+vurvIdResPayLoads.getSubscriberDetail().get(0).getLastName()); editor.putString("email", vurvIdResPayLoads.getUserDetail().get(0).getUserEmail()); editor.putString("vurvId", vurvIdResPayLoads.getSubscriberDetail().get(0).getMemberId()); editor.putInt("userId", Integer.parseInt(vurvIdResPayLoads.getSubscriberDetail().get(0).getUserId())); if(vurvIdResPayLoads.getSubscriberDetail().get(0).getMobileNo()!=null) { editor.putString("mobileNo", vurvIdResPayLoads.getSubscriberDetail().get(0).getMobileNo().equals("0") ? vurvIdResPayLoads.getUserDetail().get(0).getUserLogin() : vurvIdResPayLoads.getSubscriberDetail().get(0).getMobileNo()); }else { editor.putString("mobileNo", vurvIdResPayLoads.getSubscriberDetail().get(0).getMobileNo() == null ? vurvIdResPayLoads.getUserDetail().get(0).getUserLogin() : vurvIdResPayLoads.getSubscriberDetail().get(0).getMobileNo()); } editor.putString("dob", vurvIdResPayLoads.getSubscriberDetail().get(0).getDateOfBirth()); editor.putString("gender", vurvIdResPayLoads.getSubscriberDetail().get(0).getGender()); editor.putString("address1", vurvIdResPayLoads.getSubscriberDetail().get(0).getAddress1()); editor.putString("address2", vurvIdResPayLoads.getSubscriberDetail().get(0).getAddress2()); editor.putString("city", vurvIdResPayLoads.getSubscriberDetail().get(0).getCity()); editor.putString("stateName", vurvIdResPayLoads.getSubscriberDetail().get(0).getState()); editor.putString("zipCode", vurvIdResPayLoads.getSubscriberDetail().get(0).getZipcode()); editor.putString("zip4Code", vurvIdResPayLoads.getSubscriberDetail().get(0).getZipFourCode()); editor.putString("country", vurvIdResPayLoads.getSubscriberDetail().get(0).getCountry()); editor.putString("packageId", vurvIdResPayLoads.getSubscriberDetail().get(0).getPackageId()); editor.putString("packageName", vurvIdResPayLoads.getSubscriberDetail().get(0).getName()); editor.putString("subPackageId", vurvIdResPayLoads.getSubscriberDetail().get(0).getSubPackageId()); if(vurvIdResPayLoads.getSubscriberDetail().get(0).getOrderId()!=null) editor.putString("orderId", vurvIdResPayLoads.getSubscriberDetail().get(0).getOrderId()); editor.putString("logout", ""); editor.commit(); welComeDialog(); } else { dismissProgressDialog(); Toast.makeText(VURVHealthIDCreateActivity.this, getResources().getString(R.string.server_not_found), Toast.LENGTH_SHORT).show(); } Log.d(TAG, "Number of movies received: "); } @Override public void onFailure(Call<VurvIdResPayLoad> call, Throwable t) { // Log error here since request failed Log.e(TAG, t.toString()); dismissProgressDialog(); Toast.makeText(VURVHealthIDCreateActivity.this, getResources().getString(R.string.server_not_found), Toast.LENGTH_SHORT).show(); } }); } catch (Exception e) { e.getMessage(); } } //TextWatcher to handle the empty fields private TextWatcher textWatcher = new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { checkFieldsForEmptyValues(); } @Override public void afterTextChanged(Editable editable) { } }; //checking the empty fields here private void checkFieldsForEmptyValues() { firstName = tvFirstName.getText().toString(); lastName = tvlastName.getText().toString(); dob = tvDoB.getText().toString(); if (!firstName.equals("") && !lastName.equals("") && !dob.equals("")) { btn_done_active.setVisibility(View.VISIBLE); btn_done.setVisibility(View.GONE); btn_done.setEnabled(false); btn_done_active.setEnabled(true); } else { btn_done_active.setVisibility(View.GONE); btn_done.setVisibility(View.VISIBLE); btn_done_active.setEnabled(false); btn_done.setEnabled(true); } } //show the confirmation popup private void welComeDialog() { final Dialog customDialog = new Dialog(VURVHealthIDCreateActivity.this); customDialog.setCancelable(false); customDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); customDialog.setContentView(R.layout.confirmation_popup); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); lp.copyFrom(customDialog.getWindow().getAttributes()); lp.width = WindowManager.LayoutParams.MATCH_PARENT; lp.height = WindowManager.LayoutParams.WRAP_CONTENT; lp.gravity = Gravity.CENTER; final Button btn_ok = (Button) customDialog.findViewById(R.id.okBtn); final TextView tvName = (TextView) customDialog.findViewById(R.id.tvName); final TextView name = (TextView) customDialog.findViewById(R.id.name); final TextView vurvId = (TextView) customDialog.findViewById(R.id.vurv_id); tvName.setText(" "+firstName+"!"); name.setText(firstName +" "+lastName); //vurvId.setText("VURV ID: "+vurvIdResPayLoads.getSubscriberDetail().get(0).getMemberId()); /*srikanth*/ try { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(vurvIdResPayLoads.getSubscriberDetail().get(0).getMemberId().substring(0, 4)); stringBuilder.append("-"); stringBuilder.append(vurvIdResPayLoads.getSubscriberDetail().get(0).getMemberId().substring(4, 7)); stringBuilder.append("-"); stringBuilder.append(vurvIdResPayLoads.getSubscriberDetail().get(0).getMemberId().substring(7, 11)); vurvId.setText("VURV ID: " + stringBuilder); } catch (ArrayIndexOutOfBoundsException e2) { vurvId.setText("VURV ID: " + vurvIdResPayLoads.getSubscriberDetail().get(0).getMemberId()); } /* SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString("emailId", vurvIdResPayLoads.getUserDetail().get(0).getUserEmail()); editor.putString("firstName", vurvIdResPayLoads.getSubscriberDetail().get(0).getFirstName()); editor.putString("gender", vurvIdResPayLoads.getSubscriberDetail().get(0).getGender()); editor.commit();*/ Application_holder.userName = firstName; customDialog.getWindow().setAttributes(lp); customDialog.show(); btn_ok.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { customDialog.dismiss(); customDialog.cancel(); Intent i = new Intent(VURVHealthIDCreateActivity.this, StartScreenActivity.class); i.putExtra("firstName", firstName); i.putExtra("activity","VURVHealthIDCreateActivity"); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); finish(); } }); } @Override public void onBackPressed() { super.onBackPressed(); finish(); } }
UTF-8
Java
23,481
java
VURVHealthIDCreateActivity.java
Java
[ { "context": "ack;\nimport retrofit2.Response;\n\n/**\n * Created by yqlabs on 1/12/16.\n */\n\npublic class VURVHealthIDCreateA", "end": 1564, "score": 0.9996283054351807, "start": 1558, "tag": "USERNAME", "value": "yqlabs" }, { "context": "ail = email.split(\"@\");\n userName = usernameEmail[0];\n Application_holder.userEmail ", "end": 5592, "score": 0.9058229923248291, "start": 5579, "tag": "USERNAME", "value": "usernameEmail" }, { "context": " password = getIntent().getStringExtra(\"password\");\n nonceValue = getIntent().getString", "end": 5725, "score": 0.9338899850845337, "start": 5717, "tag": "PASSWORD", "value": "password" }, { "context": "_Id);\n vurvIdReqPayLoad.setDisplayName(firstName + \" \" + lastName);\n vurvIdReqPayLoad.s", "end": 14032, "score": 0.9724278450012207, "start": 14023, "tag": "NAME", "value": "firstName" }, { "context": " vurvIdReqPayLoad.setDisplayName(firstName + \" \" + lastName);\n vurvIdReqPayLoad.setMiddleName(midd", "end": 14049, "score": 0.9906300902366638, "start": 14041, "tag": "NAME", "value": "lastName" }, { "context": "Name);\n vurvIdReqPayLoad.setMiddleName(middlename);\n vurvIdReqPayLoad.setDateOfBir", "end": 14099, "score": 0.97480708360672, "start": 14095, "tag": "NAME", "value": "midd" }, { "context": "F\");\n vurvIdReqPayLoad.setUserNicename(firstName);\n vurvIdReqPayLoad.setFirstName(first", "end": 14291, "score": 0.9931467771530151, "start": 14282, "tag": "NAME", "value": "firstName" }, { "context": "tName);\n vurvIdReqPayLoad.setFirstName(firstName);\n vurvIdReqPayLoad.setLastName(lastNa", "end": 14345, "score": 0.6671280264854431, "start": 14336, "tag": "NAME", "value": "firstName" }, { "context": "stName);\n vurvIdReqPayLoad.setLastName(lastName);\n ArrayList<VurvIdReqPayLoad> listVur", "end": 14397, "score": 0.9801641702651978, "start": 14389, "tag": "NAME", "value": "lastName" }, { "context": "iewById(R.id.vurv_id);\n tvName.setText(\" \"+firstName+\"!\");\n name.setText(firstName +\" \"+lastNam", "end": 21342, "score": 0.7856587767601013, "start": 21333, "tag": "NAME", "value": "firstName" }, { "context": ".setText(\" \"+firstName+\"!\");\n name.setText(firstName +\" \"+lastName);\n //vurvId.setText(\"VURV ID", "end": 21379, "score": 0.827331006526947, "start": 21370, "tag": "NAME", "value": "firstName" }, { "context": "rstName+\"!\");\n name.setText(firstName +\" \"+lastName);\n //vurvId.setText(\"VURV ID: \"+vurvIdResP", "end": 21393, "score": 0.9070311784744263, "start": 21385, "tag": "NAME", "value": "lastName" }, { "context": "scriberDetail().get(0).getMemberId());\n\n /*srikanth*/\n try {\n StringBuilder st", "end": 21510, "score": 0.6022182703018188, "start": 21507, "tag": "USERNAME", "value": "sri" }, { "context": "commit();*/\n\n Application_holder.userName = firstName;\n\n customDialog.getWindow().setAttributes(", "end": 22675, "score": 0.5346304774284363, "start": 22666, "tag": "USERNAME", "value": "firstName" }, { "context": "ty.class);\n i.putExtra(\"firstName\", firstName);\n i.putExtra(\"activity\",\"VURVHeal", "end": 23117, "score": 0.9969134330749512, "start": 23108, "tag": "NAME", "value": "firstName" } ]
null
[]
package com.VURVhealth.vurvhealth.authentication; import android.app.DatePickerDialog; import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.view.Gravity; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.DatePicker; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.VURVhealth.vurvhealth.retrofit.Application_holder; import com.VURVhealth.vurvhealth.R; import com.VURVhealth.vurvhealth.StartScreenActivity; import com.VURVhealth.vurvhealth.authentication.registrationPojo.RegistrationResPayLoad; import com.VURVhealth.vurvhealth.authentication.vurvIdPojos.VurvIdReqPayLoad; import com.VURVhealth.vurvhealth.authentication.vurvIdPojos.VurvIdResPayLoad; import com.VURVhealth.vurvhealth.retrofit.ApiClient; import com.VURVhealth.vurvhealth.retrofit.ApiInterface; import com.VURVhealth.vurvhealth.superappcompact.SuperAppCompactActivity; import org.json.JSONObject; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.Locale; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; /** * Created by yqlabs on 1/12/16. */ public class VURVHealthIDCreateActivity extends SuperAppCompactActivity { private static final String TAG = VURVHealthIDCreateActivity.class.getSimpleName(); private EditText tvFirstName, tvMiddleName, tvlastName; private TextView text_hint; private Button btn_done, btn_done_active, tvDoB; private CheckBox chkMale, chkFemale; private ImageView backBtn; private String firstName, lastName, dob, middlename; private String email,userName, password, nonceValue; private SharedPreferences sharedPreferences; private SharedPreferences.Editor editor; public RegistrationResPayLoad registrationResPayLoad; private Calendar myCalendar; private VurvIdResPayLoad vurvIdResPayLoads; String dobFormat; /** Called when the activity is first created. */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.vurvhealthid_create_screen); tvFirstName = (EditText) findViewById(R.id.tvFirstName); tvMiddleName = (EditText) findViewById(R.id.tvMiddleName); tvlastName = (EditText) findViewById(R.id.tvlastName); tvDoB = (Button) findViewById(R.id.tvDoB); btn_done = (Button) findViewById(R.id.btn_done); btn_done_active = (Button) findViewById(R.id.btn_done_active); chkMale = (CheckBox) findViewById(R.id.chkMale); chkFemale = (CheckBox) findViewById(R.id.chkFemale); backBtn = (ImageView) findViewById(R.id.backBtn); text_hint = (TextView) findViewById(R.id.text_hint); //adding text watcher for the fields tvFirstName.addTextChangedListener(textWatcher); tvlastName.addTextChangedListener(textWatcher); tvDoB.addTextChangedListener(textWatcher); checkFieldsForEmptyValues(); //get the calender instance myCalendar = Calendar.getInstance(); //add text watcher for middle name for optional text tvMiddleName.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (tvMiddleName.getText().toString().length() == 0) { text_hint.setVisibility(View.VISIBLE); } else text_hint.setVisibility(View.GONE); } @Override public void afterTextChanged(Editable s) { } }); // setting the date picker dialog here final DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() { final long today = System.currentTimeMillis() - 1000; @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { // TODO Auto-generated method stub myCalendar.set(Calendar.YEAR, year); myCalendar.set(Calendar.MONTH, monthOfYear); myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); if (myCalendar.getTimeInMillis() >= today) { //Make them try again tvDoB.setText(""); Toast.makeText(getApplicationContext(), "Invalid date, please try again", Toast.LENGTH_LONG).show(); } else { updateLabel(); } } }; if (getIntent() != null) { if (getIntent().getStringExtra("mobile") != null){ userName = getIntent().getStringExtra("mobile"); email = getIntent().getStringExtra("mobile") + "@vurvhealth.com"; }else { email = getIntent().getStringExtra("email"); String[] usernameEmail = email.split("@"); userName = usernameEmail[0]; Application_holder.userEmail = email; } password = getIntent().getStringExtra("<PASSWORD>"); nonceValue = getIntent().getStringExtra("nonceValue"); } chkMale.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { chkFemale.setChecked(false); SharedPreferences settings = getSharedPreferences(Application_holder.LOGIN_PREFERENCES, 0); settings.edit().putBoolean("check",true).commit(); } } }); chkFemale.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { chkMale.setChecked(false); SharedPreferences settings = getSharedPreferences(Application_holder.LOGIN_PREFERENCES, 0); settings.edit().putBoolean("check",true).commit(); } } }); //When button is clicked tvDoB.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DatePickerDialog dialog = new DatePickerDialog(VURVHealthIDCreateActivity.this, date, myCalendar .get(Calendar.YEAR), myCalendar.get(Calendar.MONTH), myCalendar.get(Calendar.DAY_OF_MONTH)); dialog.getDatePicker().setMaxDate(new Date().getTime()); // dialog.getDatePicker().setMaxDate(System.currentTimeMillis()); dialog.show(); } }); //When button is clicked backBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); //When button is clicked btn_done_active.setOnClickListener(new View.OnClickListener() { //Run when button is clicked @Override public void onClick(View v) { firstName = tvFirstName.getText().toString().trim(); middlename = tvMiddleName.getText().toString().trim(); lastName = tvlastName.getText().toString().trim(); dob = tvDoB.getText().toString(); try { SimpleDateFormat dt = new SimpleDateFormat("MM-dd-yyyy"); Date date = dt.parse(dob); SimpleDateFormat sm = new SimpleDateFormat("yyyy-MM-dd"); dobFormat = sm.format(date); } catch (Exception e) { e.printStackTrace(); } StringBuffer result = new StringBuffer(); if (firstName.length() == 0) { Toast.makeText(VURVHealthIDCreateActivity.this, "Please enter first name", Toast.LENGTH_SHORT).show(); } else if (tvFirstName.getText().toString().trim().length() < 3 || tvFirstName.getText().toString().trim().length() > 25) { Toast.makeText(VURVHealthIDCreateActivity.this, "Please enter minimum 3 and maximum 25 characters", Toast.LENGTH_SHORT).show(); } else if (lastName.length() == 0) { Toast.makeText(VURVHealthIDCreateActivity.this, "Please enter last name", Toast.LENGTH_SHORT).show(); } else if (dob.length() == 0) { Toast.makeText(VURVHealthIDCreateActivity.this, "Please enter Date of Birth (MM/ DD/ YY)", Toast.LENGTH_SHORT).show(); } else if ((!chkMale.isChecked() && !chkFemale.isChecked()) || (chkFemale.isChecked() && chkMale.isChecked())) { Toast.makeText(VURVHealthIDCreateActivity.this, "Please select gender", Toast.LENGTH_SHORT).show(); } else { if (checkInternet()) { //Here, we are calling register service getRegistrationService(userName, password, email, nonceValue, firstName, "yes", "cool"); } else { Toast.makeText(VURVHealthIDCreateActivity.this, getResources().getString(R.string.no_network), Toast.LENGTH_SHORT).show(); } } } }); } //set the date format here private void updateLabel() { String myFormat = "MM-dd-yyyy"; //In which format need to put here // String myFormat = "yyyy-MM-dd"; //In which format need to put here SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.US); tvDoB.setText(sdf.format(myCalendar.getTime())); } // Consuming Register service here private void getRegistrationService(String username, final String password,final String email, final String nonceValue, String firstName, String notify, String insecure) { try { showProgressDialog(VURVHealthIDCreateActivity.this); ApiInterface apiService = ApiClient.getClient(VURVHealthIDCreateActivity.this).create(ApiInterface.class); Call<RegistrationResPayLoad> call = apiService.getRegistration(username, password, email, nonceValue, firstName/*, notify, insecure*/); call.enqueue(new Callback<RegistrationResPayLoad>() { @Override public void onResponse(Call<RegistrationResPayLoad> call, Response<RegistrationResPayLoad> response) { if (response.isSuccessful()) { registrationResPayLoad = response.body(); // dismissProgressDialog(); if (checkInternet()) { //Calling the VURVID service for vurvid creation getVURVIDService(); } else { Toast.makeText(VURVHealthIDCreateActivity.this, getResources().getString(R.string.no_network), Toast.LENGTH_SHORT).show(); } } else { dismissProgressDialog(); try { JSONObject jObjError = new JSONObject(response.errorBody().string()); if (jObjError.getString("error").equalsIgnoreCase("Username already exists.")){ if (email.equalsIgnoreCase(getIntent().getStringExtra("mobile") + "@vurvhealth.com")) Toast.makeText(getApplicationContext(), "Mobile Number already exists.", Toast.LENGTH_LONG).show(); else Toast.makeText(getApplicationContext(), "Email already exists.", Toast.LENGTH_LONG).show(); }else { Toast.makeText(getApplicationContext(), jObjError.getString("error"), Toast.LENGTH_LONG).show(); } } catch (Exception e) { Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); } } } @Override public void onFailure(Call<RegistrationResPayLoad> call, Throwable t) { Log.e(TAG, t.toString()); dismissProgressDialog(); Toast.makeText(VURVHealthIDCreateActivity.this, getResources().getString(R.string.server_not_found), Toast.LENGTH_SHORT).show(); } }); } catch (Exception e) { Log.v(TAG, e.getMessage()); } } // Consuming VURVID service here private void getVURVIDService() { try { // showProgressDialog(VURVHealthIDCreateActivity.this); String user_Id = registrationResPayLoad.getUserId(); ApiInterface apiService = ApiClient.getClient(VURVHealthIDCreateActivity.this).create(ApiInterface.class); VurvIdReqPayLoad vurvIdReqPayLoad = new VurvIdReqPayLoad(); vurvIdReqPayLoad.setId(user_Id); vurvIdReqPayLoad.setDisplayName(firstName + " " + lastName); vurvIdReqPayLoad.setMiddleName(middlename); vurvIdReqPayLoad.setDateOfBirth(dobFormat); vurvIdReqPayLoad.setGender(chkMale.isChecked() ? "M" : "F"); vurvIdReqPayLoad.setUserNicename(firstName); vurvIdReqPayLoad.setFirstName(firstName); vurvIdReqPayLoad.setLastName(lastName); ArrayList<VurvIdReqPayLoad> listVurv = new ArrayList<>(); listVurv.add(vurvIdReqPayLoad); Call<VurvIdResPayLoad> call = apiService.getVURVIDService(listVurv); call.enqueue(new Callback<VurvIdResPayLoad>() { @Override public void onResponse(Call<VurvIdResPayLoad> call, Response<VurvIdResPayLoad> response) { if (response.isSuccessful()) { vurvIdResPayLoads = response.body(); dismissProgressDialog(); sharedPreferences = getSharedPreferences(Application_holder.LOGIN_PREFERENCES, Context.MODE_PRIVATE); editor = sharedPreferences.edit(); editor.putString("firstName", vurvIdResPayLoads.getSubscriberDetail().get(0).getFirstName()); editor.putString("lastName",vurvIdResPayLoads.getSubscriberDetail().get(0).getLastName()); editor.putString("fullName", vurvIdResPayLoads.getSubscriberDetail().get(0).getFirstName()+" "+vurvIdResPayLoads.getSubscriberDetail().get(0).getLastName()); editor.putString("email", vurvIdResPayLoads.getUserDetail().get(0).getUserEmail()); editor.putString("vurvId", vurvIdResPayLoads.getSubscriberDetail().get(0).getMemberId()); editor.putInt("userId", Integer.parseInt(vurvIdResPayLoads.getSubscriberDetail().get(0).getUserId())); if(vurvIdResPayLoads.getSubscriberDetail().get(0).getMobileNo()!=null) { editor.putString("mobileNo", vurvIdResPayLoads.getSubscriberDetail().get(0).getMobileNo().equals("0") ? vurvIdResPayLoads.getUserDetail().get(0).getUserLogin() : vurvIdResPayLoads.getSubscriberDetail().get(0).getMobileNo()); }else { editor.putString("mobileNo", vurvIdResPayLoads.getSubscriberDetail().get(0).getMobileNo() == null ? vurvIdResPayLoads.getUserDetail().get(0).getUserLogin() : vurvIdResPayLoads.getSubscriberDetail().get(0).getMobileNo()); } editor.putString("dob", vurvIdResPayLoads.getSubscriberDetail().get(0).getDateOfBirth()); editor.putString("gender", vurvIdResPayLoads.getSubscriberDetail().get(0).getGender()); editor.putString("address1", vurvIdResPayLoads.getSubscriberDetail().get(0).getAddress1()); editor.putString("address2", vurvIdResPayLoads.getSubscriberDetail().get(0).getAddress2()); editor.putString("city", vurvIdResPayLoads.getSubscriberDetail().get(0).getCity()); editor.putString("stateName", vurvIdResPayLoads.getSubscriberDetail().get(0).getState()); editor.putString("zipCode", vurvIdResPayLoads.getSubscriberDetail().get(0).getZipcode()); editor.putString("zip4Code", vurvIdResPayLoads.getSubscriberDetail().get(0).getZipFourCode()); editor.putString("country", vurvIdResPayLoads.getSubscriberDetail().get(0).getCountry()); editor.putString("packageId", vurvIdResPayLoads.getSubscriberDetail().get(0).getPackageId()); editor.putString("packageName", vurvIdResPayLoads.getSubscriberDetail().get(0).getName()); editor.putString("subPackageId", vurvIdResPayLoads.getSubscriberDetail().get(0).getSubPackageId()); if(vurvIdResPayLoads.getSubscriberDetail().get(0).getOrderId()!=null) editor.putString("orderId", vurvIdResPayLoads.getSubscriberDetail().get(0).getOrderId()); editor.putString("logout", ""); editor.commit(); welComeDialog(); } else { dismissProgressDialog(); Toast.makeText(VURVHealthIDCreateActivity.this, getResources().getString(R.string.server_not_found), Toast.LENGTH_SHORT).show(); } Log.d(TAG, "Number of movies received: "); } @Override public void onFailure(Call<VurvIdResPayLoad> call, Throwable t) { // Log error here since request failed Log.e(TAG, t.toString()); dismissProgressDialog(); Toast.makeText(VURVHealthIDCreateActivity.this, getResources().getString(R.string.server_not_found), Toast.LENGTH_SHORT).show(); } }); } catch (Exception e) { e.getMessage(); } } //TextWatcher to handle the empty fields private TextWatcher textWatcher = new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { checkFieldsForEmptyValues(); } @Override public void afterTextChanged(Editable editable) { } }; //checking the empty fields here private void checkFieldsForEmptyValues() { firstName = tvFirstName.getText().toString(); lastName = tvlastName.getText().toString(); dob = tvDoB.getText().toString(); if (!firstName.equals("") && !lastName.equals("") && !dob.equals("")) { btn_done_active.setVisibility(View.VISIBLE); btn_done.setVisibility(View.GONE); btn_done.setEnabled(false); btn_done_active.setEnabled(true); } else { btn_done_active.setVisibility(View.GONE); btn_done.setVisibility(View.VISIBLE); btn_done_active.setEnabled(false); btn_done.setEnabled(true); } } //show the confirmation popup private void welComeDialog() { final Dialog customDialog = new Dialog(VURVHealthIDCreateActivity.this); customDialog.setCancelable(false); customDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); customDialog.setContentView(R.layout.confirmation_popup); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); lp.copyFrom(customDialog.getWindow().getAttributes()); lp.width = WindowManager.LayoutParams.MATCH_PARENT; lp.height = WindowManager.LayoutParams.WRAP_CONTENT; lp.gravity = Gravity.CENTER; final Button btn_ok = (Button) customDialog.findViewById(R.id.okBtn); final TextView tvName = (TextView) customDialog.findViewById(R.id.tvName); final TextView name = (TextView) customDialog.findViewById(R.id.name); final TextView vurvId = (TextView) customDialog.findViewById(R.id.vurv_id); tvName.setText(" "+firstName+"!"); name.setText(firstName +" "+lastName); //vurvId.setText("VURV ID: "+vurvIdResPayLoads.getSubscriberDetail().get(0).getMemberId()); /*srikanth*/ try { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(vurvIdResPayLoads.getSubscriberDetail().get(0).getMemberId().substring(0, 4)); stringBuilder.append("-"); stringBuilder.append(vurvIdResPayLoads.getSubscriberDetail().get(0).getMemberId().substring(4, 7)); stringBuilder.append("-"); stringBuilder.append(vurvIdResPayLoads.getSubscriberDetail().get(0).getMemberId().substring(7, 11)); vurvId.setText("VURV ID: " + stringBuilder); } catch (ArrayIndexOutOfBoundsException e2) { vurvId.setText("VURV ID: " + vurvIdResPayLoads.getSubscriberDetail().get(0).getMemberId()); } /* SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString("emailId", vurvIdResPayLoads.getUserDetail().get(0).getUserEmail()); editor.putString("firstName", vurvIdResPayLoads.getSubscriberDetail().get(0).getFirstName()); editor.putString("gender", vurvIdResPayLoads.getSubscriberDetail().get(0).getGender()); editor.commit();*/ Application_holder.userName = firstName; customDialog.getWindow().setAttributes(lp); customDialog.show(); btn_ok.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { customDialog.dismiss(); customDialog.cancel(); Intent i = new Intent(VURVHealthIDCreateActivity.this, StartScreenActivity.class); i.putExtra("firstName", firstName); i.putExtra("activity","VURVHealthIDCreateActivity"); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); finish(); } }); } @Override public void onBackPressed() { super.onBackPressed(); finish(); } }
23,483
0.609471
0.606107
521
44.069099
39.48336
252
false
false
0
0
0
0
0
0
0.742802
false
false
11
402f0463a8ff5dcca12f3f5cb22fe0aeeb5f1b56
523,986,077,534
6e545c0f4084a64707837ca3a4898cd49c86cfa2
/jscraper/scraper/src/main/java/com/ubikz/scraper/core/app/entity/FeedProhibitedEntity.java
6a143edd186e51e83884653ee49beffafc459903
[]
no_license
UbikZ/jscraper
https://github.com/UbikZ/jscraper
749eee154a9d05218fb7b5e0d6f50adb26ca24e9
5a1ccdf6c9b79bf30f8dc5cbb55dc24318ef55c8
refs/heads/master
2021-01-11T17:55:39.476000
2017-06-27T21:40:33
2017-06-27T21:40:33
79,858,217
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ubikz.scraper.core.app.entity; import com.ubikz.scraper.core.app.dal.FeedProhibitedDal; import com.ubikz.scraper.core.app.dal.filter.AbstractDalFilter; import com.ubikz.scraper.core.app.dal.filter.FeedProhibitedDalFilter; import com.ubikz.scraper.core.app.dal.request.AbstractDalRequest; import com.ubikz.scraper.core.app.dal.request.FeedProhibitedDalRequest; import com.ubikz.scraper.core.app.dto.AbstractDto; import com.ubikz.scraper.core.app.entity.filter.AbstractEntityFilter; import com.ubikz.scraper.core.app.entity.helper.FeedProhibitedEntityHelper; import com.ubikz.scraper.core.app.entity.request.AbstractEntityRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.List; import java.util.Map; @Component public class FeedProhibitedEntity extends AbstractEntity { @Autowired public FeedProhibitedEntity(FeedProhibitedDal feedProhibitedDal) { this.dal = feedProhibitedDal; this.helper = new FeedProhibitedEntityHelper(); } @Override protected void computeLoading(List<AbstractDto> dtoList) { } @Override protected void computeLoading(Map<Object, AbstractDto> dtoList) throws Exception { } /** * @param request * @return */ @Override protected AbstractDalRequest parseEntityToDalRequest(AbstractEntityRequest request) { return this.parseBaseEntityToDalRequest(request, new FeedProhibitedDalRequest()); } /** * @param filter * @return */ @Override protected AbstractDalFilter parseEntityToDalFilter(AbstractEntityFilter filter) { return this.parseBaseEntityToDalFilter(filter, new FeedProhibitedDalFilter()); } }
UTF-8
Java
1,751
java
FeedProhibitedEntity.java
Java
[]
null
[]
package com.ubikz.scraper.core.app.entity; import com.ubikz.scraper.core.app.dal.FeedProhibitedDal; import com.ubikz.scraper.core.app.dal.filter.AbstractDalFilter; import com.ubikz.scraper.core.app.dal.filter.FeedProhibitedDalFilter; import com.ubikz.scraper.core.app.dal.request.AbstractDalRequest; import com.ubikz.scraper.core.app.dal.request.FeedProhibitedDalRequest; import com.ubikz.scraper.core.app.dto.AbstractDto; import com.ubikz.scraper.core.app.entity.filter.AbstractEntityFilter; import com.ubikz.scraper.core.app.entity.helper.FeedProhibitedEntityHelper; import com.ubikz.scraper.core.app.entity.request.AbstractEntityRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.List; import java.util.Map; @Component public class FeedProhibitedEntity extends AbstractEntity { @Autowired public FeedProhibitedEntity(FeedProhibitedDal feedProhibitedDal) { this.dal = feedProhibitedDal; this.helper = new FeedProhibitedEntityHelper(); } @Override protected void computeLoading(List<AbstractDto> dtoList) { } @Override protected void computeLoading(Map<Object, AbstractDto> dtoList) throws Exception { } /** * @param request * @return */ @Override protected AbstractDalRequest parseEntityToDalRequest(AbstractEntityRequest request) { return this.parseBaseEntityToDalRequest(request, new FeedProhibitedDalRequest()); } /** * @param filter * @return */ @Override protected AbstractDalFilter parseEntityToDalFilter(AbstractEntityFilter filter) { return this.parseBaseEntityToDalFilter(filter, new FeedProhibitedDalFilter()); } }
1,751
0.769275
0.769275
52
32.692307
30.761826
89
false
false
0
0
0
0
0
0
0.403846
false
false
11
3b3c9228975868c9dc8afd59de1f349bb25cfef2
5,257,040,007,064
3c42587781119ca87fb4c0e32cf55765bfd5e632
/spring-security/src/main/java/com/thanh/domain/User.java
6333fff8c3843223980941cbac48ee7c30d3c461
[]
no_license
Thanhramsey/bootWebPage
https://github.com/Thanhramsey/bootWebPage
60910192f48d37c91258280536826b5c59e79bab
0fbd16667e314f2de935107f6e0cc8cddaf83cdd
refs/heads/master
2020-09-12T09:59:56.524000
2019-11-30T10:33:25
2019-11-30T10:33:25
222,388,191
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.thanh.domain; import java.io.Serializable; import java.sql.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "user") public class User implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id", nullable = false) private int id; @Column(name = "first_name") private String firstName; @Column(name="last_name") private String lastName; @Column(name="register_name") private String registerName; @Column(name="password") private String password; @Column(name="email") private String email; @Column(name="date_of_birth") private Date dateOfBirth; @Column(name="phone") private String phone; @Column(name="address") private String address; public static long getSerialVersionUID() { return serialVersionUID; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getRegisterName() { return registerName; } public void setRegisterName(String registerName) { this.registerName = registerName; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public Date getDateOfBirth() { return dateOfBirth; } public void setDateOfBirth(Date dateOfBirth) { this.dateOfBirth = dateOfBirth; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public User(String firstName, String lastName, String registerName, String password, String email, Date dateOfBirth, String phone, String address) { this.firstName = firstName; this.lastName = lastName; this.registerName = registerName; this.password = password; this.email = email; this.dateOfBirth = dateOfBirth; this.phone = phone; this.address = address; } public User(){} }
UTF-8
Java
2,564
java
User.java
Java
[ { "context": "e\")\n\tprivate String registerName;\n\n\t@Column(name=\"password\")\n\tprivate String password;\n\n\t@Column(name=\"email", "end": 724, "score": 0.9950160384178162, "start": 716, "tag": "PASSWORD", "value": "password" }, { "context": "d setPassword(String password) {\n\t\tthis.password = password;\n\t}\n\n\tpublic String getEmail() {\n\t\treturn email;\n", "end": 1667, "score": 0.7457293272018433, "start": 1659, "tag": "PASSWORD", "value": "password" }, { "context": "\n\t\tthis.address = address;\n\t}\n\n\tpublic User(String firstName, String lastName, String registerName, String pas", "end": 2194, "score": 0.912319004535675, "start": 2185, "tag": "NAME", "value": "firstName" }, { "context": "address;\n\t}\n\n\tpublic User(String firstName, String lastName, String registerName, String password, String ema", "end": 2211, "score": 0.9451021552085876, "start": 2203, "tag": "NAME", "value": "lastName" }, { "context": "String phone, String address) {\n\t\tthis.firstName = firstName;\n\t\tthis.lastName = lastName;\n\t\tthis.registerName ", "end": 2343, "score": 0.9986864924430847, "start": 2334, "tag": "NAME", "value": "firstName" }, { "context": " {\n\t\tthis.firstName = firstName;\n\t\tthis.lastName = lastName;\n\t\tthis.registerName = registerName;\n\t\tthis.passw", "end": 2371, "score": 0.9981253743171692, "start": 2363, "tag": "NAME", "value": "lastName" }, { "context": "\n\t\tthis.lastName = lastName;\n\t\tthis.registerName = registerName;\n\t\tthis.password = password;\n\t\tthis.email = e", "end": 2403, "score": 0.8052786588668823, "start": 2395, "tag": "NAME", "value": "register" }, { "context": "his.registerName = registerName;\n\t\tthis.password = password;\n\t\tthis.email = email;\n\t\tthis.dateOfBirth = dateO", "end": 2435, "score": 0.9985291361808777, "start": 2427, "tag": "PASSWORD", "value": "password" } ]
null
[]
package com.thanh.domain; import java.io.Serializable; import java.sql.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "user") public class User implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id", nullable = false) private int id; @Column(name = "first_name") private String firstName; @Column(name="last_name") private String lastName; @Column(name="register_name") private String registerName; @Column(name="<PASSWORD>") private String password; @Column(name="email") private String email; @Column(name="date_of_birth") private Date dateOfBirth; @Column(name="phone") private String phone; @Column(name="address") private String address; public static long getSerialVersionUID() { return serialVersionUID; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getRegisterName() { return registerName; } public void setRegisterName(String registerName) { this.registerName = registerName; } public String getPassword() { return password; } public void setPassword(String password) { this.password = <PASSWORD>; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public Date getDateOfBirth() { return dateOfBirth; } public void setDateOfBirth(Date dateOfBirth) { this.dateOfBirth = dateOfBirth; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public User(String firstName, String lastName, String registerName, String password, String email, Date dateOfBirth, String phone, String address) { this.firstName = firstName; this.lastName = lastName; this.registerName = registerName; this.password = <PASSWORD>; this.email = email; this.dateOfBirth = dateOfBirth; this.phone = phone; this.address = address; } public User(){} }
2,570
0.727769
0.727379
138
17.57971
18.882479
149
false
false
0
0
0
0
0
0
1.231884
false
false
11
9b69c0ddce61627e4fbce5e5fa207a0c00af1dd3
13,795,435,004,605
9ee7dee8654f33135dfc50e7f7477b188cc6d4b1
/src/main/java/com/ant/linker/data/entity/event/type/NewQuoteEventContent.java
e82bbb3c278cedd6c3908aec5bd593b80aa8fd84
[]
no_license
ydaoudi30/StageFinEtudes2018_Linker_Backend
https://github.com/ydaoudi30/StageFinEtudes2018_Linker_Backend
0574404de06fe22df665119f292000c954638508
32d185ccb53d3743259d9195e7e54b15ab57541d
refs/heads/master
2023-06-29T01:52:25.901000
2021-08-03T18:24:13
2021-08-03T18:24:13
392,411,821
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ant.linker.data.entity.event.type; import java.io.Serializable; import com.ant.linker.data.entity.QuotationRequest; import com.googlecode.objectify.annotation.Entity; import com.googlecode.objectify.annotation.Index; @Entity @Index public class NewQuoteEventContent extends QuoteEventContent implements Serializable{ public NewQuoteEventContent() { super(); // TODO Auto-generated constructor stub } public NewQuoteEventContent(QuotationRequest quotation) { super(quotation); // TODO Auto-generated constructor stub } }
UTF-8
Java
551
java
NewQuoteEventContent.java
Java
[]
null
[]
package com.ant.linker.data.entity.event.type; import java.io.Serializable; import com.ant.linker.data.entity.QuotationRequest; import com.googlecode.objectify.annotation.Entity; import com.googlecode.objectify.annotation.Index; @Entity @Index public class NewQuoteEventContent extends QuoteEventContent implements Serializable{ public NewQuoteEventContent() { super(); // TODO Auto-generated constructor stub } public NewQuoteEventContent(QuotationRequest quotation) { super(quotation); // TODO Auto-generated constructor stub } }
551
0.800363
0.800363
23
22.956522
24.355124
84
false
false
0
0
0
0
0
0
0.869565
false
false
11
e2ea11513f9be8c2dd92d9ee839739e904e2ff86
15,418,932,612,974
a668a8d0d1befdc7d1035fa2b6395d176c538ee6
/postmates/BorderSort.java
910e36119d1ae61ce54b9df31e511ec0b2da350c
[]
no_license
SameenaThab/hankerrank-leetcode-geeksforgeeks
https://github.com/SameenaThab/hankerrank-leetcode-geeksforgeeks
1e8b691b3e18438f66ef695c25cafa3259cfb735
f2f638f77894c09e032d5b88a6c3e470e4afcf7a
refs/heads/master
2023-01-11T15:45:35.948000
2022-12-22T21:38:05
2022-12-22T21:38:05
132,793,048
0
3
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class BorderSort { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int m = 3; int n = 4; int[][] a = new int[][]{{4,2,8,0},{2,6,9,8},{0,3,1,7}}; System.out.println("Matrix before border sort"); for(int i=0;i<m;i++) { for(int j=0;j<n;j++) { System.out.print(a[i][j]+" "); } System.out.println(); } borderSort(a,m,n); System.out.println("Matrix after border sort"); for(int i=0;i<m;i++) { for(int j=0;j<n;j++) { System.out.print(a[i][j]+" "); } System.out.println(); } } public static void borderSort(int[][] a,int m,int n) { int size = 2*(m+n-2); System.out.println("size:"+size); int[] arr = new int[size]; System.out.println("Matrix before border sort"); int x=0; int i=0; int j=0; while(x<size) { while(j<n) { arr[x++]=a[i][j++]; } j--; i++; System.out.println("i:"+i+" j:"+j); while(i<m) { arr[x++]=a[i++][j]; } i--; j--; System.out.println("i:"+i+" j:"+j); while(j>=0) { arr[x++]=a[i][j--]; } j++; i--; System.out.println("i:"+i+" j:"+j); while(i>0) { arr[x++]=a[i--][j]; } } Arrays.sort(arr); x=0; i=0; j=0; while(x<size) { while(j<n) { a[i][j++]=arr[x++]; } j--; i++; System.out.println("i:"+i+" j:"+j); while(i<m) { a[i++][j]=arr[x++]; } i--; j--; System.out.println("i:"+i+" j:"+j); while(j>=0) { a[i][j--]=arr[x++]; } j++; i--; System.out.println("i:"+i+" j:"+j); while(i>0) { a[i--][j]=arr[x++]; } } } }
UTF-8
Java
2,346
java
BorderSort.java
Java
[]
null
[]
import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class BorderSort { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int m = 3; int n = 4; int[][] a = new int[][]{{4,2,8,0},{2,6,9,8},{0,3,1,7}}; System.out.println("Matrix before border sort"); for(int i=0;i<m;i++) { for(int j=0;j<n;j++) { System.out.print(a[i][j]+" "); } System.out.println(); } borderSort(a,m,n); System.out.println("Matrix after border sort"); for(int i=0;i<m;i++) { for(int j=0;j<n;j++) { System.out.print(a[i][j]+" "); } System.out.println(); } } public static void borderSort(int[][] a,int m,int n) { int size = 2*(m+n-2); System.out.println("size:"+size); int[] arr = new int[size]; System.out.println("Matrix before border sort"); int x=0; int i=0; int j=0; while(x<size) { while(j<n) { arr[x++]=a[i][j++]; } j--; i++; System.out.println("i:"+i+" j:"+j); while(i<m) { arr[x++]=a[i++][j]; } i--; j--; System.out.println("i:"+i+" j:"+j); while(j>=0) { arr[x++]=a[i][j--]; } j++; i--; System.out.println("i:"+i+" j:"+j); while(i>0) { arr[x++]=a[i--][j]; } } Arrays.sort(arr); x=0; i=0; j=0; while(x<size) { while(j<n) { a[i][j++]=arr[x++]; } j--; i++; System.out.println("i:"+i+" j:"+j); while(i<m) { a[i++][j]=arr[x++]; } i--; j--; System.out.println("i:"+i+" j:"+j); while(j>=0) { a[i][j--]=arr[x++]; } j++; i--; System.out.println("i:"+i+" j:"+j); while(i>0) { a[i--][j]=arr[x++]; } } } }
2,346
0.34058
0.327792
89
25.370787
14.694172
63
false
false
0
0
0
0
0
0
0.842697
false
false
11
397a6759bed81c2b39b7d5f43928c1e0f3d50d98
15,418,932,609,892
b1b3360a1b44abbbc50c6f3cabcba52414b9ad4a
/test_source_from_JADX/sources/org/catrobat/catroid/transfers/SearchScratchProgramsTask.java
11060bb7c60d7c640aea549eb394fb6e5833b72d
[]
no_license
soumitradev/FaceApp-Source
https://github.com/soumitradev/FaceApp-Source
3c993400b3a1a009d94f19b640ca89d35fb6466f
ce530ef243780739f92a1c806e517d697f5df6df
refs/heads/master
2020-04-13T07:38:20.175000
2018-12-25T07:49:03
2018-12-25T07:49:03
163,056,906
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.catrobat.catroid.transfers; import android.os.AsyncTask; import android.util.Log; import com.google.common.base.Preconditions; import java.io.InterruptedIOException; import org.catrobat.catroid.common.ScratchSearchResult; import org.catrobat.catroid.web.ScratchDataFetcher; import org.catrobat.catroid.web.WebconnectionException; public class SearchScratchProgramsTask extends AsyncTask<String, Void, ScratchSearchResult> { private static final String TAG = SearchScratchProgramsTask.class.getSimpleName(); private SearchScratchProgramsTaskDelegate delegate = null; private ScratchDataFetcher fetcher = null; public interface SearchScratchProgramsTaskDelegate { void onPostExecute(ScratchSearchResult scratchSearchResult); void onPreExecute(); } public SearchScratchProgramsTask setDelegate(SearchScratchProgramsTaskDelegate delegate) { this.delegate = delegate; return this; } public SearchScratchProgramsTask setFetcher(ScratchDataFetcher fetcher) { this.fetcher = fetcher; return this; } protected void onPreExecute() { super.onPreExecute(); if (this.delegate != null) { this.delegate.onPreExecute(); } } protected ScratchSearchResult doInBackground(String... params) { Preconditions.checkArgument(params.length <= 2, "Invalid number of parameters!"); try { return fetchProgramList(params.length > 0 ? params[0] : null); } catch (InterruptedIOException e) { Log.i(TAG, "Task has been cancelled in the meanwhile!"); return null; } } public ScratchSearchResult fetchProgramList(String query) throws InterruptedIOException { int attempt = 0; while (attempt <= 2) { if (isCancelled()) { Log.i(TAG, "Task has been cancelled in the meanwhile!"); return null; } else if (query == null) { return this.fetcher.fetchDefaultScratchPrograms(); } else { try { return this.fetcher.scratchSearch(query, 20, 0); } catch (WebconnectionException e) { String str = TAG; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(e.getLocalizedMessage()); stringBuilder.append("\n"); stringBuilder.append(e.getStackTrace()); Log.d(str, stringBuilder.toString()); int delay = ((int) ((Math.random() * 1000.0d) * ((double) (attempt + 1)))) + 1000; String str2 = TAG; StringBuilder stringBuilder2 = new StringBuilder(); stringBuilder2.append("Retry #"); stringBuilder2.append(attempt + 1); stringBuilder2.append(" to search for scratch programs scheduled in "); stringBuilder2.append(delay); stringBuilder2.append(" ms due to "); stringBuilder2.append(e.getLocalizedMessage()); Log.i(str2, stringBuilder2.toString()); try { Thread.sleep((long) delay); } catch (InterruptedException ex) { Log.e(TAG, ex.getMessage()); } attempt++; } } } Log.w(TAG, "Maximum number of 3 attempts exceeded! Server not reachable?!"); return null; } protected void onPostExecute(ScratchSearchResult result) { super.onPostExecute(result); if (this.delegate != null && !isCancelled()) { this.delegate.onPostExecute(result); } } }
UTF-8
Java
3,829
java
SearchScratchProgramsTask.java
Java
[]
null
[]
package org.catrobat.catroid.transfers; import android.os.AsyncTask; import android.util.Log; import com.google.common.base.Preconditions; import java.io.InterruptedIOException; import org.catrobat.catroid.common.ScratchSearchResult; import org.catrobat.catroid.web.ScratchDataFetcher; import org.catrobat.catroid.web.WebconnectionException; public class SearchScratchProgramsTask extends AsyncTask<String, Void, ScratchSearchResult> { private static final String TAG = SearchScratchProgramsTask.class.getSimpleName(); private SearchScratchProgramsTaskDelegate delegate = null; private ScratchDataFetcher fetcher = null; public interface SearchScratchProgramsTaskDelegate { void onPostExecute(ScratchSearchResult scratchSearchResult); void onPreExecute(); } public SearchScratchProgramsTask setDelegate(SearchScratchProgramsTaskDelegate delegate) { this.delegate = delegate; return this; } public SearchScratchProgramsTask setFetcher(ScratchDataFetcher fetcher) { this.fetcher = fetcher; return this; } protected void onPreExecute() { super.onPreExecute(); if (this.delegate != null) { this.delegate.onPreExecute(); } } protected ScratchSearchResult doInBackground(String... params) { Preconditions.checkArgument(params.length <= 2, "Invalid number of parameters!"); try { return fetchProgramList(params.length > 0 ? params[0] : null); } catch (InterruptedIOException e) { Log.i(TAG, "Task has been cancelled in the meanwhile!"); return null; } } public ScratchSearchResult fetchProgramList(String query) throws InterruptedIOException { int attempt = 0; while (attempt <= 2) { if (isCancelled()) { Log.i(TAG, "Task has been cancelled in the meanwhile!"); return null; } else if (query == null) { return this.fetcher.fetchDefaultScratchPrograms(); } else { try { return this.fetcher.scratchSearch(query, 20, 0); } catch (WebconnectionException e) { String str = TAG; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(e.getLocalizedMessage()); stringBuilder.append("\n"); stringBuilder.append(e.getStackTrace()); Log.d(str, stringBuilder.toString()); int delay = ((int) ((Math.random() * 1000.0d) * ((double) (attempt + 1)))) + 1000; String str2 = TAG; StringBuilder stringBuilder2 = new StringBuilder(); stringBuilder2.append("Retry #"); stringBuilder2.append(attempt + 1); stringBuilder2.append(" to search for scratch programs scheduled in "); stringBuilder2.append(delay); stringBuilder2.append(" ms due to "); stringBuilder2.append(e.getLocalizedMessage()); Log.i(str2, stringBuilder2.toString()); try { Thread.sleep((long) delay); } catch (InterruptedException ex) { Log.e(TAG, ex.getMessage()); } attempt++; } } } Log.w(TAG, "Maximum number of 3 attempts exceeded! Server not reachable?!"); return null; } protected void onPostExecute(ScratchSearchResult result) { super.onPostExecute(result); if (this.delegate != null && !isCancelled()) { this.delegate.onPostExecute(result); } } }
3,829
0.593628
0.585793
96
38.885418
27.542721
102
false
false
0
0
0
0
0
0
0.645833
false
false
11
fd488158fc6279e1ae489ec785da27de5b5aafca
5,549,097,799,734
e0bb960bb72350856102a13a6d56fc0bf4574512
/Test/app/src/main/java/com/example/pikachu/test/CustomAdapter.java
fdda0b470e02ecebe1d3ca5656d8259b003d6dc7
[]
no_license
majju1991/Best-Buy-Android-Test
https://github.com/majju1991/Best-Buy-Android-Test
b717b4657d1f3a36eda55691ba2bf149996d65f1
a8c6909eb689d1e536efe917c284f539641710d3
refs/heads/master
2020-06-15T03:44:09.146000
2020-03-05T04:01:21
2020-03-05T04:01:21
75,333,324
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.pikachu.test; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.support.annotation.NonNull; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; /** * Created by Pikachu on 11/23/16. */ public class CustomAdapter extends ArrayAdapter { Context context; ArrayList<Product1> product1s; ViewHolder holder; public CustomAdapter(MainActivity mainActivity, ArrayList<Product1> product1s) { super(mainActivity, R.layout.product_list_row, product1s); context = mainActivity; this.product1s = product1s; } public class ViewHolder { ImageView imageView; TextView nameView; TextView SKUView; TextView priceView; public ViewHolder(View row) { imageView = (ImageView) row.findViewById(R.id.product_imageview1); nameView = (TextView) row.findViewById(R.id.product_name_view1); SKUView = (TextView) row.findViewById(R.id.product_sku_view2); priceView = (TextView) row.findViewById(R.id.product_price_view2); } } @NonNull @Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; if (row == null) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE); row = inflater.inflate(R.layout.product_list_row, parent, false); holder = new ViewHolder(row); row.setTag(holder); } else { holder = (ViewHolder) row.getTag(); } Product1 singleProduct1 = product1s.get(position); String value = "Name: " + singleProduct1.name; holder.nameView.setText(value); value = "SKU: " + singleProduct1.SKU; holder.SKUView.setText(value); value = "Price: " + singleProduct1.price; holder.priceView.setText(value); holder.imageView.setImageBitmap(singleProduct1.bitmap); return row; } }
UTF-8
Java
2,409
java
CustomAdapter.java
Java
[ { "context": "\nimport java.util.ArrayList;\r\n\r\n/**\r\n * Created by Pikachu on 11/23/16.\r\n */\r\n\r\npublic class CustomAdapter e", "end": 537, "score": 0.9296411871910095, "start": 530, "tag": "NAME", "value": "Pikachu" } ]
null
[]
package com.example.pikachu.test; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.support.annotation.NonNull; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; /** * Created by Pikachu on 11/23/16. */ public class CustomAdapter extends ArrayAdapter { Context context; ArrayList<Product1> product1s; ViewHolder holder; public CustomAdapter(MainActivity mainActivity, ArrayList<Product1> product1s) { super(mainActivity, R.layout.product_list_row, product1s); context = mainActivity; this.product1s = product1s; } public class ViewHolder { ImageView imageView; TextView nameView; TextView SKUView; TextView priceView; public ViewHolder(View row) { imageView = (ImageView) row.findViewById(R.id.product_imageview1); nameView = (TextView) row.findViewById(R.id.product_name_view1); SKUView = (TextView) row.findViewById(R.id.product_sku_view2); priceView = (TextView) row.findViewById(R.id.product_price_view2); } } @NonNull @Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; if (row == null) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE); row = inflater.inflate(R.layout.product_list_row, parent, false); holder = new ViewHolder(row); row.setTag(holder); } else { holder = (ViewHolder) row.getTag(); } Product1 singleProduct1 = product1s.get(position); String value = "Name: " + singleProduct1.name; holder.nameView.setText(value); value = "SKU: " + singleProduct1.SKU; holder.SKUView.setText(value); value = "Price: " + singleProduct1.price; holder.priceView.setText(value); holder.imageView.setImageBitmap(singleProduct1.bitmap); return row; } }
2,409
0.653383
0.643421
78
28.910257
25.106024
113
false
false
0
0
0
0
0
0
0.653846
false
false
11
e682ff8fce1ec74473b675733d74341653cd2a17
24,953,760,005,744
fc44f78f5c80fb92f4255bd13531bdf24a86cc9f
/src/test/java/demo/projects/cucumber/test/infrastructure/package-info.java
541b51edd72bbbab6094db014e8ecbe683dc814a
[]
no_license
dan975/selenium-browser
https://github.com/dan975/selenium-browser
a2edf23e3964af5c2f88d32d1bbae86e0d548a8c
dd027e679e5718dc6b3d755a7e0e63b8a4393c20
refs/heads/master
2022-11-28T15:18:57.829000
2020-08-05T15:54:12
2020-08-05T15:54:12
285,336,395
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Classes defining test runner options, test hooks, Cucumber step shared world and logging aspects. */ package demo.projects.cucumber.test.infrastructure;
UTF-8
Java
161
java
package-info.java
Java
[]
null
[]
/** * Classes defining test runner options, test hooks, Cucumber step shared world and logging aspects. */ package demo.projects.cucumber.test.infrastructure;
161
0.782609
0.782609
4
39.25
40.176952
100
false
false
0
0
0
0
0
0
0.75
false
false
11
bfca981fbbfa0988d5677931e2387dab35e299ac
17,471,927,016,224
71c552c2bf805eed3953c60a749f48a388f67bbf
/core/src/com/mygdx/game/view/figures/FigurePink1.java
b613c74458503a68bb57648ee7a8d98509389a67
[]
no_license
Goldeo/GameB
https://github.com/Goldeo/GameB
d9aff90d3cf387268f3570885a4c292a6fb405d9
1ca955d58396cc51a00642585300d44f5d7b2a8a
refs/heads/master
2021-01-12T14:16:22.593000
2017-07-28T16:27:56
2017-07-28T16:27:56
70,001,395
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mygdx.game.view.figures; import com.mygdx.game.view.screens.PlayScreen; /** * Created by Sergey on 05.10.2016. */ public class FigurePink1 extends Figure { public FigurePink1(PlayScreen screen) { super(screen); for (int i = 0; i < 4; ++i) { panel = new com.mygdx.game.view.panels.Panel(screen, com.mygdx.game.view.panels.Panel.Color.PINK, i * PANEL_WIDTH + LITTLE_PADDING, BIG_PADDING); panel.setRowAndColumn(0, i); addActor(panel); } setSize(4, 1, LITTLE_PADDING, BIG_PADDING); } }
UTF-8
Java
579
java
FigurePink1.java
Java
[ { "context": "x.game.view.screens.PlayScreen;\n\n/**\n * Created by Sergey on 05.10.2016.\n */\n\npublic class FigurePink1 exte", "end": 110, "score": 0.9916828274726868, "start": 104, "tag": "NAME", "value": "Sergey" } ]
null
[]
package com.mygdx.game.view.figures; import com.mygdx.game.view.screens.PlayScreen; /** * Created by Sergey on 05.10.2016. */ public class FigurePink1 extends Figure { public FigurePink1(PlayScreen screen) { super(screen); for (int i = 0; i < 4; ++i) { panel = new com.mygdx.game.view.panels.Panel(screen, com.mygdx.game.view.panels.Panel.Color.PINK, i * PANEL_WIDTH + LITTLE_PADDING, BIG_PADDING); panel.setRowAndColumn(0, i); addActor(panel); } setSize(4, 1, LITTLE_PADDING, BIG_PADDING); } }
579
0.625216
0.599309
22
25.318182
34.163227
157
false
false
0
0
0
0
0
0
0.727273
false
false
11
edb4b2548f27a95c98fb1ff356eb881cd4e48344
14,121,852,490,624
beeef5f959dceabba17582f58d9b1dbc685819fe
/app/src/main/java/com/livingstoneapp/interactors/IActivityInteractor.java
5e8f80352958b25f592cd318c4cce6c27cb3f41b
[ "Apache-2.0" ]
permissive
oosthuizenr/Livingstone
https://github.com/oosthuizenr/Livingstone
902c39fd8d46c89dd54ef7800ea45dbb4487aaec
0cd5b28ef084ae5faa55404d92b86f2be4816afc
refs/heads/master
2021-01-10T06:03:56.993000
2016-03-27T17:05:36
2016-03-27T17:05:36
54,821,190
13
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.livingstoneapp.interactors; import java.util.ArrayList; import rx.Observable; import com.livingstoneapp.models.ActivityInfoInternal; /** * Created by renier on 2/17/2016. */ public interface IActivityInteractor { Observable<ArrayList<ActivityInfoInternal>> getActivities(String packageName); }
UTF-8
Java
315
java
IActivityInteractor.java
Java
[ { "context": "pp.models.ActivityInfoInternal;\n\n/**\n * Created by renier on 2/17/2016.\n */\npublic interface IActivityInter", "end": 172, "score": 0.9992077350616455, "start": 166, "tag": "USERNAME", "value": "renier" } ]
null
[]
package com.livingstoneapp.interactors; import java.util.ArrayList; import rx.Observable; import com.livingstoneapp.models.ActivityInfoInternal; /** * Created by renier on 2/17/2016. */ public interface IActivityInteractor { Observable<ArrayList<ActivityInfoInternal>> getActivities(String packageName); }
315
0.8
0.777778
13
23.23077
24.704885
82
false
false
0
0
0
0
0
0
0.384615
false
false
11
ae58d82021788ca8b5988c432054be6871423a9f
15,891,379,043,871
f50f5b6930a5532734985b397211c31d2ff02476
/src/CabBooking/AddMoneyFunc.java
577ec962c92b3aedd0ff091ecf32589970c760f3
[]
no_license
Dhanush1011/Cab-Booking-Desktop-Application
https://github.com/Dhanush1011/Cab-Booking-Desktop-Application
99f3964e8bf10940d6e7375da867f1428a88c40e
7a7563843d1e78a7b20be786d35c646950e225a8
refs/heads/master
2022-11-28T20:48:33.234000
2020-08-04T17:22:30
2020-08-04T17:22:30
285,046,954
0
1
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 CabBooking; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; /** * * @author karupakula */ public class AddMoneyFunc { boolean addmoney(String amt, String userid, char[] p){ String pwd = new String(p); ResultSet rst1 = null; int c=0; int count = 0; try{ String myUrl = "jdbc:mysql://localhost:3306/trial"; Connection conn1 = DriverManager.getConnection(myUrl, "root", "242921326@pj"); Statement st1 = conn1.createStatement(); rst1 = st1.executeQuery("SELECT * FROM trials"); while(rst1.next()) { if(userid.equals(rst1.getString("userid")) && pwd.equals(rst1.getString("pwd"))) { c = Integer.parseInt(rst1.getString("accountbal")) + Integer.parseInt(amt); count = 1; } } rst1.close(); conn1.close(); } catch (Exception e) { System.err.println("Got an exception!"); System.err.println(e.getMessage()); } try{ String myUrl = "jdbc:mysql://localhost:3306/trial"; Connection conn1 = DriverManager.getConnection(myUrl, "root", "242921326@pj"); Statement st1 = conn1.createStatement(); st1.executeUpdate("UPDATE trials SET accountbal = '" + Integer.toString(c) + "' WHERE userid = '" + userid + "';"); rst1.close(); conn1.close(); } catch (Exception e) { System.err.println("Got an exception!"); System.err.println(e.getMessage()); } if(count == 1) { return true; } else { return false; } } }
UTF-8
Java
2,207
java
AddMoneyFunc.java
Java
[ { "context": "Set;\nimport java.sql.Statement;\n\n/**\n *\n * @author karupakula\n */\npublic class AddMoneyFunc {\n \n boolean ", "end": 348, "score": 0.9983588457107544, "start": 338, "tag": "USERNAME", "value": "karupakula" }, { "context": "n1 = DriverManager.getConnection(myUrl, \"root\", \"242921326@pj\");\n \n Statement st1 = co", "end": 734, "score": 0.6671379804611206, "start": 726, "tag": "PASSWORD", "value": "42921326" }, { "context": "n1 = DriverManager.getConnection(myUrl, \"root\", \"242921326@pj\");\n \n Statement st1 = c", "end": 1608, "score": 0.5692080855369568, "start": 1601, "tag": "PASSWORD", "value": "4292132" } ]
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 CabBooking; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; /** * * @author karupakula */ public class AddMoneyFunc { boolean addmoney(String amt, String userid, char[] p){ String pwd = new String(p); ResultSet rst1 = null; int c=0; int count = 0; try{ String myUrl = "jdbc:mysql://localhost:3306/trial"; Connection conn1 = DriverManager.getConnection(myUrl, "root", "2<PASSWORD>@pj"); Statement st1 = conn1.createStatement(); rst1 = st1.executeQuery("SELECT * FROM trials"); while(rst1.next()) { if(userid.equals(rst1.getString("userid")) && pwd.equals(rst1.getString("pwd"))) { c = Integer.parseInt(rst1.getString("accountbal")) + Integer.parseInt(amt); count = 1; } } rst1.close(); conn1.close(); } catch (Exception e) { System.err.println("Got an exception!"); System.err.println(e.getMessage()); } try{ String myUrl = "jdbc:mysql://localhost:3306/trial"; Connection conn1 = DriverManager.getConnection(myUrl, "root", "2<PASSWORD>6@pj"); Statement st1 = conn1.createStatement(); st1.executeUpdate("UPDATE trials SET accountbal = '" + Integer.toString(c) + "' WHERE userid = '" + userid + "';"); rst1.close(); conn1.close(); } catch (Exception e) { System.err.println("Got an exception!"); System.err.println(e.getMessage()); } if(count == 1) { return true; } else { return false; } } }
2,212
0.499773
0.478024
79
26.936708
25.997732
127
false
false
0
0
0
0
0
0
0.493671
false
false
11
a1211e178790e72fa8ad9d62c26008035ac4d248
18,064,632,450,233
ce93323e2be1e51fac6905913c74113d03751a1a
/plugin/test/base/PerlPlatformTestCase.java
58bc5e4b6214788621d0250ce63253adb0eac382
[ "Apache-2.0" ]
permissive
hurricup/Perl5-IDEA
https://github.com/hurricup/Perl5-IDEA
333ebbbb3594b70a5af67e637549703a77d248a3
670a98f4e89a265eb770ac7ecbdb5cc1552ded09
refs/heads/master
2021-04-22T13:08:16.073000
2021-04-21T15:10:53
2021-04-21T15:21:29
33,823,684
160
31
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2015-2021 Alexandr Evstigneev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package base; import com.intellij.execution.*; import com.intellij.execution.actions.ConfigurationContext; import com.intellij.execution.actions.ConfigurationFromContext; import com.intellij.execution.configurations.ConfigurationFactory; import com.intellij.execution.configurations.RunConfiguration; import com.intellij.execution.process.*; import com.intellij.execution.runners.ExecutionEnvironment; import com.intellij.execution.runners.ProgramRunner; import com.intellij.execution.testframework.TestTreeView; import com.intellij.execution.testframework.sm.runner.SMTestProxy; import com.intellij.execution.testframework.sm.runner.ui.SMTestRunnerResultsForm; import com.intellij.execution.ui.ExecutionConsole; import com.intellij.execution.ui.RunContentDescriptor; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.LangDataKeys; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.impl.NonBlockingReadActionImpl; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.module.Module; import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.projectRoots.impl.PerlSdkTable; import com.intellij.openapi.roots.ModuleRootManager; import com.intellij.openapi.roots.ModuleRootModificationUtil; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiManager; import com.intellij.testFramework.HeavyPlatformTestCase; import com.intellij.testFramework.PlatformTestUtil; import com.intellij.testFramework.TestActionEvent; import com.intellij.testFramework.UsefulTestCase; import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.tree.TreeUtil; import com.perl5.lang.perl.idea.project.PerlProjectManager; import com.perl5.lang.perl.idea.run.GenericPerlRunConfiguration; import com.perl5.lang.perl.idea.run.prove.PerlSMTRunnerConsoleView; import com.perl5.lang.perl.idea.run.prove.PerlTestRunConfiguration; import com.perl5.lang.perl.idea.sdk.host.PerlHostHandler; import com.perl5.lang.perl.idea.sdk.versionManager.PerlRealVersionManagerHandler; import com.perl5.lang.perl.idea.sdk.versionManager.perlbrew.PerlBrewTestUtil; import com.perl5.lang.perl.util.PerlRunUtil; import com.pty4j.util.Pair; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.concurrency.Promise; import org.junit.Assume; import org.junit.runner.Description; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.io.File; import java.io.IOException; import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.function.BooleanSupplier; import java.util.function.Function; @RunWith(JUnit4.class) public abstract class PerlPlatformTestCase extends HeavyPlatformTestCase { private static final int MAX_WAIT_TIME = 10_000; protected static final Logger LOG = Logger.getInstance(PerlPlatformTestCase.class); private static final String PERLBREW_HOME = "~/perl5/perlbrew/bin/perlbrew"; private static final String PERL_532 = "perl-5.32.0"; private static final String MOJO_LIB_SEPARATOR = "@"; private static final Key<CapturingProcessAdapter> ADAPTER_KEY = Key.create("process.adapter"); protected final Disposable myPerlLightTestCaseDisposable = Disposer.newDisposable(); @Override protected void setUp() throws Exception { super.setUp(); addPerlBrewSdk(getPerl532DistibutionId("plugin_test")); } protected void disposeOnPerlTearDown(@NotNull Disposable disposable) { Disposer.register(myPerlLightTestCaseDisposable, disposable); } @Override protected @NotNull Module doCreateRealModule(@NotNull String moduleName) { Module module = super.doCreateRealModule(moduleName); try { VirtualFile moduleRoot = getOrCreateProjectBaseDir().createChildDirectory(this, moduleName); ModuleRootModificationUtil.addContentRoot(module, moduleRoot); } catch (IOException e) { throw new RuntimeException(e); } return module; } protected @NotNull VirtualFile getMainContentRoot() { return ModuleRootManager.getInstance(getModule()).getContentRoots()[0]; } @Override protected void tearDown() throws Exception { try { ApplicationManager.getApplication().invokeAndWait(() -> { PerlProjectManager projectManager = PerlProjectManager.getInstance(getProject()); projectManager.setProjectSdk(null); projectManager.setExternalLibraries(Collections.emptyList()); }); Disposer.dispose(myPerlLightTestCaseDisposable); } finally { super.tearDown(); } } /** * As far as we can't provide additional rules, because of hacky way main rule works, you should * put additional logic in here * * @param description test method description */ protected void doEvaluate(@NotNull Description description) { } protected void addPerlBrewSdk(@NotNull String distributionId) { addSdk(getPerlbrewPath(), distributionId, PerlBrewTestUtil.getVersionManagerHandler()); } protected void addSdk(@NotNull String pathToVersionManager, @NotNull String distributionId, @NotNull PerlRealVersionManagerHandler<?, ?> versionManagerHandler) { versionManagerHandler.createInterpreter( distributionId, versionManagerHandler.createAdapter(pathToVersionManager, PerlHostHandler.getDefaultHandler().createData()), this::onSdkCreation, getProject() ); } private void onSdkCreation(@NotNull Sdk sdk) { PerlSdkTable.getInstance().addJdk(sdk, myPerlLightTestCaseDisposable); PerlProjectManager.getInstance(getProject()).setProjectSdk(sdk); PerlRunUtil.refreshSdkDirs(sdk, getProject()); } protected @Nullable Sdk getSdk() { return PerlProjectManager.getSdk(getModule()); } protected @NotNull String getPerl532DistibutionId(@Nullable String libraryName) { return StringUtil.isEmpty(libraryName) ? PERL_532 : PERL_532 + MOJO_LIB_SEPARATOR + libraryName; } protected void runAction(@NotNull AnAction anAction) { runAction(anAction, null); } protected void runAction(@NotNull AnAction anAction, @Nullable VirtualFile virtualFile) { TestActionEvent e = new TestActionEvent(dataId -> { if (LangDataKeys.MODULE.is(dataId)) { return getModule(); } else if (CommonDataKeys.PROJECT.is(dataId)) { return getProject(); } else if (CommonDataKeys.VIRTUAL_FILE.is(dataId)) { return virtualFile; } return null; }); anAction.update(e); assertTrue("Action unavailable: " + anAction, e.getPresentation().isEnabled()); anAction.actionPerformed(e); } protected static void assumePerlbrewAvailable() { Assume.assumeTrue(getPerlbrewFile() != null); } protected static @NotNull String getPerlbrewPath() { assumePerlbrewAvailable(); return Objects.requireNonNull(getPerlbrewFile()).getPath(); } protected static @Nullable File getPerlbrewFile() { String perlbrewHome = FileUtil.expandUserHome(PERLBREW_HOME); File perlbrewFile = new File(perlbrewHome); return perlbrewFile.exists() ? perlbrewFile : null; } protected String getBaseDataPath() { return ""; } protected final String getTestDataPath() { File file = new File(getBaseDataPath()); assertTrue("File not found: " + file, file.exists()); return file.getAbsolutePath(); } protected void copyDirToModule(@NotNull String directoryName) { File file = new File(getTestDataPath(), directoryName); assertTrue("File not found: " + file, file.exists()); VirtualFile virtualFile = refreshAndFindFile(file); assertNotNull("Unable to find virtual file for: " + file, virtualFile); virtualFile.refresh(false, true); copyDirContentsTo(virtualFile, getModuleRoot()); } protected @NotNull VirtualFile getModuleRoot() { try { return getOrCreateModuleDir(getModule()); } catch (IOException e) { throw new RuntimeException(e); } } protected @NotNull VirtualFile getModuleFile(@NotNull String relativePath) { VirtualFile file = getModuleRoot().findFileByRelativePath(relativePath); assertNotNull("Unable to find file in module: " + relativePath, file); return file; } protected @NotNull GenericPerlRunConfiguration createOnlyRunConfiguration(@NotNull String relativePath) { List<ConfigurationFromContext> configurationsFromContext = getRunConfigurationsFromFileContext(relativePath); assertSize(1, configurationsFromContext); ConfigurationFromContext configurationFromContext = configurationsFromContext.get(0); RunConfiguration runConfiguration = configurationFromContext.getConfiguration(); assertInstanceOf(runConfiguration, GenericPerlRunConfiguration.class); return (GenericPerlRunConfiguration)runConfiguration; } protected @NotNull List<ConfigurationFromContext> getRunConfigurationsFromFileContext(@NotNull String relativePath) { VirtualFile virtualFile = getModuleFile(relativePath); PsiElement psiElement = getPsiElement(virtualFile); ConfigurationContext configurationContext = ConfigurationContext.getFromContext(createDataContext( it -> LangDataKeys.PSI_ELEMENT_ARRAY.is(it) ? new PsiElement[]{psiElement} : null)); List<ConfigurationFromContext> configurationsFromContext = configurationContext.getConfigurationsFromContext(); assertNotNull(configurationsFromContext); return configurationsFromContext; } protected @NotNull PsiElement getPsiElement(VirtualFile virtualFile) { PsiManager psiManager = PsiManager.getInstance(getProject()); PsiElement psiElement = virtualFile.isDirectory() ? psiManager.findDirectory(virtualFile) : psiManager.findFile(virtualFile); assertNotNull(psiElement); return psiElement; } private @NotNull DataContext createDataContext() { return createDataContext(it -> null); } protected @NotNull DataContext createDataContext(@NotNull Function<String, Object> additionalData) { return dataId -> { if (CommonDataKeys.PROJECT.is(dataId)) { return getProject(); } else if (LangDataKeys.MODULE.is(dataId)) { return getModule(); } return additionalData.apply(dataId); }; } /** * Copy of {@link com.intellij.testFramework.PlatformTestUtil#executeConfiguration(RunConfiguration, String)} without waiting */ protected Pair<ExecutionEnvironment, RunContentDescriptor> executeConfiguration(@NotNull RunConfiguration runConfiguration, @NotNull String executorId) throws InterruptedException { Executor executor = ExecutorRegistry.getInstance().getExecutorById(executorId); assertNotNull("Unable to find executor: " + executorId, executor); return executeConfiguration(runConfiguration, executor); } protected @NotNull Pair<ExecutionEnvironment, RunContentDescriptor> executeConfiguration(@NotNull RunConfiguration runConfiguration, Executor executor) throws InterruptedException { Project project = runConfiguration.getProject(); ConfigurationFactory factory = runConfiguration.getFactory(); if (factory == null) { fail("No factory found for: " + runConfiguration); } RunnerAndConfigurationSettings runnerAndConfigurationSettings = RunManager.getInstance(project).createConfiguration(runConfiguration, factory); ProgramRunner<?> runner = ProgramRunner.getRunner(executor.getId(), runConfiguration); if (runner == null) { fail("No runner found for: " + executor.getId() + " and " + runConfiguration); } Ref<RunContentDescriptor> refRunContentDescriptor = new Ref<>(); ExecutionEnvironment executionEnvironment = new ExecutionEnvironment(executor, runner, runnerAndConfigurationSettings, project); CountDownLatch latch = new CountDownLatch(1); ProgramRunnerUtil.executeConfigurationAsync(executionEnvironment, false, false, descriptor -> { LOG.debug("Process started"); refRunContentDescriptor.set(descriptor); ProcessHandler processHandler = descriptor.getProcessHandler(); assertNotNull(processHandler); CapturingProcessAdapter capturingAdapter = new CapturingProcessAdapter(); processHandler.addProcessListener(capturingAdapter); processHandler.addProcessListener(new ProcessAdapter() { @Override public void startNotified(@NotNull ProcessEvent event) { LOG.debug("Process notified"); } @Override public void processTerminated(@NotNull ProcessEvent event) { LOG.debug("Process terminated with " + event.getExitCode()); } @Override public void onTextAvailable(@NotNull ProcessEvent event, @NotNull Key outputType) { LOG.debug(outputType + ": " + event.getText()); } }); ADAPTER_KEY.set(executionEnvironment, capturingAdapter); latch.countDown(); }); NonBlockingReadActionImpl.waitForAsyncTaskCompletion(); if (!latch.await(60, TimeUnit.SECONDS)) { fail("Process failed to start"); } RunContentDescriptor runContentDescriptor = refRunContentDescriptor.get(); ProcessHandler processHandler = runContentDescriptor.getProcessHandler(); assertNotNull(processHandler); disposeOnPerlTearDown(runContentDescriptor); disposeOnPerlTearDown(() -> { if (!processHandler.isProcessTerminated()) { processHandler.destroyProcess(); } UIUtil.dispatchAllInvocationEvents(); }); return Pair.create(executionEnvironment, runContentDescriptor); } protected final @Nullable CapturingProcessAdapter getCapturingAdapter(@NotNull ExecutionEnvironment environment) { return ADAPTER_KEY.get(environment); } protected String getResultsTestDataPath() { return getTestDataPath(); } public String getTestResultsFilePath(@NotNull String appendix) { return getResultsTestDataPath() + "/" + computeAnswerFileName(appendix); } protected @NotNull String computeAnswerFileName(@NotNull String appendix) { return computeAnswerFileNameWithoutExtension(appendix) + "." + getResultsFileExtension(); } protected @NotNull String computeAnswerFileNameWithoutExtension(@NotNull String appendix) { return getTestName(true) + appendix; } protected @NotNull String getResultsFileExtension() { return "txt"; } protected void waitForProcessFinish(ProcessHandler processHandler) { waitWithEventsDispatching("Process failed to finish in time", processHandler::isProcessTerminated); } protected @NotNull String serializeOutput(@Nullable ProcessOutput processOutput) { if (processOutput == null) { return "null"; } return "Exit code: " + processOutput.getExitCode() + PerlLightTestCaseBase.SEPARATOR_NEWLINES + "Stdout: " + processOutput.getStdout() + PerlLightTestCaseBase.SEPARATOR_NEWLINES + "Stderr: " + processOutput.getStderr(); } protected @NotNull String serializeTestNode(@Nullable SMTestProxy node, @NotNull String indent) { if (node == null) { return "null"; } StringBuilder sb = new StringBuilder(indent).append(node.getName()); String state; if (node.isIgnored()) { state = "ignored"; } else if (node.isInterrupted()) { state = "interrupted"; } else if (node.isPassed()) { state = "passed"; } else { state = "failed"; } sb.append(" (").append(state); if (node.isSuite()) { sb.append(" suite"); } else { sb.append(" test"); } sb.append(")"); String stacktrace = node.getStacktrace(); if (StringUtil.isNotEmpty(stacktrace)) { sb.append(PerlLightTestCaseBase.SEPARATOR_NEWLINES) .append(stacktrace.replaceAll(Objects.requireNonNull(getProject().getBasePath()), "/DATA_PATH")) .append(PerlLightTestCaseBase.SEPARATOR_NEWLINES); } else { sb.append("\n"); } for (SMTestProxy child : node.getChildren()) { sb.append(StringUtil.trimEnd(serializeTestNode(child, " " + indent), '\n')).append("\n"); } return sb.toString(); } protected void runTestConfigurationWithExecutorAndCheckResultsWithFile(GenericPerlRunConfiguration runConfiguration, String executorId) { Pair<ExecutionEnvironment, RunContentDescriptor> execResult; try { execResult = executeConfiguration(runConfiguration, executorId); } catch (InterruptedException e) { throw new RuntimeException(e); } RunContentDescriptor contentDescriptor = execResult.second; ProcessHandler processHandler = contentDescriptor.getProcessHandler(); assertNotNull(processHandler); waitForProcessFinish(processHandler); checkTestRunResultsWithFile(contentDescriptor); } protected void checkTestRunResultsWithFile(RunContentDescriptor contentDescriptor) { ExecutionConsole executionConsole = contentDescriptor.getExecutionConsole(); assertInstanceOf(executionConsole, PerlSMTRunnerConsoleView.class); SMTestRunnerResultsForm resultsViewer = ((PerlSMTRunnerConsoleView)executionConsole).getResultsViewer(); TestTreeView testTreeView = resultsViewer.getTreeView(); assertNotNull(testTreeView); Promise<?> promise = TreeUtil.promiseExpandAll(testTreeView); waitWithEventsDispatching("Failed to expand tests tree", promise::isSucceeded); UsefulTestCase.assertSameLinesWithFile(getTestResultsFilePath(".tests"), serializeTestNode(resultsViewer.getTestsRootNode(), "")); } protected @NotNull PerlTestRunConfiguration createTestRunConfiguration(@NotNull String file) { GenericPerlRunConfiguration runConfiguration = createOnlyRunConfiguration(file); assertInstanceOf(runConfiguration, PerlTestRunConfiguration.class); return (PerlTestRunConfiguration)runConfiguration; } protected void waitWithEventsDispatching(@NotNull String errorMessage, @NotNull BooleanSupplier condition) { long start = System.currentTimeMillis(); while (true) { try { if (System.currentTimeMillis() - start > MAX_WAIT_TIME) { fail(errorMessage); } if (condition.getAsBoolean()) { break; } PlatformTestUtil.dispatchAllEventsInIdeEventQueue(); Thread.sleep(10); } catch (InterruptedException e) { throw new RuntimeException(e); } } } }
UTF-8
Java
19,683
java
PerlPlatformTestCase.java
Java
[ { "context": "/*\n * Copyright 2015-2021 Alexandr Evstigneev\n *\n * Licensed under the Apache License, Version ", "end": 45, "score": 0.9998596906661987, "start": 26, "tag": "NAME", "value": "Alexandr Evstigneev" }, { "context": "apturingProcessAdapter> ADAPTER_KEY = Key.create(\"process.adapter\");\n\n protected final Disposable myPerlLightTestC", "end": 4357, "score": 0.8301842212677002, "start": 4342, "tag": "KEY", "value": "process.adapter" } ]
null
[]
/* * Copyright 2015-2021 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package base; import com.intellij.execution.*; import com.intellij.execution.actions.ConfigurationContext; import com.intellij.execution.actions.ConfigurationFromContext; import com.intellij.execution.configurations.ConfigurationFactory; import com.intellij.execution.configurations.RunConfiguration; import com.intellij.execution.process.*; import com.intellij.execution.runners.ExecutionEnvironment; import com.intellij.execution.runners.ProgramRunner; import com.intellij.execution.testframework.TestTreeView; import com.intellij.execution.testframework.sm.runner.SMTestProxy; import com.intellij.execution.testframework.sm.runner.ui.SMTestRunnerResultsForm; import com.intellij.execution.ui.ExecutionConsole; import com.intellij.execution.ui.RunContentDescriptor; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.LangDataKeys; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.impl.NonBlockingReadActionImpl; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.module.Module; import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.projectRoots.impl.PerlSdkTable; import com.intellij.openapi.roots.ModuleRootManager; import com.intellij.openapi.roots.ModuleRootModificationUtil; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiManager; import com.intellij.testFramework.HeavyPlatformTestCase; import com.intellij.testFramework.PlatformTestUtil; import com.intellij.testFramework.TestActionEvent; import com.intellij.testFramework.UsefulTestCase; import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.tree.TreeUtil; import com.perl5.lang.perl.idea.project.PerlProjectManager; import com.perl5.lang.perl.idea.run.GenericPerlRunConfiguration; import com.perl5.lang.perl.idea.run.prove.PerlSMTRunnerConsoleView; import com.perl5.lang.perl.idea.run.prove.PerlTestRunConfiguration; import com.perl5.lang.perl.idea.sdk.host.PerlHostHandler; import com.perl5.lang.perl.idea.sdk.versionManager.PerlRealVersionManagerHandler; import com.perl5.lang.perl.idea.sdk.versionManager.perlbrew.PerlBrewTestUtil; import com.perl5.lang.perl.util.PerlRunUtil; import com.pty4j.util.Pair; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.concurrency.Promise; import org.junit.Assume; import org.junit.runner.Description; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.io.File; import java.io.IOException; import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.function.BooleanSupplier; import java.util.function.Function; @RunWith(JUnit4.class) public abstract class PerlPlatformTestCase extends HeavyPlatformTestCase { private static final int MAX_WAIT_TIME = 10_000; protected static final Logger LOG = Logger.getInstance(PerlPlatformTestCase.class); private static final String PERLBREW_HOME = "~/perl5/perlbrew/bin/perlbrew"; private static final String PERL_532 = "perl-5.32.0"; private static final String MOJO_LIB_SEPARATOR = "@"; private static final Key<CapturingProcessAdapter> ADAPTER_KEY = Key.create("process.adapter"); protected final Disposable myPerlLightTestCaseDisposable = Disposer.newDisposable(); @Override protected void setUp() throws Exception { super.setUp(); addPerlBrewSdk(getPerl532DistibutionId("plugin_test")); } protected void disposeOnPerlTearDown(@NotNull Disposable disposable) { Disposer.register(myPerlLightTestCaseDisposable, disposable); } @Override protected @NotNull Module doCreateRealModule(@NotNull String moduleName) { Module module = super.doCreateRealModule(moduleName); try { VirtualFile moduleRoot = getOrCreateProjectBaseDir().createChildDirectory(this, moduleName); ModuleRootModificationUtil.addContentRoot(module, moduleRoot); } catch (IOException e) { throw new RuntimeException(e); } return module; } protected @NotNull VirtualFile getMainContentRoot() { return ModuleRootManager.getInstance(getModule()).getContentRoots()[0]; } @Override protected void tearDown() throws Exception { try { ApplicationManager.getApplication().invokeAndWait(() -> { PerlProjectManager projectManager = PerlProjectManager.getInstance(getProject()); projectManager.setProjectSdk(null); projectManager.setExternalLibraries(Collections.emptyList()); }); Disposer.dispose(myPerlLightTestCaseDisposable); } finally { super.tearDown(); } } /** * As far as we can't provide additional rules, because of hacky way main rule works, you should * put additional logic in here * * @param description test method description */ protected void doEvaluate(@NotNull Description description) { } protected void addPerlBrewSdk(@NotNull String distributionId) { addSdk(getPerlbrewPath(), distributionId, PerlBrewTestUtil.getVersionManagerHandler()); } protected void addSdk(@NotNull String pathToVersionManager, @NotNull String distributionId, @NotNull PerlRealVersionManagerHandler<?, ?> versionManagerHandler) { versionManagerHandler.createInterpreter( distributionId, versionManagerHandler.createAdapter(pathToVersionManager, PerlHostHandler.getDefaultHandler().createData()), this::onSdkCreation, getProject() ); } private void onSdkCreation(@NotNull Sdk sdk) { PerlSdkTable.getInstance().addJdk(sdk, myPerlLightTestCaseDisposable); PerlProjectManager.getInstance(getProject()).setProjectSdk(sdk); PerlRunUtil.refreshSdkDirs(sdk, getProject()); } protected @Nullable Sdk getSdk() { return PerlProjectManager.getSdk(getModule()); } protected @NotNull String getPerl532DistibutionId(@Nullable String libraryName) { return StringUtil.isEmpty(libraryName) ? PERL_532 : PERL_532 + MOJO_LIB_SEPARATOR + libraryName; } protected void runAction(@NotNull AnAction anAction) { runAction(anAction, null); } protected void runAction(@NotNull AnAction anAction, @Nullable VirtualFile virtualFile) { TestActionEvent e = new TestActionEvent(dataId -> { if (LangDataKeys.MODULE.is(dataId)) { return getModule(); } else if (CommonDataKeys.PROJECT.is(dataId)) { return getProject(); } else if (CommonDataKeys.VIRTUAL_FILE.is(dataId)) { return virtualFile; } return null; }); anAction.update(e); assertTrue("Action unavailable: " + anAction, e.getPresentation().isEnabled()); anAction.actionPerformed(e); } protected static void assumePerlbrewAvailable() { Assume.assumeTrue(getPerlbrewFile() != null); } protected static @NotNull String getPerlbrewPath() { assumePerlbrewAvailable(); return Objects.requireNonNull(getPerlbrewFile()).getPath(); } protected static @Nullable File getPerlbrewFile() { String perlbrewHome = FileUtil.expandUserHome(PERLBREW_HOME); File perlbrewFile = new File(perlbrewHome); return perlbrewFile.exists() ? perlbrewFile : null; } protected String getBaseDataPath() { return ""; } protected final String getTestDataPath() { File file = new File(getBaseDataPath()); assertTrue("File not found: " + file, file.exists()); return file.getAbsolutePath(); } protected void copyDirToModule(@NotNull String directoryName) { File file = new File(getTestDataPath(), directoryName); assertTrue("File not found: " + file, file.exists()); VirtualFile virtualFile = refreshAndFindFile(file); assertNotNull("Unable to find virtual file for: " + file, virtualFile); virtualFile.refresh(false, true); copyDirContentsTo(virtualFile, getModuleRoot()); } protected @NotNull VirtualFile getModuleRoot() { try { return getOrCreateModuleDir(getModule()); } catch (IOException e) { throw new RuntimeException(e); } } protected @NotNull VirtualFile getModuleFile(@NotNull String relativePath) { VirtualFile file = getModuleRoot().findFileByRelativePath(relativePath); assertNotNull("Unable to find file in module: " + relativePath, file); return file; } protected @NotNull GenericPerlRunConfiguration createOnlyRunConfiguration(@NotNull String relativePath) { List<ConfigurationFromContext> configurationsFromContext = getRunConfigurationsFromFileContext(relativePath); assertSize(1, configurationsFromContext); ConfigurationFromContext configurationFromContext = configurationsFromContext.get(0); RunConfiguration runConfiguration = configurationFromContext.getConfiguration(); assertInstanceOf(runConfiguration, GenericPerlRunConfiguration.class); return (GenericPerlRunConfiguration)runConfiguration; } protected @NotNull List<ConfigurationFromContext> getRunConfigurationsFromFileContext(@NotNull String relativePath) { VirtualFile virtualFile = getModuleFile(relativePath); PsiElement psiElement = getPsiElement(virtualFile); ConfigurationContext configurationContext = ConfigurationContext.getFromContext(createDataContext( it -> LangDataKeys.PSI_ELEMENT_ARRAY.is(it) ? new PsiElement[]{psiElement} : null)); List<ConfigurationFromContext> configurationsFromContext = configurationContext.getConfigurationsFromContext(); assertNotNull(configurationsFromContext); return configurationsFromContext; } protected @NotNull PsiElement getPsiElement(VirtualFile virtualFile) { PsiManager psiManager = PsiManager.getInstance(getProject()); PsiElement psiElement = virtualFile.isDirectory() ? psiManager.findDirectory(virtualFile) : psiManager.findFile(virtualFile); assertNotNull(psiElement); return psiElement; } private @NotNull DataContext createDataContext() { return createDataContext(it -> null); } protected @NotNull DataContext createDataContext(@NotNull Function<String, Object> additionalData) { return dataId -> { if (CommonDataKeys.PROJECT.is(dataId)) { return getProject(); } else if (LangDataKeys.MODULE.is(dataId)) { return getModule(); } return additionalData.apply(dataId); }; } /** * Copy of {@link com.intellij.testFramework.PlatformTestUtil#executeConfiguration(RunConfiguration, String)} without waiting */ protected Pair<ExecutionEnvironment, RunContentDescriptor> executeConfiguration(@NotNull RunConfiguration runConfiguration, @NotNull String executorId) throws InterruptedException { Executor executor = ExecutorRegistry.getInstance().getExecutorById(executorId); assertNotNull("Unable to find executor: " + executorId, executor); return executeConfiguration(runConfiguration, executor); } protected @NotNull Pair<ExecutionEnvironment, RunContentDescriptor> executeConfiguration(@NotNull RunConfiguration runConfiguration, Executor executor) throws InterruptedException { Project project = runConfiguration.getProject(); ConfigurationFactory factory = runConfiguration.getFactory(); if (factory == null) { fail("No factory found for: " + runConfiguration); } RunnerAndConfigurationSettings runnerAndConfigurationSettings = RunManager.getInstance(project).createConfiguration(runConfiguration, factory); ProgramRunner<?> runner = ProgramRunner.getRunner(executor.getId(), runConfiguration); if (runner == null) { fail("No runner found for: " + executor.getId() + " and " + runConfiguration); } Ref<RunContentDescriptor> refRunContentDescriptor = new Ref<>(); ExecutionEnvironment executionEnvironment = new ExecutionEnvironment(executor, runner, runnerAndConfigurationSettings, project); CountDownLatch latch = new CountDownLatch(1); ProgramRunnerUtil.executeConfigurationAsync(executionEnvironment, false, false, descriptor -> { LOG.debug("Process started"); refRunContentDescriptor.set(descriptor); ProcessHandler processHandler = descriptor.getProcessHandler(); assertNotNull(processHandler); CapturingProcessAdapter capturingAdapter = new CapturingProcessAdapter(); processHandler.addProcessListener(capturingAdapter); processHandler.addProcessListener(new ProcessAdapter() { @Override public void startNotified(@NotNull ProcessEvent event) { LOG.debug("Process notified"); } @Override public void processTerminated(@NotNull ProcessEvent event) { LOG.debug("Process terminated with " + event.getExitCode()); } @Override public void onTextAvailable(@NotNull ProcessEvent event, @NotNull Key outputType) { LOG.debug(outputType + ": " + event.getText()); } }); ADAPTER_KEY.set(executionEnvironment, capturingAdapter); latch.countDown(); }); NonBlockingReadActionImpl.waitForAsyncTaskCompletion(); if (!latch.await(60, TimeUnit.SECONDS)) { fail("Process failed to start"); } RunContentDescriptor runContentDescriptor = refRunContentDescriptor.get(); ProcessHandler processHandler = runContentDescriptor.getProcessHandler(); assertNotNull(processHandler); disposeOnPerlTearDown(runContentDescriptor); disposeOnPerlTearDown(() -> { if (!processHandler.isProcessTerminated()) { processHandler.destroyProcess(); } UIUtil.dispatchAllInvocationEvents(); }); return Pair.create(executionEnvironment, runContentDescriptor); } protected final @Nullable CapturingProcessAdapter getCapturingAdapter(@NotNull ExecutionEnvironment environment) { return ADAPTER_KEY.get(environment); } protected String getResultsTestDataPath() { return getTestDataPath(); } public String getTestResultsFilePath(@NotNull String appendix) { return getResultsTestDataPath() + "/" + computeAnswerFileName(appendix); } protected @NotNull String computeAnswerFileName(@NotNull String appendix) { return computeAnswerFileNameWithoutExtension(appendix) + "." + getResultsFileExtension(); } protected @NotNull String computeAnswerFileNameWithoutExtension(@NotNull String appendix) { return getTestName(true) + appendix; } protected @NotNull String getResultsFileExtension() { return "txt"; } protected void waitForProcessFinish(ProcessHandler processHandler) { waitWithEventsDispatching("Process failed to finish in time", processHandler::isProcessTerminated); } protected @NotNull String serializeOutput(@Nullable ProcessOutput processOutput) { if (processOutput == null) { return "null"; } return "Exit code: " + processOutput.getExitCode() + PerlLightTestCaseBase.SEPARATOR_NEWLINES + "Stdout: " + processOutput.getStdout() + PerlLightTestCaseBase.SEPARATOR_NEWLINES + "Stderr: " + processOutput.getStderr(); } protected @NotNull String serializeTestNode(@Nullable SMTestProxy node, @NotNull String indent) { if (node == null) { return "null"; } StringBuilder sb = new StringBuilder(indent).append(node.getName()); String state; if (node.isIgnored()) { state = "ignored"; } else if (node.isInterrupted()) { state = "interrupted"; } else if (node.isPassed()) { state = "passed"; } else { state = "failed"; } sb.append(" (").append(state); if (node.isSuite()) { sb.append(" suite"); } else { sb.append(" test"); } sb.append(")"); String stacktrace = node.getStacktrace(); if (StringUtil.isNotEmpty(stacktrace)) { sb.append(PerlLightTestCaseBase.SEPARATOR_NEWLINES) .append(stacktrace.replaceAll(Objects.requireNonNull(getProject().getBasePath()), "/DATA_PATH")) .append(PerlLightTestCaseBase.SEPARATOR_NEWLINES); } else { sb.append("\n"); } for (SMTestProxy child : node.getChildren()) { sb.append(StringUtil.trimEnd(serializeTestNode(child, " " + indent), '\n')).append("\n"); } return sb.toString(); } protected void runTestConfigurationWithExecutorAndCheckResultsWithFile(GenericPerlRunConfiguration runConfiguration, String executorId) { Pair<ExecutionEnvironment, RunContentDescriptor> execResult; try { execResult = executeConfiguration(runConfiguration, executorId); } catch (InterruptedException e) { throw new RuntimeException(e); } RunContentDescriptor contentDescriptor = execResult.second; ProcessHandler processHandler = contentDescriptor.getProcessHandler(); assertNotNull(processHandler); waitForProcessFinish(processHandler); checkTestRunResultsWithFile(contentDescriptor); } protected void checkTestRunResultsWithFile(RunContentDescriptor contentDescriptor) { ExecutionConsole executionConsole = contentDescriptor.getExecutionConsole(); assertInstanceOf(executionConsole, PerlSMTRunnerConsoleView.class); SMTestRunnerResultsForm resultsViewer = ((PerlSMTRunnerConsoleView)executionConsole).getResultsViewer(); TestTreeView testTreeView = resultsViewer.getTreeView(); assertNotNull(testTreeView); Promise<?> promise = TreeUtil.promiseExpandAll(testTreeView); waitWithEventsDispatching("Failed to expand tests tree", promise::isSucceeded); UsefulTestCase.assertSameLinesWithFile(getTestResultsFilePath(".tests"), serializeTestNode(resultsViewer.getTestsRootNode(), "")); } protected @NotNull PerlTestRunConfiguration createTestRunConfiguration(@NotNull String file) { GenericPerlRunConfiguration runConfiguration = createOnlyRunConfiguration(file); assertInstanceOf(runConfiguration, PerlTestRunConfiguration.class); return (PerlTestRunConfiguration)runConfiguration; } protected void waitWithEventsDispatching(@NotNull String errorMessage, @NotNull BooleanSupplier condition) { long start = System.currentTimeMillis(); while (true) { try { if (System.currentTimeMillis() - start > MAX_WAIT_TIME) { fail(errorMessage); } if (condition.getAsBoolean()) { break; } PlatformTestUtil.dispatchAllEventsInIdeEventQueue(); Thread.sleep(10); } catch (InterruptedException e) { throw new RuntimeException(e); } } } }
19,670
0.743637
0.740792
492
39.006096
32.592674
139
false
false
0
0
0
0
0
0
0.607724
false
false
11
1b4e42f8324cb1666d9c87a0844d54d7122700d9
17,239,998,731,124
4a6604c2145119bdd55fcef742a246a9df749dee
/olib-rss-rest/olib-rss-rest-collector/src/main/java/com/olib/rss/collector/model/RssCollectHistory.java
e4f450068c7d6c68498d7fd9d9712b6e82f4cef4
[]
no_license
ossang/olib-rss
https://github.com/ossang/olib-rss
728dc9860a33bb37902d968422bbe069fd14161e
1f10559c4cd9853352db0e70e3b97006dada3aea
refs/heads/master
2022-12-27T05:55:24.253000
2019-08-10T07:09:55
2019-08-10T07:09:55
85,173,106
2
1
null
false
2022-12-08T23:47:48
2017-03-16T08:47:05
2019-08-10T07:09:57
2022-12-08T23:47:45
31,556
2
1
4
TypeScript
false
false
package com.olib.rss.collector.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity public class RssCollectHistory { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private long id; private String name; private String url; private String collectDate; private int collectCount; public RssCollectHistory() {} public RssCollectHistory( String name, String url, String collectDate, int collectCount) { this.name = name; this.url = url; this.collectDate = collectDate; this.collectCount = collectCount; } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getCollectDate() { return collectDate; } public void setCollectDate(String collectDate) { this.collectDate = collectDate; } public int getCollectCount() { return collectCount; } public void setCollectCount(int collectCount) { this.collectCount = collectCount; } }
UTF-8
Java
1,250
java
RssCollectHistory.java
Java
[]
null
[]
package com.olib.rss.collector.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity public class RssCollectHistory { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private long id; private String name; private String url; private String collectDate; private int collectCount; public RssCollectHistory() {} public RssCollectHistory( String name, String url, String collectDate, int collectCount) { this.name = name; this.url = url; this.collectDate = collectDate; this.collectCount = collectCount; } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getCollectDate() { return collectDate; } public void setCollectDate(String collectDate) { this.collectDate = collectDate; } public int getCollectCount() { return collectCount; } public void setCollectCount(int collectCount) { this.collectCount = collectCount; } }
1,250
0.7216
0.7216
72
16.361111
14.775455
50
false
false
0
0
0
0
0
0
1.402778
false
false
11
be403b58814957bb416a0f4311621cf6c7ad6ed9
17,119,739,683,647
b89fe8a102ca2370c958a22514d1450175d5f868
/controller/BankController1.java
1856e2ae9c894e0e173a4b2d87794747d856812e
[]
no_license
SteefP/myHomeBank
https://github.com/SteefP/myHomeBank
e9f20e50d8d8d6f7c6b37de414ecd68e77bc9955
72d6b7ea50244a5d416d782fc0d4ca4e88513e0c
refs/heads/master
2021-01-16T00:03:28.662000
2017-10-12T12:39:15
2017-10-12T12:39:15
99,954,662
0
1
null
false
2017-08-29T15:10:30
2017-08-10T18:43:39
2017-08-27T21:22:02
2017-08-29T15:10:29
5,725
0
1
1
Java
null
null
package controller; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.time.LocalDate; import java.time.Period; import java.util.ArrayList; import org.jfree.data.category.DefaultCategoryDataset; import org.jfree.data.general.DefaultPieDataset; import model.*; public class BankController1 implements BankControllerInterface { BankModelInterface bankModel; public BankController1(BankModelInterface bankModel) { this.bankModel = bankModel; } @Override public void loadTransactionFile(File file) { bankModel.loadTransactionFile(file); } @Override public void loadCategoryFile(File file) { bankModel.loadCategoryFile(file); } @Override public void saveState() { bankModel.saveState(); } @Override public void excludeTransactionFromAnalisys(Transaction t){ bankModel.getTransactions().remove(t); bankModel.getExcludedTransactions().add(t); } @Override public void addCategory(Category category){ bankModel.getCategories().add(category); } @Override public void removeCategory(Category category){ bankModel.getCategories().remove(category); } @Override public ArrayList<Category> getCategories() { return bankModel.getCategories(); } @Override public ArrayList<Transaction> getTransactions() { return bankModel.getTransactions(); } @Override // Data are INCLUDING the first date (day), EXLUDING the last date (day), so you can put 1-5-2016, 1-6-2016 and get one month including the first of the month public double categoryTotal(String category, String debcred, LocalDate date1, LocalDate date2){ Category tempCat = null; // for flexibilty reasons this methods takes a String value for the category, but for checking subcategories the real category is needed for(Category c: bankModel.getCategories()){ if(c.getName().equals(category)){ tempCat= c; } } double total = 0; for(Transaction t: bankModel.getTransactions()){ if(date1.isEqual(t.getTransactionDate()) || date1.isBefore(t.getTransactionDate()) && date2.isAfter(t.getTransactionDate())) if(t.getDebetOrCredit().equals(debcred)){ if(t.getCategory().getName().equals(category)){ total += t.getAmount(); } for(SubCategory sc : tempCat.getSubCategories()){ if(t.getCategory().getName().equals(sc.getName())){ total += t.getAmount(); } } } } return total; } @Override public double subCategoryTotal(String subCategory, LocalDate date1, LocalDate date2){ double total = 0; for(Transaction t: bankModel.getTransactions()){ if(date1.isEqual(t.getTransactionDate()) || date1.isBefore(t.getTransactionDate()) && date2.isAfter(t.getTransactionDate())) if(t.getCategory().getName().equals(subCategory)){ total += t.getAmount(); if(t.getCategory().getName().equals("Gas & elektriciteit")){ System.out.println("Subcategory "+t.getCategory().getName()+ " added amount of " + t.getAmount() +" dd "+ t.getTransactionDate() ); }; } } return total; } @Override public double generalTotal(String debcred, LocalDate date1, LocalDate date2){ double total = 0; for(Transaction t: bankModel.getTransactions()){ if(date1.isEqual(t.getTransactionDate()) || date1.isBefore(t.getTransactionDate()) && date2.isAfter(t.getTransactionDate())){ if(t.getDebetOrCredit().equals(debcred)){ total += t.getAmount(); } } } return total; } @Override public ArrayList<Transaction> searchTransactions(LocalDate date1, LocalDate date2, String category, int minAmount) { ArrayList<Transaction> transactionsToBeCategorised = new ArrayList<Transaction>(); // Creates a local ArrayList temp to list the transactions that match the criteria, and reverses the ordering to biggest amount on index 0 etc. int size = bankModel.getTransactions().size(); for(int i = 1; i < size-1; i++){ Transaction t = bankModel.getTransactions().get(size-i); LocalDate d = bankModel.getTransactions().get(size-i).getTransactionDate(); if(date1.isEqual(d) || date1.isBefore(d) && date2.isAfter(d)) if(t.getAmount()> minAmount) if(t.getCategory().getName().equals(category)) { //If criteria match transaction t is added to the list to be categorized transactionsToBeCategorised.add(t); } } return transactionsToBeCategorised; } @Override public ArrayList<Transaction> searchTransactions(LocalDate date1, LocalDate date2, String category, int minAmount, String debcred) { ArrayList<Transaction> transactionsToBeCategorised = new ArrayList<Transaction>(); int size = bankModel.getTransactions().size(); for(int i = 1; i < size-1; i++){ Transaction t = bankModel.getTransactions().get(size-i); LocalDate d = bankModel.getTransactions().get(size-i).getTransactionDate(); if(date1.isEqual(d) || date1.isBefore(d) && date2.isAfter(d)){ if(t.getAmount()> minAmount){ if(t.getDebetOrCredit().equals(debcred)){ try { if(t.getCategory().getName().equals(category)) { transactionsToBeCategorised.add(t); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } } return transactionsToBeCategorised; } @Override public void addRuleToCategory(String debCred, String category, Rule rule) { for(Category c : bankModel.getCategories()){ if(c.getDebetOrCredit().equals(debCred)){ String tempname = c.getName(); if(tempname.equalsIgnoreCase(category)){ c.getRules().add(rule); } } } System.out.println("Made a new rule"); checkTransactionsAgianstRules("not yet assigned"); } // Currently not used @Override public void addKeyWordToCategory(String category, String keyword){ for(Category c : bankModel.getCategories()){ String tempname = c.getName(); if(tempname.equalsIgnoreCase(category)){ c.getKeyWords().add(keyword); } } } @Override public void removeKeyWordFromCategory(String category, String keyword){ for(Category c : bankModel.getCategories()){ String tempname = c.getName(); if(tempname.equalsIgnoreCase(category)){ c.getKeyWords().remove(keyword); } } } // Currently not used @Override public void addAccountToCategory(String category, String account){ for(Category c : bankModel.getCategories()){ String tempname = c.getName(); if(tempname.equalsIgnoreCase(category)){ c.getCounterAccounts().add(account); } } } @Override public void removeAccountFromCategory(String category, String account){ for(Category c : bankModel.getCategories()){ String tempname = c.getName(); if(tempname.equalsIgnoreCase(category)){ c.getCounterAccounts().remove(account); } } } @Override public void checkTransactionsAgainstKeyWords(String categoryName){ //Checks against keyword and set a category for(Transaction t: bankModel.getTransactions()){ if(t.getCategory().getName().equals(categoryName)){ for(Category category : bankModel.getCategories()){ for(String s : category.getKeyWords()){ if(t.getDescription().toUpperCase().contains(s.toUpperCase())){ t.setCategory(category); } } for(SubCategory sb : category.getSubCategories()){ for(String s : sb.getKeyWords()){ if(t.getDescription().toUpperCase().contains(s.toUpperCase())){ t.setCategory(sb); System.out.println("Transaction :" + " added to catgory " +sb); } } } } } } } @Override public void checkTransactionsAgainstCounterAccounts(String categoryName){ for(Transaction t: bankModel.getTransactions()){ if (t.getCategory().getName().equals(categoryName)) { for (Category category : bankModel.getCategories()) { for (String a : category.getCounterAccounts()) { if (t.getOtherEndOfTransactionName().equals(a)) { t.setCategory(category); } } for (SubCategory sb : category.getSubCategories()) { for (String a : sb.getCounterAccounts()) { if (t.getOtherEndOfTransactionName().equals(a)) { t.setCategory(sb); } } } } } } } @Override public void checkTransactionsAgianstRules(String categoryName){ for(Transaction t: bankModel.getTransactions()){ if (t.getCategory().getName().equals(categoryName)) { for (Category category : bankModel.getCategories()) { if (!category.getRules().isEmpty()) { for (Rule r : category.getRules()) { Boolean keyword = false; Boolean minAmount = false; Boolean maxAmount = false; Boolean startDate = false; Boolean endDate = false; Boolean counterAccount = false; Boolean counterAcccountDiscription = false; if (r.getKeyword() == null) { keyword = true; } else if (t.getDescription().contains(r.getKeyword())) { keyword = true; } if (r.getMinAmount() < t.getAmount()) { minAmount = true; } if ((r.getMaxAmount() == 0)) { maxAmount = true; } else if (r.getMaxAmount() > t.getAmount()) { maxAmount = true; } if (r.getStartDate() == null) { startDate = true; } else if (r.getStartDate().isBefore(t.getTransactionDate())) { startDate = true; } if (r.getEndDate() == null) { endDate = true; } else if (r.getEndDate().isAfter(t.getTransactionDate())) { endDate = true; } if (r.getCounterAccount() == null) { counterAccount = true; } else if (r.getCounterAccount().equals(t.getOtherEndOfTransactionAccount())) { counterAccount = true; } if (r.getCounterAcccountDiscription() == null) { counterAcccountDiscription = true; } else if (r.getCounterAcccountDiscription() .equalsIgnoreCase(t.getOtherEndOfTransactionName())) { counterAcccountDiscription = true; } if (keyword & minAmount & maxAmount & startDate & endDate & counterAccount & counterAcccountDiscription) { t.setCategory(category); System.out.println("transaction: " + t + "is categorized as " + category); } } // close for rule } // close if cat not empty for (SubCategory sc : category.getSubCategories()){ if (!sc.getRules().isEmpty()){ for (Rule r : sc.getRules()) { Boolean keyword = false; Boolean minAmount = false; Boolean maxAmount = false; Boolean startDate = false; Boolean endDate = false; Boolean counterAccount = false; Boolean counterAcccountDiscription = false; if (r.getKeyword() == null) { keyword = true; } else if (t.getDescription().contains(r.getKeyword())) { keyword = true; } if (r.getMinAmount() < t.getAmount()) { minAmount = true; } if ((r.getMaxAmount() == 0)) { maxAmount = true; } else if (r.getMaxAmount() > t.getAmount()) { maxAmount = true; } if (r.getStartDate() == null) { startDate = true; } else if (r.getStartDate().isBefore(t.getTransactionDate())) { startDate = true; } if (r.getEndDate() == null) { endDate = true; } else if (r.getEndDate().isAfter(t.getTransactionDate())) { endDate = true; } if (r.getCounterAccount() == null) { counterAccount = true; } else if (r.getCounterAccount().equals(t.getOtherEndOfTransactionAccount())) { counterAccount = true; } if (r.getCounterAcccountDiscription() == null) { counterAcccountDiscription = true; } else if (r.getCounterAcccountDiscription() .equalsIgnoreCase(t.getOtherEndOfTransactionName())) { counterAcccountDiscription = true; } if (keyword & minAmount & maxAmount & startDate & endDate & counterAccount & counterAcccountDiscription) { t.setCategory(sc); System.out.println("transaction: " + t + "is categorized as " + sc); } } // close for rule } // close if subcategory } //close for sub category } // close for category } // close if category } //close for transaction } //close method @Override // This function is misplaced shoul be in model, of al the things that dont have to be in the model should be in the controller public void saveCategories(File file){ try{ FileWriter writer = new FileWriter(file); for(Category c : bankModel.getCategories()){ ArrayList<String> tempDisc = c.getKeyWords(); System.out.println(c); writer.write(c.getdebetOrCredit()+ "; "); writer.write(c.getFixedOrVariable()+ "; "); writer.write(c.getName()+ "; "); if(!tempDisc.isEmpty()){ for(int i = 0; i < tempDisc.size()-1; i++){ writer.write(tempDisc.get(i) +"; "); } writer.write(tempDisc.get(tempDisc.size()-1)); } writer.write("\r\n"); } writer.close(); } catch(IOException ex) { System.out.println("couldn't write the categoryList out"); ex.printStackTrace(); } } @Override public void clearAll() { System.out.println("Clear all"); bankModel.clearTransactions(); bankModel.clearCategories(); } // Helper convenience method double Total(String debcred, LocalDate date1, LocalDate date2){ double total = 0; for(Transaction t: bankModel.getTransactions()){ if(date1.isEqual(t.getTransactionDate()) || date1.isBefore(t.getTransactionDate()) && date2.isAfter(t.getTransactionDate())) if(t.getDebetOrCredit().equals(debcred)) total += t.getAmount(); } return total; } @Override public String toString(){ return "controller 1"; } /* * DEPRECATED METHODS DEPRECATED METHODS DEPRECATED METHODS DEPRECATED METHODS DEPRECATED METHODS */ @Override public DefaultCategoryDataset createMontlyDataset(LocalDate date1, LocalDate date2, String debCred){ DefaultCategoryDataset dataset = new DefaultCategoryDataset(); Period p = Period.between(date1, date2); int maxI = p.getMonths() + p.getYears()*12; System.out.println(maxI); for(int i = 0; i < maxI; i++){ for(Category category : bankModel.getCategories()){ double m1 = categoryTotal(category.getName(), debCred, date1.plusMonths(i), date1.plusMonths(1 + i)); if(m1 > 0) dataset.addValue(m1, category.getName(), date1.plusMonths(i).getMonth().toString().substring(0,3)); } } return dataset; } @Override public DefaultCategoryDataset createMontlyDataset(LocalDate date, String label){ DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for(int i = 0; i < 12; i++){ double m1 = Total("D", date.plusMonths(i), date.plusMonths(1 + i)); dataset.addValue(m1, label, date.plusMonths(i).getMonth().toString().substring(0, 3)); } return dataset; } @Override public void catogeriseTransaction(Transaction t, String category, String keyword) { boolean isCat = false; for(Category c : bankModel.getCategories()){ if(c.getName().equalsIgnoreCase(category)){ isCat = true; if(!keyword.equals("")){ try { c.getKeyWords().add(keyword); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("Excisting category " + c + " added to transaction, keyword :" +keyword +"added to the category" ); } t.setCategory(c); System.out.println("Excisting category " + c + " added to transaction"); if(!isCat){ ArrayList<String> names = new ArrayList<>(); names.add(keyword); Category newCat = new Category(category, names); bankModel.getCategories().add(newCat); t.setCategory(newCat); System.out.println("New category " + newCat + " added to transaction. With keyword " + keyword); } checkTransactionsAgainstKeyWords("not yet assigned"); } } } @Override public void catogeriseTransactionAccount(Transaction t, String category, String account) { for(Category c : bankModel.getCategories()){ if(c.getName().equalsIgnoreCase(category)){ c.getCounterAccounts().add(account); checkTransactionsAgainstCounterAccounts("not yet assigned"); } } } @Override public DefaultPieDataset createPieDataset(LocalDate date1, LocalDate date2, String debCred) { System.out.println("Creating pie dataset"); DefaultPieDataset data = new DefaultPieDataset(); for(Category c : bankModel.getCategories()){ ArrayList<Transaction> temp = null; if(debCred.equals("B")){ temp = searchTransactions(date1, date2, c.getName(), 0); } else { temp = searchTransactions(date1, date2, c.getName(), 0, debCred); } int tempAmount = 0; for (Transaction t : temp){ tempAmount += t.getAmount(); } if(tempAmount>0){ data.setValue(c.getName(), tempAmount); } } return data; } @Override // not used at the moment public void createMontlyReport(LocalDate date1, LocalDate date2, String debCred, File file){ try{ FileWriter writer = new FileWriter(file); writer.write("Report of all monthly moneyflow of type " + debCred + "from the period starting " + date1+ " \r\n"); writer.write("------------------------------------------------------------------------\r\n"); writer.write("Residence \t\t\t" + (int)categoryTotal("Residence" ,debCred,date1, date2)/12 + " Nibud number is undefined \r\n"); writer.write("Gas, Water Electricity \t\t" + (int)categoryTotal("Gas, Water Electricity" ,debCred,date1, date2)/12+ "Nibud number is 135\r\n") ; writer.write("Insurance \t\t\t" + (int)categoryTotal("Insurance" ,debCred,date1, date2)/12 + "Nibud number is 163\r\n") ; writer.write("Subscriptions & Bubbles\t\t" + (int)categoryTotal("Subscriptions & Bubbles" ,debCred,date1, date2)/12 + "Nibud number is 103 \r\n") ; writer.write("Education \t\t\t" + (int)categoryTotal("Education" ,debCred,date1, date2)/12 + "Nibud number is\r\n") ; writer.write("Transport \t\t\t" + (int)categoryTotal("Transport" ,debCred,date1, date2)/12 + "Nibud number is 165 \r\n") ; writer.write("Clothing & Shoes \t\t" + (int)categoryTotal("Clothing & Shoes" ,debCred,date1, date2)/12 + "Nibud number is 56\r\n") ; writer.write("Inventory, home & garden \t" + (int)categoryTotal("Inventory, home & garden" ,debCred,date1, date2)/12 + "Nibud number is 98\r\n") ; writer.write("Non-reimbursed healthcare \t" + (int)categoryTotal("Non-reimbursed healthcare costs" ,debCred,date1, date2)/12 + "Nibud number is 44\r\n") ; writer.write("Leisure expenses \t\t" + (int)categoryTotal("Leisure expenses" ,debCred,date1, date2)/12 + "Nibud number is 88\r\n") ; writer.write("Household expenses \t\t" + (int)categoryTotal("Household expenses" ,debCred,date1, date2)/12 + "Nibud number is 271 \r\n") ; writer.write("Other fixed charges \t\t" + (int)categoryTotal("Other fixed charges" ,debCred,date1, date2)/12+ "Nibud number is\r\n\r\n") ; writer.write("Total \t\t\t\t"+ (int)Total(debCred ,date1, date2)/12); writer.close(); } catch(IOException ex) { System.out.println("couldn't write the report out"); ex.printStackTrace(); } } @Override public float generalTotal(String debCred){ float temp = 0; for(Transaction t : bankModel.getTransactions()){ if(t.getDebetOrCredit().equals(debCred)){ temp += t.getAmount(); } } return temp; } @Override public float categoryTotal(String categoryName, String debCred){ float temp = 0; for(Transaction t : bankModel.getTransactions()){ if(t.getCategory().getName().equals(categoryName)){ if(t.getDebetOrCredit().equals(debCred)){ temp += t.getAmount(); } } } return temp; } }
UTF-8
Java
20,424
java
BankController1.java
Java
[]
null
[]
package controller; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.time.LocalDate; import java.time.Period; import java.util.ArrayList; import org.jfree.data.category.DefaultCategoryDataset; import org.jfree.data.general.DefaultPieDataset; import model.*; public class BankController1 implements BankControllerInterface { BankModelInterface bankModel; public BankController1(BankModelInterface bankModel) { this.bankModel = bankModel; } @Override public void loadTransactionFile(File file) { bankModel.loadTransactionFile(file); } @Override public void loadCategoryFile(File file) { bankModel.loadCategoryFile(file); } @Override public void saveState() { bankModel.saveState(); } @Override public void excludeTransactionFromAnalisys(Transaction t){ bankModel.getTransactions().remove(t); bankModel.getExcludedTransactions().add(t); } @Override public void addCategory(Category category){ bankModel.getCategories().add(category); } @Override public void removeCategory(Category category){ bankModel.getCategories().remove(category); } @Override public ArrayList<Category> getCategories() { return bankModel.getCategories(); } @Override public ArrayList<Transaction> getTransactions() { return bankModel.getTransactions(); } @Override // Data are INCLUDING the first date (day), EXLUDING the last date (day), so you can put 1-5-2016, 1-6-2016 and get one month including the first of the month public double categoryTotal(String category, String debcred, LocalDate date1, LocalDate date2){ Category tempCat = null; // for flexibilty reasons this methods takes a String value for the category, but for checking subcategories the real category is needed for(Category c: bankModel.getCategories()){ if(c.getName().equals(category)){ tempCat= c; } } double total = 0; for(Transaction t: bankModel.getTransactions()){ if(date1.isEqual(t.getTransactionDate()) || date1.isBefore(t.getTransactionDate()) && date2.isAfter(t.getTransactionDate())) if(t.getDebetOrCredit().equals(debcred)){ if(t.getCategory().getName().equals(category)){ total += t.getAmount(); } for(SubCategory sc : tempCat.getSubCategories()){ if(t.getCategory().getName().equals(sc.getName())){ total += t.getAmount(); } } } } return total; } @Override public double subCategoryTotal(String subCategory, LocalDate date1, LocalDate date2){ double total = 0; for(Transaction t: bankModel.getTransactions()){ if(date1.isEqual(t.getTransactionDate()) || date1.isBefore(t.getTransactionDate()) && date2.isAfter(t.getTransactionDate())) if(t.getCategory().getName().equals(subCategory)){ total += t.getAmount(); if(t.getCategory().getName().equals("Gas & elektriciteit")){ System.out.println("Subcategory "+t.getCategory().getName()+ " added amount of " + t.getAmount() +" dd "+ t.getTransactionDate() ); }; } } return total; } @Override public double generalTotal(String debcred, LocalDate date1, LocalDate date2){ double total = 0; for(Transaction t: bankModel.getTransactions()){ if(date1.isEqual(t.getTransactionDate()) || date1.isBefore(t.getTransactionDate()) && date2.isAfter(t.getTransactionDate())){ if(t.getDebetOrCredit().equals(debcred)){ total += t.getAmount(); } } } return total; } @Override public ArrayList<Transaction> searchTransactions(LocalDate date1, LocalDate date2, String category, int minAmount) { ArrayList<Transaction> transactionsToBeCategorised = new ArrayList<Transaction>(); // Creates a local ArrayList temp to list the transactions that match the criteria, and reverses the ordering to biggest amount on index 0 etc. int size = bankModel.getTransactions().size(); for(int i = 1; i < size-1; i++){ Transaction t = bankModel.getTransactions().get(size-i); LocalDate d = bankModel.getTransactions().get(size-i).getTransactionDate(); if(date1.isEqual(d) || date1.isBefore(d) && date2.isAfter(d)) if(t.getAmount()> minAmount) if(t.getCategory().getName().equals(category)) { //If criteria match transaction t is added to the list to be categorized transactionsToBeCategorised.add(t); } } return transactionsToBeCategorised; } @Override public ArrayList<Transaction> searchTransactions(LocalDate date1, LocalDate date2, String category, int minAmount, String debcred) { ArrayList<Transaction> transactionsToBeCategorised = new ArrayList<Transaction>(); int size = bankModel.getTransactions().size(); for(int i = 1; i < size-1; i++){ Transaction t = bankModel.getTransactions().get(size-i); LocalDate d = bankModel.getTransactions().get(size-i).getTransactionDate(); if(date1.isEqual(d) || date1.isBefore(d) && date2.isAfter(d)){ if(t.getAmount()> minAmount){ if(t.getDebetOrCredit().equals(debcred)){ try { if(t.getCategory().getName().equals(category)) { transactionsToBeCategorised.add(t); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } } return transactionsToBeCategorised; } @Override public void addRuleToCategory(String debCred, String category, Rule rule) { for(Category c : bankModel.getCategories()){ if(c.getDebetOrCredit().equals(debCred)){ String tempname = c.getName(); if(tempname.equalsIgnoreCase(category)){ c.getRules().add(rule); } } } System.out.println("Made a new rule"); checkTransactionsAgianstRules("not yet assigned"); } // Currently not used @Override public void addKeyWordToCategory(String category, String keyword){ for(Category c : bankModel.getCategories()){ String tempname = c.getName(); if(tempname.equalsIgnoreCase(category)){ c.getKeyWords().add(keyword); } } } @Override public void removeKeyWordFromCategory(String category, String keyword){ for(Category c : bankModel.getCategories()){ String tempname = c.getName(); if(tempname.equalsIgnoreCase(category)){ c.getKeyWords().remove(keyword); } } } // Currently not used @Override public void addAccountToCategory(String category, String account){ for(Category c : bankModel.getCategories()){ String tempname = c.getName(); if(tempname.equalsIgnoreCase(category)){ c.getCounterAccounts().add(account); } } } @Override public void removeAccountFromCategory(String category, String account){ for(Category c : bankModel.getCategories()){ String tempname = c.getName(); if(tempname.equalsIgnoreCase(category)){ c.getCounterAccounts().remove(account); } } } @Override public void checkTransactionsAgainstKeyWords(String categoryName){ //Checks against keyword and set a category for(Transaction t: bankModel.getTransactions()){ if(t.getCategory().getName().equals(categoryName)){ for(Category category : bankModel.getCategories()){ for(String s : category.getKeyWords()){ if(t.getDescription().toUpperCase().contains(s.toUpperCase())){ t.setCategory(category); } } for(SubCategory sb : category.getSubCategories()){ for(String s : sb.getKeyWords()){ if(t.getDescription().toUpperCase().contains(s.toUpperCase())){ t.setCategory(sb); System.out.println("Transaction :" + " added to catgory " +sb); } } } } } } } @Override public void checkTransactionsAgainstCounterAccounts(String categoryName){ for(Transaction t: bankModel.getTransactions()){ if (t.getCategory().getName().equals(categoryName)) { for (Category category : bankModel.getCategories()) { for (String a : category.getCounterAccounts()) { if (t.getOtherEndOfTransactionName().equals(a)) { t.setCategory(category); } } for (SubCategory sb : category.getSubCategories()) { for (String a : sb.getCounterAccounts()) { if (t.getOtherEndOfTransactionName().equals(a)) { t.setCategory(sb); } } } } } } } @Override public void checkTransactionsAgianstRules(String categoryName){ for(Transaction t: bankModel.getTransactions()){ if (t.getCategory().getName().equals(categoryName)) { for (Category category : bankModel.getCategories()) { if (!category.getRules().isEmpty()) { for (Rule r : category.getRules()) { Boolean keyword = false; Boolean minAmount = false; Boolean maxAmount = false; Boolean startDate = false; Boolean endDate = false; Boolean counterAccount = false; Boolean counterAcccountDiscription = false; if (r.getKeyword() == null) { keyword = true; } else if (t.getDescription().contains(r.getKeyword())) { keyword = true; } if (r.getMinAmount() < t.getAmount()) { minAmount = true; } if ((r.getMaxAmount() == 0)) { maxAmount = true; } else if (r.getMaxAmount() > t.getAmount()) { maxAmount = true; } if (r.getStartDate() == null) { startDate = true; } else if (r.getStartDate().isBefore(t.getTransactionDate())) { startDate = true; } if (r.getEndDate() == null) { endDate = true; } else if (r.getEndDate().isAfter(t.getTransactionDate())) { endDate = true; } if (r.getCounterAccount() == null) { counterAccount = true; } else if (r.getCounterAccount().equals(t.getOtherEndOfTransactionAccount())) { counterAccount = true; } if (r.getCounterAcccountDiscription() == null) { counterAcccountDiscription = true; } else if (r.getCounterAcccountDiscription() .equalsIgnoreCase(t.getOtherEndOfTransactionName())) { counterAcccountDiscription = true; } if (keyword & minAmount & maxAmount & startDate & endDate & counterAccount & counterAcccountDiscription) { t.setCategory(category); System.out.println("transaction: " + t + "is categorized as " + category); } } // close for rule } // close if cat not empty for (SubCategory sc : category.getSubCategories()){ if (!sc.getRules().isEmpty()){ for (Rule r : sc.getRules()) { Boolean keyword = false; Boolean minAmount = false; Boolean maxAmount = false; Boolean startDate = false; Boolean endDate = false; Boolean counterAccount = false; Boolean counterAcccountDiscription = false; if (r.getKeyword() == null) { keyword = true; } else if (t.getDescription().contains(r.getKeyword())) { keyword = true; } if (r.getMinAmount() < t.getAmount()) { minAmount = true; } if ((r.getMaxAmount() == 0)) { maxAmount = true; } else if (r.getMaxAmount() > t.getAmount()) { maxAmount = true; } if (r.getStartDate() == null) { startDate = true; } else if (r.getStartDate().isBefore(t.getTransactionDate())) { startDate = true; } if (r.getEndDate() == null) { endDate = true; } else if (r.getEndDate().isAfter(t.getTransactionDate())) { endDate = true; } if (r.getCounterAccount() == null) { counterAccount = true; } else if (r.getCounterAccount().equals(t.getOtherEndOfTransactionAccount())) { counterAccount = true; } if (r.getCounterAcccountDiscription() == null) { counterAcccountDiscription = true; } else if (r.getCounterAcccountDiscription() .equalsIgnoreCase(t.getOtherEndOfTransactionName())) { counterAcccountDiscription = true; } if (keyword & minAmount & maxAmount & startDate & endDate & counterAccount & counterAcccountDiscription) { t.setCategory(sc); System.out.println("transaction: " + t + "is categorized as " + sc); } } // close for rule } // close if subcategory } //close for sub category } // close for category } // close if category } //close for transaction } //close method @Override // This function is misplaced shoul be in model, of al the things that dont have to be in the model should be in the controller public void saveCategories(File file){ try{ FileWriter writer = new FileWriter(file); for(Category c : bankModel.getCategories()){ ArrayList<String> tempDisc = c.getKeyWords(); System.out.println(c); writer.write(c.getdebetOrCredit()+ "; "); writer.write(c.getFixedOrVariable()+ "; "); writer.write(c.getName()+ "; "); if(!tempDisc.isEmpty()){ for(int i = 0; i < tempDisc.size()-1; i++){ writer.write(tempDisc.get(i) +"; "); } writer.write(tempDisc.get(tempDisc.size()-1)); } writer.write("\r\n"); } writer.close(); } catch(IOException ex) { System.out.println("couldn't write the categoryList out"); ex.printStackTrace(); } } @Override public void clearAll() { System.out.println("Clear all"); bankModel.clearTransactions(); bankModel.clearCategories(); } // Helper convenience method double Total(String debcred, LocalDate date1, LocalDate date2){ double total = 0; for(Transaction t: bankModel.getTransactions()){ if(date1.isEqual(t.getTransactionDate()) || date1.isBefore(t.getTransactionDate()) && date2.isAfter(t.getTransactionDate())) if(t.getDebetOrCredit().equals(debcred)) total += t.getAmount(); } return total; } @Override public String toString(){ return "controller 1"; } /* * DEPRECATED METHODS DEPRECATED METHODS DEPRECATED METHODS DEPRECATED METHODS DEPRECATED METHODS */ @Override public DefaultCategoryDataset createMontlyDataset(LocalDate date1, LocalDate date2, String debCred){ DefaultCategoryDataset dataset = new DefaultCategoryDataset(); Period p = Period.between(date1, date2); int maxI = p.getMonths() + p.getYears()*12; System.out.println(maxI); for(int i = 0; i < maxI; i++){ for(Category category : bankModel.getCategories()){ double m1 = categoryTotal(category.getName(), debCred, date1.plusMonths(i), date1.plusMonths(1 + i)); if(m1 > 0) dataset.addValue(m1, category.getName(), date1.plusMonths(i).getMonth().toString().substring(0,3)); } } return dataset; } @Override public DefaultCategoryDataset createMontlyDataset(LocalDate date, String label){ DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for(int i = 0; i < 12; i++){ double m1 = Total("D", date.plusMonths(i), date.plusMonths(1 + i)); dataset.addValue(m1, label, date.plusMonths(i).getMonth().toString().substring(0, 3)); } return dataset; } @Override public void catogeriseTransaction(Transaction t, String category, String keyword) { boolean isCat = false; for(Category c : bankModel.getCategories()){ if(c.getName().equalsIgnoreCase(category)){ isCat = true; if(!keyword.equals("")){ try { c.getKeyWords().add(keyword); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("Excisting category " + c + " added to transaction, keyword :" +keyword +"added to the category" ); } t.setCategory(c); System.out.println("Excisting category " + c + " added to transaction"); if(!isCat){ ArrayList<String> names = new ArrayList<>(); names.add(keyword); Category newCat = new Category(category, names); bankModel.getCategories().add(newCat); t.setCategory(newCat); System.out.println("New category " + newCat + " added to transaction. With keyword " + keyword); } checkTransactionsAgainstKeyWords("not yet assigned"); } } } @Override public void catogeriseTransactionAccount(Transaction t, String category, String account) { for(Category c : bankModel.getCategories()){ if(c.getName().equalsIgnoreCase(category)){ c.getCounterAccounts().add(account); checkTransactionsAgainstCounterAccounts("not yet assigned"); } } } @Override public DefaultPieDataset createPieDataset(LocalDate date1, LocalDate date2, String debCred) { System.out.println("Creating pie dataset"); DefaultPieDataset data = new DefaultPieDataset(); for(Category c : bankModel.getCategories()){ ArrayList<Transaction> temp = null; if(debCred.equals("B")){ temp = searchTransactions(date1, date2, c.getName(), 0); } else { temp = searchTransactions(date1, date2, c.getName(), 0, debCred); } int tempAmount = 0; for (Transaction t : temp){ tempAmount += t.getAmount(); } if(tempAmount>0){ data.setValue(c.getName(), tempAmount); } } return data; } @Override // not used at the moment public void createMontlyReport(LocalDate date1, LocalDate date2, String debCred, File file){ try{ FileWriter writer = new FileWriter(file); writer.write("Report of all monthly moneyflow of type " + debCred + "from the period starting " + date1+ " \r\n"); writer.write("------------------------------------------------------------------------\r\n"); writer.write("Residence \t\t\t" + (int)categoryTotal("Residence" ,debCred,date1, date2)/12 + " Nibud number is undefined \r\n"); writer.write("Gas, Water Electricity \t\t" + (int)categoryTotal("Gas, Water Electricity" ,debCred,date1, date2)/12+ "Nibud number is 135\r\n") ; writer.write("Insurance \t\t\t" + (int)categoryTotal("Insurance" ,debCred,date1, date2)/12 + "Nibud number is 163\r\n") ; writer.write("Subscriptions & Bubbles\t\t" + (int)categoryTotal("Subscriptions & Bubbles" ,debCred,date1, date2)/12 + "Nibud number is 103 \r\n") ; writer.write("Education \t\t\t" + (int)categoryTotal("Education" ,debCred,date1, date2)/12 + "Nibud number is\r\n") ; writer.write("Transport \t\t\t" + (int)categoryTotal("Transport" ,debCred,date1, date2)/12 + "Nibud number is 165 \r\n") ; writer.write("Clothing & Shoes \t\t" + (int)categoryTotal("Clothing & Shoes" ,debCred,date1, date2)/12 + "Nibud number is 56\r\n") ; writer.write("Inventory, home & garden \t" + (int)categoryTotal("Inventory, home & garden" ,debCred,date1, date2)/12 + "Nibud number is 98\r\n") ; writer.write("Non-reimbursed healthcare \t" + (int)categoryTotal("Non-reimbursed healthcare costs" ,debCred,date1, date2)/12 + "Nibud number is 44\r\n") ; writer.write("Leisure expenses \t\t" + (int)categoryTotal("Leisure expenses" ,debCred,date1, date2)/12 + "Nibud number is 88\r\n") ; writer.write("Household expenses \t\t" + (int)categoryTotal("Household expenses" ,debCred,date1, date2)/12 + "Nibud number is 271 \r\n") ; writer.write("Other fixed charges \t\t" + (int)categoryTotal("Other fixed charges" ,debCred,date1, date2)/12+ "Nibud number is\r\n\r\n") ; writer.write("Total \t\t\t\t"+ (int)Total(debCred ,date1, date2)/12); writer.close(); } catch(IOException ex) { System.out.println("couldn't write the report out"); ex.printStackTrace(); } } @Override public float generalTotal(String debCred){ float temp = 0; for(Transaction t : bankModel.getTransactions()){ if(t.getDebetOrCredit().equals(debCred)){ temp += t.getAmount(); } } return temp; } @Override public float categoryTotal(String categoryName, String debCred){ float temp = 0; for(Transaction t : bankModel.getTransactions()){ if(t.getCategory().getName().equals(categoryName)){ if(t.getDebetOrCredit().equals(debCred)){ temp += t.getAmount(); } } } return temp; } }
20,424
0.639884
0.631365
615
31.211382
32.774433
171
false
false
0
0
0
0
0
0
3.821138
false
false
11
6aa9ffaec1677de0283a44deaf9069de2bd1299d
16,492,674,433,509
84c31d77a02fe56bfb9a99e18c1a0a6bdb3c2c30
/PolymorphismChallenge/src/com/company/Toyota.java
5ac8a7b3e83780240d021bc94fab039f848f5239
[]
no_license
rtram/JavaDevelopmentCourse
https://github.com/rtram/JavaDevelopmentCourse
0ff81d5e91ef763b9c15c9c325967bfcc6a1b305
d33027c04492cbbe3532ddf127b4f34e204218c7
refs/heads/master
2022-12-11T15:13:40.078000
2020-09-15T19:54:13
2020-09-15T19:54:13
268,566,382
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.company; class Toyota extends Car { public Toyota() { super("Honda", 4); } @Override public void startEngine() { System.out.println("You are driving a Toy Yoda"); } }
UTF-8
Java
217
java
Toyota.java
Java
[]
null
[]
package com.company; class Toyota extends Car { public Toyota() { super("Honda", 4); } @Override public void startEngine() { System.out.println("You are driving a Toy Yoda"); } }
217
0.585253
0.580645
13
15.769231
16.149084
57
false
false
0
0
0
0
0
0
0.307692
false
false
11
7e3029123a6cb3e543286ad5a23f672cb397878f
2,448,131,365,196
aab5e19c40dba2971656aa0122a6a6459b2d6394
/src/main/java/com/sisadmaca/controller/gacademica/selectores/GacsasisnsmoodleController.java
3cbd14662204dfdaf4f629de666aa514fe9367f5
[]
no_license
esyacelga/sisadmaca
https://github.com/esyacelga/sisadmaca
9b892cf6229524fe2606edb3f85617e9d6fec2b5
0dede01cd561daf66c43f1d1affa1d0139d35a51
refs/heads/master
2018-01-09T01:40:48.834000
2016-01-13T14:49:29
2016-01-13T14:49:29
45,849,590
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sisadmaca.controller.gacademica.selectores; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; import com.sisadmaca.controller.generic.GacSelectorGenericController; import com.sisadmaca.sistema.util.UtilSistema; @ManagedBean(name = "gacsasisnsmoodleController") @SessionScoped public class GacsasisnsmoodleController extends GacSelectorGenericController { public void aceptarCancelar(boolean opcion) { if (opcion) { setAceptarCancelar(true); } else { setAceptarCancelar(false); } crearAsistencias(); } public void crearAsistencias(){ if (isAceptarCancelar()){ if(getFilaNueva()!= null && obtenerRfAsistencia().getTemaCursoEdicionsmdl()!=null && obtenerRfAsistencia().getTemaCursoEdicionsmdl()!= ""){ obtenerRfAsistencia().setTemaCurso(obtenerRfAsistencia().getTemaCursoEdicionsmdl()) ; obtenerRfAsistencia().ingresarAsistencias(obtenerRfstablas().getFilaNueva().getCodigoSelctor(), getFilaNueva().getCodigoSelctor()); obtenerRfAsistencia().cerrarTodos(); obtenerRfAsistencia().setTemaCurso(null); obtenerRfAsistencia().setFilasDataTable(null); obtenerRfAsistencia().setSeleccionCursosi (getFilaNueva().getCodigoSelctor()); obtenerRfAsistencia().setSeleccionCursoci (0); obtenerRfAsistencia().getFilasDataTable(); }else{ if (getFilaNueva()== null){ UtilSistema.mensajeSistema(UtilSistema.obtenerProperties("sistema.mensajes.panel.validaselecccion")); }else{ UtilSistema.mensajeSistema("Debe ingresar un tema"); } } }else{ obtenerRfAsistencia().cerrarTodos(); UtilSistema.mensajeSistema(UtilSistema.obtenerProperties("sistema.mensajes.panel.cancelacion")); } } public GacSeleccionTablasController obtenerRfstablas() { ExternalContext contexto = FacesContext.getCurrentInstance() .getExternalContext(); GacSeleccionTablasController referenciaBeanSession = (GacSeleccionTablasController) contexto .getSessionMap().get("gacSeleccionTablasController"); return referenciaBeanSession; } }
UTF-8
Java
2,196
java
GacsasisnsmoodleController.java
Java
[]
null
[]
package com.sisadmaca.controller.gacademica.selectores; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; import com.sisadmaca.controller.generic.GacSelectorGenericController; import com.sisadmaca.sistema.util.UtilSistema; @ManagedBean(name = "gacsasisnsmoodleController") @SessionScoped public class GacsasisnsmoodleController extends GacSelectorGenericController { public void aceptarCancelar(boolean opcion) { if (opcion) { setAceptarCancelar(true); } else { setAceptarCancelar(false); } crearAsistencias(); } public void crearAsistencias(){ if (isAceptarCancelar()){ if(getFilaNueva()!= null && obtenerRfAsistencia().getTemaCursoEdicionsmdl()!=null && obtenerRfAsistencia().getTemaCursoEdicionsmdl()!= ""){ obtenerRfAsistencia().setTemaCurso(obtenerRfAsistencia().getTemaCursoEdicionsmdl()) ; obtenerRfAsistencia().ingresarAsistencias(obtenerRfstablas().getFilaNueva().getCodigoSelctor(), getFilaNueva().getCodigoSelctor()); obtenerRfAsistencia().cerrarTodos(); obtenerRfAsistencia().setTemaCurso(null); obtenerRfAsistencia().setFilasDataTable(null); obtenerRfAsistencia().setSeleccionCursosi (getFilaNueva().getCodigoSelctor()); obtenerRfAsistencia().setSeleccionCursoci (0); obtenerRfAsistencia().getFilasDataTable(); }else{ if (getFilaNueva()== null){ UtilSistema.mensajeSistema(UtilSistema.obtenerProperties("sistema.mensajes.panel.validaselecccion")); }else{ UtilSistema.mensajeSistema("Debe ingresar un tema"); } } }else{ obtenerRfAsistencia().cerrarTodos(); UtilSistema.mensajeSistema(UtilSistema.obtenerProperties("sistema.mensajes.panel.cancelacion")); } } public GacSeleccionTablasController obtenerRfstablas() { ExternalContext contexto = FacesContext.getCurrentInstance() .getExternalContext(); GacSeleccionTablasController referenciaBeanSession = (GacSeleccionTablasController) contexto .getSessionMap().get("gacSeleccionTablasController"); return referenciaBeanSession; } }
2,196
0.755464
0.755009
59
35.220341
34.465935
142
false
false
0
0
0
0
0
0
2.542373
false
false
11
c90e606f613e8d53c4f1d81267bb491fe5a5c2af
26,422,638,812,962
d71e879b3517cf4fccde29f7bf82cff69856cfcd
/ExtractedJars/Ibotta_com.ibotta.android/javafiles/com/fasterxml/jackson/core/JsonFactory$Feature.java
599a2a27fbed60a86e1e523f62b6d1efda8979f3
[ "MIT" ]
permissive
Andreas237/AndroidPolicyAutomation
https://github.com/Andreas237/AndroidPolicyAutomation
b8e949e072d08cf6c6166c3f15c9c63379b8f6ce
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
refs/heads/master
2020-04-10T02:14:08.789000
2019-05-16T19:29:11
2019-05-16T19:29:11
160,739,088
5
1
null
null
null
null
null
null
null
null
null
null
null
null
null
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) annotate safe package com.fasterxml.jackson.core; // Referenced classes of package com.fasterxml.jackson.core: // JsonFactory public static final class JsonFactory$Feature extends Enum { public static int collectDefaults() { JsonFactory$Feature ajsonfactory$feature[] = values(); // 0 0:invokestatic #51 <Method JsonFactory$Feature[] values()> // 1 3:astore 4 int l = ajsonfactory$feature.length; // 2 5:aload 4 // 3 7:arraylength // 4 8:istore_3 int i = 0; // 5 9:iconst_0 // 6 10:istore_0 int j; int k; for(j = 0; i < l; j = k) //* 7 11:iconst_0 //* 8 12:istore_1 //* 9 13:iload_0 //* 10 14:iload_3 //* 11 15:icmpge 51 { JsonFactory$Feature jsonfactory$feature = ajsonfactory$feature[i]; // 12 18:aload 4 // 13 20:iload_0 // 14 21:aaload // 15 22:astore 5 k = j; // 16 24:iload_1 // 17 25:istore_2 if(jsonfactory$feature.enabledByDefault()) //* 18 26:aload 5 //* 19 28:invokevirtual #55 <Method boolean enabledByDefault()> //* 20 31:ifeq 42 k = j | jsonfactory$feature.getMask(); // 21 34:iload_1 // 22 35:aload 5 // 23 37:invokevirtual #58 <Method int getMask()> // 24 40:ior // 25 41:istore_2 i++; // 26 42:iload_0 // 27 43:iconst_1 // 28 44:iadd // 29 45:istore_0 } // 30 46:iload_2 // 31 47:istore_1 //* 32 48:goto 13 return j; // 33 51:iload_1 // 34 52:ireturn } public static JsonFactory$Feature valueOf(String s) { return (JsonFactory$Feature)Enum.valueOf(com/fasterxml/jackson/core/JsonFactory$Feature, s); // 0 0:ldc1 #2 <Class JsonFactory$Feature> // 1 2:aload_0 // 2 3:invokestatic #63 <Method Enum Enum.valueOf(Class, String)> // 3 6:checkcast #2 <Class JsonFactory$Feature> // 4 9:areturn } public static JsonFactory$Feature[] values() { return (JsonFactory$Feature[])((JsonFactory$Feature []) ($VALUES)).clone(); // 0 0:getstatic #37 <Field JsonFactory$Feature[] $VALUES> // 1 3:invokevirtual #68 <Method Object _5B_Lcom.fasterxml.jackson.core.JsonFactory$Feature_3B_.clone()> // 2 6:checkcast #64 <Class JsonFactory$Feature[]> // 3 9:areturn } public boolean enabledByDefault() { return _defaultState; // 0 0:aload_0 // 1 1:getfield #43 <Field boolean _defaultState> // 2 4:ireturn } public boolean enabledIn(int i) { return (i & getMask()) != 0; // 0 0:iload_1 // 1 1:aload_0 // 2 2:invokevirtual #58 <Method int getMask()> // 3 5:iand // 4 6:ifeq 11 // 5 9:iconst_1 // 6 10:ireturn // 7 11:iconst_0 // 8 12:ireturn } public int getMask() { return 1 << ordinal(); // 0 0:iconst_1 // 1 1:aload_0 // 2 2:invokevirtual #73 <Method int ordinal()> // 3 5:ishl // 4 6:ireturn } private static final JsonFactory$Feature $VALUES[]; public static final JsonFactory$Feature CANONICALIZE_FIELD_NAMES; public static final JsonFactory$Feature FAIL_ON_SYMBOL_HASH_OVERFLOW; public static final JsonFactory$Feature INTERN_FIELD_NAMES; public static final JsonFactory$Feature USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING; private final boolean _defaultState; static { INTERN_FIELD_NAMES = new JsonFactory$Feature("INTERN_FIELD_NAMES", 0, true); // 0 0:new #2 <Class JsonFactory$Feature> // 1 3:dup // 2 4:ldc1 #20 <String "INTERN_FIELD_NAMES"> // 3 6:iconst_0 // 4 7:iconst_1 // 5 8:invokespecial #24 <Method void JsonFactory$Feature(String, int, boolean)> // 6 11:putstatic #26 <Field JsonFactory$Feature INTERN_FIELD_NAMES> CANONICALIZE_FIELD_NAMES = new JsonFactory$Feature("CANONICALIZE_FIELD_NAMES", 1, true); // 7 14:new #2 <Class JsonFactory$Feature> // 8 17:dup // 9 18:ldc1 #27 <String "CANONICALIZE_FIELD_NAMES"> // 10 20:iconst_1 // 11 21:iconst_1 // 12 22:invokespecial #24 <Method void JsonFactory$Feature(String, int, boolean)> // 13 25:putstatic #29 <Field JsonFactory$Feature CANONICALIZE_FIELD_NAMES> FAIL_ON_SYMBOL_HASH_OVERFLOW = new JsonFactory$Feature("FAIL_ON_SYMBOL_HASH_OVERFLOW", 2, true); // 14 28:new #2 <Class JsonFactory$Feature> // 15 31:dup // 16 32:ldc1 #30 <String "FAIL_ON_SYMBOL_HASH_OVERFLOW"> // 17 34:iconst_2 // 18 35:iconst_1 // 19 36:invokespecial #24 <Method void JsonFactory$Feature(String, int, boolean)> // 20 39:putstatic #32 <Field JsonFactory$Feature FAIL_ON_SYMBOL_HASH_OVERFLOW> USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING = new JsonFactory$Feature("USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING", 3, true); // 21 42:new #2 <Class JsonFactory$Feature> // 22 45:dup // 23 46:ldc1 #33 <String "USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING"> // 24 48:iconst_3 // 25 49:iconst_1 // 26 50:invokespecial #24 <Method void JsonFactory$Feature(String, int, boolean)> // 27 53:putstatic #35 <Field JsonFactory$Feature USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING> $VALUES = (new JsonFactory$Feature[] { INTERN_FIELD_NAMES, CANONICALIZE_FIELD_NAMES, FAIL_ON_SYMBOL_HASH_OVERFLOW, USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING }); // 28 56:iconst_4 // 29 57:anewarray JsonFactory$Feature[] // 30 60:dup // 31 61:iconst_0 // 32 62:getstatic #26 <Field JsonFactory$Feature INTERN_FIELD_NAMES> // 33 65:aastore // 34 66:dup // 35 67:iconst_1 // 36 68:getstatic #29 <Field JsonFactory$Feature CANONICALIZE_FIELD_NAMES> // 37 71:aastore // 38 72:dup // 39 73:iconst_2 // 40 74:getstatic #32 <Field JsonFactory$Feature FAIL_ON_SYMBOL_HASH_OVERFLOW> // 41 77:aastore // 42 78:dup // 43 79:iconst_3 // 44 80:getstatic #35 <Field JsonFactory$Feature USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING> // 45 83:aastore // 46 84:putstatic #37 <Field JsonFactory$Feature[] $VALUES> //* 47 87:return } private JsonFactory$Feature(String s, int i, boolean flag) { super(s, i); // 0 0:aload_0 // 1 1:aload_1 // 2 2:iload_2 // 3 3:invokespecial #41 <Method void Enum(String, int)> _defaultState = flag; // 4 6:aload_0 // 5 7:iload_3 // 6 8:putfield #43 <Field boolean _defaultState> // 7 11:return } }
UTF-8
Java
7,521
java
JsonFactory$Feature.java
Java
[ { "context": "// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.\n// Jad home page: http://www.kpdus.com/jad.html\n", "end": 61, "score": 0.9995550513267517, "start": 45, "tag": "NAME", "value": "Pavel Kouznetsov" } ]
null
[]
// Decompiled by Jad v1.5.8g. Copyright 2001 <NAME>. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) annotate safe package com.fasterxml.jackson.core; // Referenced classes of package com.fasterxml.jackson.core: // JsonFactory public static final class JsonFactory$Feature extends Enum { public static int collectDefaults() { JsonFactory$Feature ajsonfactory$feature[] = values(); // 0 0:invokestatic #51 <Method JsonFactory$Feature[] values()> // 1 3:astore 4 int l = ajsonfactory$feature.length; // 2 5:aload 4 // 3 7:arraylength // 4 8:istore_3 int i = 0; // 5 9:iconst_0 // 6 10:istore_0 int j; int k; for(j = 0; i < l; j = k) //* 7 11:iconst_0 //* 8 12:istore_1 //* 9 13:iload_0 //* 10 14:iload_3 //* 11 15:icmpge 51 { JsonFactory$Feature jsonfactory$feature = ajsonfactory$feature[i]; // 12 18:aload 4 // 13 20:iload_0 // 14 21:aaload // 15 22:astore 5 k = j; // 16 24:iload_1 // 17 25:istore_2 if(jsonfactory$feature.enabledByDefault()) //* 18 26:aload 5 //* 19 28:invokevirtual #55 <Method boolean enabledByDefault()> //* 20 31:ifeq 42 k = j | jsonfactory$feature.getMask(); // 21 34:iload_1 // 22 35:aload 5 // 23 37:invokevirtual #58 <Method int getMask()> // 24 40:ior // 25 41:istore_2 i++; // 26 42:iload_0 // 27 43:iconst_1 // 28 44:iadd // 29 45:istore_0 } // 30 46:iload_2 // 31 47:istore_1 //* 32 48:goto 13 return j; // 33 51:iload_1 // 34 52:ireturn } public static JsonFactory$Feature valueOf(String s) { return (JsonFactory$Feature)Enum.valueOf(com/fasterxml/jackson/core/JsonFactory$Feature, s); // 0 0:ldc1 #2 <Class JsonFactory$Feature> // 1 2:aload_0 // 2 3:invokestatic #63 <Method Enum Enum.valueOf(Class, String)> // 3 6:checkcast #2 <Class JsonFactory$Feature> // 4 9:areturn } public static JsonFactory$Feature[] values() { return (JsonFactory$Feature[])((JsonFactory$Feature []) ($VALUES)).clone(); // 0 0:getstatic #37 <Field JsonFactory$Feature[] $VALUES> // 1 3:invokevirtual #68 <Method Object _5B_Lcom.fasterxml.jackson.core.JsonFactory$Feature_3B_.clone()> // 2 6:checkcast #64 <Class JsonFactory$Feature[]> // 3 9:areturn } public boolean enabledByDefault() { return _defaultState; // 0 0:aload_0 // 1 1:getfield #43 <Field boolean _defaultState> // 2 4:ireturn } public boolean enabledIn(int i) { return (i & getMask()) != 0; // 0 0:iload_1 // 1 1:aload_0 // 2 2:invokevirtual #58 <Method int getMask()> // 3 5:iand // 4 6:ifeq 11 // 5 9:iconst_1 // 6 10:ireturn // 7 11:iconst_0 // 8 12:ireturn } public int getMask() { return 1 << ordinal(); // 0 0:iconst_1 // 1 1:aload_0 // 2 2:invokevirtual #73 <Method int ordinal()> // 3 5:ishl // 4 6:ireturn } private static final JsonFactory$Feature $VALUES[]; public static final JsonFactory$Feature CANONICALIZE_FIELD_NAMES; public static final JsonFactory$Feature FAIL_ON_SYMBOL_HASH_OVERFLOW; public static final JsonFactory$Feature INTERN_FIELD_NAMES; public static final JsonFactory$Feature USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING; private final boolean _defaultState; static { INTERN_FIELD_NAMES = new JsonFactory$Feature("INTERN_FIELD_NAMES", 0, true); // 0 0:new #2 <Class JsonFactory$Feature> // 1 3:dup // 2 4:ldc1 #20 <String "INTERN_FIELD_NAMES"> // 3 6:iconst_0 // 4 7:iconst_1 // 5 8:invokespecial #24 <Method void JsonFactory$Feature(String, int, boolean)> // 6 11:putstatic #26 <Field JsonFactory$Feature INTERN_FIELD_NAMES> CANONICALIZE_FIELD_NAMES = new JsonFactory$Feature("CANONICALIZE_FIELD_NAMES", 1, true); // 7 14:new #2 <Class JsonFactory$Feature> // 8 17:dup // 9 18:ldc1 #27 <String "CANONICALIZE_FIELD_NAMES"> // 10 20:iconst_1 // 11 21:iconst_1 // 12 22:invokespecial #24 <Method void JsonFactory$Feature(String, int, boolean)> // 13 25:putstatic #29 <Field JsonFactory$Feature CANONICALIZE_FIELD_NAMES> FAIL_ON_SYMBOL_HASH_OVERFLOW = new JsonFactory$Feature("FAIL_ON_SYMBOL_HASH_OVERFLOW", 2, true); // 14 28:new #2 <Class JsonFactory$Feature> // 15 31:dup // 16 32:ldc1 #30 <String "FAIL_ON_SYMBOL_HASH_OVERFLOW"> // 17 34:iconst_2 // 18 35:iconst_1 // 19 36:invokespecial #24 <Method void JsonFactory$Feature(String, int, boolean)> // 20 39:putstatic #32 <Field JsonFactory$Feature FAIL_ON_SYMBOL_HASH_OVERFLOW> USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING = new JsonFactory$Feature("USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING", 3, true); // 21 42:new #2 <Class JsonFactory$Feature> // 22 45:dup // 23 46:ldc1 #33 <String "USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING"> // 24 48:iconst_3 // 25 49:iconst_1 // 26 50:invokespecial #24 <Method void JsonFactory$Feature(String, int, boolean)> // 27 53:putstatic #35 <Field JsonFactory$Feature USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING> $VALUES = (new JsonFactory$Feature[] { INTERN_FIELD_NAMES, CANONICALIZE_FIELD_NAMES, FAIL_ON_SYMBOL_HASH_OVERFLOW, USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING }); // 28 56:iconst_4 // 29 57:anewarray JsonFactory$Feature[] // 30 60:dup // 31 61:iconst_0 // 32 62:getstatic #26 <Field JsonFactory$Feature INTERN_FIELD_NAMES> // 33 65:aastore // 34 66:dup // 35 67:iconst_1 // 36 68:getstatic #29 <Field JsonFactory$Feature CANONICALIZE_FIELD_NAMES> // 37 71:aastore // 38 72:dup // 39 73:iconst_2 // 40 74:getstatic #32 <Field JsonFactory$Feature FAIL_ON_SYMBOL_HASH_OVERFLOW> // 41 77:aastore // 42 78:dup // 43 79:iconst_3 // 44 80:getstatic #35 <Field JsonFactory$Feature USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING> // 45 83:aastore // 46 84:putstatic #37 <Field JsonFactory$Feature[] $VALUES> //* 47 87:return } private JsonFactory$Feature(String s, int i, boolean flag) { super(s, i); // 0 0:aload_0 // 1 1:aload_1 // 2 2:iload_2 // 3 3:invokespecial #41 <Method void Enum(String, int)> _defaultState = flag; // 4 6:aload_0 // 5 7:iload_3 // 6 8:putfield #43 <Field boolean _defaultState> // 7 11:return } }
7,511
0.541151
0.472411
198
36.984848
27.512436
116
false
false
0
0
0
0
0
0
1.363636
false
false
11
fe49e2bbac496bbe9231908f5e0c9553389022da
6,614,249,698,082
92fc5bfb14d62d5d6f6e97995fb998d6a89e486f
/VersionTree/src/net/sf/versiontree/data/AbstractVersionTreeHelper.java
67e915df54a596944ba6761824bec644580b9c28
[]
no_license
angvoz/net.sf.versiontree
https://github.com/angvoz/net.sf.versiontree
6dc9506cbe7bbeda5bd181dca6d8c3702e48fb02
80f54504c9df277f6609760d283b802faadfe461
refs/heads/master
2021-01-23T16:30:39.552000
2017-12-22T20:25:17
2017-12-27T02:29:33
4,816,879
1
1
null
false
2013-02-16T12:00:41
2012-06-28T04:49:46
2013-02-16T12:00:41
2013-02-16T12:00:41
5,092
null
1
0
Java
null
null
/******************************************************************************* * Copyright (c) 2003 Jan Karstens, André Langhorst. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v10.html * * Contributors: * André Langhorst <andre@masse.de> - initial implementation *******************************************************************************/ package net.sf.versiontree.data; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; /** * walk ITreeElement trees and draw connectors (and other stuff in the future) * @author Andre */ public abstract class AbstractVersionTreeHelper { /** returns one revision from a list of treelements, to be used on children of a revision */ public static IRevision getRevisionFromTreeElements(List<ITreeElement> elements) { for (ITreeElement element : elements) { if (element instanceof IRevision) { IRevision revision = (IRevision) element; return revision; } } return null; } private static boolean isChildVisible(ITreeElement node, boolean isAddEmptyEnabled, boolean isAddNaEnabled, String branchFilter) { for (ITreeElement child : node.getChildren()) { if (child instanceof IBranch) { if (isBranchVisible((IBranch) child, isAddEmptyEnabled, isAddNaEnabled, branchFilter)) { return true; } continue; } if (isChildVisible(child, isAddEmptyEnabled, isAddNaEnabled, branchFilter)) { return true; } } return false; } private static boolean isBranchVisible(IBranch branch, boolean isAddEmptyEnabled, boolean isAddNaEnabled, String branchFilter) { String branchName = branch.getName(); // HEAD branch if (IBranch.HEAD_NAME.equals(branchName)) { return true; } // Empty branch if (branch.isEmpty() && branchName.contains(branchFilter)) { return isAddEmptyEnabled; } // Unnamed branch if (branchName.equals(IBranch.N_A_BRANCH) && isAddNaEnabled && branchName.contains(branchFilter)) { return true; } // Regular branch if (!branch.isEmpty() && !branchName.equals(IBranch.N_A_BRANCH) && branchName.contains(branchFilter)) { return true; } // Check if any child in the subtree needs to be visible return isChildVisible(branch, isAddEmptyEnabled, isAddNaEnabled, branchFilter); } public static List<IBranch> getBranchesForRevision(IRevision rev, boolean isAddEmptyEnabled, boolean isAddNaEnabled, String branchFilter) { ArrayList<IBranch> branchList = new ArrayList<IBranch>(); for (ITreeElement element : rev.getChildren()) { if (element instanceof IBranch) { IBranch branch = (IBranch) element; if (isBranchVisible(branch, isAddEmptyEnabled, isAddNaEnabled, branchFilter)) { branchList.add(branch); } } } return branchList; } public static List<IBranch> getHeightSortedBranchesForRevision(IRevision rev, boolean emptyBranches, boolean naBranches, String branchFilter) { List<IBranch> sortedBranches = new ArrayList<IBranch>(); for (IBranch branch : AbstractVersionTreeHelper.getBranchesForRevision(rev, emptyBranches, naBranches, branchFilter)) { sortedBranches.add(branch); } // sort list by height of branches Collections.sort(sortedBranches, new Comparator<IBranch>(){ public int compare(IBranch arg0, IBranch arg1) { if (arg0.getHeight() < arg1.getHeight()) { return -1; } if (arg0.getHeight() == arg1.getHeight()) { return 0; } return 1; } }); return sortedBranches; } }
WINDOWS-1250
Java
3,680
java
AbstractVersionTreeHelper.java
Java
[ { "context": "****************************\n * Copyright (c) 2003 Jan Karstens, André Langhorst.\n * All rights reserved. This pr", "end": 115, "score": 0.9998341798782349, "start": 103, "tag": "NAME", "value": "Jan Karstens" }, { "context": "**************\n * Copyright (c) 2003 Jan Karstens, André Langhorst.\n * All rights reserved. This program and the acc", "end": 132, "score": 0.9998709559440613, "start": 117, "tag": "NAME", "value": "André Langhorst" }, { "context": ".org/legal/cpl-v10.html\n *\n * Contributors:\n * André Langhorst <andre@masse.de> - initial implementation\n ******", "end": 421, "score": 0.9998800158500671, "start": 406, "tag": "NAME", "value": "André Langhorst" }, { "context": ".html\n *\n * Contributors:\n * André Langhorst <andre@masse.de> - initial implementation\n **********************", "end": 437, "score": 0.999928891658783, "start": 423, "tag": "EMAIL", "value": "andre@masse.de" }, { "context": "nectors (and other stuff in the future)\n * @author Andre */\npublic abstract class AbstractVersionTreeHelpe", "end": 789, "score": 0.9962171316146851, "start": 784, "tag": "NAME", "value": "Andre" } ]
null
[]
/******************************************************************************* * Copyright (c) 2003 <NAME>, <NAME>. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v10.html * * Contributors: * <NAME> <<EMAIL>> - initial implementation *******************************************************************************/ package net.sf.versiontree.data; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; /** * walk ITreeElement trees and draw connectors (and other stuff in the future) * @author Andre */ public abstract class AbstractVersionTreeHelper { /** returns one revision from a list of treelements, to be used on children of a revision */ public static IRevision getRevisionFromTreeElements(List<ITreeElement> elements) { for (ITreeElement element : elements) { if (element instanceof IRevision) { IRevision revision = (IRevision) element; return revision; } } return null; } private static boolean isChildVisible(ITreeElement node, boolean isAddEmptyEnabled, boolean isAddNaEnabled, String branchFilter) { for (ITreeElement child : node.getChildren()) { if (child instanceof IBranch) { if (isBranchVisible((IBranch) child, isAddEmptyEnabled, isAddNaEnabled, branchFilter)) { return true; } continue; } if (isChildVisible(child, isAddEmptyEnabled, isAddNaEnabled, branchFilter)) { return true; } } return false; } private static boolean isBranchVisible(IBranch branch, boolean isAddEmptyEnabled, boolean isAddNaEnabled, String branchFilter) { String branchName = branch.getName(); // HEAD branch if (IBranch.HEAD_NAME.equals(branchName)) { return true; } // Empty branch if (branch.isEmpty() && branchName.contains(branchFilter)) { return isAddEmptyEnabled; } // Unnamed branch if (branchName.equals(IBranch.N_A_BRANCH) && isAddNaEnabled && branchName.contains(branchFilter)) { return true; } // Regular branch if (!branch.isEmpty() && !branchName.equals(IBranch.N_A_BRANCH) && branchName.contains(branchFilter)) { return true; } // Check if any child in the subtree needs to be visible return isChildVisible(branch, isAddEmptyEnabled, isAddNaEnabled, branchFilter); } public static List<IBranch> getBranchesForRevision(IRevision rev, boolean isAddEmptyEnabled, boolean isAddNaEnabled, String branchFilter) { ArrayList<IBranch> branchList = new ArrayList<IBranch>(); for (ITreeElement element : rev.getChildren()) { if (element instanceof IBranch) { IBranch branch = (IBranch) element; if (isBranchVisible(branch, isAddEmptyEnabled, isAddNaEnabled, branchFilter)) { branchList.add(branch); } } } return branchList; } public static List<IBranch> getHeightSortedBranchesForRevision(IRevision rev, boolean emptyBranches, boolean naBranches, String branchFilter) { List<IBranch> sortedBranches = new ArrayList<IBranch>(); for (IBranch branch : AbstractVersionTreeHelper.getBranchesForRevision(rev, emptyBranches, naBranches, branchFilter)) { sortedBranches.add(branch); } // sort list by height of branches Collections.sort(sortedBranches, new Comparator<IBranch>(){ public int compare(IBranch arg0, IBranch arg1) { if (arg0.getHeight() < arg1.getHeight()) { return -1; } if (arg0.getHeight() == arg1.getHeight()) { return 0; } return 1; } }); return sortedBranches; } }
3,647
0.697662
0.69304
110
32.436363
35.316368
144
false
false
0
0
0
0
0
0
2.381818
false
false
11
5d0b9f254a86b92da1cb81afaab6b8d24a6ac069
20,091,857,021,647
e6fd4c479cca162bc5d66b8150927ac60b407555
/app/src/main/java/io/filenet/wallet/ui/adapter/ETHBillRecyclerAdapter.java
8c71ada50bac2620234799773fc2388b70c199a6
[]
no_license
Filenet/fnwallet-android
https://github.com/Filenet/fnwallet-android
25833887f8316da7fa09f6e4cc9c444f37254c1b
f6416bba42a6afaddc85a319438f40679bae7bfe
refs/heads/master
2022-09-10T19:15:08.947000
2020-05-22T01:27:39
2020-05-22T01:27:39
256,381,527
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.filenet.wallet.ui.adapter; import android.support.annotation.NonNull; import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import io.filenet.wallet.R; import io.filenet.wallet.domain.ETHWallet; import io.filenet.wallet.entity.ETHBills; import io.filenet.wallet.utils.WalletDaoUtils; public class ETHBillRecyclerAdapter extends RecyclerView.Adapter<ETHBillRecyclerAdapter.ViewHolder> implements View.OnClickListener { public List<ETHBills.ResultBean> mData; public LayoutInflater mInflater; public ETHBills.ResultBean test; private String address; public void setAdd(String add) { address = add; } public ETHBillRecyclerAdapter(List<ETHBills.ResultBean> data) { mData = data; } private ETHBills.ResultBean getData(int position) { return mData.get(position); } @NonNull @Override public ETHBillRecyclerAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { mInflater = LayoutInflater.from(viewGroup.getContext()); View view = mInflater.inflate(R.layout.ethbills_item, viewGroup, false); view.setOnClickListener(this); return new ViewHolder(view); } @Override public void onClick(View view) { if (mItemClickListener != null) { mItemClickListener.onItemClick((Integer) view.getTag()); } } public interface OnItemClickListener { void onItemClick(int position); } private OnItemClickListener mItemClickListener; @Override public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) { test = getData(i); ETHWallet wallet = WalletDaoUtils.getCurrent(); String walletAddress = wallet.getAddress(); if (address.equals(test.getFrom())) { viewHolder.ethAddFrom.setText(test.getTo()); viewHolder.ethInOut.setImageResource(R.mipmap.bills_out); viewHolder.ethValue.setTextColor(ContextCompat.getColor(viewHolder.ethValue.getContext(), R.color.color_FF6677)); viewHolder.ethValue.setText(String.format("-%.4f", new BigDecimal(test.getValue()).divide(new BigDecimal("1000000000000000000"))) + " ETH"); } else { viewHolder.ethAddFrom.setText(test.getFrom()); viewHolder.ethInOut.setImageResource(R.mipmap.bills_in); viewHolder.ethValue.setTextColor(ContextCompat.getColor(viewHolder.ethValue.getContext(), R.color.color_7ED321)); viewHolder.ethValue.setText(String.format("+%.4f", new BigDecimal(test.getValue()).divide(new BigDecimal("1000000000000000000"))) + " ETH"); } viewHolder.ethDate.setText(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(Long.valueOf(test.getTimeStamp() + "000")))); viewHolder.itemView.setTag(i); } public List<ETHBills.ResultBean> getDatas() { return mData; } public void clearData() { mData.clear(); notifyItemRangeRemoved(0, mData.size()); } public void addData(List<ETHBills.ResultBean> datas) { addData(0, datas); } public void setData(List<ETHBills.ResultBean> datas) { this.mData = datas; notifyDataSetChanged(); } public void addData(int position, List<ETHBills.ResultBean> datas) { if (datas != null && datas.size() > 0) { mData.addAll(datas); notifyDataSetChanged(); } } @Override public int getItemCount() { if (mData != null && mData.size() > 0) { return mData.size(); } return 0; } public void setItemClickListener(OnItemClickListener itemClickListener) { mItemClickListener = itemClickListener; } class ViewHolder extends RecyclerView.ViewHolder { ImageView ethInOut; TextView ethAddFrom; TextView ethDate; TextView ethValue; public ViewHolder(@NonNull View itemView) { super(itemView); ethInOut = itemView.findViewById(R.id.iv_inorout); ethAddFrom = itemView.findViewById(R.id.tv_bills_address); ethDate = itemView.findViewById(R.id.tv_bills_time); ethValue = itemView.findViewById(R.id.eth_amount); } } }
UTF-8
Java
4,578
java
ETHBillRecyclerAdapter.java
Java
[]
null
[]
package io.filenet.wallet.ui.adapter; import android.support.annotation.NonNull; import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import io.filenet.wallet.R; import io.filenet.wallet.domain.ETHWallet; import io.filenet.wallet.entity.ETHBills; import io.filenet.wallet.utils.WalletDaoUtils; public class ETHBillRecyclerAdapter extends RecyclerView.Adapter<ETHBillRecyclerAdapter.ViewHolder> implements View.OnClickListener { public List<ETHBills.ResultBean> mData; public LayoutInflater mInflater; public ETHBills.ResultBean test; private String address; public void setAdd(String add) { address = add; } public ETHBillRecyclerAdapter(List<ETHBills.ResultBean> data) { mData = data; } private ETHBills.ResultBean getData(int position) { return mData.get(position); } @NonNull @Override public ETHBillRecyclerAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { mInflater = LayoutInflater.from(viewGroup.getContext()); View view = mInflater.inflate(R.layout.ethbills_item, viewGroup, false); view.setOnClickListener(this); return new ViewHolder(view); } @Override public void onClick(View view) { if (mItemClickListener != null) { mItemClickListener.onItemClick((Integer) view.getTag()); } } public interface OnItemClickListener { void onItemClick(int position); } private OnItemClickListener mItemClickListener; @Override public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) { test = getData(i); ETHWallet wallet = WalletDaoUtils.getCurrent(); String walletAddress = wallet.getAddress(); if (address.equals(test.getFrom())) { viewHolder.ethAddFrom.setText(test.getTo()); viewHolder.ethInOut.setImageResource(R.mipmap.bills_out); viewHolder.ethValue.setTextColor(ContextCompat.getColor(viewHolder.ethValue.getContext(), R.color.color_FF6677)); viewHolder.ethValue.setText(String.format("-%.4f", new BigDecimal(test.getValue()).divide(new BigDecimal("1000000000000000000"))) + " ETH"); } else { viewHolder.ethAddFrom.setText(test.getFrom()); viewHolder.ethInOut.setImageResource(R.mipmap.bills_in); viewHolder.ethValue.setTextColor(ContextCompat.getColor(viewHolder.ethValue.getContext(), R.color.color_7ED321)); viewHolder.ethValue.setText(String.format("+%.4f", new BigDecimal(test.getValue()).divide(new BigDecimal("1000000000000000000"))) + " ETH"); } viewHolder.ethDate.setText(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(Long.valueOf(test.getTimeStamp() + "000")))); viewHolder.itemView.setTag(i); } public List<ETHBills.ResultBean> getDatas() { return mData; } public void clearData() { mData.clear(); notifyItemRangeRemoved(0, mData.size()); } public void addData(List<ETHBills.ResultBean> datas) { addData(0, datas); } public void setData(List<ETHBills.ResultBean> datas) { this.mData = datas; notifyDataSetChanged(); } public void addData(int position, List<ETHBills.ResultBean> datas) { if (datas != null && datas.size() > 0) { mData.addAll(datas); notifyDataSetChanged(); } } @Override public int getItemCount() { if (mData != null && mData.size() > 0) { return mData.size(); } return 0; } public void setItemClickListener(OnItemClickListener itemClickListener) { mItemClickListener = itemClickListener; } class ViewHolder extends RecyclerView.ViewHolder { ImageView ethInOut; TextView ethAddFrom; TextView ethDate; TextView ethValue; public ViewHolder(@NonNull View itemView) { super(itemView); ethInOut = itemView.findViewById(R.id.iv_inorout); ethAddFrom = itemView.findViewById(R.id.tv_bills_address); ethDate = itemView.findViewById(R.id.tv_bills_time); ethValue = itemView.findViewById(R.id.eth_amount); } } }
4,578
0.675186
0.662516
143
31.013987
32.236233
152
false
false
0
0
0
0
0
0
0.524476
false
false
11
751abd607b4f3e5a3c2e52863fd712603b8728ab
652,835,080,228
7d5d6f78e9a55a41fca276de29d64300412b08ee
/common/src/main/java/ndk/utils/Fragment_Utils.java
2a54b14ba5dfee86f60d7ba796984281c0a9c192
[]
no_license
Miftab-Solutions/Tricoin_Android
https://github.com/Miftab-Solutions/Tricoin_Android
483187c734cb79d3a6c4e1cd83224d66f9605615
fe07cb328e6e289bed1dbbaed20a521d3c1548ec
refs/heads/master
2020-03-20T17:16:33.620000
2019-08-20T07:36:52
2019-08-20T07:36:52
137,555,856
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ndk.utils; import android.support.v4.app.Fragment; import android.support.v7.app.AppCompatActivity; public class Fragment_Utils { public static void display_fragment(AppCompatActivity activity, Fragment fragment) { activity.getSupportFragmentManager().beginTransaction().add(android.R.id.content, fragment).commit(); } }
UTF-8
Java
348
java
Fragment_Utils.java
Java
[]
null
[]
package ndk.utils; import android.support.v4.app.Fragment; import android.support.v7.app.AppCompatActivity; public class Fragment_Utils { public static void display_fragment(AppCompatActivity activity, Fragment fragment) { activity.getSupportFragmentManager().beginTransaction().add(android.R.id.content, fragment).commit(); } }
348
0.772988
0.767241
11
30.636364
36.076366
109
false
false
0
0
0
0
0
0
0.545455
false
false
11
0352391571fdc0589f60ffdeeeef12006684c06b
16,286,516,055,184
d9039f3e6f72584efc090b2369650301b8ad08b6
/Kameleon/src/network/ScoreTime.java
5d9cdf31196329ef68033cd143ceba6f4468c1fc
[]
no_license
bobismijnnaam/shiny-kameleon
https://github.com/bobismijnnaam/shiny-kameleon
dfc3c96642545378911d51c0a43a7c456531d2db
be8f2e1830640fdf38fe2aaba39018d47a1bdee1
refs/heads/master
2020-05-30T06:29:04.818000
2018-03-11T10:15:11
2018-03-11T10:15:11
15,333,440
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package network; public enum ScoreTime { DAY, WEEK, MONTH; private String s; static { DAY.s = "DAY"; WEEK.s = "WEEK"; MONTH.s = "MONTH"; } public String toString() { return s; } }
UTF-8
Java
222
java
ScoreTime.java
Java
[]
null
[]
package network; public enum ScoreTime { DAY, WEEK, MONTH; private String s; static { DAY.s = "DAY"; WEEK.s = "WEEK"; MONTH.s = "MONTH"; } public String toString() { return s; } }
222
0.536036
0.536036
19
9.684211
8.460762
27
false
false
0
0
0
0
0
0
1.473684
false
false
11
33a4dc3be54ecd5f99815dc5ef67626dddfd2572
11,785,390,284,840
f48a3b36f84eb083df672b2db66cdeeb6d9aff4d
/src/main/java/pl/akademiakodu/model/translationcompany/PanJanek.java
11b7d5f1821f588060c3c1329e67991f9a30e350
[]
no_license
farugaa-ak/di-spring
https://github.com/farugaa-ak/di-spring
41ee740e36c53042fdae8f331491e21832c43331
b624673ad7e15170583acc2e41336936977cb4c0
refs/heads/master
2021-07-20T19:33:58.376000
2017-10-29T10:38:27
2017-10-29T10:38:27
108,651,632
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pl.akademiakodu.model.translationcompany; public class PanJanek implements Worker { public void work() { System.out.println("Pan Janek"); } }
UTF-8
Java
168
java
PanJanek.java
Java
[]
null
[]
package pl.akademiakodu.model.translationcompany; public class PanJanek implements Worker { public void work() { System.out.println("Pan Janek"); } }
168
0.696429
0.696429
8
20
19.634153
49
false
false
0
0
0
0
0
0
0.25
false
false
11
050541119a4f5a7ca5b2f599e1dddc54bd054495
29,618,094,527,965
5ab765ce5f1aaeee253b8f34bc93b7c9b17b3a16
/src/main/java/ru/gmail/gasimov/task3/observer/TriangleObserver.java
34318a0453e6ade1b1bd79a6676bcee2b887284e
[]
no_license
Eltay750505/ThirdTask
https://github.com/Eltay750505/ThirdTask
aa738db87a1aaf2001839b0fe560e1b562d01056
f4dcef035b2726292a584a26288d80b3777e0048
refs/heads/master
2023-04-16T01:46:46.092000
2021-05-04T11:52:57
2021-05-04T11:52:57
356,245,457
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ru.gmail.gasimov.task3.observer; public interface TriangleObserver { void parametersChanged(TriangleEvent event); }
UTF-8
Java
129
java
TriangleObserver.java
Java
[]
null
[]
package ru.gmail.gasimov.task3.observer; public interface TriangleObserver { void parametersChanged(TriangleEvent event); }
129
0.806202
0.79845
5
24.799999
20.272148
48
false
false
0
0
0
0
0
0
0.4
false
false
11
8eeb46032942a7a66fb9cda760d34ab4ad234c16
32,152,125,178,408
0ada8feb983c73034211ae7b5011559274cc002d
/2018_2_25/MyLinkedListTest.java
9af4baa4e83b55116d3d9c71c01149e1e749c06f
[]
no_license
ItamarAsulin/Exams_Solutions
https://github.com/ItamarAsulin/Exams_Solutions
726622e3eeb794f5a0d310e9615f86014a5a4c1f
f41050a2681f3f0c08a29eef0cc85a53425f4115
refs/heads/main
2023-02-21T01:55:32.770000
2021-01-29T15:17:24
2021-01-29T15:17:24
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package test; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; class MyLinkedListTest { @Test void sortTest() { MyLinkedList ll = new MyLinkedList(); ll.add(6); ll.add(3); ll.add(2); ll.add(24); ll.add(6); ll.add(8); ll.add(4); ll.add(94); ll.add(104); ll.add(36); ll.add(625); ll.sort(); System.out.println(ll.toString()); } }
UTF-8
Java
491
java
MyLinkedListTest.java
Java
[]
null
[]
package test; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; class MyLinkedListTest { @Test void sortTest() { MyLinkedList ll = new MyLinkedList(); ll.add(6); ll.add(3); ll.add(2); ll.add(24); ll.add(6); ll.add(8); ll.add(4); ll.add(94); ll.add(104); ll.add(36); ll.add(625); ll.sort(); System.out.println(ll.toString()); } }
491
0.509165
0.472505
26
17.923077
13.0647
49
false
false
0
0
0
0
0
0
0.653846
false
false
11
bdc40fff3946431c76994c114fbc88b0aa4bc5cf
21,363,167,334,872
fec26ad5313e57bf6345c3b1cac83c571b3af766
/src/java/gob/sucamec/interop/ws/WSLicenciasArmasProxy.java
4b0b3952d24b438dea58e26e8c437263d58c407c
[]
no_license
Farid88/HibperV3
https://github.com/Farid88/HibperV3
ea21821abc2a2a37185196097cb3f009d412b4ef
5aaca5b756c0d65297836feb7f1b3358f2eb9f59
refs/heads/master
2016-08-12T23:27:08.354000
2015-10-03T21:08:14
2015-10-03T21:08:14
43,597,260
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package gob.sucamec.interop.ws; public class WSLicenciasArmasProxy implements gob.sucamec.interop.ws.WSLicenciasArmas_PortType { private String _endpoint = null; private gob.sucamec.interop.ws.WSLicenciasArmas_PortType wSLicenciasArmas_PortType = null; public WSLicenciasArmasProxy() { _initWSLicenciasArmasProxy(); } public WSLicenciasArmasProxy(String endpoint) { _endpoint = endpoint; _initWSLicenciasArmasProxy(); } private void _initWSLicenciasArmasProxy() { try { wSLicenciasArmas_PortType = (new gob.sucamec.interop.ws.WSLicenciasArmas_ServiceLocator()).getWSLicenciasArmasPort(); if (wSLicenciasArmas_PortType != null) { if (_endpoint != null) ((javax.xml.rpc.Stub)wSLicenciasArmas_PortType)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint); else _endpoint = (String)((javax.xml.rpc.Stub)wSLicenciasArmas_PortType)._getProperty("javax.xml.rpc.service.endpoint.address"); } } catch (javax.xml.rpc.ServiceException serviceException) {} } public String getEndpoint() { return _endpoint; } public void setEndpoint(String endpoint) { _endpoint = endpoint; if (wSLicenciasArmas_PortType != null) ((javax.xml.rpc.Stub)wSLicenciasArmas_PortType)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint); } public gob.sucamec.interop.ws.WSLicenciasArmas_PortType getWSLicenciasArmas_PortType() { if (wSLicenciasArmas_PortType == null) _initWSLicenciasArmasProxy(); return wSLicenciasArmas_PortType; } public gob.sucamec.interop.ws.WsLicencias[] buscaPorCodUsr(java.lang.String codUsr, java.lang.String tkUsr, java.lang.String tkApp) throws java.rmi.RemoteException{ if (wSLicenciasArmas_PortType == null) _initWSLicenciasArmasProxy(); return wSLicenciasArmas_PortType.buscaPorCodUsr(codUsr, tkUsr, tkApp); } public gob.sucamec.interop.ws.WsLicencias[] buscaPorNombre(java.lang.String name, java.lang.String tkUsr, java.lang.String tkApp) throws java.rmi.RemoteException{ if (wSLicenciasArmas_PortType == null) _initWSLicenciasArmasProxy(); return wSLicenciasArmas_PortType.buscaPorNombre(name, tkUsr, tkApp); } public gob.sucamec.interop.ws.WsLicencias[] buscaPorApellidosNombres(java.lang.String paterno, java.lang.String materno, java.lang.String nombres, java.lang.String tkUsr, java.lang.String tkApp) throws java.rmi.RemoteException{ if (wSLicenciasArmas_PortType == null) _initWSLicenciasArmasProxy(); return wSLicenciasArmas_PortType.buscaPorApellidosNombres(paterno, materno, nombres, tkUsr, tkApp); } public gob.sucamec.interop.ws.WsLicencias[] buscaPorNroLic(java.lang.String nroLic, java.lang.String tkUsr, java.lang.String tkApp) throws java.rmi.RemoteException{ if (wSLicenciasArmas_PortType == null) _initWSLicenciasArmasProxy(); return wSLicenciasArmas_PortType.buscaPorNroLic(nroLic, tkUsr, tkApp); } public gob.sucamec.interop.ws.WsLicencias[] buscaPorNroSerie(java.lang.String nroSerie, java.lang.String tkUsr, java.lang.String tkApp) throws java.rmi.RemoteException{ if (wSLicenciasArmas_PortType == null) _initWSLicenciasArmasProxy(); return wSLicenciasArmas_PortType.buscaPorNroSerie(nroSerie, tkUsr, tkApp); } public gob.sucamec.interop.ws.WsLicencias[] buscaPorTipoCodUsr(java.lang.String tipUsr, java.lang.String codUsr, java.lang.String tkUsr, java.lang.String tkApp) throws java.rmi.RemoteException{ if (wSLicenciasArmas_PortType == null) _initWSLicenciasArmasProxy(); return wSLicenciasArmas_PortType.buscaPorTipoCodUsr(tipUsr, codUsr, tkUsr, tkApp); } }
UTF-8
Java
3,790
java
WSLicenciasArmasProxy.java
Java
[]
null
[]
package gob.sucamec.interop.ws; public class WSLicenciasArmasProxy implements gob.sucamec.interop.ws.WSLicenciasArmas_PortType { private String _endpoint = null; private gob.sucamec.interop.ws.WSLicenciasArmas_PortType wSLicenciasArmas_PortType = null; public WSLicenciasArmasProxy() { _initWSLicenciasArmasProxy(); } public WSLicenciasArmasProxy(String endpoint) { _endpoint = endpoint; _initWSLicenciasArmasProxy(); } private void _initWSLicenciasArmasProxy() { try { wSLicenciasArmas_PortType = (new gob.sucamec.interop.ws.WSLicenciasArmas_ServiceLocator()).getWSLicenciasArmasPort(); if (wSLicenciasArmas_PortType != null) { if (_endpoint != null) ((javax.xml.rpc.Stub)wSLicenciasArmas_PortType)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint); else _endpoint = (String)((javax.xml.rpc.Stub)wSLicenciasArmas_PortType)._getProperty("javax.xml.rpc.service.endpoint.address"); } } catch (javax.xml.rpc.ServiceException serviceException) {} } public String getEndpoint() { return _endpoint; } public void setEndpoint(String endpoint) { _endpoint = endpoint; if (wSLicenciasArmas_PortType != null) ((javax.xml.rpc.Stub)wSLicenciasArmas_PortType)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint); } public gob.sucamec.interop.ws.WSLicenciasArmas_PortType getWSLicenciasArmas_PortType() { if (wSLicenciasArmas_PortType == null) _initWSLicenciasArmasProxy(); return wSLicenciasArmas_PortType; } public gob.sucamec.interop.ws.WsLicencias[] buscaPorCodUsr(java.lang.String codUsr, java.lang.String tkUsr, java.lang.String tkApp) throws java.rmi.RemoteException{ if (wSLicenciasArmas_PortType == null) _initWSLicenciasArmasProxy(); return wSLicenciasArmas_PortType.buscaPorCodUsr(codUsr, tkUsr, tkApp); } public gob.sucamec.interop.ws.WsLicencias[] buscaPorNombre(java.lang.String name, java.lang.String tkUsr, java.lang.String tkApp) throws java.rmi.RemoteException{ if (wSLicenciasArmas_PortType == null) _initWSLicenciasArmasProxy(); return wSLicenciasArmas_PortType.buscaPorNombre(name, tkUsr, tkApp); } public gob.sucamec.interop.ws.WsLicencias[] buscaPorApellidosNombres(java.lang.String paterno, java.lang.String materno, java.lang.String nombres, java.lang.String tkUsr, java.lang.String tkApp) throws java.rmi.RemoteException{ if (wSLicenciasArmas_PortType == null) _initWSLicenciasArmasProxy(); return wSLicenciasArmas_PortType.buscaPorApellidosNombres(paterno, materno, nombres, tkUsr, tkApp); } public gob.sucamec.interop.ws.WsLicencias[] buscaPorNroLic(java.lang.String nroLic, java.lang.String tkUsr, java.lang.String tkApp) throws java.rmi.RemoteException{ if (wSLicenciasArmas_PortType == null) _initWSLicenciasArmasProxy(); return wSLicenciasArmas_PortType.buscaPorNroLic(nroLic, tkUsr, tkApp); } public gob.sucamec.interop.ws.WsLicencias[] buscaPorNroSerie(java.lang.String nroSerie, java.lang.String tkUsr, java.lang.String tkApp) throws java.rmi.RemoteException{ if (wSLicenciasArmas_PortType == null) _initWSLicenciasArmasProxy(); return wSLicenciasArmas_PortType.buscaPorNroSerie(nroSerie, tkUsr, tkApp); } public gob.sucamec.interop.ws.WsLicencias[] buscaPorTipoCodUsr(java.lang.String tipUsr, java.lang.String codUsr, java.lang.String tkUsr, java.lang.String tkApp) throws java.rmi.RemoteException{ if (wSLicenciasArmas_PortType == null) _initWSLicenciasArmasProxy(); return wSLicenciasArmas_PortType.buscaPorTipoCodUsr(tipUsr, codUsr, tkUsr, tkApp); } }
3,790
0.72876
0.72876
84
43.142857
51.120804
229
false
false
0
0
0
0
0
0
0.690476
false
false
11
aeed176ca39873977b63bf6afe7340b5e473c567
30,253,749,636,546
71d5070dcf6ea9b755e7e7e5dccc4cf7da237ed9
/src/main/java/com/ctr/crm/api/AllotJobService.java
f19d3d30cca073a32d1bd027c214073569ef7c8d
[]
no_license
LXC-9349/ctr1
https://github.com/LXC-9349/ctr1
3a965b008dccd9b8186dd5f0626be189f50ba665
b543af284e600ecf59e1d06c98e53be901840de1
refs/heads/master
2022-07-11T20:26:23.442000
2019-07-18T04:30:41
2019-07-18T04:30:41
197,510,513
0
0
null
false
2022-06-29T17:31:08
2019-07-18T04:18:03
2019-07-18T04:31:00
2022-06-29T17:31:06
11,423
0
0
4
Java
false
false
package com.ctr.crm.api; /** * 功能描述: 自动分配定时任务 * * @author: DoubleLi * @date: 2019/5/5 14:44 */ public interface AllotJobService { void allot(); }
UTF-8
Java
179
java
AllotJobService.java
Java
[ { "context": "ctr.crm.api;\n\n/**\n * 功能描述: 自动分配定时任务\n *\n * @author: DoubleLi\n * @date: 2019/5/5 14:44\n */\npublic interface All", "end": 71, "score": 0.8652923107147217, "start": 63, "tag": "NAME", "value": "DoubleLi" } ]
null
[]
package com.ctr.crm.api; /** * 功能描述: 自动分配定时任务 * * @author: DoubleLi * @date: 2019/5/5 14:44 */ public interface AllotJobService { void allot(); }
179
0.632258
0.567742
11
13.181818
11.271994
34
false
false
0
0
0
0
0
0
0.181818
false
false
11
42dd4148f4aa871e81045a30e401498c4889fae0
30,185,030,203,715
268cf59675d1bba159905b8d6948f2154ce609b2
/IcandemyManage/src/com/ican/manage/RegistBeautyActivity.java
c24f959d50e689a0305868d9201e8f6d3a8233d0
[]
no_license
chenglove1201/IcandemyManage
https://github.com/chenglove1201/IcandemyManage
2b9175d66a7b782aa125741a5c4a93a4cc95c1e6
610a09c8381dfc1c7e31dcd5d75a58db42f0dc64
refs/heads/master
2017-12-20T16:15:30.771000
2016-12-23T10:58:23
2016-12-23T10:58:23
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ican.manage; import java.util.ArrayList; import java.util.List; import com.google.gson.Gson; import com.ican.manage.entity.Beauty; import com.ican.manage.entity.Card; import com.ican.manage.entity.CardPaging; import com.ican.manage.entity.RegistBeauty; import com.ican.manage.http.HttpBusiness; import com.ican.manage.http.IcanHttp; import com.ican.manage.rx.RxNoHttp; import com.ican.manage.rx.SimpleSubscriber; import com.ican.manage.util.TipDialog; import com.ican.manage.util.Toast; import com.yolanda.nohttp.rest.Request; import com.yolanda.nohttp.rest.Response; import android.app.Dialog; import android.graphics.Color; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.View.OnClickListener; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.EditText; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.RadioGroup; import android.widget.Switch; import android.widget.TextView; import android.widget.CompoundButton.OnCheckedChangeListener; public class RegistBeautyActivity extends AppCompatActivity implements OnClickListener, OnCheckedChangeListener, android.widget.RadioGroup.OnCheckedChangeListener { private RadioGroup rg_countSlect; private TextView dialog_title; private ImageButton ib_back; private ImageButton ib_commit; private LinearLayout linear_count; private Switch switch_autho_tiyan; private EditText et_name, et_contact, et_phone, et_address, et_remainAdvanceCharge, et_unitPrice; private CardPaging cardPaging; private TextView tv_card1, tv_card2, tv_card3, tv_card4, tv_card5, tv_card6, tv_card7, tv_must; private CheckBox checkBox1, checkBox2, checkBox3, checkBox4, checkBox5, checkBox6, checkBox7; private LinearLayout linearLayout; private ImageButton img_xiugai1, img_xiugai2, img_xiugai3, img_xiugai4, img_xiugai5, img_xiugai6, img_xiugai7; private Dialog dialog; private View dialog_view; private List<Card> sendDataCard = new ArrayList<Card>(); private List<String> cacheCardName = new ArrayList<String>();// 缓存美容卡名称 private int countTimes = 20; private int cacheCountTimes;// 缓存体验卡时长 private Gson gson; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_registbeauty); dialog_title = (TextView) findViewById(R.id.tv_dialog_title); dialog_title.setText("登记美容院"); ib_back = (ImageButton) findViewById(R.id.ib_back); ib_back.setOnClickListener(this); ib_commit = (ImageButton) findViewById(R.id.ib_commit); ib_commit.setImageResource(R.drawable.ic_add); ib_commit.setOnClickListener(this); linear_count = (LinearLayout) findViewById(R.id.linearLayout1); switch_autho_tiyan = (Switch) findViewById(R.id.switch1); switch_autho_tiyan.setOnCheckedChangeListener(this); et_name = (EditText) findViewById(R.id.editText1); et_contact = (EditText) findViewById(R.id.editText2); et_phone = (EditText) findViewById(R.id.editText3); et_address = (EditText) findViewById(R.id.editText4); et_remainAdvanceCharge = (EditText) findViewById(R.id.editText5); et_remainAdvanceCharge.setText("0"); et_unitPrice = (EditText) findViewById(R.id.editText6); et_unitPrice.setText("1000"); tv_card1 = (TextView) findViewById(R.id.tv_card1); tv_card2 = (TextView) findViewById(R.id.tv_card2); tv_card3 = (TextView) findViewById(R.id.tv_card3); tv_card4 = (TextView) findViewById(R.id.tv_card4); tv_card5 = (TextView) findViewById(R.id.tv_card5); tv_card6 = (TextView) findViewById(R.id.tv_card6); tv_card7 = (TextView) findViewById(R.id.tv_card7); checkBox1 = (CheckBox) findViewById(R.id.checkBox1); checkBox1.setOnCheckedChangeListener(this); checkBox2 = (CheckBox) findViewById(R.id.checkBox2); checkBox2.setOnCheckedChangeListener(this); checkBox3 = (CheckBox) findViewById(R.id.checkBox3); checkBox3.setOnCheckedChangeListener(this); checkBox4 = (CheckBox) findViewById(R.id.checkBox4); checkBox4.setOnCheckedChangeListener(this); checkBox5 = (CheckBox) findViewById(R.id.checkBox5); checkBox5.setOnCheckedChangeListener(this); checkBox6 = (CheckBox) findViewById(R.id.checkBox6); checkBox6.setOnCheckedChangeListener(this); checkBox7 = (CheckBox) findViewById(R.id.checkBox7); checkBox7.setOnCheckedChangeListener(this); img_xiugai1 = (ImageButton) findViewById(R.id.img_xiugai1); img_xiugai1.setOnClickListener(this); img_xiugai2 = (ImageButton) findViewById(R.id.img_xiugai2); img_xiugai2.setOnClickListener(this); img_xiugai3 = (ImageButton) findViewById(R.id.img_xiugai3); img_xiugai3.setOnClickListener(this); img_xiugai4 = (ImageButton) findViewById(R.id.img_xiugai4); img_xiugai4.setOnClickListener(this); img_xiugai5 = (ImageButton) findViewById(R.id.img_xiugai5); img_xiugai5.setOnClickListener(this); img_xiugai6 = (ImageButton) findViewById(R.id.img_xiugai6); img_xiugai6.setOnClickListener(this); img_xiugai7 = (ImageButton) findViewById(R.id.img_xiugai7); img_xiugai7.setOnClickListener(this); linearLayout = (LinearLayout) findViewById(R.id.linearLayout2); linearLayout.setVisibility(View.INVISIBLE); rg_countSlect = (RadioGroup) findViewById(R.id.radioGroup_count); rg_countSlect.setOnCheckedChangeListener(this); tv_must = (TextView) findViewById(R.id.tv_must); tv_must.setTextColor(Color.RED); tv_must.setVisibility(View.VISIBLE); tv_must.setText("*(必填)"); gson = new Gson(); } @Override protected void onStart() { super.onStart(); Request<String> request = new HttpBusiness().getAllInfo(1, IcanHttp.card_url); RxNoHttp.request(this, request, new SimpleSubscriber<Response<String>>() { @Override public void onNext(Response<String> stringResponse) { String string = stringResponse.get(); if (!string.equals("false")) { cardPaging = gson.fromJson(string, CardPaging.class); for (Card card : cardPaging.getCards()) { cacheCardName.add(card.getName()); } linearLayout.setVisibility(View.VISIBLE); inflateView(); } } }); } private void inflateView() { tv_card1.setText("价格:" + cardPaging.getCards().get(0).getPrice() + "¥" + "\n" + "次数:" + cardPaging.getCards().get(0).getTimes()); checkBox1.setText(cardPaging.getCards().get(0).getName()); tv_card2.setText("价格:" + cardPaging.getCards().get(1).getPrice() + "¥" + "\n" + "次数:" + cardPaging.getCards().get(1).getTimes()); checkBox2.setText(cardPaging.getCards().get(1).getName()); tv_card3.setText("价格:" + cardPaging.getCards().get(2).getPrice() + "¥" + "\n" + "次数:" + cardPaging.getCards().get(2).getTimes()); checkBox3.setText(cardPaging.getCards().get(2).getName()); tv_card4.setText("价格:" + cardPaging.getCards().get(3).getPrice() + "¥" + "\n" + "次数:" + cardPaging.getCards().get(3).getTimes()); checkBox4.setText(cardPaging.getCards().get(3).getName()); tv_card5.setText("价格:" + cardPaging.getCards().get(4).getPrice() + "¥" + "\n" + "次数:" + cardPaging.getCards().get(4).getTimes()); checkBox5.setText(cardPaging.getCards().get(4).getName()); tv_card6.setText("价格:" + cardPaging.getCards().get(5).getPrice() + "¥" + "\n" + "次数:" + cardPaging.getCards().get(5).getTimes()); checkBox6.setText(cardPaging.getCards().get(5).getName()); tv_card7.setText("价格:" + cardPaging.getCards().get(6).getPrice() + "¥" + "\n" + "次数:" + cardPaging.getCards().get(6).getTimes()); checkBox7.setText(cardPaging.getCards().get(6).getName()); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.ib_commit: String beautyName = et_name.getText().toString().trim(); if (beautyName != null && !beautyName.equals("")) { // 设置美容院基本信息 Beauty beauty = new Beauty(); beauty.setName(beautyName); beauty.setContacts(et_contact.getText().toString().trim()); beauty.setPhone(et_phone.getText().toString().trim()); beauty.setAddress(et_address.getText().toString().trim()); String remainAdvanceCharge = et_remainAdvanceCharge.getText().toString().trim(); String unitPrice = et_unitPrice.getText().toString().trim(); if (remainAdvanceCharge != null && !remainAdvanceCharge.equals("")) { beauty.setRemain_advance_charge(Integer.parseInt(remainAdvanceCharge)); } if (unitPrice != null && !unitPrice.equals("")) { beauty.setUnit_price(Integer.parseInt(unitPrice)); } // 设置美容院的美容卡 sendDataCard.clear(); for (int i = 0; i < cacheCardName.size(); i++) { for (int j = 0; j < cardPaging.getCards().size(); j++) { if (cardPaging.getCards().get(j).getName().equals(cacheCardName.get(i))) { sendDataCard.add(cardPaging.getCards().get(j)); break; } } } if (sendDataCard.size() > 0) { RegistBeauty registBeauty = new RegistBeauty(); registBeauty.setBeauty(gson.toJson(beauty)); registBeauty.setCards(gson.toJson(sendDataCard)); registBeauty.setTiyanCount(countTimes); Request<String> request = new HttpBusiness().registBeauty(IcanHttp.regist_beauty_url, registBeauty); RxNoHttp.request(this, request, new SimpleSubscriber<Response<String>>() { @Override public void onNext(Response<String> arg0) { Toast.show(RegistBeautyActivity.this, arg0.get()); finish(); } }); } else { Toast.show(this, "至少选择一张美容卡"); } } else { Toast.show(this, "请填写美容院名称"); } break; case R.id.ib_back: finish(); break; case R.id.img_xiugai1: alterCard(1, tv_card1); break; case R.id.img_xiugai2: alterCard(2, tv_card2); break; case R.id.img_xiugai3: alterCard(3, tv_card3); break; case R.id.img_xiugai4: alterCard(4, tv_card4); break; case R.id.img_xiugai5: alterCard(5, tv_card5); break; case R.id.img_xiugai6: alterCard(6, tv_card6); break; case R.id.img_xiugai7: alterCard(7, tv_card7); break; default: break; } } private ImageButton cancle, confirm; private EditText et_xiugai_price, et_xiugai_count; private TextView tv_xiugai; /** * 修改美容卡价格 */ private void alterCard(final int position, final TextView tv_card) { if (dialog == null) { dialog = new TipDialog().getDialog(this); } if (dialog_view == null) { dialog_view = View.inflate(this, R.layout.dialog_xiugai_card, null); tv_xiugai = (TextView) dialog_view.findViewById(R.id.tv_xiugai); et_xiugai_price = (EditText) dialog_view.findViewById(R.id.et_xiugai_price); et_xiugai_count = (EditText) dialog_view.findViewById(R.id.et_xiugai_count); cancle = (ImageButton) dialog_view.findViewById(R.id.imgbtn_cancle); confirm = (ImageButton) dialog_view.findViewById(R.id.imgbtn_confirm); } tv_xiugai.setText("修改" + cardPaging.getCards().get(position - 1).getName()); cancle.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); confirm.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String price = et_xiugai_price.getText().toString().trim(); String count = et_xiugai_count.getText().toString().trim(); if (price != null && count != null && !price.equals("") && !count.equals("")) { tv_card.setText("价格:" + price + "¥" + "\n" + "次数:" + count); cardPaging.getCards().get(position - 1).setPrice(Integer.parseInt(price)); cardPaging.getCards().get(position - 1).setTimes(Integer.parseInt(count)); } else { Toast.show(RegistBeautyActivity.this, "输入有误"); } dialog.dismiss(); } }); dialog.setContentView(dialog_view); dialog.show(); } @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { switch (buttonView.getId()) { case R.id.switch1: if (isChecked) { linear_count.setVisibility(View.VISIBLE); countTimes = cacheCountTimes; } else { linear_count.setVisibility(View.GONE); cacheCountTimes = countTimes; countTimes = 0; } break; case R.id.checkBox1: addOrDeleteCard(checkBox1, checkBox1.getText().toString().trim()); break; case R.id.checkBox2: addOrDeleteCard(checkBox2, checkBox2.getText().toString().trim()); break; case R.id.checkBox3: addOrDeleteCard(checkBox3, checkBox3.getText().toString().trim()); break; case R.id.checkBox4: addOrDeleteCard(checkBox4, checkBox4.getText().toString().trim()); break; case R.id.checkBox5: addOrDeleteCard(checkBox5, checkBox5.getText().toString().trim()); break; case R.id.checkBox6: addOrDeleteCard(checkBox6, checkBox6.getText().toString().trim()); break; case R.id.checkBox7: addOrDeleteCard(checkBox7, checkBox7.getText().toString().trim()); break; case R.id.radioButton1: countTimes = 1; break; case R.id.radioButton2: countTimes = 12; break; case R.id.radioButton3: countTimes = 20; break; default: break; } } /** * 删除或增加缓存区中的美容卡 * * @param cBox * @param cardName */ private void addOrDeleteCard(CheckBox cBox, String cardName) { if (!cBox.isChecked()) {// 如果取消选中,则删除缓存区中的此卡 for (int i = 0; i < cacheCardName.size(); i++) { if (cacheCardName.get(i).equals(cardName)) { cacheCardName.remove(i); break; } } } else {// 如果再次勾中,则在缓存区中插入此卡 for (int i = 0; i < cardPaging.getCards().size(); i++) { if (cardPaging.getCards().get(i).getName().equals(cardName)) { cacheCardName.add(cardPaging.getCards().get(i).getName()); break; } } } } @Override public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.radioButton1: countTimes = 1; break; case R.id.radioButton2: countTimes = 12; break; case R.id.radioButton3: countTimes = 20; break; default: break; } } }
UTF-8
Java
14,531
java
RegistBeautyActivity.java
Java
[]
null
[]
package com.ican.manage; import java.util.ArrayList; import java.util.List; import com.google.gson.Gson; import com.ican.manage.entity.Beauty; import com.ican.manage.entity.Card; import com.ican.manage.entity.CardPaging; import com.ican.manage.entity.RegistBeauty; import com.ican.manage.http.HttpBusiness; import com.ican.manage.http.IcanHttp; import com.ican.manage.rx.RxNoHttp; import com.ican.manage.rx.SimpleSubscriber; import com.ican.manage.util.TipDialog; import com.ican.manage.util.Toast; import com.yolanda.nohttp.rest.Request; import com.yolanda.nohttp.rest.Response; import android.app.Dialog; import android.graphics.Color; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.View.OnClickListener; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.EditText; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.RadioGroup; import android.widget.Switch; import android.widget.TextView; import android.widget.CompoundButton.OnCheckedChangeListener; public class RegistBeautyActivity extends AppCompatActivity implements OnClickListener, OnCheckedChangeListener, android.widget.RadioGroup.OnCheckedChangeListener { private RadioGroup rg_countSlect; private TextView dialog_title; private ImageButton ib_back; private ImageButton ib_commit; private LinearLayout linear_count; private Switch switch_autho_tiyan; private EditText et_name, et_contact, et_phone, et_address, et_remainAdvanceCharge, et_unitPrice; private CardPaging cardPaging; private TextView tv_card1, tv_card2, tv_card3, tv_card4, tv_card5, tv_card6, tv_card7, tv_must; private CheckBox checkBox1, checkBox2, checkBox3, checkBox4, checkBox5, checkBox6, checkBox7; private LinearLayout linearLayout; private ImageButton img_xiugai1, img_xiugai2, img_xiugai3, img_xiugai4, img_xiugai5, img_xiugai6, img_xiugai7; private Dialog dialog; private View dialog_view; private List<Card> sendDataCard = new ArrayList<Card>(); private List<String> cacheCardName = new ArrayList<String>();// 缓存美容卡名称 private int countTimes = 20; private int cacheCountTimes;// 缓存体验卡时长 private Gson gson; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_registbeauty); dialog_title = (TextView) findViewById(R.id.tv_dialog_title); dialog_title.setText("登记美容院"); ib_back = (ImageButton) findViewById(R.id.ib_back); ib_back.setOnClickListener(this); ib_commit = (ImageButton) findViewById(R.id.ib_commit); ib_commit.setImageResource(R.drawable.ic_add); ib_commit.setOnClickListener(this); linear_count = (LinearLayout) findViewById(R.id.linearLayout1); switch_autho_tiyan = (Switch) findViewById(R.id.switch1); switch_autho_tiyan.setOnCheckedChangeListener(this); et_name = (EditText) findViewById(R.id.editText1); et_contact = (EditText) findViewById(R.id.editText2); et_phone = (EditText) findViewById(R.id.editText3); et_address = (EditText) findViewById(R.id.editText4); et_remainAdvanceCharge = (EditText) findViewById(R.id.editText5); et_remainAdvanceCharge.setText("0"); et_unitPrice = (EditText) findViewById(R.id.editText6); et_unitPrice.setText("1000"); tv_card1 = (TextView) findViewById(R.id.tv_card1); tv_card2 = (TextView) findViewById(R.id.tv_card2); tv_card3 = (TextView) findViewById(R.id.tv_card3); tv_card4 = (TextView) findViewById(R.id.tv_card4); tv_card5 = (TextView) findViewById(R.id.tv_card5); tv_card6 = (TextView) findViewById(R.id.tv_card6); tv_card7 = (TextView) findViewById(R.id.tv_card7); checkBox1 = (CheckBox) findViewById(R.id.checkBox1); checkBox1.setOnCheckedChangeListener(this); checkBox2 = (CheckBox) findViewById(R.id.checkBox2); checkBox2.setOnCheckedChangeListener(this); checkBox3 = (CheckBox) findViewById(R.id.checkBox3); checkBox3.setOnCheckedChangeListener(this); checkBox4 = (CheckBox) findViewById(R.id.checkBox4); checkBox4.setOnCheckedChangeListener(this); checkBox5 = (CheckBox) findViewById(R.id.checkBox5); checkBox5.setOnCheckedChangeListener(this); checkBox6 = (CheckBox) findViewById(R.id.checkBox6); checkBox6.setOnCheckedChangeListener(this); checkBox7 = (CheckBox) findViewById(R.id.checkBox7); checkBox7.setOnCheckedChangeListener(this); img_xiugai1 = (ImageButton) findViewById(R.id.img_xiugai1); img_xiugai1.setOnClickListener(this); img_xiugai2 = (ImageButton) findViewById(R.id.img_xiugai2); img_xiugai2.setOnClickListener(this); img_xiugai3 = (ImageButton) findViewById(R.id.img_xiugai3); img_xiugai3.setOnClickListener(this); img_xiugai4 = (ImageButton) findViewById(R.id.img_xiugai4); img_xiugai4.setOnClickListener(this); img_xiugai5 = (ImageButton) findViewById(R.id.img_xiugai5); img_xiugai5.setOnClickListener(this); img_xiugai6 = (ImageButton) findViewById(R.id.img_xiugai6); img_xiugai6.setOnClickListener(this); img_xiugai7 = (ImageButton) findViewById(R.id.img_xiugai7); img_xiugai7.setOnClickListener(this); linearLayout = (LinearLayout) findViewById(R.id.linearLayout2); linearLayout.setVisibility(View.INVISIBLE); rg_countSlect = (RadioGroup) findViewById(R.id.radioGroup_count); rg_countSlect.setOnCheckedChangeListener(this); tv_must = (TextView) findViewById(R.id.tv_must); tv_must.setTextColor(Color.RED); tv_must.setVisibility(View.VISIBLE); tv_must.setText("*(必填)"); gson = new Gson(); } @Override protected void onStart() { super.onStart(); Request<String> request = new HttpBusiness().getAllInfo(1, IcanHttp.card_url); RxNoHttp.request(this, request, new SimpleSubscriber<Response<String>>() { @Override public void onNext(Response<String> stringResponse) { String string = stringResponse.get(); if (!string.equals("false")) { cardPaging = gson.fromJson(string, CardPaging.class); for (Card card : cardPaging.getCards()) { cacheCardName.add(card.getName()); } linearLayout.setVisibility(View.VISIBLE); inflateView(); } } }); } private void inflateView() { tv_card1.setText("价格:" + cardPaging.getCards().get(0).getPrice() + "¥" + "\n" + "次数:" + cardPaging.getCards().get(0).getTimes()); checkBox1.setText(cardPaging.getCards().get(0).getName()); tv_card2.setText("价格:" + cardPaging.getCards().get(1).getPrice() + "¥" + "\n" + "次数:" + cardPaging.getCards().get(1).getTimes()); checkBox2.setText(cardPaging.getCards().get(1).getName()); tv_card3.setText("价格:" + cardPaging.getCards().get(2).getPrice() + "¥" + "\n" + "次数:" + cardPaging.getCards().get(2).getTimes()); checkBox3.setText(cardPaging.getCards().get(2).getName()); tv_card4.setText("价格:" + cardPaging.getCards().get(3).getPrice() + "¥" + "\n" + "次数:" + cardPaging.getCards().get(3).getTimes()); checkBox4.setText(cardPaging.getCards().get(3).getName()); tv_card5.setText("价格:" + cardPaging.getCards().get(4).getPrice() + "¥" + "\n" + "次数:" + cardPaging.getCards().get(4).getTimes()); checkBox5.setText(cardPaging.getCards().get(4).getName()); tv_card6.setText("价格:" + cardPaging.getCards().get(5).getPrice() + "¥" + "\n" + "次数:" + cardPaging.getCards().get(5).getTimes()); checkBox6.setText(cardPaging.getCards().get(5).getName()); tv_card7.setText("价格:" + cardPaging.getCards().get(6).getPrice() + "¥" + "\n" + "次数:" + cardPaging.getCards().get(6).getTimes()); checkBox7.setText(cardPaging.getCards().get(6).getName()); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.ib_commit: String beautyName = et_name.getText().toString().trim(); if (beautyName != null && !beautyName.equals("")) { // 设置美容院基本信息 Beauty beauty = new Beauty(); beauty.setName(beautyName); beauty.setContacts(et_contact.getText().toString().trim()); beauty.setPhone(et_phone.getText().toString().trim()); beauty.setAddress(et_address.getText().toString().trim()); String remainAdvanceCharge = et_remainAdvanceCharge.getText().toString().trim(); String unitPrice = et_unitPrice.getText().toString().trim(); if (remainAdvanceCharge != null && !remainAdvanceCharge.equals("")) { beauty.setRemain_advance_charge(Integer.parseInt(remainAdvanceCharge)); } if (unitPrice != null && !unitPrice.equals("")) { beauty.setUnit_price(Integer.parseInt(unitPrice)); } // 设置美容院的美容卡 sendDataCard.clear(); for (int i = 0; i < cacheCardName.size(); i++) { for (int j = 0; j < cardPaging.getCards().size(); j++) { if (cardPaging.getCards().get(j).getName().equals(cacheCardName.get(i))) { sendDataCard.add(cardPaging.getCards().get(j)); break; } } } if (sendDataCard.size() > 0) { RegistBeauty registBeauty = new RegistBeauty(); registBeauty.setBeauty(gson.toJson(beauty)); registBeauty.setCards(gson.toJson(sendDataCard)); registBeauty.setTiyanCount(countTimes); Request<String> request = new HttpBusiness().registBeauty(IcanHttp.regist_beauty_url, registBeauty); RxNoHttp.request(this, request, new SimpleSubscriber<Response<String>>() { @Override public void onNext(Response<String> arg0) { Toast.show(RegistBeautyActivity.this, arg0.get()); finish(); } }); } else { Toast.show(this, "至少选择一张美容卡"); } } else { Toast.show(this, "请填写美容院名称"); } break; case R.id.ib_back: finish(); break; case R.id.img_xiugai1: alterCard(1, tv_card1); break; case R.id.img_xiugai2: alterCard(2, tv_card2); break; case R.id.img_xiugai3: alterCard(3, tv_card3); break; case R.id.img_xiugai4: alterCard(4, tv_card4); break; case R.id.img_xiugai5: alterCard(5, tv_card5); break; case R.id.img_xiugai6: alterCard(6, tv_card6); break; case R.id.img_xiugai7: alterCard(7, tv_card7); break; default: break; } } private ImageButton cancle, confirm; private EditText et_xiugai_price, et_xiugai_count; private TextView tv_xiugai; /** * 修改美容卡价格 */ private void alterCard(final int position, final TextView tv_card) { if (dialog == null) { dialog = new TipDialog().getDialog(this); } if (dialog_view == null) { dialog_view = View.inflate(this, R.layout.dialog_xiugai_card, null); tv_xiugai = (TextView) dialog_view.findViewById(R.id.tv_xiugai); et_xiugai_price = (EditText) dialog_view.findViewById(R.id.et_xiugai_price); et_xiugai_count = (EditText) dialog_view.findViewById(R.id.et_xiugai_count); cancle = (ImageButton) dialog_view.findViewById(R.id.imgbtn_cancle); confirm = (ImageButton) dialog_view.findViewById(R.id.imgbtn_confirm); } tv_xiugai.setText("修改" + cardPaging.getCards().get(position - 1).getName()); cancle.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); confirm.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String price = et_xiugai_price.getText().toString().trim(); String count = et_xiugai_count.getText().toString().trim(); if (price != null && count != null && !price.equals("") && !count.equals("")) { tv_card.setText("价格:" + price + "¥" + "\n" + "次数:" + count); cardPaging.getCards().get(position - 1).setPrice(Integer.parseInt(price)); cardPaging.getCards().get(position - 1).setTimes(Integer.parseInt(count)); } else { Toast.show(RegistBeautyActivity.this, "输入有误"); } dialog.dismiss(); } }); dialog.setContentView(dialog_view); dialog.show(); } @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { switch (buttonView.getId()) { case R.id.switch1: if (isChecked) { linear_count.setVisibility(View.VISIBLE); countTimes = cacheCountTimes; } else { linear_count.setVisibility(View.GONE); cacheCountTimes = countTimes; countTimes = 0; } break; case R.id.checkBox1: addOrDeleteCard(checkBox1, checkBox1.getText().toString().trim()); break; case R.id.checkBox2: addOrDeleteCard(checkBox2, checkBox2.getText().toString().trim()); break; case R.id.checkBox3: addOrDeleteCard(checkBox3, checkBox3.getText().toString().trim()); break; case R.id.checkBox4: addOrDeleteCard(checkBox4, checkBox4.getText().toString().trim()); break; case R.id.checkBox5: addOrDeleteCard(checkBox5, checkBox5.getText().toString().trim()); break; case R.id.checkBox6: addOrDeleteCard(checkBox6, checkBox6.getText().toString().trim()); break; case R.id.checkBox7: addOrDeleteCard(checkBox7, checkBox7.getText().toString().trim()); break; case R.id.radioButton1: countTimes = 1; break; case R.id.radioButton2: countTimes = 12; break; case R.id.radioButton3: countTimes = 20; break; default: break; } } /** * 删除或增加缓存区中的美容卡 * * @param cBox * @param cardName */ private void addOrDeleteCard(CheckBox cBox, String cardName) { if (!cBox.isChecked()) {// 如果取消选中,则删除缓存区中的此卡 for (int i = 0; i < cacheCardName.size(); i++) { if (cacheCardName.get(i).equals(cardName)) { cacheCardName.remove(i); break; } } } else {// 如果再次勾中,则在缓存区中插入此卡 for (int i = 0; i < cardPaging.getCards().size(); i++) { if (cardPaging.getCards().get(i).getName().equals(cardName)) { cacheCardName.add(cardPaging.getCards().get(i).getName()); break; } } } } @Override public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.radioButton1: countTimes = 1; break; case R.id.radioButton2: countTimes = 12; break; case R.id.radioButton3: countTimes = 20; break; default: break; } } }
14,531
0.684096
0.670002
388
34.574741
24.800276
111
false
false
0
0
0
0
0
0
3.118557
false
false
11
45f6260e4d5eb3e747e3dc57b579738422a67370
36,713,380,468,970
72617c12c2f40ef484a150f5ea522ec59c4fef6e
/src/test/java/test/endtoend/auctionsniper/AuctionSniperEndToEndTest.java
60f75526953df5a89826fe9027488a9c279f8b77
[ "Apache-2.0" ]
permissive
skinny85/goos-book-code
https://github.com/skinny85/goos-book-code
29593ae492fdb7aebbf34396f5f752d9236c54d6
aa779d4eb12158f84ecc16ed7481fc63bc03127b
refs/heads/master
2021-01-10T03:22:22.507000
2019-10-31T06:32:07
2019-10-31T06:32:07
49,369,445
47
15
null
null
null
null
null
null
null
null
null
null
null
null
null
package test.endtoend.auctionsniper; import org.junit.After; import org.junit.Test; public class AuctionSniperEndToEndTest { private final FakeAuctionServer auction = new FakeAuctionServer("item-54321"); private final FakeAuctionServer auction2 = new FakeAuctionServer("item-65432"); private final ApplicationRunner application = new ApplicationRunner(); @Test public void sniperJoinsAuctionUntilAuctionCloses() throws Exception { auction.startSellingItem(); application.startBiddingIn(auction); auction.hasReceivedJoinRequestFrom(ApplicationRunner.SNIPER_XMPP_ID); auction.announceClosed(); application.showsSniperHasLostAuction(auction); } @Test public void sniperMakesAHigherBidButLoses() throws Exception { auction.startSellingItem(); application.startBiddingIn(auction); auction.hasReceivedJoinRequestFrom(ApplicationRunner.SNIPER_XMPP_ID); auction.reportPrice(1000, 98, "other bidder"); application.hasShownSniperIsBidding(auction, 1000, 1098); auction.hasReceivedBid(1098, ApplicationRunner.SNIPER_XMPP_ID); auction.announceClosed(); application.showsSniperHasLostAuction(auction); } @Test public void sniperWinsAnAuctionByBiddingHigher() throws Exception { auction.startSellingItem(); application.startBiddingIn(auction); auction.hasReceivedJoinRequestFrom(ApplicationRunner.SNIPER_XMPP_ID); auction.reportPrice(1000, 98, "other bidder"); application.hasShownSniperIsBidding(auction, 1000, 1098); auction.hasReceivedBid(1098, ApplicationRunner.SNIPER_XMPP_ID); auction.reportPrice(1098, 97, ApplicationRunner.SNIPER_XMPP_ID); application.hasShownSniperIsWinning(auction, 1098); auction.announceClosed(); application.showsSniperHasWonAuction(auction, 1098); } @Test public void sniperBidsForMultipleItems() throws Exception { auction.startSellingItem(); auction2.startSellingItem(); application.startBiddingIn(auction, auction2); auction.hasReceivedJoinRequestFrom(ApplicationRunner.SNIPER_XMPP_ID); auction2.hasReceivedJoinRequestFrom(ApplicationRunner.SNIPER_XMPP_ID); auction.reportPrice(1000, 98, "other bidder"); auction.hasReceivedBid(1098, ApplicationRunner.SNIPER_XMPP_ID); auction2.reportPrice(500, 21, "other bidder"); auction2.hasReceivedBid(521, ApplicationRunner.SNIPER_XMPP_ID); auction.reportPrice(1098, 97, ApplicationRunner.SNIPER_XMPP_ID); auction2.reportPrice(521, 22, ApplicationRunner.SNIPER_XMPP_ID); application.hasShownSniperIsWinning(auction, 1098); application.hasShownSniperIsWinning(auction2, 521); auction.announceClosed(); auction2.announceClosed(); application.showsSniperHasWonAuction(auction, 1098); application.showsSniperHasWonAuction(auction2, 521); } @Test public void sniperLosesAnAuctionWhenThePriceIsTooHigh() throws Exception { auction.startSellingItem(); application.startBiddingWithStopPrice(auction, 1100); auction.hasReceivedJoinRequestFrom(ApplicationRunner.SNIPER_XMPP_ID); auction.reportPrice(1000, 98, "other bidder"); application.hasShownSniperIsBidding(auction, 1000, 1098); auction.hasReceivedBid(1098, ApplicationRunner.SNIPER_XMPP_ID); auction.reportPrice(1197, 10, "third party"); application.hasShownSniperIsLosing(auction, 1197, 1098); auction.reportPrice(1207, 10, "fourth party"); application.hasShownSniperIsLosing(auction, 1207, 1098); auction.announceClosed(); application.showsSniperHasLostAuction(auction, 1207, 1098); } @Test public void sniperReportsInvalidAuctionMessageAndStopsRespondingToEvents() throws Exception { String brokenMessage = "a broken message"; auction.startSellingItem(); auction2.startSellingItem(); application.startBiddingIn(auction, auction2); auction.hasReceivedJoinRequestFrom(ApplicationRunner.SNIPER_XMPP_ID); auction.reportPrice(500, 20, "other bidder"); auction.hasReceivedBid(520, ApplicationRunner.SNIPER_XMPP_ID); auction.sendInvalidMessageContaining(brokenMessage); application.showsSniperHasFailed(auction); auction.reportPrice(520, 21, "other bidder"); waitForAnotherAuctionEvent(); application.reportsInvalidMessage(auction, brokenMessage); application.showsSniperHasFailed(auction); } private void waitForAnotherAuctionEvent() throws Exception { auction2.hasReceivedJoinRequestFrom(ApplicationRunner.SNIPER_XMPP_ID); auction2.reportPrice(600, 6, "other bidder"); application.hasShownSniperIsBidding(auction2, 600, 606); } // Additional cleanup @After public void stopAuction() { auction.stop(); auction2.stop(); } @After public void stopApplication() { application.stop(); } }
UTF-8
Java
5,113
java
AuctionSniperEndToEndTest.java
Java
[]
null
[]
package test.endtoend.auctionsniper; import org.junit.After; import org.junit.Test; public class AuctionSniperEndToEndTest { private final FakeAuctionServer auction = new FakeAuctionServer("item-54321"); private final FakeAuctionServer auction2 = new FakeAuctionServer("item-65432"); private final ApplicationRunner application = new ApplicationRunner(); @Test public void sniperJoinsAuctionUntilAuctionCloses() throws Exception { auction.startSellingItem(); application.startBiddingIn(auction); auction.hasReceivedJoinRequestFrom(ApplicationRunner.SNIPER_XMPP_ID); auction.announceClosed(); application.showsSniperHasLostAuction(auction); } @Test public void sniperMakesAHigherBidButLoses() throws Exception { auction.startSellingItem(); application.startBiddingIn(auction); auction.hasReceivedJoinRequestFrom(ApplicationRunner.SNIPER_XMPP_ID); auction.reportPrice(1000, 98, "other bidder"); application.hasShownSniperIsBidding(auction, 1000, 1098); auction.hasReceivedBid(1098, ApplicationRunner.SNIPER_XMPP_ID); auction.announceClosed(); application.showsSniperHasLostAuction(auction); } @Test public void sniperWinsAnAuctionByBiddingHigher() throws Exception { auction.startSellingItem(); application.startBiddingIn(auction); auction.hasReceivedJoinRequestFrom(ApplicationRunner.SNIPER_XMPP_ID); auction.reportPrice(1000, 98, "other bidder"); application.hasShownSniperIsBidding(auction, 1000, 1098); auction.hasReceivedBid(1098, ApplicationRunner.SNIPER_XMPP_ID); auction.reportPrice(1098, 97, ApplicationRunner.SNIPER_XMPP_ID); application.hasShownSniperIsWinning(auction, 1098); auction.announceClosed(); application.showsSniperHasWonAuction(auction, 1098); } @Test public void sniperBidsForMultipleItems() throws Exception { auction.startSellingItem(); auction2.startSellingItem(); application.startBiddingIn(auction, auction2); auction.hasReceivedJoinRequestFrom(ApplicationRunner.SNIPER_XMPP_ID); auction2.hasReceivedJoinRequestFrom(ApplicationRunner.SNIPER_XMPP_ID); auction.reportPrice(1000, 98, "other bidder"); auction.hasReceivedBid(1098, ApplicationRunner.SNIPER_XMPP_ID); auction2.reportPrice(500, 21, "other bidder"); auction2.hasReceivedBid(521, ApplicationRunner.SNIPER_XMPP_ID); auction.reportPrice(1098, 97, ApplicationRunner.SNIPER_XMPP_ID); auction2.reportPrice(521, 22, ApplicationRunner.SNIPER_XMPP_ID); application.hasShownSniperIsWinning(auction, 1098); application.hasShownSniperIsWinning(auction2, 521); auction.announceClosed(); auction2.announceClosed(); application.showsSniperHasWonAuction(auction, 1098); application.showsSniperHasWonAuction(auction2, 521); } @Test public void sniperLosesAnAuctionWhenThePriceIsTooHigh() throws Exception { auction.startSellingItem(); application.startBiddingWithStopPrice(auction, 1100); auction.hasReceivedJoinRequestFrom(ApplicationRunner.SNIPER_XMPP_ID); auction.reportPrice(1000, 98, "other bidder"); application.hasShownSniperIsBidding(auction, 1000, 1098); auction.hasReceivedBid(1098, ApplicationRunner.SNIPER_XMPP_ID); auction.reportPrice(1197, 10, "third party"); application.hasShownSniperIsLosing(auction, 1197, 1098); auction.reportPrice(1207, 10, "fourth party"); application.hasShownSniperIsLosing(auction, 1207, 1098); auction.announceClosed(); application.showsSniperHasLostAuction(auction, 1207, 1098); } @Test public void sniperReportsInvalidAuctionMessageAndStopsRespondingToEvents() throws Exception { String brokenMessage = "a broken message"; auction.startSellingItem(); auction2.startSellingItem(); application.startBiddingIn(auction, auction2); auction.hasReceivedJoinRequestFrom(ApplicationRunner.SNIPER_XMPP_ID); auction.reportPrice(500, 20, "other bidder"); auction.hasReceivedBid(520, ApplicationRunner.SNIPER_XMPP_ID); auction.sendInvalidMessageContaining(brokenMessage); application.showsSniperHasFailed(auction); auction.reportPrice(520, 21, "other bidder"); waitForAnotherAuctionEvent(); application.reportsInvalidMessage(auction, brokenMessage); application.showsSniperHasFailed(auction); } private void waitForAnotherAuctionEvent() throws Exception { auction2.hasReceivedJoinRequestFrom(ApplicationRunner.SNIPER_XMPP_ID); auction2.reportPrice(600, 6, "other bidder"); application.hasShownSniperIsBidding(auction2, 600, 606); } // Additional cleanup @After public void stopAuction() { auction.stop(); auction2.stop(); } @After public void stopApplication() { application.stop(); } }
5,113
0.715236
0.67612
145
34.26207
29.270445
97
false
false
0
0
0
0
0
0
0.917241
false
false
11
1612cb6dd5e8d6a8d0ca332dcd3d47fc38f0295f
34,875,134,479,359
527678c57106c33567145d8a4503bb9482dc6227
/Java Core/Full Java/rizvi's code/BiggestNumber.java
1158aee38dac73419022cb6e497ade11c55da4c0
[ "MIT" ]
permissive
themizan404/JAVA-All
https://github.com/themizan404/JAVA-All
2107ffee64b5aed27343b17822751ce694bacbbc
55fc16fd0eaf9165047ebf0b790043ae49c3ced2
refs/heads/master
2023-03-06T05:27:15.164000
2021-02-19T20:01:11
2021-02-19T20:01:11
294,966,363
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package practice; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Scanner; import java.util.*; public class BiggestNumber { static List<Integer> numbers = new ArrayList(); public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter int nums"); int n = sc.nextInt(); int i = 0; while(n!= 1){ numbers.add(n); n = sc.nextInt(); } System.out.println(getBiggestNum(numbers)); } public static int getBiggestNum(List<Integer> nums) { Collections.sort(nums); return nums.get(nums.size() -1); } }
UTF-8
Java
733
java
BiggestNumber.java
Java
[]
null
[]
package practice; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Scanner; import java.util.*; public class BiggestNumber { static List<Integer> numbers = new ArrayList(); public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter int nums"); int n = sc.nextInt(); int i = 0; while(n!= 1){ numbers.add(n); n = sc.nextInt(); } System.out.println(getBiggestNum(numbers)); } public static int getBiggestNum(List<Integer> nums) { Collections.sort(nums); return nums.get(nums.size() -1); } }
733
0.609823
0.60573
30
23.4
16.827755
57
false
false
0
0
0
0
0
0
0.566667
false
false
11
10ac7341155772138b23419c926a6f4e50161bd3
33,792,802,726,496
338a82ab5ae52cf1da381fa86fb66e11ef5e0818
/Week-1/Day-4/src/milesToKmConverter.java
ba6dda7dd8558b1be42105052d70ffba57b954b0
[]
no_license
mpakaris/mpakaris
https://github.com/mpakaris/mpakaris
cc25e235ef361138b1df2902b3952df7d19584e7
37308cd97b96609c2c69761640b91a9637e38f26
refs/heads/master
2022-06-25T21:55:06.642000
2020-05-11T16:19:37
2020-05-11T16:19:37
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; public class milesToKmConverter { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Please enter below the Miles you want to convert into km:"); double milesUser = scanner.nextDouble(); double kmCalculates = milesUser*1.609344; System.out.println("km: " + kmCalculates); } }
UTF-8
Java
407
java
milesToKmConverter.java
Java
[]
null
[]
import java.util.Scanner; public class milesToKmConverter { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Please enter below the Miles you want to convert into km:"); double milesUser = scanner.nextDouble(); double kmCalculates = milesUser*1.609344; System.out.println("km: " + kmCalculates); } }
407
0.663391
0.646192
15
26.133333
26.810114
88
false
false
0
0
0
0
0
0
0.4
false
false
11
faaafe52c49ef5bedeb94b1b7e41d804370622ef
30,013,231,511,514
65a386394cbd8445c2c3ba53b29ebd3e6dd3723f
/lab_1/src/ua/feo/statement/DeleteStatement.java
9d30b1c03a19b587ebd584eb055c4354d449adb5
[]
no_license
Feodott/nulp.pist-21.sem1.ModelingAndAnalysisSoftware
https://github.com/Feodott/nulp.pist-21.sem1.ModelingAndAnalysisSoftware
c84aac2b1b75fcdadb091ae18bd20dcf3da5cbf7
c960f6deea574de6ef9bc11ae04323da3b548b45
refs/heads/master
2018-01-05T00:48:14.900000
2016-12-29T00:03:41
2016-12-29T00:03:41
70,906,745
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ua.feo.statement; import ua.feo.exception.InterpreterException; import ua.feo.interpreter.Context; import ua.feo.visitor.Visitor; public class DeleteStatement implements Statement { public final String variable; public DeleteStatement(String variable) { this.variable = variable; } @Override public void execute(Context context) throws InterpreterException { context.getVariables().delete(variable); } @Override public void accept(Visitor visitor) { visitor.visit(this); } }
UTF-8
Java
550
java
DeleteStatement.java
Java
[]
null
[]
package ua.feo.statement; import ua.feo.exception.InterpreterException; import ua.feo.interpreter.Context; import ua.feo.visitor.Visitor; public class DeleteStatement implements Statement { public final String variable; public DeleteStatement(String variable) { this.variable = variable; } @Override public void execute(Context context) throws InterpreterException { context.getVariables().delete(variable); } @Override public void accept(Visitor visitor) { visitor.visit(this); } }
550
0.712727
0.712727
25
21
20.560156
70
false
false
0
0
0
0
0
0
0.32
false
false
11
38bff107ac30952f7641bc6a8aede23eddf5b4df
35,390,530,554,323
104079c6b563bcf01d4cffb7632d1ea248037efe
/FirestormTemp/src/zt/cms/xf/common/dto/Xfvcontractprtinfo.java
3927da5ae4c4dd9aa271f57c06cbff676d7050c2
[]
no_license
yangzilong1986/zhan-cms
https://github.com/yangzilong1986/zhan-cms
a740244cc0d7fbd293f349ecf34dadbb71d80aad
bc5a5c6e0561fd7b0e4e1557a310119e53f55041
refs/heads/master
2016-09-10T21:39:46.841000
2011-07-11T06:09:38
2011-07-11T06:09:38
42,923,886
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * This source file was generated by FireStorm/DAO. * * If you purchase a full license for FireStorm/DAO you can customize this header file. * * For more information please visit http://www.codefutures.com/products/firestorm */ package zt.cms.xf.common.dto; import zt.cms.xf.common.dao.*; import zt.cms.xf.common.factory.*; import zt.cms.xf.common.exceptions.*; import java.io.Serializable; import java.util.*; import java.util.Date; import java.math.BigDecimal; public class Xfvcontractprtinfo implements Serializable { /** * This attribute maps to the column CONTRACTNO in the XFVCONTRACTPRTINFO table. */ protected String contractno; /** * This attribute maps to the column STARTDATE in the XFVCONTRACTPRTINFO table. */ protected Date startdate; /** * This attribute maps to the column PLACE in the XFVCONTRACTPRTINFO table. */ protected String place; /** * This attribute maps to the column DURATION in the XFVCONTRACTPRTINFO table. */ protected BigDecimal duration; /** * This attribute maps to the column CONTRACTAMT in the XFVCONTRACTPRTINFO table. */ protected BigDecimal contractamt; /** * This attribute maps to the column SERVICECHARGE in the XFVCONTRACTPRTINFO table. */ protected BigDecimal servicecharge; /** * This attribute maps to the column PARTNERNAME in the XFVCONTRACTPRTINFO table. */ protected String partnername; /** * This attribute maps to the column CLIENTIDTYPE in the XFVCONTRACTPRTINFO table. */ protected String clientidtype; /** * This attribute maps to the column CLIENTID in the XFVCONTRACTPRTINFO table. */ protected String clientid; /** * This attribute maps to the column CLIENTNAME in the XFVCONTRACTPRTINFO table. */ protected String clientname; /** * This attribute maps to the column PAYBACKACT in the XFVCONTRACTPRTINFO table. */ protected String paybackact; /** * This attribute maps to the column PAYBACKACTNAME in the XFVCONTRACTPRTINFO table. */ protected String paybackactname; /** * This attribute maps to the column COMMNAME in the XFVCONTRACTPRTINFO table. */ protected String commname; /** * This attribute maps to the column NUM in the XFVCONTRACTPRTINFO table. */ protected String num; /** * This attribute maps to the column PC in the XFVCONTRACTPRTINFO table. */ protected String pc; /** * This attribute maps to the column PHONE1 in the XFVCONTRACTPRTINFO table. */ protected String phone1; /** * This attribute maps to the column PHONE2 in the XFVCONTRACTPRTINFO table. */ protected String phone2; /** * This attribute maps to the column PHONE3 in the XFVCONTRACTPRTINFO table. */ protected String phone3; /** * This attribute maps to the column APPNO in the XFVCONTRACTPRTINFO table. */ protected String appno; /** * This attribute maps to the column WITHHOLDBANKNAME in the XFVCONTRACTPRTINFO table. */ protected String withholdbankname; /** * This attribute maps to the column COMMAMT in the XFVCONTRACTPRTINFO table. */ protected BigDecimal commamt; /** * This attribute maps to the column RECEIVEAMT in the XFVCONTRACTPRTINFO table. */ protected BigDecimal receiveamt; /** * This attribute maps to the column APPDATE in the XFVCONTRACTPRTINFO table. */ protected Date appdate; /** * Method 'Xfvcontractprtinfo' * */ public Xfvcontractprtinfo() { } /** * Method 'getContractno' * * @return String */ public String getContractno() { return contractno; } /** * Method 'setContractno' * * @param contractno */ public void setContractno(String contractno) { this.contractno = contractno; } /** * Method 'getStartdate' * * @return Date */ public Date getStartdate() { return startdate; } /** * Method 'setStartdate' * * @param startdate */ public void setStartdate(Date startdate) { this.startdate = startdate; } /** * Method 'getPlace' * * @return String */ public String getPlace() { return place; } /** * Method 'setPlace' * * @param place */ public void setPlace(String place) { this.place = place; } /** * Method 'getDuration' * * @return BigDecimal */ public BigDecimal getDuration() { return duration; } /** * Method 'setDuration' * * @param duration */ public void setDuration(BigDecimal duration) { this.duration = duration; } /** * Method 'getContractamt' * * @return BigDecimal */ public BigDecimal getContractamt() { return contractamt; } /** * Method 'setContractamt' * * @param contractamt */ public void setContractamt(BigDecimal contractamt) { this.contractamt = contractamt; } /** * Method 'getServicecharge' * * @return BigDecimal */ public BigDecimal getServicecharge() { return servicecharge; } /** * Method 'setServicecharge' * * @param servicecharge */ public void setServicecharge(BigDecimal servicecharge) { this.servicecharge = servicecharge; } /** * Method 'getPartnername' * * @return String */ public String getPartnername() { return partnername; } /** * Method 'setPartnername' * * @param partnername */ public void setPartnername(String partnername) { this.partnername = partnername; } /** * Method 'getClientidtype' * * @return String */ public String getClientidtype() { return clientidtype; } /** * Method 'setClientidtype' * * @param clientidtype */ public void setClientidtype(String clientidtype) { this.clientidtype = clientidtype; } /** * Method 'getClientid' * * @return String */ public String getClientid() { return clientid; } /** * Method 'setClientid' * * @param clientid */ public void setClientid(String clientid) { this.clientid = clientid; } /** * Method 'getClientname' * * @return String */ public String getClientname() { return clientname; } /** * Method 'setClientname' * * @param clientname */ public void setClientname(String clientname) { this.clientname = clientname; } /** * Method 'getPaybackact' * * @return String */ public String getPaybackact() { return paybackact; } /** * Method 'setPaybackact' * * @param paybackact */ public void setPaybackact(String paybackact) { this.paybackact = paybackact; } /** * Method 'getPaybackactname' * * @return String */ public String getPaybackactname() { return paybackactname; } /** * Method 'setPaybackactname' * * @param paybackactname */ public void setPaybackactname(String paybackactname) { this.paybackactname = paybackactname; } /** * Method 'getCommname' * * @return String */ public String getCommname() { return commname; } /** * Method 'setCommname' * * @param commname */ public void setCommname(String commname) { this.commname = commname; } /** * Method 'getNum' * * @return String */ public String getNum() { return num; } /** * Method 'setNum' * * @param num */ public void setNum(String num) { this.num = num; } /** * Method 'getPc' * * @return String */ public String getPc() { return pc; } /** * Method 'setPc' * * @param pc */ public void setPc(String pc) { this.pc = pc; } /** * Method 'getPhone1' * * @return String */ public String getPhone1() { return phone1; } /** * Method 'setPhone1' * * @param phone1 */ public void setPhone1(String phone1) { this.phone1 = phone1; } /** * Method 'getPhone2' * * @return String */ public String getPhone2() { return phone2; } /** * Method 'setPhone2' * * @param phone2 */ public void setPhone2(String phone2) { this.phone2 = phone2; } /** * Method 'getPhone3' * * @return String */ public String getPhone3() { return phone3; } /** * Method 'setPhone3' * * @param phone3 */ public void setPhone3(String phone3) { this.phone3 = phone3; } /** * Method 'getAppno' * * @return String */ public String getAppno() { return appno; } /** * Method 'setAppno' * * @param appno */ public void setAppno(String appno) { this.appno = appno; } /** * Method 'getWithholdbankname' * * @return String */ public String getWithholdbankname() { return withholdbankname; } /** * Method 'setWithholdbankname' * * @param withholdbankname */ public void setWithholdbankname(String withholdbankname) { this.withholdbankname = withholdbankname; } /** * Method 'getCommamt' * * @return BigDecimal */ public BigDecimal getCommamt() { return commamt; } /** * Method 'setCommamt' * * @param commamt */ public void setCommamt(BigDecimal commamt) { this.commamt = commamt; } /** * Method 'getReceiveamt' * * @return BigDecimal */ public BigDecimal getReceiveamt() { return receiveamt; } /** * Method 'setReceiveamt' * * @param receiveamt */ public void setReceiveamt(BigDecimal receiveamt) { this.receiveamt = receiveamt; } /** * Method 'getAppdate' * * @return Date */ public Date getAppdate() { return appdate; } /** * Method 'setAppdate' * * @param appdate */ public void setAppdate(Date appdate) { this.appdate = appdate; } /** * Method 'equals' * * @param _other * @return boolean */ public boolean equals(Object _other) { if (_other == null) { return false; } if (_other == this) { return true; } if (!(_other instanceof Xfvcontractprtinfo)) { return false; } final Xfvcontractprtinfo _cast = (Xfvcontractprtinfo) _other; if (contractno == null ? _cast.contractno != contractno : !contractno.equals( _cast.contractno )) { return false; } if (startdate == null ? _cast.startdate != startdate : !startdate.equals( _cast.startdate )) { return false; } if (place == null ? _cast.place != place : !place.equals( _cast.place )) { return false; } if (duration == null ? _cast.duration != duration : !duration.equals( _cast.duration )) { return false; } if (contractamt == null ? _cast.contractamt != contractamt : !contractamt.equals( _cast.contractamt )) { return false; } if (servicecharge == null ? _cast.servicecharge != servicecharge : !servicecharge.equals( _cast.servicecharge )) { return false; } if (partnername == null ? _cast.partnername != partnername : !partnername.equals( _cast.partnername )) { return false; } if (clientidtype == null ? _cast.clientidtype != clientidtype : !clientidtype.equals( _cast.clientidtype )) { return false; } if (clientid == null ? _cast.clientid != clientid : !clientid.equals( _cast.clientid )) { return false; } if (clientname == null ? _cast.clientname != clientname : !clientname.equals( _cast.clientname )) { return false; } if (paybackact == null ? _cast.paybackact != paybackact : !paybackact.equals( _cast.paybackact )) { return false; } if (paybackactname == null ? _cast.paybackactname != paybackactname : !paybackactname.equals( _cast.paybackactname )) { return false; } if (commname == null ? _cast.commname != commname : !commname.equals( _cast.commname )) { return false; } if (num == null ? _cast.num != num : !num.equals( _cast.num )) { return false; } if (pc == null ? _cast.pc != pc : !pc.equals( _cast.pc )) { return false; } if (phone1 == null ? _cast.phone1 != phone1 : !phone1.equals( _cast.phone1 )) { return false; } if (phone2 == null ? _cast.phone2 != phone2 : !phone2.equals( _cast.phone2 )) { return false; } if (phone3 == null ? _cast.phone3 != phone3 : !phone3.equals( _cast.phone3 )) { return false; } if (appno == null ? _cast.appno != appno : !appno.equals( _cast.appno )) { return false; } if (withholdbankname == null ? _cast.withholdbankname != withholdbankname : !withholdbankname.equals( _cast.withholdbankname )) { return false; } if (commamt == null ? _cast.commamt != commamt : !commamt.equals( _cast.commamt )) { return false; } if (receiveamt == null ? _cast.receiveamt != receiveamt : !receiveamt.equals( _cast.receiveamt )) { return false; } if (appdate == null ? _cast.appdate != appdate : !appdate.equals( _cast.appdate )) { return false; } return true; } /** * Method 'hashCode' * * @return int */ public int hashCode() { int _hashCode = 0; if (contractno != null) { _hashCode = 29 * _hashCode + contractno.hashCode(); } if (startdate != null) { _hashCode = 29 * _hashCode + startdate.hashCode(); } if (place != null) { _hashCode = 29 * _hashCode + place.hashCode(); } if (duration != null) { _hashCode = 29 * _hashCode + duration.hashCode(); } if (contractamt != null) { _hashCode = 29 * _hashCode + contractamt.hashCode(); } if (servicecharge != null) { _hashCode = 29 * _hashCode + servicecharge.hashCode(); } if (partnername != null) { _hashCode = 29 * _hashCode + partnername.hashCode(); } if (clientidtype != null) { _hashCode = 29 * _hashCode + clientidtype.hashCode(); } if (clientid != null) { _hashCode = 29 * _hashCode + clientid.hashCode(); } if (clientname != null) { _hashCode = 29 * _hashCode + clientname.hashCode(); } if (paybackact != null) { _hashCode = 29 * _hashCode + paybackact.hashCode(); } if (paybackactname != null) { _hashCode = 29 * _hashCode + paybackactname.hashCode(); } if (commname != null) { _hashCode = 29 * _hashCode + commname.hashCode(); } if (num != null) { _hashCode = 29 * _hashCode + num.hashCode(); } if (pc != null) { _hashCode = 29 * _hashCode + pc.hashCode(); } if (phone1 != null) { _hashCode = 29 * _hashCode + phone1.hashCode(); } if (phone2 != null) { _hashCode = 29 * _hashCode + phone2.hashCode(); } if (phone3 != null) { _hashCode = 29 * _hashCode + phone3.hashCode(); } if (appno != null) { _hashCode = 29 * _hashCode + appno.hashCode(); } if (withholdbankname != null) { _hashCode = 29 * _hashCode + withholdbankname.hashCode(); } if (commamt != null) { _hashCode = 29 * _hashCode + commamt.hashCode(); } if (receiveamt != null) { _hashCode = 29 * _hashCode + receiveamt.hashCode(); } if (appdate != null) { _hashCode = 29 * _hashCode + appdate.hashCode(); } return _hashCode; } /** * Method 'toString' * * @return String */ public String toString() { StringBuffer ret = new StringBuffer(); ret.append( "zt.cms.xf.common.dto.Xfvcontractprtinfo: " ); ret.append( "contractno=" + contractno ); ret.append( ", startdate=" + startdate ); ret.append( ", place=" + place ); ret.append( ", duration=" + duration ); ret.append( ", contractamt=" + contractamt ); ret.append( ", servicecharge=" + servicecharge ); ret.append( ", partnername=" + partnername ); ret.append( ", clientidtype=" + clientidtype ); ret.append( ", clientid=" + clientid ); ret.append( ", clientname=" + clientname ); ret.append( ", paybackact=" + paybackact ); ret.append( ", paybackactname=" + paybackactname ); ret.append( ", commname=" + commname ); ret.append( ", num=" + num ); ret.append( ", pc=" + pc ); ret.append( ", phone1=" + phone1 ); ret.append( ", phone2=" + phone2 ); ret.append( ", phone3=" + phone3 ); ret.append( ", appno=" + appno ); ret.append( ", withholdbankname=" + withholdbankname ); ret.append( ", commamt=" + commamt ); ret.append( ", receiveamt=" + receiveamt ); ret.append( ", appdate=" + appdate ); return ret.toString(); } }
UTF-8
Java
16,649
java
Xfvcontractprtinfo.java
Java
[]
null
[]
/* * This source file was generated by FireStorm/DAO. * * If you purchase a full license for FireStorm/DAO you can customize this header file. * * For more information please visit http://www.codefutures.com/products/firestorm */ package zt.cms.xf.common.dto; import zt.cms.xf.common.dao.*; import zt.cms.xf.common.factory.*; import zt.cms.xf.common.exceptions.*; import java.io.Serializable; import java.util.*; import java.util.Date; import java.math.BigDecimal; public class Xfvcontractprtinfo implements Serializable { /** * This attribute maps to the column CONTRACTNO in the XFVCONTRACTPRTINFO table. */ protected String contractno; /** * This attribute maps to the column STARTDATE in the XFVCONTRACTPRTINFO table. */ protected Date startdate; /** * This attribute maps to the column PLACE in the XFVCONTRACTPRTINFO table. */ protected String place; /** * This attribute maps to the column DURATION in the XFVCONTRACTPRTINFO table. */ protected BigDecimal duration; /** * This attribute maps to the column CONTRACTAMT in the XFVCONTRACTPRTINFO table. */ protected BigDecimal contractamt; /** * This attribute maps to the column SERVICECHARGE in the XFVCONTRACTPRTINFO table. */ protected BigDecimal servicecharge; /** * This attribute maps to the column PARTNERNAME in the XFVCONTRACTPRTINFO table. */ protected String partnername; /** * This attribute maps to the column CLIENTIDTYPE in the XFVCONTRACTPRTINFO table. */ protected String clientidtype; /** * This attribute maps to the column CLIENTID in the XFVCONTRACTPRTINFO table. */ protected String clientid; /** * This attribute maps to the column CLIENTNAME in the XFVCONTRACTPRTINFO table. */ protected String clientname; /** * This attribute maps to the column PAYBACKACT in the XFVCONTRACTPRTINFO table. */ protected String paybackact; /** * This attribute maps to the column PAYBACKACTNAME in the XFVCONTRACTPRTINFO table. */ protected String paybackactname; /** * This attribute maps to the column COMMNAME in the XFVCONTRACTPRTINFO table. */ protected String commname; /** * This attribute maps to the column NUM in the XFVCONTRACTPRTINFO table. */ protected String num; /** * This attribute maps to the column PC in the XFVCONTRACTPRTINFO table. */ protected String pc; /** * This attribute maps to the column PHONE1 in the XFVCONTRACTPRTINFO table. */ protected String phone1; /** * This attribute maps to the column PHONE2 in the XFVCONTRACTPRTINFO table. */ protected String phone2; /** * This attribute maps to the column PHONE3 in the XFVCONTRACTPRTINFO table. */ protected String phone3; /** * This attribute maps to the column APPNO in the XFVCONTRACTPRTINFO table. */ protected String appno; /** * This attribute maps to the column WITHHOLDBANKNAME in the XFVCONTRACTPRTINFO table. */ protected String withholdbankname; /** * This attribute maps to the column COMMAMT in the XFVCONTRACTPRTINFO table. */ protected BigDecimal commamt; /** * This attribute maps to the column RECEIVEAMT in the XFVCONTRACTPRTINFO table. */ protected BigDecimal receiveamt; /** * This attribute maps to the column APPDATE in the XFVCONTRACTPRTINFO table. */ protected Date appdate; /** * Method 'Xfvcontractprtinfo' * */ public Xfvcontractprtinfo() { } /** * Method 'getContractno' * * @return String */ public String getContractno() { return contractno; } /** * Method 'setContractno' * * @param contractno */ public void setContractno(String contractno) { this.contractno = contractno; } /** * Method 'getStartdate' * * @return Date */ public Date getStartdate() { return startdate; } /** * Method 'setStartdate' * * @param startdate */ public void setStartdate(Date startdate) { this.startdate = startdate; } /** * Method 'getPlace' * * @return String */ public String getPlace() { return place; } /** * Method 'setPlace' * * @param place */ public void setPlace(String place) { this.place = place; } /** * Method 'getDuration' * * @return BigDecimal */ public BigDecimal getDuration() { return duration; } /** * Method 'setDuration' * * @param duration */ public void setDuration(BigDecimal duration) { this.duration = duration; } /** * Method 'getContractamt' * * @return BigDecimal */ public BigDecimal getContractamt() { return contractamt; } /** * Method 'setContractamt' * * @param contractamt */ public void setContractamt(BigDecimal contractamt) { this.contractamt = contractamt; } /** * Method 'getServicecharge' * * @return BigDecimal */ public BigDecimal getServicecharge() { return servicecharge; } /** * Method 'setServicecharge' * * @param servicecharge */ public void setServicecharge(BigDecimal servicecharge) { this.servicecharge = servicecharge; } /** * Method 'getPartnername' * * @return String */ public String getPartnername() { return partnername; } /** * Method 'setPartnername' * * @param partnername */ public void setPartnername(String partnername) { this.partnername = partnername; } /** * Method 'getClientidtype' * * @return String */ public String getClientidtype() { return clientidtype; } /** * Method 'setClientidtype' * * @param clientidtype */ public void setClientidtype(String clientidtype) { this.clientidtype = clientidtype; } /** * Method 'getClientid' * * @return String */ public String getClientid() { return clientid; } /** * Method 'setClientid' * * @param clientid */ public void setClientid(String clientid) { this.clientid = clientid; } /** * Method 'getClientname' * * @return String */ public String getClientname() { return clientname; } /** * Method 'setClientname' * * @param clientname */ public void setClientname(String clientname) { this.clientname = clientname; } /** * Method 'getPaybackact' * * @return String */ public String getPaybackact() { return paybackact; } /** * Method 'setPaybackact' * * @param paybackact */ public void setPaybackact(String paybackact) { this.paybackact = paybackact; } /** * Method 'getPaybackactname' * * @return String */ public String getPaybackactname() { return paybackactname; } /** * Method 'setPaybackactname' * * @param paybackactname */ public void setPaybackactname(String paybackactname) { this.paybackactname = paybackactname; } /** * Method 'getCommname' * * @return String */ public String getCommname() { return commname; } /** * Method 'setCommname' * * @param commname */ public void setCommname(String commname) { this.commname = commname; } /** * Method 'getNum' * * @return String */ public String getNum() { return num; } /** * Method 'setNum' * * @param num */ public void setNum(String num) { this.num = num; } /** * Method 'getPc' * * @return String */ public String getPc() { return pc; } /** * Method 'setPc' * * @param pc */ public void setPc(String pc) { this.pc = pc; } /** * Method 'getPhone1' * * @return String */ public String getPhone1() { return phone1; } /** * Method 'setPhone1' * * @param phone1 */ public void setPhone1(String phone1) { this.phone1 = phone1; } /** * Method 'getPhone2' * * @return String */ public String getPhone2() { return phone2; } /** * Method 'setPhone2' * * @param phone2 */ public void setPhone2(String phone2) { this.phone2 = phone2; } /** * Method 'getPhone3' * * @return String */ public String getPhone3() { return phone3; } /** * Method 'setPhone3' * * @param phone3 */ public void setPhone3(String phone3) { this.phone3 = phone3; } /** * Method 'getAppno' * * @return String */ public String getAppno() { return appno; } /** * Method 'setAppno' * * @param appno */ public void setAppno(String appno) { this.appno = appno; } /** * Method 'getWithholdbankname' * * @return String */ public String getWithholdbankname() { return withholdbankname; } /** * Method 'setWithholdbankname' * * @param withholdbankname */ public void setWithholdbankname(String withholdbankname) { this.withholdbankname = withholdbankname; } /** * Method 'getCommamt' * * @return BigDecimal */ public BigDecimal getCommamt() { return commamt; } /** * Method 'setCommamt' * * @param commamt */ public void setCommamt(BigDecimal commamt) { this.commamt = commamt; } /** * Method 'getReceiveamt' * * @return BigDecimal */ public BigDecimal getReceiveamt() { return receiveamt; } /** * Method 'setReceiveamt' * * @param receiveamt */ public void setReceiveamt(BigDecimal receiveamt) { this.receiveamt = receiveamt; } /** * Method 'getAppdate' * * @return Date */ public Date getAppdate() { return appdate; } /** * Method 'setAppdate' * * @param appdate */ public void setAppdate(Date appdate) { this.appdate = appdate; } /** * Method 'equals' * * @param _other * @return boolean */ public boolean equals(Object _other) { if (_other == null) { return false; } if (_other == this) { return true; } if (!(_other instanceof Xfvcontractprtinfo)) { return false; } final Xfvcontractprtinfo _cast = (Xfvcontractprtinfo) _other; if (contractno == null ? _cast.contractno != contractno : !contractno.equals( _cast.contractno )) { return false; } if (startdate == null ? _cast.startdate != startdate : !startdate.equals( _cast.startdate )) { return false; } if (place == null ? _cast.place != place : !place.equals( _cast.place )) { return false; } if (duration == null ? _cast.duration != duration : !duration.equals( _cast.duration )) { return false; } if (contractamt == null ? _cast.contractamt != contractamt : !contractamt.equals( _cast.contractamt )) { return false; } if (servicecharge == null ? _cast.servicecharge != servicecharge : !servicecharge.equals( _cast.servicecharge )) { return false; } if (partnername == null ? _cast.partnername != partnername : !partnername.equals( _cast.partnername )) { return false; } if (clientidtype == null ? _cast.clientidtype != clientidtype : !clientidtype.equals( _cast.clientidtype )) { return false; } if (clientid == null ? _cast.clientid != clientid : !clientid.equals( _cast.clientid )) { return false; } if (clientname == null ? _cast.clientname != clientname : !clientname.equals( _cast.clientname )) { return false; } if (paybackact == null ? _cast.paybackact != paybackact : !paybackact.equals( _cast.paybackact )) { return false; } if (paybackactname == null ? _cast.paybackactname != paybackactname : !paybackactname.equals( _cast.paybackactname )) { return false; } if (commname == null ? _cast.commname != commname : !commname.equals( _cast.commname )) { return false; } if (num == null ? _cast.num != num : !num.equals( _cast.num )) { return false; } if (pc == null ? _cast.pc != pc : !pc.equals( _cast.pc )) { return false; } if (phone1 == null ? _cast.phone1 != phone1 : !phone1.equals( _cast.phone1 )) { return false; } if (phone2 == null ? _cast.phone2 != phone2 : !phone2.equals( _cast.phone2 )) { return false; } if (phone3 == null ? _cast.phone3 != phone3 : !phone3.equals( _cast.phone3 )) { return false; } if (appno == null ? _cast.appno != appno : !appno.equals( _cast.appno )) { return false; } if (withholdbankname == null ? _cast.withholdbankname != withholdbankname : !withholdbankname.equals( _cast.withholdbankname )) { return false; } if (commamt == null ? _cast.commamt != commamt : !commamt.equals( _cast.commamt )) { return false; } if (receiveamt == null ? _cast.receiveamt != receiveamt : !receiveamt.equals( _cast.receiveamt )) { return false; } if (appdate == null ? _cast.appdate != appdate : !appdate.equals( _cast.appdate )) { return false; } return true; } /** * Method 'hashCode' * * @return int */ public int hashCode() { int _hashCode = 0; if (contractno != null) { _hashCode = 29 * _hashCode + contractno.hashCode(); } if (startdate != null) { _hashCode = 29 * _hashCode + startdate.hashCode(); } if (place != null) { _hashCode = 29 * _hashCode + place.hashCode(); } if (duration != null) { _hashCode = 29 * _hashCode + duration.hashCode(); } if (contractamt != null) { _hashCode = 29 * _hashCode + contractamt.hashCode(); } if (servicecharge != null) { _hashCode = 29 * _hashCode + servicecharge.hashCode(); } if (partnername != null) { _hashCode = 29 * _hashCode + partnername.hashCode(); } if (clientidtype != null) { _hashCode = 29 * _hashCode + clientidtype.hashCode(); } if (clientid != null) { _hashCode = 29 * _hashCode + clientid.hashCode(); } if (clientname != null) { _hashCode = 29 * _hashCode + clientname.hashCode(); } if (paybackact != null) { _hashCode = 29 * _hashCode + paybackact.hashCode(); } if (paybackactname != null) { _hashCode = 29 * _hashCode + paybackactname.hashCode(); } if (commname != null) { _hashCode = 29 * _hashCode + commname.hashCode(); } if (num != null) { _hashCode = 29 * _hashCode + num.hashCode(); } if (pc != null) { _hashCode = 29 * _hashCode + pc.hashCode(); } if (phone1 != null) { _hashCode = 29 * _hashCode + phone1.hashCode(); } if (phone2 != null) { _hashCode = 29 * _hashCode + phone2.hashCode(); } if (phone3 != null) { _hashCode = 29 * _hashCode + phone3.hashCode(); } if (appno != null) { _hashCode = 29 * _hashCode + appno.hashCode(); } if (withholdbankname != null) { _hashCode = 29 * _hashCode + withholdbankname.hashCode(); } if (commamt != null) { _hashCode = 29 * _hashCode + commamt.hashCode(); } if (receiveamt != null) { _hashCode = 29 * _hashCode + receiveamt.hashCode(); } if (appdate != null) { _hashCode = 29 * _hashCode + appdate.hashCode(); } return _hashCode; } /** * Method 'toString' * * @return String */ public String toString() { StringBuffer ret = new StringBuffer(); ret.append( "zt.cms.xf.common.dto.Xfvcontractprtinfo: " ); ret.append( "contractno=" + contractno ); ret.append( ", startdate=" + startdate ); ret.append( ", place=" + place ); ret.append( ", duration=" + duration ); ret.append( ", contractamt=" + contractamt ); ret.append( ", servicecharge=" + servicecharge ); ret.append( ", partnername=" + partnername ); ret.append( ", clientidtype=" + clientidtype ); ret.append( ", clientid=" + clientid ); ret.append( ", clientname=" + clientname ); ret.append( ", paybackact=" + paybackact ); ret.append( ", paybackactname=" + paybackactname ); ret.append( ", commname=" + commname ); ret.append( ", num=" + num ); ret.append( ", pc=" + pc ); ret.append( ", phone1=" + phone1 ); ret.append( ", phone2=" + phone2 ); ret.append( ", phone3=" + phone3 ); ret.append( ", appno=" + appno ); ret.append( ", withholdbankname=" + withholdbankname ); ret.append( ", commamt=" + commamt ); ret.append( ", receiveamt=" + receiveamt ); ret.append( ", appdate=" + appdate ); return ret.toString(); } }
16,649
0.599495
0.593069
858
17.404428
22.368826
131
false
false
0
0
0
0
0
0
1.472028
false
false
11
e8a38ddc6cd08c79f87f331cb42ea30861203f5d
38,311,108,304,464
e8e62c572f6162413d7ffa0aac40a324d7554a5a
/bookshop/bookshop/src/main/java/com/example/bookshop/mapper/UBMapper.java
b8e8a3015b3670606a361ba87032021adafc7c2a
[]
no_license
LeoHolmes416/Assignment1-ebook-store
https://github.com/LeoHolmes416/Assignment1-ebook-store
bcf0820250dcb41b93c97f2aaf37e7dcf7488916
6dfd316ca6cfc266d158339556327290d5271323
refs/heads/master
2023-06-03T21:58:25.719000
2021-06-24T16:12:07
2021-06-24T16:12:07
359,088,344
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.bookshop.mapper; import com.example.bookshop.entity.UB; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Select; public interface UBMapper { @Insert("insert into tb_user_book values(#{uid},#{bid})") public void insert(UB ub ); @Select("select count(1) from tb_user_book where uid = #{uid} and bid = #{bid}") int findDuplicate(UB ub); }
UTF-8
Java
408
java
UBMapper.java
Java
[]
null
[]
package com.example.bookshop.mapper; import com.example.bookshop.entity.UB; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Select; public interface UBMapper { @Insert("insert into tb_user_book values(#{uid},#{bid})") public void insert(UB ub ); @Select("select count(1) from tb_user_book where uid = #{uid} and bid = #{bid}") int findDuplicate(UB ub); }
408
0.715686
0.713235
14
28.214285
25.037624
84
false
false
0
0
0
0
0
0
0.5
false
false
11
d10894277fe66596c7611d3b2f26b9b4e7e258b9
36,344,013,296,332
cbb75ebbee3fb80a5e5ad842b7a4bb4a5a1ec5f5
/c/a/y.java
136bb6f6f9328484dff090df7a925a89f9d46a2f
[]
no_license
killbus/jd_decompile
https://github.com/killbus/jd_decompile
9cc676b4be9c0415b895e4c0cf1823e0a119dcef
50c521ce6a2c71c37696e5c131ec2e03661417cc
refs/heads/master
2022-01-13T03:27:02.492000
2018-05-14T11:21:30
2018-05-14T11:21:30
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package c.a; import java.io.Serializable; import java.util.ArrayList; import java.util.BitSet; import java.util.Collections; import java.util.EnumMap; import java.util.EnumSet; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; import jd.wjlogin_sdk.util.ReplyCode; /* compiled from: TbsSdkJava */ public class y implements av<y, e>, Serializable, Cloneable { public static final Map<e, be> d; private static final bu e = new bu("IdTracking"); private static final bl f = new bl("snapshots", ReplyCode.reply0xd, (short) 1); private static final bl g = new bl("journals", ReplyCode.reply0xf, (short) 2); private static final bl h = new bl("checksum", ReplyCode.reply0xb, (short) 3); private static final Map<Class<? extends bw>, bx> i = new HashMap(); public Map<String, x> a; public List<v> b; public String c; private e[] j; /* compiled from: TbsSdkJava */ private static class a extends by<y> { private a() { } public /* synthetic */ void a(bo boVar, av avVar) throws az { b(boVar, (y) avVar); } public /* synthetic */ void b(bo boVar, av avVar) throws az { a(boVar, (y) avVar); } public void a(bo boVar, y yVar) throws az { boVar.f(); while (true) { bl h = boVar.h(); if (h.b == (byte) 0) { boVar.g(); yVar.p(); return; } int i; switch (h.c) { case (short) 1: if (h.b != ReplyCode.reply0xd) { bs.a(boVar, h.b); break; } bn j = boVar.j(); yVar.a = new HashMap(j.c * 2); for (i = 0; i < j.c; i++) { String v = boVar.v(); x xVar = new x(); xVar.a(boVar); yVar.a.put(v, xVar); } boVar.k(); yVar.a(true); break; case (short) 2: if (h.b != ReplyCode.reply0xf) { bs.a(boVar, h.b); break; } bm l = boVar.l(); yVar.b = new ArrayList(l.b); for (i = 0; i < l.b; i++) { v vVar = new v(); vVar.a(boVar); yVar.b.add(vVar); } boVar.m(); yVar.b(true); break; case (short) 3: if (h.b != ReplyCode.reply0xb) { bs.a(boVar, h.b); break; } yVar.c = boVar.v(); yVar.c(true); break; default: bs.a(boVar, h.b); break; } boVar.i(); } } public void b(bo boVar, y yVar) throws az { yVar.p(); boVar.a(y.e); if (yVar.a != null) { boVar.a(y.f); boVar.a(new bn(ReplyCode.reply0xb, ReplyCode.reply0xc, yVar.a.size())); for (Entry entry : yVar.a.entrySet()) { boVar.a((String) entry.getKey()); ((x) entry.getValue()).b(boVar); } boVar.d(); boVar.b(); } if (yVar.b != null && yVar.l()) { boVar.a(y.g); boVar.a(new bm(ReplyCode.reply0xc, yVar.b.size())); for (v b : yVar.b) { b.b(boVar); } boVar.e(); boVar.b(); } if (yVar.c != null && yVar.o()) { boVar.a(y.h); boVar.a(yVar.c); boVar.b(); } boVar.c(); boVar.a(); } } /* compiled from: TbsSdkJava */ private static class b implements bx { private b() { } public /* synthetic */ bw b() { return a(); } public a a() { return new a(); } } /* compiled from: TbsSdkJava */ private static class c extends bz<y> { private c() { } public void a(bo boVar, y yVar) throws az { boVar = (bv) boVar; boVar.a(yVar.a.size()); for (Entry entry : yVar.a.entrySet()) { boVar.a((String) entry.getKey()); ((x) entry.getValue()).b(boVar); } BitSet bitSet = new BitSet(); if (yVar.l()) { bitSet.set(0); } if (yVar.o()) { bitSet.set(1); } boVar.a(bitSet, 2); if (yVar.l()) { boVar.a(yVar.b.size()); for (v b : yVar.b) { b.b(boVar); } } if (yVar.o()) { boVar.a(yVar.c); } } public void b(bo boVar, y yVar) throws az { int i = 0; boVar = (bv) boVar; bn bnVar = new bn(ReplyCode.reply0xb, ReplyCode.reply0xc, boVar.s()); yVar.a = new HashMap(bnVar.c * 2); for (int i2 = 0; i2 < bnVar.c; i2++) { String v = boVar.v(); x xVar = new x(); xVar.a(boVar); yVar.a.put(v, xVar); } yVar.a(true); BitSet b = boVar.b(2); if (b.get(0)) { bm bmVar = new bm(ReplyCode.reply0xc, boVar.s()); yVar.b = new ArrayList(bmVar.b); while (i < bmVar.b) { v vVar = new v(); vVar.a(boVar); yVar.b.add(vVar); i++; } yVar.b(true); } if (b.get(1)) { yVar.c = boVar.v(); yVar.c(true); } } } /* compiled from: TbsSdkJava */ private static class d implements bx { private d() { } public /* synthetic */ bw b() { return a(); } public c a() { return new c(); } } /* compiled from: TbsSdkJava */ public enum e implements ba { SNAPSHOTS((short) 1, "snapshots"), JOURNALS((short) 2, "journals"), CHECKSUM((short) 3, "checksum"); private static final Map<String, e> d = null; private final short e; private final String f; static { d = new HashMap(); Iterator it = EnumSet.allOf(e.class).iterator(); while (it.hasNext()) { e eVar = (e) it.next(); d.put(eVar.b(), eVar); } } public static e a(int i) { switch (i) { case 1: return SNAPSHOTS; case 2: return JOURNALS; case 3: return CHECKSUM; default: return null; } } public static e b(int i) { e a = a(i); if (a != null) { return a; } throw new IllegalArgumentException("Field " + i + " doesn't exist!"); } public static e a(String str) { return (e) d.get(str); } private e(short s, String str) { this.e = s; this.f = str; } public short a() { return this.e; } public String b() { return this.f; } } public /* synthetic */ ba b(int i) { return a(i); } public /* synthetic */ av g() { return a(); } static { i.put(by.class, new b()); i.put(bz.class, new d()); Map enumMap = new EnumMap(e.class); enumMap.put(e.SNAPSHOTS, new be("snapshots", (byte) 1, new bh(ReplyCode.reply0xd, new bf(ReplyCode.reply0xb), new bi(ReplyCode.reply0xc, x.class)))); enumMap.put(e.JOURNALS, new be("journals", (byte) 2, new bg(ReplyCode.reply0xf, new bi(ReplyCode.reply0xc, v.class)))); enumMap.put(e.CHECKSUM, new be("checksum", (byte) 2, new bf(ReplyCode.reply0xb))); d = Collections.unmodifiableMap(enumMap); be.a(y.class, d); } public y() { this.j = new e[]{e.JOURNALS, e.CHECKSUM}; } public y(Map<String, x> map) { this(); this.a = map; } public y(y yVar) { this.j = new e[]{e.JOURNALS, e.CHECKSUM}; if (yVar.f()) { Map hashMap = new HashMap(); for (Entry entry : yVar.a.entrySet()) { hashMap.put((String) entry.getKey(), new x((x) entry.getValue())); } this.a = hashMap; } if (yVar.l()) { List arrayList = new ArrayList(); for (v vVar : yVar.b) { arrayList.add(new v(vVar)); } this.b = arrayList; } if (yVar.o()) { this.c = yVar.c; } } public y a() { return new y(this); } public void b() { this.a = null; this.b = null; this.c = null; } public int c() { return this.a == null ? 0 : this.a.size(); } public void a(String str, x xVar) { if (this.a == null) { this.a = new HashMap(); } this.a.put(str, xVar); } public Map<String, x> d() { return this.a; } public y a(Map<String, x> map) { this.a = map; return this; } public void e() { this.a = null; } public boolean f() { return this.a != null; } public void a(boolean z) { if (!z) { this.a = null; } } public int h() { return this.b == null ? 0 : this.b.size(); } public Iterator<v> i() { return this.b == null ? null : this.b.iterator(); } public void a(v vVar) { if (this.b == null) { this.b = new ArrayList(); } this.b.add(vVar); } public List<v> j() { return this.b; } public y a(List<v> list) { this.b = list; return this; } public void k() { this.b = null; } public boolean l() { return this.b != null; } public void b(boolean z) { if (!z) { this.b = null; } } public String m() { return this.c; } public y a(String str) { this.c = str; return this; } public void n() { this.c = null; } public boolean o() { return this.c != null; } public void c(boolean z) { if (!z) { this.c = null; } } public e a(int i) { return e.a(i); } public void a(bo boVar) throws az { ((bx) i.get(boVar.y())).b().b(boVar, this); } public void b(bo boVar) throws az { ((bx) i.get(boVar.y())).b().a(boVar, this); } public String toString() { StringBuilder stringBuilder = new StringBuilder("IdTracking("); stringBuilder.append("snapshots:"); if (this.a == null) { stringBuilder.append("null"); } else { stringBuilder.append(this.a); } if (l()) { stringBuilder.append(", "); stringBuilder.append("journals:"); if (this.b == null) { stringBuilder.append("null"); } else { stringBuilder.append(this.b); } } if (o()) { stringBuilder.append(", "); stringBuilder.append("checksum:"); if (this.c == null) { stringBuilder.append("null"); } else { stringBuilder.append(this.c); } } stringBuilder.append(")"); return stringBuilder.toString(); } public void p() throws az { if (this.a == null) { throw new bp("Required field 'snapshots' was not present! Struct: " + toString()); } } }
UTF-8
Java
12,794
java
y.java
Java
[]
null
[]
package c.a; import java.io.Serializable; import java.util.ArrayList; import java.util.BitSet; import java.util.Collections; import java.util.EnumMap; import java.util.EnumSet; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; import jd.wjlogin_sdk.util.ReplyCode; /* compiled from: TbsSdkJava */ public class y implements av<y, e>, Serializable, Cloneable { public static final Map<e, be> d; private static final bu e = new bu("IdTracking"); private static final bl f = new bl("snapshots", ReplyCode.reply0xd, (short) 1); private static final bl g = new bl("journals", ReplyCode.reply0xf, (short) 2); private static final bl h = new bl("checksum", ReplyCode.reply0xb, (short) 3); private static final Map<Class<? extends bw>, bx> i = new HashMap(); public Map<String, x> a; public List<v> b; public String c; private e[] j; /* compiled from: TbsSdkJava */ private static class a extends by<y> { private a() { } public /* synthetic */ void a(bo boVar, av avVar) throws az { b(boVar, (y) avVar); } public /* synthetic */ void b(bo boVar, av avVar) throws az { a(boVar, (y) avVar); } public void a(bo boVar, y yVar) throws az { boVar.f(); while (true) { bl h = boVar.h(); if (h.b == (byte) 0) { boVar.g(); yVar.p(); return; } int i; switch (h.c) { case (short) 1: if (h.b != ReplyCode.reply0xd) { bs.a(boVar, h.b); break; } bn j = boVar.j(); yVar.a = new HashMap(j.c * 2); for (i = 0; i < j.c; i++) { String v = boVar.v(); x xVar = new x(); xVar.a(boVar); yVar.a.put(v, xVar); } boVar.k(); yVar.a(true); break; case (short) 2: if (h.b != ReplyCode.reply0xf) { bs.a(boVar, h.b); break; } bm l = boVar.l(); yVar.b = new ArrayList(l.b); for (i = 0; i < l.b; i++) { v vVar = new v(); vVar.a(boVar); yVar.b.add(vVar); } boVar.m(); yVar.b(true); break; case (short) 3: if (h.b != ReplyCode.reply0xb) { bs.a(boVar, h.b); break; } yVar.c = boVar.v(); yVar.c(true); break; default: bs.a(boVar, h.b); break; } boVar.i(); } } public void b(bo boVar, y yVar) throws az { yVar.p(); boVar.a(y.e); if (yVar.a != null) { boVar.a(y.f); boVar.a(new bn(ReplyCode.reply0xb, ReplyCode.reply0xc, yVar.a.size())); for (Entry entry : yVar.a.entrySet()) { boVar.a((String) entry.getKey()); ((x) entry.getValue()).b(boVar); } boVar.d(); boVar.b(); } if (yVar.b != null && yVar.l()) { boVar.a(y.g); boVar.a(new bm(ReplyCode.reply0xc, yVar.b.size())); for (v b : yVar.b) { b.b(boVar); } boVar.e(); boVar.b(); } if (yVar.c != null && yVar.o()) { boVar.a(y.h); boVar.a(yVar.c); boVar.b(); } boVar.c(); boVar.a(); } } /* compiled from: TbsSdkJava */ private static class b implements bx { private b() { } public /* synthetic */ bw b() { return a(); } public a a() { return new a(); } } /* compiled from: TbsSdkJava */ private static class c extends bz<y> { private c() { } public void a(bo boVar, y yVar) throws az { boVar = (bv) boVar; boVar.a(yVar.a.size()); for (Entry entry : yVar.a.entrySet()) { boVar.a((String) entry.getKey()); ((x) entry.getValue()).b(boVar); } BitSet bitSet = new BitSet(); if (yVar.l()) { bitSet.set(0); } if (yVar.o()) { bitSet.set(1); } boVar.a(bitSet, 2); if (yVar.l()) { boVar.a(yVar.b.size()); for (v b : yVar.b) { b.b(boVar); } } if (yVar.o()) { boVar.a(yVar.c); } } public void b(bo boVar, y yVar) throws az { int i = 0; boVar = (bv) boVar; bn bnVar = new bn(ReplyCode.reply0xb, ReplyCode.reply0xc, boVar.s()); yVar.a = new HashMap(bnVar.c * 2); for (int i2 = 0; i2 < bnVar.c; i2++) { String v = boVar.v(); x xVar = new x(); xVar.a(boVar); yVar.a.put(v, xVar); } yVar.a(true); BitSet b = boVar.b(2); if (b.get(0)) { bm bmVar = new bm(ReplyCode.reply0xc, boVar.s()); yVar.b = new ArrayList(bmVar.b); while (i < bmVar.b) { v vVar = new v(); vVar.a(boVar); yVar.b.add(vVar); i++; } yVar.b(true); } if (b.get(1)) { yVar.c = boVar.v(); yVar.c(true); } } } /* compiled from: TbsSdkJava */ private static class d implements bx { private d() { } public /* synthetic */ bw b() { return a(); } public c a() { return new c(); } } /* compiled from: TbsSdkJava */ public enum e implements ba { SNAPSHOTS((short) 1, "snapshots"), JOURNALS((short) 2, "journals"), CHECKSUM((short) 3, "checksum"); private static final Map<String, e> d = null; private final short e; private final String f; static { d = new HashMap(); Iterator it = EnumSet.allOf(e.class).iterator(); while (it.hasNext()) { e eVar = (e) it.next(); d.put(eVar.b(), eVar); } } public static e a(int i) { switch (i) { case 1: return SNAPSHOTS; case 2: return JOURNALS; case 3: return CHECKSUM; default: return null; } } public static e b(int i) { e a = a(i); if (a != null) { return a; } throw new IllegalArgumentException("Field " + i + " doesn't exist!"); } public static e a(String str) { return (e) d.get(str); } private e(short s, String str) { this.e = s; this.f = str; } public short a() { return this.e; } public String b() { return this.f; } } public /* synthetic */ ba b(int i) { return a(i); } public /* synthetic */ av g() { return a(); } static { i.put(by.class, new b()); i.put(bz.class, new d()); Map enumMap = new EnumMap(e.class); enumMap.put(e.SNAPSHOTS, new be("snapshots", (byte) 1, new bh(ReplyCode.reply0xd, new bf(ReplyCode.reply0xb), new bi(ReplyCode.reply0xc, x.class)))); enumMap.put(e.JOURNALS, new be("journals", (byte) 2, new bg(ReplyCode.reply0xf, new bi(ReplyCode.reply0xc, v.class)))); enumMap.put(e.CHECKSUM, new be("checksum", (byte) 2, new bf(ReplyCode.reply0xb))); d = Collections.unmodifiableMap(enumMap); be.a(y.class, d); } public y() { this.j = new e[]{e.JOURNALS, e.CHECKSUM}; } public y(Map<String, x> map) { this(); this.a = map; } public y(y yVar) { this.j = new e[]{e.JOURNALS, e.CHECKSUM}; if (yVar.f()) { Map hashMap = new HashMap(); for (Entry entry : yVar.a.entrySet()) { hashMap.put((String) entry.getKey(), new x((x) entry.getValue())); } this.a = hashMap; } if (yVar.l()) { List arrayList = new ArrayList(); for (v vVar : yVar.b) { arrayList.add(new v(vVar)); } this.b = arrayList; } if (yVar.o()) { this.c = yVar.c; } } public y a() { return new y(this); } public void b() { this.a = null; this.b = null; this.c = null; } public int c() { return this.a == null ? 0 : this.a.size(); } public void a(String str, x xVar) { if (this.a == null) { this.a = new HashMap(); } this.a.put(str, xVar); } public Map<String, x> d() { return this.a; } public y a(Map<String, x> map) { this.a = map; return this; } public void e() { this.a = null; } public boolean f() { return this.a != null; } public void a(boolean z) { if (!z) { this.a = null; } } public int h() { return this.b == null ? 0 : this.b.size(); } public Iterator<v> i() { return this.b == null ? null : this.b.iterator(); } public void a(v vVar) { if (this.b == null) { this.b = new ArrayList(); } this.b.add(vVar); } public List<v> j() { return this.b; } public y a(List<v> list) { this.b = list; return this; } public void k() { this.b = null; } public boolean l() { return this.b != null; } public void b(boolean z) { if (!z) { this.b = null; } } public String m() { return this.c; } public y a(String str) { this.c = str; return this; } public void n() { this.c = null; } public boolean o() { return this.c != null; } public void c(boolean z) { if (!z) { this.c = null; } } public e a(int i) { return e.a(i); } public void a(bo boVar) throws az { ((bx) i.get(boVar.y())).b().b(boVar, this); } public void b(bo boVar) throws az { ((bx) i.get(boVar.y())).b().a(boVar, this); } public String toString() { StringBuilder stringBuilder = new StringBuilder("IdTracking("); stringBuilder.append("snapshots:"); if (this.a == null) { stringBuilder.append("null"); } else { stringBuilder.append(this.a); } if (l()) { stringBuilder.append(", "); stringBuilder.append("journals:"); if (this.b == null) { stringBuilder.append("null"); } else { stringBuilder.append(this.b); } } if (o()) { stringBuilder.append(", "); stringBuilder.append("checksum:"); if (this.c == null) { stringBuilder.append("null"); } else { stringBuilder.append(this.c); } } stringBuilder.append(")"); return stringBuilder.toString(); } public void p() throws az { if (this.a == null) { throw new bp("Required field 'snapshots' was not present! Struct: " + toString()); } } }
12,794
0.406519
0.402532
481
25.598753
19.515417
157
false
false
0
0
0
0
0
0
0.573805
false
false
11
5a595cf08d223861b4f883204263326af144624e
1,451,698,950,010
27c485932f3d5d0c230c55522ac84a84567dbfa6
/service-provider/src/main/java/com/nagarro/serviceprovider/service/DirectOrderService.java
f41ed85a89d23c9756a5a91f8c958ba2bb2b5ef7
[]
no_license
surbhiagarwal98/UrbanClapApp
https://github.com/surbhiagarwal98/UrbanClapApp
64715dcba7930edf68a79bf49cb07479a9595581
f7462cabe3f59bc40ad3d456e793ecdf73617056
refs/heads/main
2023-04-29T14:45:56.835000
2021-05-11T05:14:50
2021-05-11T05:14:50
366,262,566
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.nagarro.serviceprovider.service; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.springframework.stereotype.Service; import com.nagarro.serviceprovider.model.OrderRequest; import com.nagarro.serviceprovider.model.ServiceProvider; /** * directs order request coming from admin * * @author surbhiagarwal * */ @Service public class DirectOrderService { List<ServiceProvider> serviceProviders = Arrays.asList(new ServiceProvider("shdjsd", "Abc", "Noida", 1, "+91 7983975574", "surbhiagarwal219@gmail.com", "Yes", null)); /** * adds new service providers * * @param serviceProvider */ public void addToList(ServiceProvider serviceProvider) { serviceProviders.add(serviceProvider); } /** * gets all service providers * * @return */ public List<ServiceProvider> getAllServiceProviders() { return serviceProviders; } /** * gets specified services providers to direct request to * * @param req * @return */ public List<ServiceProvider> getSpecifiedServiceProviders(OrderRequest req) { List<ServiceProvider> specifiedServiceProviders = new ArrayList<ServiceProvider>(); int serviceId = req.getorder().getRequestedServiceId(); for (ServiceProvider sp : serviceProviders) { if (sp.getServiceId() == serviceId) { specifiedServiceProviders.add(sp); } } return specifiedServiceProviders; } }
UTF-8
Java
1,409
java
DirectOrderService.java
Java
[ { "context": "cts order request coming from admin\n * \n * @author surbhiagarwal\n *\n */\n@Service\npublic class DirectOrderService {", "end": 360, "score": 0.9947152137756348, "start": 347, "tag": "USERNAME", "value": "surbhiagarwal" }, { "context": "shdjsd\", \"Abc\", \"Noida\", 1,\n\t\t\t\"+91 7983975574\", \"surbhiagarwal219@gmail.com\", \"Yes\", null));\n\n\t/**\n\t * adds new service provi", "end": 565, "score": 0.9999163746833801, "start": 539, "tag": "EMAIL", "value": "surbhiagarwal219@gmail.com" } ]
null
[]
package com.nagarro.serviceprovider.service; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.springframework.stereotype.Service; import com.nagarro.serviceprovider.model.OrderRequest; import com.nagarro.serviceprovider.model.ServiceProvider; /** * directs order request coming from admin * * @author surbhiagarwal * */ @Service public class DirectOrderService { List<ServiceProvider> serviceProviders = Arrays.asList(new ServiceProvider("shdjsd", "Abc", "Noida", 1, "+91 7983975574", "<EMAIL>", "Yes", null)); /** * adds new service providers * * @param serviceProvider */ public void addToList(ServiceProvider serviceProvider) { serviceProviders.add(serviceProvider); } /** * gets all service providers * * @return */ public List<ServiceProvider> getAllServiceProviders() { return serviceProviders; } /** * gets specified services providers to direct request to * * @param req * @return */ public List<ServiceProvider> getSpecifiedServiceProviders(OrderRequest req) { List<ServiceProvider> specifiedServiceProviders = new ArrayList<ServiceProvider>(); int serviceId = req.getorder().getRequestedServiceId(); for (ServiceProvider sp : serviceProviders) { if (sp.getServiceId() == serviceId) { specifiedServiceProviders.add(sp); } } return specifiedServiceProviders; } }
1,390
0.739532
0.728176
59
22.881355
25.324394
104
false
false
0
0
0
0
0
0
1.20339
false
false
11
8687c5bb04a18b498406c1268707eca802df8bb8
28,733,331,227,937
aaa4ec205e5edc369c621a21091b7de73e311589
/src/lostcities/HumanPlayer.java
ca32ca6af3f9f6a70f00335154ed6715df519ba0
[]
no_license
tomverran/javacards
https://github.com/tomverran/javacards
f787251874e06d6d21ecdfc714041b5888d0e9be
de0b1a3c133b32fd7f1117d5acc034b9e6c35b61
refs/heads/master
2020-11-26T19:31:39.312000
2012-05-06T11:16:27
2012-05-06T11:16:27
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package lostcities; import javacards.*; public class HumanPlayer extends Player { public HumanPlayer(String name) { super(name); } @Override public Deck getDeckToDrawFrom(GameState gamestate) { // TODO Get a user input and get the deck to draw from return null; } @Override public Pair<Card, Deck> chooseACardToPlay(GameState gameState) { // TODO Get user input to get the card to play and which deck to play on. return null; } }
UTF-8
Java
456
java
HumanPlayer.java
Java
[]
null
[]
package lostcities; import javacards.*; public class HumanPlayer extends Player { public HumanPlayer(String name) { super(name); } @Override public Deck getDeckToDrawFrom(GameState gamestate) { // TODO Get a user input and get the deck to draw from return null; } @Override public Pair<Card, Deck> chooseACardToPlay(GameState gameState) { // TODO Get user input to get the card to play and which deck to play on. return null; } }
456
0.725877
0.725877
24
18
22.520361
75
false
false
0
0
0
0
0
0
1.083333
false
false
11
611196d35a71c39bfe5e127ca47fcfcb2cdcb4a7
9,397,388,445,959
b26ab7f22c98b586c9c0e257d8de5ab53f9024c5
/app/src/main/java/com/example/mobile_contentsapp/Recipe/Retrofit/HeartFindPost.java
c9f995afdaca2e3a1e9e5beae09b3af38a95749c
[]
no_license
Armand-De/doppio-android
https://github.com/Armand-De/doppio-android
180b1f582e8af6047ec64bcd709e96f1d1d43ae2
2a95290f09199bd2b8d56ee8accc803486ad206e
refs/heads/master
2023-06-15T07:05:28.293000
2021-07-14T20:11:00
2021-07-14T20:11:00
368,235,255
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.mobile_contentsapp.Recipe.Retrofit; public class HeartFindPost { private boolean exist; public boolean isExist() { return exist; } public void setExist(boolean exist) { this.exist = exist; } }
UTF-8
Java
252
java
HeartFindPost.java
Java
[]
null
[]
package com.example.mobile_contentsapp.Recipe.Retrofit; public class HeartFindPost { private boolean exist; public boolean isExist() { return exist; } public void setExist(boolean exist) { this.exist = exist; } }
252
0.65873
0.65873
13
18.384615
17.305128
55
false
false
0
0
0
0
0
0
0.307692
false
false
11
32a5b5d7285dde0e4dc4bbb42ea26148d0cb644b
22,582,938,067,956
80d573b02239c01cfd94bb3ab25bfb89298b6176
/Consumer/src/main/java/mongoUI/MeteorMapper.java
5bfe2c26787b695413ee6a167dfb83f121997b76
[]
no_license
buegeleisen/dhbw_14sea_projekt
https://github.com/buegeleisen/dhbw_14sea_projekt
6163b970d3c70777d617d2655baae629bedc8e71
dedc3d68750decfabc1a1572aaeff31d2ce5b4d4
refs/heads/master
2020-09-16T14:37:01.460000
2016-11-21T02:03:35
2016-11-21T02:03:35
66,961,242
1
1
null
false
2016-11-21T01:43:31
2016-08-30T17:08:47
2016-11-21T01:34:25
2016-11-21T01:43:30
97,691
1
0
0
JavaScript
null
null
package mongoUI; import com.google.gson.Gson; import objects.KafkaMessage; import objects.LiveItem; import objects.Point; import objects.Product; import static java.awt.SystemColor.text; /** * Created by mrpon on 17.10.2016. */ public class MeteorMapper { private MeteorMongoConnector meteorMongoConnector; private Gson gson = new Gson(); public MeteorMapper(){ //init Connector with standard ip and port meteorMongoConnector = new MeteorMongoConnector(); } public void map(KafkaMessage message) { if (!message.getValue().toString().equals("true") && !message.getValue().toString().equals("false")) { String itemName = message.getItemName(); String timeStamp=message.getTimestamp().toString(); String shorter=timeStamp.substring(timeStamp.length()-7, timeStamp.length()-1); System.out.println("Gekürzter TimeStamp :"+shorter); //Insert a simple xy point into DB Point point = new Point(Double.parseDouble(shorter), Double.parseDouble(message.getValue())); String json = gson.toJson(point); if (itemName.equals("MILLING_SPEED")) { meteorMongoConnector.insertJSON(json, "millingspeeddata"); System.out.println("DB - millingspeeddata: "+ json); } else if (itemName.equals("MILLING_HEAT")) { meteorMongoConnector.insertJSON(json, "millingheatdata"); System.out.println("DB - millingheatdata: "+ json); } else if (itemName.equals("DRILLING_SPEED")) { meteorMongoConnector.insertJSON(json, "drillingspeeddata"); System.out.println("DB - drillingspeeddata: "+ json); } else if (itemName.equals("DRILLING_HEAT")) { meteorMongoConnector.insertJSON(json, "drillingheatdata"); System.out.println("DB - drillingheatdata: "+ json); } } } public void sendStatus(KafkaMessage message){ if(message.getValue().toString().equals("true")){ String itemName=message.getItemName(); LiveItem liveItem=new LiveItem(itemName); String json=gson.toJson(liveItem); meteorMongoConnector.insertJSON(json, "machinestatus"); System.out.println("DB - machinestatus: "+ json); } } public void sendProduct(Product product){ String json=gson.toJson(product); meteorMongoConnector.insertJSON(json, "productData"); System.out.println("DB - products: "+ json); } }
UTF-8
Java
2,580
java
MeteorMapper.java
Java
[ { "context": "atic java.awt.SystemColor.text;\n\n/**\n * Created by mrpon on 17.10.2016.\n */\npublic class MeteorMapper {\n ", "end": 213, "score": 0.999647319316864, "start": 208, "tag": "USERNAME", "value": "mrpon" } ]
null
[]
package mongoUI; import com.google.gson.Gson; import objects.KafkaMessage; import objects.LiveItem; import objects.Point; import objects.Product; import static java.awt.SystemColor.text; /** * Created by mrpon on 17.10.2016. */ public class MeteorMapper { private MeteorMongoConnector meteorMongoConnector; private Gson gson = new Gson(); public MeteorMapper(){ //init Connector with standard ip and port meteorMongoConnector = new MeteorMongoConnector(); } public void map(KafkaMessage message) { if (!message.getValue().toString().equals("true") && !message.getValue().toString().equals("false")) { String itemName = message.getItemName(); String timeStamp=message.getTimestamp().toString(); String shorter=timeStamp.substring(timeStamp.length()-7, timeStamp.length()-1); System.out.println("Gekürzter TimeStamp :"+shorter); //Insert a simple xy point into DB Point point = new Point(Double.parseDouble(shorter), Double.parseDouble(message.getValue())); String json = gson.toJson(point); if (itemName.equals("MILLING_SPEED")) { meteorMongoConnector.insertJSON(json, "millingspeeddata"); System.out.println("DB - millingspeeddata: "+ json); } else if (itemName.equals("MILLING_HEAT")) { meteorMongoConnector.insertJSON(json, "millingheatdata"); System.out.println("DB - millingheatdata: "+ json); } else if (itemName.equals("DRILLING_SPEED")) { meteorMongoConnector.insertJSON(json, "drillingspeeddata"); System.out.println("DB - drillingspeeddata: "+ json); } else if (itemName.equals("DRILLING_HEAT")) { meteorMongoConnector.insertJSON(json, "drillingheatdata"); System.out.println("DB - drillingheatdata: "+ json); } } } public void sendStatus(KafkaMessage message){ if(message.getValue().toString().equals("true")){ String itemName=message.getItemName(); LiveItem liveItem=new LiveItem(itemName); String json=gson.toJson(liveItem); meteorMongoConnector.insertJSON(json, "machinestatus"); System.out.println("DB - machinestatus: "+ json); } } public void sendProduct(Product product){ String json=gson.toJson(product); meteorMongoConnector.insertJSON(json, "productData"); System.out.println("DB - products: "+ json); } }
2,580
0.633579
0.629701
63
39.936508
28.224089
110
false
false
0
0
0
0
0
0
0.634921
false
false
11
ff2149dc0ca21c3da2eaf7da9af2356ec07c6da5
16,982,300,698,642
6b5ec0c0e2aa10423e7f1062d7ae79c5ec937b21
/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/logic/timing/results/RevealCardFromTopOfDeckResult.java
7b1dc02b4b4a3829c0ecd97e6ffef65ed3f65179
[]
no_license
MarcinSc/gemp-lotr
https://github.com/MarcinSc/gemp-lotr
84ff73746fcad66a881bfaa28fa248927f743246
500675c7826dd1397e431d6068ca2c8c065b89ff
refs/heads/master
2021-07-08T20:48:26.354000
2021-04-21T17:58:29
2021-04-21T17:58:29
32,196,470
10
16
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.gempukku.lotro.logic.timing.results; import com.gempukku.lotro.game.PhysicalCard; import com.gempukku.lotro.logic.timing.EffectResult; import java.util.Collection; public class RevealCardFromTopOfDeckResult extends EffectResult { private String _playerId; private PhysicalCard _revealedCard; public RevealCardFromTopOfDeckResult(String playerId, PhysicalCard revealedCard) { super(Type.FOR_EACH_REVEALED_FROM_TOP_OF_DECK); _playerId = playerId; _revealedCard = revealedCard; } public String getPlayerId() { return _playerId; } public PhysicalCard getRevealedCard() { return _revealedCard; } }
UTF-8
Java
683
java
RevealCardFromTopOfDeckResult.java
Java
[]
null
[]
package com.gempukku.lotro.logic.timing.results; import com.gempukku.lotro.game.PhysicalCard; import com.gempukku.lotro.logic.timing.EffectResult; import java.util.Collection; public class RevealCardFromTopOfDeckResult extends EffectResult { private String _playerId; private PhysicalCard _revealedCard; public RevealCardFromTopOfDeckResult(String playerId, PhysicalCard revealedCard) { super(Type.FOR_EACH_REVEALED_FROM_TOP_OF_DECK); _playerId = playerId; _revealedCard = revealedCard; } public String getPlayerId() { return _playerId; } public PhysicalCard getRevealedCard() { return _revealedCard; } }
683
0.727672
0.727672
25
26.32
23.75495
86
false
false
0
0
0
0
0
0
0.48
false
false
11
92b4669346443e8e7a26e850d6bb5cede65addae
28,269,474,800,598
bc169c69a73991b469f2959dab52c02f7ae918dd
/src/main/java/br/util/ZipUtil.java
432936abee47542df129792b7ad824b00193667e
[]
no_license
daniel-tavares/envio-email
https://github.com/daniel-tavares/envio-email
9abb4ff1dce859dbb0f4c4d1d2571dfa74e716ae
d487ebc0a3c1c08f74d9b11b70b6d5741eff1f86
refs/heads/master
2021-06-23T15:46:22.583000
2017-08-29T02:39:46
2017-08-29T02:39:46
100,606,286
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.util; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; public class ZipUtil { private static final int BUFFER = 2048; public static byte[] getArquivoDescompactado(byte[] arquivo) { try { ByteArrayOutputStream bout=new ByteArrayOutputStream(); ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream(arquivo)); ZipEntry entry; while ((entry = zis.getNextEntry()) != null) { System.out.println("Extraindo o arquivo: " + entry); int count; byte data[] = new byte[BUFFER]; while ((count = zis.read(data, 0, BUFFER)) != -1) { bout.write(data, 0, count); } bout.flush(); bout.close(); } zis.close(); return bout.toByteArray(); } catch (Exception e) { e.printStackTrace(); } return null; } }
UTF-8
Java
892
java
ZipUtil.java
Java
[]
null
[]
package br.util; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; public class ZipUtil { private static final int BUFFER = 2048; public static byte[] getArquivoDescompactado(byte[] arquivo) { try { ByteArrayOutputStream bout=new ByteArrayOutputStream(); ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream(arquivo)); ZipEntry entry; while ((entry = zis.getNextEntry()) != null) { System.out.println("Extraindo o arquivo: " + entry); int count; byte data[] = new byte[BUFFER]; while ((count = zis.read(data, 0, BUFFER)) != -1) { bout.write(data, 0, count); } bout.flush(); bout.close(); } zis.close(); return bout.toByteArray(); } catch (Exception e) { e.printStackTrace(); } return null; } }
892
0.665919
0.658072
39
21.897436
20.503653
78
false
false
0
0
0
0
0
0
2.641026
false
false
11
0963ae3a4c2dcbc633d3423600fffb3bf7be5784
7,584,912,288,944
9f7b1bfb311f9d8bfa7bccc98fbdda1c3cbb7bda
/src/main/java/sword2offer/NO_55.java
3f72f7d733c146008d43737b1abd815a61d2d5a3
[]
no_license
jiaohanhan/Leetcode
https://github.com/jiaohanhan/Leetcode
3a46214a2cc93a73d6f98b76f197584597b71f00
adcc20424c6fe16a44b0caa5955f0836b47406b8
refs/heads/master
2020-06-11T08:25:18.948000
2019-10-19T15:22:00
2019-10-19T15:22:00
193,901,699
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package sword2offer; /** * 删除链表中的重复节点 * 题目描述;在一个排序链表中,存在重复的结点,请删除该链表中重复的结点,重复的结点不保留,返回链表头指针。 * 1->2->3->3->4 1->2->4 */ public class NO_55 { /** * 递归 */ public ListNode deleteDuplication(ListNode pHead){ if (pHead == null || pHead.next == null) return pHead; if (pHead.val == pHead.next.val){ ListNode pNode = pHead.next; while (pNode != null && pNode.val == pHead.val) { // 跳过值与当前结点相同的全部结点,找到第一个与当前结点不同的结点 pNode = pNode.next; } return deleteDuplication(pNode); }else { // 当前结点不是重复结点 pHead.next = deleteDuplication(pHead.next); return pHead; } } private ListNode delete(ListNode pHead) { ListNode dummy = new ListNode(0); dummy.next = pHead; ListNode p = pHead; ListNode last = dummy; while (p != null && p.next != null) { if (p.val == p.next.val) { int val = p.val; while (p != null && p.val == val) { p= p.next; } last.next = p; }else { last = p; p = p.next; } } return dummy.next; } static class ListNode{ int val; ListNode next; public ListNode(int val){this.val = val;} } }
UTF-8
Java
1,625
java
NO_55.java
Java
[]
null
[]
package sword2offer; /** * 删除链表中的重复节点 * 题目描述;在一个排序链表中,存在重复的结点,请删除该链表中重复的结点,重复的结点不保留,返回链表头指针。 * 1->2->3->3->4 1->2->4 */ public class NO_55 { /** * 递归 */ public ListNode deleteDuplication(ListNode pHead){ if (pHead == null || pHead.next == null) return pHead; if (pHead.val == pHead.next.val){ ListNode pNode = pHead.next; while (pNode != null && pNode.val == pHead.val) { // 跳过值与当前结点相同的全部结点,找到第一个与当前结点不同的结点 pNode = pNode.next; } return deleteDuplication(pNode); }else { // 当前结点不是重复结点 pHead.next = deleteDuplication(pHead.next); return pHead; } } private ListNode delete(ListNode pHead) { ListNode dummy = new ListNode(0); dummy.next = pHead; ListNode p = pHead; ListNode last = dummy; while (p != null && p.next != null) { if (p.val == p.next.val) { int val = p.val; while (p != null && p.val == val) { p= p.next; } last.next = p; }else { last = p; p = p.next; } } return dummy.next; } static class ListNode{ int val; ListNode next; public ListNode(int val){this.val = val;} } }
1,625
0.466431
0.457951
54
25.203703
17.742374
62
false
false
0
0
0
0
0
0
0.407407
false
false
11
b73e420099a83910e454c4d4c353acf2da913e6f
35,656,818,501,607
324c34b6359ec1626867645dc5b7f906036f98ac
/Evolution/src/main/java/com/lasgis/evolution/object/animal/organs/FoodIndex.java
8ce7511e4282699c0eaef827a27f87308875406e
[]
no_license
LasGIS/LGEvolution
https://github.com/LasGIS/LGEvolution
5ecca42a825130ac2b5e314667644c0a44eeb115
8b41aa823abd315057c06e0318934434b3e9ba08
refs/heads/master
2021-06-09T20:58:30.911000
2021-01-15T15:50:45
2021-01-15T15:50:45
160,509,791
0
0
null
false
2021-06-07T18:17:32
2018-12-05T11:43:08
2021-01-15T15:51:03
2021-06-07T18:17:31
19,171
0
0
3
Java
false
false
/** * @(#)FoodIndex.java 1.0 * * Title: LG Evolution powered by Java * Description: Program for imitation of evolutions process. * Copyright (c) 2012-2013 LasGIS Company. All Rights Reserved. */ package com.lasgis.evolution.object.animal.organs; /** * Пара ключ - индекс. * @author vladimir.laskin * @version 1.0 */ public class FoodIndex { private String bestKey = null; private double bestIndex = -10000.0; private double value = 0.0; public String getBestKey() { return bestKey; } public void setBestKey(String bestKey) { this.bestKey = bestKey; } public double getBestIndex() { return bestIndex; } public void setBestIndex(double bestIndex) { this.bestIndex = bestIndex; } public double getValue() { return value; } public void setValue(double value) { this.value = value; } }
UTF-8
Java
921
java
FoodIndex.java
Java
[ { "context": "mal.organs;\n\n/**\n * Пара ключ - индекс.\n * @author vladimir.laskin\n * @version 1.0\n */\npublic class FoodIndex {\n\n ", "end": 307, "score": 0.9875836372375488, "start": 292, "tag": "NAME", "value": "vladimir.laskin" } ]
null
[]
/** * @(#)FoodIndex.java 1.0 * * Title: LG Evolution powered by Java * Description: Program for imitation of evolutions process. * Copyright (c) 2012-2013 LasGIS Company. All Rights Reserved. */ package com.lasgis.evolution.object.animal.organs; /** * Пара ключ - индекс. * @author vladimir.laskin * @version 1.0 */ public class FoodIndex { private String bestKey = null; private double bestIndex = -10000.0; private double value = 0.0; public String getBestKey() { return bestKey; } public void setBestKey(String bestKey) { this.bestKey = bestKey; } public double getBestIndex() { return bestIndex; } public void setBestIndex(double bestIndex) { this.bestIndex = bestIndex; } public double getValue() { return value; } public void setValue(double value) { this.value = value; } }
921
0.636163
0.614112
45
19.177778
18.188261
63
false
false
0
0
0
0
0
0
0.222222
false
false
11
3de358055f0d0f950c15c0a58f054a67dfa7ff33
35,656,818,499,293
7491346a64b4ffd4cf8345aad3bc1125fb2c7e3f
/src/main/java/edu/gdpu/bookshop/service/OrderService.java
6dd0bb0834cd4a25060ff8d90d707e183a09f645
[]
no_license
MSJeinlong/Bookshop
https://github.com/MSJeinlong/Bookshop
7444758765c4c16034f7a8edd3c63ed068851e95
c6db3b21ddb89d568c2e5a0366bac6d4cb791fdd
refs/heads/master
2020-12-04T22:47:50.968000
2020-01-20T17:18:49
2020-01-20T17:18:49
231,926,362
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.gdpu.bookshop.service; import com.github.pagehelper.PageHelper; import edu.gdpu.bookshop.entity.OrderDetail; import edu.gdpu.bookshop.entity.OrderDetailExample; import edu.gdpu.bookshop.entity.OrderMaster; import edu.gdpu.bookshop.entity.OrderMasterExample; import edu.gdpu.bookshop.mapper.OrderDetailMapper; import edu.gdpu.bookshop.mapper.OrderMasterMapper; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; @Service public class OrderService { @Resource private OrderMasterMapper orderMasterMapper; @Resource private OrderDetailMapper orderDetailMapper; //获取所有的订单数据 public List<OrderMaster> findAllOrder(){ return orderMasterMapper.selectByExample(new OrderMasterExample()); } //保存新的 OrderMaster 到 数据库 public void addOrderMaster(OrderMaster orderMaster){ orderMasterMapper.insert(orderMaster); } //保存 orderDetailList 到数据库 public void addOrderDetailList(List<OrderDetail> orderDetailList){ for (OrderDetail orderDetail: orderDetailList) { orderDetailMapper.insert(orderDetail); } } //更新OrderMaster 的状态 public void updateOrderMaster(OrderMaster orderMaster){ orderMasterMapper.updateByPrimaryKey(orderMaster); } //根据userId 读出 OrderMasterList public List<OrderMaster> findOrderMasterByUserId(Integer userId){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andUserIdEqualTo(userId); return orderMasterMapper.selectByExample(orderMasterExample); } //统计待付款的订单数 public long countAllOrder(Integer userId){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andUserIdEqualTo(userId); return orderMasterMapper.countByExample(orderMasterExample); } //统计待付款的订单数 public long countUnpaidOrder(Integer userId){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andUserIdEqualTo(userId); criteria.andOrderStatusEqualTo((byte)0); return orderMasterMapper.countByExample(orderMasterExample); } //统计待发货的订单数 public long countUnDelivery(Integer userId){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andUserIdEqualTo(userId); criteria.andOrderStatusEqualTo((byte)1); return orderMasterMapper.countByExample(orderMasterExample); } //统计待收货的订单数 public long countUnreceived(Integer userId){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andUserIdEqualTo(userId); criteria.andOrderStatusEqualTo((byte)2); return orderMasterMapper.countByExample(orderMasterExample); } //统计待评价(已收货)的订单数 public long countReceived(Integer userId){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andUserIdEqualTo(userId); criteria.andOrderStatusEqualTo((byte)3); return orderMasterMapper.countByExample(orderMasterExample); } /*根据订单号读出订单详情*/ public List<OrderDetail> findOrderDetailByOrderId(String orderId){ OrderDetailExample orderDetailExample = new OrderDetailExample(); OrderDetailExample.Criteria criteria = orderDetailExample.createCriteria(); criteria.andOrderIdEqualTo(orderId); return orderDetailMapper.selectByExample(orderDetailExample); } /*根据orderId 读出 orderMaster*/ public OrderMaster findOrderMasterByOrderId(String orderId){ return orderMasterMapper.selectByPrimaryKey(orderId); } /*根据orderExample读出orderMasterList*/ public List<OrderMaster> findOrderByExample(OrderMasterExample orderMasterExample){ return orderMasterMapper.selectByExample(orderMasterExample); } /* 查询未付款的订单*/ public List<OrderMaster> findOrderUnpaid(String userName, String orderId, Integer pageNum){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andOrderStatusEqualTo((byte)0); criteria.andUserNameLike("%"+userName+"%"); criteria.andOrderIdLike("%"+orderId+"%"); PageHelper.startPage(pageNum, 10); return orderMasterMapper.selectByExample(orderMasterExample); } /*查询未发货的订单*/ public List<OrderMaster> findOrderUnDelivery(String userName, String orderId, Integer pageNum){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andOrderStatusEqualTo((byte)1); criteria.andUserNameLike("%"+userName+"%"); criteria.andOrderIdLike("%"+orderId+"%"); PageHelper.startPage(pageNum, 10); return orderMasterMapper.selectByExample(orderMasterExample); } /*查询未收货的订单*/ public List<OrderMaster> findOrderUnReceived(String userName, String orderId, Integer pageNum){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andOrderStatusEqualTo((byte)2); criteria.andUserNameLike("%"+userName+"%"); criteria.andOrderIdLike("%"+orderId+"%"); PageHelper.startPage(pageNum, 10); return orderMasterMapper.selectByExample(orderMasterExample); } /*根据userName 和 orderId 查询订单*/ public List<OrderMaster> findByUnameOrderId(String userName, String orderId, Integer pageNum){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andUserNameLike("%"+userName+"%"); criteria.andOrderIdLike("%"+orderId+"%"); PageHelper.startPage(pageNum, 10); return orderMasterMapper.selectByExample(orderMasterExample); } public List<OrderMaster> findOrderByTime(String userName, String orderId, Integer pageNum){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andUserNameLike("%"+userName+"%"); criteria.andOrderIdLike("%"+orderId+"%"); PageHelper.startPage(pageNum, 10, "create_time desc"); List<OrderMaster> orderMasterList = orderMasterMapper.selectByExample(orderMasterExample); System.out.println("orderMasterList:********** size="+orderMasterList.size()); return orderMasterList; //return orderMasterList.stream().sorted(Comparator.comparing(OrderMaster::getCreateTime).reversed()).collect(Collectors.toList()); } }
UTF-8
Java
7,530
java
OrderService.java
Java
[ { "context": " public List<OrderMaster> findOrderUnpaid(String userName, String orderId, Integer pageNum){\n OrderM", "end": 4414, "score": 0.7042350769042969, "start": 4406, "tag": "USERNAME", "value": "userName" } ]
null
[]
package edu.gdpu.bookshop.service; import com.github.pagehelper.PageHelper; import edu.gdpu.bookshop.entity.OrderDetail; import edu.gdpu.bookshop.entity.OrderDetailExample; import edu.gdpu.bookshop.entity.OrderMaster; import edu.gdpu.bookshop.entity.OrderMasterExample; import edu.gdpu.bookshop.mapper.OrderDetailMapper; import edu.gdpu.bookshop.mapper.OrderMasterMapper; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; @Service public class OrderService { @Resource private OrderMasterMapper orderMasterMapper; @Resource private OrderDetailMapper orderDetailMapper; //获取所有的订单数据 public List<OrderMaster> findAllOrder(){ return orderMasterMapper.selectByExample(new OrderMasterExample()); } //保存新的 OrderMaster 到 数据库 public void addOrderMaster(OrderMaster orderMaster){ orderMasterMapper.insert(orderMaster); } //保存 orderDetailList 到数据库 public void addOrderDetailList(List<OrderDetail> orderDetailList){ for (OrderDetail orderDetail: orderDetailList) { orderDetailMapper.insert(orderDetail); } } //更新OrderMaster 的状态 public void updateOrderMaster(OrderMaster orderMaster){ orderMasterMapper.updateByPrimaryKey(orderMaster); } //根据userId 读出 OrderMasterList public List<OrderMaster> findOrderMasterByUserId(Integer userId){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andUserIdEqualTo(userId); return orderMasterMapper.selectByExample(orderMasterExample); } //统计待付款的订单数 public long countAllOrder(Integer userId){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andUserIdEqualTo(userId); return orderMasterMapper.countByExample(orderMasterExample); } //统计待付款的订单数 public long countUnpaidOrder(Integer userId){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andUserIdEqualTo(userId); criteria.andOrderStatusEqualTo((byte)0); return orderMasterMapper.countByExample(orderMasterExample); } //统计待发货的订单数 public long countUnDelivery(Integer userId){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andUserIdEqualTo(userId); criteria.andOrderStatusEqualTo((byte)1); return orderMasterMapper.countByExample(orderMasterExample); } //统计待收货的订单数 public long countUnreceived(Integer userId){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andUserIdEqualTo(userId); criteria.andOrderStatusEqualTo((byte)2); return orderMasterMapper.countByExample(orderMasterExample); } //统计待评价(已收货)的订单数 public long countReceived(Integer userId){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andUserIdEqualTo(userId); criteria.andOrderStatusEqualTo((byte)3); return orderMasterMapper.countByExample(orderMasterExample); } /*根据订单号读出订单详情*/ public List<OrderDetail> findOrderDetailByOrderId(String orderId){ OrderDetailExample orderDetailExample = new OrderDetailExample(); OrderDetailExample.Criteria criteria = orderDetailExample.createCriteria(); criteria.andOrderIdEqualTo(orderId); return orderDetailMapper.selectByExample(orderDetailExample); } /*根据orderId 读出 orderMaster*/ public OrderMaster findOrderMasterByOrderId(String orderId){ return orderMasterMapper.selectByPrimaryKey(orderId); } /*根据orderExample读出orderMasterList*/ public List<OrderMaster> findOrderByExample(OrderMasterExample orderMasterExample){ return orderMasterMapper.selectByExample(orderMasterExample); } /* 查询未付款的订单*/ public List<OrderMaster> findOrderUnpaid(String userName, String orderId, Integer pageNum){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andOrderStatusEqualTo((byte)0); criteria.andUserNameLike("%"+userName+"%"); criteria.andOrderIdLike("%"+orderId+"%"); PageHelper.startPage(pageNum, 10); return orderMasterMapper.selectByExample(orderMasterExample); } /*查询未发货的订单*/ public List<OrderMaster> findOrderUnDelivery(String userName, String orderId, Integer pageNum){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andOrderStatusEqualTo((byte)1); criteria.andUserNameLike("%"+userName+"%"); criteria.andOrderIdLike("%"+orderId+"%"); PageHelper.startPage(pageNum, 10); return orderMasterMapper.selectByExample(orderMasterExample); } /*查询未收货的订单*/ public List<OrderMaster> findOrderUnReceived(String userName, String orderId, Integer pageNum){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andOrderStatusEqualTo((byte)2); criteria.andUserNameLike("%"+userName+"%"); criteria.andOrderIdLike("%"+orderId+"%"); PageHelper.startPage(pageNum, 10); return orderMasterMapper.selectByExample(orderMasterExample); } /*根据userName 和 orderId 查询订单*/ public List<OrderMaster> findByUnameOrderId(String userName, String orderId, Integer pageNum){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andUserNameLike("%"+userName+"%"); criteria.andOrderIdLike("%"+orderId+"%"); PageHelper.startPage(pageNum, 10); return orderMasterMapper.selectByExample(orderMasterExample); } public List<OrderMaster> findOrderByTime(String userName, String orderId, Integer pageNum){ OrderMasterExample orderMasterExample = new OrderMasterExample(); OrderMasterExample.Criteria criteria = orderMasterExample.createCriteria(); criteria.andUserNameLike("%"+userName+"%"); criteria.andOrderIdLike("%"+orderId+"%"); PageHelper.startPage(pageNum, 10, "create_time desc"); List<OrderMaster> orderMasterList = orderMasterMapper.selectByExample(orderMasterExample); System.out.println("orderMasterList:********** size="+orderMasterList.size()); return orderMasterList; //return orderMasterList.stream().sorted(Comparator.comparing(OrderMaster::getCreateTime).reversed()).collect(Collectors.toList()); } }
7,530
0.737964
0.735626
170
41.764706
30.527191
139
false
false
0
0
0
0
0
0
0.605882
false
false
11
c50aee8a9edc41a688c5740218e30dec80fd07e1
23,768,349,063,066
e35eea44e419c423780f212b49a6139779a0176f
/itheima/12_FunctionalInterface/src/com/shuaibo/demo03LambdaTest/Demo02Comparator.java
95f01b68367ed7f87b0f6b536b9e3cb5b3c932eb
[]
no_license
kangshuaibo/My-Java-Learn
https://github.com/kangshuaibo/My-Java-Learn
f9d24ef92525b6cea366e8ea4da16eb668f39348
4952515c17bcedf0b4388295894d78cd0abb335a
refs/heads/master
2022-07-16T10:02:39.855000
2020-08-18T07:51:52
2020-08-18T07:51:52
163,481,584
0
0
null
false
2022-06-21T04:02:06
2018-12-29T06:07:46
2020-08-18T07:58:33
2022-06-21T04:02:05
157,606
0
0
17
Java
false
false
package com.shuaibo.demo03LambdaTest; import java.sql.SQLOutput; import java.util.Arrays; import java.util.Comparator; /* 类似地,如果一个方法的返回值类型是一个函数式接口,那么就可以直接返回一个Lambda表达式。 当需要通过一个方法来获取一个java.util.Comparator 接口类型的对象作为排序器时,就可以调该方法获取。 */ public class Demo02Comparator { //定义一个方法, 方法的返回值类型使用函数式接口Comparator public static Comparator<String> getComparator(){ //方法的返回值类型是一个接口,那么我们可以返回这个接口的匿名内部类 /* return new Comparator<String>() { @Override public int compare(String o1, String o2) { //按照字符串的降序排列 return o2.length() - o1.length(); } };*/ //方法的返回值类型是一个函数式接口,所以我们可以返回一个Lambda表达式 /* return (String o1, String o2)->{ //按照字符串的降序排列 return o2.length() - o1.length(); }; */ //继续优化lambda表达式 return (String o1, String o2)-> o2.length() - o1.length(); } public static void main(String[] args) { //创建一个字符串数组 String[] arr = {"aaa","b","cccccc","dddddddddddddd"}; //输出排序前的数组 System.out.println(Arrays.toString(arr)); //[aaa, b, cccccc, dddddddddddddd] //调用Arrays中的sort方法,对字符串数组进行排序 Arrays.sort(arr,getComparator()); //输出排序后的数组 System.out.println(Arrays.toString(arr)); //[dddddddddddddd, cccccc, aaa, b] } }
UTF-8
Java
1,805
java
Demo02Comparator.java
Java
[]
null
[]
package com.shuaibo.demo03LambdaTest; import java.sql.SQLOutput; import java.util.Arrays; import java.util.Comparator; /* 类似地,如果一个方法的返回值类型是一个函数式接口,那么就可以直接返回一个Lambda表达式。 当需要通过一个方法来获取一个java.util.Comparator 接口类型的对象作为排序器时,就可以调该方法获取。 */ public class Demo02Comparator { //定义一个方法, 方法的返回值类型使用函数式接口Comparator public static Comparator<String> getComparator(){ //方法的返回值类型是一个接口,那么我们可以返回这个接口的匿名内部类 /* return new Comparator<String>() { @Override public int compare(String o1, String o2) { //按照字符串的降序排列 return o2.length() - o1.length(); } };*/ //方法的返回值类型是一个函数式接口,所以我们可以返回一个Lambda表达式 /* return (String o1, String o2)->{ //按照字符串的降序排列 return o2.length() - o1.length(); }; */ //继续优化lambda表达式 return (String o1, String o2)-> o2.length() - o1.length(); } public static void main(String[] args) { //创建一个字符串数组 String[] arr = {"aaa","b","cccccc","dddddddddddddd"}; //输出排序前的数组 System.out.println(Arrays.toString(arr)); //[aaa, b, cccccc, dddddddddddddd] //调用Arrays中的sort方法,对字符串数组进行排序 Arrays.sort(arr,getComparator()); //输出排序后的数组 System.out.println(Arrays.toString(arr)); //[dddddddddddddd, cccccc, aaa, b] } }
1,805
0.607435
0.595539
45
28.888889
23.051847
86
false
false
0
0
0
0
0
0
0.6
false
false
11
e6a69738409372e909df4ee8b725b58250545c5d
20,521,353,799,833
ba539768d92aeeebbba5c0d6678b42c27993ad50
/app/src/main/java/hk/idv/elton/cuwaveautologin/ShortcutActivity.java
d32bee409b491315b3acde07b37ef6c25ea44cc9
[ "BSD-2-Clause" ]
permissive
quakelton/CUWave-autologin
https://github.com/quakelton/CUWave-autologin
24ffecfc6f82dcaee2963a981191a2ec4b96ff7c
b83e3f0646cc4013eb49aae5b4dec30f9a993c96
refs/heads/master
2021-01-22T16:25:06.573000
2017-03-12T12:19:14
2017-03-12T12:19:14
55,112,167
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package hk.idv.elton.cuwaveautologin; import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.Bundle; public class ShortcutActivity extends Activity { public static final String SHORTCUT_INTENT = "hk.idv.elton.cuwaveautologin.SHORTCUT"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); boolean isLogout = getIntent().getBooleanExtra(LoginRoute.EXTRA_LOGOUT, false); Utils.checkWifiAndDoLogin(this, isLogout); finish(); } public static class CreateLoginShortcut extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setResult(RESULT_OK, createShortcutIntent(this, false)); finish(); } } public static class CreateLogoutShortcut extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setResult(RESULT_OK, createShortcutIntent(this, true)); finish(); } } private static Intent createShortcutIntent(Context context, boolean isLogout) { Intent shortcutIntent = new Intent(ShortcutActivity.SHORTCUT_INTENT); shortcutIntent.putExtra(LoginRoute.EXTRA_LOGOUT, isLogout); shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { addClearTaskFlag(shortcutIntent); } else { // This will cause the Setting page to disappear from recents shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK); } shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Intent.ShortcutIconResource iconResource = Intent.ShortcutIconResource.fromContext(context, R.drawable.icon); Intent intent = new Intent(); intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, context.getString(isLogout ? R.string.logout : R.string.login)); intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource); return intent; } @TargetApi(Build.VERSION_CODES.HONEYCOMB) private static void addClearTaskFlag(Intent intent) { intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); } }
UTF-8
Java
2,506
java
ShortcutActivity.java
Java
[]
null
[]
package hk.idv.elton.cuwaveautologin; import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.Bundle; public class ShortcutActivity extends Activity { public static final String SHORTCUT_INTENT = "hk.idv.elton.cuwaveautologin.SHORTCUT"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); boolean isLogout = getIntent().getBooleanExtra(LoginRoute.EXTRA_LOGOUT, false); Utils.checkWifiAndDoLogin(this, isLogout); finish(); } public static class CreateLoginShortcut extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setResult(RESULT_OK, createShortcutIntent(this, false)); finish(); } } public static class CreateLogoutShortcut extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setResult(RESULT_OK, createShortcutIntent(this, true)); finish(); } } private static Intent createShortcutIntent(Context context, boolean isLogout) { Intent shortcutIntent = new Intent(ShortcutActivity.SHORTCUT_INTENT); shortcutIntent.putExtra(LoginRoute.EXTRA_LOGOUT, isLogout); shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { addClearTaskFlag(shortcutIntent); } else { // This will cause the Setting page to disappear from recents shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK); } shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Intent.ShortcutIconResource iconResource = Intent.ShortcutIconResource.fromContext(context, R.drawable.icon); Intent intent = new Intent(); intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, context.getString(isLogout ? R.string.logout : R.string.login)); intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource); return intent; } @TargetApi(Build.VERSION_CODES.HONEYCOMB) private static void addClearTaskFlag(Intent intent) { intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); } }
2,506
0.698324
0.698324
72
33.805557
31.271942
117
false
false
0
0
0
0
0
0
0.597222
false
false
11