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
e9d90ecce836782d637b87a600ffa875eaf98e1b
30,837,865,246,818
c8d1944610e0678f4e881334346f14d24537e27c
/src/practice/action/midp/MidPerson.java
ec2f087082ca5c53b3c8f580fd9dd1eb39ca05b0
[]
no_license
snotJam/designpattern
https://github.com/snotJam/designpattern
67fc5e69e2999662e43418da55df1a3d48d0f5fa
76811b8682c1944af68bbfdb161396f2e3567a09
refs/heads/master
2018-11-21T20:43:25.185000
2018-09-25T02:05:02
2018-09-25T02:05:02
117,081,306
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package practice.action.midp; /** * Created by Administrator on 2018/2/10. */ public class MidPerson { DepartA departA; DepartB departB; public MidPerson(DepartA departA, DepartB departB) { this.departA = departA; this.departB = departB; } public void opA() { departA.operation(); } public void opB() { departB.operation(); } public void op() { departA.operation(); departB.operation(); } }
UTF-8
Java
486
java
MidPerson.java
Java
[ { "context": "package practice.action.midp;\n\n/**\n * Created by Administrator on 2018/2/10.\n */\npublic class MidPerson {\n De", "end": 62, "score": 0.4986000061035156, "start": 49, "tag": "USERNAME", "value": "Administrator" } ]
null
[]
package practice.action.midp; /** * Created by Administrator on 2018/2/10. */ public class MidPerson { DepartA departA; DepartB departB; public MidPerson(DepartA departA, DepartB departB) { this.departA = departA; this.departB = departB; } public void opA() { departA.operation(); } public void opB() { departB.operation(); } public void op() { departA.operation(); departB.operation(); } }
486
0.58642
0.572016
27
17
14.844877
56
false
false
0
0
0
0
0
0
0.37037
false
false
9
a934afdefb90d96c705f56710eed00a29882ce39
30,837,865,245,626
18e333f1a6b306d11fc4d69965bd477b7d93ba22
/MQTT_Application/src/main/java/me/esraozturk/mqttlistener/sdk/exception/DuplicateFieldException.java
2a820968206a96bbeb38b85ac8e32db27f3dc56c
[]
no_license
ozturkesra/ELK599
https://github.com/ozturkesra/ELK599
25bbb4aaf658419e35313ec4e94c705266b241a2
30fbeb977ad512ce474ea22400e30267db751167
refs/heads/main
2023-03-13T20:32:55.376000
2021-03-07T14:54:46
2021-03-07T14:54:46
340,635,819
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package me.esraozturk.mqttlistener.sdk.exception; import java.util.Collections; import java.util.List; public class DuplicateFieldException extends RuntimeException { public DuplicateFieldException(String field) { this(Collections.singletonList(field)); } public DuplicateFieldException(List<String> fields) { super(fields.toString()); } }
UTF-8
Java
377
java
DuplicateFieldException.java
Java
[]
null
[]
package me.esraozturk.mqttlistener.sdk.exception; import java.util.Collections; import java.util.List; public class DuplicateFieldException extends RuntimeException { public DuplicateFieldException(String field) { this(Collections.singletonList(field)); } public DuplicateFieldException(List<String> fields) { super(fields.toString()); } }
377
0.742706
0.742706
16
22.5625
23.248571
63
false
false
0
0
0
0
0
0
0.3125
false
false
9
8b3d28a1dda84a7e3d71536f39b6e8d7b8f08a2e
17,008,070,556,069
1ef497fef3ca2bd5981ff2a6d3b5df32a845ce85
/jadx-decompile/com/google/android/gms/drive/internal/CloseContentsRequest.java
b2ecda4db93d8f7877f3b0ba8bf453cd5d4f149b
[]
no_license
gmtandi/droneapp
https://github.com/gmtandi/droneapp
624eeb8a77bbb6cbe3160d79d0c9b46e827e8f4f
bfacef0ef2cc43aded3e03c012debcee868706c5
refs/heads/master
2019-07-22T10:11:35.423000
2017-06-01T00:38:41
2017-06-01T00:38:41
92,822,587
5
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.google.android.gms.drive.internal; import android.os.Parcel; import android.os.Parcelable.Creator; import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; import com.google.android.gms.drive.Contents; public class CloseContentsRequest extends AbstractSafeParcelable { public static final Creator<CloseContentsRequest> CREATOR = new bh(); final int a; final Contents b; final Boolean c; final int d; CloseContentsRequest(int i, Contents contents, Boolean bool, int i2) { this.a = i; this.b = contents; this.c = bool; this.d = i2; } public CloseContentsRequest(int i, boolean z) { this(1, null, Boolean.valueOf(z), i); } public void writeToParcel(Parcel parcel, int i) { bh.a(this, parcel, i); } }
UTF-8
Java
830
java
CloseContentsRequest.java
Java
[]
null
[]
package com.google.android.gms.drive.internal; import android.os.Parcel; import android.os.Parcelable.Creator; import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; import com.google.android.gms.drive.Contents; public class CloseContentsRequest extends AbstractSafeParcelable { public static final Creator<CloseContentsRequest> CREATOR = new bh(); final int a; final Contents b; final Boolean c; final int d; CloseContentsRequest(int i, Contents contents, Boolean bool, int i2) { this.a = i; this.b = contents; this.c = bool; this.d = i2; } public CloseContentsRequest(int i, boolean z) { this(1, null, Boolean.valueOf(z), i); } public void writeToParcel(Parcel parcel, int i) { bh.a(this, parcel, i); } }
830
0.685542
0.681928
29
27.620689
24.393913
80
false
false
0
0
0
0
0
0
0.896552
false
false
9
54bfb93e5828d5de7bd083cffbd40a54c25d4a4b
25,615,185,016,273
febdc36fcd171db88b1a11dc9bea9dfefaff8501
/src/Queue/CircularQueue.java
38ad25183433ad9b757ea3cf57249a58e1f6da6f
[]
no_license
TJZhou/INFO6205_Algorithms
https://github.com/TJZhou/INFO6205_Algorithms
4d967f281887ceb50b11dba0e1034efb5ee1695f
8eac1fad67993f23c12dadd0ebb33e3c7cd93e51
refs/heads/master
2020-04-16T09:22:19.264000
2019-04-15T03:57:04
2019-04-15T03:57:04
165,461,778
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Queue; public class CircularQueue<Item> { private int front, rear; private int maxSize; private Item[] q; public CircularQueue() { front = rear = 0; this.maxSize = 9; q = (Item[]) new Object[maxSize]; } public CircularQueue(int maxSize) { this.maxSize = maxSize; q = (Item[]) new Object[this.maxSize]; } public void enqueue(Item item) { if (isFull()) System.out.println("Queue is full"); else { q[rear] = item; rear = (rear + 1) % maxSize; } } public Item dequeue() { if (isEmpty()) { System.out.println("Queue is empty"); return null; } else { Item item = q[front]; front = (front + 1) % maxSize; return item; } } public boolean isEmpty() { return front % maxSize == rear; } public boolean isFull() { return (rear + 1) % maxSize == front; } // get the number of elements public int size() { if (rear >= front) { return (rear - front); } else { return (maxSize - (front - rear)); } } public void display() { for(int i = front; i!= rear; i = (i+1)%maxSize) { System.out.print(q[i] + " "); } System.out.println(); } public int getMaxSize() { return maxSize; } }
UTF-8
Java
1,178
java
CircularQueue.java
Java
[]
null
[]
package Queue; public class CircularQueue<Item> { private int front, rear; private int maxSize; private Item[] q; public CircularQueue() { front = rear = 0; this.maxSize = 9; q = (Item[]) new Object[maxSize]; } public CircularQueue(int maxSize) { this.maxSize = maxSize; q = (Item[]) new Object[this.maxSize]; } public void enqueue(Item item) { if (isFull()) System.out.println("Queue is full"); else { q[rear] = item; rear = (rear + 1) % maxSize; } } public Item dequeue() { if (isEmpty()) { System.out.println("Queue is empty"); return null; } else { Item item = q[front]; front = (front + 1) % maxSize; return item; } } public boolean isEmpty() { return front % maxSize == rear; } public boolean isFull() { return (rear + 1) % maxSize == front; } // get the number of elements public int size() { if (rear >= front) { return (rear - front); } else { return (maxSize - (front - rear)); } } public void display() { for(int i = front; i!= rear; i = (i+1)%maxSize) { System.out.print(q[i] + " "); } System.out.println(); } public int getMaxSize() { return maxSize; } }
1,178
0.594227
0.589134
67
16.58209
13.916756
51
false
false
0
0
0
0
0
0
1.880597
false
false
9
5945b42353ccb3b51db3577c7d5c60489c5e708c
3,693,671,928,108
c7666ba9b71a429fb80ccf5b38fb4bf7da7cf59f
/platform/Mobile/Android/eSpaceSDK_New/.svn/pristine/23/2357d2630645069f1e97f1e60e0d746c38242320.svn-base
e55ec4838ce2f67f0f433903aee49aa805acd83c
[ "Apache-2.0" ]
permissive
eSDK/esdk_uc_espaceMobile
https://github.com/eSDK/esdk_uc_espaceMobile
6b7230d09c47e7717973826e19ee78681e3ef4ce
0f69a9fbd70eb18fc18d1dbecface58bc458057c
refs/heads/master
2016-08-11T09:11:04.345000
2015-11-28T06:44:41
2015-11-28T06:44:41
47,013,049
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.huawei.service.login; /** * Created by l00186254 on 14-8-4. */ public enum LoginError { DEFAULT, CONNECTERROR, SVN_CONNECT_ERROR, SVN_SUPPORT_ERROR,//(705) // FORCE_UPDATE, RSAKEYERROR, ACK_ERROR,// CheckVerison KeyExchange Login ACK 中 返回的结果error LOGINOK, HEARTBEATERROR, // 心跳累计超时三次。认为是网络断开 SESSION_TIMEOUT,// -2 SESSION_OVERDUE,// -9 BE_KICKOFF,// -6 被踢 SVN_KICKOFF }
GB18030
Java
486
2357d2630645069f1e97f1e60e0d746c38242320.svn-base
Java
[ { "context": "ckage com.huawei.service.login;\n\n/**\n * Created by l00186254 on 14-8-4.\n */\npublic enum LoginError\n{\n DEFAU", "end": 62, "score": 0.9988524913787842, "start": 53, "tag": "USERNAME", "value": "l00186254" } ]
null
[]
package com.huawei.service.login; /** * Created by l00186254 on 14-8-4. */ public enum LoginError { DEFAULT, CONNECTERROR, SVN_CONNECT_ERROR, SVN_SUPPORT_ERROR,//(705) // FORCE_UPDATE, RSAKEYERROR, ACK_ERROR,// CheckVerison KeyExchange Login ACK 中 返回的结果error LOGINOK, HEARTBEATERROR, // 心跳累计超时三次。认为是网络断开 SESSION_TIMEOUT,// -2 SESSION_OVERDUE,// -9 BE_KICKOFF,// -6 被踢 SVN_KICKOFF }
486
0.648402
0.607306
22
18.90909
15.302731
65
false
false
0
0
0
0
0
0
0.590909
false
false
9
fdefac276241b149a2f44f064932f918a2e878d8
17,042,430,296,837
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/18/18_d4c690acfab7a365b8448cd5847a863857a4bc89/TextTitleAndSummary/18_d4c690acfab7a365b8448cd5847a863857a4bc89_TextTitleAndSummary_s.java
decde375bcae275a90e88dcc0b9c3fa3e92c24ed
[]
no_license
zhongxingyu/Seer
https://github.com/zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516000
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
false
2023-06-22T07:55:57
2020-04-28T11:07:49
2023-06-21T00:53:27
2023-06-22T07:55:57
2,849,868
2
2
0
null
false
false
package ro.koch.resourcefacades.facades; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.collect.Iterables.getFirst; import ro.koch.resourcefacades.TitleAndSummary; import com.google.common.base.Splitter; public class TextTitleAndSummary implements TitleAndSummary { private final String text; private final static Splitter titleSplitter = Splitter.on("\n").limit(1) .trimResults(); public TextTitleAndSummary(String text) { this.text = checkNotNull(text); } @Override public String getTitle() { String firstLine = getFirst(titleSplitter.split(text),"NO TITLE"); return firstLine.substring(0, 90); } @Override public String getSummary() { return text; } }
UTF-8
Java
845
java
18_d4c690acfab7a365b8448cd5847a863857a4bc89_TextTitleAndSummary_s.java
Java
[]
null
[]
package ro.koch.resourcefacades.facades; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.collect.Iterables.getFirst; import ro.koch.resourcefacades.TitleAndSummary; import com.google.common.base.Splitter; public class TextTitleAndSummary implements TitleAndSummary { private final String text; private final static Splitter titleSplitter = Splitter.on("\n").limit(1) .trimResults(); public TextTitleAndSummary(String text) { this.text = checkNotNull(text); } @Override public String getTitle() { String firstLine = getFirst(titleSplitter.split(text),"NO TITLE"); return firstLine.substring(0, 90); } @Override public String getSummary() { return text; } }
845
0.671006
0.666272
27
30.25926
26.005117
76
false
false
0
0
0
0
0
0
0.481481
false
false
9
504e24165cb43f611f44116e57a1dff0ea0509c2
26,920,855,074,285
085a4fba3828458225c3e3739e54745c5f3626ea
/src/main/java/de/uniko/iwm/Repo/Repo.java
e17d6cc8667e6eb8e70bcd526c8b45d0e3f23aa9
[]
no_license
PhilipFeuchtner/Tingo
https://github.com/PhilipFeuchtner/Tingo
4ee19ed4e040c21eaf80509049743c51df97989c
7820655eed884613f18da4db86d35b9f10952e37
refs/heads/master
2021-01-23T10:44:36.403000
2014-08-10T20:10:39
2014-08-10T20:10:39
39,499,639
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.uniko.iwm.Repo; import java.util.ArrayList; import java.util.List; public class Repo { private List<Section> sectionlist = new ArrayList<Section>(); private Navigation navigation; public Repo() { } // -------------------- hepler ------------------------------- public Section getSection() { return sectionlist.get(navigation.getSection()); } public List<GroupItem> getGroups() { return sectionlist.get(navigation.getSection()).getGroupitemlist(); } public GroupItem getGroupItem() { return sectionlist.get(navigation.getSection()).getGroupitemlist().get(navigation.getGroup()); } public List<QuestionItem> getQuestions() { System.out.println(" ->: " + navigation); return sectionlist.get(navigation.getSection()).getGroupitemlist() .get(navigation.getGroup()).getQuestionitemlist(); } public QuestionItem getQuestionItem() { return sectionlist.get(navigation.getSection()).getGroupitemlist() .get(navigation.getGroup()).getQuestionitemlist().get(navigation.getQuestion()); } public void increment() { sectionlist.get(navigation.getSection()).getGroupitemlist() .get(navigation.getGroup()).getState().increment(); } // ----------------------------------------------------------- public List<Section> getSectionlist() { return sectionlist; } public void setSectionlist(List<Section> sectionlist) { this.sectionlist = sectionlist; } public Navigation getNavigation() { return navigation; } public void setNavigation(Navigation navigation) { this.navigation = navigation; } }
UTF-8
Java
1,567
java
Repo.java
Java
[]
null
[]
package de.uniko.iwm.Repo; import java.util.ArrayList; import java.util.List; public class Repo { private List<Section> sectionlist = new ArrayList<Section>(); private Navigation navigation; public Repo() { } // -------------------- hepler ------------------------------- public Section getSection() { return sectionlist.get(navigation.getSection()); } public List<GroupItem> getGroups() { return sectionlist.get(navigation.getSection()).getGroupitemlist(); } public GroupItem getGroupItem() { return sectionlist.get(navigation.getSection()).getGroupitemlist().get(navigation.getGroup()); } public List<QuestionItem> getQuestions() { System.out.println(" ->: " + navigation); return sectionlist.get(navigation.getSection()).getGroupitemlist() .get(navigation.getGroup()).getQuestionitemlist(); } public QuestionItem getQuestionItem() { return sectionlist.get(navigation.getSection()).getGroupitemlist() .get(navigation.getGroup()).getQuestionitemlist().get(navigation.getQuestion()); } public void increment() { sectionlist.get(navigation.getSection()).getGroupitemlist() .get(navigation.getGroup()).getState().increment(); } // ----------------------------------------------------------- public List<Section> getSectionlist() { return sectionlist; } public void setSectionlist(List<Section> sectionlist) { this.sectionlist = sectionlist; } public Navigation getNavigation() { return navigation; } public void setNavigation(Navigation navigation) { this.navigation = navigation; } }
1,567
0.680919
0.680919
63
23.873016
26.057014
96
false
false
0
0
0
0
0
0
1.285714
false
false
9
0cdf42ec2ceb806f6f093579d311d8043a16023d
20,804,821,648,301
fd259f9881f121f63f75c071e9b161f526338466
/flexo-foundation/src/main/java/org/openflexo/foundation/fml/binding/FlexoConceptBindingVariable.java
6c51a3502b665ac6aa14ff39729d8403f10bdb20
[]
no_license
openflexo-team/openflexo-core
https://github.com/openflexo-team/openflexo-core
360e7baaf321115ef0dde47b7f508da31756dc9b
d4e001b70d1cc5294d6d59ebc554d5b302787be9
refs/heads/2.0.0
2023-08-31T06:44:26.298000
2020-07-01T08:49:29
2020-07-01T08:49:29
15,801,662
2
2
null
false
2023-08-30T13:18:44
2014-01-10T15:33:47
2023-02-09T14:04:05
2023-08-24T11:58:26
47,802
2
2
5
Java
false
false
/** * * Copyright (c) 2014-2015, Openflexo * * This file is part of Flexo-foundation, a component of the software infrastructure * developed at Openflexo. * * * Openflexo is dual-licensed under the European Union Public License (EUPL, either * version 1.1 of the License, or any later version ), which is available at * https://joinup.ec.europa.eu/software/page/eupl/licence-eupl * and the GNU General Public License (GPL, either version 3 of the License, or any * later version), which is available at http://www.gnu.org/licenses/gpl.html . * * You can redistribute it and/or modify under the terms of either of these licenses * * If you choose to redistribute it and/or modify under the terms of the GNU GPL, you * must include the following additional permission. * * Additional permission under GNU GPL version 3 section 7 * * If you modify this Program, or any covered work, by linking or * combining it with software containing parts covered by the terms * of EPL 1.0, the licensors of this Program grant you additional permission * to convey the resulting work. * * * This software 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 http://www.openflexo.org/license.html for details. * * * Please contact Openflexo (openflexo-contacts@openflexo.org) * or visit www.openflexo.org if you need additional information. * */ package org.openflexo.foundation.fml.binding; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.lang.reflect.Type; import java.util.logging.Logger; import org.openflexo.connie.BindingVariable; import org.openflexo.foundation.fml.FlexoConcept; import org.openflexo.foundation.fml.FlexoConceptInstanceType; /** * A {@link BindingVariable} implementation with a given {@link FlexoConcept} as type * * @author sylvain * */ public class FlexoConceptBindingVariable extends BindingVariable implements PropertyChangeListener { static final Logger logger = Logger.getLogger(FlexoConceptBindingVariable.class.getPackage().getName()); private final FlexoConcept flexoConcept; public FlexoConceptBindingVariable(String variableName, FlexoConcept anFlexoConcept) { super(variableName, FlexoConceptInstanceType.getFlexoConceptInstanceType(anFlexoConcept)); this.flexoConcept = anFlexoConcept; if (flexoConcept != null && flexoConcept.getPropertyChangeSupport() != null) { flexoConcept.getPropertyChangeSupport().addPropertyChangeListener(this); } } @Override public void delete() { if (flexoConcept != null && flexoConcept.getPropertyChangeSupport() != null) { flexoConcept.getPropertyChangeSupport().removePropertyChangeListener(this); } super.delete(); } @Override public Type getType() { return FlexoConceptInstanceType.getFlexoConceptInstanceType(flexoConcept); } @Override public String getTooltipText(Type resultingType) { return flexoConcept.getDescription(); } public FlexoConcept getFlexoConcept() { return flexoConcept; } @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getSource() instanceof FlexoConcept) { if (evt.getPropertyName().equals(FlexoConcept.FLEXO_PROPERTIES_KEY) || evt.getPropertyName().equals(FlexoConcept.FLEXO_BEHAVIOURS_KEY)) { isNotifyingBindingPathChanged = true; getPropertyChangeSupport().firePropertyChange(BINDING_PATH_CHANGED, false, true); isNotifyingBindingPathChanged = false; } } } private boolean isNotifyingBindingPathChanged = false; @Override public boolean isNotifyingBindingPathChanged() { return isNotifyingBindingPathChanged; } }
UTF-8
Java
3,785
java
FlexoConceptBindingVariable.java
Java
[ { "context": "for details.\n * \n * \n * Please contact Openflexo (openflexo-contacts@openflexo.org)\n * or visit www.openflexo.org if you need additi", "end": 1480, "score": 0.9999344348907471, "start": 1448, "tag": "EMAIL", "value": "openflexo-contacts@openflexo.org" }, { "context"...
null
[]
/** * * Copyright (c) 2014-2015, Openflexo * * This file is part of Flexo-foundation, a component of the software infrastructure * developed at Openflexo. * * * Openflexo is dual-licensed under the European Union Public License (EUPL, either * version 1.1 of the License, or any later version ), which is available at * https://joinup.ec.europa.eu/software/page/eupl/licence-eupl * and the GNU General Public License (GPL, either version 3 of the License, or any * later version), which is available at http://www.gnu.org/licenses/gpl.html . * * You can redistribute it and/or modify under the terms of either of these licenses * * If you choose to redistribute it and/or modify under the terms of the GNU GPL, you * must include the following additional permission. * * Additional permission under GNU GPL version 3 section 7 * * If you modify this Program, or any covered work, by linking or * combining it with software containing parts covered by the terms * of EPL 1.0, the licensors of this Program grant you additional permission * to convey the resulting work. * * * This software 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 http://www.openflexo.org/license.html for details. * * * Please contact Openflexo (<EMAIL>) * or visit www.openflexo.org if you need additional information. * */ package org.openflexo.foundation.fml.binding; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.lang.reflect.Type; import java.util.logging.Logger; import org.openflexo.connie.BindingVariable; import org.openflexo.foundation.fml.FlexoConcept; import org.openflexo.foundation.fml.FlexoConceptInstanceType; /** * A {@link BindingVariable} implementation with a given {@link FlexoConcept} as type * * @author sylvain * */ public class FlexoConceptBindingVariable extends BindingVariable implements PropertyChangeListener { static final Logger logger = Logger.getLogger(FlexoConceptBindingVariable.class.getPackage().getName()); private final FlexoConcept flexoConcept; public FlexoConceptBindingVariable(String variableName, FlexoConcept anFlexoConcept) { super(variableName, FlexoConceptInstanceType.getFlexoConceptInstanceType(anFlexoConcept)); this.flexoConcept = anFlexoConcept; if (flexoConcept != null && flexoConcept.getPropertyChangeSupport() != null) { flexoConcept.getPropertyChangeSupport().addPropertyChangeListener(this); } } @Override public void delete() { if (flexoConcept != null && flexoConcept.getPropertyChangeSupport() != null) { flexoConcept.getPropertyChangeSupport().removePropertyChangeListener(this); } super.delete(); } @Override public Type getType() { return FlexoConceptInstanceType.getFlexoConceptInstanceType(flexoConcept); } @Override public String getTooltipText(Type resultingType) { return flexoConcept.getDescription(); } public FlexoConcept getFlexoConcept() { return flexoConcept; } @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getSource() instanceof FlexoConcept) { if (evt.getPropertyName().equals(FlexoConcept.FLEXO_PROPERTIES_KEY) || evt.getPropertyName().equals(FlexoConcept.FLEXO_BEHAVIOURS_KEY)) { isNotifyingBindingPathChanged = true; getPropertyChangeSupport().firePropertyChange(BINDING_PATH_CHANGED, false, true); isNotifyingBindingPathChanged = false; } } } private boolean isNotifyingBindingPathChanged = false; @Override public boolean isNotifyingBindingPathChanged() { return isNotifyingBindingPathChanged; } }
3,760
0.759577
0.755614
110
33.409092
32.919819
105
false
false
0
0
0
0
0
0
1.090909
false
false
9
f0556ffd508af86d2b508812a9c9e841d066709d
2,405,181,752,145
aeef2494b283012ed619870c4275e7d015f4017a
/sdk/java/src/main/java/com/pulumi/gcp/logging/inputs/MetricBucketOptionsExponentialBucketsArgs.java
0f7ea4facc4089715485ad52e17c9215fb979a2b
[ "BSD-3-Clause", "MPL-2.0", "Apache-2.0" ]
permissive
pulumi/pulumi-gcp
https://github.com/pulumi/pulumi-gcp
d4fd3f80c3df5290edaf33eb5eafe34e6699d0ff
7deea0a50a4ee5ab7bd722a83eca01707e298f85
refs/heads/master
2023-08-31T07:12:45.921000
2023-08-31T06:16:27
2023-08-31T06:16:27
97,485,806
160
63
Apache-2.0
false
2023-09-14T19:49:36
2017-07-17T14:28:37
2023-09-09T05:01:08
2023-09-14T19:49:35
159,678
149
50
173
Java
false
false
// *** WARNING: this file was generated by pulumi-java-gen. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** package com.pulumi.gcp.logging.inputs; import com.pulumi.core.Output; import com.pulumi.core.annotations.Import; import java.lang.Double; import java.lang.Integer; import java.util.Objects; import java.util.Optional; import javax.annotation.Nullable; public final class MetricBucketOptionsExponentialBucketsArgs extends com.pulumi.resources.ResourceArgs { public static final MetricBucketOptionsExponentialBucketsArgs Empty = new MetricBucketOptionsExponentialBucketsArgs(); /** * Must be greater than 1. * */ @Import(name="growthFactor") private @Nullable Output<Double> growthFactor; /** * @return Must be greater than 1. * */ public Optional<Output<Double>> growthFactor() { return Optional.ofNullable(this.growthFactor); } /** * Must be greater than 0. * */ @Import(name="numFiniteBuckets") private @Nullable Output<Integer> numFiniteBuckets; /** * @return Must be greater than 0. * */ public Optional<Output<Integer>> numFiniteBuckets() { return Optional.ofNullable(this.numFiniteBuckets); } /** * Must be greater than 0. * */ @Import(name="scale") private @Nullable Output<Double> scale; /** * @return Must be greater than 0. * */ public Optional<Output<Double>> scale() { return Optional.ofNullable(this.scale); } private MetricBucketOptionsExponentialBucketsArgs() {} private MetricBucketOptionsExponentialBucketsArgs(MetricBucketOptionsExponentialBucketsArgs $) { this.growthFactor = $.growthFactor; this.numFiniteBuckets = $.numFiniteBuckets; this.scale = $.scale; } public static Builder builder() { return new Builder(); } public static Builder builder(MetricBucketOptionsExponentialBucketsArgs defaults) { return new Builder(defaults); } public static final class Builder { private MetricBucketOptionsExponentialBucketsArgs $; public Builder() { $ = new MetricBucketOptionsExponentialBucketsArgs(); } public Builder(MetricBucketOptionsExponentialBucketsArgs defaults) { $ = new MetricBucketOptionsExponentialBucketsArgs(Objects.requireNonNull(defaults)); } /** * @param growthFactor Must be greater than 1. * * @return builder * */ public Builder growthFactor(@Nullable Output<Double> growthFactor) { $.growthFactor = growthFactor; return this; } /** * @param growthFactor Must be greater than 1. * * @return builder * */ public Builder growthFactor(Double growthFactor) { return growthFactor(Output.of(growthFactor)); } /** * @param numFiniteBuckets Must be greater than 0. * * @return builder * */ public Builder numFiniteBuckets(@Nullable Output<Integer> numFiniteBuckets) { $.numFiniteBuckets = numFiniteBuckets; return this; } /** * @param numFiniteBuckets Must be greater than 0. * * @return builder * */ public Builder numFiniteBuckets(Integer numFiniteBuckets) { return numFiniteBuckets(Output.of(numFiniteBuckets)); } /** * @param scale Must be greater than 0. * * @return builder * */ public Builder scale(@Nullable Output<Double> scale) { $.scale = scale; return this; } /** * @param scale Must be greater than 0. * * @return builder * */ public Builder scale(Double scale) { return scale(Output.of(scale)); } public MetricBucketOptionsExponentialBucketsArgs build() { return $; } } }
UTF-8
Java
4,178
java
MetricBucketOptionsExponentialBucketsArgs.java
Java
[]
null
[]
// *** WARNING: this file was generated by pulumi-java-gen. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** package com.pulumi.gcp.logging.inputs; import com.pulumi.core.Output; import com.pulumi.core.annotations.Import; import java.lang.Double; import java.lang.Integer; import java.util.Objects; import java.util.Optional; import javax.annotation.Nullable; public final class MetricBucketOptionsExponentialBucketsArgs extends com.pulumi.resources.ResourceArgs { public static final MetricBucketOptionsExponentialBucketsArgs Empty = new MetricBucketOptionsExponentialBucketsArgs(); /** * Must be greater than 1. * */ @Import(name="growthFactor") private @Nullable Output<Double> growthFactor; /** * @return Must be greater than 1. * */ public Optional<Output<Double>> growthFactor() { return Optional.ofNullable(this.growthFactor); } /** * Must be greater than 0. * */ @Import(name="numFiniteBuckets") private @Nullable Output<Integer> numFiniteBuckets; /** * @return Must be greater than 0. * */ public Optional<Output<Integer>> numFiniteBuckets() { return Optional.ofNullable(this.numFiniteBuckets); } /** * Must be greater than 0. * */ @Import(name="scale") private @Nullable Output<Double> scale; /** * @return Must be greater than 0. * */ public Optional<Output<Double>> scale() { return Optional.ofNullable(this.scale); } private MetricBucketOptionsExponentialBucketsArgs() {} private MetricBucketOptionsExponentialBucketsArgs(MetricBucketOptionsExponentialBucketsArgs $) { this.growthFactor = $.growthFactor; this.numFiniteBuckets = $.numFiniteBuckets; this.scale = $.scale; } public static Builder builder() { return new Builder(); } public static Builder builder(MetricBucketOptionsExponentialBucketsArgs defaults) { return new Builder(defaults); } public static final class Builder { private MetricBucketOptionsExponentialBucketsArgs $; public Builder() { $ = new MetricBucketOptionsExponentialBucketsArgs(); } public Builder(MetricBucketOptionsExponentialBucketsArgs defaults) { $ = new MetricBucketOptionsExponentialBucketsArgs(Objects.requireNonNull(defaults)); } /** * @param growthFactor Must be greater than 1. * * @return builder * */ public Builder growthFactor(@Nullable Output<Double> growthFactor) { $.growthFactor = growthFactor; return this; } /** * @param growthFactor Must be greater than 1. * * @return builder * */ public Builder growthFactor(Double growthFactor) { return growthFactor(Output.of(growthFactor)); } /** * @param numFiniteBuckets Must be greater than 0. * * @return builder * */ public Builder numFiniteBuckets(@Nullable Output<Integer> numFiniteBuckets) { $.numFiniteBuckets = numFiniteBuckets; return this; } /** * @param numFiniteBuckets Must be greater than 0. * * @return builder * */ public Builder numFiniteBuckets(Integer numFiniteBuckets) { return numFiniteBuckets(Output.of(numFiniteBuckets)); } /** * @param scale Must be greater than 0. * * @return builder * */ public Builder scale(@Nullable Output<Double> scale) { $.scale = scale; return this; } /** * @param scale Must be greater than 0. * * @return builder * */ public Builder scale(Double scale) { return scale(Output.of(scale)); } public MetricBucketOptionsExponentialBucketsArgs build() { return $; } } }
4,178
0.597415
0.594543
158
25.443037
25.582949
122
false
false
0
0
0
0
0
0
0.208861
false
false
9
2b19c8919b082cccd9db031c42e03a2cfa718dc4
32,160,715,170,164
27a1acf51c0302894e95623213c0f2d0b98d7e28
/app/src/main/java/com/androidproj/chat/Chat.java
7792c033848f92f1d0254b7f320d148c09491a7c
[]
no_license
doublfish9x/Chat
https://github.com/doublfish9x/Chat
716a2eea7d646964c07d8aa466e0e0e7e6d9e8be
67a13def813c72883da240b31a88bf0ed70a82f4
refs/heads/master
2021-01-21T06:24:59.297000
2017-02-26T04:15:10
2017-02-26T04:15:10
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.androidproj.chat; /** * Created by NgocLong on 2/25/17. */ public class Chat { }
UTF-8
Java
97
java
Chat.java
Java
[ { "context": "package com.androidproj.chat;\n\n/**\n * Created by NgocLong on 2/25/17.\n */\n\npublic class Chat {\n}\n", "end": 57, "score": 0.9994857311248779, "start": 49, "tag": "USERNAME", "value": "NgocLong" } ]
null
[]
package com.androidproj.chat; /** * Created by NgocLong on 2/25/17. */ public class Chat { }
97
0.659794
0.608247
8
11.125
13.166601
34
false
false
0
0
0
0
0
0
0.125
false
false
9
d9d27c196222a3f62224a2bbf8897a19cdf31281
38,869,454,053,810
59b28febfd1ddec92f190110e08166a65a42f9d2
/src/org/mohsin/geek/Array/ReplaceWithGreatestOnRight.java
aaf6f492d12a2e5c3c9aec2a84e60d9dfb278e22
[]
no_license
mustafacse/Geeksforgeeks
https://github.com/mustafacse/Geeksforgeeks
6b383829382fa06102c597248463448f046d2b96
18f8131d07f36e01c8db2184813f495cf1a7aa11
refs/heads/master
2020-04-06T04:27:53.835000
2017-02-02T11:48:57
2017-02-02T11:48:57
73,790,645
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * */ package org.mohsin.geek.Array; import java.util.Arrays; /** * @author mohsin * */ public class ReplaceWithGreatestOnRight { public static void replace(int arr[]){ int max = arr[arr.length-1]; arr[arr.length-1] = -1; for(int i = arr.length-2;i >= 0;--i){ int temp = arr[i]; arr[i] = max; if(max < temp) max = temp; } } /** * @param args */ public static void main(String[] args) { int arr[] = {16,17,4,3,5,2}; replace(arr); System.out.println(Arrays.toString(arr)); } }
UTF-8
Java
538
java
ReplaceWithGreatestOnRight.java
Java
[ { "context": "k.Array;\n\nimport java.util.Arrays;\n\n/**\n * @author mohsin\n *\n */\npublic class ReplaceWithGreatestOnRight {\n", "end": 91, "score": 0.938431441783905, "start": 85, "tag": "USERNAME", "value": "mohsin" } ]
null
[]
/** * */ package org.mohsin.geek.Array; import java.util.Arrays; /** * @author mohsin * */ public class ReplaceWithGreatestOnRight { public static void replace(int arr[]){ int max = arr[arr.length-1]; arr[arr.length-1] = -1; for(int i = arr.length-2;i >= 0;--i){ int temp = arr[i]; arr[i] = max; if(max < temp) max = temp; } } /** * @param args */ public static void main(String[] args) { int arr[] = {16,17,4,3,5,2}; replace(arr); System.out.println(Arrays.toString(arr)); } }
538
0.568773
0.54461
38
13.157895
14.18028
43
false
false
0
0
0
0
0
0
1.578947
false
false
9
83f0a82be3422fcf89e8a3a5c6ed70740176b29f
6,828,998,063,235
ce7cb6a6a4410984f57569ee9e2dfc0134f5a796
/aurora/plugin/source/gen/builders/ViewBuilder.java
4b49d060fd909b6099a786319acce679fc94bcef
[]
no_license
hand-china-hec/aurora-plugin
https://github.com/hand-china-hec/aurora-plugin
aa656cd73ad272ad1358aed31614bc481d6b290b
4b54c9fb0a726f8d33b10fec153853749d3d520d
refs/heads/master
2017-12-01T09:42:02.897000
2017-10-25T08:01:33
2017-10-25T08:01:33
62,461,543
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package aurora.plugin.source.gen.builders; import java.util.List; import uncertain.composite.CompositeMap; import aurora.plugin.source.gen.BuilderSession; import aurora.plugin.source.gen.ModelMapParser; import aurora.plugin.source.gen.Util; import aurora.plugin.source.gen.screen.model.properties.ComponentInnerProperties; import aurora.plugin.source.gen.screen.model.properties.IProperties; public class ViewBuilder extends DefaultSourceBuilder { private static final String A = "a"; @Override public void buildContext(BuilderSession session) { super.buildContext(session); buildLinkContext(session); buildDatasetsContext(session); calBindTarget(session); } private void buildDatasetsContext(BuilderSession session) { CompositeMap currentContext = session.getCurrentContext(); ModelMapParser mmp = getModelMapParser(session); List<CompositeMap> datasets = mmp.getDatasets(); for (CompositeMap ds : datasets) { String ds_id = genDatasetID(ds, session); ds.put(IProperties.DS_ID, ds_id); } for (CompositeMap ds : datasets) { String type = ds.getString(IProperties.COMPONENT_TYPE, ""); if (IProperties.QUERYDATASET.equalsIgnoreCase(type)) { ds.put(IProperties.autoCreate, true); } if (IProperties.RESULTDATASET.equalsIgnoreCase(type)) { CompositeMap query = ds.getChildByAttrib( IProperties.PROPERTYE_ID, IProperties.DATASET_QUERY_CONTAINER); if (query != null) { CompositeMap container = mmp.getComponentByID(query .getString(IProperties.MARKID, "")); if (container == null) return; CompositeMap cds = container.getChildByAttrib( IProperties.PROPERTYE_ID, IProperties.I_DATASET_DELEGATE); String fds_type = cds.getString(IProperties.COMPONENT_TYPE, ""); if (IProperties.QUERYDATASET.equalsIgnoreCase(fds_type)) { ds.put(IProperties.QUERY_DS, cds.getString(IProperties.DS_ID, "")); } else if (IProperties.RESULTDATASET .equalsIgnoreCase(fds_type)) { ds.put(IProperties.bindName, ds.getString(IProperties.DS_ID, "")); ds.put(IProperties.bindTarget, cds.getString(IProperties.DS_ID, "")); } } else { ds.put(IProperties.autoQuery, true); ds.put(IProperties.pageSize, null); } } } for (CompositeMap ds : datasets) { List<CompositeMap> datasetFields = mmp.getDatasetFields(ds); CompositeMap newDS = (CompositeMap) ds.clone(); newDS.getChildsNotNull().clear(); newDS.setPrefix(A); newDS.setName(IProperties.DATASET); for (CompositeMap field : datasetFields) { field.put(IProperties.FIELD_NAME, field.getParent().getString(IProperties.name, "")); String fieldType = field.getParent().getString( IProperties.COMPONENT_TYPE, ""); if (IProperties.GRIDCOLUMN.equals(fieldType)) { fieldType = field.getParent().getString(IProperties.editor, ""); } field.put(IProperties.FIELD_TYPE, fieldType); if (isLov(field)) { genLovDSField(session, field); } if (isCombo(field)) { genComboDSField(session, field); } CompositeMap clone = (CompositeMap) field.clone(); clone.setName(IProperties.FIELD); clone.setPrefix(A); newDS.addChild((CompositeMap) clone); } currentContext.addChild(newDS); } } ModelMapParser getModelMapParser(BuilderSession session) { CompositeMap currentModel = session.getCurrentModel(); return session.createModelMapParser(currentModel); // ModelMapParser mmp = new ModelMapParser(currentModel); // return mmp; } public void genLovDSField(BuilderSession session, CompositeMap field) { ModelMapParser mmp = getModelMapParser(session); // List<CompositeMap> lovMaps = mmp.getLovMaps(field); // field.put("lovService", field.getString("options", "")); // if (lovMaps != null) { // mmp.bindMapping(field, lovMaps); // } String[] models = mmp.findComboFieldOption(field); CompositeMap lovservice = getLovServiceMap(session, field); String lovservice_options = lovservice.getString( IProperties.LOVSERVICE_OPTIONS, ""); String model = "".equals(lovservice_options) ? models[0] : lovservice_options; models[0] = model; field.put(IProperties.displayField, mmp.getComboDisplayField(models, field)); field.put(IProperties.valueField, mmp.getComboValueField(models, field)); field.put(IProperties.lovService, model); } private CompositeMap getLovServiceMap(BuilderSession session, CompositeMap field) { CompositeMap innerLovService = field.getChildByAttrib( IProperties.COMPONENT_TYPE, IProperties.INNER_TYPE_LOV_SERVICE); return innerLovService; } public void genComboDSField(BuilderSession session, CompositeMap field) { ModelMapParser mmp = getModelMapParser(session); // String model = field.getString("options", ""); String[] models = mmp.findComboFieldOption(field); CompositeMap lovservice = getLovServiceMap(session, field); String lovservice_options = lovservice.getString( IProperties.LOVSERVICE_OPTIONS, ""); String model = "".equals(lovservice_options) ? models[0] : lovservice_options; String lookupCode = models[1]; // if ("".equals(model)) { // lookupCode = field.getString("lookupCode", ""); // } if ("".equals(model) == false || "".equals(lookupCode) == false) { CompositeMap createComboDatasetMap = createComboDatasetMap(model, lookupCode, session); session.getCurrentContext().addChild(createComboDatasetMap); field.put(IProperties.options, createComboDatasetMap.getString(IProperties.DS_ID, "")); } models[0] = model; field.put(IProperties.displayField, mmp.getComboDisplayField(models, field)); field.put(IProperties.valueField, mmp.getComboValueField(models, field)); } public boolean isLov(CompositeMap field) { String type = field.getParent().getString(IProperties.COMPONENT_TYPE, ""); if (IProperties.GRIDCOLUMN.equalsIgnoreCase(type)) { type = field.getParent().getString(IProperties.editor, ""); } return IProperties.LOV.equalsIgnoreCase(type); } public boolean isCombo(CompositeMap field) { String type = field.getParent().getString(IProperties.COMPONENT_TYPE, ""); if (IProperties.GRIDCOLUMN.equalsIgnoreCase(type)) { type = field.getParent().getString(IProperties.editor, ""); } return IProperties.COMBO_BOX.equalsIgnoreCase(type); } private void calBindTarget(BuilderSession session) { ModelMapParser mmp = getModelMapParser(session); List<CompositeMap> datasets = mmp.getDatasets(); for (CompositeMap ds : datasets) { if (ds.getParent().getString(IProperties.COMPONENT_TYPE, "") .equals(IProperties.GRID)) { ds.getParent().put(IProperties.bindTarget, ds.getString(IProperties.DS_ID, "")); } List<CompositeMap> datasetFields = mmp.getDatasetFields(ds); for (CompositeMap field : datasetFields) { String ds_id = ds.getString(IProperties.DS_ID, ""); field.getParent().put(IProperties.bindTarget, ds_id); // parser.debug(field.getParent().getParent().toXML()); } } } private CompositeMap createComboDatasetMap(String model, String lookupCode, BuilderSession session) { CompositeMap ds = new CompositeMap(IProperties.DATASET); ds.setPrefix(A); String id = genDatasetID(ds, session); ds.put(IProperties.DS_ID, id); ds.put(IProperties.autoCreate, true); ds.put(IProperties.COMPONENT_TYPE, IProperties.COMBODATASET); if ("".equals(model) == false) ds.put(IProperties.model, model); ds.put(IProperties.loadData, true); if ("".equals(lookupCode) == false) ds.put(IProperties.lookupCode, lookupCode); return ds; } private String genDatasetID(CompositeMap ds, BuilderSession session) { return session.getIDGenerator().genDatasetID(ds); } private CompositeMap genLinkContext(CompositeMap map, BuilderSession session, String openpath) { CompositeMap link = new CompositeMap(IProperties.LINK); String id = genLinkID(link, session); link.put(IProperties.url, "${/request/@context_path}/" + openpath); link.put(IProperties.COMPONENT_TYPE, IProperties.LINK); link.put(IProperties.id, id); return link; } private String genLinkID(CompositeMap link, BuilderSession session) { return session.getIDGenerator().genLinkID(IProperties.LINK); } private void buildLinkContext(BuilderSession session) { ModelMapParser mmp = getModelMapParser(session); CompositeMap currentContext = session.getCurrentContext(); List<CompositeMap> buttons = mmp.getComponents(IProperties.BUTTON); for (CompositeMap button : buttons) { CompositeMap clicker = button .getChild(IProperties.INNER_BUTTONCLICKER); if (clicker != null) { String id = clicker .getString(ComponentInnerProperties.BUTTON_CLICK_ACTIONID); if (IProperties.OPEN.equals(id)) { String openpath = clicker.getString( ComponentInnerProperties.OPEN_PATH, ""); if (openpath.endsWith(".uip")) { openpath = openpath.replaceAll(".uip", ".screen"); } CompositeMap link = genLinkContext(clicker, session, openpath); currentContext.addChild(link); clicker.put(IProperties.LINK_ID, link.getString(IProperties.id, "")); } } } List<CompositeMap> renderers = mmp.getComponents(IProperties.renderer); for (CompositeMap renderer : renderers) { String type = renderer.getString( ComponentInnerProperties.RENDERER_TYPE, ""); if (IProperties.PAGE_REDIRECT.equals(type)) { String openpath = renderer.getString( ComponentInnerProperties.OPEN_PATH, ""); if (openpath.endsWith(".uip")) { openpath = Util.getNewLinkFilePath(openpath, "" + session.getConfig(IProperties.FILE_NAME)); } CompositeMap link = genLinkContext(renderer, session, openpath); currentContext.addChild(link); renderer.put(IProperties.LINK_ID, link.getString(IProperties.id, "")); } } } public void actionEvent(String event, BuilderSession session) { if (IProperties.EVENT_CHILDREN.equals(event) && IProperties.VIEW .equalsIgnoreCase(session.getCurrentModel().getString( ComponentInnerProperties.COMPONENT_TYPE, ""))) { buildChildComponent(session); } } }
UTF-8
Java
10,154
java
ViewBuilder.java
Java
[]
null
[]
package aurora.plugin.source.gen.builders; import java.util.List; import uncertain.composite.CompositeMap; import aurora.plugin.source.gen.BuilderSession; import aurora.plugin.source.gen.ModelMapParser; import aurora.plugin.source.gen.Util; import aurora.plugin.source.gen.screen.model.properties.ComponentInnerProperties; import aurora.plugin.source.gen.screen.model.properties.IProperties; public class ViewBuilder extends DefaultSourceBuilder { private static final String A = "a"; @Override public void buildContext(BuilderSession session) { super.buildContext(session); buildLinkContext(session); buildDatasetsContext(session); calBindTarget(session); } private void buildDatasetsContext(BuilderSession session) { CompositeMap currentContext = session.getCurrentContext(); ModelMapParser mmp = getModelMapParser(session); List<CompositeMap> datasets = mmp.getDatasets(); for (CompositeMap ds : datasets) { String ds_id = genDatasetID(ds, session); ds.put(IProperties.DS_ID, ds_id); } for (CompositeMap ds : datasets) { String type = ds.getString(IProperties.COMPONENT_TYPE, ""); if (IProperties.QUERYDATASET.equalsIgnoreCase(type)) { ds.put(IProperties.autoCreate, true); } if (IProperties.RESULTDATASET.equalsIgnoreCase(type)) { CompositeMap query = ds.getChildByAttrib( IProperties.PROPERTYE_ID, IProperties.DATASET_QUERY_CONTAINER); if (query != null) { CompositeMap container = mmp.getComponentByID(query .getString(IProperties.MARKID, "")); if (container == null) return; CompositeMap cds = container.getChildByAttrib( IProperties.PROPERTYE_ID, IProperties.I_DATASET_DELEGATE); String fds_type = cds.getString(IProperties.COMPONENT_TYPE, ""); if (IProperties.QUERYDATASET.equalsIgnoreCase(fds_type)) { ds.put(IProperties.QUERY_DS, cds.getString(IProperties.DS_ID, "")); } else if (IProperties.RESULTDATASET .equalsIgnoreCase(fds_type)) { ds.put(IProperties.bindName, ds.getString(IProperties.DS_ID, "")); ds.put(IProperties.bindTarget, cds.getString(IProperties.DS_ID, "")); } } else { ds.put(IProperties.autoQuery, true); ds.put(IProperties.pageSize, null); } } } for (CompositeMap ds : datasets) { List<CompositeMap> datasetFields = mmp.getDatasetFields(ds); CompositeMap newDS = (CompositeMap) ds.clone(); newDS.getChildsNotNull().clear(); newDS.setPrefix(A); newDS.setName(IProperties.DATASET); for (CompositeMap field : datasetFields) { field.put(IProperties.FIELD_NAME, field.getParent().getString(IProperties.name, "")); String fieldType = field.getParent().getString( IProperties.COMPONENT_TYPE, ""); if (IProperties.GRIDCOLUMN.equals(fieldType)) { fieldType = field.getParent().getString(IProperties.editor, ""); } field.put(IProperties.FIELD_TYPE, fieldType); if (isLov(field)) { genLovDSField(session, field); } if (isCombo(field)) { genComboDSField(session, field); } CompositeMap clone = (CompositeMap) field.clone(); clone.setName(IProperties.FIELD); clone.setPrefix(A); newDS.addChild((CompositeMap) clone); } currentContext.addChild(newDS); } } ModelMapParser getModelMapParser(BuilderSession session) { CompositeMap currentModel = session.getCurrentModel(); return session.createModelMapParser(currentModel); // ModelMapParser mmp = new ModelMapParser(currentModel); // return mmp; } public void genLovDSField(BuilderSession session, CompositeMap field) { ModelMapParser mmp = getModelMapParser(session); // List<CompositeMap> lovMaps = mmp.getLovMaps(field); // field.put("lovService", field.getString("options", "")); // if (lovMaps != null) { // mmp.bindMapping(field, lovMaps); // } String[] models = mmp.findComboFieldOption(field); CompositeMap lovservice = getLovServiceMap(session, field); String lovservice_options = lovservice.getString( IProperties.LOVSERVICE_OPTIONS, ""); String model = "".equals(lovservice_options) ? models[0] : lovservice_options; models[0] = model; field.put(IProperties.displayField, mmp.getComboDisplayField(models, field)); field.put(IProperties.valueField, mmp.getComboValueField(models, field)); field.put(IProperties.lovService, model); } private CompositeMap getLovServiceMap(BuilderSession session, CompositeMap field) { CompositeMap innerLovService = field.getChildByAttrib( IProperties.COMPONENT_TYPE, IProperties.INNER_TYPE_LOV_SERVICE); return innerLovService; } public void genComboDSField(BuilderSession session, CompositeMap field) { ModelMapParser mmp = getModelMapParser(session); // String model = field.getString("options", ""); String[] models = mmp.findComboFieldOption(field); CompositeMap lovservice = getLovServiceMap(session, field); String lovservice_options = lovservice.getString( IProperties.LOVSERVICE_OPTIONS, ""); String model = "".equals(lovservice_options) ? models[0] : lovservice_options; String lookupCode = models[1]; // if ("".equals(model)) { // lookupCode = field.getString("lookupCode", ""); // } if ("".equals(model) == false || "".equals(lookupCode) == false) { CompositeMap createComboDatasetMap = createComboDatasetMap(model, lookupCode, session); session.getCurrentContext().addChild(createComboDatasetMap); field.put(IProperties.options, createComboDatasetMap.getString(IProperties.DS_ID, "")); } models[0] = model; field.put(IProperties.displayField, mmp.getComboDisplayField(models, field)); field.put(IProperties.valueField, mmp.getComboValueField(models, field)); } public boolean isLov(CompositeMap field) { String type = field.getParent().getString(IProperties.COMPONENT_TYPE, ""); if (IProperties.GRIDCOLUMN.equalsIgnoreCase(type)) { type = field.getParent().getString(IProperties.editor, ""); } return IProperties.LOV.equalsIgnoreCase(type); } public boolean isCombo(CompositeMap field) { String type = field.getParent().getString(IProperties.COMPONENT_TYPE, ""); if (IProperties.GRIDCOLUMN.equalsIgnoreCase(type)) { type = field.getParent().getString(IProperties.editor, ""); } return IProperties.COMBO_BOX.equalsIgnoreCase(type); } private void calBindTarget(BuilderSession session) { ModelMapParser mmp = getModelMapParser(session); List<CompositeMap> datasets = mmp.getDatasets(); for (CompositeMap ds : datasets) { if (ds.getParent().getString(IProperties.COMPONENT_TYPE, "") .equals(IProperties.GRID)) { ds.getParent().put(IProperties.bindTarget, ds.getString(IProperties.DS_ID, "")); } List<CompositeMap> datasetFields = mmp.getDatasetFields(ds); for (CompositeMap field : datasetFields) { String ds_id = ds.getString(IProperties.DS_ID, ""); field.getParent().put(IProperties.bindTarget, ds_id); // parser.debug(field.getParent().getParent().toXML()); } } } private CompositeMap createComboDatasetMap(String model, String lookupCode, BuilderSession session) { CompositeMap ds = new CompositeMap(IProperties.DATASET); ds.setPrefix(A); String id = genDatasetID(ds, session); ds.put(IProperties.DS_ID, id); ds.put(IProperties.autoCreate, true); ds.put(IProperties.COMPONENT_TYPE, IProperties.COMBODATASET); if ("".equals(model) == false) ds.put(IProperties.model, model); ds.put(IProperties.loadData, true); if ("".equals(lookupCode) == false) ds.put(IProperties.lookupCode, lookupCode); return ds; } private String genDatasetID(CompositeMap ds, BuilderSession session) { return session.getIDGenerator().genDatasetID(ds); } private CompositeMap genLinkContext(CompositeMap map, BuilderSession session, String openpath) { CompositeMap link = new CompositeMap(IProperties.LINK); String id = genLinkID(link, session); link.put(IProperties.url, "${/request/@context_path}/" + openpath); link.put(IProperties.COMPONENT_TYPE, IProperties.LINK); link.put(IProperties.id, id); return link; } private String genLinkID(CompositeMap link, BuilderSession session) { return session.getIDGenerator().genLinkID(IProperties.LINK); } private void buildLinkContext(BuilderSession session) { ModelMapParser mmp = getModelMapParser(session); CompositeMap currentContext = session.getCurrentContext(); List<CompositeMap> buttons = mmp.getComponents(IProperties.BUTTON); for (CompositeMap button : buttons) { CompositeMap clicker = button .getChild(IProperties.INNER_BUTTONCLICKER); if (clicker != null) { String id = clicker .getString(ComponentInnerProperties.BUTTON_CLICK_ACTIONID); if (IProperties.OPEN.equals(id)) { String openpath = clicker.getString( ComponentInnerProperties.OPEN_PATH, ""); if (openpath.endsWith(".uip")) { openpath = openpath.replaceAll(".uip", ".screen"); } CompositeMap link = genLinkContext(clicker, session, openpath); currentContext.addChild(link); clicker.put(IProperties.LINK_ID, link.getString(IProperties.id, "")); } } } List<CompositeMap> renderers = mmp.getComponents(IProperties.renderer); for (CompositeMap renderer : renderers) { String type = renderer.getString( ComponentInnerProperties.RENDERER_TYPE, ""); if (IProperties.PAGE_REDIRECT.equals(type)) { String openpath = renderer.getString( ComponentInnerProperties.OPEN_PATH, ""); if (openpath.endsWith(".uip")) { openpath = Util.getNewLinkFilePath(openpath, "" + session.getConfig(IProperties.FILE_NAME)); } CompositeMap link = genLinkContext(renderer, session, openpath); currentContext.addChild(link); renderer.put(IProperties.LINK_ID, link.getString(IProperties.id, "")); } } } public void actionEvent(String event, BuilderSession session) { if (IProperties.EVENT_CHILDREN.equals(event) && IProperties.VIEW .equalsIgnoreCase(session.getCurrentModel().getString( ComponentInnerProperties.COMPONENT_TYPE, ""))) { buildChildComponent(session); } } }
10,154
0.719815
0.719322
282
35.007092
22.482616
81
false
false
0
0
0
0
0
0
3.574468
false
false
9
42dd08259fe42eadf8f148b1226170b3ff85e5c4
23,733,989,347,545
e065ba9ed2ab16f51004b0bc8c32f3601c7de470
/src/main/java/com/dk/rsale/dao/PurchaseDAO.java
de6d904e708c35ea1c78af4ae9a78fb074aaf3bf
[]
no_license
deepakrgec2005/POS
https://github.com/deepakrgec2005/POS
165fa2ae46a4432dd5243bb5e674bb7026856eca
584b127b68bb0593c04e28826520407aa35cff66
refs/heads/master
2023-07-02T06:47:16.383000
2021-08-10T19:29:38
2021-08-10T19:29:38
361,191,613
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dk.rsale.dao; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import com.dk.rsale.entity.Purchase; public interface PurchaseDAO extends JpaRepository<Purchase, String> { }
UTF-8
Java
270
java
PurchaseDAO.java
Java
[]
null
[]
package com.dk.rsale.dao; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import com.dk.rsale.entity.Purchase; public interface PurchaseDAO extends JpaRepository<Purchase, String> { }
270
0.777778
0.777778
11
22.545454
26.565062
70
false
false
0
0
0
0
0
0
0.636364
false
false
9
fa3825f17c4c9fbabae2f502ee93f253d507bc20
8,409,546,024,650
1e98e8e883b15db8ab4314c840f9c451d19b5843
/tutos-android/UdemyAndroidCero/app/src/main/java/com/example/cliente/udemyandroidcero/App/MyApplication.java
4ec5c8256918cc9c6820e9a09ee37cda4fd85f4c
[]
no_license
alejosg1285/tutos-html-css
https://github.com/alejosg1285/tutos-html-css
622912b1159266f6981d165946a8949f12169977
00654a07a71c17a1b3c7b46e1ad6a2d2382354a0
refs/heads/master
2021-04-29T10:39:34.128000
2018-01-03T13:40:34
2018-01-03T13:40:34
77,642,377
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.cliente.udemyandroidcero.App; import android.app.Application; import android.os.SystemClock; import com.example.cliente.udemyandroidcero.Models.Board; import com.example.cliente.udemyandroidcero.Models.Note; import java.util.concurrent.atomic.AtomicInteger; import io.realm.Realm; import io.realm.RealmConfiguration; import io.realm.RealmObject; import io.realm.RealmResults; /** * Created by Lenovo on 26/04/2017. */ public class MyApplication extends Application { public static AtomicInteger BoardId = new AtomicInteger(); public static AtomicInteger NoteId = new AtomicInteger(); @Override public void onCreate() { super.onCreate(); //Retraza 3sg la carga de la aplicación para ver el splash, si se tuviera una carga excesiva durante la carga de la primera actvidad no seria necesario. SystemClock.sleep(3000); Realm.init(this); setUpRealmConfig(); Realm realm = Realm.getDefaultInstance(); BoardId = getIdByTable(realm, Board.class); NoteId = getIdByTable(realm, Note.class); realm.close(); } private void setUpRealmConfig() { RealmConfiguration config = new RealmConfiguration .Builder() .deleteRealmIfMigrationNeeded() .build(); Realm.setDefaultConfiguration(config); } private <T extends RealmObject> AtomicInteger getIdByTable(Realm realm, Class<T> anyClass) { RealmResults<T> results = realm.where(anyClass).findAll(); return (results.size() > 0) ? new AtomicInteger(results.max("id").intValue()) : new AtomicInteger(); } }
UTF-8
Java
1,670
java
MyApplication.java
Java
[ { "context": ";\nimport io.realm.RealmResults;\n\n/**\n * Created by Lenovo on 26/04/2017.\n */\n\npublic class MyApplication ex", "end": 425, "score": 0.9987361431121826, "start": 419, "tag": "USERNAME", "value": "Lenovo" } ]
null
[]
package com.example.cliente.udemyandroidcero.App; import android.app.Application; import android.os.SystemClock; import com.example.cliente.udemyandroidcero.Models.Board; import com.example.cliente.udemyandroidcero.Models.Note; import java.util.concurrent.atomic.AtomicInteger; import io.realm.Realm; import io.realm.RealmConfiguration; import io.realm.RealmObject; import io.realm.RealmResults; /** * Created by Lenovo on 26/04/2017. */ public class MyApplication extends Application { public static AtomicInteger BoardId = new AtomicInteger(); public static AtomicInteger NoteId = new AtomicInteger(); @Override public void onCreate() { super.onCreate(); //Retraza 3sg la carga de la aplicación para ver el splash, si se tuviera una carga excesiva durante la carga de la primera actvidad no seria necesario. SystemClock.sleep(3000); Realm.init(this); setUpRealmConfig(); Realm realm = Realm.getDefaultInstance(); BoardId = getIdByTable(realm, Board.class); NoteId = getIdByTable(realm, Note.class); realm.close(); } private void setUpRealmConfig() { RealmConfiguration config = new RealmConfiguration .Builder() .deleteRealmIfMigrationNeeded() .build(); Realm.setDefaultConfiguration(config); } private <T extends RealmObject> AtomicInteger getIdByTable(Realm realm, Class<T> anyClass) { RealmResults<T> results = realm.where(anyClass).findAll(); return (results.size() > 0) ? new AtomicInteger(results.max("id").intValue()) : new AtomicInteger(); } }
1,670
0.690833
0.682445
57
28.280703
30.857769
160
false
false
0
0
0
0
0
0
0.491228
false
false
9
ded4bcd5252e820cc81f7e1a05f70e987dd75d86
33,835,752,406,460
fa1d00b1d8cae003adab2c05ddb38d81c64ac045
/src/test/java/API/restassured/RestAssuredPojoIntro.java
95d4a5da3028e0f76d86448c7dc03b796d143512
[]
no_license
erma2008/sampleProject
https://github.com/erma2008/sampleProject
7a62441b030db8d35afa9637892f366ceff317dd
6a3a3fd301e2e312da9c850ad4be14cfa785f8da
refs/heads/master
2022-12-05T16:43:59.038000
2020-09-02T16:20:53
2020-09-02T16:20:53
292,332,723
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package API.restassured; import API.pojo.AllCatsFactsPojo; import API.pojo.PetPojo; import io.restassured.http.ContentType; import io.restassured.response.Response; import org.junit.Assert; import org.junit.Test; import static io.restassured.RestAssured.given; public class RestAssuredPojoIntro { @Test public void getPet(){ Response response= given().accept(ContentType.JSON) .when().get("https://petstore.swagger.io/v2/pet/112233"); response.then().statusCode(200); PetPojo pet=response.getBody().as(PetPojo.class); Assert.assertEquals(112233,pet.getId()); } @Test public void getcatfactsNotByAlexWohlbruck(){ Response response= given().accept(ContentType.JSON) .when().get("https://cat-fact.herokuapp.com/facts/"); response.then().statusCode(200); AllCatsFactsPojo facts=response.getBody().as(AllCatsFactsPojo.class); for(int i=0; i<facts.getAll().size();i++){ if(facts.getAll().get(i).getUser() != null) { if (!facts.getAll().get(i).getUser().getName().getLast().equalsIgnoreCase("Wohlbruck")) { System.out.println(facts.getAll().get(i).getText()); System.out.println("==============================="); } } } } }
UTF-8
Java
1,350
java
RestAssuredPojoIntro.java
Java
[ { "context": "getUser().getName().getLast().equalsIgnoreCase(\"Wohlbruck\")) {\n System.out.println(", "end": 1140, "score": 0.5841699838638306, "start": 1138, "tag": "NAME", "value": "hl" } ]
null
[]
package API.restassured; import API.pojo.AllCatsFactsPojo; import API.pojo.PetPojo; import io.restassured.http.ContentType; import io.restassured.response.Response; import org.junit.Assert; import org.junit.Test; import static io.restassured.RestAssured.given; public class RestAssuredPojoIntro { @Test public void getPet(){ Response response= given().accept(ContentType.JSON) .when().get("https://petstore.swagger.io/v2/pet/112233"); response.then().statusCode(200); PetPojo pet=response.getBody().as(PetPojo.class); Assert.assertEquals(112233,pet.getId()); } @Test public void getcatfactsNotByAlexWohlbruck(){ Response response= given().accept(ContentType.JSON) .when().get("https://cat-fact.herokuapp.com/facts/"); response.then().statusCode(200); AllCatsFactsPojo facts=response.getBody().as(AllCatsFactsPojo.class); for(int i=0; i<facts.getAll().size();i++){ if(facts.getAll().get(i).getUser() != null) { if (!facts.getAll().get(i).getUser().getName().getLast().equalsIgnoreCase("Wohlbruck")) { System.out.println(facts.getAll().get(i).getText()); System.out.println("==============================="); } } } } }
1,350
0.608889
0.594074
43
30.39535
27.611204
105
false
false
0
0
0
0
0
0
0.465116
false
false
9
541e904d625623cd39d3575ec520788c13874beb
33,835,752,403,923
13ded40605ddf4e22147f76615a006b7f4cc9cac
/buildSrc/src/main/java/gradlebuild/VariantsExtension.java
6201015782e3294eb3370e4bbeb88f15584c6e83
[ "Apache-2.0" ]
permissive
gradle/native-platform
https://github.com/gradle/native-platform
7f2fe1df56c6ebb9edef47b22995343cb2a1c52f
c58e7c6b6d6dae26f8209932c1413c23c23515c5
refs/heads/master
2023-08-16T04:36:56.330000
2023-08-07T18:20:43
2023-08-07T18:20:43
5,220,824
28
13
Apache-2.0
false
2023-09-06T09:16:33
2012-07-29T07:40:26
2023-06-06T19:06:56
2023-09-06T09:16:32
2,982
104
41
40
Java
false
false
package gradlebuild; import org.gradle.api.provider.Property; import org.gradle.api.provider.SetProperty; public interface VariantsExtension { Property<String> getGroupId(); Property<String> getArtifactId(); Property<String> getVersion(); /** * List of names of extra variants of this artifact. * * May be empty. */ SetProperty<String> getVariantNames(); }
UTF-8
Java
400
java
VariantsExtension.java
Java
[]
null
[]
package gradlebuild; import org.gradle.api.provider.Property; import org.gradle.api.provider.SetProperty; public interface VariantsExtension { Property<String> getGroupId(); Property<String> getArtifactId(); Property<String> getVersion(); /** * List of names of extra variants of this artifact. * * May be empty. */ SetProperty<String> getVariantNames(); }
400
0.695
0.695
17
22.529411
18.201866
56
false
false
0
0
0
0
0
0
0.411765
false
false
9
6f1007805f2e92bc40d739ee2e2d4312a8a76230
1,889,785,664,732
f0a35b8d5cc33e5735278ef213ea51b3923453cd
/homework/sixth-exercise/src/main/java/ru/kalemsj713/otus/exercise/dao/AuthorDaoImpl.java
c39e7dbad3df22b32118a9e9d6017681c2b318bd
[]
no_license
kalemsj713/2020-02-otus-spring-karagaev
https://github.com/kalemsj713/2020-02-otus-spring-karagaev
2cb57c753790058938d760ddf78d0a5b9f8c7326
8bd9de476d72a48cabdc42c265d242fbea7c6f20
refs/heads/master
2022-01-28T21:48:16.594000
2020-08-07T10:36:16
2020-08-07T10:36:16
243,973,856
0
0
null
false
2022-01-21T23:46:23
2020-02-29T13:29:13
2020-08-07T10:36:21
2022-01-21T23:46:21
224
0
0
12
Java
false
false
package ru.kalemsj713.otus.exercise.dao; import org.hibernate.Hibernate; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import ru.kalemsj713.otus.exercise.domain.Author; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import java.util.Optional; @Transactional @Repository public class AuthorDaoImpl implements AuthorDao { @PersistenceContext private EntityManager em; @Override public Optional<Author> getAuthor(Long id) { Optional<Author> author = Optional.ofNullable(em.find(Author.class, id)); author.ifPresent(value -> Hibernate.initialize(value.getBooks())); return author; } @Override public void deleteAuthor(Long id) { Author author = em.find(Author.class, id); em.remove(author); } @Override public Author saveAuthor(Author author) { if (author.getId() <= 0) { em.persist(author); return author; } else { return em.merge(author); } } }
UTF-8
Java
994
java
AuthorDaoImpl.java
Java
[ { "context": "package ru.kalemsj713.otus.exercise.dao;\n\nimport org.hibernate.Hibernat", "end": 21, "score": 0.9844651818275452, "start": 12, "tag": "USERNAME", "value": "alemsj713" }, { "context": "k.transaction.annotation.Transactional;\nimport ru.kalemsj713.otus.exercise.domain.A...
null
[]
package ru.kalemsj713.otus.exercise.dao; import org.hibernate.Hibernate; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import ru.kalemsj713.otus.exercise.domain.Author; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import java.util.Optional; @Transactional @Repository public class AuthorDaoImpl implements AuthorDao { @PersistenceContext private EntityManager em; @Override public Optional<Author> getAuthor(Long id) { Optional<Author> author = Optional.ofNullable(em.find(Author.class, id)); author.ifPresent(value -> Hibernate.initialize(value.getBooks())); return author; } @Override public void deleteAuthor(Long id) { Author author = em.find(Author.class, id); em.remove(author); } @Override public Author saveAuthor(Author author) { if (author.getId() <= 0) { em.persist(author); return author; } else { return em.merge(author); } } }
994
0.763582
0.756539
42
22.666666
20.95422
75
false
false
0
0
0
0
0
0
1.309524
false
false
9
cc46b7b0c3bfa55e794f28ed6ee99312ef1c0986
18,227,841,205,611
4af888f778789b3f30f5572736d2e7f250e8adb7
/src/main/java/com/springboot/sample/samplespringboot/repositories/LibraryRepositoryCustom.java
8d44e7d13f57aff7b111ae92b877acd09d7fb439
[]
no_license
AbinayaVelusamy/SpringBootPractise
https://github.com/AbinayaVelusamy/SpringBootPractise
3af397f1aa4fba2c5e7482774de43d1b5442f732
5c63fe74b769d0bae4e88bec0c74e2b1101cf15a
refs/heads/master
2023-08-03T22:22:03.127000
2021-08-23T12:56:33
2021-08-23T12:56:33
399,102,233
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.springboot.sample.samplespringboot.repositories; import com.springboot.sample.samplespringboot.restcontrollers.LibraryBean; import java.util.List; public interface LibraryRepositoryCustom { List<LibraryBean> getBooksByAuthor(String authorname); }
UTF-8
Java
264
java
LibraryRepositoryCustom.java
Java
[]
null
[]
package com.springboot.sample.samplespringboot.repositories; import com.springboot.sample.samplespringboot.restcontrollers.LibraryBean; import java.util.List; public interface LibraryRepositoryCustom { List<LibraryBean> getBooksByAuthor(String authorname); }
264
0.848485
0.848485
7
36.714287
27.395069
74
false
false
0
0
0
0
0
0
0.571429
false
false
9
5b07376783d95f406e117a36a949eeab4322b265
29,729,763,680,299
eccdb653b6ae10cbf5fc5c7c38b4f636b33311b2
/stack/src/com/edu/view/AuditServlet.java
ca94853eb0a5cb0f134e7bc3a27244cdd1fed965
[]
no_license
tzl520/stack
https://github.com/tzl520/stack
5d47f12d1dd78cf295e7e28398d99cf2df28753f
0f80e5b3d906156d07fc5ae530689041a4c0a708
refs/heads/master
2022-12-28T20:17:20.750000
2020-10-14T11:06:04
2020-10-14T11:06:04
303,988,226
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.edu.view; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.edu.bean.Audit; import com.edu.constant.Constance; import com.edu.service.AuditService; import com.edu.service.ChineseMenuService; import com.edu.service.impl.AuditServiceImpl; import com.edu.service.impl.ChineseMenuServiceImpl; /** * Servlet implementation class AuditServlet */ public class AuditServlet extends HttpServlet { private static final long serialVersionUID = 1L; @Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("UTF-8"); String method = req.getParameter("method"); if("show".equals(method)){ show(req,resp); }else if("adopt".equals(method)){ adopt(req,resp); }else if("failed".equals(method)){ failed(req,resp); } } private void failed(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String pageNoStr = req.getParameter("pageNo"); int pageNo = 1; if(null != pageNoStr && pageNoStr.trim().length() > 0) { pageNo = Integer.parseInt(pageNoStr); } String ids = req.getParameter("id"); int id = 0; if(null != ids && ids.trim().length() != 0){ id = Integer.parseInt(ids); } try { AuditService auditService = new AuditServiceImpl(); auditService.deleteById(id); req.setAttribute("pageNo", pageNo); resp.sendRedirect(req.getContextPath()+"/Audit?method=show&pageNo="+pageNo); } catch (Exception e) { e.printStackTrace(); } } private void adopt(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String pageNoStr = req.getParameter("pageNo"); int pageNo = 1; if(null != pageNoStr && pageNoStr.trim().length() > 0) { pageNo = Integer.parseInt(pageNoStr); } String ids = req.getParameter("id"); int id = 0; if(null != ids && ids.trim().length() != 0){ id = Integer.parseInt(ids); } try { AuditService auditService = new AuditServiceImpl(); auditService.adopt(id); req.setAttribute("pageNo", pageNo); resp.sendRedirect(req.getContextPath()+"/Audit?method=show&pageNo="+pageNo); } catch (Exception e) { e.printStackTrace(); } } private void show(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String pageNoStr = req.getParameter("pageNo"); int pageNo = 1; if(null != pageNoStr && pageNoStr.trim().length() > 0) { pageNo = Integer.parseInt(pageNoStr); } if(pageNo ==0){ pageNo=1; } try { AuditService auditService = new AuditServiceImpl(); List<Audit> audLsit = auditService.getAll(pageNo); int rowCount = auditService.getCount(); int pageCount = rowCount%Constance.PAGESIZE==0?rowCount/Constance.PAGESIZE:rowCount/Constance.PAGESIZE+1; req.setAttribute("pageNo", pageNo); req.setAttribute("pageCount", pageCount); req.setAttribute("audList", audLsit); req.getRequestDispatcher("Backstage/userAudit.jsp").forward(req, resp); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
UTF-8
Java
3,347
java
AuditServlet.java
Java
[]
null
[]
package com.edu.view; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.edu.bean.Audit; import com.edu.constant.Constance; import com.edu.service.AuditService; import com.edu.service.ChineseMenuService; import com.edu.service.impl.AuditServiceImpl; import com.edu.service.impl.ChineseMenuServiceImpl; /** * Servlet implementation class AuditServlet */ public class AuditServlet extends HttpServlet { private static final long serialVersionUID = 1L; @Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("UTF-8"); String method = req.getParameter("method"); if("show".equals(method)){ show(req,resp); }else if("adopt".equals(method)){ adopt(req,resp); }else if("failed".equals(method)){ failed(req,resp); } } private void failed(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String pageNoStr = req.getParameter("pageNo"); int pageNo = 1; if(null != pageNoStr && pageNoStr.trim().length() > 0) { pageNo = Integer.parseInt(pageNoStr); } String ids = req.getParameter("id"); int id = 0; if(null != ids && ids.trim().length() != 0){ id = Integer.parseInt(ids); } try { AuditService auditService = new AuditServiceImpl(); auditService.deleteById(id); req.setAttribute("pageNo", pageNo); resp.sendRedirect(req.getContextPath()+"/Audit?method=show&pageNo="+pageNo); } catch (Exception e) { e.printStackTrace(); } } private void adopt(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String pageNoStr = req.getParameter("pageNo"); int pageNo = 1; if(null != pageNoStr && pageNoStr.trim().length() > 0) { pageNo = Integer.parseInt(pageNoStr); } String ids = req.getParameter("id"); int id = 0; if(null != ids && ids.trim().length() != 0){ id = Integer.parseInt(ids); } try { AuditService auditService = new AuditServiceImpl(); auditService.adopt(id); req.setAttribute("pageNo", pageNo); resp.sendRedirect(req.getContextPath()+"/Audit?method=show&pageNo="+pageNo); } catch (Exception e) { e.printStackTrace(); } } private void show(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String pageNoStr = req.getParameter("pageNo"); int pageNo = 1; if(null != pageNoStr && pageNoStr.trim().length() > 0) { pageNo = Integer.parseInt(pageNoStr); } if(pageNo ==0){ pageNo=1; } try { AuditService auditService = new AuditServiceImpl(); List<Audit> audLsit = auditService.getAll(pageNo); int rowCount = auditService.getCount(); int pageCount = rowCount%Constance.PAGESIZE==0?rowCount/Constance.PAGESIZE:rowCount/Constance.PAGESIZE+1; req.setAttribute("pageNo", pageNo); req.setAttribute("pageCount", pageCount); req.setAttribute("audList", audLsit); req.getRequestDispatcher("Backstage/userAudit.jsp").forward(req, resp); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
3,347
0.703018
0.698237
105
30.87619
23.518461
112
false
false
0
0
0
0
0
0
2.361905
false
false
9
a8ed114cb54df73192fe65cc9357b4f25ad9760c
764,504,181,732
463e2e20854ae734a5ce6ea966d5758bb4ef033e
/src/main/java/com/briup/estore2/web/servlet/ConfirmOrderServlet.java
5d987c757d95fea4b08b2388e98ce309eb0b5219
[]
no_license
bstlili/estore_repository
https://github.com/bstlili/estore_repository
94d796d72e3d3f2850a40d31c38f437ea1f02905
bb853acce0e75d0c51aa5378d09d544d0ca1d60a
refs/heads/master
2021-06-13T15:49:44.191000
2019-05-28T08:48:49
2019-05-28T08:48:49
188,990,514
0
0
null
false
2021-04-22T18:19:27
2019-05-28T08:48:03
2019-05-28T08:49:37
2021-04-22T18:19:27
2,846
0
0
2
CSS
false
false
package com.briup.estore2.web.servlet; import java.io.IOException; import java.util.Date; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.briup.estore2.bean.Customer; import com.briup.estore2.bean.OrderForm; import com.briup.estore2.bean.Shipaddress; import com.briup.estore2.bean.ShoppingCar; import com.briup.estore2.service.OrderFormService; import com.briup.estore2.service.ShipaddressService; import com.briup.estore2.service.impl.OrderFormServiceImpl; import com.briup.estore2.service.impl.ShipaddressServiceImpl; import com.briup.estore2.util.exception.OrderFormException; import com.briup.estore2.util.exception.ShipaddressException; /** * Servlet implementation class ConfirmOrderServlet */ @WebServlet("/ConfirmOrderServlet") public class ConfirmOrderServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public ConfirmOrderServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String sid = request.getParameter("sid"); Long shipId = Long.parseLong(sid); HttpSession session = request.getSession(); Customer customer = (Customer) session.getAttribute("customer"); ShoppingCar shoppingCar = (ShoppingCar) session.getAttribute("shoppingCar"); Shipaddress shipaddress = new Shipaddress(); if (shipId==1) { shipaddress.setShipuname(customer.getName()); shipaddress.setPhone(customer.getTelephone()); shipaddress.setAdres(customer.getAddress()); shipaddress.setCustomer(customer); }else{ ShipaddressService service = new ShipaddressServiceImpl(); try { shipaddress = service.findShipaddressById(shipId); } catch (ShipaddressException e) { e.printStackTrace(); } } OrderForm order = new OrderForm(); order.setCost(shoppingCar.getCost()); order.setOrderDate(new Date()); order.setCustomer(customer); order.setOrderLine(shoppingCar.getOrderLine().values()); order.setShipaddress(shipaddress); request.getSession().setAttribute("order", order); System.out.println(order); OrderFormService service = new OrderFormServiceImpl(); try { service.confirmOrder(order); //清空购物车 shoppingCar.clear(); } catch (OrderFormException e) { e.printStackTrace(); } //页面跳转 response.sendRedirect("confirmSuc.jsp"); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
GB18030
Java
3,068
java
ConfirmOrderServlet.java
Java
[]
null
[]
package com.briup.estore2.web.servlet; import java.io.IOException; import java.util.Date; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.briup.estore2.bean.Customer; import com.briup.estore2.bean.OrderForm; import com.briup.estore2.bean.Shipaddress; import com.briup.estore2.bean.ShoppingCar; import com.briup.estore2.service.OrderFormService; import com.briup.estore2.service.ShipaddressService; import com.briup.estore2.service.impl.OrderFormServiceImpl; import com.briup.estore2.service.impl.ShipaddressServiceImpl; import com.briup.estore2.util.exception.OrderFormException; import com.briup.estore2.util.exception.ShipaddressException; /** * Servlet implementation class ConfirmOrderServlet */ @WebServlet("/ConfirmOrderServlet") public class ConfirmOrderServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public ConfirmOrderServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String sid = request.getParameter("sid"); Long shipId = Long.parseLong(sid); HttpSession session = request.getSession(); Customer customer = (Customer) session.getAttribute("customer"); ShoppingCar shoppingCar = (ShoppingCar) session.getAttribute("shoppingCar"); Shipaddress shipaddress = new Shipaddress(); if (shipId==1) { shipaddress.setShipuname(customer.getName()); shipaddress.setPhone(customer.getTelephone()); shipaddress.setAdres(customer.getAddress()); shipaddress.setCustomer(customer); }else{ ShipaddressService service = new ShipaddressServiceImpl(); try { shipaddress = service.findShipaddressById(shipId); } catch (ShipaddressException e) { e.printStackTrace(); } } OrderForm order = new OrderForm(); order.setCost(shoppingCar.getCost()); order.setOrderDate(new Date()); order.setCustomer(customer); order.setOrderLine(shoppingCar.getOrderLine().values()); order.setShipaddress(shipaddress); request.getSession().setAttribute("order", order); System.out.println(order); OrderFormService service = new OrderFormServiceImpl(); try { service.confirmOrder(order); //清空购物车 shoppingCar.clear(); } catch (OrderFormException e) { e.printStackTrace(); } //页面跳转 response.sendRedirect("confirmSuc.jsp"); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
3,068
0.762951
0.758689
94
31.446808
25.55995
119
false
false
0
0
0
0
0
0
1.819149
false
false
9
ab91683cdb825f86d68bf00f7df371a98629a42b
5,033,701,722,003
68564c5a6a618c23ca962289fd35c05d97b46b1e
/src/weixin/promotion/service/MemberCouponServiceI.java
df9aa14f1ac14862913ff01286dc669f7c7b2f40
[]
no_license
admindxh/test3
https://github.com/admindxh/test3
87f10be33242d990f6d6c58bc4bb4eb2eb81e5aa
3193695af80cce7822ed84b645486e0ce9f11239
refs/heads/master
2021-01-18T23:26:28.456000
2016-07-22T06:15:27
2016-07-22T06:15:27
34,147,755
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package weixin.promotion.service; import org.jeecgframework.core.common.service.CommonService; public abstract interface MemberCouponServiceI extends CommonService { }
UTF-8
Java
175
java
MemberCouponServiceI.java
Java
[]
null
[]
package weixin.promotion.service; import org.jeecgframework.core.common.service.CommonService; public abstract interface MemberCouponServiceI extends CommonService { }
175
0.828571
0.828571
7
23.285715
28.080061
68
false
false
0
0
0
0
0
0
0.285714
false
false
9
6ae169a188f1c2ceb788db88bbac30c62f4abefa
2,327,872,276,929
6a58f6b6542b9132b57c8acc5b1c5cd4795a2ca0
/src/main/java/uk/co/wehavecookies56/kk/common/item/ItemDriveOrb.java
3005d2e3d206ac351883c2168758f2777ce8ab36
[]
no_license
Wehavecookies56/Kingdom-Keys-Re-Coded-1.9-WIP
https://github.com/Wehavecookies56/Kingdom-Keys-Re-Coded-1.9-WIP
fa21369307344db34602c13f7ff853486552a5d3
e3f15fb4c774cb810634663ca21ea0f0e2956439
refs/heads/master
2021-01-10T14:36:19.690000
2016-05-10T02:17:19
2016-05-10T02:17:19
54,055,284
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package uk.co.wehavecookies56.kk.common.item; import java.util.List; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class ItemDriveOrb extends Item { public ItemDriveOrb () { setMaxStackSize(1); } @Override public void addInformation (ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) { if (stack.hasTagCompound()) { int amount = stack.getTagCompound().getInteger("amount"); tooltip.add("" + amount); } } @Override public void getSubItems (Item itemIn, CreativeTabs tab, List subItems) {} }
UTF-8
Java
663
java
ItemDriveOrb.java
Java
[ { "context": "package uk.co.wehavecookies56.kk.common.item;\n\nimport java.util.List;\n\nimport n", "end": 29, "score": 0.9787144660949707, "start": 14, "tag": "USERNAME", "value": "wehavecookies56" } ]
null
[]
package uk.co.wehavecookies56.kk.common.item; import java.util.List; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class ItemDriveOrb extends Item { public ItemDriveOrb () { setMaxStackSize(1); } @Override public void addInformation (ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) { if (stack.hasTagCompound()) { int amount = stack.getTagCompound().getInteger("amount"); tooltip.add("" + amount); } } @Override public void getSubItems (Item itemIn, CreativeTabs tab, List subItems) {} }
663
0.758673
0.754148
26
24.5
26.083076
102
false
false
0
0
0
0
0
0
1.269231
false
false
9
0c2746aa4a95f5eb3691fb34d76d6b4aade96ea8
15,796,889,733,200
37e755a84a5d0097adc3cf861d440d2ff7e40b7b
/src/com/situ/day36/C3P0Test.java
7a428f52c131c4de068415d5cd79bdd4c450149b
[]
no_license
GaoChengQuan/Java1711Web
https://github.com/GaoChengQuan/Java1711Web
e0b415e470dbaf77058d0e8fac6108fd00ad9b93
d9986e7e522fd2b676439f2aa0652790a478e28e
refs/heads/master
2021-09-04T11:29:24.153000
2018-01-18T09:09:38
2018-01-18T09:09:38
115,404,977
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.situ.day36; import java.sql.Connection; import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import javax.sql.DataSource; import org.junit.Test; import com.mchange.v2.c3p0.ComboPooledDataSource; import com.situ.student.entity.Student; import com.situ.student.util.JDBCUtil; public class C3P0Test { @Test public void testFindAll() { Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; try { connection = C3P0Util.getConnection(); String sql = "select * from student;"; preparedStatement = connection.prepareStatement(sql); resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { Integer id = resultSet.getInt("id"); String name = resultSet.getString("name"); Integer age = resultSet.getInt("age"); String address = resultSet.getString("address"); String gender = resultSet.getString("gender"); Date birthday = resultSet.getDate("birthday");// java.sql.Date Student student = new Student(id, name, age, gender, address, new java.util.Date(), birthday); System.out.println(student); } } catch (SQLException e) { e.printStackTrace(); } finally { C3P0Util.release(connection, preparedStatement, resultSet); } } @Test public void testFindAll1() { Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; //创建C3P0数据库连接池 DataSource dataSource = new ComboPooledDataSource(); try { connection = dataSource.getConnection(); String sql = "select * from student;"; preparedStatement = connection.prepareStatement(sql); resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { Integer id = resultSet.getInt("id"); String name = resultSet.getString("name"); Integer age = resultSet.getInt("age"); String address = resultSet.getString("address"); String gender = resultSet.getString("gender"); Date birthday = resultSet.getDate("birthday");// java.sql.Date Student student = new Student(id, name, age, gender, address, new java.util.Date(), birthday); System.out.println(student); } } catch (SQLException e) { e.printStackTrace(); } finally { JDBCUtil.close(null, preparedStatement, resultSet); } } }
UTF-8
Java
2,381
java
C3P0Test.java
Java
[]
null
[]
package com.situ.day36; import java.sql.Connection; import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import javax.sql.DataSource; import org.junit.Test; import com.mchange.v2.c3p0.ComboPooledDataSource; import com.situ.student.entity.Student; import com.situ.student.util.JDBCUtil; public class C3P0Test { @Test public void testFindAll() { Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; try { connection = C3P0Util.getConnection(); String sql = "select * from student;"; preparedStatement = connection.prepareStatement(sql); resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { Integer id = resultSet.getInt("id"); String name = resultSet.getString("name"); Integer age = resultSet.getInt("age"); String address = resultSet.getString("address"); String gender = resultSet.getString("gender"); Date birthday = resultSet.getDate("birthday");// java.sql.Date Student student = new Student(id, name, age, gender, address, new java.util.Date(), birthday); System.out.println(student); } } catch (SQLException e) { e.printStackTrace(); } finally { C3P0Util.release(connection, preparedStatement, resultSet); } } @Test public void testFindAll1() { Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; //创建C3P0数据库连接池 DataSource dataSource = new ComboPooledDataSource(); try { connection = dataSource.getConnection(); String sql = "select * from student;"; preparedStatement = connection.prepareStatement(sql); resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { Integer id = resultSet.getInt("id"); String name = resultSet.getString("name"); Integer age = resultSet.getInt("age"); String address = resultSet.getString("address"); String gender = resultSet.getString("gender"); Date birthday = resultSet.getDate("birthday");// java.sql.Date Student student = new Student(id, name, age, gender, address, new java.util.Date(), birthday); System.out.println(student); } } catch (SQLException e) { e.printStackTrace(); } finally { JDBCUtil.close(null, preparedStatement, resultSet); } } }
2,381
0.710359
0.70444
84
27.154762
22.572895
98
false
false
0
0
0
0
0
0
2.690476
false
false
9
2401257e96ba0dfa72b3751b7435e7a1e09b4224
7,017,976,612,305
29345337bf86edc938f3b5652702d551bfc3f11a
/core/src/main/java/com/alibaba/alink/params/regression/IsotonicRegTrainParams.java
31fca8ad9ab85b96ec1b5e4568ed92237cdb2ac4
[ "Apache-2.0" ]
permissive
vacaly/Alink
https://github.com/vacaly/Alink
32b71ac4572ae3509d343e3d1ff31a4da2321b6d
edb543ee05260a1dd314b11384d918fa1622d9c1
refs/heads/master
2023-07-21T03:29:07.612000
2023-07-12T12:41:31
2023-07-12T12:41:31
283,079,072
0
0
Apache-2.0
true
2020-07-28T02:46:14
2020-07-28T02:46:13
2020-07-27T16:21:11
2020-07-23T06:28:23
4,017
0
0
0
null
false
false
package com.alibaba.alink.params.regression; import org.apache.flink.ml.api.misc.param.ParamInfo; import org.apache.flink.ml.api.misc.param.ParamInfoFactory; import com.alibaba.alink.common.annotation.DescCn; import com.alibaba.alink.common.annotation.NameCn; import com.alibaba.alink.params.shared.colname.HasLabelCol; import com.alibaba.alink.params.shared.colname.HasVectorColDefaultAsNull; import com.alibaba.alink.params.shared.colname.HasWeightColDefaultAsNull; import com.alibaba.alink.params.validators.MinValidator; /** * Params for IsotonicRegressionTrainer. */ public interface IsotonicRegTrainParams<T> extends HasLabelCol <T>, HasWeightColDefaultAsNull <T>, HasVectorColDefaultAsNull <T> { @NameCn("特征列名") @DescCn("特征列的名称") ParamInfo <String> FEATURE_COL = ParamInfoFactory .createParamInfo("featureCol", String.class) .setDescription("Name of the feature column。") .setAlias(new String[] {"featureColName"}) .setHasDefaultValue(null) .build(); @NameCn("输出序列是否") @DescCn("输出序列是否递增") ParamInfo <Boolean> ISOTONIC = ParamInfoFactory .createParamInfo("isotonic", Boolean.class) .setDescription("If true, the output sequence should be increasing!") .setHasDefaultValue(true) .build(); @NameCn("训练特征所在维度") @DescCn("训练特征在输入向量的维度索引") ParamInfo <Integer> FEATURE_INDEX = ParamInfoFactory .createParamInfo("featureIndex", Integer.class) .setDescription("Feature index in the vector.") .setHasDefaultValue(0) .setValidator(new MinValidator <>(0)) .build(); default String getFeatureCol() { return get(FEATURE_COL); } default T setFeatureCol(String value) { return set(FEATURE_COL, value); } default Boolean getIsotonic() { return get(ISOTONIC); } default T setIsotonic(Boolean value) { return set(ISOTONIC, value); } default Integer getFeatureIndex() { return get(FEATURE_INDEX); } default T setFeatureIndex(Integer value) { return set(FEATURE_INDEX, value); } }
UTF-8
Java
2,037
java
IsotonicRegTrainParams.java
Java
[]
null
[]
package com.alibaba.alink.params.regression; import org.apache.flink.ml.api.misc.param.ParamInfo; import org.apache.flink.ml.api.misc.param.ParamInfoFactory; import com.alibaba.alink.common.annotation.DescCn; import com.alibaba.alink.common.annotation.NameCn; import com.alibaba.alink.params.shared.colname.HasLabelCol; import com.alibaba.alink.params.shared.colname.HasVectorColDefaultAsNull; import com.alibaba.alink.params.shared.colname.HasWeightColDefaultAsNull; import com.alibaba.alink.params.validators.MinValidator; /** * Params for IsotonicRegressionTrainer. */ public interface IsotonicRegTrainParams<T> extends HasLabelCol <T>, HasWeightColDefaultAsNull <T>, HasVectorColDefaultAsNull <T> { @NameCn("特征列名") @DescCn("特征列的名称") ParamInfo <String> FEATURE_COL = ParamInfoFactory .createParamInfo("featureCol", String.class) .setDescription("Name of the feature column。") .setAlias(new String[] {"featureColName"}) .setHasDefaultValue(null) .build(); @NameCn("输出序列是否") @DescCn("输出序列是否递增") ParamInfo <Boolean> ISOTONIC = ParamInfoFactory .createParamInfo("isotonic", Boolean.class) .setDescription("If true, the output sequence should be increasing!") .setHasDefaultValue(true) .build(); @NameCn("训练特征所在维度") @DescCn("训练特征在输入向量的维度索引") ParamInfo <Integer> FEATURE_INDEX = ParamInfoFactory .createParamInfo("featureIndex", Integer.class) .setDescription("Feature index in the vector.") .setHasDefaultValue(0) .setValidator(new MinValidator <>(0)) .build(); default String getFeatureCol() { return get(FEATURE_COL); } default T setFeatureCol(String value) { return set(FEATURE_COL, value); } default Boolean getIsotonic() { return get(ISOTONIC); } default T setIsotonic(Boolean value) { return set(ISOTONIC, value); } default Integer getFeatureIndex() { return get(FEATURE_INDEX); } default T setFeatureIndex(Integer value) { return set(FEATURE_INDEX, value); } }
2,037
0.761194
0.760165
69
27.15942
21.411512
73
false
false
0
0
0
0
0
0
1.318841
false
false
9
365898570758bc797fd26e309267a17a2f06ec80
2,327,872,280,643
c561879af792df60f5306ea85fa940252564563e
/src/main/java/com/ironhack/bankingSystem/repository/Accounts/CheckingRepository.java
6514bfc446d337a909aa593bd851c928263da137
[]
no_license
julialaria/Midterm-Project
https://github.com/julialaria/Midterm-Project
c0e79faa524b9c203b4ad4cd321054ef504a9b1e
be9abeccf819ca39416cd3b9f348fc3767e4a7ad
refs/heads/main
2023-03-05T16:02:28.765000
2021-02-14T20:53:15
2021-02-14T20:53:15
338,832,506
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ironhack.bankingSystem.repository.Accounts; import com.ironhack.bankingSystem.model.Account.Checking; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface CheckingRepository extends JpaRepository<Checking, Integer> { }
UTF-8
Java
321
java
CheckingRepository.java
Java
[]
null
[]
package com.ironhack.bankingSystem.repository.Accounts; import com.ironhack.bankingSystem.model.Account.Checking; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface CheckingRepository extends JpaRepository<Checking, Integer> { }
321
0.856698
0.856698
9
34.666668
29.412771
78
false
false
0
0
0
0
0
0
0.555556
false
false
9
e652773514dbc2ec0da19fee330bea23da16b11a
30,348,238,922,476
1dc580618fe76607c15c9be34d5c9a3f7c87ed19
/chapter11_activemq/src/main/java/code/me/chapter11_activemq/service/impl/MoodServiceImpl.java
235ee5834ac22436e583a01c15ce063c42146414
[]
no_license
nayunfeng/stepbystep_springboot
https://github.com/nayunfeng/stepbystep_springboot
0450b6b7cad9ece41564fa861c9434bd3fbc26b7
06f33bbec12f493c2a6d929abb512e2cd75e598a
refs/heads/master
2020-07-29T17:39:59.287000
2019-10-09T08:03:40
2019-10-09T08:03:40
209,905,055
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package code.me.chapter11_activemq.service.impl; import code.me.chapter11_activemq.dao.MoodRepository; import code.me.chapter11_activemq.domain.Mood; import code.me.chapter11_activemq.jms.MoodProducer; import code.me.chapter11_activemq.service.MoodService; import org.apache.activemq.command.ActiveMQQueue; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.AsyncResult; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.stereotype.Service; import javax.jms.Destination; import java.util.List; import java.util.concurrent.Future; /** * @author nayunfeng * @date 2019/9/27 18:19 * @description */ @Service @EnableAsync public class MoodServiceImpl implements MoodService { @Autowired private MoodRepository moodRepository; @Autowired private MoodProducer moodProducer; @Autowired private static final Destination destination = new ActiveMQQueue("mood.async"); /** * 保存说说 * * @param mood 说说内容 * @return Mood */ @Override public Mood save(Mood mood) { return moodRepository.save(mood); } /** * 异步保存说说 * * @param mood 说说内容 * @return String */ @Override public String asyncSave(Mood mood) { // 往队列mood.async推送消息,消息内容为说说实体 moodProducer.sendMessage(destination, mood); return "success"; } /** * 查询所有说说 * * @return List */ @Override public List<Mood> findAll() { System.out.println("开始做任务"); long startTime = System.currentTimeMillis(); List<Mood> moodList = moodRepository.findAll(); long endTime = System.currentTimeMillis(); System.out.println("完成任务,耗时:" + (endTime - startTime) + "毫秒"); return moodList; } /** * 异步方式查询所有说说 * * @return List */ @Async @Override public Future<List<Mood>> asyncFindAll() { System.out.println("开始做任务"); long startTime = System.currentTimeMillis(); List<Mood> moodList = moodRepository.findAll(); long endTime = System.currentTimeMillis(); System.out.println("完成任务,耗时:" + (endTime - startTime) + "毫秒"); return new AsyncResult<>(moodList); } }
UTF-8
Java
2,506
java
MoodServiceImpl.java
Java
[ { "context": "mport java.util.concurrent.Future;\n\n/**\n * @author nayunfeng\n * @date 2019/9/27 18:19\n * @description\n */\n@Ser", "end": 713, "score": 0.9995676279067993, "start": 704, "tag": "USERNAME", "value": "nayunfeng" } ]
null
[]
package code.me.chapter11_activemq.service.impl; import code.me.chapter11_activemq.dao.MoodRepository; import code.me.chapter11_activemq.domain.Mood; import code.me.chapter11_activemq.jms.MoodProducer; import code.me.chapter11_activemq.service.MoodService; import org.apache.activemq.command.ActiveMQQueue; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.AsyncResult; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.stereotype.Service; import javax.jms.Destination; import java.util.List; import java.util.concurrent.Future; /** * @author nayunfeng * @date 2019/9/27 18:19 * @description */ @Service @EnableAsync public class MoodServiceImpl implements MoodService { @Autowired private MoodRepository moodRepository; @Autowired private MoodProducer moodProducer; @Autowired private static final Destination destination = new ActiveMQQueue("mood.async"); /** * 保存说说 * * @param mood 说说内容 * @return Mood */ @Override public Mood save(Mood mood) { return moodRepository.save(mood); } /** * 异步保存说说 * * @param mood 说说内容 * @return String */ @Override public String asyncSave(Mood mood) { // 往队列mood.async推送消息,消息内容为说说实体 moodProducer.sendMessage(destination, mood); return "success"; } /** * 查询所有说说 * * @return List */ @Override public List<Mood> findAll() { System.out.println("开始做任务"); long startTime = System.currentTimeMillis(); List<Mood> moodList = moodRepository.findAll(); long endTime = System.currentTimeMillis(); System.out.println("完成任务,耗时:" + (endTime - startTime) + "毫秒"); return moodList; } /** * 异步方式查询所有说说 * * @return List */ @Async @Override public Future<List<Mood>> asyncFindAll() { System.out.println("开始做任务"); long startTime = System.currentTimeMillis(); List<Mood> moodList = moodRepository.findAll(); long endTime = System.currentTimeMillis(); System.out.println("完成任务,耗时:" + (endTime - startTime) + "毫秒"); return new AsyncResult<>(moodList); } }
2,506
0.668798
0.659847
89
25.35955
21.246149
83
false
false
0
0
0
0
0
0
0.382022
false
false
9
aef8145de48750da5e80a046f8628b8f159e627f
60,129,555,995
d0dfa1da4a61cf560907d7bd8b6c463b1971a438
/src/org/yuriak/weibo/util/WeiboAttentionUtil.java
358dcadeb89ad2b20922e6ba94c11f664db7537f
[]
no_license
yuriak/DufeDataCrawler
https://github.com/yuriak/DufeDataCrawler
d77c8033dac048f84bb487d79eb59d945bc8d39c
2227b8cee986336023afe330915bbbad49d802fb
refs/heads/master
2020-05-20T23:55:09.690000
2015-09-11T13:12:13
2015-09-11T13:12:13
40,760,290
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.yuriak.weibo.util; import java.io.File; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; import org.apache.commons.io.FileUtils; import org.apache.http.HttpEntity; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.mime.Header; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.openqa.selenium.remote.html5.AddApplicationCache; import org.yuriak.weibo.config.CommonValues; import cn.edu.hfut.dmic.webcollector.weiboapi.WeiboCN; public class WeiboAttentionUtil { public static void addAttention(String uid,String cookie) throws Exception { // 创建默认的httpClient实例. CloseableHttpClient httpclient = HttpClients.createDefault(); // 创建httppost HttpPost httppost = new HttpPost("http://m.weibo.cn/attentionDeal/addAttention"); //伪造http头,伪装成浏览器 httppost.addHeader("cookie", cookie); httppost.addHeader("Referer","http://m.weibo.cn/u/"+uid); httppost.addHeader("Origin","http://m.weibo.cn"); httppost.addHeader("Host", "m.weibo.cn"); httppost.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36"); // 创建参数队列 List<BasicNameValuePair> formparams = new ArrayList<BasicNameValuePair>(); formparams.add(new BasicNameValuePair("uid", uid)); UrlEncodedFormEntity uefEntity; try { uefEntity = new UrlEncodedFormEntity(formparams, "UTF-8"); httppost.setEntity(uefEntity); System.out.println("executing request " + httppost.getURI()); CloseableHttpResponse response = httpclient.execute(httppost); try { HttpEntity entity = response.getEntity(); if (entity != null) { //如果返回值里有ok:1就说明加关注成功 System.out.println("Response content: " + EntityUtils.toString(entity, "UTF-8")); } } finally { response.close(); } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { // 关闭连接,释放资源 try { httpclient.close(); } catch (IOException e) { e.printStackTrace(); } } } public static void addAllAttention(final List<String> uids,final String cookie){ //这里本来想用多线程然后配合线程等待来降低速度,后来发现普通速度可以不被封号,所以就没再动 Thread thread=new Thread(new Runnable() { @Override public void run() { // TODO Auto-generated method stub for (int i = 0; i < uids.size(); i++) { try { addAttention(uids.get(i),cookie); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }); thread.start(); } public static void main(String[] args) throws IOException { // List<String> users=FileUtils.readLines(new File("data/users.txt")); // System.out.println(users.size()); // addAllAttention(users); } }
UTF-8
Java
3,908
java
WeiboAttentionUtil.java
Java
[]
null
[]
package org.yuriak.weibo.util; import java.io.File; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; import org.apache.commons.io.FileUtils; import org.apache.http.HttpEntity; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.mime.Header; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.openqa.selenium.remote.html5.AddApplicationCache; import org.yuriak.weibo.config.CommonValues; import cn.edu.hfut.dmic.webcollector.weiboapi.WeiboCN; public class WeiboAttentionUtil { public static void addAttention(String uid,String cookie) throws Exception { // 创建默认的httpClient实例. CloseableHttpClient httpclient = HttpClients.createDefault(); // 创建httppost HttpPost httppost = new HttpPost("http://m.weibo.cn/attentionDeal/addAttention"); //伪造http头,伪装成浏览器 httppost.addHeader("cookie", cookie); httppost.addHeader("Referer","http://m.weibo.cn/u/"+uid); httppost.addHeader("Origin","http://m.weibo.cn"); httppost.addHeader("Host", "m.weibo.cn"); httppost.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36"); // 创建参数队列 List<BasicNameValuePair> formparams = new ArrayList<BasicNameValuePair>(); formparams.add(new BasicNameValuePair("uid", uid)); UrlEncodedFormEntity uefEntity; try { uefEntity = new UrlEncodedFormEntity(formparams, "UTF-8"); httppost.setEntity(uefEntity); System.out.println("executing request " + httppost.getURI()); CloseableHttpResponse response = httpclient.execute(httppost); try { HttpEntity entity = response.getEntity(); if (entity != null) { //如果返回值里有ok:1就说明加关注成功 System.out.println("Response content: " + EntityUtils.toString(entity, "UTF-8")); } } finally { response.close(); } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { // 关闭连接,释放资源 try { httpclient.close(); } catch (IOException e) { e.printStackTrace(); } } } public static void addAllAttention(final List<String> uids,final String cookie){ //这里本来想用多线程然后配合线程等待来降低速度,后来发现普通速度可以不被封号,所以就没再动 Thread thread=new Thread(new Runnable() { @Override public void run() { // TODO Auto-generated method stub for (int i = 0; i < uids.size(); i++) { try { addAttention(uids.get(i),cookie); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }); thread.start(); } public static void main(String[] args) throws IOException { // List<String> users=FileUtils.readLines(new File("data/users.txt")); // System.out.println(users.size()); // addAllAttention(users); } }
3,908
0.647691
0.638829
98
37
25.804209
154
false
false
0
0
0
0
0
0
1.489796
false
false
9
99b202e1df6bd8e0a0ed32b2771744bfdfe5c82b
35,510,789,607,563
9326efbf4f57f1705f84ec726299c92ebaab9e23
/example/android/app/src/main/java/cn/jiguang/jmlink_flutter_plugin_example/WelcomeActivity.java
4232b29226ce4a11e2bcb168f7bfd26f8743463c
[ "MIT" ]
permissive
jpush/jmlink-flutter-plugin
https://github.com/jpush/jmlink-flutter-plugin
216adbf0cf8465acd80b61c71c6009885800e6f4
cdf90e01e43cad7c660e250c8c38f2232d44ee8b
refs/heads/master
2023-08-03T15:07:09.053000
2023-07-28T04:15:51
2023-07-28T04:15:51
219,950,273
19
10
MIT
false
2023-07-28T04:15:52
2019-11-06T08:42:19
2023-06-20T16:41:34
2023-07-28T04:15:51
127
17
10
8
Dart
false
false
package cn.jiguang.jmlink_flutter_plugin_example; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import cn.jiguang.jmlink_flutter_plugin.JmlinkFlutterPlugin; public class WelcomeActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { Log.d("| WelcomeActivity | - ","onCreate:"); super.onCreate(savedInstanceState); JmlinkFlutterPlugin.setData(getIntent().getData()); Intent intent = new Intent(this,MainActivity.class); startActivity(intent); finish(); } //@Override protected void onDestroy() { Log.d("| WelcomeActivity | - ","onDestroy:"); super.onDestroy(); } protected void onNewIntent(Intent intent) { Log.d("| WelcomeActivity | - ","onNewIntent:"); super.onNewIntent(intent); setIntent(intent); } }
UTF-8
Java
932
java
WelcomeActivity.java
Java
[]
null
[]
package cn.jiguang.jmlink_flutter_plugin_example; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import cn.jiguang.jmlink_flutter_plugin.JmlinkFlutterPlugin; public class WelcomeActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { Log.d("| WelcomeActivity | - ","onCreate:"); super.onCreate(savedInstanceState); JmlinkFlutterPlugin.setData(getIntent().getData()); Intent intent = new Intent(this,MainActivity.class); startActivity(intent); finish(); } //@Override protected void onDestroy() { Log.d("| WelcomeActivity | - ","onDestroy:"); super.onDestroy(); } protected void onNewIntent(Intent intent) { Log.d("| WelcomeActivity | - ","onNewIntent:"); super.onNewIntent(intent); setIntent(intent); } }
932
0.667382
0.667382
35
25.628571
21.454384
60
false
false
0
0
0
0
0
0
0.771429
false
false
9
86c60b6623fa834c40d1dc631b6c17f515be9b94
34,462,817,591,152
a585b44e69484abed0aa9d33dc61293a8881f93c
/src/main/java/com/clayoverwind/designpattern/structure/proxy/Player.java
3493a64d2f1701e0f3602b8e3da695e18c643856
[]
no_license
clayandgithub/designpattern
https://github.com/clayandgithub/designpattern
48d76a4ab51d585dea7a39a8debeb4a20a634032
fd7949d382111d4ba4e0e88ec24c3d100b542896
refs/heads/master
2021-01-21T10:25:58.912000
2017-06-19T03:10:22
2017-06-19T03:10:22
91,689,964
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.clayoverwind.designpattern.structure.proxy; /** * @author clayoverwind * @version 2017/5/26 * @E-mail clayanddev@163.com */ public interface Player { String play(); }
UTF-8
Java
188
java
Player.java
Java
[ { "context": "ind.designpattern.structure.proxy;\n\n/**\n * @author clayoverwind\n * @version 2017/5/26\n * @E-mail clayanddev@163.c", "end": 84, "score": 0.9996007084846497, "start": 72, "tag": "USERNAME", "value": "clayoverwind" }, { "context": "thor clayoverwind\n * @version 2017/...
null
[]
package com.clayoverwind.designpattern.structure.proxy; /** * @author clayoverwind * @version 2017/5/26 * @E-mail <EMAIL> */ public interface Player { String play(); }
177
0.707447
0.654255
10
17.799999
16.234531
55
false
false
0
0
0
0
0
0
0.2
false
false
9
44b0cc6b38aba0e4e4dffe7d229b935a74f41a22
6,768,868,468,212
95f715651fd6efb06b8d8b080f677a8d82e76969
/src/main/java/shop/mapper/ShoppingCartMapper.java
03d88208e08e3609d1f2140e74fa9970ddf17b99
[]
no_license
ChenChanandy/shop
https://github.com/ChenChanandy/shop
16b11d0c31a2af7492de5d50fd86b58106c4f344
5b0977f25691dc4a034b7eab7c44d1c1172c4104
refs/heads/master
2020-03-28T12:30:58.081000
2018-09-11T11:25:10
2018-09-11T11:25:10
141,095,748
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package shop.mapper; import java.util.List; import org.apache.ibatis.annotations.Param; import shop.model.ShoppingCartItem; public interface ShoppingCartMapper { Integer findItemQuantity(@Param("userId") Long userId, @Param("cellphoneId") Long cellphoneId); void createItem(@Param("userId") Long userId, @Param("cellphoneId") Long cellphoneId, @Param("quantity") int quantity); List<ShoppingCartItem> findAllItems(Long userId); void removeItem(@Param("userId") Long userId, @Param("cellphoneId") Long cellphoneId); void deleteItemsByUserId(Long userId); void updateItemQuantity(@Param("userId") Long userId, @Param("cellphoneId") Long cellphoneId, @Param("quantity") int quantity); }
UTF-8
Java
864
java
ShoppingCartMapper.java
Java
[]
null
[]
package shop.mapper; import java.util.List; import org.apache.ibatis.annotations.Param; import shop.model.ShoppingCartItem; public interface ShoppingCartMapper { Integer findItemQuantity(@Param("userId") Long userId, @Param("cellphoneId") Long cellphoneId); void createItem(@Param("userId") Long userId, @Param("cellphoneId") Long cellphoneId, @Param("quantity") int quantity); List<ShoppingCartItem> findAllItems(Long userId); void removeItem(@Param("userId") Long userId, @Param("cellphoneId") Long cellphoneId); void deleteItemsByUserId(Long userId); void updateItemQuantity(@Param("userId") Long userId, @Param("cellphoneId") Long cellphoneId, @Param("quantity") int quantity); }
864
0.625
0.625
29
28.793104
26.278849
68
false
false
0
0
0
0
0
0
0.551724
false
false
9
fdb11c73423470afc2a6ee9450ddcc0f16cad929
35,304,631,183,308
fcce388631824e532c952e1598ab370dc845d2e6
/Cliente/SaukiClient/src/com/sauki/vista/reportes/contabilidad/BalanceGeneralIF.java
e1e98012484b758194b69dd8106b387c7816e620
[]
no_license
Spontecorp-CA/sauki
https://github.com/Spontecorp-CA/sauki
7156e04703ed2b7fbd5d7a8696f43a6a02b53d4a
e4eb33e21dd494989b2a70bb0bffa7ac12465d57
refs/heads/master
2016-07-28T20:46:03.865000
2016-01-14T10:58:57
2016-01-14T10:58:57
27,384,057
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.sauki.vista.reportes.contabilidad; import com.sauki.Contexto; import java.util.logging.Logger; /** * * @author JoseAngel */ public class BalanceGeneralIF extends javax.swing.JInternalFrame { // Crear el logger de la clase para registrar los mensajes ...log file private static final Logger logger = Logger.getLogger(BalanceGeneralIF.class.getName()); // crear instancia de la vista en null private static BalanceGeneralIF instance = null; /** * Creates new form BalanceGeneral */ public BalanceGeneralIF() { initComponents(); setTitle("BALANCE GENERAL"); // Configuración del log para esta clase Contexto.setLoggerHandlers(logger); initBackground(); } // Hacer que siempre se muestre la misma instancia que está activa public static BalanceGeneralIF getInstance() { if (instance == null) { instance = new BalanceGeneralIF(); } return instance; } private void initBackground() { seleccionPanel.setBackground(Contexto.getColor()); reportePanel.setBackground(Contexto.getColor()); botonesPanel.setBackground(Contexto.getColor()); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { backPanel = new javax.swing.JPanel(); jTabbedPane1 = new javax.swing.JTabbedPane(); seleccionPanel = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); periodoFiscalComboBox = new javax.swing.JComboBox(); periodoFiscalCompararCheckBox = new javax.swing.JCheckBox(); periodoFiscalCompararComboBox = new javax.swing.JComboBox(); PeriodoCompararCheckBox = new javax.swing.JCheckBox(); jLabel3 = new javax.swing.JLabel(); cuentasSaldoCeroCheckBox = new javax.swing.JCheckBox(); mostrarCodigoCuentaCheckBox = new javax.swing.JCheckBox(); ajustadoInflacionCheckBox = new javax.swing.JCheckBox(); botonesPanel = new javax.swing.JPanel(); aceptarButton = new javax.swing.JButton(); cancelarButton = new javax.swing.JButton(); nivelCuentasComboBox = new javax.swing.JComboBox(); MostraFechaPagCheckBox = new javax.swing.JCheckBox(); reportePanel = new javax.swing.JPanel(); setBackground(new java.awt.Color(255, 255, 255)); setClosable(true); setIconifiable(true); setMaximizable(true); setResizable(true); backPanel.setBackground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Período Fiscal:"); periodoFiscalComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione", "2015 Enero", "2014 Diciembre", "2014 Noviembre", "2014 Octubre", " " })); periodoFiscalCompararCheckBox.setText("Comparar con el Período:"); periodoFiscalCompararComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione", "2015 Enero", "2014 Diciembre", "2014 Noviembre", "2014 Octubre", " " })); PeriodoCompararCheckBox.setText("Comparar con Presupuesto"); jLabel3.setText("Nivel de Cuestas a Mostrar:"); cuentasSaldoCeroCheckBox.setText("Mostrar Cuentas con Saldo Cero"); mostrarCodigoCuentaCheckBox.setText("Mostrar Código de Cuenta"); ajustadoInflacionCheckBox.setText("Ajustado a Inflación"); aceptarButton.setText("Aceptar"); cancelarButton.setText("Cancelar"); javax.swing.GroupLayout botonesPanelLayout = new javax.swing.GroupLayout(botonesPanel); botonesPanel.setLayout(botonesPanelLayout); botonesPanelLayout.setHorizontalGroup( botonesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, botonesPanelLayout.createSequentialGroup() .addContainerGap(125, Short.MAX_VALUE) .addComponent(aceptarButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(cancelarButton) .addGap(71, 71, 71)) ); botonesPanelLayout.setVerticalGroup( botonesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(botonesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(aceptarButton) .addComponent(cancelarButton)) ); nivelCuentasComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione", "1", "2", "3", "4", "5" })); MostraFechaPagCheckBox.setText("Mostrar Fecha y Página"); javax.swing.GroupLayout seleccionPanelLayout = new javax.swing.GroupLayout(seleccionPanel); seleccionPanel.setLayout(seleccionPanelLayout); seleccionPanelLayout.setHorizontalGroup( seleccionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(seleccionPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(seleccionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(mostrarCodigoCuentaCheckBox) .addComponent(cuentasSaldoCeroCheckBox) .addComponent(PeriodoCompararCheckBox) .addGroup(seleccionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, seleccionPanelLayout.createSequentialGroup() .addGap(21, 21, 21) .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(nivelCuentasComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, seleccionPanelLayout.createSequentialGroup() .addGroup(seleccionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(periodoFiscalCompararCheckBox) .addGroup(seleccionPanelLayout.createSequentialGroup() .addGap(23, 23, 23) .addComponent(jLabel1))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(seleccionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(periodoFiscalCompararComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(periodoFiscalComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addComponent(MostraFechaPagCheckBox) .addComponent(ajustadoInflacionCheckBox)) .addContainerGap(597, Short.MAX_VALUE)) .addGroup(seleccionPanelLayout.createSequentialGroup() .addComponent(botonesPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); seleccionPanelLayout.setVerticalGroup( seleccionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(seleccionPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(seleccionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(periodoFiscalComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(seleccionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(periodoFiscalCompararCheckBox) .addComponent(periodoFiscalCompararComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(PeriodoCompararCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(seleccionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(nivelCuentasComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(cuentasSaldoCeroCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(mostrarCodigoCuentaCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(MostraFechaPagCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(ajustadoInflacionCheckBox) .addGap(18, 18, 18) .addComponent(botonesPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(197, Short.MAX_VALUE)) ); jTabbedPane1.addTab("Selección", seleccionPanel); javax.swing.GroupLayout reportePanelLayout = new javax.swing.GroupLayout(reportePanel); reportePanel.setLayout(reportePanelLayout); reportePanelLayout.setHorizontalGroup( reportePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 859, Short.MAX_VALUE) ); reportePanelLayout.setVerticalGroup( reportePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 462, Short.MAX_VALUE) ); jTabbedPane1.addTab("Reporte", reportePanel); javax.swing.GroupLayout backPanelLayout = new javax.swing.GroupLayout(backPanel); backPanel.setLayout(backPanelLayout); backPanelLayout.setHorizontalGroup( backPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(backPanelLayout.createSequentialGroup() .addContainerGap() .addComponent(jTabbedPane1)) ); backPanelLayout.setVerticalGroup( backPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(backPanelLayout.createSequentialGroup() .addContainerGap() .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 490, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(backPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(backPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JCheckBox MostraFechaPagCheckBox; private javax.swing.JCheckBox PeriodoCompararCheckBox; private javax.swing.JButton aceptarButton; private javax.swing.JCheckBox ajustadoInflacionCheckBox; private javax.swing.JPanel backPanel; private javax.swing.JPanel botonesPanel; private javax.swing.JButton cancelarButton; private javax.swing.JCheckBox cuentasSaldoCeroCheckBox; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel3; private javax.swing.JTabbedPane jTabbedPane1; private javax.swing.JCheckBox mostrarCodigoCuentaCheckBox; private javax.swing.JComboBox nivelCuentasComboBox; private javax.swing.JComboBox periodoFiscalComboBox; private javax.swing.JCheckBox periodoFiscalCompararCheckBox; private javax.swing.JComboBox periodoFiscalCompararComboBox; private javax.swing.JPanel reportePanel; private javax.swing.JPanel seleccionPanel; // End of variables declaration//GEN-END:variables }
UTF-8
Java
13,690
java
BalanceGeneralIF.java
Java
[ { "context": "mport java.util.logging.Logger;\n\n/**\n *\n * @author JoseAngel\n */\npublic class BalanceGeneralIF extends javax.s", "end": 321, "score": 0.998934268951416, "start": 312, "tag": "NAME", "value": "JoseAngel" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.sauki.vista.reportes.contabilidad; import com.sauki.Contexto; import java.util.logging.Logger; /** * * @author JoseAngel */ public class BalanceGeneralIF extends javax.swing.JInternalFrame { // Crear el logger de la clase para registrar los mensajes ...log file private static final Logger logger = Logger.getLogger(BalanceGeneralIF.class.getName()); // crear instancia de la vista en null private static BalanceGeneralIF instance = null; /** * Creates new form BalanceGeneral */ public BalanceGeneralIF() { initComponents(); setTitle("BALANCE GENERAL"); // Configuración del log para esta clase Contexto.setLoggerHandlers(logger); initBackground(); } // Hacer que siempre se muestre la misma instancia que está activa public static BalanceGeneralIF getInstance() { if (instance == null) { instance = new BalanceGeneralIF(); } return instance; } private void initBackground() { seleccionPanel.setBackground(Contexto.getColor()); reportePanel.setBackground(Contexto.getColor()); botonesPanel.setBackground(Contexto.getColor()); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { backPanel = new javax.swing.JPanel(); jTabbedPane1 = new javax.swing.JTabbedPane(); seleccionPanel = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); periodoFiscalComboBox = new javax.swing.JComboBox(); periodoFiscalCompararCheckBox = new javax.swing.JCheckBox(); periodoFiscalCompararComboBox = new javax.swing.JComboBox(); PeriodoCompararCheckBox = new javax.swing.JCheckBox(); jLabel3 = new javax.swing.JLabel(); cuentasSaldoCeroCheckBox = new javax.swing.JCheckBox(); mostrarCodigoCuentaCheckBox = new javax.swing.JCheckBox(); ajustadoInflacionCheckBox = new javax.swing.JCheckBox(); botonesPanel = new javax.swing.JPanel(); aceptarButton = new javax.swing.JButton(); cancelarButton = new javax.swing.JButton(); nivelCuentasComboBox = new javax.swing.JComboBox(); MostraFechaPagCheckBox = new javax.swing.JCheckBox(); reportePanel = new javax.swing.JPanel(); setBackground(new java.awt.Color(255, 255, 255)); setClosable(true); setIconifiable(true); setMaximizable(true); setResizable(true); backPanel.setBackground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Período Fiscal:"); periodoFiscalComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione", "2015 Enero", "2014 Diciembre", "2014 Noviembre", "2014 Octubre", " " })); periodoFiscalCompararCheckBox.setText("Comparar con el Período:"); periodoFiscalCompararComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione", "2015 Enero", "2014 Diciembre", "2014 Noviembre", "2014 Octubre", " " })); PeriodoCompararCheckBox.setText("Comparar con Presupuesto"); jLabel3.setText("Nivel de Cuestas a Mostrar:"); cuentasSaldoCeroCheckBox.setText("Mostrar Cuentas con Saldo Cero"); mostrarCodigoCuentaCheckBox.setText("Mostrar Código de Cuenta"); ajustadoInflacionCheckBox.setText("Ajustado a Inflación"); aceptarButton.setText("Aceptar"); cancelarButton.setText("Cancelar"); javax.swing.GroupLayout botonesPanelLayout = new javax.swing.GroupLayout(botonesPanel); botonesPanel.setLayout(botonesPanelLayout); botonesPanelLayout.setHorizontalGroup( botonesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, botonesPanelLayout.createSequentialGroup() .addContainerGap(125, Short.MAX_VALUE) .addComponent(aceptarButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(cancelarButton) .addGap(71, 71, 71)) ); botonesPanelLayout.setVerticalGroup( botonesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(botonesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(aceptarButton) .addComponent(cancelarButton)) ); nivelCuentasComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione", "1", "2", "3", "4", "5" })); MostraFechaPagCheckBox.setText("Mostrar Fecha y Página"); javax.swing.GroupLayout seleccionPanelLayout = new javax.swing.GroupLayout(seleccionPanel); seleccionPanel.setLayout(seleccionPanelLayout); seleccionPanelLayout.setHorizontalGroup( seleccionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(seleccionPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(seleccionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(mostrarCodigoCuentaCheckBox) .addComponent(cuentasSaldoCeroCheckBox) .addComponent(PeriodoCompararCheckBox) .addGroup(seleccionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, seleccionPanelLayout.createSequentialGroup() .addGap(21, 21, 21) .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(nivelCuentasComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, seleccionPanelLayout.createSequentialGroup() .addGroup(seleccionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(periodoFiscalCompararCheckBox) .addGroup(seleccionPanelLayout.createSequentialGroup() .addGap(23, 23, 23) .addComponent(jLabel1))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(seleccionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(periodoFiscalCompararComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(periodoFiscalComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addComponent(MostraFechaPagCheckBox) .addComponent(ajustadoInflacionCheckBox)) .addContainerGap(597, Short.MAX_VALUE)) .addGroup(seleccionPanelLayout.createSequentialGroup() .addComponent(botonesPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); seleccionPanelLayout.setVerticalGroup( seleccionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(seleccionPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(seleccionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(periodoFiscalComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(seleccionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(periodoFiscalCompararCheckBox) .addComponent(periodoFiscalCompararComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(PeriodoCompararCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(seleccionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(nivelCuentasComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(cuentasSaldoCeroCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(mostrarCodigoCuentaCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(MostraFechaPagCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(ajustadoInflacionCheckBox) .addGap(18, 18, 18) .addComponent(botonesPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(197, Short.MAX_VALUE)) ); jTabbedPane1.addTab("Selección", seleccionPanel); javax.swing.GroupLayout reportePanelLayout = new javax.swing.GroupLayout(reportePanel); reportePanel.setLayout(reportePanelLayout); reportePanelLayout.setHorizontalGroup( reportePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 859, Short.MAX_VALUE) ); reportePanelLayout.setVerticalGroup( reportePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 462, Short.MAX_VALUE) ); jTabbedPane1.addTab("Reporte", reportePanel); javax.swing.GroupLayout backPanelLayout = new javax.swing.GroupLayout(backPanel); backPanel.setLayout(backPanelLayout); backPanelLayout.setHorizontalGroup( backPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(backPanelLayout.createSequentialGroup() .addContainerGap() .addComponent(jTabbedPane1)) ); backPanelLayout.setVerticalGroup( backPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(backPanelLayout.createSequentialGroup() .addContainerGap() .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 490, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(backPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(backPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JCheckBox MostraFechaPagCheckBox; private javax.swing.JCheckBox PeriodoCompararCheckBox; private javax.swing.JButton aceptarButton; private javax.swing.JCheckBox ajustadoInflacionCheckBox; private javax.swing.JPanel backPanel; private javax.swing.JPanel botonesPanel; private javax.swing.JButton cancelarButton; private javax.swing.JCheckBox cuentasSaldoCeroCheckBox; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel3; private javax.swing.JTabbedPane jTabbedPane1; private javax.swing.JCheckBox mostrarCodigoCuentaCheckBox; private javax.swing.JComboBox nivelCuentasComboBox; private javax.swing.JComboBox periodoFiscalComboBox; private javax.swing.JCheckBox periodoFiscalCompararCheckBox; private javax.swing.JComboBox periodoFiscalCompararComboBox; private javax.swing.JPanel reportePanel; private javax.swing.JPanel seleccionPanel; // End of variables declaration//GEN-END:variables }
13,690
0.689738
0.681114
256
52.445313
40.511631
194
false
false
0
0
0
0
0
0
0.664063
false
false
9
eb270d23a146fd4899b37505dad150ba265f09db
10,977,936,446,559
24876095b3ad0115d2bf0c468654ad446c51b8c3
/kotlin/src/main/kotlin/rn/puzzle/dynamic/hard/cherry/index/CherryPickupSolver.java
b6c2d26cbbbf7e1fc0454e4196c2356696094852
[]
no_license
rnofenko/devPuzzle
https://github.com/rnofenko/devPuzzle
f4cfa6b24980f2d6f9f28453b5d7a2751fdd1c70
bb76ba47eaad3616a1fb4f44888ac5b55ce2806d
refs/heads/master
2023-05-01T00:48:24.933000
2023-04-17T21:51:10
2023-04-17T21:51:10
42,119,862
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package rn.puzzle.dynamic.hard.cherry.index; import rn.puzzle.dynamic.hard.cherry.GraphPrinter; import rn.puzzle.dynamic.hard.cherry.ICherryPickSolver; import rn.tool.Stopwatch; import java.util.*; public class CherryPickupSolver implements ICherryPickSolver { private static final int SINK = 1; private static final int VISITED = 1; private static final int EMPTY = 0; private static final int SOURCE = 0; private List<List<Integer>> graph; private int[] sorted; public int cherryPickup(int[][] grid) { Stopwatch w = Stopwatch.Companion.start(); if (grid.length == 1) { return grid[0][0]; } w.show("start"); GraphBuilder builder = new GraphBuilder(grid); graph = builder.build(); w.show("graph build"); removeDoubleLinks(); w.show("graph pruned"); GraphPrinter.printIndexedConnections(graph); w.show("graph printed"); sorted = doTopologicalSort(); w.show("graph sorted"); int rootPoints = depthFirst(); w.show("depthFirst"); if (grid[0][0] == EMPTY) { rootPoints--; } if (grid[grid.length - 1][grid[0].length - 1] == EMPTY) { rootPoints--; } return Math.max(0, rootPoints); } private int[] doTopologicalSort() { Stack<Integer> stack = new Stack<>(); int[] visited = new int[graph.size()]; doTopologicalSort(0, stack, visited); int[] reverted = new int[graph.size()]; int i = 0; while (!stack.isEmpty()) { reverted[i++] = stack.pop(); } return reverted; } private void doTopologicalSort(int vertex, Stack<Integer> stack, int[] visited) { visited[vertex] = 1; for (int kid : graph.get(vertex)) { if (visited[kid] == 1) continue; doTopologicalSort(kid, stack, visited); } stack.push(vertex); } private int depthFirst() { int[] visited = new int[graph.size()]; return depthFirst(SOURCE, visited, 1, 0); } private int depthFirst(int vertex, int[] visited, int level, int maxPoints) { visited[vertex] = VISITED; if (vertex == SINK) { int locPoints = calcLongestPath(visited); maxPoints = Math.max(locPoints + level, maxPoints); } for (int kid : graph.get(vertex)) { int locPoints = depthFirst(kid, visited, level + 1, maxPoints); maxPoints = Math.max(locPoints, maxPoints); } visited[vertex] = EMPTY; return maxPoints; } private int calcLongestPath(int[] visited) { int[] path = new int[graph.size()]; for (int vertex : sorted) { int startPoint = path[vertex]; for (int kid : graph.get(vertex)) { path[kid] = Math.max(path[kid], startPoint + 1 - visited[kid]); } } return path[SINK]; } private void removeDoubleLinks() { removeDoubleLinks(SOURCE); } private void removeDoubleLinks(int parent) { List<Integer> kids = graph.get(parent); Set<Integer> forRemove = new HashSet<>(); for (int kid : kids) { List<Integer> grandKids = graph.get(kid); if (kid != SINK && grandKids.isEmpty()) { forRemove.add(kid); } for (int grandKid : grandKids) { if (kids.contains(grandKid)) { forRemove.add(grandKid); } } } for (Integer kid : forRemove) { kids.remove(kid); } for (int kid : kids) { removeDoubleLinks(kid); } } }
UTF-8
Java
3,780
java
CherryPickupSolver.java
Java
[]
null
[]
package rn.puzzle.dynamic.hard.cherry.index; import rn.puzzle.dynamic.hard.cherry.GraphPrinter; import rn.puzzle.dynamic.hard.cherry.ICherryPickSolver; import rn.tool.Stopwatch; import java.util.*; public class CherryPickupSolver implements ICherryPickSolver { private static final int SINK = 1; private static final int VISITED = 1; private static final int EMPTY = 0; private static final int SOURCE = 0; private List<List<Integer>> graph; private int[] sorted; public int cherryPickup(int[][] grid) { Stopwatch w = Stopwatch.Companion.start(); if (grid.length == 1) { return grid[0][0]; } w.show("start"); GraphBuilder builder = new GraphBuilder(grid); graph = builder.build(); w.show("graph build"); removeDoubleLinks(); w.show("graph pruned"); GraphPrinter.printIndexedConnections(graph); w.show("graph printed"); sorted = doTopologicalSort(); w.show("graph sorted"); int rootPoints = depthFirst(); w.show("depthFirst"); if (grid[0][0] == EMPTY) { rootPoints--; } if (grid[grid.length - 1][grid[0].length - 1] == EMPTY) { rootPoints--; } return Math.max(0, rootPoints); } private int[] doTopologicalSort() { Stack<Integer> stack = new Stack<>(); int[] visited = new int[graph.size()]; doTopologicalSort(0, stack, visited); int[] reverted = new int[graph.size()]; int i = 0; while (!stack.isEmpty()) { reverted[i++] = stack.pop(); } return reverted; } private void doTopologicalSort(int vertex, Stack<Integer> stack, int[] visited) { visited[vertex] = 1; for (int kid : graph.get(vertex)) { if (visited[kid] == 1) continue; doTopologicalSort(kid, stack, visited); } stack.push(vertex); } private int depthFirst() { int[] visited = new int[graph.size()]; return depthFirst(SOURCE, visited, 1, 0); } private int depthFirst(int vertex, int[] visited, int level, int maxPoints) { visited[vertex] = VISITED; if (vertex == SINK) { int locPoints = calcLongestPath(visited); maxPoints = Math.max(locPoints + level, maxPoints); } for (int kid : graph.get(vertex)) { int locPoints = depthFirst(kid, visited, level + 1, maxPoints); maxPoints = Math.max(locPoints, maxPoints); } visited[vertex] = EMPTY; return maxPoints; } private int calcLongestPath(int[] visited) { int[] path = new int[graph.size()]; for (int vertex : sorted) { int startPoint = path[vertex]; for (int kid : graph.get(vertex)) { path[kid] = Math.max(path[kid], startPoint + 1 - visited[kid]); } } return path[SINK]; } private void removeDoubleLinks() { removeDoubleLinks(SOURCE); } private void removeDoubleLinks(int parent) { List<Integer> kids = graph.get(parent); Set<Integer> forRemove = new HashSet<>(); for (int kid : kids) { List<Integer> grandKids = graph.get(kid); if (kid != SINK && grandKids.isEmpty()) { forRemove.add(kid); } for (int grandKid : grandKids) { if (kids.contains(grandKid)) { forRemove.add(grandKid); } } } for (Integer kid : forRemove) { kids.remove(kid); } for (int kid : kids) { removeDoubleLinks(kid); } } }
3,780
0.54709
0.541534
143
25.433567
21.391312
85
false
false
0
0
0
0
0
0
0.552448
false
false
9
4dabda5b11bf63cc97cf5b9aa2664fd1656fb0e7
22,677,427,372,314
fe83e8696ab77f255ac69ef4369d710a0243d373
/iotclient/src/main/java/cn/edu/zju/cs/bs/IOTListener.java
238f8690edf32c833da3ba8d100f6df1beb83167
[]
no_license
wewewexiao2008/iot-lord
https://github.com/wewewexiao2008/iot-lord
152567f94ed24b326202ca93db0f1023c3122851
444c2f6fde6d9e2f81f1e8f4160ddd70484a619b
refs/heads/main
2023-06-04T13:26:53.324000
2021-07-01T13:20:16
2021-07-01T13:20:16
381,876,762
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.edu.zju.cs.bs; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import org.eclipse.paho.client.mqttv3.*; import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; import java.sql.Timestamp; public class IOTListener { private static MqttClient client; public void start_listen() throws MqttException, InterruptedException{ MemoryPersistence memoryPersistence = new MemoryPersistence(); MqttConnectOptions options = new MqttConnectOptions(); options.setUserName("listener"); options.setPassword("12345".toCharArray()); options.setConnectionTimeout(10); options.setKeepAliveInterval(20); client = new MqttClient("tcp://localhost:1883", "123", memoryPersistence); client.setCallback(mqttCallbackExtended); client.connect(options); } private static MqttCallbackExtended mqttCallbackExtended = new MqttCallbackExtended() { @Override public void connectionLost(Throwable throwable) { System.out.println("connectionLost:" + throwable.getMessage()); } @Override public void messageArrived(String s, MqttMessage mqttMessage) throws Exception { System.out.println("receive 收到消息"); String str = new String(mqttMessage.getPayload(), "UTF-8"); System.out.println(str); IOTMessage msg = JSON.parseObject(str, IOTMessage.class); DBService dbService = new DBService(); dbService.insertLogInfo(msg); } @Override public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) { System.out.println("[isComplete]:" + iMqttDeliveryToken.isComplete() + " " + iMqttDeliveryToken.getTopics()); } @Override public void connectComplete(boolean b, String s) { System.out.println("connectComplete:"+s); int[] Qos = { 1 }; String[] topic1 = { "testapp" }; try { client.subscribe(topic1, Qos); System.out.println("订阅了"); } catch (MqttException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }; // public void msgToJSON(String message) throws JSONException { // JSONObject jb = new JSONObject(message); // System.out.println("收到mqtt消息:" + message); // } }
UTF-8
Java
2,479
java
IOTListener.java
Java
[ { "context": "serName(\"listener\");\n options.setPassword(\"12345\".toCharArray());\n options.setConnectionTim", "end": 589, "score": 0.9992915987968445, "start": 584, "tag": "PASSWORD", "value": "12345" }, { "context": "(\"listener\");\n options.setPassword(\"1...
null
[]
package cn.edu.zju.cs.bs; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import org.eclipse.paho.client.mqttv3.*; import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; import java.sql.Timestamp; public class IOTListener { private static MqttClient client; public void start_listen() throws MqttException, InterruptedException{ MemoryPersistence memoryPersistence = new MemoryPersistence(); MqttConnectOptions options = new MqttConnectOptions(); options.setUserName("listener"); options.setPassword("<PASSWORD>".toCharArray()); options.setConnectionTimeout(10); options.setKeepAliveInterval(20); client = new MqttClient("tcp://localhost:1883", "123", memoryPersistence); client.setCallback(mqttCallbackExtended); client.connect(options); } private static MqttCallbackExtended mqttCallbackExtended = new MqttCallbackExtended() { @Override public void connectionLost(Throwable throwable) { System.out.println("connectionLost:" + throwable.getMessage()); } @Override public void messageArrived(String s, MqttMessage mqttMessage) throws Exception { System.out.println("receive 收到消息"); String str = new String(mqttMessage.getPayload(), "UTF-8"); System.out.println(str); IOTMessage msg = JSON.parseObject(str, IOTMessage.class); DBService dbService = new DBService(); dbService.insertLogInfo(msg); } @Override public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) { System.out.println("[isComplete]:" + iMqttDeliveryToken.isComplete() + " " + iMqttDeliveryToken.getTopics()); } @Override public void connectComplete(boolean b, String s) { System.out.println("connectComplete:"+s); int[] Qos = { 1 }; String[] topic1 = { "testapp" }; try { client.subscribe(topic1, Qos); System.out.println("订阅了"); } catch (MqttException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }; // public void msgToJSON(String message) throws JSONException { // JSONObject jb = new JSONObject(message); // System.out.println("收到mqtt消息:" + message); // } }
2,484
0.632179
0.623218
74
32.175674
28.800976
127
false
false
0
0
0
0
0
0
0.554054
false
false
9
27f9fe058be69085e726bfde320fd6be52cf15e6
22,677,427,371,657
449c28da15d21e6029b36f16521440755d15a618
/src/main/java/br/com/sarp/model/dao/CadastroInsumoDAO.java
9d3aed1a0b9aa74f174c2d1ba147ed06d6515062
[]
no_license
UzumakiFerrel/sarp
https://github.com/UzumakiFerrel/sarp
7168f731d2186964bc78fec08b9ba73280cda8ed
cd2f2bd8a7888f9a635ce24a9f462da69384a6b6
refs/heads/master
2021-01-02T08:46:41.288000
2015-02-28T14:06:14
2015-02-28T14:06:14
31,464,036
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.sarp.model.dao; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import br.com.sarp.model.entidades.CadastroInsumo; @Repository public class CadastroInsumoDAO { // injecao de dependencia EntityManager @PersistenceContext EntityManager em; // gerenciador de transacoes do spring @Transactional public void salvar(CadastroInsumo cadastroInsumo) throws DAOException { try { em.merge(cadastroInsumo); } catch (Exception erro) {// captura e excecao no banco de dados throw new DAOException("nao foi possivel salvar", erro); } } @Transactional public void excluir(CadastroInsumo cadastroInsumo) throws DAOException { try { CadastroInsumo cadastroInsumoexc = buscarPorId(cadastroInsumo .getCd_insumo()); em.remove(cadastroInsumoexc); } catch (Exception erro) {// captura e excecao no banco de dados throw new DAOException("Nao foi possivel excluir Item", erro); } } @SuppressWarnings("unchecked") @Transactional public List<CadastroInsumo> buscarTodos() { Query consulta = em.createQuery("select u from CadastroInsumo u"); return consulta.getResultList(); } @Transactional public CadastroInsumo buscarPorId(int id) { return em.find(CadastroInsumo.class, id); } @SuppressWarnings("unchecked") @Transactional public List<CadastroInsumo> buscaQueryDescricao(String query) { query = "'%" + query + "'"; Query consulta = em.createQuery("select c from CadastroInsumo c"); return consulta.getResultList(); } }
UTF-8
Java
1,707
java
CadastroInsumoDAO.java
Java
[]
null
[]
package br.com.sarp.model.dao; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import br.com.sarp.model.entidades.CadastroInsumo; @Repository public class CadastroInsumoDAO { // injecao de dependencia EntityManager @PersistenceContext EntityManager em; // gerenciador de transacoes do spring @Transactional public void salvar(CadastroInsumo cadastroInsumo) throws DAOException { try { em.merge(cadastroInsumo); } catch (Exception erro) {// captura e excecao no banco de dados throw new DAOException("nao foi possivel salvar", erro); } } @Transactional public void excluir(CadastroInsumo cadastroInsumo) throws DAOException { try { CadastroInsumo cadastroInsumoexc = buscarPorId(cadastroInsumo .getCd_insumo()); em.remove(cadastroInsumoexc); } catch (Exception erro) {// captura e excecao no banco de dados throw new DAOException("Nao foi possivel excluir Item", erro); } } @SuppressWarnings("unchecked") @Transactional public List<CadastroInsumo> buscarTodos() { Query consulta = em.createQuery("select u from CadastroInsumo u"); return consulta.getResultList(); } @Transactional public CadastroInsumo buscarPorId(int id) { return em.find(CadastroInsumo.class, id); } @SuppressWarnings("unchecked") @Transactional public List<CadastroInsumo> buscaQueryDescricao(String query) { query = "'%" + query + "'"; Query consulta = em.createQuery("select c from CadastroInsumo c"); return consulta.getResultList(); } }
1,707
0.759227
0.759227
74
22.067568
23.959047
73
false
false
0
0
0
0
0
0
1.189189
false
false
9
aa8472b51f7d27cd0cb52d03337afbe9daf28fed
21,792,664,100,626
7ed4cd25c595fbad7ffc58f076e23242dc8402a5
/src/main/java/com/javaex/vo/ProblemVo.java
5c1d40b6699f16603ba04faea4e8658a0403f5e6
[]
no_license
kkho4043/learnwhale
https://github.com/kkho4043/learnwhale
96a06c26fc19e64eabed0d0fe9b095acebac2510
7951117fbf4a43c1b2a512260898a00b498157b4
refs/heads/master
2023-03-28T17:44:09.087000
2021-04-05T03:19:28
2021-04-05T03:19:28
344,045,340
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.javaex.vo; public class ProblemVo { private int problemNo, cateNo; private String type, problemTitle, content, contentImage, description, answer, regDate; private int mypoint; private String result;// 오답여부 private int orderNum; // 시험 관리 >> 문제리스트 문제순서 private String whether; // 시험 체점 여부 public ProblemVo() { } public ProblemVo(int problemNo, int cateNo, String type, String problemTitle, String content, String contentImage, String description, String answer, String regDate, int mypoint, String result, int orderNum, String whether) { super(); this.problemNo = problemNo; this.cateNo = cateNo; this.type = type; this.problemTitle = problemTitle; this.content = content; this.contentImage = contentImage; this.description = description; this.answer = answer; this.regDate = regDate; this.mypoint = mypoint; this.result = result; this.orderNum = orderNum; this.whether = whether; } public String getWhether() { return whether; } public void setWhether(String whether) { this.whether = whether; } public int getMypoint() { return mypoint; } public void setMypoint(int mypoint) { this.mypoint = mypoint; } public int getProblemNo() { return problemNo; } public void setProblemNo(int problemNo) { this.problemNo = problemNo; } public int getCateNo() { return cateNo; } public void setCateNo(int cateNo) { this.cateNo = cateNo; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getProblemTitle() { return problemTitle; } public void setProblemTitle(String problemTitle) { this.problemTitle = problemTitle; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getContentImage() { return contentImage; } public void setContentImage(String contentImage) { this.contentImage = contentImage; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getAnswer() { return answer; } public void setAnswer(String answer) { this.answer = answer; } public String getRegDate() { return regDate; } public void setRegDate(String regDate) { this.regDate = regDate; } public String getResult() { return result; } public void setResult(String result) { this.result = result; } public int getOrderNum() { return orderNum; } public void setOrderNum(int orderNum) { this.orderNum = orderNum; } @Override public String toString() { return "ProblemVo [problemNo=" + problemNo + ", cateNo=" + cateNo + ", type=" + type + ", problemTitle=" + problemTitle + ", content=" + content + ", contentImage=" + contentImage + ", description=" + description + ", answer=" + answer + ", regDate=" + regDate + ", mypoint=" + mypoint + ", result=" + result + ", orderNum=" + orderNum + ", whether=" + whether + "]"; } }
UTF-8
Java
3,069
java
ProblemVo.java
Java
[]
null
[]
package com.javaex.vo; public class ProblemVo { private int problemNo, cateNo; private String type, problemTitle, content, contentImage, description, answer, regDate; private int mypoint; private String result;// 오답여부 private int orderNum; // 시험 관리 >> 문제리스트 문제순서 private String whether; // 시험 체점 여부 public ProblemVo() { } public ProblemVo(int problemNo, int cateNo, String type, String problemTitle, String content, String contentImage, String description, String answer, String regDate, int mypoint, String result, int orderNum, String whether) { super(); this.problemNo = problemNo; this.cateNo = cateNo; this.type = type; this.problemTitle = problemTitle; this.content = content; this.contentImage = contentImage; this.description = description; this.answer = answer; this.regDate = regDate; this.mypoint = mypoint; this.result = result; this.orderNum = orderNum; this.whether = whether; } public String getWhether() { return whether; } public void setWhether(String whether) { this.whether = whether; } public int getMypoint() { return mypoint; } public void setMypoint(int mypoint) { this.mypoint = mypoint; } public int getProblemNo() { return problemNo; } public void setProblemNo(int problemNo) { this.problemNo = problemNo; } public int getCateNo() { return cateNo; } public void setCateNo(int cateNo) { this.cateNo = cateNo; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getProblemTitle() { return problemTitle; } public void setProblemTitle(String problemTitle) { this.problemTitle = problemTitle; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getContentImage() { return contentImage; } public void setContentImage(String contentImage) { this.contentImage = contentImage; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getAnswer() { return answer; } public void setAnswer(String answer) { this.answer = answer; } public String getRegDate() { return regDate; } public void setRegDate(String regDate) { this.regDate = regDate; } public String getResult() { return result; } public void setResult(String result) { this.result = result; } public int getOrderNum() { return orderNum; } public void setOrderNum(int orderNum) { this.orderNum = orderNum; } @Override public String toString() { return "ProblemVo [problemNo=" + problemNo + ", cateNo=" + cateNo + ", type=" + type + ", problemTitle=" + problemTitle + ", content=" + content + ", contentImage=" + contentImage + ", description=" + description + ", answer=" + answer + ", regDate=" + regDate + ", mypoint=" + mypoint + ", result=" + result + ", orderNum=" + orderNum + ", whether=" + whether + "]"; } }
3,069
0.694013
0.694013
147
19.571428
22.750645
115
false
false
0
0
0
0
0
0
1.659864
false
false
9
6370a4f77896cd7544d24a5e25a8899d3e9ef6a5
10,565,619,559,407
257f66ad69b40e78970c48f77a2366d28ad652e6
/app/src/main/java/com/example/admin/moviedbapplication/data/source/GenreDataSource.java
493d7ceb7ad3f50248ab3fe6a8a007a0d6a2b582
[]
no_license
framgia/moviedb_16
https://github.com/framgia/moviedb_16
f9120d173715455886c3af86aae595fcdf69a3c0
fb24765d3390a29909feb198d09fb60a36013e89
refs/heads/develop
2018-10-23T09:52:35.074000
2018-08-23T09:29:24
2018-08-23T09:29:24
142,996,075
0
1
null
false
2018-08-23T09:29:25
2018-07-31T09:59:03
2018-08-23T09:17:15
2018-08-23T09:29:24
318
0
1
1
Java
false
null
package com.example.admin.moviedbapplication.data.source; import com.example.admin.moviedbapplication.data.model.Genre; import java.util.ArrayList; /** * Created by TamTT on 8/6/2018. */ public interface GenreDataSource { void getGenres(Callback<ArrayList<Genre>> callback); }
UTF-8
Java
287
java
GenreDataSource.java
Java
[ { "context": "e;\n\nimport java.util.ArrayList;\n\n/**\n * Created by TamTT on 8/6/2018.\n */\n\npublic interface GenreDataSourc", "end": 174, "score": 0.9995057582855225, "start": 169, "tag": "USERNAME", "value": "TamTT" } ]
null
[]
package com.example.admin.moviedbapplication.data.source; import com.example.admin.moviedbapplication.data.model.Genre; import java.util.ArrayList; /** * Created by TamTT on 8/6/2018. */ public interface GenreDataSource { void getGenres(Callback<ArrayList<Genre>> callback); }
287
0.770035
0.749129
13
21.076923
23.630037
61
false
false
0
0
0
0
0
0
0.307692
false
false
9
4836bcb830c88e27cba00c2f95f75c460ffcc2ac
1,262,720,437,535
becc7caf8effe04efb301288db2df986b778ae99
/src/model/service/BarangayService.java
290e0141336e349e5d8733d16d07b864cbda6995
[]
no_license
blaster25/AdminCDO
https://github.com/blaster25/AdminCDO
3fad5ec2cd218b907b9da9795f45fb7210cf00fa
22015799b0c9860537d51db92434271df298dc0d
refs/heads/master
2021-01-20T00:07:50.788000
2015-09-30T04:38:52
2015-09-30T04:38:52
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package model.service; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import javax.persistence.Query; import model.entity.Barangay; import com.example.admincdo.AdmincdoUI; public class BarangayService { EntityManagerFactory emf = Persistence.createEntityManagerFactory(AdmincdoUI.PERSISTENT_UNIT); EntityManager em = emf.createEntityManager(); public List<Barangay> get () { Query query = em.createQuery("SELECT b FROM Barangay b"); return query.getResultList(); } public Barangay get (int id) { return em.find(Barangay.class, id); } public void post (Barangay b) { em.getTransaction().begin(); em.persist(b); em.getTransaction().commit(); } public void put (Barangay b) { em.getTransaction().begin(); Barangay edit = em.find(Barangay.class, b.getBarangayid()); edit.setDate_registered(b.getDate_registered()); edit.setDistrick(b.getDistrick()); edit.setMunicipal(b.getMunicipal()); edit.setName(b.getName()); em.getTransaction().commit(); } public void delete (int id) { em.getTransaction().begin(); Barangay b = em.find(Barangay.class, id); em.remove(b); em.getTransaction().commit(); } public void delete (Barangay b) { em.getTransaction().begin(); em.remove(b); em.getTransaction().commit(); } }
UTF-8
Java
1,405
java
BarangayService.java
Java
[]
null
[]
package model.service; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import javax.persistence.Query; import model.entity.Barangay; import com.example.admincdo.AdmincdoUI; public class BarangayService { EntityManagerFactory emf = Persistence.createEntityManagerFactory(AdmincdoUI.PERSISTENT_UNIT); EntityManager em = emf.createEntityManager(); public List<Barangay> get () { Query query = em.createQuery("SELECT b FROM Barangay b"); return query.getResultList(); } public Barangay get (int id) { return em.find(Barangay.class, id); } public void post (Barangay b) { em.getTransaction().begin(); em.persist(b); em.getTransaction().commit(); } public void put (Barangay b) { em.getTransaction().begin(); Barangay edit = em.find(Barangay.class, b.getBarangayid()); edit.setDate_registered(b.getDate_registered()); edit.setDistrick(b.getDistrick()); edit.setMunicipal(b.getMunicipal()); edit.setName(b.getName()); em.getTransaction().commit(); } public void delete (int id) { em.getTransaction().begin(); Barangay b = em.find(Barangay.class, id); em.remove(b); em.getTransaction().commit(); } public void delete (Barangay b) { em.getTransaction().begin(); em.remove(b); em.getTransaction().commit(); } }
1,405
0.709609
0.709609
67
19.97015
19.777849
95
false
false
0
0
0
0
0
0
1.701493
false
false
9
5ce5dfe3a5c30fd6bb66d75fe986ac095a752901
9,182,640,124,853
c68686e1277ba97c6ffcc18acb2af5e10e9b50ac
/demo_nginx/src/main/java/com/cjean/springboot/demo_nginx/controller/TestJedisDemo.java
119506134cca5e52dc82f82e706a059eaf17f416
[ "Apache-2.0" ]
permissive
cjeanGitHub/exercies
https://github.com/cjeanGitHub/exercies
e9e3e705f915e44c727875b61e2d1a48b86b8765
44db3df4333dce0bdbb0e3c534e3c306d8b21061
refs/heads/master
2022-12-23T00:28:40.796000
2020-02-02T15:51:48
2020-02-02T15:51:48
218,790,416
1
1
Apache-2.0
false
2022-12-16T08:52:10
2019-10-31T14:52:09
2020-09-19T16:01:09
2022-12-16T08:52:06
301,652
1
1
78
Java
false
false
/** * Copyright (C), 2015-2019, XXX有限公司 * FileName: TestJedisDemo * Author: 14172 * Date: 2019/11/14 0:14 * History: * <author> <time> <version> <desc> * 作者姓名 修改时间 版本号 描述 */ package com.cjean.springboot.demo_nginx.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; /** * @author 14172 * @create 2019/11/14 * @since 1.0.0 */ public class TestJedisDemo { @Autowired private static JedisPool jedisPool;//注入JedisPool public static void main(String[] args) { //获取ShardedJedis对象 Jedis jedis = jedisPool.getResource(); //存入键值对 jedis.set("key2","hello jedis one"); //回收ShardedJedis实例 jedis.close(); } }
GB18030
Java
955
java
TestJedisDemo.java
Java
[ { "context": ", XXX有限公司\n * FileName: TestJedisDemo\n * Author: 14172\n * Date: 2019/11/14 0:14\n * History:\n * <auth", "end": 86, "score": 0.9993899464607239, "start": 81, "tag": "USERNAME", "value": "14172" }, { "context": "rt redis.clients.jedis.JedisPool;\n\n/**\n * @autho...
null
[]
/** * Copyright (C), 2015-2019, XXX有限公司 * FileName: TestJedisDemo * Author: 14172 * Date: 2019/11/14 0:14 * History: * <author> <time> <version> <desc> * 作者姓名 修改时间 版本号 描述 */ package com.cjean.springboot.demo_nginx.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; /** * @author 14172 * @create 2019/11/14 * @since 1.0.0 */ public class TestJedisDemo { @Autowired private static JedisPool jedisPool;//注入JedisPool public static void main(String[] args) { //获取ShardedJedis对象 Jedis jedis = jedisPool.getResource(); //存入键值对 jedis.set("key2","hello <PASSWORD>"); //回收ShardedJedis实例 jedis.close(); } }
956
0.636364
0.590348
34
25.205883
19.748089
62
false
false
0
0
0
0
0
0
0.352941
false
false
9
781abb309d3d4a339126ef8a03e670825605d50f
29,996,051,636,821
e08def0c5f4b443906844bf19072710742ea85a0
/app/src/main/java/com/cn/bag/adapter/home/HomeCategoryAdapter.java
445f867fe4348166b3eb7509bb6768de85e391b9
[]
no_license
JunZhangNext/NewBagApp
https://github.com/JunZhangNext/NewBagApp
ba800b64a69fe1a8961eb0c8c048f7019063e854
56278d6aaa07278ac6268bd9cb542d70f7a7d26e
refs/heads/master
2020-03-27T00:51:41.107000
2018-11-28T06:06:06
2018-11-28T06:06:06
145,532,564
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cn.bag.adapter.home; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import java.util.List; import response.home.HomeModuleCategory; /** * 菜单 * @author ZJ * @date 2018/09/06. */ public class HomeCategoryAdapter extends RecyclerView.Adapter<HomeCategoryAdapter.HomeCategoryViewHolder> { /** * */ private List<HomeModuleCategory> homeModuleCategories; public HomeCategoryAdapter(List<HomeModuleCategory> homeModuleCategories) { this.homeModuleCategories = homeModuleCategories; } @NonNull @Override public HomeCategoryViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { return null; } @Override public void onBindViewHolder(@NonNull HomeCategoryViewHolder holder, int position) { holder.initView(homeModuleCategories.get(position)); } @Override public int getItemCount() { return homeModuleCategories.size(); } class HomeCategoryViewHolder extends RecyclerView.ViewHolder{ public HomeCategoryViewHolder(View itemView) { super(itemView); } public void initView(HomeModuleCategory homeModuleCategory){ } } }
UTF-8
Java
1,309
java
HomeCategoryAdapter.java
Java
[ { "context": "nse.home.HomeModuleCategory;\n\n/**\n * 菜单\n * @author ZJ\n * @date 2018/09/06.\n */\n\npublic class HomeCatego", "end": 271, "score": 0.998674750328064, "start": 269, "tag": "USERNAME", "value": "ZJ" } ]
null
[]
package com.cn.bag.adapter.home; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import java.util.List; import response.home.HomeModuleCategory; /** * 菜单 * @author ZJ * @date 2018/09/06. */ public class HomeCategoryAdapter extends RecyclerView.Adapter<HomeCategoryAdapter.HomeCategoryViewHolder> { /** * */ private List<HomeModuleCategory> homeModuleCategories; public HomeCategoryAdapter(List<HomeModuleCategory> homeModuleCategories) { this.homeModuleCategories = homeModuleCategories; } @NonNull @Override public HomeCategoryViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { return null; } @Override public void onBindViewHolder(@NonNull HomeCategoryViewHolder holder, int position) { holder.initView(homeModuleCategories.get(position)); } @Override public int getItemCount() { return homeModuleCategories.size(); } class HomeCategoryViewHolder extends RecyclerView.ViewHolder{ public HomeCategoryViewHolder(View itemView) { super(itemView); } public void initView(HomeModuleCategory homeModuleCategory){ } } }
1,309
0.715709
0.708812
56
22.303572
27.636621
107
false
false
0
0
0
0
0
0
0.267857
false
false
9
5f545d88e6dc4145496808ac795e8c11ebb5c9d2
33,560,874,452,760
0b5e605c656006c185be730c17771706bddf31d7
/app/src/main/java/leetcode/_695岛屿的最大面积.java
1e015656aac48195f3ffe6fbc851fff77347885d
[]
no_license
lihaoo/leetcode
https://github.com/lihaoo/leetcode
5ea8f502b7c4a2068014c94ae88ea1ada2afe14b
817d9c700b93769390f752b3841e655938564edc
refs/heads/master
2023-02-09T07:50:24.906000
2020-12-30T07:46:45
2020-12-30T07:46:45
324,519,342
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package leetcode; import java.util.ArrayList; public class _695岛屿的最大面积 { public int maxAreaOfIsland(int[][] grid) { if (grid == null || grid.length < 1 || grid[0].length < 1) { return 0; } int max = 0; for (int i = 0; i < grid.length; i++) { for (int j = 0; j < grid[0].length; j++) { if (grid[i][j] == 1) { max = Math.max(max, bfs(grid, i, j)); } } } return max; } private int bfs(int[][] grid, int i, int j) { int a = 0; int ROW = grid.length; int COL = grid[0].length; ArrayList<Integer> integers = new ArrayList<>(); integers.add(j + i * COL); while (integers.size() > 0) { int temp = integers.remove(0); int x = temp % COL; int y = temp / COL; grid[y][x] = 2; a++; if ((x - 1) >= 0 && grid[y][x - 1] == 1 && !integers.contains((x - 1) + y * COL)) { integers.add((x - 1) + y * COL); } if ((x + 1) < COL && grid[y][x + 1] == 1 && !integers.contains((x + 1) + y * COL)) { integers.add((x + 1) + y * COL); } if ((y - 1) >= 0 && grid[y - 1][x] == 1 && !integers.contains(x + (y - 1) * COL)) { integers.add(x + (y - 1) * COL); } if ((y + 1) < ROW && grid[y + 1][x] == 1 && !integers.contains(x + (y + 1) * COL)) { integers.add(x + (y + 1) * COL); } } return a; } }
UTF-8
Java
1,625
java
_695岛屿的最大面积.java
Java
[]
null
[]
package leetcode; import java.util.ArrayList; public class _695岛屿的最大面积 { public int maxAreaOfIsland(int[][] grid) { if (grid == null || grid.length < 1 || grid[0].length < 1) { return 0; } int max = 0; for (int i = 0; i < grid.length; i++) { for (int j = 0; j < grid[0].length; j++) { if (grid[i][j] == 1) { max = Math.max(max, bfs(grid, i, j)); } } } return max; } private int bfs(int[][] grid, int i, int j) { int a = 0; int ROW = grid.length; int COL = grid[0].length; ArrayList<Integer> integers = new ArrayList<>(); integers.add(j + i * COL); while (integers.size() > 0) { int temp = integers.remove(0); int x = temp % COL; int y = temp / COL; grid[y][x] = 2; a++; if ((x - 1) >= 0 && grid[y][x - 1] == 1 && !integers.contains((x - 1) + y * COL)) { integers.add((x - 1) + y * COL); } if ((x + 1) < COL && grid[y][x + 1] == 1 && !integers.contains((x + 1) + y * COL)) { integers.add((x + 1) + y * COL); } if ((y - 1) >= 0 && grid[y - 1][x] == 1 && !integers.contains(x + (y - 1) * COL)) { integers.add(x + (y - 1) * COL); } if ((y + 1) < ROW && grid[y + 1][x] == 1 && !integers.contains(x + (y + 1) * COL)) { integers.add(x + (y + 1) * COL); } } return a; } }
1,625
0.387958
0.363749
56
27.767857
26.300455
96
false
false
0
0
0
0
0
0
0.607143
false
false
9
d778e3cab7cceae83eeb07239312a858b5925f2f
22,204,980,967,446
a2e7f172bca6252233c6a64f578ea967ec3f9dea
/app/src/main/java/com/chinaboy/smstools/tools/PermissionUtil.java
384c769380fd589bb1a7ae71a622f3828c08aa31
[]
no_license
HelloMark/SmsTools
https://github.com/HelloMark/SmsTools
571453219798a274a5c752a76df8d55563016c8e
4c75216fb39ad24d7f69285f4bc6ccb6110ebfd7
refs/heads/master
2020-07-28T01:18:23.667000
2019-09-19T09:14:37
2019-09-19T09:14:37
209,266,156
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.chinaboy.smstools.tools; import android.app.Activity; import android.content.pm.PackageManager; import android.os.Build; import android.widget.Toast; import androidx.annotation.RequiresApi; import androidx.core.app.ActivityCompat; import androidx.fragment.app.Fragment; import java.util.ArrayList; public class PermissionUtil { /** * 申请权限 * * @param cxt 为Activity或者Fragment * @param permission 权限 * @param requestCode */ public static void requestPermissionsWrapper(Object cxt, String[] permission, int requestCode) { if (cxt instanceof Activity) { Activity activity = (Activity) cxt; ActivityCompat.requestPermissions(activity, permission, requestCode); // Toast.makeText(activity, "avtivity", Toast.LENGTH_SHORT).show(); } else if (cxt instanceof Fragment) { Fragment fragment = (Fragment) cxt; fragment.requestPermissions(permission, requestCode); // Toast.makeText(fragment.getActivity(), "fragment", Toast.LENGTH_SHORT).show(); } else { throw new RuntimeException("cxt is not a activity or fragment"); } } /** * 检查权限 * * @param cxt 为Activity或者Fragment * @param permission * @return */ @RequiresApi(api = Build.VERSION_CODES.M) public static boolean checkPermissionWrapper(Object cxt, String permission) { if (cxt instanceof Activity) { Activity activity = (Activity) cxt; return ActivityCompat.checkSelfPermission(activity, permission) == PackageManager.PERMISSION_GRANTED; } else if (cxt instanceof Fragment) { Fragment fragment = (Fragment) cxt; return fragment.getActivity().checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED; } else { throw new RuntimeException("cxt is not a activity or fragment"); } } /** * 检查权限组 * * @param cxt * @param permission * @return */ @RequiresApi(api = Build.VERSION_CODES.M) public static String[] checkPermissionArray(Object cxt, String[] permission) { ArrayList<String> permiList = new ArrayList<>(); for (String p : permission) { if (!checkPermissionWrapper(cxt, p)) { permiList.add(p); } } return permiList.toArray(new String[permiList.size()]); } /*回调的 public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { //已经授权,更新 } else { //点击了不再提示,拒绝权限 if (!ActivityCompat.shouldShowRequestPermissionRationale(this, permissions[0])) { //跳转到设置界面 // Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); // Uri uri = Uri.fromParts("package", getPackageName(), null); // intent.setData(uri); // startActivityForResult(intent, savePermissionCode); } else { //拒绝权限 } } }*/ }
UTF-8
Java
3,395
java
PermissionUtil.java
Java
[]
null
[]
package com.chinaboy.smstools.tools; import android.app.Activity; import android.content.pm.PackageManager; import android.os.Build; import android.widget.Toast; import androidx.annotation.RequiresApi; import androidx.core.app.ActivityCompat; import androidx.fragment.app.Fragment; import java.util.ArrayList; public class PermissionUtil { /** * 申请权限 * * @param cxt 为Activity或者Fragment * @param permission 权限 * @param requestCode */ public static void requestPermissionsWrapper(Object cxt, String[] permission, int requestCode) { if (cxt instanceof Activity) { Activity activity = (Activity) cxt; ActivityCompat.requestPermissions(activity, permission, requestCode); // Toast.makeText(activity, "avtivity", Toast.LENGTH_SHORT).show(); } else if (cxt instanceof Fragment) { Fragment fragment = (Fragment) cxt; fragment.requestPermissions(permission, requestCode); // Toast.makeText(fragment.getActivity(), "fragment", Toast.LENGTH_SHORT).show(); } else { throw new RuntimeException("cxt is not a activity or fragment"); } } /** * 检查权限 * * @param cxt 为Activity或者Fragment * @param permission * @return */ @RequiresApi(api = Build.VERSION_CODES.M) public static boolean checkPermissionWrapper(Object cxt, String permission) { if (cxt instanceof Activity) { Activity activity = (Activity) cxt; return ActivityCompat.checkSelfPermission(activity, permission) == PackageManager.PERMISSION_GRANTED; } else if (cxt instanceof Fragment) { Fragment fragment = (Fragment) cxt; return fragment.getActivity().checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED; } else { throw new RuntimeException("cxt is not a activity or fragment"); } } /** * 检查权限组 * * @param cxt * @param permission * @return */ @RequiresApi(api = Build.VERSION_CODES.M) public static String[] checkPermissionArray(Object cxt, String[] permission) { ArrayList<String> permiList = new ArrayList<>(); for (String p : permission) { if (!checkPermissionWrapper(cxt, p)) { permiList.add(p); } } return permiList.toArray(new String[permiList.size()]); } /*回调的 public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { //已经授权,更新 } else { //点击了不再提示,拒绝权限 if (!ActivityCompat.shouldShowRequestPermissionRationale(this, permissions[0])) { //跳转到设置界面 // Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); // Uri uri = Uri.fromParts("package", getPackageName(), null); // intent.setData(uri); // startActivityForResult(intent, savePermissionCode); } else { //拒绝权限 } } }*/ }
3,395
0.615385
0.614777
99
32.222221
30.350996
113
false
false
0
0
0
0
0
0
0.515152
false
false
9
32879bdead53077ebbc2d049019e9ea81ebafa24
17,360,257,814,404
909a01d335db472379371f998d21cbec4aa4195e
/linejnye/Task34.java
6424d6d78432056513b684e22e813e0fc7dc9ca8
[]
no_license
annapru/Java
https://github.com/annapru/Java
07a03e193820f22f267dceb852ad932016f78b75
5b6bde15ba29048c8d986ebe309ed3ede67ffd3b
refs/heads/master
2022-12-02T19:12:53.148000
2020-08-23T13:40:12
2020-08-23T13:40:12
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package by.home.les1.linejnye; public class Task34 { public static void task34() { int A=16523; double KB=(double)A/1024; double MB=KB/1024; System.out.println("байт="+A+'\n'+"КБ= "+KB+'\n'+"MB= "+MB); } }
UTF-8
Java
261
java
Task34.java
Java
[]
null
[]
package by.home.les1.linejnye; public class Task34 { public static void task34() { int A=16523; double KB=(double)A/1024; double MB=KB/1024; System.out.println("байт="+A+'\n'+"КБ= "+KB+'\n'+"MB= "+MB); } }
261
0.537255
0.466667
16
13.9375
17.246264
62
false
false
0
0
0
0
0
0
1.3125
false
false
9
a6ec41f6f05f87cecfcec8580a80ea551848397f
1,864,015,820,035
20b816cfe286abd47311fd0563fd52307ee7126a
/net.sf.eclipsecs.core/src/net/sf/eclipsecs/core/config/configtypes/MultiPropertyResolver.java
b27af0c6f3c966f033a136c30419b066d41d902f
[]
no_license
sarvex/eclipse-cs
https://github.com/sarvex/eclipse-cs
a95549a917fb181113fc77df4f032eedb1e4e9df
e5a74be9f04df0559af690ebf0b0a853dc2bb0bd
refs/heads/main
2023-08-31T22:18:44.966000
2023-08-22T05:40:33
2023-08-22T05:40:33
33,739,912
0
0
null
false
2023-08-22T05:40:34
2015-04-10T16:56:18
2023-06-20T10:02:13
2023-08-22T05:40:33
56,206
0
0
1
Java
false
false
//============================================================================ // // Copyright (C) 2002-2014 David Schneider, Lars Ködderitzsch // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // //============================================================================ package net.sf.eclipsecs.core.config.configtypes; import java.util.ArrayList; import java.util.List; import org.eclipse.core.resources.IProject; import com.puppycrawl.tools.checkstyle.PropertyResolver; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; /** * This property resolver is able to aggregate a list of child property * resolvers, where each child resolver looks for different properties and may * have different ways of finding properties. The child resolvers are asked to * resolve the properties in the order they are added. This PropertyResolver * adds the property chaining feature, to allow properties within properties. * * @author Lars Ködderitzsch */ public class MultiPropertyResolver implements PropertyResolver, IContextAware { /** The list of PropertyResolvers. */ private List<PropertyResolver> mChildResolver = new ArrayList<PropertyResolver>(); /** * Adds a PropertyResolver to this aggregation property resolver. * * @param resolver the PropertyResolver to add */ public void addPropertyResolver(PropertyResolver resolver) { mChildResolver.add(resolver); } /** * {@inheritDoc} */ public void setProjectContext(IProject project) { // propagate context to the childs for (int i = 0, size = mChildResolver.size(); i < size; i++) { PropertyResolver aChildResolver = mChildResolver.get(i); if (aChildResolver instanceof IContextAware) { ((IContextAware) aChildResolver).setProjectContext(project); } } } /** * {@inheritDoc} */ public String resolve(String property) throws CheckstyleException { String value = null; for (int i = 0, size = mChildResolver.size(); i < size; i++) { PropertyResolver aChildResolver = mChildResolver.get(i); value = aChildResolver.resolve(property); if (value != null) { break; } } // property chaining - might recurse internally while (PropertyUtil.hasUnresolvedProperties(value)) { value = PropertyUtil.replaceProperties(value, this); } return value; } }
UTF-8
Java
3,215
java
MultiPropertyResolver.java
Java
[ { "context": "===================\n//\n// Copyright (C) 2002-2014 David Schneider, Lars Ködderitzsch\n//\n// This library is free sof", "end": 125, "score": 0.9998653531074524, "start": 110, "tag": "NAME", "value": "David Schneider" }, { "context": "==\n//\n// Copyright (C) 2002-201...
null
[]
//============================================================================ // // Copyright (C) 2002-2014 <NAME>, <NAME> // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // //============================================================================ package net.sf.eclipsecs.core.config.configtypes; import java.util.ArrayList; import java.util.List; import org.eclipse.core.resources.IProject; import com.puppycrawl.tools.checkstyle.PropertyResolver; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; /** * This property resolver is able to aggregate a list of child property * resolvers, where each child resolver looks for different properties and may * have different ways of finding properties. The child resolvers are asked to * resolve the properties in the order they are added. This PropertyResolver * adds the property chaining feature, to allow properties within properties. * * @author <NAME> */ public class MultiPropertyResolver implements PropertyResolver, IContextAware { /** The list of PropertyResolvers. */ private List<PropertyResolver> mChildResolver = new ArrayList<PropertyResolver>(); /** * Adds a PropertyResolver to this aggregation property resolver. * * @param resolver the PropertyResolver to add */ public void addPropertyResolver(PropertyResolver resolver) { mChildResolver.add(resolver); } /** * {@inheritDoc} */ public void setProjectContext(IProject project) { // propagate context to the childs for (int i = 0, size = mChildResolver.size(); i < size; i++) { PropertyResolver aChildResolver = mChildResolver.get(i); if (aChildResolver instanceof IContextAware) { ((IContextAware) aChildResolver).setProjectContext(project); } } } /** * {@inheritDoc} */ public String resolve(String property) throws CheckstyleException { String value = null; for (int i = 0, size = mChildResolver.size(); i < size; i++) { PropertyResolver aChildResolver = mChildResolver.get(i); value = aChildResolver.resolve(property); if (value != null) { break; } } // property chaining - might recurse internally while (PropertyUtil.hasUnresolvedProperties(value)) { value = PropertyUtil.replaceProperties(value, this); } return value; } }
3,182
0.65484
0.646748
93
33.548386
30.250038
86
false
false
0
0
0
0
94
0.0554
0.419355
false
false
9
f4b6534a138c33bb1207874641d172221ae69bae
33,191,507,268,037
5332730012b1cab1385f8725e9f68f37227f421c
/src/main/java/creational/abstractFactroy/TypedCardFactory.java
e13a57b4911c63260f4ab2051174110d6f8745c0
[]
no_license
sharmisthanag/javadesignpattern
https://github.com/sharmisthanag/javadesignpattern
a240db2c06e0f90953a52912052484ae38d7275d
5d331a71cf91a62fd1f147fd8476e092d5ef9797
refs/heads/master
2020-06-08T11:38:35.381000
2019-07-11T05:35:09
2019-07-11T05:35:51
193,219,988
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package creational.abstractFactroy; public interface TypedCardFactory { Card getCard(int points); }
UTF-8
Java
105
java
TypedCardFactory.java
Java
[]
null
[]
package creational.abstractFactroy; public interface TypedCardFactory { Card getCard(int points); }
105
0.790476
0.790476
5
20
16.074825
35
false
false
0
0
0
0
0
0
0.4
false
false
9
0b46a0efd51dd4fdb70524e6c417aa053ae0c898
33,174,327,445,862
b6b6f064775cd93147d33f6e21ef430a98716b8d
/examples/jackson/src/test/java/com/englishtown/vertx/jersey/examples/integration/JacksonIntegrationTest.java
5a504b9867bd7c37c77ede8709d4559f5a41fdfa
[ "MIT" ]
permissive
ef-labs/vertx-jersey
https://github.com/ef-labs/vertx-jersey
7d08e88b9adafb7c2ebd9bc95f8aa96230608e7e
733482a8a5afb1fb257c682b3767655e56f7a0fe
refs/heads/develop
2021-11-11T12:06:55.968000
2018-01-05T19:43:00
2018-01-05T19:43:00
9,239,473
70
34
null
false
2017-11-06T21:33:08
2013-04-05T11:10:46
2017-10-25T08:17:21
2017-11-06T21:33:07
938
122
37
9
Java
false
null
package com.englishtown.vertx.jersey.examples.integration; import com.englishtown.vertx.jersey.integration.JerseyHK2IntegrationTestBase; import com.englishtown.vertx.promises.RequestOptions; import io.vertx.core.buffer.Buffer; import io.vertx.core.http.HttpHeaders; import io.vertx.core.http.HttpMethod; import io.vertx.core.json.JsonObject; import org.junit.Test; import javax.ws.rs.core.MediaType; import java.util.function.Consumer; public class JacksonIntegrationTest extends JerseyHK2IntegrationTestBase { private String BASE_PATH = "http://localhost:8080/json"; @Test public void testGet() throws Exception { runTest("", body -> { JsonObject json = new JsonObject(body.toString()); assertEquals("Andy", json.getString("name")); }); } @Test public void testGetAsync() throws Exception { runTest("/async", body -> { JsonObject json = new JsonObject(body.toString()); assertEquals("Andy", json.getString("name")); }); } @Test public void testGetJsonp() throws Exception { runTest("/jsonp?cb=myCallback", body -> { assertEquals("myCallback({\"name\":\"Andy\"})", body.toString()); }); } @Test public void testPost() throws Exception { testPost(BASE_PATH); } @Test public void testPost2() throws Exception { testPost(BASE_PATH + "/json"); } private void testPost(String path) throws Exception { RequestOptions options = new RequestOptions() .setPauseResponse(true) .setSetupHandler(request -> { request.putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); return null; }) .setData(new JsonObject().put("name", "Andy").encode()); getWhenHttpClient().requestAbs(HttpMethod.POST, path, options) .then(response -> { assertEquals(200, response.statusCode()); return getWhenHttpClient().body(response); }) .then(body -> { JsonObject json = new JsonObject(body.toString()); assertEquals("Andy", json.getString("name")); testComplete(); return null; }) .otherwise(this::onRejected); await(); } private void runTest(String additionalPath, Consumer<Buffer> assertMethod) throws Exception { getWhenHttpClient().requestAbs(HttpMethod.GET, BASE_PATH + additionalPath, new RequestOptions().setPauseResponse(true)) .then(response -> { assertEquals(200, response.statusCode()); return getWhenHttpClient().body(response); }) .then(body -> { assertMethod.accept(body); testComplete(); return null; }) .otherwise(this::onRejected); await(); } }
UTF-8
Java
3,091
java
JacksonIntegrationTest.java
Java
[ { "context": "bject(body.toString());\n assertEquals(\"Andy\", json.getString(\"name\"));\n });\n\n }\n\n ", "end": 756, "score": 0.9991947412490845, "start": 752, "tag": "NAME", "value": "Andy" }, { "context": "bject(body.toString());\n assertEquals(...
null
[]
package com.englishtown.vertx.jersey.examples.integration; import com.englishtown.vertx.jersey.integration.JerseyHK2IntegrationTestBase; import com.englishtown.vertx.promises.RequestOptions; import io.vertx.core.buffer.Buffer; import io.vertx.core.http.HttpHeaders; import io.vertx.core.http.HttpMethod; import io.vertx.core.json.JsonObject; import org.junit.Test; import javax.ws.rs.core.MediaType; import java.util.function.Consumer; public class JacksonIntegrationTest extends JerseyHK2IntegrationTestBase { private String BASE_PATH = "http://localhost:8080/json"; @Test public void testGet() throws Exception { runTest("", body -> { JsonObject json = new JsonObject(body.toString()); assertEquals("Andy", json.getString("name")); }); } @Test public void testGetAsync() throws Exception { runTest("/async", body -> { JsonObject json = new JsonObject(body.toString()); assertEquals("Andy", json.getString("name")); }); } @Test public void testGetJsonp() throws Exception { runTest("/jsonp?cb=myCallback", body -> { assertEquals("myCallback({\"name\":\"Andy\"})", body.toString()); }); } @Test public void testPost() throws Exception { testPost(BASE_PATH); } @Test public void testPost2() throws Exception { testPost(BASE_PATH + "/json"); } private void testPost(String path) throws Exception { RequestOptions options = new RequestOptions() .setPauseResponse(true) .setSetupHandler(request -> { request.putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); return null; }) .setData(new JsonObject().put("name", "Andy").encode()); getWhenHttpClient().requestAbs(HttpMethod.POST, path, options) .then(response -> { assertEquals(200, response.statusCode()); return getWhenHttpClient().body(response); }) .then(body -> { JsonObject json = new JsonObject(body.toString()); assertEquals("Andy", json.getString("name")); testComplete(); return null; }) .otherwise(this::onRejected); await(); } private void runTest(String additionalPath, Consumer<Buffer> assertMethod) throws Exception { getWhenHttpClient().requestAbs(HttpMethod.GET, BASE_PATH + additionalPath, new RequestOptions().setPauseResponse(true)) .then(response -> { assertEquals(200, response.statusCode()); return getWhenHttpClient().body(response); }) .then(body -> { assertMethod.accept(body); testComplete(); return null; }) .otherwise(this::onRejected); await(); } }
3,091
0.575865
0.57166
102
29.313726
27.399006
127
false
false
0
0
0
0
0
0
0.539216
false
false
9
01f2c9abd4a541f0c03a22cbeb2c5bffb538f547
4,956,392,318,806
83add258142167f73ed33247bb9b205f2846d2e3
/oa4mp-server-loader-oauth2/src/main/java/edu/uiuc/ncsa/myproxy/oa4mp/oauth2/cm/util/client/RemoveRequest.java
8a5397327ccfb298d58c0945e3d0e32284780328
[]
no_license
ncsa/OA4MP
https://github.com/ncsa/OA4MP
2ca229505474ca8cadce3eb677db31bbd92d862a
f9f985c1953b94d7dd20aa0aa09b21553589cf7e
refs/heads/master
2023-04-07T16:21:57.708000
2023-04-06T15:32:20
2023-04-06T15:32:20
58,557,836
6
7
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.uiuc.ncsa.myproxy.oa4mp.oauth2.cm.util.client; import edu.uiuc.ncsa.myproxy.oa4mp.oauth2.storage.clients.OA2Client; import edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClient; /** * <p>Created by Jeff Gaynor<br> * on 12/2/16 at 1:44 PM */ public class RemoveRequest extends ClientRequest { public RemoveRequest(AdminClient adminClient, OA2Client client) { super(adminClient, client); } }
UTF-8
Java
435
java
RemoveRequest.java
Java
[ { "context": "min.adminClient.AdminClient;\n\n/**\n * <p>Created by Jeff Gaynor<br>\n * on 12/2/16 at 1:44 PM\n */\npublic class Re", "end": 235, "score": 0.9998965263366699, "start": 224, "tag": "NAME", "value": "Jeff Gaynor" } ]
null
[]
package edu.uiuc.ncsa.myproxy.oa4mp.oauth2.cm.util.client; import edu.uiuc.ncsa.myproxy.oa4mp.oauth2.storage.clients.OA2Client; import edu.uiuc.ncsa.myproxy.oa4mp.server.admin.adminClient.AdminClient; /** * <p>Created by <NAME><br> * on 12/2/16 at 1:44 PM */ public class RemoveRequest extends ClientRequest { public RemoveRequest(AdminClient adminClient, OA2Client client) { super(adminClient, client); } }
430
0.749425
0.714943
14
30.071428
27.633997
72
false
false
0
0
0
0
0
0
0.428571
false
false
9
0137d2e4732c63974f0b5d27d177afd6ffa46c95
4,956,392,318,780
cf843c93f8749deab895b679c0df39e8a218ed7a
/src/main/java/ssm/model/CourseExample.java
823ff94e1cb95fadec1b3b64e9254ac3ca79c5fb
[]
no_license
CasparGX/DynamicScheduleService
https://github.com/CasparGX/DynamicScheduleService
f5e15ad00b5d7c068922f3497842f036d2d2a24f
c0f9270da640555275514367089cd3f826e37253
refs/heads/master
2021-01-19T22:53:07.434000
2017-05-05T09:49:44
2017-05-05T09:49:44
88,881,777
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ssm.model; import java.util.ArrayList; import java.util.List; public class CourseExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public CourseExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; } public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; } public Criteria andIdEqualTo(Integer value) { addCriterion("id =", value, "id"); return (Criteria) this; } public Criteria andIdNotEqualTo(Integer value) { addCriterion("id <>", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThan(Integer value) { addCriterion("id >", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(Integer value) { addCriterion("id >=", value, "id"); return (Criteria) this; } public Criteria andIdLessThan(Integer value) { addCriterion("id <", value, "id"); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(Integer value) { addCriterion("id <=", value, "id"); return (Criteria) this; } public Criteria andIdIn(List<Integer> values) { addCriterion("id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<Integer> values) { addCriterion("id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(Integer value1, Integer value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(Integer value1, Integer value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andCourseIsNull() { addCriterion("course is null"); return (Criteria) this; } public Criteria andCourseIsNotNull() { addCriterion("course is not null"); return (Criteria) this; } public Criteria andCourseEqualTo(String value) { addCriterion("course =", value, "course"); return (Criteria) this; } public Criteria andCourseNotEqualTo(String value) { addCriterion("course <>", value, "course"); return (Criteria) this; } public Criteria andCourseGreaterThan(String value) { addCriterion("course >", value, "course"); return (Criteria) this; } public Criteria andCourseGreaterThanOrEqualTo(String value) { addCriterion("course >=", value, "course"); return (Criteria) this; } public Criteria andCourseLessThan(String value) { addCriterion("course <", value, "course"); return (Criteria) this; } public Criteria andCourseLessThanOrEqualTo(String value) { addCriterion("course <=", value, "course"); return (Criteria) this; } public Criteria andCourseLike(String value) { addCriterion("course like", value, "course"); return (Criteria) this; } public Criteria andCourseNotLike(String value) { addCriterion("course not like", value, "course"); return (Criteria) this; } public Criteria andCourseIn(List<String> values) { addCriterion("course in", values, "course"); return (Criteria) this; } public Criteria andCourseNotIn(List<String> values) { addCriterion("course not in", values, "course"); return (Criteria) this; } public Criteria andCourseBetween(String value1, String value2) { addCriterion("course between", value1, value2, "course"); return (Criteria) this; } public Criteria andCourseNotBetween(String value1, String value2) { addCriterion("course not between", value1, value2, "course"); return (Criteria) this; } public Criteria andLocationIsNull() { addCriterion("location is null"); return (Criteria) this; } public Criteria andLocationIsNotNull() { addCriterion("location is not null"); return (Criteria) this; } public Criteria andLocationEqualTo(String value) { addCriterion("location =", value, "location"); return (Criteria) this; } public Criteria andLocationNotEqualTo(String value) { addCriterion("location <>", value, "location"); return (Criteria) this; } public Criteria andLocationGreaterThan(String value) { addCriterion("location >", value, "location"); return (Criteria) this; } public Criteria andLocationGreaterThanOrEqualTo(String value) { addCriterion("location >=", value, "location"); return (Criteria) this; } public Criteria andLocationLessThan(String value) { addCriterion("location <", value, "location"); return (Criteria) this; } public Criteria andLocationLessThanOrEqualTo(String value) { addCriterion("location <=", value, "location"); return (Criteria) this; } public Criteria andLocationLike(String value) { addCriterion("location like", value, "location"); return (Criteria) this; } public Criteria andLocationNotLike(String value) { addCriterion("location not like", value, "location"); return (Criteria) this; } public Criteria andLocationIn(List<String> values) { addCriterion("location in", values, "location"); return (Criteria) this; } public Criteria andLocationNotIn(List<String> values) { addCriterion("location not in", values, "location"); return (Criteria) this; } public Criteria andLocationBetween(String value1, String value2) { addCriterion("location between", value1, value2, "location"); return (Criteria) this; } public Criteria andLocationNotBetween(String value1, String value2) { addCriterion("location not between", value1, value2, "location"); return (Criteria) this; } public Criteria andTeacherIsNull() { addCriterion("teacher is null"); return (Criteria) this; } public Criteria andTeacherIsNotNull() { addCriterion("teacher is not null"); return (Criteria) this; } public Criteria andTeacherEqualTo(String value) { addCriterion("teacher =", value, "teacher"); return (Criteria) this; } public Criteria andTeacherNotEqualTo(String value) { addCriterion("teacher <>", value, "teacher"); return (Criteria) this; } public Criteria andTeacherGreaterThan(String value) { addCriterion("teacher >", value, "teacher"); return (Criteria) this; } public Criteria andTeacherGreaterThanOrEqualTo(String value) { addCriterion("teacher >=", value, "teacher"); return (Criteria) this; } public Criteria andTeacherLessThan(String value) { addCriterion("teacher <", value, "teacher"); return (Criteria) this; } public Criteria andTeacherLessThanOrEqualTo(String value) { addCriterion("teacher <=", value, "teacher"); return (Criteria) this; } public Criteria andTeacherLike(String value) { addCriterion("teacher like", value, "teacher"); return (Criteria) this; } public Criteria andTeacherNotLike(String value) { addCriterion("teacher not like", value, "teacher"); return (Criteria) this; } public Criteria andTeacherIn(List<String> values) { addCriterion("teacher in", values, "teacher"); return (Criteria) this; } public Criteria andTeacherNotIn(List<String> values) { addCriterion("teacher not in", values, "teacher"); return (Criteria) this; } public Criteria andTeacherBetween(String value1, String value2) { addCriterion("teacher between", value1, value2, "teacher"); return (Criteria) this; } public Criteria andTeacherNotBetween(String value1, String value2) { addCriterion("teacher not between", value1, value2, "teacher"); return (Criteria) this; } public Criteria andWeekDayIsNull() { addCriterion("week_day is null"); return (Criteria) this; } public Criteria andWeekDayIsNotNull() { addCriterion("week_day is not null"); return (Criteria) this; } public Criteria andWeekDayEqualTo(Integer value) { addCriterion("week_day =", value, "weekDay"); return (Criteria) this; } public Criteria andWeekDayNotEqualTo(Integer value) { addCriterion("week_day <>", value, "weekDay"); return (Criteria) this; } public Criteria andWeekDayGreaterThan(Integer value) { addCriterion("week_day >", value, "weekDay"); return (Criteria) this; } public Criteria andWeekDayGreaterThanOrEqualTo(Integer value) { addCriterion("week_day >=", value, "weekDay"); return (Criteria) this; } public Criteria andWeekDayLessThan(Integer value) { addCriterion("week_day <", value, "weekDay"); return (Criteria) this; } public Criteria andWeekDayLessThanOrEqualTo(Integer value) { addCriterion("week_day <=", value, "weekDay"); return (Criteria) this; } public Criteria andWeekDayIn(List<Integer> values) { addCriterion("week_day in", values, "weekDay"); return (Criteria) this; } public Criteria andWeekDayNotIn(List<Integer> values) { addCriterion("week_day not in", values, "weekDay"); return (Criteria) this; } public Criteria andWeekDayBetween(Integer value1, Integer value2) { addCriterion("week_day between", value1, value2, "weekDay"); return (Criteria) this; } public Criteria andWeekDayNotBetween(Integer value1, Integer value2) { addCriterion("week_day not between", value1, value2, "weekDay"); return (Criteria) this; } public Criteria andWeekStringIsNull() { addCriterion("week_string is null"); return (Criteria) this; } public Criteria andWeekStringIsNotNull() { addCriterion("week_string is not null"); return (Criteria) this; } public Criteria andWeekStringEqualTo(String value) { addCriterion("week_string =", value, "weekString"); return (Criteria) this; } public Criteria andWeekStringNotEqualTo(String value) { addCriterion("week_string <>", value, "weekString"); return (Criteria) this; } public Criteria andWeekStringGreaterThan(String value) { addCriterion("week_string >", value, "weekString"); return (Criteria) this; } public Criteria andWeekStringGreaterThanOrEqualTo(String value) { addCriterion("week_string >=", value, "weekString"); return (Criteria) this; } public Criteria andWeekStringLessThan(String value) { addCriterion("week_string <", value, "weekString"); return (Criteria) this; } public Criteria andWeekStringLessThanOrEqualTo(String value) { addCriterion("week_string <=", value, "weekString"); return (Criteria) this; } public Criteria andWeekStringLike(String value) { addCriterion("week_string like", value, "weekString"); return (Criteria) this; } public Criteria andWeekStringNotLike(String value) { addCriterion("week_string not like", value, "weekString"); return (Criteria) this; } public Criteria andWeekStringIn(List<String> values) { addCriterion("week_string in", values, "weekString"); return (Criteria) this; } public Criteria andWeekStringNotIn(List<String> values) { addCriterion("week_string not in", values, "weekString"); return (Criteria) this; } public Criteria andWeekStringBetween(String value1, String value2) { addCriterion("week_string between", value1, value2, "weekString"); return (Criteria) this; } public Criteria andWeekStringNotBetween(String value1, String value2) { addCriterion("week_string not between", value1, value2, "weekString"); return (Criteria) this; } public Criteria andSectionLengthIsNull() { addCriterion("section_length is null"); return (Criteria) this; } public Criteria andSectionLengthIsNotNull() { addCriterion("section_length is not null"); return (Criteria) this; } public Criteria andSectionLengthEqualTo(Integer value) { addCriterion("section_length =", value, "sectionLength"); return (Criteria) this; } public Criteria andSectionLengthNotEqualTo(Integer value) { addCriterion("section_length <>", value, "sectionLength"); return (Criteria) this; } public Criteria andSectionLengthGreaterThan(Integer value) { addCriterion("section_length >", value, "sectionLength"); return (Criteria) this; } public Criteria andSectionLengthGreaterThanOrEqualTo(Integer value) { addCriterion("section_length >=", value, "sectionLength"); return (Criteria) this; } public Criteria andSectionLengthLessThan(Integer value) { addCriterion("section_length <", value, "sectionLength"); return (Criteria) this; } public Criteria andSectionLengthLessThanOrEqualTo(Integer value) { addCriterion("section_length <=", value, "sectionLength"); return (Criteria) this; } public Criteria andSectionLengthIn(List<Integer> values) { addCriterion("section_length in", values, "sectionLength"); return (Criteria) this; } public Criteria andSectionLengthNotIn(List<Integer> values) { addCriterion("section_length not in", values, "sectionLength"); return (Criteria) this; } public Criteria andSectionLengthBetween(Integer value1, Integer value2) { addCriterion("section_length between", value1, value2, "sectionLength"); return (Criteria) this; } public Criteria andSectionLengthNotBetween(Integer value1, Integer value2) { addCriterion("section_length not between", value1, value2, "sectionLength"); return (Criteria) this; } public Criteria andSectionStartIsNull() { addCriterion("section_start is null"); return (Criteria) this; } public Criteria andSectionStartIsNotNull() { addCriterion("section_start is not null"); return (Criteria) this; } public Criteria andSectionStartEqualTo(Integer value) { addCriterion("section_start =", value, "sectionStart"); return (Criteria) this; } public Criteria andSectionStartNotEqualTo(Integer value) { addCriterion("section_start <>", value, "sectionStart"); return (Criteria) this; } public Criteria andSectionStartGreaterThan(Integer value) { addCriterion("section_start >", value, "sectionStart"); return (Criteria) this; } public Criteria andSectionStartGreaterThanOrEqualTo(Integer value) { addCriterion("section_start >=", value, "sectionStart"); return (Criteria) this; } public Criteria andSectionStartLessThan(Integer value) { addCriterion("section_start <", value, "sectionStart"); return (Criteria) this; } public Criteria andSectionStartLessThanOrEqualTo(Integer value) { addCriterion("section_start <=", value, "sectionStart"); return (Criteria) this; } public Criteria andSectionStartIn(List<Integer> values) { addCriterion("section_start in", values, "sectionStart"); return (Criteria) this; } public Criteria andSectionStartNotIn(List<Integer> values) { addCriterion("section_start not in", values, "sectionStart"); return (Criteria) this; } public Criteria andSectionStartBetween(Integer value1, Integer value2) { addCriterion("section_start between", value1, value2, "sectionStart"); return (Criteria) this; } public Criteria andSectionStartNotBetween(Integer value1, Integer value2) { addCriterion("section_start not between", value1, value2, "sectionStart"); return (Criteria) this; } public Criteria andSectionEndIsNull() { addCriterion("section_end is null"); return (Criteria) this; } public Criteria andSectionEndIsNotNull() { addCriterion("section_end is not null"); return (Criteria) this; } public Criteria andSectionEndEqualTo(Integer value) { addCriterion("section_end =", value, "sectionEnd"); return (Criteria) this; } public Criteria andSectionEndNotEqualTo(Integer value) { addCriterion("section_end <>", value, "sectionEnd"); return (Criteria) this; } public Criteria andSectionEndGreaterThan(Integer value) { addCriterion("section_end >", value, "sectionEnd"); return (Criteria) this; } public Criteria andSectionEndGreaterThanOrEqualTo(Integer value) { addCriterion("section_end >=", value, "sectionEnd"); return (Criteria) this; } public Criteria andSectionEndLessThan(Integer value) { addCriterion("section_end <", value, "sectionEnd"); return (Criteria) this; } public Criteria andSectionEndLessThanOrEqualTo(Integer value) { addCriterion("section_end <=", value, "sectionEnd"); return (Criteria) this; } public Criteria andSectionEndIn(List<Integer> values) { addCriterion("section_end in", values, "sectionEnd"); return (Criteria) this; } public Criteria andSectionEndNotIn(List<Integer> values) { addCriterion("section_end not in", values, "sectionEnd"); return (Criteria) this; } public Criteria andSectionEndBetween(Integer value1, Integer value2) { addCriterion("section_end between", value1, value2, "sectionEnd"); return (Criteria) this; } public Criteria andSectionEndNotBetween(Integer value1, Integer value2) { addCriterion("section_end not between", value1, value2, "sectionEnd"); return (Criteria) this; } public Criteria andWeekIsNull() { addCriterion("week is null"); return (Criteria) this; } public Criteria andWeekIsNotNull() { addCriterion("week is not null"); return (Criteria) this; } public Criteria andWeekEqualTo(String value) { addCriterion("week =", value, "week"); return (Criteria) this; } public Criteria andWeekNotEqualTo(String value) { addCriterion("week <>", value, "week"); return (Criteria) this; } public Criteria andWeekGreaterThan(String value) { addCriterion("week >", value, "week"); return (Criteria) this; } public Criteria andWeekGreaterThanOrEqualTo(String value) { addCriterion("week >=", value, "week"); return (Criteria) this; } public Criteria andWeekLessThan(String value) { addCriterion("week <", value, "week"); return (Criteria) this; } public Criteria andWeekLessThanOrEqualTo(String value) { addCriterion("week <=", value, "week"); return (Criteria) this; } public Criteria andWeekLike(String value) { addCriterion("week like", value, "week"); return (Criteria) this; } public Criteria andWeekNotLike(String value) { addCriterion("week not like", value, "week"); return (Criteria) this; } public Criteria andWeekIn(List<String> values) { addCriterion("week in", values, "week"); return (Criteria) this; } public Criteria andWeekNotIn(List<String> values) { addCriterion("week not in", values, "week"); return (Criteria) this; } public Criteria andWeekBetween(String value1, String value2) { addCriterion("week between", value1, value2, "week"); return (Criteria) this; } public Criteria andWeekNotBetween(String value1, String value2) { addCriterion("week not between", value1, value2, "week"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
UTF-8
Java
27,351
java
CourseExample.java
Java
[]
null
[]
package ssm.model; import java.util.ArrayList; import java.util.List; public class CourseExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public CourseExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; } public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; } public Criteria andIdEqualTo(Integer value) { addCriterion("id =", value, "id"); return (Criteria) this; } public Criteria andIdNotEqualTo(Integer value) { addCriterion("id <>", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThan(Integer value) { addCriterion("id >", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(Integer value) { addCriterion("id >=", value, "id"); return (Criteria) this; } public Criteria andIdLessThan(Integer value) { addCriterion("id <", value, "id"); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(Integer value) { addCriterion("id <=", value, "id"); return (Criteria) this; } public Criteria andIdIn(List<Integer> values) { addCriterion("id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<Integer> values) { addCriterion("id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(Integer value1, Integer value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(Integer value1, Integer value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andCourseIsNull() { addCriterion("course is null"); return (Criteria) this; } public Criteria andCourseIsNotNull() { addCriterion("course is not null"); return (Criteria) this; } public Criteria andCourseEqualTo(String value) { addCriterion("course =", value, "course"); return (Criteria) this; } public Criteria andCourseNotEqualTo(String value) { addCriterion("course <>", value, "course"); return (Criteria) this; } public Criteria andCourseGreaterThan(String value) { addCriterion("course >", value, "course"); return (Criteria) this; } public Criteria andCourseGreaterThanOrEqualTo(String value) { addCriterion("course >=", value, "course"); return (Criteria) this; } public Criteria andCourseLessThan(String value) { addCriterion("course <", value, "course"); return (Criteria) this; } public Criteria andCourseLessThanOrEqualTo(String value) { addCriterion("course <=", value, "course"); return (Criteria) this; } public Criteria andCourseLike(String value) { addCriterion("course like", value, "course"); return (Criteria) this; } public Criteria andCourseNotLike(String value) { addCriterion("course not like", value, "course"); return (Criteria) this; } public Criteria andCourseIn(List<String> values) { addCriterion("course in", values, "course"); return (Criteria) this; } public Criteria andCourseNotIn(List<String> values) { addCriterion("course not in", values, "course"); return (Criteria) this; } public Criteria andCourseBetween(String value1, String value2) { addCriterion("course between", value1, value2, "course"); return (Criteria) this; } public Criteria andCourseNotBetween(String value1, String value2) { addCriterion("course not between", value1, value2, "course"); return (Criteria) this; } public Criteria andLocationIsNull() { addCriterion("location is null"); return (Criteria) this; } public Criteria andLocationIsNotNull() { addCriterion("location is not null"); return (Criteria) this; } public Criteria andLocationEqualTo(String value) { addCriterion("location =", value, "location"); return (Criteria) this; } public Criteria andLocationNotEqualTo(String value) { addCriterion("location <>", value, "location"); return (Criteria) this; } public Criteria andLocationGreaterThan(String value) { addCriterion("location >", value, "location"); return (Criteria) this; } public Criteria andLocationGreaterThanOrEqualTo(String value) { addCriterion("location >=", value, "location"); return (Criteria) this; } public Criteria andLocationLessThan(String value) { addCriterion("location <", value, "location"); return (Criteria) this; } public Criteria andLocationLessThanOrEqualTo(String value) { addCriterion("location <=", value, "location"); return (Criteria) this; } public Criteria andLocationLike(String value) { addCriterion("location like", value, "location"); return (Criteria) this; } public Criteria andLocationNotLike(String value) { addCriterion("location not like", value, "location"); return (Criteria) this; } public Criteria andLocationIn(List<String> values) { addCriterion("location in", values, "location"); return (Criteria) this; } public Criteria andLocationNotIn(List<String> values) { addCriterion("location not in", values, "location"); return (Criteria) this; } public Criteria andLocationBetween(String value1, String value2) { addCriterion("location between", value1, value2, "location"); return (Criteria) this; } public Criteria andLocationNotBetween(String value1, String value2) { addCriterion("location not between", value1, value2, "location"); return (Criteria) this; } public Criteria andTeacherIsNull() { addCriterion("teacher is null"); return (Criteria) this; } public Criteria andTeacherIsNotNull() { addCriterion("teacher is not null"); return (Criteria) this; } public Criteria andTeacherEqualTo(String value) { addCriterion("teacher =", value, "teacher"); return (Criteria) this; } public Criteria andTeacherNotEqualTo(String value) { addCriterion("teacher <>", value, "teacher"); return (Criteria) this; } public Criteria andTeacherGreaterThan(String value) { addCriterion("teacher >", value, "teacher"); return (Criteria) this; } public Criteria andTeacherGreaterThanOrEqualTo(String value) { addCriterion("teacher >=", value, "teacher"); return (Criteria) this; } public Criteria andTeacherLessThan(String value) { addCriterion("teacher <", value, "teacher"); return (Criteria) this; } public Criteria andTeacherLessThanOrEqualTo(String value) { addCriterion("teacher <=", value, "teacher"); return (Criteria) this; } public Criteria andTeacherLike(String value) { addCriterion("teacher like", value, "teacher"); return (Criteria) this; } public Criteria andTeacherNotLike(String value) { addCriterion("teacher not like", value, "teacher"); return (Criteria) this; } public Criteria andTeacherIn(List<String> values) { addCriterion("teacher in", values, "teacher"); return (Criteria) this; } public Criteria andTeacherNotIn(List<String> values) { addCriterion("teacher not in", values, "teacher"); return (Criteria) this; } public Criteria andTeacherBetween(String value1, String value2) { addCriterion("teacher between", value1, value2, "teacher"); return (Criteria) this; } public Criteria andTeacherNotBetween(String value1, String value2) { addCriterion("teacher not between", value1, value2, "teacher"); return (Criteria) this; } public Criteria andWeekDayIsNull() { addCriterion("week_day is null"); return (Criteria) this; } public Criteria andWeekDayIsNotNull() { addCriterion("week_day is not null"); return (Criteria) this; } public Criteria andWeekDayEqualTo(Integer value) { addCriterion("week_day =", value, "weekDay"); return (Criteria) this; } public Criteria andWeekDayNotEqualTo(Integer value) { addCriterion("week_day <>", value, "weekDay"); return (Criteria) this; } public Criteria andWeekDayGreaterThan(Integer value) { addCriterion("week_day >", value, "weekDay"); return (Criteria) this; } public Criteria andWeekDayGreaterThanOrEqualTo(Integer value) { addCriterion("week_day >=", value, "weekDay"); return (Criteria) this; } public Criteria andWeekDayLessThan(Integer value) { addCriterion("week_day <", value, "weekDay"); return (Criteria) this; } public Criteria andWeekDayLessThanOrEqualTo(Integer value) { addCriterion("week_day <=", value, "weekDay"); return (Criteria) this; } public Criteria andWeekDayIn(List<Integer> values) { addCriterion("week_day in", values, "weekDay"); return (Criteria) this; } public Criteria andWeekDayNotIn(List<Integer> values) { addCriterion("week_day not in", values, "weekDay"); return (Criteria) this; } public Criteria andWeekDayBetween(Integer value1, Integer value2) { addCriterion("week_day between", value1, value2, "weekDay"); return (Criteria) this; } public Criteria andWeekDayNotBetween(Integer value1, Integer value2) { addCriterion("week_day not between", value1, value2, "weekDay"); return (Criteria) this; } public Criteria andWeekStringIsNull() { addCriterion("week_string is null"); return (Criteria) this; } public Criteria andWeekStringIsNotNull() { addCriterion("week_string is not null"); return (Criteria) this; } public Criteria andWeekStringEqualTo(String value) { addCriterion("week_string =", value, "weekString"); return (Criteria) this; } public Criteria andWeekStringNotEqualTo(String value) { addCriterion("week_string <>", value, "weekString"); return (Criteria) this; } public Criteria andWeekStringGreaterThan(String value) { addCriterion("week_string >", value, "weekString"); return (Criteria) this; } public Criteria andWeekStringGreaterThanOrEqualTo(String value) { addCriterion("week_string >=", value, "weekString"); return (Criteria) this; } public Criteria andWeekStringLessThan(String value) { addCriterion("week_string <", value, "weekString"); return (Criteria) this; } public Criteria andWeekStringLessThanOrEqualTo(String value) { addCriterion("week_string <=", value, "weekString"); return (Criteria) this; } public Criteria andWeekStringLike(String value) { addCriterion("week_string like", value, "weekString"); return (Criteria) this; } public Criteria andWeekStringNotLike(String value) { addCriterion("week_string not like", value, "weekString"); return (Criteria) this; } public Criteria andWeekStringIn(List<String> values) { addCriterion("week_string in", values, "weekString"); return (Criteria) this; } public Criteria andWeekStringNotIn(List<String> values) { addCriterion("week_string not in", values, "weekString"); return (Criteria) this; } public Criteria andWeekStringBetween(String value1, String value2) { addCriterion("week_string between", value1, value2, "weekString"); return (Criteria) this; } public Criteria andWeekStringNotBetween(String value1, String value2) { addCriterion("week_string not between", value1, value2, "weekString"); return (Criteria) this; } public Criteria andSectionLengthIsNull() { addCriterion("section_length is null"); return (Criteria) this; } public Criteria andSectionLengthIsNotNull() { addCriterion("section_length is not null"); return (Criteria) this; } public Criteria andSectionLengthEqualTo(Integer value) { addCriterion("section_length =", value, "sectionLength"); return (Criteria) this; } public Criteria andSectionLengthNotEqualTo(Integer value) { addCriterion("section_length <>", value, "sectionLength"); return (Criteria) this; } public Criteria andSectionLengthGreaterThan(Integer value) { addCriterion("section_length >", value, "sectionLength"); return (Criteria) this; } public Criteria andSectionLengthGreaterThanOrEqualTo(Integer value) { addCriterion("section_length >=", value, "sectionLength"); return (Criteria) this; } public Criteria andSectionLengthLessThan(Integer value) { addCriterion("section_length <", value, "sectionLength"); return (Criteria) this; } public Criteria andSectionLengthLessThanOrEqualTo(Integer value) { addCriterion("section_length <=", value, "sectionLength"); return (Criteria) this; } public Criteria andSectionLengthIn(List<Integer> values) { addCriterion("section_length in", values, "sectionLength"); return (Criteria) this; } public Criteria andSectionLengthNotIn(List<Integer> values) { addCriterion("section_length not in", values, "sectionLength"); return (Criteria) this; } public Criteria andSectionLengthBetween(Integer value1, Integer value2) { addCriterion("section_length between", value1, value2, "sectionLength"); return (Criteria) this; } public Criteria andSectionLengthNotBetween(Integer value1, Integer value2) { addCriterion("section_length not between", value1, value2, "sectionLength"); return (Criteria) this; } public Criteria andSectionStartIsNull() { addCriterion("section_start is null"); return (Criteria) this; } public Criteria andSectionStartIsNotNull() { addCriterion("section_start is not null"); return (Criteria) this; } public Criteria andSectionStartEqualTo(Integer value) { addCriterion("section_start =", value, "sectionStart"); return (Criteria) this; } public Criteria andSectionStartNotEqualTo(Integer value) { addCriterion("section_start <>", value, "sectionStart"); return (Criteria) this; } public Criteria andSectionStartGreaterThan(Integer value) { addCriterion("section_start >", value, "sectionStart"); return (Criteria) this; } public Criteria andSectionStartGreaterThanOrEqualTo(Integer value) { addCriterion("section_start >=", value, "sectionStart"); return (Criteria) this; } public Criteria andSectionStartLessThan(Integer value) { addCriterion("section_start <", value, "sectionStart"); return (Criteria) this; } public Criteria andSectionStartLessThanOrEqualTo(Integer value) { addCriterion("section_start <=", value, "sectionStart"); return (Criteria) this; } public Criteria andSectionStartIn(List<Integer> values) { addCriterion("section_start in", values, "sectionStart"); return (Criteria) this; } public Criteria andSectionStartNotIn(List<Integer> values) { addCriterion("section_start not in", values, "sectionStart"); return (Criteria) this; } public Criteria andSectionStartBetween(Integer value1, Integer value2) { addCriterion("section_start between", value1, value2, "sectionStart"); return (Criteria) this; } public Criteria andSectionStartNotBetween(Integer value1, Integer value2) { addCriterion("section_start not between", value1, value2, "sectionStart"); return (Criteria) this; } public Criteria andSectionEndIsNull() { addCriterion("section_end is null"); return (Criteria) this; } public Criteria andSectionEndIsNotNull() { addCriterion("section_end is not null"); return (Criteria) this; } public Criteria andSectionEndEqualTo(Integer value) { addCriterion("section_end =", value, "sectionEnd"); return (Criteria) this; } public Criteria andSectionEndNotEqualTo(Integer value) { addCriterion("section_end <>", value, "sectionEnd"); return (Criteria) this; } public Criteria andSectionEndGreaterThan(Integer value) { addCriterion("section_end >", value, "sectionEnd"); return (Criteria) this; } public Criteria andSectionEndGreaterThanOrEqualTo(Integer value) { addCriterion("section_end >=", value, "sectionEnd"); return (Criteria) this; } public Criteria andSectionEndLessThan(Integer value) { addCriterion("section_end <", value, "sectionEnd"); return (Criteria) this; } public Criteria andSectionEndLessThanOrEqualTo(Integer value) { addCriterion("section_end <=", value, "sectionEnd"); return (Criteria) this; } public Criteria andSectionEndIn(List<Integer> values) { addCriterion("section_end in", values, "sectionEnd"); return (Criteria) this; } public Criteria andSectionEndNotIn(List<Integer> values) { addCriterion("section_end not in", values, "sectionEnd"); return (Criteria) this; } public Criteria andSectionEndBetween(Integer value1, Integer value2) { addCriterion("section_end between", value1, value2, "sectionEnd"); return (Criteria) this; } public Criteria andSectionEndNotBetween(Integer value1, Integer value2) { addCriterion("section_end not between", value1, value2, "sectionEnd"); return (Criteria) this; } public Criteria andWeekIsNull() { addCriterion("week is null"); return (Criteria) this; } public Criteria andWeekIsNotNull() { addCriterion("week is not null"); return (Criteria) this; } public Criteria andWeekEqualTo(String value) { addCriterion("week =", value, "week"); return (Criteria) this; } public Criteria andWeekNotEqualTo(String value) { addCriterion("week <>", value, "week"); return (Criteria) this; } public Criteria andWeekGreaterThan(String value) { addCriterion("week >", value, "week"); return (Criteria) this; } public Criteria andWeekGreaterThanOrEqualTo(String value) { addCriterion("week >=", value, "week"); return (Criteria) this; } public Criteria andWeekLessThan(String value) { addCriterion("week <", value, "week"); return (Criteria) this; } public Criteria andWeekLessThanOrEqualTo(String value) { addCriterion("week <=", value, "week"); return (Criteria) this; } public Criteria andWeekLike(String value) { addCriterion("week like", value, "week"); return (Criteria) this; } public Criteria andWeekNotLike(String value) { addCriterion("week not like", value, "week"); return (Criteria) this; } public Criteria andWeekIn(List<String> values) { addCriterion("week in", values, "week"); return (Criteria) this; } public Criteria andWeekNotIn(List<String> values) { addCriterion("week not in", values, "week"); return (Criteria) this; } public Criteria andWeekBetween(String value1, String value2) { addCriterion("week between", value1, value2, "week"); return (Criteria) this; } public Criteria andWeekNotBetween(String value1, String value2) { addCriterion("week not between", value1, value2, "week"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
27,351
0.579869
0.576652
850
31.178823
25.705637
102
false
false
0
0
0
0
0
0
0.722353
false
false
9
7855877277ecd2f555cfdfed6983ddb8551ae2dc
17,721,035,108,180
82adcbbfb6562588e71aee39c2427d6bdcbb5fbb
/src/main/java/app/model/cryptomodes/passwordbasedcrypto/pbewithshaand128bitaescbcbc/PBEWithSHAAnd128BitAES_CBC_BCDecryptor.java
0f6e3379fe85307fa21280315a20281d338ab3a1
[]
no_license
AT92/STE
https://github.com/AT92/STE
7165e0e95680c42681aaf7da2085cd05defe0266
caf167b70bdaa3d71e897bbbc8377a660c7b5d65
refs/heads/master
2021-07-14T03:50:39.433000
2017-10-18T17:41:40
2017-10-18T17:41:40
92,201,243
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package app.model.cryptomodes.passwordbasedcrypto.pbewithshaand128bitaescbcbc; import app.model.Decryptor; import javax.crypto.Cipher; import javax.crypto.SecretKey; /** * This class creates a PBEWithSHAAnd128BitAES_CBC_BCDecryptor * * @author Andrej Tihonov * @version 1.0 */ public final class PBEWithSHAAnd128BitAES_CBC_BCDecryptor extends Decryptor { /** * This method creates a new PBEWithSHAAnd128BitAES_CBC_BCDecryptor. * @param hashType, the type of hash this decryptor is using. * @param key, the key, this decryptor is using. * @throws Exception, is thrown, when something bad happens. */ public PBEWithSHAAnd128BitAES_CBC_BCDecryptor(String hashType, SecretKey key) throws Exception { super(hashType); setKey(key); } @Override public byte[] decrypt(byte[] input) throws Exception { //Getting the cipher instance Cipher cipher = Cipher.getInstance("PBEWithSHAAnd128BitAES-CBC-BC", "BC"); //initializing the cipher by setting the decryption mode and passing the key. cipher.init(Cipher.DECRYPT_MODE, getKey()); //creating the output array with the correct size byte[] output = new byte[cipher.getOutputSize(input.length)]; //decrypting the first blocks int ctLength = cipher.update(input, 0, input.length, output, 0); //decrypting the last block ctLength += cipher.doFinal(output, ctLength); //removing the ahs and the padding return removeHash(output, ctLength); } }
UTF-8
Java
1,546
java
PBEWithSHAAnd128BitAES_CBC_BCDecryptor.java
Java
[ { "context": "EWithSHAAnd128BitAES_CBC_BCDecryptor\n *\n * @author Andrej Tihonov\n * @version 1.0\n */\npublic final class PBEWithSHA", "end": 263, "score": 0.9998770356178284, "start": 249, "tag": "NAME", "value": "Andrej Tihonov" } ]
null
[]
package app.model.cryptomodes.passwordbasedcrypto.pbewithshaand128bitaescbcbc; import app.model.Decryptor; import javax.crypto.Cipher; import javax.crypto.SecretKey; /** * This class creates a PBEWithSHAAnd128BitAES_CBC_BCDecryptor * * @author <NAME> * @version 1.0 */ public final class PBEWithSHAAnd128BitAES_CBC_BCDecryptor extends Decryptor { /** * This method creates a new PBEWithSHAAnd128BitAES_CBC_BCDecryptor. * @param hashType, the type of hash this decryptor is using. * @param key, the key, this decryptor is using. * @throws Exception, is thrown, when something bad happens. */ public PBEWithSHAAnd128BitAES_CBC_BCDecryptor(String hashType, SecretKey key) throws Exception { super(hashType); setKey(key); } @Override public byte[] decrypt(byte[] input) throws Exception { //Getting the cipher instance Cipher cipher = Cipher.getInstance("PBEWithSHAAnd128BitAES-CBC-BC", "BC"); //initializing the cipher by setting the decryption mode and passing the key. cipher.init(Cipher.DECRYPT_MODE, getKey()); //creating the output array with the correct size byte[] output = new byte[cipher.getOutputSize(input.length)]; //decrypting the first blocks int ctLength = cipher.update(input, 0, input.length, output, 0); //decrypting the last block ctLength += cipher.doFinal(output, ctLength); //removing the ahs and the padding return removeHash(output, ctLength); } }
1,538
0.698577
0.684347
40
37.650002
28.926243
100
false
false
0
0
0
0
0
0
0.65
false
false
9
50bc2ba34ce73b3b415eb3503d6391794f943182
24,309,514,939,461
eb12633759794e4d1b9f3631cc14be96837dfe6c
/SlotMachineFrame.java
92f091169c69c6eb90d83e9e77f942348b73f059
[]
no_license
gabroelA/Slot-Machine
https://github.com/gabroelA/Slot-Machine
46efbfe56fd8913050697bbe68b6e44e6e2411d7
db99a5996b85917fbbc921760ffd7d09d500c8d3
refs/heads/master
2020-03-07T14:29:09.385000
2018-03-31T11:52:32
2018-03-31T11:52:32
127,527,642
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; @SuppressWarnings("serial") public class SlotMachineFrame extends JFrame implements ISlotMachine { private JButton button = new JButton("Play"); private JLabel label = new JLabel("Click Play"); private SlotMachinePanel panel = new SlotMachinePanel(); public SlotMachineFrame(int w, int h) { this.setSize(w, h); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setLocationRelativeTo(null); setLayout(new BorderLayout()); button.setBorder(BorderFactory.createLineBorder(Color.BLUE, 1)); button.setPreferredSize(new Dimension(w / 7, h)); add(button, BorderLayout.WEST); ActionPlay play = new ActionPlay(); button.addActionListener(play); label.setHorizontalAlignment(JLabel.CENTER); label.setPreferredSize(new Dimension(w, h / 30)); add(label, BorderLayout.SOUTH); add(panel); this.setVisible(true); } class ActionPlay implements ActionListener { public void actionPerformed(ActionEvent ae) { play(); } } @Override public void play() { panel.play(); if (panel.getShapeAtIndex(0).equals(panel.getShapeAtIndex(1)) && panel.getShapeAtIndex(1).equals(panel.getShapeAtIndex(2))) { label.setText("YOU WON !!"); } else { label.setText("YOU LOST !!"); } } @Override public Shape getShapeAtIndex(int index) { return null; } }
UTF-8
Java
1,568
java
SlotMachineFrame.java
Java
[]
null
[]
import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; @SuppressWarnings("serial") public class SlotMachineFrame extends JFrame implements ISlotMachine { private JButton button = new JButton("Play"); private JLabel label = new JLabel("Click Play"); private SlotMachinePanel panel = new SlotMachinePanel(); public SlotMachineFrame(int w, int h) { this.setSize(w, h); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setLocationRelativeTo(null); setLayout(new BorderLayout()); button.setBorder(BorderFactory.createLineBorder(Color.BLUE, 1)); button.setPreferredSize(new Dimension(w / 7, h)); add(button, BorderLayout.WEST); ActionPlay play = new ActionPlay(); button.addActionListener(play); label.setHorizontalAlignment(JLabel.CENTER); label.setPreferredSize(new Dimension(w, h / 30)); add(label, BorderLayout.SOUTH); add(panel); this.setVisible(true); } class ActionPlay implements ActionListener { public void actionPerformed(ActionEvent ae) { play(); } } @Override public void play() { panel.play(); if (panel.getShapeAtIndex(0).equals(panel.getShapeAtIndex(1)) && panel.getShapeAtIndex(1).equals(panel.getShapeAtIndex(2))) { label.setText("YOU WON !!"); } else { label.setText("YOU LOST !!"); } } @Override public Shape getShapeAtIndex(int index) { return null; } }
1,568
0.73852
0.733418
65
23.123077
20.617027
70
false
false
0
0
0
0
0
0
1.630769
false
false
9
198d12d49ce785aa4108a42cd250d042fcda271f
5,153,960,807,364
893fd55d55e65354c563c69d3c3f3d28a72b3a6b
/OpenADRModel20b/src/main/java/com/avob/openadr/model/oadr20b/builders/eievent/Oadr20bEiActivePeriodTypeBuilder.java
6a437003303b0ab0a885297bb27db6980994d7cc
[ "Apache-2.0" ]
permissive
avob/OpenADR
https://github.com/avob/OpenADR
62a63e08d13e792d8c7ff0b186641b74b49d5b6f
7608f780509e5669bbf5bd311c8cb3206cebf7ac
refs/heads/master
2022-09-18T21:56:32.315000
2021-09-06T06:22:02
2021-09-06T06:22:02
169,761,438
45
18
Apache-2.0
false
2022-02-16T01:15:15
2019-02-08T16:07:39
2022-02-04T17:54:16
2022-02-16T01:15:13
59,429
23
12
7
Java
false
false
package com.avob.openadr.model.oadr20b.builders.eievent; import com.avob.openadr.model.oadr20b.Oadr20bFactory; import com.avob.openadr.model.oadr20b.ei.EiActivePeriodType; import com.avob.openadr.model.oadr20b.xcal.Properties; public class Oadr20bEiActivePeriodTypeBuilder { private EiActivePeriodType eiActivePeriodType; public Oadr20bEiActivePeriodTypeBuilder(long timestampStart, String eventXmlDuration, String toleranceXmlDuration, String notificationXmlDuration) { eiActivePeriodType = Oadr20bFactory.createEiActivePeriodType(); Properties properties = Oadr20bFactory.createProperties(timestampStart, eventXmlDuration); properties.setTolerance(Oadr20bFactory.createPropertiesTolerance(toleranceXmlDuration)); properties.setXEiNotification(Oadr20bFactory.createDurationPropType(notificationXmlDuration)); eiActivePeriodType.setProperties(properties); } public Oadr20bEiActivePeriodTypeBuilder withRampUp(String rampUpXmlDuration) { eiActivePeriodType.getProperties().setXEiRampUp(Oadr20bFactory.createDurationPropType(rampUpXmlDuration)); return this; } public Oadr20bEiActivePeriodTypeBuilder withRecovery(String recoveryXmlDuration) { eiActivePeriodType.getProperties().setXEiRecovery(Oadr20bFactory.createDurationPropType(recoveryXmlDuration)); return this; } public Oadr20bEiActivePeriodTypeBuilder withComponent(Object component) { eiActivePeriodType.setComponents(component); return this; } public EiActivePeriodType build() { return eiActivePeriodType; } }
UTF-8
Java
1,633
java
Oadr20bEiActivePeriodTypeBuilder.java
Java
[]
null
[]
package com.avob.openadr.model.oadr20b.builders.eievent; import com.avob.openadr.model.oadr20b.Oadr20bFactory; import com.avob.openadr.model.oadr20b.ei.EiActivePeriodType; import com.avob.openadr.model.oadr20b.xcal.Properties; public class Oadr20bEiActivePeriodTypeBuilder { private EiActivePeriodType eiActivePeriodType; public Oadr20bEiActivePeriodTypeBuilder(long timestampStart, String eventXmlDuration, String toleranceXmlDuration, String notificationXmlDuration) { eiActivePeriodType = Oadr20bFactory.createEiActivePeriodType(); Properties properties = Oadr20bFactory.createProperties(timestampStart, eventXmlDuration); properties.setTolerance(Oadr20bFactory.createPropertiesTolerance(toleranceXmlDuration)); properties.setXEiNotification(Oadr20bFactory.createDurationPropType(notificationXmlDuration)); eiActivePeriodType.setProperties(properties); } public Oadr20bEiActivePeriodTypeBuilder withRampUp(String rampUpXmlDuration) { eiActivePeriodType.getProperties().setXEiRampUp(Oadr20bFactory.createDurationPropType(rampUpXmlDuration)); return this; } public Oadr20bEiActivePeriodTypeBuilder withRecovery(String recoveryXmlDuration) { eiActivePeriodType.getProperties().setXEiRecovery(Oadr20bFactory.createDurationPropType(recoveryXmlDuration)); return this; } public Oadr20bEiActivePeriodTypeBuilder withComponent(Object component) { eiActivePeriodType.setComponents(component); return this; } public EiActivePeriodType build() { return eiActivePeriodType; } }
1,633
0.78812
0.768524
42
37.880951
38.913948
118
false
false
0
0
0
0
0
0
0.5
false
false
9
902378acf2e41ff6821c3d5bc4580e3051ecffd0
33,054,068,369,253
8e3361422f19106eb5e07b249d5328ac2b88459b
/InstaSalaryDevBuild/src/main/java/rutherfordit/com/instasalary/activities/ReadContacts.java
6f827950ed7eeb00c85aa007842a2c78b8727826
[]
no_license
kushalsriraj/New_Insta_Salary
https://github.com/kushalsriraj/New_Insta_Salary
993bfe6a1432fa2d0c98ae2d458623137193bdc5
05562124bc7a44c3b880ccf967cca3fe844e4451
refs/heads/master
2023-01-09T04:45:24.425000
2020-11-04T12:04:06
2020-11-04T12:04:06
302,265,563
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package rutherfordit.com.instasalary.activities; import android.Manifest; import android.app.Activity; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.database.Cursor; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.provider.ContactsContract; import android.provider.Settings; import android.util.Log; import android.view.View; import android.widget.RelativeLayout; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.cardview.widget.CardView; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import com.android.volley.AuthFailureError; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.JsonObjectRequest; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import es.dmoral.toasty.Toasty; import rutherfordit.com.instasalary.R; import rutherfordit.com.instasalary.extras.IntroSliderActivity; import rutherfordit.com.instasalary.extras.MySingleton; import rutherfordit.com.instasalary.extras.Urls; public class ReadContacts extends AppCompatActivity { private static final int MY_PERMISSIONS_REQUEST_READ_CONTACTS = 111; private static final String TAG = "COntacts"; JSONArray jsonArray; SharedPreferences sharedPreferences; String UserAccessToken; List<ContactsModel> contactsModel; CardView loader_contacts; RelativeLayout rl_layout; Handler handler; public static void openPermissionSettings(Activity activity) { Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:" + activity.getPackageName())); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); activity.startActivity(intent); } /*@Override protected void onRestart() { try { if (ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.READ_CONTACTS) == PackageManager.PERMISSION_DENIED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_CONTACTS}, MY_PERMISSIONS_REQUEST_READ_CONTACTS); } else if (ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_CONTACTS}, MY_PERMISSIONS_REQUEST_READ_CONTACTS); } else { if (isNetworkAvailable()) { init(); } else { Toast.makeText(getApplicationContext(), "Please Connect To Internet..", Toast.LENGTH_SHORT).show(); } } } catch (Exception e) { e.printStackTrace(); } super.onRestart(); }*/ private boolean isNetworkAvailable() { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo != null && activeNetworkInfo.isConnected(); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_read_contacts); if (isNetworkAvailable()) { if (ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.READ_CONTACTS) == PackageManager.PERMISSION_GRANTED) { // init(); handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { init(); } }, 2000); } // } else { Toasty.warning(getApplicationContext(), "Please Connect To Internet..", Toast.LENGTH_SHORT).show(); } } private void init() { rl_layout = findViewById(R.id.rl_layout); rl_layout.setVisibility(View.GONE); loader_contacts = findViewById(R.id.loader_contacts); loader_contacts.setVisibility(View.VISIBLE); contactsModel = new ArrayList<>(); sharedPreferences = getSharedPreferences("mySharedPreference", Context.MODE_PRIVATE); UserAccessToken = "Bearer " + sharedPreferences.getString("AccessToken", ""); loadcontacts(); makejson(contactsModel); } private void loadcontacts() { ContentResolver cr = getContentResolver(); Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); if ((cur != null ? cur.getCount() : 0) > 0) { while (cur != null && cur.moveToNext()) { String id = cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID)); String name = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)); if (cur.getInt(cur.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER)) > 0) { Cursor pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?", new String[]{id}, null); while (pCur.moveToNext()) { String phoneNo = pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); ContactsModel data = new ContactsModel(); data.setContactName(name); data.setContactNumber(phoneNo); contactsModel.add(data); Log.i(TAG, "Name: " + name); Log.i(TAG, "Phone Number: " + phoneNo); } // createExcelSheet(); // createCSV(); pCur.close(); } } } else { loader_contacts.setVisibility(View.GONE); Toasty.info(getApplicationContext(), "..", Toast.LENGTH_SHORT).show(); Intent i = new Intent(getApplicationContext(), TakeSelfieActivity.class); startActivity(i); } if (cur != null) { cur.close(); } /*String[] projection = new String[]{ContactsContract.Contacts._ID, ContactsContract.Data.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.NUMBER, ContactsContract.CommonDataKinds.Phone.PHOTO_URI}; Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, projection, null, null, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " ASC"); List<ContactsModel> userList = new ArrayList<>(); String lastPhoneName = " "; if (phones.getCount() > 0) { while (phones.moveToNext()) { String name = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)); String phoneNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); String contactId = phones.getString(phones.getColumnIndex(ContactsContract.Contacts._ID)); String photoUri = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.PHOTO_URI)); if (!name.equalsIgnoreCase(lastPhoneName)) { lastPhoneName = name; ContactsModel user = new ContactsModel(); user.setContactName(phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME))); user.setContactNumber(phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER))); userList.add(user); Log.d(TAG, ""+ userList); } makejson(userList); } } else { { Toast.makeText(getApplicationContext(),"No Contacts Found",Toast.LENGTH_SHORT).show(); Intent i = new Intent(getApplicationContext(),SignUpDetails.class); i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(i); progressDialog.cancel(); } } phones.close();*/ } private void makejson(List<ContactsModel> userList) { jsonArray = new JSONArray(); for (int i = 0; i < userList.size(); i++) { JSONObject jsonObject = new JSONObject(); String name = userList.get(i).getContactName(); String number = userList.get(i).getContactNumber(); try { jsonObject.put("contact_name", name); jsonObject.put("contact_number", number); } catch (JSONException e) { e.printStackTrace(); } jsonArray.put(jsonObject); } Log.d(TAG, "getContactsArray: " + jsonArray); request(jsonArray); } private void request(JSONArray jsonArray) { JSONObject jsonObject = new JSONObject(); try { jsonObject.put("contact", jsonArray); } catch (JSONException e) { e.printStackTrace(); } Log.d(TAG, "OBJ: " + jsonObject); JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, Urls.CONTACTS_DATA, jsonObject, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { Log.e(TAG, "onResponse: " + response); if (response != null) { Toasty.success(getApplicationContext(), "Success..", Toast.LENGTH_SHORT).show(); Intent i = new Intent(getApplicationContext(), TakeSelfieActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(i); loader_contacts.setVisibility(View.GONE); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.d(TAG, "onErrorResponse: " + error.getMessage()); } }) { @Override public Map<String, String> getHeaders() throws AuthFailureError { Map<String, String> params = new HashMap<String, String>(); params.put("Content-Type", "application/json"); params.put("Accept", "application/json"); params.put("Authorization", UserAccessToken); return params; } }; MySingleton.getInstance(ReadContacts.this).addToRequestQueue(jsonObjectRequest); } /*@Override public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) { if (requestCode == MY_PERMISSIONS_REQUEST_READ_CONTACTS) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { init(); } else { *//*loader_contacts.setVisibility(View.GONE); rl_layout.setVisibility(View.VISIBLE);*//* Toast.makeText(getApplicationContext(), "Please Grant Location Permission...", Toast.LENGTH_LONG).show(); openPermissionSettings(ReadContacts.this); } } }*/ public void gotopermcontacts(View view) { Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:" + ReadContacts.this.getPackageName())); intent.addCategory(Intent.CATEGORY_DEFAULT); startActivity(intent); } }
UTF-8
Java
12,362
java
ReadContacts.java
Java
[ { "context": " {\n\n jsonObject.put(\"contact_name\", name);\n jsonObject.put(\"contact_number\"", "end": 9346, "score": 0.9767177104949951, "start": 9342, "tag": "NAME", "value": "name" } ]
null
[]
package rutherfordit.com.instasalary.activities; import android.Manifest; import android.app.Activity; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.database.Cursor; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.provider.ContactsContract; import android.provider.Settings; import android.util.Log; import android.view.View; import android.widget.RelativeLayout; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.cardview.widget.CardView; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import com.android.volley.AuthFailureError; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.JsonObjectRequest; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import es.dmoral.toasty.Toasty; import rutherfordit.com.instasalary.R; import rutherfordit.com.instasalary.extras.IntroSliderActivity; import rutherfordit.com.instasalary.extras.MySingleton; import rutherfordit.com.instasalary.extras.Urls; public class ReadContacts extends AppCompatActivity { private static final int MY_PERMISSIONS_REQUEST_READ_CONTACTS = 111; private static final String TAG = "COntacts"; JSONArray jsonArray; SharedPreferences sharedPreferences; String UserAccessToken; List<ContactsModel> contactsModel; CardView loader_contacts; RelativeLayout rl_layout; Handler handler; public static void openPermissionSettings(Activity activity) { Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:" + activity.getPackageName())); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); activity.startActivity(intent); } /*@Override protected void onRestart() { try { if (ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.READ_CONTACTS) == PackageManager.PERMISSION_DENIED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_CONTACTS}, MY_PERMISSIONS_REQUEST_READ_CONTACTS); } else if (ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_CONTACTS}, MY_PERMISSIONS_REQUEST_READ_CONTACTS); } else { if (isNetworkAvailable()) { init(); } else { Toast.makeText(getApplicationContext(), "Please Connect To Internet..", Toast.LENGTH_SHORT).show(); } } } catch (Exception e) { e.printStackTrace(); } super.onRestart(); }*/ private boolean isNetworkAvailable() { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo != null && activeNetworkInfo.isConnected(); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_read_contacts); if (isNetworkAvailable()) { if (ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.READ_CONTACTS) == PackageManager.PERMISSION_GRANTED) { // init(); handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { init(); } }, 2000); } // } else { Toasty.warning(getApplicationContext(), "Please Connect To Internet..", Toast.LENGTH_SHORT).show(); } } private void init() { rl_layout = findViewById(R.id.rl_layout); rl_layout.setVisibility(View.GONE); loader_contacts = findViewById(R.id.loader_contacts); loader_contacts.setVisibility(View.VISIBLE); contactsModel = new ArrayList<>(); sharedPreferences = getSharedPreferences("mySharedPreference", Context.MODE_PRIVATE); UserAccessToken = "Bearer " + sharedPreferences.getString("AccessToken", ""); loadcontacts(); makejson(contactsModel); } private void loadcontacts() { ContentResolver cr = getContentResolver(); Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); if ((cur != null ? cur.getCount() : 0) > 0) { while (cur != null && cur.moveToNext()) { String id = cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID)); String name = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)); if (cur.getInt(cur.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER)) > 0) { Cursor pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?", new String[]{id}, null); while (pCur.moveToNext()) { String phoneNo = pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); ContactsModel data = new ContactsModel(); data.setContactName(name); data.setContactNumber(phoneNo); contactsModel.add(data); Log.i(TAG, "Name: " + name); Log.i(TAG, "Phone Number: " + phoneNo); } // createExcelSheet(); // createCSV(); pCur.close(); } } } else { loader_contacts.setVisibility(View.GONE); Toasty.info(getApplicationContext(), "..", Toast.LENGTH_SHORT).show(); Intent i = new Intent(getApplicationContext(), TakeSelfieActivity.class); startActivity(i); } if (cur != null) { cur.close(); } /*String[] projection = new String[]{ContactsContract.Contacts._ID, ContactsContract.Data.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.NUMBER, ContactsContract.CommonDataKinds.Phone.PHOTO_URI}; Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, projection, null, null, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " ASC"); List<ContactsModel> userList = new ArrayList<>(); String lastPhoneName = " "; if (phones.getCount() > 0) { while (phones.moveToNext()) { String name = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)); String phoneNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); String contactId = phones.getString(phones.getColumnIndex(ContactsContract.Contacts._ID)); String photoUri = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.PHOTO_URI)); if (!name.equalsIgnoreCase(lastPhoneName)) { lastPhoneName = name; ContactsModel user = new ContactsModel(); user.setContactName(phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME))); user.setContactNumber(phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER))); userList.add(user); Log.d(TAG, ""+ userList); } makejson(userList); } } else { { Toast.makeText(getApplicationContext(),"No Contacts Found",Toast.LENGTH_SHORT).show(); Intent i = new Intent(getApplicationContext(),SignUpDetails.class); i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(i); progressDialog.cancel(); } } phones.close();*/ } private void makejson(List<ContactsModel> userList) { jsonArray = new JSONArray(); for (int i = 0; i < userList.size(); i++) { JSONObject jsonObject = new JSONObject(); String name = userList.get(i).getContactName(); String number = userList.get(i).getContactNumber(); try { jsonObject.put("contact_name", name); jsonObject.put("contact_number", number); } catch (JSONException e) { e.printStackTrace(); } jsonArray.put(jsonObject); } Log.d(TAG, "getContactsArray: " + jsonArray); request(jsonArray); } private void request(JSONArray jsonArray) { JSONObject jsonObject = new JSONObject(); try { jsonObject.put("contact", jsonArray); } catch (JSONException e) { e.printStackTrace(); } Log.d(TAG, "OBJ: " + jsonObject); JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, Urls.CONTACTS_DATA, jsonObject, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { Log.e(TAG, "onResponse: " + response); if (response != null) { Toasty.success(getApplicationContext(), "Success..", Toast.LENGTH_SHORT).show(); Intent i = new Intent(getApplicationContext(), TakeSelfieActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(i); loader_contacts.setVisibility(View.GONE); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.d(TAG, "onErrorResponse: " + error.getMessage()); } }) { @Override public Map<String, String> getHeaders() throws AuthFailureError { Map<String, String> params = new HashMap<String, String>(); params.put("Content-Type", "application/json"); params.put("Accept", "application/json"); params.put("Authorization", UserAccessToken); return params; } }; MySingleton.getInstance(ReadContacts.this).addToRequestQueue(jsonObjectRequest); } /*@Override public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) { if (requestCode == MY_PERMISSIONS_REQUEST_READ_CONTACTS) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { init(); } else { *//*loader_contacts.setVisibility(View.GONE); rl_layout.setVisibility(View.VISIBLE);*//* Toast.makeText(getApplicationContext(), "Please Grant Location Permission...", Toast.LENGTH_LONG).show(); openPermissionSettings(ReadContacts.this); } } }*/ public void gotopermcontacts(View view) { Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:" + ReadContacts.this.getPackageName())); intent.addCategory(Intent.CATEGORY_DEFAULT); startActivity(intent); } }
12,362
0.622877
0.621744
332
36.237953
37.191147
209
false
false
0
0
0
0
0
0
0.671687
false
false
9
737f0b745064bb9539c0d0f0919c7c3598967b22
635,655,204,346
97784ee76880c346846190f4ea4f7e4411ff14ca
/src/heroAnswers/EnhancedHuman.java
c9a80370ac4601cb3bbb48440da0c21783a5e713
[]
no_license
death667b/prac02
https://github.com/death667b/prac02
44ed1dc501645b021ded2d3ca212f7c52173741e
4070b3d013c5e7346a79c17db5adc2ec1e3bd3c6
refs/heads/master
2021-01-12T05:59:01.379000
2016-03-16T07:42:25
2016-03-16T07:42:25
77,260,779
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package heroAnswers; import heroQuestions.SuperPower; /** * An "enhanced" human is born as a mere mortal (e.g., Billy Batson) but later gains the * ability to turn into a superhero (e.g., Captain Marvel) through some magical or science * fiction plot device (e.g., by saying the name of the wizard "Shazam"). Therefore, when * an enhanced human switches into their secret (super) identity they also acquire a * whole collection of superpowers, and lose them again when changing back to their * real (non-super) identity. * * @author n5372828 - Ian Daniel * */ public class EnhancedHuman extends SuperHero { private SuperPower[] acquiredPowers; private SuperPower[] activePowers; private String enhancedIdentity; /** * A superhero of the "enhanced human" variety begins life with no superpowers * and a mortal identity, but also has an "enhanced" (super) identity, in which * he/she acquires several superpowers. * * @param normalIdentity - the superhero's initial, mortal identity * @param enhancedIdentity - the superhero's "enhanced" identity, when transformed * @param acquiredPowers - the superpowers the hero acquires when in his/her "enhanced" identity */ public EnhancedHuman(String normalIdentity, String enhancedIdentity, SuperPower[] acquiredPowers) { super(normalIdentity, enhancedIdentity); this.enhancedIdentity = enhancedIdentity; this.acquiredPowers = acquiredPowers; this.activePowers = new SuperPower[] {}; } @Override public boolean hasPower(SuperPower queriedPower) { for (SuperPower findPower: acquiredPowers){ if (findPower.equals(queriedPower)){ return true; } } return false; } @Override public int totalPower() { int returnPower = 0; for (SuperPower findPower: activePowers){ returnPower += findPower.getValue(); } return returnPower; } /** * Switches the hero's current identity to their alter ego. When a hero changes * to their "super" identity they gain all of their powers. When they switch back * to their normal identity they lose them again. */ @Override public void switchIdentity(){ super.switchIdentity(); if (currentIdentity() == enhancedIdentity) { activePowers = acquiredPowers; } else { activePowers = new SuperPower[] {}; } } }
UTF-8
Java
2,384
java
EnhancedHuman.java
Java
[ { "context": "n \"enhanced\" human is born as a mere mortal (e.g., Billy Batson) but later gains the \r\n * ability to turn into a ", "end": 132, "score": 0.9986501932144165, "start": 120, "tag": "NAME", "value": "Billy Batson" }, { "context": "s the \r\n * ability to turn into a sup...
null
[]
package heroAnswers; import heroQuestions.SuperPower; /** * An "enhanced" human is born as a mere mortal (e.g., <NAME>) but later gains the * ability to turn into a superhero (e.g., <NAME>) through some magical or science * fiction plot device (e.g., by saying the name of the wizard "Shazam"). Therefore, when * an enhanced human switches into their secret (super) identity they also acquire a * whole collection of superpowers, and lose them again when changing back to their * real (non-super) identity. * * @author n5372828 - <NAME> * */ public class EnhancedHuman extends SuperHero { private SuperPower[] acquiredPowers; private SuperPower[] activePowers; private String enhancedIdentity; /** * A superhero of the "enhanced human" variety begins life with no superpowers * and a mortal identity, but also has an "enhanced" (super) identity, in which * he/she acquires several superpowers. * * @param normalIdentity - the superhero's initial, mortal identity * @param enhancedIdentity - the superhero's "enhanced" identity, when transformed * @param acquiredPowers - the superpowers the hero acquires when in his/her "enhanced" identity */ public EnhancedHuman(String normalIdentity, String enhancedIdentity, SuperPower[] acquiredPowers) { super(normalIdentity, enhancedIdentity); this.enhancedIdentity = enhancedIdentity; this.acquiredPowers = acquiredPowers; this.activePowers = new SuperPower[] {}; } @Override public boolean hasPower(SuperPower queriedPower) { for (SuperPower findPower: acquiredPowers){ if (findPower.equals(queriedPower)){ return true; } } return false; } @Override public int totalPower() { int returnPower = 0; for (SuperPower findPower: activePowers){ returnPower += findPower.getValue(); } return returnPower; } /** * Switches the hero's current identity to their alter ego. When a hero changes * to their "super" identity they gain all of their powers. When they switch back * to their normal identity they lose them again. */ @Override public void switchIdentity(){ super.switchIdentity(); if (currentIdentity() == enhancedIdentity) { activePowers = acquiredPowers; } else { activePowers = new SuperPower[] {}; } } }
2,366
0.700503
0.697148
78
28.564102
29.245903
97
false
false
0
0
0
0
0
0
1.538462
false
false
9
841c31ec0a0eadcc4bd8442e408adf491e6cddad
8,873,402,487,996
87537bcf8985c36a40a18a31aa207b08d865ccc4
/Vacinacao/test/dao/DaoTest.java
7f65abb73f55edb87207f7c26a0cc7c85adc4c3f
[]
no_license
rodrigobaptistonefilho/Vacinacao
https://github.com/rodrigobaptistonefilho/Vacinacao
d36566d623165525c8e09676ea8a75759424af97
b3f2f86d18ec0f839ffc2725e52cbc32c47cd91e
refs/heads/master
2020-03-28T01:54:08.396000
2018-09-09T18:38:14
2018-09-09T18:38:14
147,531,194
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dao; import java.util.List; import usuario.Administrador; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import usuario.Animal; /** * * @author Rodrigo */ public class DaoTest { public DaoTest() { } @BeforeClass public static void setUpClass() { } @AfterClass public static void tearDownClass() { } @Before public void setUp() { } @After public void tearDown() { } /*@Test public void testInserir() { Dao<Administrador> gerenciador = new Dao(Administrador.class); Administrador teste = new Administrador("admin", "Administrador", "4343"); gerenciador.inserir(teste); }*/ /*@Test public void testInserirA() { Dao<Animal> gerenciador = new Dao(Animal.class); Animal teste = new Animal("teste", 105.5f); gerenciador.inserir(teste); }*/ /*@Test public void testExcluir() { Dao<Administrador> gerenciador = new Dao(Administrador.class); gerenciador.excluir(7); }*/ /*@Test public void testExcluirA() { Dao<Animal> gerenciador = new Dao(Animal.class); gerenciador.excluir(10); }*/ /*@Test public void testConsultar() { Dao<Administrador> gerenciador = new Dao(Administrador.class); Administrador teste = new Administrador(); teste = gerenciador.buscarPorCodigo(4); System.out.println(teste.toString()); }*/ @Test public void testListar() { Dao<Animal> animal = new Dao(Animal.class); List<Animal> teste = animal.listarTodos(); System.out.println(teste); } }
UTF-8
Java
1,860
java
DaoTest.java
Java
[ { "context": "st;\r\nimport usuario.Animal;\r\n\r\n/**\r\n *\r\n * @author Rodrigo\r\n */\r\npublic class DaoTest {\r\n \r\n public Da", "end": 260, "score": 0.9997500777244568, "start": 253, "tag": "NAME", "value": "Rodrigo" } ]
null
[]
package dao; import java.util.List; import usuario.Administrador; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import usuario.Animal; /** * * @author Rodrigo */ public class DaoTest { public DaoTest() { } @BeforeClass public static void setUpClass() { } @AfterClass public static void tearDownClass() { } @Before public void setUp() { } @After public void tearDown() { } /*@Test public void testInserir() { Dao<Administrador> gerenciador = new Dao(Administrador.class); Administrador teste = new Administrador("admin", "Administrador", "4343"); gerenciador.inserir(teste); }*/ /*@Test public void testInserirA() { Dao<Animal> gerenciador = new Dao(Animal.class); Animal teste = new Animal("teste", 105.5f); gerenciador.inserir(teste); }*/ /*@Test public void testExcluir() { Dao<Administrador> gerenciador = new Dao(Administrador.class); gerenciador.excluir(7); }*/ /*@Test public void testExcluirA() { Dao<Animal> gerenciador = new Dao(Animal.class); gerenciador.excluir(10); }*/ /*@Test public void testConsultar() { Dao<Administrador> gerenciador = new Dao(Administrador.class); Administrador teste = new Administrador(); teste = gerenciador.buscarPorCodigo(4); System.out.println(teste.toString()); }*/ @Test public void testListar() { Dao<Animal> animal = new Dao(Animal.class); List<Animal> teste = animal.listarTodos(); System.out.println(teste); } }
1,860
0.577419
0.570968
83
20.409639
19.004145
81
false
false
0
0
0
0
0
0
0.349398
false
false
9
a261971b9320f9caeb3611ffd132941a92a8779f
9,569,187,185,364
005fcf8ac7bb289b0f97f842dcb4d07581eaedc0
/src/day04_variables_intro/VariablesPractice.java
2d67f167c53bc590aedf2dbb3f3b77303670b290
[]
no_license
VladislavShekhovsev/java-programming
https://github.com/VladislavShekhovsev/java-programming
6b780641a4243071716d1fdebe9ce3689c56d4de
f2e3f87a8aee3e465e78deac741957ace794e164
refs/heads/master
2023-05-27T00:09:03.613000
2021-06-20T15:23:40
2021-06-20T15:23:40
365,674,623
0
0
null
false
2021-05-28T02:16:23
2021-05-09T05:27:57
2021-05-27T23:29:44
2021-05-28T02:16:23
471
0
0
0
Java
false
false
package day04_variables_intro; public class VariablesPractice { public static void main(String [] args) { // declare variable students that stores number int students; // here we declared the students ONCE students = 50; // here we assign amount System.out.println(students); students = 70; // students its like a name of container u can update from top to bottom System.out.println(students); students = 100; students = 125; System.out.println(students); int teachers; teachers = 2; int mentors; mentors = 25; System.out.print("Number of teachers:"); System.out.println(teachers); System.out.print("Number of mentors:"); System.out.println(mentors); int dogs = 2; System.out.println(dogs); } }
UTF-8
Java
875
java
VariablesPractice.java
Java
[]
null
[]
package day04_variables_intro; public class VariablesPractice { public static void main(String [] args) { // declare variable students that stores number int students; // here we declared the students ONCE students = 50; // here we assign amount System.out.println(students); students = 70; // students its like a name of container u can update from top to bottom System.out.println(students); students = 100; students = 125; System.out.println(students); int teachers; teachers = 2; int mentors; mentors = 25; System.out.print("Number of teachers:"); System.out.println(teachers); System.out.print("Number of mentors:"); System.out.println(mentors); int dogs = 2; System.out.println(dogs); } }
875
0.598857
0.580571
28
30.285715
18.742346
79
false
false
0
0
0
0
0
0
0.678571
false
false
9
6aea0d14407b07abd92ace68dd81a3af36e245e4
29,712,583,798,057
dd739728ecd3c0e300232a66e7f797a5b499d49e
/data-structures/src/counter/CounterDemo.java
d01cbf9a04e4e5c568be4daa34d318c181b491dd
[]
no_license
juniorro/java-programs
https://github.com/juniorro/java-programs
2da9302af148d7e97886654a769852fdeadba1de
4036b8cd43bee75cddb46b6a9474aa4f5e54fae9
refs/heads/master
2021-05-01T13:23:43.729000
2018-06-15T02:23:29
2018-06-15T02:23:29
121,076,877
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package counter; public class CounterDemo { public enum Day { MON, TUE, WED, THU, FRI, SAT, SUN }; public static void main(String[] args) { // declares a variable; no counter yet constructed Counter c; // constructs a counter; assigns its reference to c c = new Counter(); //c = null; // increases its value by one c.increment(); // increases its value by three more c.increment(3); // will be 4 int temp = c.getCount(); // value becomes 0 c.reset(); // declares and constructs a counter having value 5 Counter d = new Counter(5); // value becomes 6 d.increment(); Counter e = d; temp = e.getCount(); // value of e (also known as d) becomes 8 e.increment(2); Day today; today = Day.SAT; System.out.println(today); } }
UTF-8
Java
795
java
CounterDemo.java
Java
[]
null
[]
package counter; public class CounterDemo { public enum Day { MON, TUE, WED, THU, FRI, SAT, SUN }; public static void main(String[] args) { // declares a variable; no counter yet constructed Counter c; // constructs a counter; assigns its reference to c c = new Counter(); //c = null; // increases its value by one c.increment(); // increases its value by three more c.increment(3); // will be 4 int temp = c.getCount(); // value becomes 0 c.reset(); // declares and constructs a counter having value 5 Counter d = new Counter(5); // value becomes 6 d.increment(); Counter e = d; temp = e.getCount(); // value of e (also known as d) becomes 8 e.increment(2); Day today; today = Day.SAT; System.out.println(today); } }
795
0.630189
0.620126
48
15.583333
16.477047
55
false
false
0
0
0
0
0
0
1.770833
false
false
9
66bc79ba99e001d337b95c20a00af22d5eb161dd
12,094,627,954,554
c95f86aa77a1d6215c1a68a7a12bce8c9ba0778d
/association/src/test/java/SOAPSender.java
0f015f6dd696da2c9210b9a11a91c7a672bccac8
[]
no_license
KazankovMarch/kpfu-consumer
https://github.com/KazankovMarch/kpfu-consumer
afb52cd140798355d3e6e2853456080f33997d1e
7bcab215cf3181eec5542d8f25729f72d603d359
refs/heads/consumer
2021-07-14T04:05:32.431000
2019-12-25T23:01:25
2019-12-25T23:01:25
229,909,332
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import ru.kpfu.icmit.association.model.soap.Envelope; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import java.io.*; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; public class SOAPSender { /** */ public static String LOCAL_URL = "http://localhost:8080/association/"; public static String REMOTE_URL = "http://185.20.227.163:8080/association/"; private String baseUrl = LOCAL_URL; public SOAPSender(String baseUrl) { this.baseUrl = baseUrl; } /** * Пример отправки XML файла с данными конверта, получение конверта */ public Envelope sendEnvelope(Envelope envelope, String resource) { String response = ""; try { URL url = new URL( baseUrl + resource); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/xml"); connection.setDoOutput(true); //Преобразуем класс-конверт в XML-документ String xmlContent = envelopeToXML(envelope); System.out.println("Send to " + url); System.out.println(xmlContent); try (OutputStream os = connection.getOutputStream()) { os.write(xmlContent.getBytes("UTF-8")); os.flush(); } int rcode = connection.getResponseCode(); System.out.println("Response return code: " + rcode); try (BufferedReader bf = new BufferedReader( new InputStreamReader(connection.getInputStream()))) { while (bf.ready()) { response += bf.readLine(); } System.out.println("Response body:\n" + response + "\n"); } } catch (IOException e) { e.printStackTrace(); } // Преобразуем ответ в конверт if (response.length() > 0) { return readEnvelope(response); } return null; } /** * Пример отправки параметра, получение конверта */ public Envelope sendParam(String paramName, String paramValue, String resource) { String response = ""; try { URL url = new URL( baseUrl + resource); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setDoOutput(true); //Преобразуем класс-конверт в XML-документ String content = paramName+"=" + URLEncoder.encode(paramValue, "UTF-8"); System.out.println("Send to " + url); System.out.println(content); try (OutputStream os = connection.getOutputStream()) { os.write(content.getBytes("UTF-8")); os.flush(); } int rcode = connection.getResponseCode(); System.out.println("Response return code: " + rcode); try (BufferedReader bf = new BufferedReader( new InputStreamReader(connection.getInputStream()))) { while (bf.ready()) { response += bf.readLine(); } System.out.println("Response body:\n" + response + "\n"); } } catch (IOException e) { e.printStackTrace(); } // Преобразуем ответ в конверт if (response.length() > 0) { return readEnvelope(response); } return null; } /** Преобразование конверта в XML документ */ private String envelopeToXML(Envelope envelope) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { JAXBContext context = JAXBContext.newInstance(Envelope.class); Marshaller marshaller = context.createMarshaller(); // устанавливаем флаг для читабельного вывода XML в JAXB marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); // маршаллинг объекта в файл marshaller.marshal(envelope, bos); } catch (JAXBException e) { e.printStackTrace(); } return new String(bos.toByteArray()); } /** Преобразование XML документа в класс-конверт */ private Envelope readEnvelope(String content) { try(Reader reader = new StringReader(content)) { JAXBContext jaxbContext = JAXBContext.newInstance(Envelope.class); Unmarshaller un = jaxbContext.createUnmarshaller(); return (Envelope) un.unmarshal(reader); } catch (JAXBException | IOException e) { e.printStackTrace(); } return null; } }
UTF-8
Java
5,259
java
SOAPSender.java
Java
[ { "context": "/\";\n public static String REMOTE_URL = \"http://185.20.227.163:8080/association/\";\n\n private String baseUrl =", "end": 475, "score": 0.9997649788856506, "start": 461, "tag": "IP_ADDRESS", "value": "185.20.227.163" } ]
null
[]
import ru.kpfu.icmit.association.model.soap.Envelope; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import java.io.*; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; public class SOAPSender { /** */ public static String LOCAL_URL = "http://localhost:8080/association/"; public static String REMOTE_URL = "http://172.16.58.3:8080/association/"; private String baseUrl = LOCAL_URL; public SOAPSender(String baseUrl) { this.baseUrl = baseUrl; } /** * Пример отправки XML файла с данными конверта, получение конверта */ public Envelope sendEnvelope(Envelope envelope, String resource) { String response = ""; try { URL url = new URL( baseUrl + resource); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/xml"); connection.setDoOutput(true); //Преобразуем класс-конверт в XML-документ String xmlContent = envelopeToXML(envelope); System.out.println("Send to " + url); System.out.println(xmlContent); try (OutputStream os = connection.getOutputStream()) { os.write(xmlContent.getBytes("UTF-8")); os.flush(); } int rcode = connection.getResponseCode(); System.out.println("Response return code: " + rcode); try (BufferedReader bf = new BufferedReader( new InputStreamReader(connection.getInputStream()))) { while (bf.ready()) { response += bf.readLine(); } System.out.println("Response body:\n" + response + "\n"); } } catch (IOException e) { e.printStackTrace(); } // Преобразуем ответ в конверт if (response.length() > 0) { return readEnvelope(response); } return null; } /** * Пример отправки параметра, получение конверта */ public Envelope sendParam(String paramName, String paramValue, String resource) { String response = ""; try { URL url = new URL( baseUrl + resource); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setDoOutput(true); //Преобразуем класс-конверт в XML-документ String content = paramName+"=" + URLEncoder.encode(paramValue, "UTF-8"); System.out.println("Send to " + url); System.out.println(content); try (OutputStream os = connection.getOutputStream()) { os.write(content.getBytes("UTF-8")); os.flush(); } int rcode = connection.getResponseCode(); System.out.println("Response return code: " + rcode); try (BufferedReader bf = new BufferedReader( new InputStreamReader(connection.getInputStream()))) { while (bf.ready()) { response += bf.readLine(); } System.out.println("Response body:\n" + response + "\n"); } } catch (IOException e) { e.printStackTrace(); } // Преобразуем ответ в конверт if (response.length() > 0) { return readEnvelope(response); } return null; } /** Преобразование конверта в XML документ */ private String envelopeToXML(Envelope envelope) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { JAXBContext context = JAXBContext.newInstance(Envelope.class); Marshaller marshaller = context.createMarshaller(); // устанавливаем флаг для читабельного вывода XML в JAXB marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); // маршаллинг объекта в файл marshaller.marshal(envelope, bos); } catch (JAXBException e) { e.printStackTrace(); } return new String(bos.toByteArray()); } /** Преобразование XML документа в класс-конверт */ private Envelope readEnvelope(String content) { try(Reader reader = new StringReader(content)) { JAXBContext jaxbContext = JAXBContext.newInstance(Envelope.class); Unmarshaller un = jaxbContext.createUnmarshaller(); return (Envelope) un.unmarshal(reader); } catch (JAXBException | IOException e) { e.printStackTrace(); } return null; } }
5,256
0.594479
0.589608
151
31.629139
27.693357
111
false
false
0
0
0
0
0
0
0.476821
false
false
9
f97bf0aea66a14d09fcc53f99291649597cfee48
8,839,042,751,852
032dffedf87b0862455d7ae7970c2437b6d8b4ce
/gerenciador-negocios/src/main/java/br/com/gerenciador/negocios/model/FormacaoPreco.java
a3b502c747545f6dcf75522bc6dfb4160bb50168
[]
no_license
fabriciojacob211/projetos
https://github.com/fabriciojacob211/projetos
c9f5df111c7517fb2c1926d3f0d8e8445bda29fb
4777b39af5f9ebdeb3d524d5d3edc897e2604491
refs/heads/master
2020-03-02T13:19:46.688000
2018-09-16T01:31:36
2018-09-16T01:31:36
91,886,648
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.gerenciador.negocios.model; public enum FormacaoPreco { PRECOBRUTO, PRECOLIQUIDO }
UTF-8
Java
101
java
FormacaoPreco.java
Java
[]
null
[]
package br.com.gerenciador.negocios.model; public enum FormacaoPreco { PRECOBRUTO, PRECOLIQUIDO }
101
0.80198
0.80198
6
15.833333
16.405453
42
false
false
0
0
0
0
0
0
0.5
false
false
9
aae467a6c71111b67783f1b70b31e000d4e75ebc
8,839,042,750,370
378283e0b061b232f23aef8745dae626d06ffad9
/goldentime/src/main/java/k17/bean/BookListJson.java
a4fde3b10a4405bd9c0f28be36495fbb2bddf9a4
[]
no_license
rockleeprc/example
https://github.com/rockleeprc/example
e1592450b199bbff94a2e0ea037bebf20c9fe4e3
a81c7ae17ef59cc11e06d8d99fcceec98696aaa2
refs/heads/master
2021-12-28T06:14:36.425000
2021-12-23T12:05:24
2021-12-23T12:05:24
86,315,551
4
1
null
false
2021-12-14T21:12:51
2017-03-27T09:18:07
2021-06-16T08:13:26
2021-12-14T21:12:49
22,990
0
0
49
Java
false
false
package k17.bean; import java.util.List; public class BookListJson { private String code; private List<BookInfo> content; private String hasNext; private String msg; public List<BookInfo> getContent() { return content; } public void setContent(List<BookInfo> content) { this.content = content; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getHasNext() { return hasNext; } public void setHasNext(String hasNext) { this.hasNext = hasNext; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } @Override public String toString() { return "BookListJson [code=" + code + ", content=" + content + ", hasNext=" + hasNext + ", msg=" + msg + "]"; } }
UTF-8
Java
798
java
BookListJson.java
Java
[]
null
[]
package k17.bean; import java.util.List; public class BookListJson { private String code; private List<BookInfo> content; private String hasNext; private String msg; public List<BookInfo> getContent() { return content; } public void setContent(List<BookInfo> content) { this.content = content; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getHasNext() { return hasNext; } public void setHasNext(String hasNext) { this.hasNext = hasNext; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } @Override public String toString() { return "BookListJson [code=" + code + ", content=" + content + ", hasNext=" + hasNext + ", msg=" + msg + "]"; } }
798
0.671679
0.669173
47
16
19.48704
111
false
false
0
0
0
0
0
0
1.255319
false
false
9
c79076941ab9a2c79707bd0d63e58b71d0e85c60
3,427,383,903,520
696ce7d6d916dd36912d5660e4921af7d793d80c
/Succorfish/Installer/app/src/main/java/com/succorfish/installer/Vo/VoInstallationResponse.java
708dbdf41c85edc17135d2b01cc54b6c34b9629e
[]
no_license
VinayTShetty/GeoFence_Project_End
https://github.com/VinayTShetty/GeoFence_Project_End
c669ff89cc355e1772353317c8d6e7bac9ac3361
7e178f207c9183bcd42ec24e339bf414a6df9e71
refs/heads/main
2023-06-04T13:54:32.836000
2021-06-26T02:27:59
2021-06-26T02:27:59
380,394,802
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.succorfish.installer.Vo; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import java.io.Serializable; import java.util.Map; public class VoInstallationResponse implements Serializable { String deviceId = ""; String id = ""; String date = ""; String created = ""; String completed = ""; String createdById = ""; String createdByUsername = ""; String status = ""; String operation = ""; String notes = ""; String deviceImei = ""; String deviceType = ""; String realAssetId = ""; String realAssetName = ""; String realAssetRegNo = ""; VoContactInfo contactInfo; String powerSource = ""; String installationPlace = ""; String tcAccepted = ""; String qcBy = ""; String courier = ""; String trackingId = ""; String qcSticker = ""; String rnd = ""; String glandCheck = ""; String studsNPads = ""; // VoAttachedFile attachedFiles; @SerializedName("attachedFiles") @Expose Map<String, String> attachedFilesList; // String objectHistory = ""; public String getDeviceId() { return deviceId; } public void setDeviceId(String deviceId) { this.deviceId = deviceId; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String getCreated() { return created; } public void setCreated(String created) { this.created = created; } public String getCompleted() { return completed; } public void setCompleted(String completed) { this.completed = completed; } public String getCreatedById() { return createdById; } public void setCreatedById(String createdById) { this.createdById = createdById; } public String getCreatedByUsername() { return createdByUsername; } public void setCreatedByUsername(String createdByUsername) { this.createdByUsername = createdByUsername; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getOperation() { return operation; } public void setOperation(String operation) { this.operation = operation; } public String getNotes() { return notes; } public void setNotes(String notes) { this.notes = notes; } public String getDeviceImei() { return deviceImei; } public void setDeviceImei(String deviceImei) { this.deviceImei = deviceImei; } public String getDeviceType() { return deviceType; } public void setDeviceType(String deviceType) { this.deviceType = deviceType; } public String getRealAssetId() { return realAssetId; } public void setRealAssetId(String realAssetId) { this.realAssetId = realAssetId; } public String getRealAssetName() { return realAssetName; } public void setRealAssetName(String realAssetName) { this.realAssetName = realAssetName; } public String getRealAssetRegNo() { return realAssetRegNo; } public void setRealAssetRegNo(String realAssetRegNo) { this.realAssetRegNo = realAssetRegNo; } public VoContactInfo getContactInfo() { return contactInfo; } public void setContactInfo(VoContactInfo contactInfo) { this.contactInfo = contactInfo; } public String getPowerSource() { return powerSource; } public void setPowerSource(String powerSource) { this.powerSource = powerSource; } public String getInstallationPlace() { return installationPlace; } public void setInstallationPlace(String installationPlace) { this.installationPlace = installationPlace; } public String getTcAccepted() { return tcAccepted; } public void setTcAccepted(String tcAccepted) { this.tcAccepted = tcAccepted; } public String getQcBy() { return qcBy; } public void setQcBy(String qcBy) { this.qcBy = qcBy; } public String getCourier() { return courier; } public void setCourier(String courier) { this.courier = courier; } public String getTrackingId() { return trackingId; } public void setTrackingId(String trackingId) { this.trackingId = trackingId; } public String getQcSticker() { return qcSticker; } public void setQcSticker(String qcSticker) { this.qcSticker = qcSticker; } public String getRnd() { return rnd; } public void setRnd(String rnd) { this.rnd = rnd; } public String getGlandCheck() { return glandCheck; } public void setGlandCheck(String glandCheck) { this.glandCheck = glandCheck; } public String getStudsNPads() { return studsNPads; } public void setStudsNPads(String studsNPads) { this.studsNPads = studsNPads; } // public VoAttachedFile getAttachedFiles() { // return attachedFiles; // } // // public void setAttachedFiles(VoAttachedFile attachedFiles) { // this.attachedFiles = attachedFiles; // } // public String getObjectHistory() { // return objectHistory; // } // // public void setObjectHistory(String objectHistory) { // this.objectHistory = objectHistory; // } public Map<String, String> getAttachedFilesList() { return attachedFilesList; } public void setAttachedFilesList(Map<String, String> attachedFilesList) { this.attachedFilesList = attachedFilesList; } }
UTF-8
Java
5,963
java
VoInstallationResponse.java
Java
[ { "context": "lic String getCreatedByUsername() {\n return createdByUsername;\n }\n\n public void setCreatedByUsername(Stri", "end": 2075, "score": 0.719404935836792, "start": 2058, "tag": "USERNAME", "value": "createdByUsername" }, { "context": "atedByUsername) {\n ...
null
[]
package com.succorfish.installer.Vo; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import java.io.Serializable; import java.util.Map; public class VoInstallationResponse implements Serializable { String deviceId = ""; String id = ""; String date = ""; String created = ""; String completed = ""; String createdById = ""; String createdByUsername = ""; String status = ""; String operation = ""; String notes = ""; String deviceImei = ""; String deviceType = ""; String realAssetId = ""; String realAssetName = ""; String realAssetRegNo = ""; VoContactInfo contactInfo; String powerSource = ""; String installationPlace = ""; String tcAccepted = ""; String qcBy = ""; String courier = ""; String trackingId = ""; String qcSticker = ""; String rnd = ""; String glandCheck = ""; String studsNPads = ""; // VoAttachedFile attachedFiles; @SerializedName("attachedFiles") @Expose Map<String, String> attachedFilesList; // String objectHistory = ""; public String getDeviceId() { return deviceId; } public void setDeviceId(String deviceId) { this.deviceId = deviceId; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String getCreated() { return created; } public void setCreated(String created) { this.created = created; } public String getCompleted() { return completed; } public void setCompleted(String completed) { this.completed = completed; } public String getCreatedById() { return createdById; } public void setCreatedById(String createdById) { this.createdById = createdById; } public String getCreatedByUsername() { return createdByUsername; } public void setCreatedByUsername(String createdByUsername) { this.createdByUsername = createdByUsername; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getOperation() { return operation; } public void setOperation(String operation) { this.operation = operation; } public String getNotes() { return notes; } public void setNotes(String notes) { this.notes = notes; } public String getDeviceImei() { return deviceImei; } public void setDeviceImei(String deviceImei) { this.deviceImei = deviceImei; } public String getDeviceType() { return deviceType; } public void setDeviceType(String deviceType) { this.deviceType = deviceType; } public String getRealAssetId() { return realAssetId; } public void setRealAssetId(String realAssetId) { this.realAssetId = realAssetId; } public String getRealAssetName() { return realAssetName; } public void setRealAssetName(String realAssetName) { this.realAssetName = realAssetName; } public String getRealAssetRegNo() { return realAssetRegNo; } public void setRealAssetRegNo(String realAssetRegNo) { this.realAssetRegNo = realAssetRegNo; } public VoContactInfo getContactInfo() { return contactInfo; } public void setContactInfo(VoContactInfo contactInfo) { this.contactInfo = contactInfo; } public String getPowerSource() { return powerSource; } public void setPowerSource(String powerSource) { this.powerSource = powerSource; } public String getInstallationPlace() { return installationPlace; } public void setInstallationPlace(String installationPlace) { this.installationPlace = installationPlace; } public String getTcAccepted() { return tcAccepted; } public void setTcAccepted(String tcAccepted) { this.tcAccepted = tcAccepted; } public String getQcBy() { return qcBy; } public void setQcBy(String qcBy) { this.qcBy = qcBy; } public String getCourier() { return courier; } public void setCourier(String courier) { this.courier = courier; } public String getTrackingId() { return trackingId; } public void setTrackingId(String trackingId) { this.trackingId = trackingId; } public String getQcSticker() { return qcSticker; } public void setQcSticker(String qcSticker) { this.qcSticker = qcSticker; } public String getRnd() { return rnd; } public void setRnd(String rnd) { this.rnd = rnd; } public String getGlandCheck() { return glandCheck; } public void setGlandCheck(String glandCheck) { this.glandCheck = glandCheck; } public String getStudsNPads() { return studsNPads; } public void setStudsNPads(String studsNPads) { this.studsNPads = studsNPads; } // public VoAttachedFile getAttachedFiles() { // return attachedFiles; // } // // public void setAttachedFiles(VoAttachedFile attachedFiles) { // this.attachedFiles = attachedFiles; // } // public String getObjectHistory() { // return objectHistory; // } // // public void setObjectHistory(String objectHistory) { // this.objectHistory = objectHistory; // } public Map<String, String> getAttachedFilesList() { return attachedFilesList; } public void setAttachedFilesList(Map<String, String> attachedFilesList) { this.attachedFilesList = attachedFilesList; } }
5,963
0.625356
0.625356
274
20.762774
18.389696
77
false
false
0
0
0
0
0
0
0.346715
false
false
9
a3ac73efea4786657b48dc2ac11eeb60c0654c2b
3,427,383,902,813
54a3096805d0711bda3d848757c6dfe2bea6bc16
/app/src/main/java/com/buthmathearo/articlemanagement/app/MainActivity_bak.java
01bd9287fa1087328af673e2ea64e40727eb79ea
[]
no_license
buthmathearo/Android_ArticleManagement
https://github.com/buthmathearo/Android_ArticleManagement
4e62812126b7be0b1eba891424cfd02bf274e335
88a0824f33f25bad9d85635cf2847d64c87471fc
refs/heads/master
2021-05-30T06:43:29.037000
2015-12-28T06:12:59
2015-12-28T06:12:59
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.buthmathearo.articlemanagement.app; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.support.design.widget.NavigationView; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.SearchView; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.FrameLayout; import android.widget.ListView; import android.widget.Toast; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.JsonObjectRequest; import com.buthmathearo.articlemanagement.R; import com.buthmathearo.articlemanagement.adapter.ArticleAdapter; import com.buthmathearo.articlemanagement.model.Article; import com.buthmathearo.articlemanagement.util.UserLogin; import com.buthmathearo.articlemanagement.util.Util; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; import cn.pedant.SweetAlert.SweetAlertDialog; //import android.support.v4.widget.SwipeRefreshLayout; //import android.support.v4.widget.SwipeRefreshLayout; /*import android.support.v4.widget.SwipeRefreshLayout;*/ public class MainActivity_bak extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { private ProgressDialog pDialog; private List<Article> articleList = new ArrayList<Article>(); private ListView listView; private UserLogin mUserLogin; private String role = null; private int userId; private ArticleAdapter adapter; private String baseUrl = "http://hrdams.herokuapp.com"; private String TAG = "OLO_RESULT"; private LayoutInflater inflater; private Toolbar mToolbar; private String username; private SwipeRefreshLayout mSwipeRefreshLayout; private SearchView mSearchView; private MenuItem mMenuItem; private DrawerLayout drawer; private FrameLayout container; private NavigationView navigationView; private Menu navMenu; private int listItemPosition; // Pagination private int rowCount = 6; private int pageCount = 1; private int totalRecords; private int totalPages; private int remainOfRecords; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); /* Enable Custom Toolbar */ mToolbar = (Toolbar) findViewById(R.id.toolbar_main); //mToolbar.setLogo(R.drawable.logo_droid_news); mToolbar.setNavigationIcon(R.drawable.menu_btn); mToolbar.setTitleTextColor(Color.WHITE); //mToolbar.setLogo(R.mipmap.ic_launcher); setSupportActionBar(mToolbar); mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.activity_main_swipe_refresh_layout); mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { refreshList(); } }); listView = (ListView) findViewById(R.id.listview_content); adapter = new ArticleAdapter(this, articleList); listView.setAdapter(adapter); drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, mToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); navigationView = (NavigationView) findViewById(R.id.nav_view); navMenu = navigationView.getMenu(); navigationView.setNavigationItemSelectedListener(this); //getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_action_add); } @Override public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } /* Calculate total pages for pagination */ public int getTotalPages(int totalRecords) { if (totalRecords >= rowCount ) { totalPages = totalRecords / rowCount; remainOfRecords = totalRecords % rowCount; if (remainOfRecords > 0) totalPages++; } else { totalPages = 1; } return totalPages; } /* Handle Action_Search on Toolbar */ SearchView.OnQueryTextListener listener = new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { //Toast.makeText(MainActivity.this, query, Toast.LENGTH_SHORT).show(); /*Util.showAlertDialog(MainActivity.this, "Searching", true, SweetAlertDialog.PROGRESS_TYPE); if (role != null) { if (role.equalsIgnoreCase("user")) { searchUserArticle(query, String.valueOf(totalRecords), String.valueOf(1), userId); } else if (role.equalsIgnoreCase("admin")) { searchAllArticles(query, String.valueOf(totalRecords), String.valueOf(1)); } } else { searchAllArticles(query, String.valueOf(totalRecords), String.valueOf(1)); } Util.hideAlertDialog();*/ //Toast.makeText(MainActivity.this, "Search...", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(MainActivity_bak.this, SearchArticleActivity.class); intent.putExtra("USER_ID", String.valueOf(userId)); intent.putExtra("ROLE", role); intent.putExtra("KEYWORD", query); startActivity(intent); return false; } @Override public boolean onQueryTextChange(String newText) { return false; } }; @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. boolean b = false; // Get menu from Navigation Drawer navMenu = navigationView.getMenu(); if (checkUserLogin()){ if (role != null){ navMenu.findItem(R.id.nav_user_profile).setVisible(true); navMenu.findItem(R.id.nav_login).setTitle("Logout"); navMenu.findItem(R.id.nav_register).setVisible(false); b = true; if (role.equalsIgnoreCase("user")) { getMenuInflater().inflate(R.menu.activity_main_menu_user, menu); getUserArticles(String.valueOf(userId), String.valueOf(rowCount), String.valueOf(pageCount)); } else if (role.equalsIgnoreCase("admin")) { getMenuInflater().inflate(R.menu.activity_main_menu_admin, menu); getAllArticles(String.valueOf(rowCount), String.valueOf(pageCount)); } } } else { navMenu.findItem(R.id.nav_user_profile).setVisible(false); b = true; getMenuInflater().inflate(R.menu.activity_main_menu_normal_user, menu); getAllArticles(String.valueOf(rowCount), String.valueOf(pageCount)); } if (b) { mMenuItem = menu.findItem(R.id.action_search); mSearchView = (SearchView) mMenuItem.getActionView(); mSearchView.setOnQueryTextListener(listener); } /* Initialize View Objects (Widgets) Event */ setEvents(); return true; } /* Refresh List When User Swipe List View */ public void refreshList() { //totalPages++; if (pageCount < totalPages) { pageCount++; if (role != null) { if (role.equalsIgnoreCase("user")) { getUserArticles(String.valueOf(userId), String.valueOf(rowCount), String.valueOf(pageCount)); } else if (role.equalsIgnoreCase("admin")) { getAllArticles(String.valueOf(rowCount), String.valueOf(pageCount)); } } else { getAllArticles(String.valueOf(rowCount), String.valueOf(pageCount)); } } else { //Util.showAlertDialog(this, "Suggestion", "Press reload icon to get new article.", true, SweetAlertDialog.NORMAL_TYPE); Toast.makeText(MainActivity_bak.this, "Press Reload to back to first page.", Toast.LENGTH_LONG).show(); } mSwipeRefreshLayout.setRefreshing(false); //Toast.makeText(MainActivity.this, "TotalRecords: " + totalRecords + ", TotalPages: " + totalPages + ", Cur.Page: " + pageCount, Toast.LENGTH_SHORT).show(); //Util.showAlertDialog(this, "Pagination Info", "TotalRecords: " + totalRecords + ", TotalPages: " + totalPages + ", Cur.Page: " + pageCount, true, SweetAlertDialog.NORMAL_TYPE); Toast.makeText(MainActivity_bak.this, "Page: " + pageCount, Toast.LENGTH_SHORT).show(); } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); /* Handle All Action_Buttons on Toolbar */ if (id == R.id.action_add_article) { Intent intent = new Intent(getBaseContext(), AddArticleActivity.class); intent.putExtra("USER_ID", "" + userId); startActivity(intent); return true; } else if (id == R.id.action_reload) { pageCount = 1; if (role != null) { if (role.equalsIgnoreCase("user")) { articleList.clear(); adapter.notifyDataSetChanged(); getUserArticles(String.valueOf(userId), String.valueOf(rowCount), String.valueOf(pageCount)); } else if (role.equalsIgnoreCase("admin")) { articleList.clear(); adapter.notifyDataSetChanged(); getAllArticles(String.valueOf(rowCount), String.valueOf(pageCount)); } } else { articleList.clear(); adapter.notifyDataSetChanged(); getAllArticles(String.valueOf(rowCount), String.valueOf(pageCount)); } } return super.onOptionsItemSelected(item); } @SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. Intent intent; switch(item.getItemId()){ case R.id.nav_login: if (item.getTitle().equals("Login")) { intent = new Intent(this, LoginActivity.class); startActivity(intent); } else { /* if (Build.VERSION.SDK_INT >= 11) { recreate(); } else { Intent myIntent = getIntent(); item.setTitle("Login"); mUserLogin.clear(); myIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); finish(); startActivity(myIntent); }*/ /* Create Confirm Dialog when user logout. */ new SweetAlertDialog(this, SweetAlertDialog.WARNING_TYPE) .setTitleText("Confirm") .setContentText("Do you want to logout?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sDialog.cancel(); } }).setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { mUserLogin.clear(); Intent loginIntent = new Intent(MainActivity_bak.this, LoginActivity.class); startActivity(loginIntent); finish(); } }).show(); } break; case R.id.nav_register: intent = new Intent(this, RegisterActivity.class); startActivity(intent); break; case R.id.nav_user_profile: intent = new Intent(this, UserDetailActivity.class); intent.putExtra("USER_ID", "" + userId); startActivity(intent); break; case R.id.nav_developer: Util.showAlertDialog(this, "Developers", "Buth Mathearo\nLim Seudy" + "\nSa Sokngim\nEath Manith\nThorn Sereyvong", true, SweetAlertDialog.NORMAL_TYPE); break; case R.id.nav_share: Intent myIntent = new Intent(Intent.ACTION_SEND); myIntent.setType("text/plain"); myIntent.putExtra(Intent.EXTRA_TEXT, "http://hrdams.herokuapp.com"); myIntent.putExtra(Intent.EXTRA_SUBJECT,"Check out this side"); startActivity(Intent.createChooser(myIntent,"Share With:")); break; } //Toast.makeText(this, "Hello " + item.getItemId(), Toast.LENGTH_SHORT).show(); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } @Override public void onDestroy() { super.onDestroy(); } /* Initialize View Objects (Widgets) Event. */ public void setEvents() { listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { //Toast.makeText(MainActivity.this, "Item " + position, Toast.LENGTH_SHORT).show(); Article article = articleList.get(position); Intent intent = new Intent(getBaseContext(), ArticleDetailActivity.class); intent.putExtra("ARTICLE_ID", String.valueOf(article.getId())); intent.putExtra("ROLE", role); intent.putExtra("USER_ID", String.valueOf(article.getUserId())); intent.putExtra("TITLE", article.getTitle()); intent.putExtra("IMAGE", article.getImage()); intent.putExtra("DATE", article.getPublishDate()); intent.putExtra("DESCRIPTION", article.getDescription()); listItemPosition = position; //startActivity(intent); startActivityForResult(intent, Util.KEY_EDIT_ARTICLE); } }); /* Enable Long_Click on ListView_Item for Login User Only. */ if (role != null) { listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { Article article = articleList.get(position); listItemPosition = position; showConfirmDialog(""+article.getId(), position); return true; } }); } } /* Important methods: Check whether User has Login. SharedPref File will be checked * when user choose 'Remember' on LoginActivity */ public boolean checkUserLogin() { mUserLogin = new UserLogin(this); mUserLogin.readFromSharedPrefFile(); // Get all save values from SharedPrefFile /*userId = 121; role = "admin"; username = "Buth Mathearo"; return true;*/ if (mUserLogin.isRemember()) { userId = mUserLogin.getId(); role = mUserLogin.getRole(); username = mUserLogin.getUsername(); //Toast.makeText(this, "Intent NULL, User ID: " + userId + ", role: " + role + ", name: " + username , Toast.LENGTH_SHORT).show(); return true; } else if (getIntent().getExtras() != null) { role = getIntent().getExtras().getString(UserLogin.ROLE); userId = getIntent().getExtras().getInt(UserLogin.USER_ID); username = getIntent().getExtras().getString(UserLogin.USERNAME); //Toast.makeText(this, "Intent not NULL, User ID: " + userId + ", role: " + role + ", name: " + username , Toast.LENGTH_SHORT).show(); return true; } else return false; /*if (getIntent().getExtras() == null) { mUserLogin = new UserLogin(this); mUserLogin.readFromSharedPrefFile(); if (mUserLogin.isRemember()) { userId = mUserLogin.getId(); role = mUserLogin.getRole(); username = mUserLogin.getUsername(); Toast.makeText(this, "Intent NULL, User ID: " + userId + ", role: " + role + ", name: " + username , Toast.LENGTH_SHORT).show(); return true; } //Toast.makeText(this, "Already Login. Remembered " + mUserLogin.isRemember(), Toast.LENGTH_SHORT).show(); } else { role = getIntent().getExtras().getString(UserLogin.ROLE); userId = getIntent().getExtras().getInt(UserLogin.USER_ID); username = getIntent().getExtras().getString(UserLogin.USERNAME); Toast.makeText(this, "Intent not NULL, User ID: " + userId + ", role: " + role + ", name: " + username , Toast.LENGTH_SHORT).show(); return true; } return false;*/ } /* Retrieve all articles from Server then Keep all record in an ArrayList. */ public void getAllArticles(String row, String pageCount) { /* "row": "10", "pageCount": "1" */ Util.showAlertDialog(this, "Loading...", false, SweetAlertDialog.PROGRESS_TYPE); String url = baseUrl + "/api/article/hrd_r001"; JsonObjectRequest jsonObjectRequest; JSONObject params; try { params = new JSONObject(); params.put("row", row.trim()); params.put("pageCount", pageCount.trim()); jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url.trim(), params, new Response.Listener<JSONObject>(){ @Override public void onResponse(JSONObject jsonObject) { Util.hideAlertDialog(); try { totalRecords = jsonObject.getInt("TOTAL_REC"); totalPages = getTotalPages(totalRecords); //Toast.makeText(MainActivity.this, "TotalRcords: " + totalRecords + ", TotalPages: " + totalPages, Toast.LENGTH_LONG).show(); JSONArray jsonArray = jsonObject.getJSONArray("RES_DATA"); for(int i = 0; i < jsonArray.length(); i++) { JSONObject obj = jsonArray.getJSONObject(i); Article article = new Article(); article.setId(obj.getInt("id")); article.setTitle(obj.getString("title")); article.setDescription(obj.getString("description")); article.setPublishDate(obj.getString("publishDate")); article.setImage(obj.getString("image")); article.setUserId(obj.getInt("userId")); article.setEnabled(obj.getBoolean("enabled")); articleList.add(article); } } catch (JSONException e) { Log.d(TAG, e.toString()); } // Notify to Adapter adapter.notifyDataSetChanged(); } }, new Response.ErrorListener(){ @Override public void onErrorResponse(VolleyError volleyError) { Log.d(TAG, volleyError.toString()); //Toast.makeText(getBaseContext(), "ERROR MESSAGE: " + volleyError.toString(), Toast.LENGTH_SHORT).show(); Util.hideAlertDialog(); Util.showAlertDialog(MainActivity_bak.this, "Alert", "Error: " + volleyError.toString(), true, SweetAlertDialog.ERROR_TYPE); } }); // Add RequestQueue AppController.getInstance().addToRequestQueue(jsonObjectRequest); } catch (JSONException e) { Log.d(TAG, e.toString()); } catch (Exception e) { Log.d(TAG, e.toString()); } } /* Retrieve all User's Articles by specified User ID. */ public void getUserArticles(String userId, String row, String pageCount) { /* "row": "10", "pageCount": "1"*/ Util.showAlertDialog(this, "Loading...", false, SweetAlertDialog.PROGRESS_TYPE); String url = baseUrl + "/api/article/user/" + userId; JsonObjectRequest jsonObjectRequest; JSONObject params; try { params = new JSONObject(); params.put("row", row.trim()); params.put("pageCount", pageCount.trim()); jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url.trim(), params, new Response.Listener<JSONObject>(){ @Override public void onResponse(JSONObject jsonObject) { Util.hideAlertDialog(); try { JSONArray jsonArray = jsonObject.getJSONArray("RES_DATA"); for(int i = 0; i < jsonArray.length(); i++) { JSONObject obj = jsonArray.getJSONObject(i); /*"id": 211, "title": "", "description": "", "publishDate": "2015-12-07", "image": "http://www.kshrd.com.kh/jsp/img/logo.png", "enabled": true, "userId": 43*/ Article article = new Article(); article.setId(obj.getInt("id")); article.setTitle(obj.getString("title")); article.setDescription(obj.getString("description")); article.setPublishDate(obj.getString("publishDate")); article.setImage(obj.getString("image")); article.setUserId(obj.getInt("userId")); article.setEnabled(obj.getBoolean("enabled")); articleList.add(article); } } catch (JSONException e) { Log.d(TAG, e.toString()); } // Notify to Adapter adapter.notifyDataSetChanged(); } }, new Response.ErrorListener(){ @Override public void onErrorResponse(VolleyError volleyError) { Log.d(TAG, volleyError.toString()); Util.hideAlertDialog(); Util.showAlertDialog(MainActivity_bak.this, "Alert", "Error: " + volleyError.toString(), true, SweetAlertDialog.ERROR_TYPE); //Toast.makeText(getBaseContext(), "ERROR MESSAGE: " + volleyError.toString(), Toast.LENGTH_SHORT).show(); } }); // Add RequestQueue AppController.getInstance().addToRequestQueue(jsonObjectRequest); } catch (JSONException e) { Log.d(TAG, e.toString()); } catch (Exception e) { Log.d(TAG, e.toString()); } } /* Search User's Articles. */ public void searchUserArticle(String title, String row, String pageCount, final int userId) { String url = baseUrl + "/api/article/search/" + title; JsonObjectRequest jsonObjectRequest; JSONObject params; try { params = new JSONObject(); params.put("row", row.trim()); params.put("pageCount", pageCount.trim()); jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url.trim(), params, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject jsonObject) { articleList.clear(); //Toast.makeText(getBaseContext(), "Search: " + jsonObject.toString(), Toast.LENGTH_LONG).show(); try { JSONArray jsonArray = jsonObject.getJSONArray("RES_DATA"); totalRecords = jsonObject.getInt("TOTAL_REC"); totalPages = getTotalPages(totalRecords); for(int i = 0; i < jsonArray.length(); i++) { JSONObject obj = jsonArray.getJSONObject(i); if (userId == obj.getInt("userId")){ Article article = new Article(); article.setId(obj.getInt("id")); article.setTitle(obj.getString("title")); article.setDescription(obj.getString("description")); article.setPublishDate(obj.getString("publishDate")); article.setImage(obj.getString("image")); article.setUserId(obj.getInt("userId")); article.setEnabled(obj.getBoolean("enabled")); articleList.add(article); } } } catch (JSONException e) { Log.d(TAG, e.toString()); } // Notify to Adapter adapter.notifyDataSetChanged(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { Log.d(TAG, volleyError.toString()); Toast.makeText(getBaseContext(), "ERROR_MESSAGE: " + volleyError.toString(), Toast.LENGTH_SHORT).show(); } }); // Add Request to RequestQueue AppController.getInstance().addToRequestQueue(jsonObjectRequest); } catch (JSONException e) { Log.d(TAG, e.toString()); } catch (Exception e) { Log.d(TAG, e.toString()); } } /* Search all articles. */ public void searchAllArticles(String title, String row, String pageCount) { String url = baseUrl + "/api/article/search/" + title; JsonObjectRequest jsonObjectRequest; JSONObject params; try { params = new JSONObject(); params.put("row", row.trim()); params.put("pageCount", pageCount.trim()); jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url.trim(), params, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject jsonObject) { articleList.clear(); //Toast.makeText(getBaseContext(), "Search: " + jsonObject.toString(), Toast.LENGTH_LONG).show(); try { JSONArray jsonArray = jsonObject.getJSONArray("RES_DATA"); totalRecords = jsonObject.getInt("TOTAL_REC"); totalPages = getTotalPages(totalRecords); for(int i = 0; i < jsonArray.length(); i++) { JSONObject obj = jsonArray.getJSONObject(i); Article article = new Article(); article.setId(obj.getInt("id")); article.setTitle(obj.getString("title")); article.setDescription(obj.getString("description")); article.setPublishDate(obj.getString("publishDate")); article.setImage(obj.getString("image")); article.setUserId(obj.getInt("userId")); article.setEnabled(obj.getBoolean("enabled")); articleList.add(article); } } catch (JSONException e) { Log.d(TAG, e.toString()); } // Notify to Adapter adapter.notifyDataSetChanged(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { Log.d(TAG, volleyError.toString()); Toast.makeText(getBaseContext(), "ERROR_MESSAGE: " + volleyError.toString(), Toast.LENGTH_SHORT).show(); } }); // Add Request to RequestQueue AppController.getInstance().addToRequestQueue(jsonObjectRequest); } catch (JSONException e) { Log.d(TAG, e.toString()); } catch (Exception e) { Log.d(TAG, e.toString()); } } /* Delete User's Article */ public void deleletUserArticle(String articleId, final int listItemPosition){ String url = baseUrl + "/api/article/hrd_d001"; JsonObjectRequest jsonObjectRequest; JSONObject params; try { params = new JSONObject(); params.put("id", articleId.trim()); jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url.trim(), params, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject jsonObject) { try { if (jsonObject.getBoolean("STATUS")) { articleList.remove(listItemPosition); Util.showAlertDialog(MainActivity_bak.this, "Deleted.", true, SweetAlertDialog.SUCCESS_TYPE); //Toast.makeText(getBaseContext(), "Deleted ID: " + listItemPosition, Toast.LENGTH_LONG).show(); } } catch (JSONException e) { Log.d(TAG, e.toString()); } adapter.notifyDataSetChanged(); //listView.removeViewAt(listItemPosition); //Toast.makeText(getBaseContext(), "Search: " + jsonObject.toString(), Toast.LENGTH_LONG).show(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { Log.d(TAG, volleyError.toString()); Toast.makeText(getBaseContext(), "ERROR_MESSAGE: " + volleyError.toString(), Toast.LENGTH_SHORT).show(); } }); // Add Request to RequestQueue AppController.getInstance().addToRequestQueue(jsonObjectRequest); } catch (JSONException e) { Log.d(TAG, e.toString()); } catch (Exception e) { Log.d(TAG, e.toString()); } } /* Show a Dialog (Context Menu) When User Long_Click on ListView_Item. */ public void showConfirmDialog(final String articleId, final int position) { final CharSequence[] items = { "Delete", "Edit" }; AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity_bak.this); //builder.setTitle("Make your selection"); builder.setItems(items, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { if(items[item].equals("Delete")){ AlertDialog.Builder alertDialog = new AlertDialog.Builder(MainActivity_bak.this); alertDialog.setTitle("Confirm"); alertDialog.setMessage("Do you want to delete?"); alertDialog.setIcon(R.mipmap.ic_launcher); alertDialog.setPositiveButton("YES", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { deleletUserArticle(articleId, position); // Write your code here to invoke YES event //Toast.makeText(MainActivity.this, "You clicked on YES", Toast.LENGTH_SHORT).show(); } }); alertDialog.setNegativeButton("NO", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // Write your code here to invoke NO event //Toast.makeText(MainActivity.this, "You clicked on NO", Toast.LENGTH_SHORT).show(); //dialog.cancel(); } }); alertDialog.show(); } if(items[item].equals("Edit")){ //Toast.makeText(MainActivity.this, "You clicked on Edit", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(getBaseContext(), EditArticleActivity.class); intent.putExtra("USER_ID", "" + articleList.get(position).getUserId()); intent.putExtra("ARTICLE_ID", articleId); //startActivity(intent); startActivityForResult(intent, Util.KEY_EDIT_ARTICLE); } } }); AlertDialog alert = builder.create(); alert.show(); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == Util.KEY_EDIT_ARTICLE){ // Get Data Back from EditArticleActivity if (resultCode == Util.KEY_EDIT_ARTICLE){ //Toast.makeText(MainActivity.this, "ID: " + data.getStringExtra("ARTICLE_ID"), Toast.LENGTH_SHORT).show(); getArticleDetail(data.getStringExtra("ARTICLE_ID")); Util.showAlertDialog(this, "Succefully edited an article.", true, SweetAlertDialog.SUCCESS_TYPE); } } /*if (data != null) Util.showAlertDialog(this,"MSG" ,"ART_ID: " + data.getStringExtra("ARTICLE_ID") + ", USER_ID: " + userId, true, SweetAlertDialog.NORMAL_TYPE); */ } /* Get Article Detail by ID */ public void getArticleDetail(final String articleId) { String url = Util.baseUrl + "/api/article/hrd_det001"; JsonObjectRequest jsonObjectRequest; try { JSONObject param = new JSONObject(); param.put("id", articleId); jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url.trim(), param, new Response.Listener<JSONObject>(){ @Override public void onResponse(JSONObject jsonObject) { try { JSONObject obj = jsonObject.getJSONObject("RES_DATA"); /*"id": 211, "title": "", "description": "", "publishDate": "2015-12-07", "image": "http://www.kshrd.com.kh/jsp/img/logo.png", "enabled": true, "userId": 43*/ Article tmpArticle = new Article(); tmpArticle.setId(obj.getInt("id")); tmpArticle.setTitle(obj.getString("title")); tmpArticle.setDescription(obj.getString("description")); tmpArticle.setPublishDate(obj.getString("publishDate")); tmpArticle.setImage(obj.getString("image")); tmpArticle.setUserId(obj.getInt("userId")); tmpArticle.setEnabled(obj.getBoolean("enabled")); articleList.get(listItemPosition).setTitle(tmpArticle.getShortTitle()); articleList.get(listItemPosition).setDescription(tmpArticle.getShortDescription()); articleList.get(listItemPosition).setImage(tmpArticle.getImageWithoutBaseUrl()); adapter.notifyDataSetChanged(); //Toast.makeText(MainActivity.this, "USER_ID: " + articleList.get(listItemPosition).getUserId(), Toast.LENGTH_SHORT).show(); } catch (JSONException e) { Log.d(TAG, e.toString()); } } }, new Response.ErrorListener(){ @Override public void onErrorResponse(VolleyError volleyError) { Log.d(TAG, volleyError.toString()); Toast.makeText(getBaseContext(), "ERROR MESSAGE: " + volleyError.toString(), Toast.LENGTH_SHORT).show(); } }); // Add RequestQueue AppController.getInstance().addToRequestQueue(jsonObjectRequest); } catch (JSONException e) { Log.d(TAG, e.toString()); } catch (Exception e) { Log.d(TAG, e.toString()); } } }
UTF-8
Java
40,215
java
MainActivity_bak.java
Java
[ { "context": " Util.showAlertDialog(this, \"Developers\", \"Buth Mathearo\\nLim Seudy\" +\n \"\\nSa Sokng", "end": 13906, "score": 0.9998912811279297, "start": 13893, "tag": "NAME", "value": "Buth Mathearo" }, { "context": "owAlertDialog(this, \"Develope...
null
[]
package com.buthmathearo.articlemanagement.app; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.support.design.widget.NavigationView; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.SearchView; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.FrameLayout; import android.widget.ListView; import android.widget.Toast; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.JsonObjectRequest; import com.buthmathearo.articlemanagement.R; import com.buthmathearo.articlemanagement.adapter.ArticleAdapter; import com.buthmathearo.articlemanagement.model.Article; import com.buthmathearo.articlemanagement.util.UserLogin; import com.buthmathearo.articlemanagement.util.Util; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; import cn.pedant.SweetAlert.SweetAlertDialog; //import android.support.v4.widget.SwipeRefreshLayout; //import android.support.v4.widget.SwipeRefreshLayout; /*import android.support.v4.widget.SwipeRefreshLayout;*/ public class MainActivity_bak extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { private ProgressDialog pDialog; private List<Article> articleList = new ArrayList<Article>(); private ListView listView; private UserLogin mUserLogin; private String role = null; private int userId; private ArticleAdapter adapter; private String baseUrl = "http://hrdams.herokuapp.com"; private String TAG = "OLO_RESULT"; private LayoutInflater inflater; private Toolbar mToolbar; private String username; private SwipeRefreshLayout mSwipeRefreshLayout; private SearchView mSearchView; private MenuItem mMenuItem; private DrawerLayout drawer; private FrameLayout container; private NavigationView navigationView; private Menu navMenu; private int listItemPosition; // Pagination private int rowCount = 6; private int pageCount = 1; private int totalRecords; private int totalPages; private int remainOfRecords; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); /* Enable Custom Toolbar */ mToolbar = (Toolbar) findViewById(R.id.toolbar_main); //mToolbar.setLogo(R.drawable.logo_droid_news); mToolbar.setNavigationIcon(R.drawable.menu_btn); mToolbar.setTitleTextColor(Color.WHITE); //mToolbar.setLogo(R.mipmap.ic_launcher); setSupportActionBar(mToolbar); mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.activity_main_swipe_refresh_layout); mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { refreshList(); } }); listView = (ListView) findViewById(R.id.listview_content); adapter = new ArticleAdapter(this, articleList); listView.setAdapter(adapter); drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, mToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); navigationView = (NavigationView) findViewById(R.id.nav_view); navMenu = navigationView.getMenu(); navigationView.setNavigationItemSelectedListener(this); //getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_action_add); } @Override public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } /* Calculate total pages for pagination */ public int getTotalPages(int totalRecords) { if (totalRecords >= rowCount ) { totalPages = totalRecords / rowCount; remainOfRecords = totalRecords % rowCount; if (remainOfRecords > 0) totalPages++; } else { totalPages = 1; } return totalPages; } /* Handle Action_Search on Toolbar */ SearchView.OnQueryTextListener listener = new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { //Toast.makeText(MainActivity.this, query, Toast.LENGTH_SHORT).show(); /*Util.showAlertDialog(MainActivity.this, "Searching", true, SweetAlertDialog.PROGRESS_TYPE); if (role != null) { if (role.equalsIgnoreCase("user")) { searchUserArticle(query, String.valueOf(totalRecords), String.valueOf(1), userId); } else if (role.equalsIgnoreCase("admin")) { searchAllArticles(query, String.valueOf(totalRecords), String.valueOf(1)); } } else { searchAllArticles(query, String.valueOf(totalRecords), String.valueOf(1)); } Util.hideAlertDialog();*/ //Toast.makeText(MainActivity.this, "Search...", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(MainActivity_bak.this, SearchArticleActivity.class); intent.putExtra("USER_ID", String.valueOf(userId)); intent.putExtra("ROLE", role); intent.putExtra("KEYWORD", query); startActivity(intent); return false; } @Override public boolean onQueryTextChange(String newText) { return false; } }; @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. boolean b = false; // Get menu from Navigation Drawer navMenu = navigationView.getMenu(); if (checkUserLogin()){ if (role != null){ navMenu.findItem(R.id.nav_user_profile).setVisible(true); navMenu.findItem(R.id.nav_login).setTitle("Logout"); navMenu.findItem(R.id.nav_register).setVisible(false); b = true; if (role.equalsIgnoreCase("user")) { getMenuInflater().inflate(R.menu.activity_main_menu_user, menu); getUserArticles(String.valueOf(userId), String.valueOf(rowCount), String.valueOf(pageCount)); } else if (role.equalsIgnoreCase("admin")) { getMenuInflater().inflate(R.menu.activity_main_menu_admin, menu); getAllArticles(String.valueOf(rowCount), String.valueOf(pageCount)); } } } else { navMenu.findItem(R.id.nav_user_profile).setVisible(false); b = true; getMenuInflater().inflate(R.menu.activity_main_menu_normal_user, menu); getAllArticles(String.valueOf(rowCount), String.valueOf(pageCount)); } if (b) { mMenuItem = menu.findItem(R.id.action_search); mSearchView = (SearchView) mMenuItem.getActionView(); mSearchView.setOnQueryTextListener(listener); } /* Initialize View Objects (Widgets) Event */ setEvents(); return true; } /* Refresh List When User Swipe List View */ public void refreshList() { //totalPages++; if (pageCount < totalPages) { pageCount++; if (role != null) { if (role.equalsIgnoreCase("user")) { getUserArticles(String.valueOf(userId), String.valueOf(rowCount), String.valueOf(pageCount)); } else if (role.equalsIgnoreCase("admin")) { getAllArticles(String.valueOf(rowCount), String.valueOf(pageCount)); } } else { getAllArticles(String.valueOf(rowCount), String.valueOf(pageCount)); } } else { //Util.showAlertDialog(this, "Suggestion", "Press reload icon to get new article.", true, SweetAlertDialog.NORMAL_TYPE); Toast.makeText(MainActivity_bak.this, "Press Reload to back to first page.", Toast.LENGTH_LONG).show(); } mSwipeRefreshLayout.setRefreshing(false); //Toast.makeText(MainActivity.this, "TotalRecords: " + totalRecords + ", TotalPages: " + totalPages + ", Cur.Page: " + pageCount, Toast.LENGTH_SHORT).show(); //Util.showAlertDialog(this, "Pagination Info", "TotalRecords: " + totalRecords + ", TotalPages: " + totalPages + ", Cur.Page: " + pageCount, true, SweetAlertDialog.NORMAL_TYPE); Toast.makeText(MainActivity_bak.this, "Page: " + pageCount, Toast.LENGTH_SHORT).show(); } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); /* Handle All Action_Buttons on Toolbar */ if (id == R.id.action_add_article) { Intent intent = new Intent(getBaseContext(), AddArticleActivity.class); intent.putExtra("USER_ID", "" + userId); startActivity(intent); return true; } else if (id == R.id.action_reload) { pageCount = 1; if (role != null) { if (role.equalsIgnoreCase("user")) { articleList.clear(); adapter.notifyDataSetChanged(); getUserArticles(String.valueOf(userId), String.valueOf(rowCount), String.valueOf(pageCount)); } else if (role.equalsIgnoreCase("admin")) { articleList.clear(); adapter.notifyDataSetChanged(); getAllArticles(String.valueOf(rowCount), String.valueOf(pageCount)); } } else { articleList.clear(); adapter.notifyDataSetChanged(); getAllArticles(String.valueOf(rowCount), String.valueOf(pageCount)); } } return super.onOptionsItemSelected(item); } @SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. Intent intent; switch(item.getItemId()){ case R.id.nav_login: if (item.getTitle().equals("Login")) { intent = new Intent(this, LoginActivity.class); startActivity(intent); } else { /* if (Build.VERSION.SDK_INT >= 11) { recreate(); } else { Intent myIntent = getIntent(); item.setTitle("Login"); mUserLogin.clear(); myIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); finish(); startActivity(myIntent); }*/ /* Create Confirm Dialog when user logout. */ new SweetAlertDialog(this, SweetAlertDialog.WARNING_TYPE) .setTitleText("Confirm") .setContentText("Do you want to logout?") .setCancelText("No") .setConfirmText("Yes") .showCancelButton(true) .setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sDialog.cancel(); } }).setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sweetAlertDialog) { mUserLogin.clear(); Intent loginIntent = new Intent(MainActivity_bak.this, LoginActivity.class); startActivity(loginIntent); finish(); } }).show(); } break; case R.id.nav_register: intent = new Intent(this, RegisterActivity.class); startActivity(intent); break; case R.id.nav_user_profile: intent = new Intent(this, UserDetailActivity.class); intent.putExtra("USER_ID", "" + userId); startActivity(intent); break; case R.id.nav_developer: Util.showAlertDialog(this, "Developers", "<NAME>\n<NAME>" + "\nSa Sokngim\n<NAME>\n<NAME>", true, SweetAlertDialog.NORMAL_TYPE); break; case R.id.nav_share: Intent myIntent = new Intent(Intent.ACTION_SEND); myIntent.setType("text/plain"); myIntent.putExtra(Intent.EXTRA_TEXT, "http://hrdams.herokuapp.com"); myIntent.putExtra(Intent.EXTRA_SUBJECT,"Check out this side"); startActivity(Intent.createChooser(myIntent,"Share With:")); break; } //Toast.makeText(this, "Hello " + item.getItemId(), Toast.LENGTH_SHORT).show(); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } @Override public void onDestroy() { super.onDestroy(); } /* Initialize View Objects (Widgets) Event. */ public void setEvents() { listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { //Toast.makeText(MainActivity.this, "Item " + position, Toast.LENGTH_SHORT).show(); Article article = articleList.get(position); Intent intent = new Intent(getBaseContext(), ArticleDetailActivity.class); intent.putExtra("ARTICLE_ID", String.valueOf(article.getId())); intent.putExtra("ROLE", role); intent.putExtra("USER_ID", String.valueOf(article.getUserId())); intent.putExtra("TITLE", article.getTitle()); intent.putExtra("IMAGE", article.getImage()); intent.putExtra("DATE", article.getPublishDate()); intent.putExtra("DESCRIPTION", article.getDescription()); listItemPosition = position; //startActivity(intent); startActivityForResult(intent, Util.KEY_EDIT_ARTICLE); } }); /* Enable Long_Click on ListView_Item for Login User Only. */ if (role != null) { listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { Article article = articleList.get(position); listItemPosition = position; showConfirmDialog(""+article.getId(), position); return true; } }); } } /* Important methods: Check whether User has Login. SharedPref File will be checked * when user choose 'Remember' on LoginActivity */ public boolean checkUserLogin() { mUserLogin = new UserLogin(this); mUserLogin.readFromSharedPrefFile(); // Get all save values from SharedPrefFile /*userId = 121; role = "admin"; username = "Buth Mathearo"; return true;*/ if (mUserLogin.isRemember()) { userId = mUserLogin.getId(); role = mUserLogin.getRole(); username = mUserLogin.getUsername(); //Toast.makeText(this, "Intent NULL, User ID: " + userId + ", role: " + role + ", name: " + username , Toast.LENGTH_SHORT).show(); return true; } else if (getIntent().getExtras() != null) { role = getIntent().getExtras().getString(UserLogin.ROLE); userId = getIntent().getExtras().getInt(UserLogin.USER_ID); username = getIntent().getExtras().getString(UserLogin.USERNAME); //Toast.makeText(this, "Intent not NULL, User ID: " + userId + ", role: " + role + ", name: " + username , Toast.LENGTH_SHORT).show(); return true; } else return false; /*if (getIntent().getExtras() == null) { mUserLogin = new UserLogin(this); mUserLogin.readFromSharedPrefFile(); if (mUserLogin.isRemember()) { userId = mUserLogin.getId(); role = mUserLogin.getRole(); username = mUserLogin.getUsername(); Toast.makeText(this, "Intent NULL, User ID: " + userId + ", role: " + role + ", name: " + username , Toast.LENGTH_SHORT).show(); return true; } //Toast.makeText(this, "Already Login. Remembered " + mUserLogin.isRemember(), Toast.LENGTH_SHORT).show(); } else { role = getIntent().getExtras().getString(UserLogin.ROLE); userId = getIntent().getExtras().getInt(UserLogin.USER_ID); username = getIntent().getExtras().getString(UserLogin.USERNAME); Toast.makeText(this, "Intent not NULL, User ID: " + userId + ", role: " + role + ", name: " + username , Toast.LENGTH_SHORT).show(); return true; } return false;*/ } /* Retrieve all articles from Server then Keep all record in an ArrayList. */ public void getAllArticles(String row, String pageCount) { /* "row": "10", "pageCount": "1" */ Util.showAlertDialog(this, "Loading...", false, SweetAlertDialog.PROGRESS_TYPE); String url = baseUrl + "/api/article/hrd_r001"; JsonObjectRequest jsonObjectRequest; JSONObject params; try { params = new JSONObject(); params.put("row", row.trim()); params.put("pageCount", pageCount.trim()); jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url.trim(), params, new Response.Listener<JSONObject>(){ @Override public void onResponse(JSONObject jsonObject) { Util.hideAlertDialog(); try { totalRecords = jsonObject.getInt("TOTAL_REC"); totalPages = getTotalPages(totalRecords); //Toast.makeText(MainActivity.this, "TotalRcords: " + totalRecords + ", TotalPages: " + totalPages, Toast.LENGTH_LONG).show(); JSONArray jsonArray = jsonObject.getJSONArray("RES_DATA"); for(int i = 0; i < jsonArray.length(); i++) { JSONObject obj = jsonArray.getJSONObject(i); Article article = new Article(); article.setId(obj.getInt("id")); article.setTitle(obj.getString("title")); article.setDescription(obj.getString("description")); article.setPublishDate(obj.getString("publishDate")); article.setImage(obj.getString("image")); article.setUserId(obj.getInt("userId")); article.setEnabled(obj.getBoolean("enabled")); articleList.add(article); } } catch (JSONException e) { Log.d(TAG, e.toString()); } // Notify to Adapter adapter.notifyDataSetChanged(); } }, new Response.ErrorListener(){ @Override public void onErrorResponse(VolleyError volleyError) { Log.d(TAG, volleyError.toString()); //Toast.makeText(getBaseContext(), "ERROR MESSAGE: " + volleyError.toString(), Toast.LENGTH_SHORT).show(); Util.hideAlertDialog(); Util.showAlertDialog(MainActivity_bak.this, "Alert", "Error: " + volleyError.toString(), true, SweetAlertDialog.ERROR_TYPE); } }); // Add RequestQueue AppController.getInstance().addToRequestQueue(jsonObjectRequest); } catch (JSONException e) { Log.d(TAG, e.toString()); } catch (Exception e) { Log.d(TAG, e.toString()); } } /* Retrieve all User's Articles by specified User ID. */ public void getUserArticles(String userId, String row, String pageCount) { /* "row": "10", "pageCount": "1"*/ Util.showAlertDialog(this, "Loading...", false, SweetAlertDialog.PROGRESS_TYPE); String url = baseUrl + "/api/article/user/" + userId; JsonObjectRequest jsonObjectRequest; JSONObject params; try { params = new JSONObject(); params.put("row", row.trim()); params.put("pageCount", pageCount.trim()); jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url.trim(), params, new Response.Listener<JSONObject>(){ @Override public void onResponse(JSONObject jsonObject) { Util.hideAlertDialog(); try { JSONArray jsonArray = jsonObject.getJSONArray("RES_DATA"); for(int i = 0; i < jsonArray.length(); i++) { JSONObject obj = jsonArray.getJSONObject(i); /*"id": 211, "title": "", "description": "", "publishDate": "2015-12-07", "image": "http://www.kshrd.com.kh/jsp/img/logo.png", "enabled": true, "userId": 43*/ Article article = new Article(); article.setId(obj.getInt("id")); article.setTitle(obj.getString("title")); article.setDescription(obj.getString("description")); article.setPublishDate(obj.getString("publishDate")); article.setImage(obj.getString("image")); article.setUserId(obj.getInt("userId")); article.setEnabled(obj.getBoolean("enabled")); articleList.add(article); } } catch (JSONException e) { Log.d(TAG, e.toString()); } // Notify to Adapter adapter.notifyDataSetChanged(); } }, new Response.ErrorListener(){ @Override public void onErrorResponse(VolleyError volleyError) { Log.d(TAG, volleyError.toString()); Util.hideAlertDialog(); Util.showAlertDialog(MainActivity_bak.this, "Alert", "Error: " + volleyError.toString(), true, SweetAlertDialog.ERROR_TYPE); //Toast.makeText(getBaseContext(), "ERROR MESSAGE: " + volleyError.toString(), Toast.LENGTH_SHORT).show(); } }); // Add RequestQueue AppController.getInstance().addToRequestQueue(jsonObjectRequest); } catch (JSONException e) { Log.d(TAG, e.toString()); } catch (Exception e) { Log.d(TAG, e.toString()); } } /* Search User's Articles. */ public void searchUserArticle(String title, String row, String pageCount, final int userId) { String url = baseUrl + "/api/article/search/" + title; JsonObjectRequest jsonObjectRequest; JSONObject params; try { params = new JSONObject(); params.put("row", row.trim()); params.put("pageCount", pageCount.trim()); jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url.trim(), params, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject jsonObject) { articleList.clear(); //Toast.makeText(getBaseContext(), "Search: " + jsonObject.toString(), Toast.LENGTH_LONG).show(); try { JSONArray jsonArray = jsonObject.getJSONArray("RES_DATA"); totalRecords = jsonObject.getInt("TOTAL_REC"); totalPages = getTotalPages(totalRecords); for(int i = 0; i < jsonArray.length(); i++) { JSONObject obj = jsonArray.getJSONObject(i); if (userId == obj.getInt("userId")){ Article article = new Article(); article.setId(obj.getInt("id")); article.setTitle(obj.getString("title")); article.setDescription(obj.getString("description")); article.setPublishDate(obj.getString("publishDate")); article.setImage(obj.getString("image")); article.setUserId(obj.getInt("userId")); article.setEnabled(obj.getBoolean("enabled")); articleList.add(article); } } } catch (JSONException e) { Log.d(TAG, e.toString()); } // Notify to Adapter adapter.notifyDataSetChanged(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { Log.d(TAG, volleyError.toString()); Toast.makeText(getBaseContext(), "ERROR_MESSAGE: " + volleyError.toString(), Toast.LENGTH_SHORT).show(); } }); // Add Request to RequestQueue AppController.getInstance().addToRequestQueue(jsonObjectRequest); } catch (JSONException e) { Log.d(TAG, e.toString()); } catch (Exception e) { Log.d(TAG, e.toString()); } } /* Search all articles. */ public void searchAllArticles(String title, String row, String pageCount) { String url = baseUrl + "/api/article/search/" + title; JsonObjectRequest jsonObjectRequest; JSONObject params; try { params = new JSONObject(); params.put("row", row.trim()); params.put("pageCount", pageCount.trim()); jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url.trim(), params, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject jsonObject) { articleList.clear(); //Toast.makeText(getBaseContext(), "Search: " + jsonObject.toString(), Toast.LENGTH_LONG).show(); try { JSONArray jsonArray = jsonObject.getJSONArray("RES_DATA"); totalRecords = jsonObject.getInt("TOTAL_REC"); totalPages = getTotalPages(totalRecords); for(int i = 0; i < jsonArray.length(); i++) { JSONObject obj = jsonArray.getJSONObject(i); Article article = new Article(); article.setId(obj.getInt("id")); article.setTitle(obj.getString("title")); article.setDescription(obj.getString("description")); article.setPublishDate(obj.getString("publishDate")); article.setImage(obj.getString("image")); article.setUserId(obj.getInt("userId")); article.setEnabled(obj.getBoolean("enabled")); articleList.add(article); } } catch (JSONException e) { Log.d(TAG, e.toString()); } // Notify to Adapter adapter.notifyDataSetChanged(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { Log.d(TAG, volleyError.toString()); Toast.makeText(getBaseContext(), "ERROR_MESSAGE: " + volleyError.toString(), Toast.LENGTH_SHORT).show(); } }); // Add Request to RequestQueue AppController.getInstance().addToRequestQueue(jsonObjectRequest); } catch (JSONException e) { Log.d(TAG, e.toString()); } catch (Exception e) { Log.d(TAG, e.toString()); } } /* Delete User's Article */ public void deleletUserArticle(String articleId, final int listItemPosition){ String url = baseUrl + "/api/article/hrd_d001"; JsonObjectRequest jsonObjectRequest; JSONObject params; try { params = new JSONObject(); params.put("id", articleId.trim()); jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url.trim(), params, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject jsonObject) { try { if (jsonObject.getBoolean("STATUS")) { articleList.remove(listItemPosition); Util.showAlertDialog(MainActivity_bak.this, "Deleted.", true, SweetAlertDialog.SUCCESS_TYPE); //Toast.makeText(getBaseContext(), "Deleted ID: " + listItemPosition, Toast.LENGTH_LONG).show(); } } catch (JSONException e) { Log.d(TAG, e.toString()); } adapter.notifyDataSetChanged(); //listView.removeViewAt(listItemPosition); //Toast.makeText(getBaseContext(), "Search: " + jsonObject.toString(), Toast.LENGTH_LONG).show(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { Log.d(TAG, volleyError.toString()); Toast.makeText(getBaseContext(), "ERROR_MESSAGE: " + volleyError.toString(), Toast.LENGTH_SHORT).show(); } }); // Add Request to RequestQueue AppController.getInstance().addToRequestQueue(jsonObjectRequest); } catch (JSONException e) { Log.d(TAG, e.toString()); } catch (Exception e) { Log.d(TAG, e.toString()); } } /* Show a Dialog (Context Menu) When User Long_Click on ListView_Item. */ public void showConfirmDialog(final String articleId, final int position) { final CharSequence[] items = { "Delete", "Edit" }; AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity_bak.this); //builder.setTitle("Make your selection"); builder.setItems(items, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { if(items[item].equals("Delete")){ AlertDialog.Builder alertDialog = new AlertDialog.Builder(MainActivity_bak.this); alertDialog.setTitle("Confirm"); alertDialog.setMessage("Do you want to delete?"); alertDialog.setIcon(R.mipmap.ic_launcher); alertDialog.setPositiveButton("YES", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { deleletUserArticle(articleId, position); // Write your code here to invoke YES event //Toast.makeText(MainActivity.this, "You clicked on YES", Toast.LENGTH_SHORT).show(); } }); alertDialog.setNegativeButton("NO", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // Write your code here to invoke NO event //Toast.makeText(MainActivity.this, "You clicked on NO", Toast.LENGTH_SHORT).show(); //dialog.cancel(); } }); alertDialog.show(); } if(items[item].equals("Edit")){ //Toast.makeText(MainActivity.this, "You clicked on Edit", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(getBaseContext(), EditArticleActivity.class); intent.putExtra("USER_ID", "" + articleList.get(position).getUserId()); intent.putExtra("ARTICLE_ID", articleId); //startActivity(intent); startActivityForResult(intent, Util.KEY_EDIT_ARTICLE); } } }); AlertDialog alert = builder.create(); alert.show(); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == Util.KEY_EDIT_ARTICLE){ // Get Data Back from EditArticleActivity if (resultCode == Util.KEY_EDIT_ARTICLE){ //Toast.makeText(MainActivity.this, "ID: " + data.getStringExtra("ARTICLE_ID"), Toast.LENGTH_SHORT).show(); getArticleDetail(data.getStringExtra("ARTICLE_ID")); Util.showAlertDialog(this, "Succefully edited an article.", true, SweetAlertDialog.SUCCESS_TYPE); } } /*if (data != null) Util.showAlertDialog(this,"MSG" ,"ART_ID: " + data.getStringExtra("ARTICLE_ID") + ", USER_ID: " + userId, true, SweetAlertDialog.NORMAL_TYPE); */ } /* Get Article Detail by ID */ public void getArticleDetail(final String articleId) { String url = Util.baseUrl + "/api/article/hrd_det001"; JsonObjectRequest jsonObjectRequest; try { JSONObject param = new JSONObject(); param.put("id", articleId); jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url.trim(), param, new Response.Listener<JSONObject>(){ @Override public void onResponse(JSONObject jsonObject) { try { JSONObject obj = jsonObject.getJSONObject("RES_DATA"); /*"id": 211, "title": "", "description": "", "publishDate": "2015-12-07", "image": "http://www.kshrd.com.kh/jsp/img/logo.png", "enabled": true, "userId": 43*/ Article tmpArticle = new Article(); tmpArticle.setId(obj.getInt("id")); tmpArticle.setTitle(obj.getString("title")); tmpArticle.setDescription(obj.getString("description")); tmpArticle.setPublishDate(obj.getString("publishDate")); tmpArticle.setImage(obj.getString("image")); tmpArticle.setUserId(obj.getInt("userId")); tmpArticle.setEnabled(obj.getBoolean("enabled")); articleList.get(listItemPosition).setTitle(tmpArticle.getShortTitle()); articleList.get(listItemPosition).setDescription(tmpArticle.getShortDescription()); articleList.get(listItemPosition).setImage(tmpArticle.getImageWithoutBaseUrl()); adapter.notifyDataSetChanged(); //Toast.makeText(MainActivity.this, "USER_ID: " + articleList.get(listItemPosition).getUserId(), Toast.LENGTH_SHORT).show(); } catch (JSONException e) { Log.d(TAG, e.toString()); } } }, new Response.ErrorListener(){ @Override public void onErrorResponse(VolleyError volleyError) { Log.d(TAG, volleyError.toString()); Toast.makeText(getBaseContext(), "ERROR MESSAGE: " + volleyError.toString(), Toast.LENGTH_SHORT).show(); } }); // Add RequestQueue AppController.getInstance().addToRequestQueue(jsonObjectRequest); } catch (JSONException e) { Log.d(TAG, e.toString()); } catch (Exception e) { Log.d(TAG, e.toString()); } } }
40,191
0.534676
0.53296
854
46.090164
32.374203
186
false
false
0
0
0
0
0
0
0.837237
false
false
9
28b41ae613134a0801e4309fa49f3e45e5a2c3e6
10,247,791,968,854
df7d5fb09d1426a19b1b42d08467c6aabcfa6dc0
/11850/solution.java
4ba1320753d4210791e4705e0b5d69c827ef4f8c
[]
no_license
guarner8/uva-problems
https://github.com/guarner8/uva-problems
c4c6519ef85d6d5f66ae43e1881f0e4968a02c9a
35cd70c5ad5408e3ddbba5bf73da3b77cf5633cf
refs/heads/master
2020-09-14T07:35:54.710000
2019-11-21T03:09:00
2019-11-21T03:09:00
223,066,863
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Main { public static void main(String [] args) { Scanner in = new Scanner(System.in); String result; int input; // Car can only travel 200 miles at a time while ((input = in.nextInt()) != 0) { result = ""; ArrayList<Integer> distances = new ArrayList<Integer>(); for (int i = 0; i < input; i++) { distances.add(in.nextInt()); } Collections.sort(distances); for (int i = 1; i < input; i++) { if (distances.get(i) - distances.get(i-1) > 200) { result = "IMPOSSIBLE"; } } if (input < 8 || ((1422-distances.get(input-1)) * 2) > 200) { System.out.println("IMPOSSIBLE"); continue; } if (result == "") { result = "POSSIBLE"; } System.out.println(result); } in.close(); } }
UTF-8
Java
878
java
solution.java
Java
[]
null
[]
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Main { public static void main(String [] args) { Scanner in = new Scanner(System.in); String result; int input; // Car can only travel 200 miles at a time while ((input = in.nextInt()) != 0) { result = ""; ArrayList<Integer> distances = new ArrayList<Integer>(); for (int i = 0; i < input; i++) { distances.add(in.nextInt()); } Collections.sort(distances); for (int i = 1; i < input; i++) { if (distances.get(i) - distances.get(i-1) > 200) { result = "IMPOSSIBLE"; } } if (input < 8 || ((1422-distances.get(input-1)) * 2) > 200) { System.out.println("IMPOSSIBLE"); continue; } if (result == "") { result = "POSSIBLE"; } System.out.println(result); } in.close(); } }
878
0.574032
0.551253
43
19.418604
17.648022
64
false
false
0
0
0
0
0
0
2.906977
false
false
9
c7672f2cff8cc66509819f787f8a6d1accc615aa
21,852,793,666,915
13d480ff0ba6311d42013d66eeadc5cb1669db54
/commons/src/main/java/org/infinispan/commons/io/ByteBuffer.java
fbc18fe4442a3ae557ca89320502cf6c78b0b36d
[ "Apache-2.0" ]
permissive
cloudtm/infinispan
https://github.com/cloudtm/infinispan
eb181a68bba9d671fc704ad79b54ae624cbf467c
8e26ed1127094cd28bd2f2b78943a8bdaa64b03a
refs/heads/master
2021-01-17T23:09:49.760000
2013-09-04T15:08:49
2013-09-04T15:28:16
1,596,539
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.infinispan.commons.io; import java.io.ByteArrayInputStream; import java.io.InputStream; /** * A byte buffer that exposes the internal byte array with minimal copying * * @author (various) * @since 4.0 */ public class ByteBuffer { private final byte[] buf; private final int offset; private final int length; public ByteBuffer(byte[] buf, int offset, int length) { this.buf = buf; this.offset = offset; this.length = length; } public byte[] getBuf() { return buf; } public int getOffset() { return offset; } public int getLength() { return length; } public ByteBuffer copy() { byte[] new_buf = buf != null ? new byte[length] : null; int new_length = new_buf != null ? new_buf.length : 0; if (new_buf != null) System.arraycopy(buf, offset, new_buf, 0, length); return new ByteBuffer(new_buf, 0, new_length); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(length).append(" bytes"); if (offset > 0) sb.append(" (offset=").append(offset).append(")"); return sb.toString(); } /** * @return an input stream for the bytes in the buffer */ public InputStream getStream() { return new ByteArrayInputStream(getBuf(), getOffset(), getLength()); } public java.nio.ByteBuffer toJDKByteBuffer() { return java.nio.ByteBuffer.wrap(buf, offset, length); } }
UTF-8
Java
1,494
java
ByteBuffer.java
Java
[ { "context": "al byte array with minimal copying\n *\n * @author (various)\n * @since 4.0\n */\npublic class ByteBuffer {\n p", "end": 203, "score": 0.9939510226249695, "start": 196, "tag": "USERNAME", "value": "various" } ]
null
[]
package org.infinispan.commons.io; import java.io.ByteArrayInputStream; import java.io.InputStream; /** * A byte buffer that exposes the internal byte array with minimal copying * * @author (various) * @since 4.0 */ public class ByteBuffer { private final byte[] buf; private final int offset; private final int length; public ByteBuffer(byte[] buf, int offset, int length) { this.buf = buf; this.offset = offset; this.length = length; } public byte[] getBuf() { return buf; } public int getOffset() { return offset; } public int getLength() { return length; } public ByteBuffer copy() { byte[] new_buf = buf != null ? new byte[length] : null; int new_length = new_buf != null ? new_buf.length : 0; if (new_buf != null) System.arraycopy(buf, offset, new_buf, 0, length); return new ByteBuffer(new_buf, 0, new_length); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(length).append(" bytes"); if (offset > 0) sb.append(" (offset=").append(offset).append(")"); return sb.toString(); } /** * @return an input stream for the bytes in the buffer */ public InputStream getStream() { return new ByteArrayInputStream(getBuf(), getOffset(), getLength()); } public java.nio.ByteBuffer toJDKByteBuffer() { return java.nio.ByteBuffer.wrap(buf, offset, length); } }
1,494
0.621151
0.617135
62
23.096775
21.284334
74
false
false
0
0
0
0
0
0
0.548387
false
false
9
9906b19c710b5f2ca85ea9af94d59ad3a6ac04c5
29,068,338,661,816
24ad42cd43a072b76b5609874ae4607973244755
/src/test/java/com/test/ProductTest.java
6487ba143ae827127cbd97786e56f045ec83b51a
[]
no_license
nihaksh/GreatOutdoors
https://github.com/nihaksh/GreatOutdoors
78cea0d0249014fdbdc685367dc77ea7fcb22161
57689db4b5493165142c36d7fd4ee073469b4286
refs/heads/master
2023-01-05T18:28:58.062000
2020-10-28T23:08:46
2020-10-28T23:08:46
306,251,174
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.test; public class ProductTest { }
UTF-8
Java
51
java
ProductTest.java
Java
[]
null
[]
package com.test; public class ProductTest { }
51
0.705882
0.705882
7
6.428571
9.839529
26
false
false
0
0
0
0
0
0
0.285714
false
false
9
33d126c172c7c097a77e52b0640500fd416a0bdf
27,496,380,695,648
31b298f45d664a6c653cb6374c5ef741762ae08d
/BlueSystemsManagement/src/main/java/com/packt/bsm/service/LicenseService.java
5d06d857d1787ee008cedef97410a9523f4b399f
[]
no_license
SzymonKwas/BlueSystemManagement
https://github.com/SzymonKwas/BlueSystemManagement
4f8e4b3bf059dc42bc3312e90343b60423eaf482
4ba6ee539204a99b126719c9e2ccd91852aae057
refs/heads/master
2017-12-05T03:14:52.058000
2017-04-20T14:05:14
2017-04-20T14:05:14
86,478,644
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.packt.bsm.service; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.UUID; import javax.validation.ConstraintValidator; import org.springframework.web.multipart.MultipartFile; import com.packt.bsm.domain.License; import com.packt.bsm.domain.System; import com.packt.bsm.service.file.UploadStats; /** * This interface defines methods used in service layer of application, that concern license. * @author Szymon Kwasnicki * @version 1.0 */ public interface LicenseService { /** * Returns list of all licenses stored in database. * @return list of licenses */ List<License> readAllLicenses(); /** * Returns list of active licenses stored in database. * @return list of active licenses */ List<License> readAllActiveLicenses(); /** * Returns list of licenses which contains system specified by systemId. * * @param systemId * - system identity * @return list of licenses */ List<License> readAllLicensesUsingSystemId(String systemId); /** * This method saves given list of licenses to database. * @param listOfLicenses */ void saveLicensesList(List<License> listOfLicenses); /** * Checks using given licenseId if license exists in database. * @param licenseId * @return true if license exists or false if not */ boolean licenseExists(UUID licenseId); /** * Saves given license into database. * @param license - license that will be persisted to database */ void create(License license); /** * Returns license specified with given license id. * @param licenseId * @return license */ License read(UUID licenseId); /** * This method updates record in database. * @param license */ void update(License license); /** * Deletes license with specified identify . * @param licenseId */ void delete(UUID licenseId); ArrayList<License> uploadLicensesFromFile(MultipartFile file, String rootPath, UploadStats importResults, HashMap<String, System> allSystems); }
UTF-8
Java
2,100
java
LicenseService.java
Java
[ { "context": " of application, that concern license.\r\n * @author Szymon Kwasnicki\r\n * @version 1.0\r\n */\r\npublic interface LicenseSe", "end": 497, "score": 0.9998329877853394, "start": 481, "tag": "NAME", "value": "Szymon Kwasnicki" } ]
null
[]
package com.packt.bsm.service; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.UUID; import javax.validation.ConstraintValidator; import org.springframework.web.multipart.MultipartFile; import com.packt.bsm.domain.License; import com.packt.bsm.domain.System; import com.packt.bsm.service.file.UploadStats; /** * This interface defines methods used in service layer of application, that concern license. * @author <NAME> * @version 1.0 */ public interface LicenseService { /** * Returns list of all licenses stored in database. * @return list of licenses */ List<License> readAllLicenses(); /** * Returns list of active licenses stored in database. * @return list of active licenses */ List<License> readAllActiveLicenses(); /** * Returns list of licenses which contains system specified by systemId. * * @param systemId * - system identity * @return list of licenses */ List<License> readAllLicensesUsingSystemId(String systemId); /** * This method saves given list of licenses to database. * @param listOfLicenses */ void saveLicensesList(List<License> listOfLicenses); /** * Checks using given licenseId if license exists in database. * @param licenseId * @return true if license exists or false if not */ boolean licenseExists(UUID licenseId); /** * Saves given license into database. * @param license - license that will be persisted to database */ void create(License license); /** * Returns license specified with given license id. * @param licenseId * @return license */ License read(UUID licenseId); /** * This method updates record in database. * @param license */ void update(License license); /** * Deletes license with specified identify . * @param licenseId */ void delete(UUID licenseId); ArrayList<License> uploadLicensesFromFile(MultipartFile file, String rootPath, UploadStats importResults, HashMap<String, System> allSystems); }
2,090
0.700476
0.699524
81
23.925926
25.242418
143
false
false
0
0
0
0
0
0
0.962963
false
false
9
d348af81b816e8f1a77c0b5dfc16874d8a7633da
4,672,924,473,826
727f746a0b836856eee8ff4be877e4ed5dbe0bf3
/SimpleDB_Server/src/simpledb/planner/BasicQueryPlanner.java
d429567b2e78dec91556071e2954cfebec0aa163
[]
no_license
Malatawy15/SimpleDB-Union
https://github.com/Malatawy15/SimpleDB-Union
140d09cac7f8a6d6e985ab6c7eb56ab516cb2e02
72d8081d27f90057cee3a1796a934848de3fe063
refs/heads/master
2021-01-10T19:30:56.692000
2013-05-13T09:10:36
2013-05-13T09:10:36
10,017,984
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package simpledb.planner; import simpledb.tx.Transaction; import simpledb.query.*; import simpledb.parse.*; import simpledb.server.SimpleDB; import java.util.*; /** * The simplest, most naive query planner possible. * * @author Edward Sciore */ public class BasicQueryPlanner implements QueryPlanner { /** * Creates a query plan as follows. It first takes the product of all tables * and views; it then selects on the predicate; and finally it projects on * the field list. */ public Plan createSelectPlan(SelectQueryData data, Transaction tx) { // Step 1: Create a plan for each mentioned table or view List<Plan> plans = new ArrayList<Plan>(); for (String tblname : data.tables()) { String viewdef = SimpleDB.mdMgr().getViewDef(tblname, tx); if (viewdef != null) plans.add(SimpleDB.planner().createQueryPlan(viewdef, tx)); else plans.add(new TablePlan(tblname, tx)); } // Step 2: Create the product of all table plans Plan p = plans.remove(0); for (Plan nextplan : plans) p = new ProductPlan(p, nextplan); // Step 3: Add a selection plan for the predicate p = new SelectPlan(p, data.pred()); // Step 4: Project on the field names p = new ProjectPlan(p, data.fields()); return p; } // Author: Hossam public Plan createPlan(SelectQueryData data, Transaction tx) { // Step 1: Create the plan that is going to be used Plan p = createSelectPlan(data,tx); // Step 2: Add same plan for the predicate because we assume that the 2 // plans have the same schema p = new UnionPlan(p, p); // Step 3: Project on the field names p = new ProjectPlan(p, data.fields()); return p; } }
UTF-8
Java
1,717
java
BasicQueryPlanner.java
Java
[ { "context": "ost naive query planner possible.\r\n * \r\n * @author Edward Sciore\r\n */\r\npublic class BasicQueryPlanner implements Q", "end": 258, "score": 0.9998891949653625, "start": 245, "tag": "NAME", "value": "Edward Sciore" }, { "context": "p, data.fields());\r\n\t\treturn ...
null
[]
package simpledb.planner; import simpledb.tx.Transaction; import simpledb.query.*; import simpledb.parse.*; import simpledb.server.SimpleDB; import java.util.*; /** * The simplest, most naive query planner possible. * * @author <NAME> */ public class BasicQueryPlanner implements QueryPlanner { /** * Creates a query plan as follows. It first takes the product of all tables * and views; it then selects on the predicate; and finally it projects on * the field list. */ public Plan createSelectPlan(SelectQueryData data, Transaction tx) { // Step 1: Create a plan for each mentioned table or view List<Plan> plans = new ArrayList<Plan>(); for (String tblname : data.tables()) { String viewdef = SimpleDB.mdMgr().getViewDef(tblname, tx); if (viewdef != null) plans.add(SimpleDB.planner().createQueryPlan(viewdef, tx)); else plans.add(new TablePlan(tblname, tx)); } // Step 2: Create the product of all table plans Plan p = plans.remove(0); for (Plan nextplan : plans) p = new ProductPlan(p, nextplan); // Step 3: Add a selection plan for the predicate p = new SelectPlan(p, data.pred()); // Step 4: Project on the field names p = new ProjectPlan(p, data.fields()); return p; } // Author: Hossam public Plan createPlan(SelectQueryData data, Transaction tx) { // Step 1: Create the plan that is going to be used Plan p = createSelectPlan(data,tx); // Step 2: Add same plan for the predicate because we assume that the 2 // plans have the same schema p = new UnionPlan(p, p); // Step 3: Project on the field names p = new ProjectPlan(p, data.fields()); return p; } }
1,710
0.672685
0.667443
58
27.603449
23.238598
77
false
false
0
0
0
0
0
0
1.775862
false
false
9
c45c5322037bb6c9aa290a5bd345478cb0a76e10
5,420,248,783,162
531b31674a33a1594f2e878eccf7a695362721f8
/mosip_2018_2019/test/mosip/model/randoms/ExponentialRandomDistributionIT.java
2693170a9db987b026bcfac19818c3c995699c92
[]
no_license
Shadow6390/Archives
https://github.com/Shadow6390/Archives
9a339b1abf953d02743b8506fa1c910736edcbd5
3e9908938d2534334021e087ba59dafe9fe64617
refs/heads/master
2020-12-26T14:06:07.135000
2020-02-03T18:37:14
2020-02-03T18:37:14
237,531,794
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 mosip.model.randoms; import java.util.Random; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*; /** * * @author Diogo */ public class ExponentialRandomDistributionIT { public ExponentialRandomDistributionIT() { } @BeforeClass public static void setUpClass() { } @AfterClass public static void tearDownClass() { } @Before public void setUp() { } @After public void tearDown() { } /** * Test of randomRange method, of class ExponentialRandomDistribution. */ @Test public void testRandomRange_double_double() { System.out.println("randomRange"); double lowerBound = 1.0; double upperBound = 4.0; ExponentialRandomDistribution instance = new ExponentialRandomDistribution(5); instance.setRandomStream(new Random(400)); double expResult = 1.92; double result = instance.randomRange(lowerBound, upperBound); assertEquals(expResult, result, 0.1); } @Test public void testRandomRange_double_double_within_bounds() { System.out.println("randomRange"); double lowerBound = 0.0; double upperBound = 6000.0; ExponentialRandomDistribution instance = new ExponentialRandomDistribution(5); instance.setRandomStream(new Random(500)); double expResult = 1759.198; double result = instance.randomRange(lowerBound, upperBound); assertEquals(expResult, result, 0.001); } @Test public void testRandomRange_double_double_crescendo() { System.out.println("randomRange"); double lowerBound = 1.0; double upperBound = 4.0; ExponentialRandomDistribution instance = new ExponentialRandomDistribution(5); instance.setRandomStream(new Random(500)); double lastResult=0; for (int i=0;i<12;i++) { double result = instance.randomRange(lowerBound, upperBound); assertTrue("Result is "+result+" and last result is "+lastResult,result>lastResult); lastResult=result; lowerBound+=result+0.1; upperBound+=result+0.1; } } /** * Test of randomRange method, of class ExponentialRandomDistribution. */ @Test public void testRandomRange_int_int() { System.out.println("randomRange"); int lowerBound = 1; int upperBound = 4; ExponentialRandomDistribution instance = new ExponentialRandomDistribution(5); instance.setRandomStream(new Random(400)); int expResult = 1; int result = instance.randomRange(lowerBound, upperBound); assertEquals(expResult, result); } /** * Test of random method, of class ExponentialRandomDistribution. */ @Test public void testRandom() { System.out.println("random"); ExponentialRandomDistribution instance = new ExponentialRandomDistribution(5); instance.setRandomStream(new Random(600)); double expResult = 0; double result = instance.random(); assertEquals(expResult, result, 0.001); } }
UTF-8
Java
3,501
java
ExponentialRandomDistributionIT.java
Java
[ { "context": "port static org.junit.Assert.*;\n\n/**\n *\n * @author Diogo\n */\npublic class ExponentialRandomDistributionIT\n", "end": 429, "score": 0.9996717572212219, "start": 424, "tag": "NAME", "value": "Diogo" } ]
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 mosip.model.randoms; import java.util.Random; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*; /** * * @author Diogo */ public class ExponentialRandomDistributionIT { public ExponentialRandomDistributionIT() { } @BeforeClass public static void setUpClass() { } @AfterClass public static void tearDownClass() { } @Before public void setUp() { } @After public void tearDown() { } /** * Test of randomRange method, of class ExponentialRandomDistribution. */ @Test public void testRandomRange_double_double() { System.out.println("randomRange"); double lowerBound = 1.0; double upperBound = 4.0; ExponentialRandomDistribution instance = new ExponentialRandomDistribution(5); instance.setRandomStream(new Random(400)); double expResult = 1.92; double result = instance.randomRange(lowerBound, upperBound); assertEquals(expResult, result, 0.1); } @Test public void testRandomRange_double_double_within_bounds() { System.out.println("randomRange"); double lowerBound = 0.0; double upperBound = 6000.0; ExponentialRandomDistribution instance = new ExponentialRandomDistribution(5); instance.setRandomStream(new Random(500)); double expResult = 1759.198; double result = instance.randomRange(lowerBound, upperBound); assertEquals(expResult, result, 0.001); } @Test public void testRandomRange_double_double_crescendo() { System.out.println("randomRange"); double lowerBound = 1.0; double upperBound = 4.0; ExponentialRandomDistribution instance = new ExponentialRandomDistribution(5); instance.setRandomStream(new Random(500)); double lastResult=0; for (int i=0;i<12;i++) { double result = instance.randomRange(lowerBound, upperBound); assertTrue("Result is "+result+" and last result is "+lastResult,result>lastResult); lastResult=result; lowerBound+=result+0.1; upperBound+=result+0.1; } } /** * Test of randomRange method, of class ExponentialRandomDistribution. */ @Test public void testRandomRange_int_int() { System.out.println("randomRange"); int lowerBound = 1; int upperBound = 4; ExponentialRandomDistribution instance = new ExponentialRandomDistribution(5); instance.setRandomStream(new Random(400)); int expResult = 1; int result = instance.randomRange(lowerBound, upperBound); assertEquals(expResult, result); } /** * Test of random method, of class ExponentialRandomDistribution. */ @Test public void testRandom() { System.out.println("random"); ExponentialRandomDistribution instance = new ExponentialRandomDistribution(5); instance.setRandomStream(new Random(600)); double expResult = 0; double result = instance.random(); assertEquals(expResult, result, 0.001); } }
3,501
0.643245
0.624107
125
27.007999
24.639967
96
false
false
0
0
0
0
0
0
0.552
false
false
9
bcc523f3740e7dc0d9863006bc8b0fd8375409ce
1,580,547,968,397
8be9c5632c9ba05891744cca924956e823cd5041
/POC/backendParent/service/src/main/java/com/backend/service/app/Application.java
65556104130e46d18a07024875f81b016062333e
[]
no_license
vrrasann/Learning-App-WebShopping
https://github.com/vrrasann/Learning-App-WebShopping
ca5f2db8225b5d179829faf547bf2f5aa9779fde
f55319947b932be7fad3621c3e606d2116f6fb2f
refs/heads/master
2023-07-15T17:35:01.971000
2021-03-27T08:38:48
2021-03-27T08:38:48
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.backend.service.app; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import com.backend.commons.util.ConfigUtil; @SpringBootApplication @ComponentScan(basePackages = {"com.backend.commons","com.backend.api","com.backend.service"}) @EnableConfigurationProperties @Configuration public class Application { private static Logger logger = LoggerFactory.getLogger(Application.class); @Autowired ConfigUtil config; public static void main(String[] args) { logger.info("Starting SpringBoot Application"); SpringApplication.run(Application.class, args); } }
UTF-8
Java
976
java
Application.java
Java
[]
null
[]
package com.backend.service.app; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import com.backend.commons.util.ConfigUtil; @SpringBootApplication @ComponentScan(basePackages = {"com.backend.commons","com.backend.api","com.backend.service"}) @EnableConfigurationProperties @Configuration public class Application { private static Logger logger = LoggerFactory.getLogger(Application.class); @Autowired ConfigUtil config; public static void main(String[] args) { logger.info("Starting SpringBoot Application"); SpringApplication.run(Application.class, args); } }
976
0.828893
0.826844
30
31.533333
27.687222
94
false
false
0
0
0
0
0
0
0.933333
false
false
9
ac1388261295cae0039354646ac364691db0d6b8
4,715,874,127,790
feeb006004d4bef12e0431e715a0ba3e26a94c3e
/app/src/main/java/com/melborp/yarfmm/activities/Waveview.java
799ba15a4cadf8dc20fd44ad1afbdf5c41becb97
[]
no_license
suwilanji-siwale/Mini_YAR_APP
https://github.com/suwilanji-siwale/Mini_YAR_APP
5ef044251c76de107c7daf71405ce898c71ee0ca
7ebc3157044df9b1cf4de8408d975cd62f4e97da
refs/heads/main
2023-04-09T04:20:57.115000
2021-04-17T19:41:41
2021-04-17T19:41:41
358,967,524
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.melborp.yarfmm.activities; import android.content.BroadcastReceiver; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.net.ConnectivityManager; import android.net.NetworkCapabilities; import android.net.NetworkInfo; import android.os.Build; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.Toast; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.core.content.ContextCompat; import com.melborp.yarfmm.R; import com.melborp.yarfmm.services.MainActivityService; import com.scwang.wave.MultiWaveHeader; public class Waveview extends AppCompatActivity { MultiWaveHeader waveHeader; ImageView playMack, stopMack; final String YAR_FM_STREAM = "http://196.46.210.116:8000/stream"; //final String YAR_FM_STREAM = "http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p"; //final String YAR_FM_STREAM = "http://s2.voscast.com:9304/"; //final String YAR_FM_STREAM = "http://stream-africa.com/PowerFMKabwe"; private boolean isOnline; public Intent serviceIntent; boolean mBufferBroadcastIsRegistered; // private static final int REQUEST_PHONE_CALL = 1; public static ProgressBar playProgressCircle; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_final); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); waveHeader = findViewById(R.id.waveHeader); playMack = findViewById(R.id.playMack); stopMack = findViewById(R.id.stopMack); //playProgressCircle playProgressCircle = findViewById(R.id.playProgressBar); /*playProgressCircle.getIndeterminateDrawable() .setColorFilter(ContextCompat.getColor(this, R.color.menu_white), PorterDuff.Mode.SRC_IN);*/ try { //serviceIntent = new Intent(this, MainActivityService.class); serviceIntent = new Intent(this, MainActivityService.class); } catch (Exception e) { e.printStackTrace(); Toast.makeText(getApplicationContext(), e.getClass().getName() + " " + e.getMessage(), Toast.LENGTH_LONG).show(); } playMack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { playAudio(); /* playMack.setVisibility(View.GONE); stopMack.setVisibility(View.VISIBLE);*/ } }); stopMack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { stopMyPlayService(); stopMack.setVisibility(View.GONE); playMack.setVisibility(View.VISIBLE); waveHeader.stop(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.aboutUs) { Intent i = new Intent(Waveview.this, Splash_about.class); startActivity(i); } else if (item.getItemId() == R.id.exit ) { stopMyPlayService(); finish(); } return true; } //Start wave view private void startWave() { waveHeader.start(); /* waveHeader.setStartColor(R.color.colorPrimaryDark); waveHeader.setCloseColor(R.color.colorPrimary);*/ } public void playAudio() { checkConnectivity(); if (isOnline) { stopMyPlayService(); serviceIntent.putExtra("yar", YAR_FM_STREAM); try { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { startForegroundService(serviceIntent); } else { startService(serviceIntent); } } catch (Exception e) { e.printStackTrace(); Toast.makeText(getApplicationContext(), e.getClass().getName() + " " + e.getMessage(), Toast.LENGTH_LONG).show(); } } else { final AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); alertDialog.setTitle("No Internet Connection..."); //alertDialog.setMessage("Please connect to a network....."); alertDialog.setNeutralButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { alertDialog.setCancelable(true); finish(); } }); alertDialog.setIcon(R.mipmap.ic_launcher); alertDialog.create().getWindow().getAttributes().windowAnimations = R.style.dialogAnimationFade; alertDialog.show(); //FragOnAir.speaker.clearAnimation(); } } public void stopMyPlayService() { try { stopService(serviceIntent); } catch (Exception e) { e.printStackTrace(); Toast.makeText(getApplicationContext(), e.getClass().getName() + " " + e.getMessage(), Toast.LENGTH_LONG).show(); } } private void checkConnectivity() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); if (cm != null) { if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { NetworkCapabilities capabilities = cm.getNetworkCapabilities(cm.getActiveNetwork()); if (capabilities != null) { if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)) { isOnline = true; } else if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) { isOnline = true; } else if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET)){ isOnline = true; } } } else { try { NetworkInfo activeNetworkInfo = cm.getActiveNetworkInfo(); if (activeNetworkInfo != null && activeNetworkInfo.isConnected()) { isOnline = true; } else { isOnline = false; } } catch (Exception e) { Log.i("update_statut", "" + e.getMessage()); } } } Log.i("update_statut","Network is available : FALSE "); //isOnline = false; } /* if (cm.getActiveNetworkInfo() != null && cm.getActiveNetworkInfo().isAvailable() && cm.getActiveNetworkInfo().isConnected()) { isOnline = true; } else { isOnline = false; }*/ @Override protected void onPause() { // Unregister broadcast receiver if (mBufferBroadcastIsRegistered) { unregisterReceiver(broadcastBufferReceiver); mBufferBroadcastIsRegistered = false; } super.onPause(); } // -- onResume register broadcast receiver. To improve, retrieve saved screen data --- @Override protected void onResume() { // Register broadcast receiver if (!mBufferBroadcastIsRegistered) { registerReceiver(broadcastBufferReceiver, new IntentFilter( MainActivityService.BROADCAST_BUFFER)); mBufferBroadcastIsRegistered = true; } super.onResume(); } // Set up broadcast receiver private BroadcastReceiver broadcastBufferReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent bufferIntent) { showPD(bufferIntent); } }; // Progress dialogue... private void BufferDialogue() { /* pdBuff = new ProgressDialog(MainActivity.this); // pdBuff.setTitle("Buffering"); //pdBuff.setMessage("Connecting to YAR FM server.."); pdBuff.setTitle("Connecting to YAR FM server.."); pdBuff.setIndeterminate(true); pdBuff.setCancelable(false); pdBuff.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { stopMyPlayService(); } }); pdBuff.show(); playStream.setVisibility(View.GONE); stopStream.setVisibility(View.VISIBLE);*/ playProgressCircle.setVisibility(View.VISIBLE); } // Handle progress dialogue for buffering... private void showPD(Intent bufferIntent) { String bufferValue = bufferIntent.getStringExtra("buffering"); int bufferIntValue = Integer.parseInt(bufferValue); // When the broadcasted "buffering" value is 1, show "Buffering" // progress dialogue. // When the broadcasted "buffering" value is 0, dismiss the progress // dialogue. switch (bufferIntValue) { case 0: /* if (pdBuff != null) { pdBuff.dismiss(); }*/ /* playProgressCircle.setVisibility(View.GONE); startEqualizer();*/ startWave(); playProgressCircle.setVisibility(View.GONE); playMack.setVisibility(View.GONE); stopMack.setVisibility(View.VISIBLE); break; case 1: BufferDialogue(); // break; case 2: break; } } }
UTF-8
Java
10,476
java
Waveview.java
Java
[ { "context": "opMack;\n\n final String YAR_FM_STREAM = \"http://196.46.210.116:8000/stream\";\n //final String YAR_FM_STREAM = ", "end": 1106, "score": 0.9062586426734924, "start": 1092, "tag": "IP_ADDRESS", "value": "196.46.210.116" } ]
null
[]
package com.melborp.yarfmm.activities; import android.content.BroadcastReceiver; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.net.ConnectivityManager; import android.net.NetworkCapabilities; import android.net.NetworkInfo; import android.os.Build; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.Toast; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.core.content.ContextCompat; import com.melborp.yarfmm.R; import com.melborp.yarfmm.services.MainActivityService; import com.scwang.wave.MultiWaveHeader; public class Waveview extends AppCompatActivity { MultiWaveHeader waveHeader; ImageView playMack, stopMack; final String YAR_FM_STREAM = "http://172.16.31.10:8000/stream"; //final String YAR_FM_STREAM = "http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p"; //final String YAR_FM_STREAM = "http://s2.voscast.com:9304/"; //final String YAR_FM_STREAM = "http://stream-africa.com/PowerFMKabwe"; private boolean isOnline; public Intent serviceIntent; boolean mBufferBroadcastIsRegistered; // private static final int REQUEST_PHONE_CALL = 1; public static ProgressBar playProgressCircle; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_final); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); waveHeader = findViewById(R.id.waveHeader); playMack = findViewById(R.id.playMack); stopMack = findViewById(R.id.stopMack); //playProgressCircle playProgressCircle = findViewById(R.id.playProgressBar); /*playProgressCircle.getIndeterminateDrawable() .setColorFilter(ContextCompat.getColor(this, R.color.menu_white), PorterDuff.Mode.SRC_IN);*/ try { //serviceIntent = new Intent(this, MainActivityService.class); serviceIntent = new Intent(this, MainActivityService.class); } catch (Exception e) { e.printStackTrace(); Toast.makeText(getApplicationContext(), e.getClass().getName() + " " + e.getMessage(), Toast.LENGTH_LONG).show(); } playMack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { playAudio(); /* playMack.setVisibility(View.GONE); stopMack.setVisibility(View.VISIBLE);*/ } }); stopMack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { stopMyPlayService(); stopMack.setVisibility(View.GONE); playMack.setVisibility(View.VISIBLE); waveHeader.stop(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.aboutUs) { Intent i = new Intent(Waveview.this, Splash_about.class); startActivity(i); } else if (item.getItemId() == R.id.exit ) { stopMyPlayService(); finish(); } return true; } //Start wave view private void startWave() { waveHeader.start(); /* waveHeader.setStartColor(R.color.colorPrimaryDark); waveHeader.setCloseColor(R.color.colorPrimary);*/ } public void playAudio() { checkConnectivity(); if (isOnline) { stopMyPlayService(); serviceIntent.putExtra("yar", YAR_FM_STREAM); try { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { startForegroundService(serviceIntent); } else { startService(serviceIntent); } } catch (Exception e) { e.printStackTrace(); Toast.makeText(getApplicationContext(), e.getClass().getName() + " " + e.getMessage(), Toast.LENGTH_LONG).show(); } } else { final AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); alertDialog.setTitle("No Internet Connection..."); //alertDialog.setMessage("Please connect to a network....."); alertDialog.setNeutralButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { alertDialog.setCancelable(true); finish(); } }); alertDialog.setIcon(R.mipmap.ic_launcher); alertDialog.create().getWindow().getAttributes().windowAnimations = R.style.dialogAnimationFade; alertDialog.show(); //FragOnAir.speaker.clearAnimation(); } } public void stopMyPlayService() { try { stopService(serviceIntent); } catch (Exception e) { e.printStackTrace(); Toast.makeText(getApplicationContext(), e.getClass().getName() + " " + e.getMessage(), Toast.LENGTH_LONG).show(); } } private void checkConnectivity() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); if (cm != null) { if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { NetworkCapabilities capabilities = cm.getNetworkCapabilities(cm.getActiveNetwork()); if (capabilities != null) { if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)) { isOnline = true; } else if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) { isOnline = true; } else if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET)){ isOnline = true; } } } else { try { NetworkInfo activeNetworkInfo = cm.getActiveNetworkInfo(); if (activeNetworkInfo != null && activeNetworkInfo.isConnected()) { isOnline = true; } else { isOnline = false; } } catch (Exception e) { Log.i("update_statut", "" + e.getMessage()); } } } Log.i("update_statut","Network is available : FALSE "); //isOnline = false; } /* if (cm.getActiveNetworkInfo() != null && cm.getActiveNetworkInfo().isAvailable() && cm.getActiveNetworkInfo().isConnected()) { isOnline = true; } else { isOnline = false; }*/ @Override protected void onPause() { // Unregister broadcast receiver if (mBufferBroadcastIsRegistered) { unregisterReceiver(broadcastBufferReceiver); mBufferBroadcastIsRegistered = false; } super.onPause(); } // -- onResume register broadcast receiver. To improve, retrieve saved screen data --- @Override protected void onResume() { // Register broadcast receiver if (!mBufferBroadcastIsRegistered) { registerReceiver(broadcastBufferReceiver, new IntentFilter( MainActivityService.BROADCAST_BUFFER)); mBufferBroadcastIsRegistered = true; } super.onResume(); } // Set up broadcast receiver private BroadcastReceiver broadcastBufferReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent bufferIntent) { showPD(bufferIntent); } }; // Progress dialogue... private void BufferDialogue() { /* pdBuff = new ProgressDialog(MainActivity.this); // pdBuff.setTitle("Buffering"); //pdBuff.setMessage("Connecting to YAR FM server.."); pdBuff.setTitle("Connecting to YAR FM server.."); pdBuff.setIndeterminate(true); pdBuff.setCancelable(false); pdBuff.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { stopMyPlayService(); } }); pdBuff.show(); playStream.setVisibility(View.GONE); stopStream.setVisibility(View.VISIBLE);*/ playProgressCircle.setVisibility(View.VISIBLE); } // Handle progress dialogue for buffering... private void showPD(Intent bufferIntent) { String bufferValue = bufferIntent.getStringExtra("buffering"); int bufferIntValue = Integer.parseInt(bufferValue); // When the broadcasted "buffering" value is 1, show "Buffering" // progress dialogue. // When the broadcasted "buffering" value is 0, dismiss the progress // dialogue. switch (bufferIntValue) { case 0: /* if (pdBuff != null) { pdBuff.dismiss(); }*/ /* playProgressCircle.setVisibility(View.GONE); startEqualizer();*/ startWave(); playProgressCircle.setVisibility(View.GONE); playMack.setVisibility(View.GONE); stopMack.setVisibility(View.VISIBLE); break; case 1: BufferDialogue(); // break; case 2: break; } } }
10,474
0.586865
0.584288
344
29.453489
26.298225
129
false
false
0
0
0
0
0
0
0.462209
false
false
13
7159d1a38d02f27905f855ad0953a2451e4103d4
12,455,405,206,647
c4560a9ba1d06d0f00cf0320bc364b9cd644dd0d
/src/main/java/org/opensha/oaf/rj/RJ_Summary.java
e9c8c445cddc1ba20cf95cdcf85f705f27f8826a
[ "CC0-1.0" ]
permissive
opensha/opensha-oaf
https://github.com/opensha/opensha-oaf
d9486c34a715a2e94d31b1e509a0718b10173f66
e05205db5f52ceb36b3c30c07996a4837754a1a4
refs/heads/master
2023-08-02T07:13:36.968000
2023-07-30T00:08:58
2023-07-30T00:08:58
145,740,135
1
2
Apache-2.0
false
2021-11-13T13:04:51
2018-08-22T17:16:58
2021-11-13T13:01:29
2021-11-13T13:01:26
34,748
2
2
0
Java
false
false
package org.opensha.oaf.rj; import org.opensha.oaf.util.MarshalReader; import org.opensha.oaf.util.MarshalWriter; import org.opensha.oaf.util.MarshalException; public class RJ_Summary { // Summary values, see RJ_AftershockModel for description. private double b ; private double magMain ; private double min_a ; private double max_a ; private double delta_a ; private int num_a ; private double min_p ; private double max_p ; private double delta_p ; private int num_p ; private double min_c ; private double max_c ; private double delta_c ; private int num_c ; private int apc_total_size ; private int apc_support_size ; private double apc_support_total ; private double apc_max_tail_element; private int a_support_lo ; private int a_support_hi ; private int p_support_lo ; private int p_support_hi ; private int c_support_lo ; private int c_support_hi ; private double stat_a_mean ; private double stat_a_sdev ; private double stat_a_like ; private double stat_p_mean ; private double stat_p_sdev ; private double stat_p_like ; private double stat_c_mean ; private double stat_c_sdev ; private double stat_c_like ; /** * Default constructor. */ public RJ_Summary(){} /** * Construct from R&J model. */ public RJ_Summary(RJ_AftershockModel model) { this.b = model.b ; this.magMain = model.magMain ; this.min_a = model.min_a ; this.max_a = model.max_a ; this.delta_a = model.delta_a ; this.num_a = model.num_a ; this.min_p = model.min_p ; this.max_p = model.max_p ; this.delta_p = model.delta_p ; this.num_p = model.num_p ; this.min_c = model.min_c ; this.max_c = model.max_c ; this.delta_c = model.delta_c ; this.num_c = model.num_c ; this.apc_total_size = model.apc_total_size ; this.apc_support_size = model.apc_support_size ; this.apc_support_total = model.apc_support_total ; this.apc_max_tail_element = model.apc_max_tail_element; this.a_support_lo = model.a_support_lo ; this.a_support_hi = model.a_support_hi ; this.p_support_lo = model.p_support_lo ; this.p_support_hi = model.p_support_hi ; this.c_support_lo = model.c_support_lo ; this.c_support_hi = model.c_support_hi ; this.stat_a_mean = model.stat_a_mean ; this.stat_a_sdev = model.stat_a_sdev ; this.stat_a_like = model.stat_a_like ; this.stat_p_mean = model.stat_p_mean ; this.stat_p_sdev = model.stat_p_sdev ; this.stat_p_like = model.stat_p_like ; this.stat_c_mean = model.stat_c_mean ; this.stat_c_sdev = model.stat_c_sdev ; this.stat_c_like = model.stat_c_like ; } /** * Getters. */ public double get_b () {return b ;} public double get_magMain () {return magMain ;} public double get_min_a () {return min_a ;} public double get_max_a () {return max_a ;} public double get_delta_a () {return delta_a ;} public int get_num_a () {return num_a ;} public double get_min_p () {return min_p ;} public double get_max_p () {return max_p ;} public double get_delta_p () {return delta_p ;} public int get_num_p () {return num_p ;} public double get_min_c () {return min_c ;} public double get_max_c () {return max_c ;} public double get_delta_c () {return delta_c ;} public int get_num_c () {return num_c ;} public int get_apc_total_size () {return apc_total_size ;} public int get_apc_support_size () {return apc_support_size ;} public double get_apc_support_total () {return apc_support_total ;} public double get_apc_max_tail_element() {return apc_max_tail_element;} public int get_a_support_lo () {return a_support_lo ;} public int get_a_support_hi () {return a_support_hi ;} public int get_p_support_lo () {return p_support_lo ;} public int get_p_support_hi () {return p_support_hi ;} public int get_c_support_lo () {return c_support_lo ;} public int get_c_support_hi () {return c_support_hi ;} public double get_stat_a_mean () {return stat_a_mean ;} public double get_stat_a_sdev () {return stat_a_sdev ;} public double get_stat_a_like () {return stat_a_like ;} public double get_stat_p_mean () {return stat_p_mean ;} public double get_stat_p_sdev () {return stat_p_sdev ;} public double get_stat_p_like () {return stat_p_like ;} public double get_stat_c_mean () {return stat_c_mean ;} public double get_stat_c_sdev () {return stat_c_sdev ;} public double get_stat_c_like () {return stat_c_like ;} @Override public String toString() { return "b = " + get_b () + "\n" + "magMain = " + get_magMain () + "\n" + "min_a = " + get_min_a () + "\n" + "max_a = " + get_max_a () + "\n" + "delta_a = " + get_delta_a () + "\n" + "num_a = " + get_num_a () + "\n" + "min_p = " + get_min_p () + "\n" + "max_p = " + get_max_p () + "\n" + "delta_p = " + get_delta_p () + "\n" + "num_p = " + get_num_p () + "\n" + "min_c = " + get_min_c () + "\n" + "max_c = " + get_max_c () + "\n" + "delta_c = " + get_delta_c () + "\n" + "num_c = " + get_num_c () + "\n" + "apc_total_size = " + get_apc_total_size () + "\n" + "apc_support_size = " + get_apc_support_size () + "\n" + "apc_support_total = " + get_apc_support_total () + "\n" + "apc_max_tail_element = " + get_apc_max_tail_element() + "\n" + "a_support_lo = " + get_a_support_lo () + "\n" + "a_support_hi = " + get_a_support_hi () + "\n" + "p_support_lo = " + get_p_support_lo () + "\n" + "p_support_hi = " + get_p_support_hi () + "\n" + "c_support_lo = " + get_c_support_lo () + "\n" + "c_support_hi = " + get_c_support_hi () + "\n" + "stat_a_mean = " + get_stat_a_mean () + "\n" + "stat_a_sdev = " + get_stat_a_sdev () + "\n" + "stat_a_like = " + get_stat_a_like () + "\n" + "stat_p_mean = " + get_stat_p_mean () + "\n" + "stat_p_sdev = " + get_stat_p_sdev () + "\n" + "stat_p_like = " + get_stat_p_like () + "\n" + "stat_c_mean = " + get_stat_c_mean () + "\n" + "stat_c_sdev = " + get_stat_c_sdev () + "\n" + "stat_c_like = " + get_stat_c_like () ; } //----- Marshaling ----- // Marshal version number. private static final int MARSHAL_VER_1 = 4001; private static final String M_VERSION_NAME = "RJ_Summary"; // Marshal type code. protected static final int MARSHAL_NULL = 4000; protected static final int MARSHAL_RJBASE = 4001; protected static final int MARSHAL_RJGEN = 5001; protected static final int MARSHAL_RJBAY = 6001; protected static final int MARSHAL_RJSEQ = 7001; protected static final String M_TYPE_NAME = "ClassType"; // Get the type code. protected int get_marshal_type () { return MARSHAL_RJBASE; } // Marshal object, internal. protected void do_marshal (MarshalWriter writer) { // Version writer.marshalInt (M_VERSION_NAME, MARSHAL_VER_1); // Contents writer.marshalDouble ("b" , b ); writer.marshalDouble ("magMain" , magMain ); writer.marshalDouble ("min_a" , min_a ); writer.marshalDouble ("max_a" , max_a ); writer.marshalDouble ("delta_a" , delta_a ); writer.marshalInt ("num_a" , num_a ); writer.marshalDouble ("min_p" , min_p ); writer.marshalDouble ("max_p" , max_p ); writer.marshalDouble ("delta_p" , delta_p ); writer.marshalInt ("num_p" , num_p ); writer.marshalDouble ("min_c" , min_c ); writer.marshalDouble ("max_c" , max_c ); writer.marshalDouble ("delta_c" , delta_c ); writer.marshalInt ("num_c" , num_c ); writer.marshalInt ("apc_total_size" , apc_total_size ); writer.marshalInt ("apc_support_size" , apc_support_size ); writer.marshalDouble ("apc_support_total" , apc_support_total ); writer.marshalDouble ("apc_max_tail_element", apc_max_tail_element); writer.marshalInt ("a_support_lo" , a_support_lo ); writer.marshalInt ("a_support_hi" , a_support_hi ); writer.marshalInt ("p_support_lo" , p_support_lo ); writer.marshalInt ("p_support_hi" , p_support_hi ); writer.marshalInt ("c_support_lo" , c_support_lo ); writer.marshalInt ("c_support_hi" , c_support_hi ); writer.marshalDouble ("stat_a_mean" , stat_a_mean ); writer.marshalDouble ("stat_a_sdev" , stat_a_sdev ); writer.marshalDouble ("stat_a_like" , stat_a_like ); writer.marshalDouble ("stat_p_mean" , stat_p_mean ); writer.marshalDouble ("stat_p_sdev" , stat_p_sdev ); writer.marshalDouble ("stat_p_like" , stat_p_like ); writer.marshalDouble ("stat_c_mean" , stat_c_mean ); writer.marshalDouble ("stat_c_sdev" , stat_c_sdev ); writer.marshalDouble ("stat_c_like" , stat_c_like ); return; } // Unmarshal object, internal. protected void do_umarshal (MarshalReader reader) { // Version int ver = reader.unmarshalInt (M_VERSION_NAME, MARSHAL_VER_1, MARSHAL_VER_1); // Contents b = reader.unmarshalDouble ("b" ); magMain = reader.unmarshalDouble ("magMain" ); min_a = reader.unmarshalDouble ("min_a" ); max_a = reader.unmarshalDouble ("max_a" ); delta_a = reader.unmarshalDouble ("delta_a" ); num_a = reader.unmarshalInt ("num_a" , 1); min_p = reader.unmarshalDouble ("min_p" ); max_p = reader.unmarshalDouble ("max_p" ); delta_p = reader.unmarshalDouble ("delta_p" ); num_p = reader.unmarshalInt ("num_p" , 1); min_c = reader.unmarshalDouble ("min_c" ); max_c = reader.unmarshalDouble ("max_c" ); delta_c = reader.unmarshalDouble ("delta_c" ); num_c = reader.unmarshalInt ("num_c" , 1); apc_total_size = reader.unmarshalInt ("apc_total_size" , 1); apc_support_size = reader.unmarshalInt ("apc_support_size" , 0); apc_support_total = reader.unmarshalDouble ("apc_support_total" ); apc_max_tail_element = reader.unmarshalDouble ("apc_max_tail_element"); a_support_lo = reader.unmarshalInt ("a_support_lo" , 0); a_support_hi = reader.unmarshalInt ("a_support_hi" , 0); p_support_lo = reader.unmarshalInt ("p_support_lo" , 0); p_support_hi = reader.unmarshalInt ("p_support_hi" , 0); c_support_lo = reader.unmarshalInt ("c_support_lo" , 0); c_support_hi = reader.unmarshalInt ("c_support_hi" , 0); stat_a_mean = reader.unmarshalDouble ("stat_a_mean" ); stat_a_sdev = reader.unmarshalDouble ("stat_a_sdev" ); stat_a_like = reader.unmarshalDouble ("stat_a_like" ); stat_p_mean = reader.unmarshalDouble ("stat_p_mean" ); stat_p_sdev = reader.unmarshalDouble ("stat_p_sdev" ); stat_p_like = reader.unmarshalDouble ("stat_p_like" ); stat_c_mean = reader.unmarshalDouble ("stat_c_mean" ); stat_c_sdev = reader.unmarshalDouble ("stat_c_sdev" ); stat_c_like = reader.unmarshalDouble ("stat_c_like" ); return; } // Marshal object. public void marshal (MarshalWriter writer, String name) { writer.marshalMapBegin (name); do_marshal (writer); writer.marshalMapEnd (); return; } // Unmarshal object. public RJ_Summary unmarshal (MarshalReader reader, String name) { reader.unmarshalMapBegin (name); do_umarshal (reader); reader.unmarshalMapEnd (); return this; } // Marshal object, polymorphic. public static void marshal_poly (MarshalWriter writer, String name, RJ_Summary obj) { writer.marshalMapBegin (name); if (obj == null) { writer.marshalInt (M_TYPE_NAME, MARSHAL_NULL); } else { writer.marshalInt (M_TYPE_NAME, obj.get_marshal_type()); obj.do_marshal (writer); } writer.marshalMapEnd (); return; } // Unmarshal object, polymorphic. public static RJ_Summary unmarshal_poly (MarshalReader reader, String name) { RJ_Summary result; reader.unmarshalMapBegin (name); // Switch according to type int type = reader.unmarshalInt (M_TYPE_NAME); switch (type) { default: throw new MarshalException ("RJ_Summary.unmarshal_poly: Unknown class type code: type = " + type); case MARSHAL_NULL: result = null; break; case MARSHAL_RJBASE: result = new RJ_Summary(); result.do_umarshal (reader); break; case MARSHAL_RJGEN: result = new RJ_Summary_Generic(); result.do_umarshal (reader); break; case MARSHAL_RJBAY: result = new RJ_Summary_Bayesian(); result.do_umarshal (reader); break; case MARSHAL_RJSEQ: result = new RJ_Summary_SequenceSpecific(); result.do_umarshal (reader); break; } reader.unmarshalMapEnd (); return result; } }
UTF-8
Java
15,731
java
RJ_Summary.java
Java
[]
null
[]
package org.opensha.oaf.rj; import org.opensha.oaf.util.MarshalReader; import org.opensha.oaf.util.MarshalWriter; import org.opensha.oaf.util.MarshalException; public class RJ_Summary { // Summary values, see RJ_AftershockModel for description. private double b ; private double magMain ; private double min_a ; private double max_a ; private double delta_a ; private int num_a ; private double min_p ; private double max_p ; private double delta_p ; private int num_p ; private double min_c ; private double max_c ; private double delta_c ; private int num_c ; private int apc_total_size ; private int apc_support_size ; private double apc_support_total ; private double apc_max_tail_element; private int a_support_lo ; private int a_support_hi ; private int p_support_lo ; private int p_support_hi ; private int c_support_lo ; private int c_support_hi ; private double stat_a_mean ; private double stat_a_sdev ; private double stat_a_like ; private double stat_p_mean ; private double stat_p_sdev ; private double stat_p_like ; private double stat_c_mean ; private double stat_c_sdev ; private double stat_c_like ; /** * Default constructor. */ public RJ_Summary(){} /** * Construct from R&J model. */ public RJ_Summary(RJ_AftershockModel model) { this.b = model.b ; this.magMain = model.magMain ; this.min_a = model.min_a ; this.max_a = model.max_a ; this.delta_a = model.delta_a ; this.num_a = model.num_a ; this.min_p = model.min_p ; this.max_p = model.max_p ; this.delta_p = model.delta_p ; this.num_p = model.num_p ; this.min_c = model.min_c ; this.max_c = model.max_c ; this.delta_c = model.delta_c ; this.num_c = model.num_c ; this.apc_total_size = model.apc_total_size ; this.apc_support_size = model.apc_support_size ; this.apc_support_total = model.apc_support_total ; this.apc_max_tail_element = model.apc_max_tail_element; this.a_support_lo = model.a_support_lo ; this.a_support_hi = model.a_support_hi ; this.p_support_lo = model.p_support_lo ; this.p_support_hi = model.p_support_hi ; this.c_support_lo = model.c_support_lo ; this.c_support_hi = model.c_support_hi ; this.stat_a_mean = model.stat_a_mean ; this.stat_a_sdev = model.stat_a_sdev ; this.stat_a_like = model.stat_a_like ; this.stat_p_mean = model.stat_p_mean ; this.stat_p_sdev = model.stat_p_sdev ; this.stat_p_like = model.stat_p_like ; this.stat_c_mean = model.stat_c_mean ; this.stat_c_sdev = model.stat_c_sdev ; this.stat_c_like = model.stat_c_like ; } /** * Getters. */ public double get_b () {return b ;} public double get_magMain () {return magMain ;} public double get_min_a () {return min_a ;} public double get_max_a () {return max_a ;} public double get_delta_a () {return delta_a ;} public int get_num_a () {return num_a ;} public double get_min_p () {return min_p ;} public double get_max_p () {return max_p ;} public double get_delta_p () {return delta_p ;} public int get_num_p () {return num_p ;} public double get_min_c () {return min_c ;} public double get_max_c () {return max_c ;} public double get_delta_c () {return delta_c ;} public int get_num_c () {return num_c ;} public int get_apc_total_size () {return apc_total_size ;} public int get_apc_support_size () {return apc_support_size ;} public double get_apc_support_total () {return apc_support_total ;} public double get_apc_max_tail_element() {return apc_max_tail_element;} public int get_a_support_lo () {return a_support_lo ;} public int get_a_support_hi () {return a_support_hi ;} public int get_p_support_lo () {return p_support_lo ;} public int get_p_support_hi () {return p_support_hi ;} public int get_c_support_lo () {return c_support_lo ;} public int get_c_support_hi () {return c_support_hi ;} public double get_stat_a_mean () {return stat_a_mean ;} public double get_stat_a_sdev () {return stat_a_sdev ;} public double get_stat_a_like () {return stat_a_like ;} public double get_stat_p_mean () {return stat_p_mean ;} public double get_stat_p_sdev () {return stat_p_sdev ;} public double get_stat_p_like () {return stat_p_like ;} public double get_stat_c_mean () {return stat_c_mean ;} public double get_stat_c_sdev () {return stat_c_sdev ;} public double get_stat_c_like () {return stat_c_like ;} @Override public String toString() { return "b = " + get_b () + "\n" + "magMain = " + get_magMain () + "\n" + "min_a = " + get_min_a () + "\n" + "max_a = " + get_max_a () + "\n" + "delta_a = " + get_delta_a () + "\n" + "num_a = " + get_num_a () + "\n" + "min_p = " + get_min_p () + "\n" + "max_p = " + get_max_p () + "\n" + "delta_p = " + get_delta_p () + "\n" + "num_p = " + get_num_p () + "\n" + "min_c = " + get_min_c () + "\n" + "max_c = " + get_max_c () + "\n" + "delta_c = " + get_delta_c () + "\n" + "num_c = " + get_num_c () + "\n" + "apc_total_size = " + get_apc_total_size () + "\n" + "apc_support_size = " + get_apc_support_size () + "\n" + "apc_support_total = " + get_apc_support_total () + "\n" + "apc_max_tail_element = " + get_apc_max_tail_element() + "\n" + "a_support_lo = " + get_a_support_lo () + "\n" + "a_support_hi = " + get_a_support_hi () + "\n" + "p_support_lo = " + get_p_support_lo () + "\n" + "p_support_hi = " + get_p_support_hi () + "\n" + "c_support_lo = " + get_c_support_lo () + "\n" + "c_support_hi = " + get_c_support_hi () + "\n" + "stat_a_mean = " + get_stat_a_mean () + "\n" + "stat_a_sdev = " + get_stat_a_sdev () + "\n" + "stat_a_like = " + get_stat_a_like () + "\n" + "stat_p_mean = " + get_stat_p_mean () + "\n" + "stat_p_sdev = " + get_stat_p_sdev () + "\n" + "stat_p_like = " + get_stat_p_like () + "\n" + "stat_c_mean = " + get_stat_c_mean () + "\n" + "stat_c_sdev = " + get_stat_c_sdev () + "\n" + "stat_c_like = " + get_stat_c_like () ; } //----- Marshaling ----- // Marshal version number. private static final int MARSHAL_VER_1 = 4001; private static final String M_VERSION_NAME = "RJ_Summary"; // Marshal type code. protected static final int MARSHAL_NULL = 4000; protected static final int MARSHAL_RJBASE = 4001; protected static final int MARSHAL_RJGEN = 5001; protected static final int MARSHAL_RJBAY = 6001; protected static final int MARSHAL_RJSEQ = 7001; protected static final String M_TYPE_NAME = "ClassType"; // Get the type code. protected int get_marshal_type () { return MARSHAL_RJBASE; } // Marshal object, internal. protected void do_marshal (MarshalWriter writer) { // Version writer.marshalInt (M_VERSION_NAME, MARSHAL_VER_1); // Contents writer.marshalDouble ("b" , b ); writer.marshalDouble ("magMain" , magMain ); writer.marshalDouble ("min_a" , min_a ); writer.marshalDouble ("max_a" , max_a ); writer.marshalDouble ("delta_a" , delta_a ); writer.marshalInt ("num_a" , num_a ); writer.marshalDouble ("min_p" , min_p ); writer.marshalDouble ("max_p" , max_p ); writer.marshalDouble ("delta_p" , delta_p ); writer.marshalInt ("num_p" , num_p ); writer.marshalDouble ("min_c" , min_c ); writer.marshalDouble ("max_c" , max_c ); writer.marshalDouble ("delta_c" , delta_c ); writer.marshalInt ("num_c" , num_c ); writer.marshalInt ("apc_total_size" , apc_total_size ); writer.marshalInt ("apc_support_size" , apc_support_size ); writer.marshalDouble ("apc_support_total" , apc_support_total ); writer.marshalDouble ("apc_max_tail_element", apc_max_tail_element); writer.marshalInt ("a_support_lo" , a_support_lo ); writer.marshalInt ("a_support_hi" , a_support_hi ); writer.marshalInt ("p_support_lo" , p_support_lo ); writer.marshalInt ("p_support_hi" , p_support_hi ); writer.marshalInt ("c_support_lo" , c_support_lo ); writer.marshalInt ("c_support_hi" , c_support_hi ); writer.marshalDouble ("stat_a_mean" , stat_a_mean ); writer.marshalDouble ("stat_a_sdev" , stat_a_sdev ); writer.marshalDouble ("stat_a_like" , stat_a_like ); writer.marshalDouble ("stat_p_mean" , stat_p_mean ); writer.marshalDouble ("stat_p_sdev" , stat_p_sdev ); writer.marshalDouble ("stat_p_like" , stat_p_like ); writer.marshalDouble ("stat_c_mean" , stat_c_mean ); writer.marshalDouble ("stat_c_sdev" , stat_c_sdev ); writer.marshalDouble ("stat_c_like" , stat_c_like ); return; } // Unmarshal object, internal. protected void do_umarshal (MarshalReader reader) { // Version int ver = reader.unmarshalInt (M_VERSION_NAME, MARSHAL_VER_1, MARSHAL_VER_1); // Contents b = reader.unmarshalDouble ("b" ); magMain = reader.unmarshalDouble ("magMain" ); min_a = reader.unmarshalDouble ("min_a" ); max_a = reader.unmarshalDouble ("max_a" ); delta_a = reader.unmarshalDouble ("delta_a" ); num_a = reader.unmarshalInt ("num_a" , 1); min_p = reader.unmarshalDouble ("min_p" ); max_p = reader.unmarshalDouble ("max_p" ); delta_p = reader.unmarshalDouble ("delta_p" ); num_p = reader.unmarshalInt ("num_p" , 1); min_c = reader.unmarshalDouble ("min_c" ); max_c = reader.unmarshalDouble ("max_c" ); delta_c = reader.unmarshalDouble ("delta_c" ); num_c = reader.unmarshalInt ("num_c" , 1); apc_total_size = reader.unmarshalInt ("apc_total_size" , 1); apc_support_size = reader.unmarshalInt ("apc_support_size" , 0); apc_support_total = reader.unmarshalDouble ("apc_support_total" ); apc_max_tail_element = reader.unmarshalDouble ("apc_max_tail_element"); a_support_lo = reader.unmarshalInt ("a_support_lo" , 0); a_support_hi = reader.unmarshalInt ("a_support_hi" , 0); p_support_lo = reader.unmarshalInt ("p_support_lo" , 0); p_support_hi = reader.unmarshalInt ("p_support_hi" , 0); c_support_lo = reader.unmarshalInt ("c_support_lo" , 0); c_support_hi = reader.unmarshalInt ("c_support_hi" , 0); stat_a_mean = reader.unmarshalDouble ("stat_a_mean" ); stat_a_sdev = reader.unmarshalDouble ("stat_a_sdev" ); stat_a_like = reader.unmarshalDouble ("stat_a_like" ); stat_p_mean = reader.unmarshalDouble ("stat_p_mean" ); stat_p_sdev = reader.unmarshalDouble ("stat_p_sdev" ); stat_p_like = reader.unmarshalDouble ("stat_p_like" ); stat_c_mean = reader.unmarshalDouble ("stat_c_mean" ); stat_c_sdev = reader.unmarshalDouble ("stat_c_sdev" ); stat_c_like = reader.unmarshalDouble ("stat_c_like" ); return; } // Marshal object. public void marshal (MarshalWriter writer, String name) { writer.marshalMapBegin (name); do_marshal (writer); writer.marshalMapEnd (); return; } // Unmarshal object. public RJ_Summary unmarshal (MarshalReader reader, String name) { reader.unmarshalMapBegin (name); do_umarshal (reader); reader.unmarshalMapEnd (); return this; } // Marshal object, polymorphic. public static void marshal_poly (MarshalWriter writer, String name, RJ_Summary obj) { writer.marshalMapBegin (name); if (obj == null) { writer.marshalInt (M_TYPE_NAME, MARSHAL_NULL); } else { writer.marshalInt (M_TYPE_NAME, obj.get_marshal_type()); obj.do_marshal (writer); } writer.marshalMapEnd (); return; } // Unmarshal object, polymorphic. public static RJ_Summary unmarshal_poly (MarshalReader reader, String name) { RJ_Summary result; reader.unmarshalMapBegin (name); // Switch according to type int type = reader.unmarshalInt (M_TYPE_NAME); switch (type) { default: throw new MarshalException ("RJ_Summary.unmarshal_poly: Unknown class type code: type = " + type); case MARSHAL_NULL: result = null; break; case MARSHAL_RJBASE: result = new RJ_Summary(); result.do_umarshal (reader); break; case MARSHAL_RJGEN: result = new RJ_Summary_Generic(); result.do_umarshal (reader); break; case MARSHAL_RJBAY: result = new RJ_Summary_Bayesian(); result.do_umarshal (reader); break; case MARSHAL_RJSEQ: result = new RJ_Summary_SequenceSpecific(); result.do_umarshal (reader); break; } reader.unmarshalMapEnd (); return result; } }
15,731
0.494183
0.491704
373
41.174263
28.397488
101
false
false
0
0
0
0
0
0
2.209115
false
false
13
091a9a57724c4dc2b5df0b7c33e8e4d0626edcd6
10,866,267,259,792
4dd4c24195d26552ddadc5733b54e8c715e9625a
/xprt-api/src/main/java/org/mfr/xprt/rest/controller/LanguageController.java
cc3195a58edc9ccda0d54cb33cac8f272d020062
[]
no_license
attilahogyai/bbsitter-srv
https://github.com/attilahogyai/bbsitter-srv
c81abf6120821f4532ae1069753ada4a283efb03
a5e229a70fe71de33e5648075f2ac57f1e3ff14d
refs/heads/master
2021-01-12T13:00:39.687000
2016-09-27T21:47:41
2016-09-27T21:47:41
69,401,134
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.mfr.xprt.rest.controller; import javax.servlet.http.HttpServletRequest; import org.mfr.data.XLanguage; import org.mfr.data.XProfession; import org.mfr.xprt.data.XLanguageDao; import org.mfr.xprt.data.XProfessionDao; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.fasterxml.jackson.databind.JsonNode; @Controller public class LanguageController extends AbstractBaseController<XLanguage> { protected final String NAME="language"; @Autowired private XLanguageDao xLanguageDao; @RequestMapping(value="/"+NAME,method = RequestMethod.GET) @ResponseBody public Object getAll(HttpServletRequest request){ return wrapPayload(NAME, xLanguageDao.findAll(XLanguage.class)); } @RequestMapping(value="/"+NAME+"/{langId}",method = RequestMethod.GET) @ResponseBody public Object get(@PathVariable Integer langId,HttpServletRequest request){ return wrapPayload(NAME, xLanguageDao.findByIdG(langId,XProfession.class)); } @RequestMapping(value="/"+NAME+"/{langId}",method = RequestMethod.PUT) @ResponseBody public Object updateEvents(@PathVariable Integer langId,@RequestBody JsonNode eventJson,Authentication authentication){ XLanguage source=this.extractFromJson(eventJson.get(NAME), XLanguage.class); XLanguage language=xLanguageDao.findById(langId,XLanguage.class); if(language==null){ return new ResponseEntity<String>("object not found",HttpStatus.NOT_FOUND); } BeanUtils.copyProperties(source, language,getIgnorePropertiesForPut()); xLanguageDao.merge(language); return wrapPayload(NAME, language); } @RequestMapping(value = "/" + NAME, method = RequestMethod.POST) @ResponseBody public Object create(Authentication authentication, @RequestBody JsonNode event) { XLanguage object=this.extractFromJson(event.get(NAME), XLanguage.class); xLanguageDao.persistG(object); return wrapPayload(NAME, object); } @Override protected Class getClazz() { return XProfession.class; } }
UTF-8
Java
2,513
java
LanguageController.java
Java
[]
null
[]
package org.mfr.xprt.rest.controller; import javax.servlet.http.HttpServletRequest; import org.mfr.data.XLanguage; import org.mfr.data.XProfession; import org.mfr.xprt.data.XLanguageDao; import org.mfr.xprt.data.XProfessionDao; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.fasterxml.jackson.databind.JsonNode; @Controller public class LanguageController extends AbstractBaseController<XLanguage> { protected final String NAME="language"; @Autowired private XLanguageDao xLanguageDao; @RequestMapping(value="/"+NAME,method = RequestMethod.GET) @ResponseBody public Object getAll(HttpServletRequest request){ return wrapPayload(NAME, xLanguageDao.findAll(XLanguage.class)); } @RequestMapping(value="/"+NAME+"/{langId}",method = RequestMethod.GET) @ResponseBody public Object get(@PathVariable Integer langId,HttpServletRequest request){ return wrapPayload(NAME, xLanguageDao.findByIdG(langId,XProfession.class)); } @RequestMapping(value="/"+NAME+"/{langId}",method = RequestMethod.PUT) @ResponseBody public Object updateEvents(@PathVariable Integer langId,@RequestBody JsonNode eventJson,Authentication authentication){ XLanguage source=this.extractFromJson(eventJson.get(NAME), XLanguage.class); XLanguage language=xLanguageDao.findById(langId,XLanguage.class); if(language==null){ return new ResponseEntity<String>("object not found",HttpStatus.NOT_FOUND); } BeanUtils.copyProperties(source, language,getIgnorePropertiesForPut()); xLanguageDao.merge(language); return wrapPayload(NAME, language); } @RequestMapping(value = "/" + NAME, method = RequestMethod.POST) @ResponseBody public Object create(Authentication authentication, @RequestBody JsonNode event) { XLanguage object=this.extractFromJson(event.get(NAME), XLanguage.class); xLanguageDao.persistG(object); return wrapPayload(NAME, object); } @Override protected Class getClazz() { return XProfession.class; } }
2,513
0.808595
0.808595
67
36.507462
28.938108
120
false
false
0
0
0
0
0
0
1.567164
false
false
13
553edc1a78eb62c6cccad667d48ee89761534cc7
18,562,848,692,713
812b8b9af0173feab01eef2cbe1a8407e120b54b
/src/main/java/org/omnaest/genomics/translator/domain/AminoAcidCode.java
777d8043565204a704b7705fe12183f1803c09c1
[ "Apache-2.0" ]
permissive
omnaest/NucleicAcidSequenceTranslation4J
https://github.com/omnaest/NucleicAcidSequenceTranslation4J
6b261f4c984f537e804107384c42bcda94d495ab
5176e6c2dc80942087b02e1cb2863ce176de1a93
refs/heads/master
2023-03-11T22:53:09.855000
2021-03-01T06:16:00
2021-03-01T06:16:00
111,240,435
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/******************************************************************************* * Copyright 2021 Danny Kunz * * 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. ******************************************************************************/ /* * Copyright 2017 Danny Kunz 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.omnaest.genomics.translator.domain; import java.util.ArrayList; import java.util.BitSet; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import java.util.function.Predicate; import org.omnaest.genomics.translator.utils.BitSetUtils; public enum AminoAcidCode implements Predicate<AminoAcidCode> { A("Alanine", 'A'), C("Cysteine", 'C'), D("Aspartic acid", 'D'), E("Glutamic acid", 'E'), F("Phenylalanine", 'F'), G("Glycine", 'G'), H("Histidine", 'H'), I("Isoleucine", 'I'), K("Lysine", 'K'), L("Leucine", 'L'), J("Leucine (L) or Isoleucine (I)", 'J', L.or(I)), M("Methionine", 'M'), N("Asparagine", 'N'), B("Aspartic acid (D) or Asparagine (N)", 'B', D.or(N)), O("Pyrrolysine", 'O'), P("Proline", 'P'), Q("Glutamine", 'Q'), R("Arginine", 'R'), S("Serine", 'S'), T("Threonine", 'T'), U("Selenocysteine", 'U'), V("Valine", 'V'), W("Tryptophan", 'W'), Y("Tyrosine", 'Y'), Z("Glutamic acid (E) or Glutamine (Q)", 'Z', E.or(Q)), STOP("Translation STOP", '*'), __("Gap of indeterminate length", '-'), X("any", 'X', STOP.negate() .and(__.negate())); private Predicate<AminoAcidCode> predicate; private Character code; private String name; private AminoAcidCode(String name, Character code) { this.name = name; this.code = code; } private AminoAcidCode(String name, Character code, Predicate<AminoAcidCode> predicate) { this.name = name; this.code = code; this.predicate = predicate; } public String getName() { return this.name; } @Override public boolean test(AminoAcidCode otherAminoAcid) { return Predicate.<AminoAcidCode>isEqual(this) .or(this.predicate) .test(otherAminoAcid); } /** * Returns the matching {@link AminoAcidCode} for the given code {@link Character}. <br> * <br> * If no matching {@link AminoAcidCode} is found, this returns null * * @param code * @return */ public static AminoAcidCode valueOf(Character code) { AminoAcidCode retval = null; for (AminoAcidCode aminoAcidCode : AminoAcidCode.values()) { if (aminoAcidCode.getCode() .equals(Character.toUpperCase(code))) { retval = aminoAcidCode; break; } } return retval; } public static AminoAcidCode valueOf(BitSet bitSet) { byte ordinal = BitSetUtils.toByte(bitSet); if (ordinal > values().length) { throw new RuntimeException("given bitset does not match any ordinal(max=" + (values().length - 1) + ") of an amino acid code; bits=" + BitSetUtils.toBinaryString(bitSet) + " = " + ordinal); } return AminoAcidCode.values()[ordinal]; } public static List<AminoAcidCode> valuesOf(BitSet bitSet) { List<AminoAcidCode> retvals = new ArrayList<>(); byte[] bytes = bitSet.toByteArray(); for (byte value : bytes) { AminoAcidCode aminoAcidCode = AminoAcidCode.valueOf(BitSetUtils.valueOf(value)); assert (aminoAcidCode != null); retvals.add(aminoAcidCode); } return retvals; } public Character getCode() { return this.code; } /** * Returns a further {@link Set} of all matching {@link AminoAcidCode}s including those which are non specific and do only exclude certain amino acids * * @param code * @return */ public Set<AminoAcidCode> expandedMatchingCodes() { Set<AminoAcidCode> retval = new LinkedHashSet<>(); for (AminoAcidCode aminoAcidCode : AminoAcidCode.values()) { if (aminoAcidCode.test(this)) { retval.add(aminoAcidCode); } } return retval; } public BitSet asBitSet() { return BitSetUtils.valueOf((byte) this.ordinal()); } public boolean isStart() { return AminoAcidCode.M.equals(this); } }
UTF-8
Java
5,625
java
AminoAcidCode.java
Java
[ { "context": "********************************\n * Copyright 2021 Danny Kunz\n * \n * Licensed under the Apache License, Version", "end": 109, "score": 0.9998297691345215, "start": 99, "tag": "NAME", "value": "Danny Kunz" }, { "context": "****************************/\n/*\n * Copyrig...
null
[]
/******************************************************************************* * Copyright 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. ******************************************************************************/ /* * Copyright 2017 <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 org.omnaest.genomics.translator.domain; import java.util.ArrayList; import java.util.BitSet; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import java.util.function.Predicate; import org.omnaest.genomics.translator.utils.BitSetUtils; public enum AminoAcidCode implements Predicate<AminoAcidCode> { A("Alanine", 'A'), C("Cysteine", 'C'), D("Aspartic acid", 'D'), E("Glutamic acid", 'E'), F("Phenylalanine", 'F'), G("Glycine", 'G'), H("Histidine", 'H'), I("Isoleucine", 'I'), K("Lysine", 'K'), L("Leucine", 'L'), J("Leucine (L) or Isoleucine (I)", 'J', L.or(I)), M("Methionine", 'M'), N("Asparagine", 'N'), B("Aspartic acid (D) or Asparagine (N)", 'B', D.or(N)), O("Pyrrolysine", 'O'), P("Proline", 'P'), Q("Glutamine", 'Q'), R("Arginine", 'R'), S("Serine", 'S'), T("Threonine", 'T'), U("Selenocysteine", 'U'), V("Valine", 'V'), W("Tryptophan", 'W'), Y("Tyrosine", 'Y'), Z("Glutamic acid (E) or Glutamine (Q)", 'Z', E.or(Q)), STOP("Translation STOP", '*'), __("Gap of indeterminate length", '-'), X("any", 'X', STOP.negate() .and(__.negate())); private Predicate<AminoAcidCode> predicate; private Character code; private String name; private AminoAcidCode(String name, Character code) { this.name = name; this.code = code; } private AminoAcidCode(String name, Character code, Predicate<AminoAcidCode> predicate) { this.name = name; this.code = code; this.predicate = predicate; } public String getName() { return this.name; } @Override public boolean test(AminoAcidCode otherAminoAcid) { return Predicate.<AminoAcidCode>isEqual(this) .or(this.predicate) .test(otherAminoAcid); } /** * Returns the matching {@link AminoAcidCode} for the given code {@link Character}. <br> * <br> * If no matching {@link AminoAcidCode} is found, this returns null * * @param code * @return */ public static AminoAcidCode valueOf(Character code) { AminoAcidCode retval = null; for (AminoAcidCode aminoAcidCode : AminoAcidCode.values()) { if (aminoAcidCode.getCode() .equals(Character.toUpperCase(code))) { retval = aminoAcidCode; break; } } return retval; } public static AminoAcidCode valueOf(BitSet bitSet) { byte ordinal = BitSetUtils.toByte(bitSet); if (ordinal > values().length) { throw new RuntimeException("given bitset does not match any ordinal(max=" + (values().length - 1) + ") of an amino acid code; bits=" + BitSetUtils.toBinaryString(bitSet) + " = " + ordinal); } return AminoAcidCode.values()[ordinal]; } public static List<AminoAcidCode> valuesOf(BitSet bitSet) { List<AminoAcidCode> retvals = new ArrayList<>(); byte[] bytes = bitSet.toByteArray(); for (byte value : bytes) { AminoAcidCode aminoAcidCode = AminoAcidCode.valueOf(BitSetUtils.valueOf(value)); assert (aminoAcidCode != null); retvals.add(aminoAcidCode); } return retvals; } public Character getCode() { return this.code; } /** * Returns a further {@link Set} of all matching {@link AminoAcidCode}s including those which are non specific and do only exclude certain amino acids * * @param code * @return */ public Set<AminoAcidCode> expandedMatchingCodes() { Set<AminoAcidCode> retval = new LinkedHashSet<>(); for (AminoAcidCode aminoAcidCode : AminoAcidCode.values()) { if (aminoAcidCode.test(this)) { retval.add(aminoAcidCode); } } return retval; } public BitSet asBitSet() { return BitSetUtils.valueOf((byte) this.ordinal()); } public boolean isStart() { return AminoAcidCode.M.equals(this); } }
5,617
0.586311
0.583289
178
30.601124
31.480392
157
false
false
0
0
0
0
0
0
0.629214
false
false
13
51ccccaa7f825fb249e9b077fc40842d2f4c976d
22,385,369,586,036
596d36a78c206f896a4a7247a064a934a262d41e
/src/main/java/aramframework/com/uss/olp/qim/service/impl/QustnrItemManageServiceImpl.java
1f8cf7ce59b26474ce3cdd050a3f729b59bae828
[ "Apache-2.0" ]
permissive
SkyDevCode/aramcomp
https://github.com/SkyDevCode/aramcomp
5042d9d01fe6103733f8ae3fdefb70af969527d5
090af4eeedbc50de91a204ee84b1cf781bcab6f5
refs/heads/master
2021-01-14T08:30:33.994000
2016-01-04T13:18:12
2016-01-04T13:18:12
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package aramframework.com.uss.olp.qim.service.impl; import java.util.List; import javax.annotation.Resource; import org.springframework.stereotype.Service; import aramframework.com.cmm.util.BeanUtil; import aramframework.com.uss.olp.qim.service.QustnrItemManageService; import aramframework.com.uss.olp.qim.service.QustnrItemManageVO; import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl; import egovframework.rte.fdl.cmmn.exception.FdlException; import egovframework.rte.fdl.idgnr.EgovIdGnrService; import egovframework.rte.psl.dataaccess.util.EgovMap; /** * 설문항목관리를 처리하는 ServiceImpl Class 구현 * * @author 아람컴포넌트 조헌철 * @since 2014.11.11 * @version 1.0 * @see * * <pre> * * << 개정이력(Modification Information) >> * * 수정일 수정자 수정내용 * ------- ------ --------------------------- * 2014.11.11 조헌철 최초 생성 * * </pre> */ @Service("qustnrItemManageService") public class QustnrItemManageServiceImpl extends EgovAbstractServiceImpl implements QustnrItemManageService { @Resource(name = "qustnrItemManageMapper") private QustnrItemManageMapper qustnrItemManageMapper; @Resource(name = "qustnrItemManageIdGnrService") private EgovIdGnrService idgenService; /** * 설문항목 목록을 조회한다. * * @param qustnrItemManageVO */ public List<EgovMap> selectQustnrItemManageList(QustnrItemManageVO qustnrItemManageVO) { return qustnrItemManageMapper.selectQustnrItemManageList(qustnrItemManageVO); } /** * 설문항목를(을) 목록 전체 건수를(을) 조회한다. * * @param qustnrItemManageVO */ public int selectQustnrItemManageListCnt(QustnrItemManageVO qustnrItemManageVO) { return (Integer) qustnrItemManageMapper.selectQustnrItemManageListCnt(qustnrItemManageVO); } /** * 설문항목를(을) 상세조회 한다. * * @param qustnrItemManageVO */ public QustnrItemManageVO selectQustnrItemManageDetail(QustnrItemManageVO qustnrItemManageVO) { QustnrItemManageVO resultVo = qustnrItemManageMapper.selectQustnrItemManageDetail(qustnrItemManageVO); // deep copy BeanUtil.copyPropertiesCore(resultVo, qustnrItemManageVO); return resultVo; } /** * 설문항목를(을) 등록한다. * * @param qustnrItemManageVO */ public void insertQustnrItemManage(QustnrItemManageVO qustnrItemManageVO) { try { qustnrItemManageVO.setQustnrIemId(idgenService.getNextStringId()); } catch (FdlException e) { throw new RuntimeException(e); } qustnrItemManageMapper.insertQustnrItemManage(qustnrItemManageVO); } /** * 설문항목를(을) 수정한다. * * @param qustnrItemManageVO */ public void updateQustnrItemManage(QustnrItemManageVO qustnrItemManageVO) { qustnrItemManageMapper.updateQustnrItemManage(qustnrItemManageVO); } /** * 설문항목를(을) 삭제한다. * * @param qustnrItemManageVO */ public void deleteQustnrItemManage(QustnrItemManageVO qustnrItemManageVO) { qustnrItemManageMapper.deleteQustnrRespondInfo(qustnrItemManageVO); qustnrItemManageMapper.deleteQustnrItemManage(qustnrItemManageVO); } }
UTF-8
Java
3,176
java
QustnrItemManageServiceImpl.java
Java
[ { "context": "* 설문항목관리를 처리하는 ServiceImpl Class 구현\n * \n * @author 아람컴포넌트 조헌철\n * @since 2014.11.11\n * @version 1.0\n * @see\n *\n ", "end": 630, "score": 0.9997130036354065, "start": 620, "tag": "NAME", "value": "아람컴포넌트 조헌철" }, { "context": "--- ---------------------------\n * ...
null
[]
package aramframework.com.uss.olp.qim.service.impl; import java.util.List; import javax.annotation.Resource; import org.springframework.stereotype.Service; import aramframework.com.cmm.util.BeanUtil; import aramframework.com.uss.olp.qim.service.QustnrItemManageService; import aramframework.com.uss.olp.qim.service.QustnrItemManageVO; import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl; import egovframework.rte.fdl.cmmn.exception.FdlException; import egovframework.rte.fdl.idgnr.EgovIdGnrService; import egovframework.rte.psl.dataaccess.util.EgovMap; /** * 설문항목관리를 처리하는 ServiceImpl Class 구현 * * @author <NAME> * @since 2014.11.11 * @version 1.0 * @see * * <pre> * * << 개정이력(Modification Information) >> * * 수정일 수정자 수정내용 * ------- ------ --------------------------- * 2014.11.11 조헌철 최초 생성 * * </pre> */ @Service("qustnrItemManageService") public class QustnrItemManageServiceImpl extends EgovAbstractServiceImpl implements QustnrItemManageService { @Resource(name = "qustnrItemManageMapper") private QustnrItemManageMapper qustnrItemManageMapper; @Resource(name = "qustnrItemManageIdGnrService") private EgovIdGnrService idgenService; /** * 설문항목 목록을 조회한다. * * @param qustnrItemManageVO */ public List<EgovMap> selectQustnrItemManageList(QustnrItemManageVO qustnrItemManageVO) { return qustnrItemManageMapper.selectQustnrItemManageList(qustnrItemManageVO); } /** * 설문항목를(을) 목록 전체 건수를(을) 조회한다. * * @param qustnrItemManageVO */ public int selectQustnrItemManageListCnt(QustnrItemManageVO qustnrItemManageVO) { return (Integer) qustnrItemManageMapper.selectQustnrItemManageListCnt(qustnrItemManageVO); } /** * 설문항목를(을) 상세조회 한다. * * @param qustnrItemManageVO */ public QustnrItemManageVO selectQustnrItemManageDetail(QustnrItemManageVO qustnrItemManageVO) { QustnrItemManageVO resultVo = qustnrItemManageMapper.selectQustnrItemManageDetail(qustnrItemManageVO); // deep copy BeanUtil.copyPropertiesCore(resultVo, qustnrItemManageVO); return resultVo; } /** * 설문항목를(을) 등록한다. * * @param qustnrItemManageVO */ public void insertQustnrItemManage(QustnrItemManageVO qustnrItemManageVO) { try { qustnrItemManageVO.setQustnrIemId(idgenService.getNextStringId()); } catch (FdlException e) { throw new RuntimeException(e); } qustnrItemManageMapper.insertQustnrItemManage(qustnrItemManageVO); } /** * 설문항목를(을) 수정한다. * * @param qustnrItemManageVO */ public void updateQustnrItemManage(QustnrItemManageVO qustnrItemManageVO) { qustnrItemManageMapper.updateQustnrItemManage(qustnrItemManageVO); } /** * 설문항목를(을) 삭제한다. * * @param qustnrItemManageVO */ public void deleteQustnrItemManage(QustnrItemManageVO qustnrItemManageVO) { qustnrItemManageMapper.deleteQustnrRespondInfo(qustnrItemManageVO); qustnrItemManageMapper.deleteQustnrItemManage(qustnrItemManageVO); } }
3,154
0.755427
0.749322
108
26.296297
28.911186
109
false
false
0
0
0
0
0
0
0.972222
false
false
13
8d6bf8c99d6661c821530abf57b361ede82fcf5d
19,387,482,414,248
9966b6c9c070fc74eb6e2822ec14099a6b9fa5a4
/app/src/main/java/com/example/emanuellemenali/mybeatboxwork/view/activity/BeatBoxActivity.java
fcd84ee3a2d7dc1f0212633edf20a9db525e2916
[]
no_license
cs-emanuelle-menali/workshop_android
https://github.com/cs-emanuelle-menali/workshop_android
df9da360af78ca45054324611e08613d7f7f2dc8
d759cca5d3e17ab3b6c6cbe1fbb2225a3b018818
refs/heads/master
2021-05-07T21:36:25.947000
2017-11-03T08:55:55
2017-11-03T08:55:55
109,033,513
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.emanuellemenali.mybeatboxwork.view.activity; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.AppCompatActivity; import com.example.emanuellemenali.mybeatboxwork.R; import com.example.emanuellemenali.mybeatboxwork.view.fragment.BeatBoxFragment; public class BeatBoxActivity extends SingleFragmentActivity { @Override protected Fragment createFragment() { return BeatBoxFragment.newInstance(); } }
UTF-8
Java
489
java
BeatBoxActivity.java
Java
[ { "context": "package com.example.emanuellemenali.mybeatboxwork.view.activity;\n\nimport android.os.B", "end": 35, "score": 0.9959937334060669, "start": 20, "tag": "USERNAME", "value": "emanuellemenali" }, { "context": "ort.v7.app.AppCompatActivity;\n\nimport com.example.emanuellemen...
null
[]
package com.example.emanuellemenali.mybeatboxwork.view.activity; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.AppCompatActivity; import com.example.emanuellemenali.mybeatboxwork.R; import com.example.emanuellemenali.mybeatboxwork.view.fragment.BeatBoxFragment; public class BeatBoxActivity extends SingleFragmentActivity { @Override protected Fragment createFragment() { return BeatBoxFragment.newInstance(); } }
489
0.807771
0.803681
17
27.764706
26.463137
79
false
false
0
0
0
0
0
0
0.411765
false
false
13
c53d097e4103a643a6f7064b931084165af882f8
16,690,242,963,219
ce584cede91ab9ad8b2db15f43274bdc003d75bc
/cs4735/sabinadev/assign2/src/RGBPixel.java
d50cc5ee75fdae822a25edef8f824bd866ab5637
[]
no_license
immaballerhaha/columbiaprivate
https://github.com/immaballerhaha/columbiaprivate
ab717d50f53a998784961683f19678d55c4e3cc0
fd216ee498a95cefb61b4dff837ffbe54bcaf9f8
refs/heads/master
2022-06-21T18:59:17.548000
2022-05-10T18:50:06
2022-05-10T18:50:06
262,224,541
0
0
null
true
2020-05-08T04:12:18
2020-05-08T04:12:17
2016-12-20T01:49:40
2015-05-11T17:11:24
98,952
0
0
0
null
false
false
public class RGBPixel { int redVal; int blueVal; int greenVal; public RGBPixel(int red, int blue, int green){ redVal = red; blueVal = blue; greenVal = green; } public void setRed(int red){ redVal = red; } public void setGreen(int green){ greenVal = green; } public void setBlue(int blue){ blueVal = blue; } public int getRed(){ return redVal; } public int getGreen(){ return greenVal; } public int getBlue(){ return blueVal; } }
UTF-8
Java
472
java
RGBPixel.java
Java
[]
null
[]
public class RGBPixel { int redVal; int blueVal; int greenVal; public RGBPixel(int red, int blue, int green){ redVal = red; blueVal = blue; greenVal = green; } public void setRed(int red){ redVal = red; } public void setGreen(int green){ greenVal = green; } public void setBlue(int blue){ blueVal = blue; } public int getRed(){ return redVal; } public int getGreen(){ return greenVal; } public int getBlue(){ return blueVal; } }
472
0.654661
0.654661
31
14.193548
11.405769
47
false
false
0
0
0
0
0
0
1.677419
false
false
13
375c697d1595ad3a26eb19b4fed7ef2065e04753
29,360,396,483,577
195b3c9beb4690a28d114036310d9ae48de2349d
/backend/naite-backend/src/main/java/com/ssafy/naite/domain/chat/ChatMessage.java
9752b4a2cafc7d501c75921eabed7b7cbc584b67
[]
no_license
judong93/Naite-Project
https://github.com/judong93/Naite-Project
dff96f1c6c15d4ca89c284b8393725ce1af52e52
9ec6a17b5697181a0db01b94095541d4df9885e1
refs/heads/main
2023-03-24T11:06:43.608000
2021-03-22T12:32:30
2021-03-22T12:32:30
350,330,624
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ssafy.naite.domain.chat; import com.ssafy.naite.domain.user.User; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import javax.persistence.*; import java.time.LocalDateTime; @Entity @Getter @Setter @NoArgsConstructor public class ChatMessage { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer messageNo; private String message; private LocalDateTime time; @ManyToOne @JoinColumn(name = "room_no") private ChatRoom chatRoom; @ManyToOne @JoinColumn(name = "user_no") private User user; @Builder public ChatMessage(String message, LocalDateTime time, ChatRoom chatRoom, User user) { this.message = message; this.time = time; this.chatRoom = chatRoom; this.user = user; } }
UTF-8
Java
853
java
ChatMessage.java
Java
[]
null
[]
package com.ssafy.naite.domain.chat; import com.ssafy.naite.domain.user.User; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import javax.persistence.*; import java.time.LocalDateTime; @Entity @Getter @Setter @NoArgsConstructor public class ChatMessage { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer messageNo; private String message; private LocalDateTime time; @ManyToOne @JoinColumn(name = "room_no") private ChatRoom chatRoom; @ManyToOne @JoinColumn(name = "user_no") private User user; @Builder public ChatMessage(String message, LocalDateTime time, ChatRoom chatRoom, User user) { this.message = message; this.time = time; this.chatRoom = chatRoom; this.user = user; } }
853
0.705744
0.705744
40
20.325001
17.879301
90
false
false
0
0
0
0
0
0
0.5
false
false
13
d12e58978c4cfd3821f81c58410f14e94b1d3a8b
7,292,854,514,695
1cecee12457b7f007954a759aeae7fa28831ae26
/src/InvertElements.java
551b2755ab35d192abc8083356fed0be6f8dca14
[]
no_license
reza9431/My-Training
https://github.com/reza9431/My-Training
b1a42f506ce7f47136127622c71e180c41fd45c0
3f9466acd95372ac672ac029d272219f864cd1a2
refs/heads/master
2022-02-26T00:38:11.421000
2019-10-28T15:23:30
2019-10-28T15:23:30
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; public class InvertElements { public static void main(String[] args) { int array[]; int tmp; int i, n; Scanner input = new Scanner(System.in); System.out.println("Now many Element"); n = input.nextInt(); array = new int[n]; for (i = 0; i < n; i++) { System.out.println("Enter Element"); array[i] = input.nextInt(); } for (i = 0; i < n; i++) { System.out.print("\t" + array[i]); } // Inversion Block System.out.println(""); for (i = 0; i < n / 2; i++) ; tmp = array[i]; array[i] = array[n - i - 1]; array[n - i - 1] = tmp; for (i = 0; i < n; i++) { System.out.print("\t" + array[i]); } } }
UTF-8
Java
836
java
InvertElements.java
Java
[]
null
[]
import java.util.Scanner; public class InvertElements { public static void main(String[] args) { int array[]; int tmp; int i, n; Scanner input = new Scanner(System.in); System.out.println("Now many Element"); n = input.nextInt(); array = new int[n]; for (i = 0; i < n; i++) { System.out.println("Enter Element"); array[i] = input.nextInt(); } for (i = 0; i < n; i++) { System.out.print("\t" + array[i]); } // Inversion Block System.out.println(""); for (i = 0; i < n / 2; i++) ; tmp = array[i]; array[i] = array[n - i - 1]; array[n - i - 1] = tmp; for (i = 0; i < n; i++) { System.out.print("\t" + array[i]); } } }
836
0.436603
0.42823
42
18.904762
17.321621
48
false
false
0
0
0
0
0
0
0.619048
false
false
13
284b5fb5ed9c50b87e4c7382b7c65bd60f541bce
22,926,535,478,403
053aef382729371544c191d54e23c35b1bde8246
/src/Soltech/Automation.java
841893ea401236609de060aa25fea47b59dcfc1e
[]
no_license
mjacob2017/TestingChallenge
https://github.com/mjacob2017/TestingChallenge
051d412cf35e43389b693ebe0c95ada6f10f4814
5c08b48e54cf2ac27c610922a62a1460fb4fb475
refs/heads/master
2020-12-03T00:39:48.883000
2017-07-03T01:30:58
2017-07-03T01:30:58
96,057,756
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Soltech; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class Automation { /** * @param args * @throws */ public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.chrome.driver","lib/chromedriver_win32/chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.manage().window().getSize().getHeight(); //New resolution driver.manage().window().setSize(new Dimension(1814,974)); driver.get("http://soltech.net/"); driver.manage().window().maximize(); driver.findElement(By.partialLinkText("MENU")).click(); Thread.sleep(5000); driver.findElement(By.linkText("Open Positions")).click(); Thread.sleep(5000); // Switch to new window for (String handle : driver.getWindowHandles()) { driver.switchTo().window(handle);} // Window scroll down JavascriptExecutor jse = (JavascriptExecutor)driver; jse.executeScript("window.scrollBy(0,600)", ""); Thread.sleep(5000); //Find job title and view job description driver.switchTo().frame(driver.findElement(By.cssSelector("iframe"))); driver.findElement(By.cssSelector("#jsb_f_keywords_i")).sendKeys("QA"); driver.findElement(By.cssSelector("#jsb_form_submit_i")).click(); driver.findElement(By.partialLinkText("Automation Engineer")).click(); // Check Job ID displayed System.out.println(driver.findElement(By.xpath("html/body/div[2]/div[2]/div[1]/div[1]/div/div/div/dl[1]/dd")).isDisplayed()); //Print job ID on console String s = driver.findElement(By.xpath("html/body/div[2]/div[2]/div[1]/div[1]/div/div/div/dl[1]/dd")).getText(); System.out.println(s); } }
UTF-8
Java
1,875
java
Automation.java
Java
[]
null
[]
package Soltech; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class Automation { /** * @param args * @throws */ public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.chrome.driver","lib/chromedriver_win32/chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.manage().window().getSize().getHeight(); //New resolution driver.manage().window().setSize(new Dimension(1814,974)); driver.get("http://soltech.net/"); driver.manage().window().maximize(); driver.findElement(By.partialLinkText("MENU")).click(); Thread.sleep(5000); driver.findElement(By.linkText("Open Positions")).click(); Thread.sleep(5000); // Switch to new window for (String handle : driver.getWindowHandles()) { driver.switchTo().window(handle);} // Window scroll down JavascriptExecutor jse = (JavascriptExecutor)driver; jse.executeScript("window.scrollBy(0,600)", ""); Thread.sleep(5000); //Find job title and view job description driver.switchTo().frame(driver.findElement(By.cssSelector("iframe"))); driver.findElement(By.cssSelector("#jsb_f_keywords_i")).sendKeys("QA"); driver.findElement(By.cssSelector("#jsb_form_submit_i")).click(); driver.findElement(By.partialLinkText("Automation Engineer")).click(); // Check Job ID displayed System.out.println(driver.findElement(By.xpath("html/body/div[2]/div[2]/div[1]/div[1]/div/div/div/dl[1]/dd")).isDisplayed()); //Print job ID on console String s = driver.findElement(By.xpath("html/body/div[2]/div[2]/div[1]/div[1]/div/div/div/dl[1]/dd")).getText(); System.out.println(s); } }
1,875
0.690667
0.672
59
30.779661
29.5205
128
false
false
0
0
0
0
0
0
2.508475
false
false
13
c14df167efd63870270c28e1040f5874b32fbd01
3,556,232,971,975
dee8dd425c94dcb64134e3290449acf9b2587a11
/src/main/java/com/playmusical/playmusicalweb/dto/UserDTO.java
fe2f3d870e9e2cc1a52d900d6c2b609226e22921
[]
no_license
heshAlgo/NHN-Basecamp-playmusical.web
https://github.com/heshAlgo/NHN-Basecamp-playmusical.web
e6a0c29e4d39ebe5bf328867ee3a852e8f8302c9
fcc241327f7a7b5b2f6df3cc3a526b79458537e1
refs/heads/main
2023-04-05T04:28:51.967000
2021-03-29T00:47:41
2021-03-29T00:47:41
352,473,834
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.playmusical.playmusicalweb.dto; import lombok.*; @Builder @NoArgsConstructor @AllArgsConstructor @Getter @Setter public class UserDTO { private String id; private String token; }
UTF-8
Java
204
java
UserDTO.java
Java
[]
null
[]
package com.playmusical.playmusicalweb.dto; import lombok.*; @Builder @NoArgsConstructor @AllArgsConstructor @Getter @Setter public class UserDTO { private String id; private String token; }
204
0.759804
0.759804
16
11.75
12.085632
43
false
false
0
0
0
0
0
0
0.25
false
false
13
14e8d1f9710926cca802a8a29dcd43d0de8adad5
31,104,153,205,524
262c9758912f5eddd2ea054a793bcd9ea196a385
/Java Game/src/main/Ball.java
6502840035ee00bb2d8b2a7017f4d4b381c4d4bb
[]
no_license
SunriseBolt/Java-Game-Example
https://github.com/SunriseBolt/Java-Game-Example
ae431452c8a57ae2a68d141302dc693aff0da435
3dd845c5fef63557293e1cb5ed4bd3ec090eb366
refs/heads/master
2021-05-08T19:36:45.566000
2018-01-31T19:27:39
2018-01-31T19:27:39
119,574,643
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package main; import java.awt.Color; import java.awt.Graphics2D; import java.awt.Rectangle; public class Ball { private static final int DIAMETER = 40; int x = 0, y = 0, xa = 1, ya = 1; private Window game; public Ball(Window game) { this.game = game; } void move() { boolean changeDirection = true; if (x + xa < 0) xa = game.speed; if(x + xa > game.getWidth() - DIAMETER) xa = -game.speed; if(y + ya < 0) ya = game.speed; if(y + ya > game.getHeight() - DIAMETER) game.gameOver(); if(collision()) { ya = -game.speed; y = game.racquet.getTopY() - DIAMETER; game.speed++; } else changeDirection = false; if(changeDirection) Sound.BALL.play(); x += xa; y += ya; } private boolean collision() { return game.racquet.getBounds().intersects(getBounds()); } public void paint(Graphics2D g) { g.setColor(Color.BLUE); g.fillOval(x, y, DIAMETER, DIAMETER); } public Rectangle getBounds() { return new Rectangle(x, y, DIAMETER, DIAMETER); } }
UTF-8
Java
1,015
java
Ball.java
Java
[]
null
[]
package main; import java.awt.Color; import java.awt.Graphics2D; import java.awt.Rectangle; public class Ball { private static final int DIAMETER = 40; int x = 0, y = 0, xa = 1, ya = 1; private Window game; public Ball(Window game) { this.game = game; } void move() { boolean changeDirection = true; if (x + xa < 0) xa = game.speed; if(x + xa > game.getWidth() - DIAMETER) xa = -game.speed; if(y + ya < 0) ya = game.speed; if(y + ya > game.getHeight() - DIAMETER) game.gameOver(); if(collision()) { ya = -game.speed; y = game.racquet.getTopY() - DIAMETER; game.speed++; } else changeDirection = false; if(changeDirection) Sound.BALL.play(); x += xa; y += ya; } private boolean collision() { return game.racquet.getBounds().intersects(getBounds()); } public void paint(Graphics2D g) { g.setColor(Color.BLUE); g.fillOval(x, y, DIAMETER, DIAMETER); } public Rectangle getBounds() { return new Rectangle(x, y, DIAMETER, DIAMETER); } }
1,015
0.631527
0.621675
50
19.299999
14.550945
58
false
false
0
0
0
0
0
0
2.18
false
false
13
4508a6991cfe4100c8df3be27e81dc13e665a822
32,633,161,567,858
166d4e1d0c269fded87585480d39499e3b850c69
/src/main/java/com/github/loutai/xia/service/MenuService.java
e99d7c281695831c355d6492062d4346cb297c29
[ "BSD-3-Clause" ]
permissive
ltyyz/xia
https://github.com/ltyyz/xia
3d892de25029e3a42457f6bb79df17c5403a2ff7
dc243272272006e869d84b23f8e99f03f18f3a56
refs/heads/master
2020-04-07T16:46:32.735000
2018-11-21T15:32:09
2018-11-21T15:32:09
158,542,466
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.github.loutai.xia.service; import com.github.loutai.xia.common.Constant; import com.github.loutai.xia.common.ServiceResult; import com.github.loutai.xia.entity.XiaMenu; import com.github.loutai.xia.repository.XiaMenuRepository; import com.github.loutai.xia.security.SecurityContextUtil; import org.springframework.data.domain.*; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; import javax.annotation.Resource; import java.util.Date; @Service public class MenuService { @Resource private XiaMenuRepository menuRepository; @Resource private SecurityContextUtil securityContextUtil; public ServiceResult listByAppId(Integer appId) { return ServiceResult.ofSuccess(menuRepository.findByAppIdAndDeletedOrderBySorts(appId, Constant.DELETE_N)); } public Page<XiaMenu> queryPage(int page, int rows, Integer appId, String parentId) { Pageable pageable = PageRequest.of(page - 1, rows, new Sort(Sort.DEFAULT_DIRECTION, "sorts")); XiaMenu entity = new XiaMenu(); entity.setDeleted(Constant.DELETE_N); ExampleMatcher exampleMatcher = ExampleMatcher.matching().withIgnorePaths("id") .withMatcher("deleted", ExampleMatcher.GenericPropertyMatchers.exact()); if (!StringUtils.isEmpty(parentId)) { entity.setParentId(Integer.parseInt(parentId)); exampleMatcher.withMatcher("parentId", ExampleMatcher.GenericPropertyMatchers.exact()); } if (appId != null && appId != 0) { entity.setAppId(appId); exampleMatcher.withMatcher("appId", ExampleMatcher.GenericPropertyMatchers.exact()); } Example<XiaMenu> example = Example.of(entity, exampleMatcher); return menuRepository.findAll(example, pageable); } public ServiceResult add(XiaMenu entity) { entity.setDeleted(Constant.DELETE_N); entity.setCreateDate(new Date()); entity.setCreateBy(securityContextUtil.getCurrentUser().getId()); entity.setChildren(0); menuRepository.saveAndFlush(entity); if (entity.getParentId() != null) { updateChildren(entity.getParentId()); } return ServiceResult.ofSuccess(); } public ServiceResult update(XiaMenu entity) { XiaMenu _entity = menuRepository.getOne(entity.getId()); Integer oldParentId = _entity.getParentId(); Integer newParentId = entity.getParentId(); _entity.setName(entity.getName()); _entity.setAppId(entity.getAppId()); _entity.setUpdateDate(new Date()); _entity.setType(entity.getType()); _entity.setUrl(entity.getUrl()); _entity.setIcon(entity.getIcon()); _entity.setSorts(entity.getSorts()); _entity.setUpdateBy(securityContextUtil.getCurrentUser().getId()); _entity.setParentId(newParentId); menuRepository.saveAndFlush(_entity); if (newParentId != oldParentId) { updateChildren(newParentId); updateChildren(oldParentId); } return ServiceResult.ofSuccess(); } public ServiceResult delete(Integer id) { XiaMenu _entity = menuRepository.getOne(id); _entity.setDeleted(Constant.DELETE_Y); menuRepository.saveAndFlush(_entity); updateChildren(_entity.getParentId()); return ServiceResult.ofSuccess(); } private void updateChildren(Integer id) { if (id != null) { Long children = menuRepository.countByParentIdAndDeleted(id, Constant.DELETE_N); XiaMenu menu = menuRepository.getOne(id); menu.setChildren(children.intValue()); menuRepository.saveAndFlush(menu); } } }
UTF-8
Java
3,768
java
MenuService.java
Java
[ { "context": "com.github.loutai.xia.service;\n\nimport com.github.loutai.xia.common.Constant;\nimport com.github.loutai.xia", "end": 64, "score": 0.6795988082885742, "start": 58, "tag": "USERNAME", "value": "loutai" }, { "context": "hub.loutai.xia.common.Constant;\nimport com.github....
null
[]
package com.github.loutai.xia.service; import com.github.loutai.xia.common.Constant; import com.github.loutai.xia.common.ServiceResult; import com.github.loutai.xia.entity.XiaMenu; import com.github.loutai.xia.repository.XiaMenuRepository; import com.github.loutai.xia.security.SecurityContextUtil; import org.springframework.data.domain.*; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; import javax.annotation.Resource; import java.util.Date; @Service public class MenuService { @Resource private XiaMenuRepository menuRepository; @Resource private SecurityContextUtil securityContextUtil; public ServiceResult listByAppId(Integer appId) { return ServiceResult.ofSuccess(menuRepository.findByAppIdAndDeletedOrderBySorts(appId, Constant.DELETE_N)); } public Page<XiaMenu> queryPage(int page, int rows, Integer appId, String parentId) { Pageable pageable = PageRequest.of(page - 1, rows, new Sort(Sort.DEFAULT_DIRECTION, "sorts")); XiaMenu entity = new XiaMenu(); entity.setDeleted(Constant.DELETE_N); ExampleMatcher exampleMatcher = ExampleMatcher.matching().withIgnorePaths("id") .withMatcher("deleted", ExampleMatcher.GenericPropertyMatchers.exact()); if (!StringUtils.isEmpty(parentId)) { entity.setParentId(Integer.parseInt(parentId)); exampleMatcher.withMatcher("parentId", ExampleMatcher.GenericPropertyMatchers.exact()); } if (appId != null && appId != 0) { entity.setAppId(appId); exampleMatcher.withMatcher("appId", ExampleMatcher.GenericPropertyMatchers.exact()); } Example<XiaMenu> example = Example.of(entity, exampleMatcher); return menuRepository.findAll(example, pageable); } public ServiceResult add(XiaMenu entity) { entity.setDeleted(Constant.DELETE_N); entity.setCreateDate(new Date()); entity.setCreateBy(securityContextUtil.getCurrentUser().getId()); entity.setChildren(0); menuRepository.saveAndFlush(entity); if (entity.getParentId() != null) { updateChildren(entity.getParentId()); } return ServiceResult.ofSuccess(); } public ServiceResult update(XiaMenu entity) { XiaMenu _entity = menuRepository.getOne(entity.getId()); Integer oldParentId = _entity.getParentId(); Integer newParentId = entity.getParentId(); _entity.setName(entity.getName()); _entity.setAppId(entity.getAppId()); _entity.setUpdateDate(new Date()); _entity.setType(entity.getType()); _entity.setUrl(entity.getUrl()); _entity.setIcon(entity.getIcon()); _entity.setSorts(entity.getSorts()); _entity.setUpdateBy(securityContextUtil.getCurrentUser().getId()); _entity.setParentId(newParentId); menuRepository.saveAndFlush(_entity); if (newParentId != oldParentId) { updateChildren(newParentId); updateChildren(oldParentId); } return ServiceResult.ofSuccess(); } public ServiceResult delete(Integer id) { XiaMenu _entity = menuRepository.getOne(id); _entity.setDeleted(Constant.DELETE_Y); menuRepository.saveAndFlush(_entity); updateChildren(_entity.getParentId()); return ServiceResult.ofSuccess(); } private void updateChildren(Integer id) { if (id != null) { Long children = menuRepository.countByParentIdAndDeleted(id, Constant.DELETE_N); XiaMenu menu = menuRepository.getOne(id); menu.setChildren(children.intValue()); menuRepository.saveAndFlush(menu); } } }
3,768
0.680732
0.679936
104
35.23077
27.581429
115
false
false
0
0
0
0
0
0
0.663462
false
false
13
3ad9a6b5e319e0e949fda962db086e2a873142ce
32,633,161,567,673
6546b8da3ae1eb029093aef589088c16eb8d5a77
/src/thread/RunnableTest01.java
c76c30e79155484528b2e3f7bf2177dd700584a2
[]
no_license
xiongyi1994/java_learning
https://github.com/xiongyi1994/java_learning
766e88507a3df21b17f016d9473c3d346173880b
06341bd1779db7d923b5e3744e9cdd467a495701
refs/heads/master
2021-07-15T00:20:46.872000
2021-07-07T02:43:39
2021-07-07T02:43:39
89,570,492
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package thread; public class RunnableTest01 { /* * 测试操作符 ++ 是不是线程安全的 * * 结论 ++ 不是线程安全的 * */ static class Test implements Runnable { int a =0; @Override public void run() { ++a; System.out.println(a); } } public static void main(String[] args) { Test m1 = new Test(); Test m2 = new Test(); Thread t1 = new Thread(m1); Thread t2 = new Thread(m2); t1.start(); t2.start(); } }
UTF-8
Java
562
java
RunnableTest01.java
Java
[]
null
[]
package thread; public class RunnableTest01 { /* * 测试操作符 ++ 是不是线程安全的 * * 结论 ++ 不是线程安全的 * */ static class Test implements Runnable { int a =0; @Override public void run() { ++a; System.out.println(a); } } public static void main(String[] args) { Test m1 = new Test(); Test m2 = new Test(); Thread t1 = new Thread(m1); Thread t2 = new Thread(m2); t1.start(); t2.start(); } }
562
0.472973
0.451737
29
16.862068
13.551242
44
false
false
0
0
0
0
0
0
0.344828
false
false
13
b6b1e9d92f98e8b23038c76b5b4437ef685e6499
9,491,877,728,882
4b0bf4787e89bcae7e4759bde6d7f3ab2c81f849
/aliyun-java-sdk-alidns/src/main/java/com/aliyuncs/alidns/model/v20150109/DescribeDnsGtmInstanceResponse.java
df187c58e0ea2807f060197c6b589e375f1bb0ff
[ "Apache-2.0" ]
permissive
aliyun/aliyun-openapi-java-sdk
https://github.com/aliyun/aliyun-openapi-java-sdk
a263fa08e261f12d45586d1b3ad8a6609bba0e91
e19239808ad2298d32dda77db29a6d809e4f7add
refs/heads/master
2023-09-03T12:28:09.765000
2023-09-01T09:03:00
2023-09-01T09:03:00
39,555,898
1,542
1,317
NOASSERTION
false
2023-09-14T07:27:05
2015-07-23T08:41:13
2023-08-31T07:30:44
2023-09-14T07:27:03
72,323
1,375
1,144
12
Java
false
false
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.aliyuncs.alidns.model.v20150109; import java.util.List; import com.aliyuncs.AcsResponse; import com.aliyuncs.alidns.transform.v20150109.DescribeDnsGtmInstanceResponseUnmarshaller; import com.aliyuncs.transform.UnmarshallerContext; /** * @author auto create * @version */ public class DescribeDnsGtmInstanceResponse extends AcsResponse { private Long expireTimestamp; private String requestId; private String resourceGroupId; private String instanceId; private Integer taskQuota; private String createTime; private Integer smsQuota; private String versionCode; private String paymentType; private String expireTime; private Long createTimestamp; private Config config; private UsedQuota usedQuota; public Long getExpireTimestamp() { return this.expireTimestamp; } public void setExpireTimestamp(Long expireTimestamp) { this.expireTimestamp = expireTimestamp; } public String getRequestId() { return this.requestId; } public void setRequestId(String requestId) { this.requestId = requestId; } public String getResourceGroupId() { return this.resourceGroupId; } public void setResourceGroupId(String resourceGroupId) { this.resourceGroupId = resourceGroupId; } public String getInstanceId() { return this.instanceId; } public void setInstanceId(String instanceId) { this.instanceId = instanceId; } public Integer getTaskQuota() { return this.taskQuota; } public void setTaskQuota(Integer taskQuota) { this.taskQuota = taskQuota; } public String getCreateTime() { return this.createTime; } public void setCreateTime(String createTime) { this.createTime = createTime; } public Integer getSmsQuota() { return this.smsQuota; } public void setSmsQuota(Integer smsQuota) { this.smsQuota = smsQuota; } public String getVersionCode() { return this.versionCode; } public void setVersionCode(String versionCode) { this.versionCode = versionCode; } public String getPaymentType() { return this.paymentType; } public void setPaymentType(String paymentType) { this.paymentType = paymentType; } public String getExpireTime() { return this.expireTime; } public void setExpireTime(String expireTime) { this.expireTime = expireTime; } public Long getCreateTimestamp() { return this.createTimestamp; } public void setCreateTimestamp(Long createTimestamp) { this.createTimestamp = createTimestamp; } public Config getConfig() { return this.config; } public void setConfig(Config config) { this.config = config; } public UsedQuota getUsedQuota() { return this.usedQuota; } public void setUsedQuota(UsedQuota usedQuota) { this.usedQuota = usedQuota; } public static class Config { private Integer ttl; private String alertGroup; private String cnameType; private String strategyMode; private String instanceName; private String publicCnameMode; private String publicUserDomainName; private String pubicZoneName; private String publicRr; private List<AlertConfigItem> alertConfig; public Integer getTtl() { return this.ttl; } public void setTtl(Integer ttl) { this.ttl = ttl; } public String getAlertGroup() { return this.alertGroup; } public void setAlertGroup(String alertGroup) { this.alertGroup = alertGroup; } public String getCnameType() { return this.cnameType; } public void setCnameType(String cnameType) { this.cnameType = cnameType; } public String getStrategyMode() { return this.strategyMode; } public void setStrategyMode(String strategyMode) { this.strategyMode = strategyMode; } public String getInstanceName() { return this.instanceName; } public void setInstanceName(String instanceName) { this.instanceName = instanceName; } public String getPublicCnameMode() { return this.publicCnameMode; } public void setPublicCnameMode(String publicCnameMode) { this.publicCnameMode = publicCnameMode; } public String getPublicUserDomainName() { return this.publicUserDomainName; } public void setPublicUserDomainName(String publicUserDomainName) { this.publicUserDomainName = publicUserDomainName; } public String getPubicZoneName() { return this.pubicZoneName; } public void setPubicZoneName(String pubicZoneName) { this.pubicZoneName = pubicZoneName; } public String getPublicRr() { return this.publicRr; } public void setPublicRr(String publicRr) { this.publicRr = publicRr; } public List<AlertConfigItem> getAlertConfig() { return this.alertConfig; } public void setAlertConfig(List<AlertConfigItem> alertConfig) { this.alertConfig = alertConfig; } public static class AlertConfigItem { private Boolean smsNotice; private String noticeType; private Boolean emailNotice; private Boolean dingtalkNotice; public Boolean getSmsNotice() { return this.smsNotice; } public void setSmsNotice(Boolean smsNotice) { this.smsNotice = smsNotice; } public String getNoticeType() { return this.noticeType; } public void setNoticeType(String noticeType) { this.noticeType = noticeType; } public Boolean getEmailNotice() { return this.emailNotice; } public void setEmailNotice(Boolean emailNotice) { this.emailNotice = emailNotice; } public Boolean getDingtalkNotice() { return this.dingtalkNotice; } public void setDingtalkNotice(Boolean dingtalkNotice) { this.dingtalkNotice = dingtalkNotice; } } } public static class UsedQuota { private Integer emailUsedCount; private Integer taskUsedCount; private Integer smsUsedCount; private Integer dingtalkUsedCount; public Integer getEmailUsedCount() { return this.emailUsedCount; } public void setEmailUsedCount(Integer emailUsedCount) { this.emailUsedCount = emailUsedCount; } public Integer getTaskUsedCount() { return this.taskUsedCount; } public void setTaskUsedCount(Integer taskUsedCount) { this.taskUsedCount = taskUsedCount; } public Integer getSmsUsedCount() { return this.smsUsedCount; } public void setSmsUsedCount(Integer smsUsedCount) { this.smsUsedCount = smsUsedCount; } public Integer getDingtalkUsedCount() { return this.dingtalkUsedCount; } public void setDingtalkUsedCount(Integer dingtalkUsedCount) { this.dingtalkUsedCount = dingtalkUsedCount; } } @Override public DescribeDnsGtmInstanceResponse getInstance(UnmarshallerContext context) { return DescribeDnsGtmInstanceResponseUnmarshaller.unmarshall(this, context); } }
UTF-8
Java
7,503
java
DescribeDnsGtmInstanceResponse.java
Java
[]
null
[]
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.aliyuncs.alidns.model.v20150109; import java.util.List; import com.aliyuncs.AcsResponse; import com.aliyuncs.alidns.transform.v20150109.DescribeDnsGtmInstanceResponseUnmarshaller; import com.aliyuncs.transform.UnmarshallerContext; /** * @author auto create * @version */ public class DescribeDnsGtmInstanceResponse extends AcsResponse { private Long expireTimestamp; private String requestId; private String resourceGroupId; private String instanceId; private Integer taskQuota; private String createTime; private Integer smsQuota; private String versionCode; private String paymentType; private String expireTime; private Long createTimestamp; private Config config; private UsedQuota usedQuota; public Long getExpireTimestamp() { return this.expireTimestamp; } public void setExpireTimestamp(Long expireTimestamp) { this.expireTimestamp = expireTimestamp; } public String getRequestId() { return this.requestId; } public void setRequestId(String requestId) { this.requestId = requestId; } public String getResourceGroupId() { return this.resourceGroupId; } public void setResourceGroupId(String resourceGroupId) { this.resourceGroupId = resourceGroupId; } public String getInstanceId() { return this.instanceId; } public void setInstanceId(String instanceId) { this.instanceId = instanceId; } public Integer getTaskQuota() { return this.taskQuota; } public void setTaskQuota(Integer taskQuota) { this.taskQuota = taskQuota; } public String getCreateTime() { return this.createTime; } public void setCreateTime(String createTime) { this.createTime = createTime; } public Integer getSmsQuota() { return this.smsQuota; } public void setSmsQuota(Integer smsQuota) { this.smsQuota = smsQuota; } public String getVersionCode() { return this.versionCode; } public void setVersionCode(String versionCode) { this.versionCode = versionCode; } public String getPaymentType() { return this.paymentType; } public void setPaymentType(String paymentType) { this.paymentType = paymentType; } public String getExpireTime() { return this.expireTime; } public void setExpireTime(String expireTime) { this.expireTime = expireTime; } public Long getCreateTimestamp() { return this.createTimestamp; } public void setCreateTimestamp(Long createTimestamp) { this.createTimestamp = createTimestamp; } public Config getConfig() { return this.config; } public void setConfig(Config config) { this.config = config; } public UsedQuota getUsedQuota() { return this.usedQuota; } public void setUsedQuota(UsedQuota usedQuota) { this.usedQuota = usedQuota; } public static class Config { private Integer ttl; private String alertGroup; private String cnameType; private String strategyMode; private String instanceName; private String publicCnameMode; private String publicUserDomainName; private String pubicZoneName; private String publicRr; private List<AlertConfigItem> alertConfig; public Integer getTtl() { return this.ttl; } public void setTtl(Integer ttl) { this.ttl = ttl; } public String getAlertGroup() { return this.alertGroup; } public void setAlertGroup(String alertGroup) { this.alertGroup = alertGroup; } public String getCnameType() { return this.cnameType; } public void setCnameType(String cnameType) { this.cnameType = cnameType; } public String getStrategyMode() { return this.strategyMode; } public void setStrategyMode(String strategyMode) { this.strategyMode = strategyMode; } public String getInstanceName() { return this.instanceName; } public void setInstanceName(String instanceName) { this.instanceName = instanceName; } public String getPublicCnameMode() { return this.publicCnameMode; } public void setPublicCnameMode(String publicCnameMode) { this.publicCnameMode = publicCnameMode; } public String getPublicUserDomainName() { return this.publicUserDomainName; } public void setPublicUserDomainName(String publicUserDomainName) { this.publicUserDomainName = publicUserDomainName; } public String getPubicZoneName() { return this.pubicZoneName; } public void setPubicZoneName(String pubicZoneName) { this.pubicZoneName = pubicZoneName; } public String getPublicRr() { return this.publicRr; } public void setPublicRr(String publicRr) { this.publicRr = publicRr; } public List<AlertConfigItem> getAlertConfig() { return this.alertConfig; } public void setAlertConfig(List<AlertConfigItem> alertConfig) { this.alertConfig = alertConfig; } public static class AlertConfigItem { private Boolean smsNotice; private String noticeType; private Boolean emailNotice; private Boolean dingtalkNotice; public Boolean getSmsNotice() { return this.smsNotice; } public void setSmsNotice(Boolean smsNotice) { this.smsNotice = smsNotice; } public String getNoticeType() { return this.noticeType; } public void setNoticeType(String noticeType) { this.noticeType = noticeType; } public Boolean getEmailNotice() { return this.emailNotice; } public void setEmailNotice(Boolean emailNotice) { this.emailNotice = emailNotice; } public Boolean getDingtalkNotice() { return this.dingtalkNotice; } public void setDingtalkNotice(Boolean dingtalkNotice) { this.dingtalkNotice = dingtalkNotice; } } } public static class UsedQuota { private Integer emailUsedCount; private Integer taskUsedCount; private Integer smsUsedCount; private Integer dingtalkUsedCount; public Integer getEmailUsedCount() { return this.emailUsedCount; } public void setEmailUsedCount(Integer emailUsedCount) { this.emailUsedCount = emailUsedCount; } public Integer getTaskUsedCount() { return this.taskUsedCount; } public void setTaskUsedCount(Integer taskUsedCount) { this.taskUsedCount = taskUsedCount; } public Integer getSmsUsedCount() { return this.smsUsedCount; } public void setSmsUsedCount(Integer smsUsedCount) { this.smsUsedCount = smsUsedCount; } public Integer getDingtalkUsedCount() { return this.dingtalkUsedCount; } public void setDingtalkUsedCount(Integer dingtalkUsedCount) { this.dingtalkUsedCount = dingtalkUsedCount; } } @Override public DescribeDnsGtmInstanceResponse getInstance(UnmarshallerContext context) { return DescribeDnsGtmInstanceResponseUnmarshaller.unmarshall(this, context); } }
7,503
0.713715
0.711049
351
19.447294
20.422934
90
false
false
0
0
0
0
0
0
1.57265
false
false
13
6db2f7ef60ac503fcbc1ae2db722a7098fb5b7eb
25,735,444,086,997
2be0eb942e7b9f66001f2484222a1c5d51095ce7
/com.kanopus.workflow.facadeservices/src/main/java/com/kanopus/workflow/encrypt/utilities/EncryptResolverDataSource.java
2d5cb915b356afbdb6d944fe658f45041554f64c
[]
no_license
AHariharan/OpenSourceWorkflow
https://github.com/AHariharan/OpenSourceWorkflow
55dfa2087cfd8b8687db0bed2f5a77c634266120
0d2ac32752f51027623ef364988c562b69ed9bd5
refs/heads/master
2021-01-17T23:36:17.277000
2015-09-08T09:05:41
2015-09-08T09:05:41
39,222,566
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kanopus.workflow.encrypt.utilities; import org.jasypt.util.text.BasicTextEncryptor; import org.apache.commons.dbcp2.BasicDataSource; public class EncryptResolverDataSource extends BasicDataSource{ @Override public void setPassword(String password) { BasicTextEncryptor textEncryptor = new BasicTextEncryptor(); textEncryptor.setPassword("wf@mpw"); String result = textEncryptor.decrypt(password); super.setPassword(result); } }
UTF-8
Java
456
java
EncryptResolverDataSource.java
Java
[ { "context": "asicTextEncryptor();\n\t\ttextEncryptor.setPassword(\"wf@mpw\");\n\t\tString result = textEncryptor.decrypt(passwo", "end": 366, "score": 0.999447226524353, "start": 360, "tag": "PASSWORD", "value": "wf@mpw" } ]
null
[]
package com.kanopus.workflow.encrypt.utilities; import org.jasypt.util.text.BasicTextEncryptor; import org.apache.commons.dbcp2.BasicDataSource; public class EncryptResolverDataSource extends BasicDataSource{ @Override public void setPassword(String password) { BasicTextEncryptor textEncryptor = new BasicTextEncryptor(); textEncryptor.setPassword("<PASSWORD>"); String result = textEncryptor.decrypt(password); super.setPassword(result); } }
460
0.807018
0.804825
16
27.5
23.872055
63
false
false
0
0
0
0
0
0
1.1875
false
false
13
24db74248e2588751fb195c6fd1104d799b33e2b
11,467,562,680,849
8cde2582e22bb65bad98b3af1c4e806a1b910ce5
/Rohini-Learners/src/cmjdproject/learner/view/manager/internels/ClearRecords.java
1a79b5364d8533b14258ab0b207dbb78ebbee777
[]
no_license
oshanz/rohini-learners
https://github.com/oshanz/rohini-learners
b2d2f25fbd186b6ac10a67b7fda3e6e926614f7b
edf534a11f3cea1373cee275b80ba667ab2aad4e
refs/heads/master
2021-01-10T06:01:30.028000
2013-09-27T15:57:46
2013-09-27T15:57:46
43,924,243
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package cmjdproject.learner.view.manager.internels; import cmjdproject.learner.controller.RegisterController; import cmjdproject.learner.models.CandidateMod; import cmjdproject.learner.other.FormatedDate; import java.io.FileNotFoundException; import java.io.IOException; import java.sql.Date; import java.sql.SQLException; import java.util.ArrayList; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; import org.joda.time.DateTimeComparator; /** * * @author oshanz */ public class ClearRecords extends javax.swing.JInternalFrame { /** * Creates new form ClearRecords */ private DefaultTableModel dtm; public ClearRecords() { initComponents(); // SearchViaCombo searchViaCombo = new SearchViaCombo(); // searchViaCombo.setResultViaCombo(jComboBox1, true, ""); // // SwingSorter swingSorter = new SwingSorter(); // swingSorter.sortComboBox(jComboBox1); // new AutoCompletion(jComboBox1); // new JComboBoxAutoCompletador(jComboBox1); dtm = (DefaultTableModel) jTable1.getModel(); loadexpires(); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jButton2 = new javax.swing.JButton(); jButton1 = new javax.swing.JButton(); setClosable(true); setMaximizable(true); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Expired Registrations")); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Name", "NIC" } ) { boolean[] canEdit = new boolean [] { false, false }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); jScrollPane1.setViewportView(jTable1); jButton2.setText("Clear All"); jButton1.setText("Load"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 463, Short.MAX_VALUE) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 373, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton2) .addComponent(jButton1)) .addContainerGap(14, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: loadexpires(); }//GEN-LAST:event_jButton1ActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JPanel jPanel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable jTable1; // End of variables declaration//GEN-END:variables public boolean loadexpires() { boolean exists = false; ArrayList<String> arrayList = new ArrayList<String>(); try { ArrayList<String> regdate = new RegisterController().getregdate(); for (String rdate : regdate) { String[] split = rdate.split("-\\s*"); String b = (Integer.parseInt(split[2]) + 1) + "-" + (Integer.parseInt(split[1]) + 6) + "-" + split[0]; Date valueOf = Date.valueOf(b); Date valueOf1 = Date.valueOf(new FormatedDate().getDate("yyyy-MM-dd")); int compare = DateTimeComparator.getInstance().compare(valueOf1, valueOf); if (compare >= 0) {//valuof < valuof1 /////// valueof is old ////clean //System.out.println("win " + valueOf + " " + valueOf1); arrayList.add(rdate); //System.out.println("win " + valueOf + " " + valueOf1); exists = true; } else { // System.out.println("hik " + valueOf + " " + valueOf1); } } ArrayList<CandidateMod> nidfromdate = RegisterController.getnidfromdate(arrayList); for (CandidateMod candidateMod : nidfromdate) { // System.out.println(candidateMod.getNid() + " " + candidateMod.getName()); if (dtm.getRowCount() == 0) { dtm.addRow(new String[]{candidateMod.getNid(), candidateMod.getName()}); } else { for (int i = 0; i < dtm.getRowCount(); i++) { String valueAt = (String) dtm.getValueAt(i, 0); // System.out.println(valueAt); if (valueAt.equalsIgnoreCase(candidateMod.getNid())) { break; } if (i == dtm.getRowCount() - 1) { dtm.addRow(new String[]{candidateMod.getNid(), candidateMod.getName()}); break; } } } } } catch (ClassNotFoundException ex) { JOptionPane.showConfirmDialog(null, "Error at : " + ex.getMessage()); } catch (FileNotFoundException ex) { JOptionPane.showConfirmDialog(null, "Error at : " + ex.getMessage()); } catch (SQLException ex) { JOptionPane.showConfirmDialog(null, "Error at : " + ex.getMessage()); } catch (IOException ex) { JOptionPane.showConfirmDialog(null, "Error at : " + ex.getMessage()); } return exists; } }
UTF-8
Java
8,483
java
ClearRecords.java
Java
[ { "context": "g.joda.time.DateTimeComparator;\n\n/**\n *\n * @author oshanz\n */\npublic class ClearRecords extends javax.swing", "end": 594, "score": 0.9996739029884338, "start": 588, "tag": "USERNAME", "value": "oshanz" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package cmjdproject.learner.view.manager.internels; import cmjdproject.learner.controller.RegisterController; import cmjdproject.learner.models.CandidateMod; import cmjdproject.learner.other.FormatedDate; import java.io.FileNotFoundException; import java.io.IOException; import java.sql.Date; import java.sql.SQLException; import java.util.ArrayList; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; import org.joda.time.DateTimeComparator; /** * * @author oshanz */ public class ClearRecords extends javax.swing.JInternalFrame { /** * Creates new form ClearRecords */ private DefaultTableModel dtm; public ClearRecords() { initComponents(); // SearchViaCombo searchViaCombo = new SearchViaCombo(); // searchViaCombo.setResultViaCombo(jComboBox1, true, ""); // // SwingSorter swingSorter = new SwingSorter(); // swingSorter.sortComboBox(jComboBox1); // new AutoCompletion(jComboBox1); // new JComboBoxAutoCompletador(jComboBox1); dtm = (DefaultTableModel) jTable1.getModel(); loadexpires(); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jButton2 = new javax.swing.JButton(); jButton1 = new javax.swing.JButton(); setClosable(true); setMaximizable(true); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Expired Registrations")); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Name", "NIC" } ) { boolean[] canEdit = new boolean [] { false, false }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); jScrollPane1.setViewportView(jTable1); jButton2.setText("Clear All"); jButton1.setText("Load"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 463, Short.MAX_VALUE) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 373, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton2) .addComponent(jButton1)) .addContainerGap(14, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: loadexpires(); }//GEN-LAST:event_jButton1ActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JPanel jPanel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable jTable1; // End of variables declaration//GEN-END:variables public boolean loadexpires() { boolean exists = false; ArrayList<String> arrayList = new ArrayList<String>(); try { ArrayList<String> regdate = new RegisterController().getregdate(); for (String rdate : regdate) { String[] split = rdate.split("-\\s*"); String b = (Integer.parseInt(split[2]) + 1) + "-" + (Integer.parseInt(split[1]) + 6) + "-" + split[0]; Date valueOf = Date.valueOf(b); Date valueOf1 = Date.valueOf(new FormatedDate().getDate("yyyy-MM-dd")); int compare = DateTimeComparator.getInstance().compare(valueOf1, valueOf); if (compare >= 0) {//valuof < valuof1 /////// valueof is old ////clean //System.out.println("win " + valueOf + " " + valueOf1); arrayList.add(rdate); //System.out.println("win " + valueOf + " " + valueOf1); exists = true; } else { // System.out.println("hik " + valueOf + " " + valueOf1); } } ArrayList<CandidateMod> nidfromdate = RegisterController.getnidfromdate(arrayList); for (CandidateMod candidateMod : nidfromdate) { // System.out.println(candidateMod.getNid() + " " + candidateMod.getName()); if (dtm.getRowCount() == 0) { dtm.addRow(new String[]{candidateMod.getNid(), candidateMod.getName()}); } else { for (int i = 0; i < dtm.getRowCount(); i++) { String valueAt = (String) dtm.getValueAt(i, 0); // System.out.println(valueAt); if (valueAt.equalsIgnoreCase(candidateMod.getNid())) { break; } if (i == dtm.getRowCount() - 1) { dtm.addRow(new String[]{candidateMod.getNid(), candidateMod.getName()}); break; } } } } } catch (ClassNotFoundException ex) { JOptionPane.showConfirmDialog(null, "Error at : " + ex.getMessage()); } catch (FileNotFoundException ex) { JOptionPane.showConfirmDialog(null, "Error at : " + ex.getMessage()); } catch (SQLException ex) { JOptionPane.showConfirmDialog(null, "Error at : " + ex.getMessage()); } catch (IOException ex) { JOptionPane.showConfirmDialog(null, "Error at : " + ex.getMessage()); } return exists; } }
8,483
0.606389
0.596605
198
41.843433
32.89777
147
false
false
0
0
0
0
0
0
0.606061
false
false
13
ba60e6237304af85fe696f9294d1d2b8b9886988
9,990,093,985,738
ae4098ef524da5d951bfefa12beb02cdd52ae391
/app/src/main/java/com/example/zmant/dailyenglish/view/fragment/FragmentWorld.java
dbdf20de84af3303ea89bdf3512574e73cd7605c
[]
no_license
mmklzmant/DailyEnglish
https://github.com/mmklzmant/DailyEnglish
7eb303ba85f9baf9f915cfab8988891beccea5c8
5e71e788463b1da5b5622610e7db1e592170ee86
refs/heads/master
2019-01-07T03:13:41.602000
2016-12-27T12:38:04
2016-12-27T12:38:04
74,966,243
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.zmant.dailyenglish.view.fragment; import android.content.Context; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.widget.RecyclerView; import com.example.zmant.dailyenglish.api.ApiService; import com.example.zmant.dailyenglish.component.AppComponent; import com.example.zmant.dailyenglish.component.DaggerBBCWorldComponent; import com.example.zmant.dailyenglish.module.BBCWorldModule; import com.example.zmant.dailyenglish.presenter.BBCFragmentPresenter; import com.example.zmant.dailyenglish.view.R; import javax.inject.Inject; import butterknife.BindView; import butterknife.OnItemClick; /** * @author zmant 2016/11/29 15:04 * @classname FragmentWorld * @description MainViewPagerAdapter的Fragment */ public class FragmentWorld extends BaseMainFragment{ @BindView(R.id.recycleview_world_main) RecyclerView mRecycleView; @BindView(R.id.refresh_world_main) SwipeRefreshLayout mRefresh; @Inject ApiService apiService; @Inject BBCFragmentPresenter mPresenter; public FragmentWorld(Context context, int layoutId) { super(context, layoutId); } //初始化Component @Override public void setupFragmentComponent(AppComponent appComponent) { DaggerBBCWorldComponent.builder() .appComponent(appComponent) .bBCWorldModule(new BBCWorldModule(this)) .build().inject(this); } @Override protected SwipeRefreshLayout getRefresh() { return mRefresh; } @Override protected RecyclerView getRecycle() { return mRecycleView; } @Override protected void setListener() { } @Override public void initData() { if(!isVisible)//第一次 { //加载网络数据 showProgress(); mPresenter.loadData(apiService, "/news/world"); } else{ //加载本地缓存 // initViewPagerData(); } } }
UTF-8
Java
2,020
java
FragmentWorld.java
Java
[ { "context": "w;\nimport butterknife.OnItemClick;\n\n/**\n * @author zmant 2016/11/29 15:04\n * @classname FragmentWorld\n * @", "end": 666, "score": 0.9995201826095581, "start": 661, "tag": "USERNAME", "value": "zmant" } ]
null
[]
package com.example.zmant.dailyenglish.view.fragment; import android.content.Context; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.widget.RecyclerView; import com.example.zmant.dailyenglish.api.ApiService; import com.example.zmant.dailyenglish.component.AppComponent; import com.example.zmant.dailyenglish.component.DaggerBBCWorldComponent; import com.example.zmant.dailyenglish.module.BBCWorldModule; import com.example.zmant.dailyenglish.presenter.BBCFragmentPresenter; import com.example.zmant.dailyenglish.view.R; import javax.inject.Inject; import butterknife.BindView; import butterknife.OnItemClick; /** * @author zmant 2016/11/29 15:04 * @classname FragmentWorld * @description MainViewPagerAdapter的Fragment */ public class FragmentWorld extends BaseMainFragment{ @BindView(R.id.recycleview_world_main) RecyclerView mRecycleView; @BindView(R.id.refresh_world_main) SwipeRefreshLayout mRefresh; @Inject ApiService apiService; @Inject BBCFragmentPresenter mPresenter; public FragmentWorld(Context context, int layoutId) { super(context, layoutId); } //初始化Component @Override public void setupFragmentComponent(AppComponent appComponent) { DaggerBBCWorldComponent.builder() .appComponent(appComponent) .bBCWorldModule(new BBCWorldModule(this)) .build().inject(this); } @Override protected SwipeRefreshLayout getRefresh() { return mRefresh; } @Override protected RecyclerView getRecycle() { return mRecycleView; } @Override protected void setListener() { } @Override public void initData() { if(!isVisible)//第一次 { //加载网络数据 showProgress(); mPresenter.loadData(apiService, "/news/world"); } else{ //加载本地缓存 // initViewPagerData(); } } }
2,020
0.690716
0.683653
80
23.775
20.748478
72
false
false
0
0
0
0
0
0
0.3375
false
false
13
02d3ffa192493ad77aa00ab292dc20614c51b97e
26,268,020,007,942
7add119409aeb3a1d1130aea394a16985181371c
/src/java/dao/DespesaDao.java
1e75298e3642b44ce59012a4a78a667743ee36a0
[]
no_license
Kelvin023/QSMarmitex
https://github.com/Kelvin023/QSMarmitex
245a672fc9b996f64ca16e5360038c9cf6403890
b4c9fbd4654f4c6e60254aa423595dcbd6464ea1
refs/heads/master
2023-06-11T00:04:37.782000
2021-07-01T23:42:15
2021-07-01T23:42:15
299,758,499
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import model.Acompanhamento; import model.Despesa; import util.DbUtil; public class DespesaDao { private final Connection connection; public DespesaDao() { connection = DbUtil.getConnection(); } public void addDespesa(Despesa despesa, int cd_tipo) { System.out.println("Entrei na addDespesa!!"); try { String SQL = "INSERT INTO tb_despesa(vl_despesa, ds_despesa, cd_tipo) VALUES" + "(?, ? , ?)"; try (PreparedStatement ps = connection.prepareStatement(SQL)) { ps.setFloat(1, despesa.getVl_despesa()); ps.setString(2, despesa.getDs_despesa()); ps.setInt(3, cd_tipo); ps.executeUpdate(); ps.close(); System.out.println("Despesa " + despesa.getCd_tipo()+ " inserida com sucesso!"); } //connection.close(); } catch (SQLException e) { e.printStackTrace(); System.out.println("Falha ao adicionar a despesa"); } } public void deleteDespesa(int cd_despesa) { try { PreparedStatement preparedStatement = connection .prepareStatement("delete from tb_despesa where cd_despesa=?"); preparedStatement.setInt(1, cd_despesa); preparedStatement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } } public void updateDespesa(Despesa despesa, String cd_despesa) { System.out.println("Entrei na updateDespesa!"); try { PreparedStatement ps = connection .prepareStatement("update tb_despesa set vl_despesa=?, ds_despesa =?" + "where cd_despesa=?"); ps.setFloat(1,despesa.getVl_despesa()); ps.setString(2,despesa.getDs_despesa()); ps.setString(3,cd_despesa); ps.executeUpdate(); System.out.println("Número da Despesa a ser atualizado= " + cd_despesa); System.out.println("Despesa atualizada com sucesso!"); ps.close(); } catch (SQLException e) { e.printStackTrace(); throw new RuntimeException("Erro ao atualizar despesa!"); } } public List<Despesa> getAllDespesas() { List<Despesa> listaDeDespesas = new ArrayList<Despesa>(); try { String SQL = "select * from tb_despesa"; PreparedStatement ps = connection.prepareStatement(SQL); ResultSet rs = ps.executeQuery(); while (rs.next()) { Despesa despesa = new Despesa(); despesa.setCd_despesa(rs.getInt("cd_despesa")); despesa.setCd_tipo(rs.getInt("cd_tipo")); despesa.setVl_despesa(rs.getFloat("vl_despesa")); despesa.setDs_despesa(rs.getString("ds_despesa")); despesa.setDt_inclusion(rs.getDate("dt_inclusion")); listaDeDespesas.add(despesa); } } catch (SQLException e) { throw new RuntimeException("Falha ao listar despesas em DespesaDAO.", e); } return listaDeDespesas; } public Despesa getDespesaById(int cd_despesa) { Despesa despesa = new Despesa(); try { PreparedStatement preparedStatement = connection.prepareStatement("select * from tb_despesa where cd_despesa=?"); preparedStatement.setInt(1, cd_despesa); ResultSet rs = preparedStatement.executeQuery(); if (rs.next()) { despesa.setCd_despesa(rs.getInt("cd_despesa")); despesa.setCd_tipo(rs.getInt("cd_tipo")); despesa.setVl_despesa(rs.getFloat("vl_despesa")); despesa.setDs_despesa(rs.getString("ds_despesa")); despesa.setDt_inclusion(rs.getDate("dt_inclusion")); } } catch (SQLException e) { e.printStackTrace(); throw new RuntimeException("Erro ao buscar registro da despesa solicitada."); } return despesa; } public boolean despesaExist(String cd_despesa) { try { PreparedStatement preparedStatement = connection.prepareStatement("select * from tb_despesa where cd_despesa=?"); preparedStatement.setString(1, cd_despesa); ResultSet rs = preparedStatement.executeQuery(); if (rs.next()) { return true; } } catch (SQLException e) { throw new RuntimeException("Erro de SQL.", e); } return false; } //TOTAL DE DESPESAS POR PERIODO(MÊS) public List<Despesa> getTotalDespesaByPeriodo() { System.out.println("Entrei na getTotalDespesaByPeriodo"); List<Despesa> listaDeDespesas = new ArrayList<Despesa>(); try { String SQL = "select \n" + " sum(vl_despesa) as vlr_total_despesa,\n" + " month(dt_inclusion) as mes,\n" + " year(dt_inclusion) as ano\n" + "from tb_despesa\n" + "group by mes, ano\n" + "order by ano, mes;"; PreparedStatement ps = connection.prepareStatement(SQL); ResultSet rs = ps.executeQuery(); while (rs.next()) { Despesa despesa = new Despesa(); despesa.setVlr_total_despesa(rs.getFloat("vlr_total_despesa")); despesa.setAno_despesa_particao(rs.getInt("ano")); despesa.setMes_despesa_particao(rs.getInt("mes")); listaDeDespesas.add(despesa); } } catch (SQLException e) { throw new RuntimeException("Falha ao listar despesas.", e); } return listaDeDespesas; } // MÉTODO PARA CAPTURAR AS DESPESAS POR PERIODO: DT_INICIO E DT_FIM public List<Despesa> getAllDespesasByPeriodo(String dtinicio, String dtfim) { System.out.println("Entrei na getAllDespesasByPeriodo!!"); List<Despesa> listaDeDespesas = new ArrayList<Despesa>(); try { String SQL = "SELECT \n" + " cd_despesa,\n" + " cd_tipo,\n" + " vl_despesa,\n" + " ds_despesa,\n" + " dt_inclusion\n" + "FROM tb_despesa\n" + "where DATE(dt_inclusion) between ? and ?;"; PreparedStatement ps = connection.prepareStatement(SQL); ps.setString(1, dtinicio); ps.setString(2, dtfim); System.out.println("Data de inicio do periodo dentro da getAllDespesasByPeriodo: " + dtinicio); System.out.println("Data de fim do periodo dentro da getAllDespesasByPeriodo: " + dtfim); ResultSet rs = ps.executeQuery(); while (rs.next()) { Despesa despesa = new Despesa(); despesa.setCd_despesa(rs.getInt("cd_despesa")); despesa.setCd_tipo(rs.getInt("cd_tipo")); despesa.setVl_despesa(rs.getFloat("vl_despesa")); despesa.setDs_despesa(rs.getString("ds_despesa")); despesa.setDt_inclusion(rs.getDate("dt_inclusion")); listaDeDespesas.add(despesa); } } catch (SQLException e) { throw new RuntimeException("Falha ao listar despesas.", e); } return listaDeDespesas; } // MÉTODO PARA CAPTURAR AS DESPESAS POR TIPO public List<Despesa> getallDespesasByTipo(String tipoDespesa) { System.out.println("Entrei na getallDespesasByTipo!!"); List<Despesa> listaDeDespesas = new ArrayList<Despesa>(); try { String SQL = "SELECT \n" + " cd_despesa,\n" + " cd_tipo,\n" + " vl_despesa,\n" + " ds_despesa,\n" + " dt_inclusion\n" + "FROM tb_despesa\n" + "where cd_tipo = ?;"; PreparedStatement ps = connection.prepareStatement(SQL); ps.setString(1, tipoDespesa); System.out.println("Status dentro da getallPedidosByStatus: " + tipoDespesa); ResultSet rs = ps.executeQuery(); while (rs.next()) { Despesa despesa = new Despesa(); despesa.setCd_despesa(rs.getInt("cd_despesa")); despesa.setCd_tipo(rs.getInt("cd_tipo")); despesa.setVl_despesa(rs.getFloat("vl_despesa")); despesa.setDs_despesa(rs.getString("ds_despesa")); despesa.setDt_inclusion(rs.getDate("dt_inclusion")); listaDeDespesas.add(despesa); } } catch (SQLException e) { throw new RuntimeException("Falha ao listar despesas.", e); } return listaDeDespesas; } // MÉTODO PARA CAPTURAR AS DESPESAS POR PERIODO E TIPO public List<Despesa> getallDespesasByTipoandPeriodo(String tipoDespesa, String dtinicio, String dtfim) { System.out.println("Entrei na getallDespesasByTipoandPeriodo!!"); List<Despesa> listaDeDespesas = new ArrayList<Despesa>(); try { String SQL = "SELECT \n" + " cd_despesa,\n" + " cd_tipo,\n" + " vl_despesa,\n" + " ds_despesa,\n" + " dt_inclusion\n" + "FROM tb_despesa\n" + "where cd_tipo = ? and\n" + "DATE(dt_inclusion) between ? and ?;"; PreparedStatement ps = connection.prepareStatement(SQL); ps.setString(1, tipoDespesa); ps.setString(2, dtinicio); ps.setString(3, dtfim); ResultSet rs = ps.executeQuery(); while (rs.next()) { Despesa despesa = new Despesa(); despesa.setCd_despesa(rs.getInt("cd_despesa")); despesa.setCd_tipo(rs.getInt("cd_tipo")); despesa.setVl_despesa(rs.getFloat("vl_despesa")); despesa.setDs_despesa(rs.getString("ds_despesa")); despesa.setDt_inclusion(rs.getDate("dt_inclusion")); listaDeDespesas.add(despesa); } } catch (SQLException e) { throw new RuntimeException("Falha ao listar despesas.", e); } return listaDeDespesas; } }
UTF-8
Java
11,740
java
DespesaDao.java
Java
[]
null
[]
package dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import model.Acompanhamento; import model.Despesa; import util.DbUtil; public class DespesaDao { private final Connection connection; public DespesaDao() { connection = DbUtil.getConnection(); } public void addDespesa(Despesa despesa, int cd_tipo) { System.out.println("Entrei na addDespesa!!"); try { String SQL = "INSERT INTO tb_despesa(vl_despesa, ds_despesa, cd_tipo) VALUES" + "(?, ? , ?)"; try (PreparedStatement ps = connection.prepareStatement(SQL)) { ps.setFloat(1, despesa.getVl_despesa()); ps.setString(2, despesa.getDs_despesa()); ps.setInt(3, cd_tipo); ps.executeUpdate(); ps.close(); System.out.println("Despesa " + despesa.getCd_tipo()+ " inserida com sucesso!"); } //connection.close(); } catch (SQLException e) { e.printStackTrace(); System.out.println("Falha ao adicionar a despesa"); } } public void deleteDespesa(int cd_despesa) { try { PreparedStatement preparedStatement = connection .prepareStatement("delete from tb_despesa where cd_despesa=?"); preparedStatement.setInt(1, cd_despesa); preparedStatement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } } public void updateDespesa(Despesa despesa, String cd_despesa) { System.out.println("Entrei na updateDespesa!"); try { PreparedStatement ps = connection .prepareStatement("update tb_despesa set vl_despesa=?, ds_despesa =?" + "where cd_despesa=?"); ps.setFloat(1,despesa.getVl_despesa()); ps.setString(2,despesa.getDs_despesa()); ps.setString(3,cd_despesa); ps.executeUpdate(); System.out.println("Número da Despesa a ser atualizado= " + cd_despesa); System.out.println("Despesa atualizada com sucesso!"); ps.close(); } catch (SQLException e) { e.printStackTrace(); throw new RuntimeException("Erro ao atualizar despesa!"); } } public List<Despesa> getAllDespesas() { List<Despesa> listaDeDespesas = new ArrayList<Despesa>(); try { String SQL = "select * from tb_despesa"; PreparedStatement ps = connection.prepareStatement(SQL); ResultSet rs = ps.executeQuery(); while (rs.next()) { Despesa despesa = new Despesa(); despesa.setCd_despesa(rs.getInt("cd_despesa")); despesa.setCd_tipo(rs.getInt("cd_tipo")); despesa.setVl_despesa(rs.getFloat("vl_despesa")); despesa.setDs_despesa(rs.getString("ds_despesa")); despesa.setDt_inclusion(rs.getDate("dt_inclusion")); listaDeDespesas.add(despesa); } } catch (SQLException e) { throw new RuntimeException("Falha ao listar despesas em DespesaDAO.", e); } return listaDeDespesas; } public Despesa getDespesaById(int cd_despesa) { Despesa despesa = new Despesa(); try { PreparedStatement preparedStatement = connection.prepareStatement("select * from tb_despesa where cd_despesa=?"); preparedStatement.setInt(1, cd_despesa); ResultSet rs = preparedStatement.executeQuery(); if (rs.next()) { despesa.setCd_despesa(rs.getInt("cd_despesa")); despesa.setCd_tipo(rs.getInt("cd_tipo")); despesa.setVl_despesa(rs.getFloat("vl_despesa")); despesa.setDs_despesa(rs.getString("ds_despesa")); despesa.setDt_inclusion(rs.getDate("dt_inclusion")); } } catch (SQLException e) { e.printStackTrace(); throw new RuntimeException("Erro ao buscar registro da despesa solicitada."); } return despesa; } public boolean despesaExist(String cd_despesa) { try { PreparedStatement preparedStatement = connection.prepareStatement("select * from tb_despesa where cd_despesa=?"); preparedStatement.setString(1, cd_despesa); ResultSet rs = preparedStatement.executeQuery(); if (rs.next()) { return true; } } catch (SQLException e) { throw new RuntimeException("Erro de SQL.", e); } return false; } //TOTAL DE DESPESAS POR PERIODO(MÊS) public List<Despesa> getTotalDespesaByPeriodo() { System.out.println("Entrei na getTotalDespesaByPeriodo"); List<Despesa> listaDeDespesas = new ArrayList<Despesa>(); try { String SQL = "select \n" + " sum(vl_despesa) as vlr_total_despesa,\n" + " month(dt_inclusion) as mes,\n" + " year(dt_inclusion) as ano\n" + "from tb_despesa\n" + "group by mes, ano\n" + "order by ano, mes;"; PreparedStatement ps = connection.prepareStatement(SQL); ResultSet rs = ps.executeQuery(); while (rs.next()) { Despesa despesa = new Despesa(); despesa.setVlr_total_despesa(rs.getFloat("vlr_total_despesa")); despesa.setAno_despesa_particao(rs.getInt("ano")); despesa.setMes_despesa_particao(rs.getInt("mes")); listaDeDespesas.add(despesa); } } catch (SQLException e) { throw new RuntimeException("Falha ao listar despesas.", e); } return listaDeDespesas; } // MÉTODO PARA CAPTURAR AS DESPESAS POR PERIODO: DT_INICIO E DT_FIM public List<Despesa> getAllDespesasByPeriodo(String dtinicio, String dtfim) { System.out.println("Entrei na getAllDespesasByPeriodo!!"); List<Despesa> listaDeDespesas = new ArrayList<Despesa>(); try { String SQL = "SELECT \n" + " cd_despesa,\n" + " cd_tipo,\n" + " vl_despesa,\n" + " ds_despesa,\n" + " dt_inclusion\n" + "FROM tb_despesa\n" + "where DATE(dt_inclusion) between ? and ?;"; PreparedStatement ps = connection.prepareStatement(SQL); ps.setString(1, dtinicio); ps.setString(2, dtfim); System.out.println("Data de inicio do periodo dentro da getAllDespesasByPeriodo: " + dtinicio); System.out.println("Data de fim do periodo dentro da getAllDespesasByPeriodo: " + dtfim); ResultSet rs = ps.executeQuery(); while (rs.next()) { Despesa despesa = new Despesa(); despesa.setCd_despesa(rs.getInt("cd_despesa")); despesa.setCd_tipo(rs.getInt("cd_tipo")); despesa.setVl_despesa(rs.getFloat("vl_despesa")); despesa.setDs_despesa(rs.getString("ds_despesa")); despesa.setDt_inclusion(rs.getDate("dt_inclusion")); listaDeDespesas.add(despesa); } } catch (SQLException e) { throw new RuntimeException("Falha ao listar despesas.", e); } return listaDeDespesas; } // MÉTODO PARA CAPTURAR AS DESPESAS POR TIPO public List<Despesa> getallDespesasByTipo(String tipoDespesa) { System.out.println("Entrei na getallDespesasByTipo!!"); List<Despesa> listaDeDespesas = new ArrayList<Despesa>(); try { String SQL = "SELECT \n" + " cd_despesa,\n" + " cd_tipo,\n" + " vl_despesa,\n" + " ds_despesa,\n" + " dt_inclusion\n" + "FROM tb_despesa\n" + "where cd_tipo = ?;"; PreparedStatement ps = connection.prepareStatement(SQL); ps.setString(1, tipoDespesa); System.out.println("Status dentro da getallPedidosByStatus: " + tipoDespesa); ResultSet rs = ps.executeQuery(); while (rs.next()) { Despesa despesa = new Despesa(); despesa.setCd_despesa(rs.getInt("cd_despesa")); despesa.setCd_tipo(rs.getInt("cd_tipo")); despesa.setVl_despesa(rs.getFloat("vl_despesa")); despesa.setDs_despesa(rs.getString("ds_despesa")); despesa.setDt_inclusion(rs.getDate("dt_inclusion")); listaDeDespesas.add(despesa); } } catch (SQLException e) { throw new RuntimeException("Falha ao listar despesas.", e); } return listaDeDespesas; } // MÉTODO PARA CAPTURAR AS DESPESAS POR PERIODO E TIPO public List<Despesa> getallDespesasByTipoandPeriodo(String tipoDespesa, String dtinicio, String dtfim) { System.out.println("Entrei na getallDespesasByTipoandPeriodo!!"); List<Despesa> listaDeDespesas = new ArrayList<Despesa>(); try { String SQL = "SELECT \n" + " cd_despesa,\n" + " cd_tipo,\n" + " vl_despesa,\n" + " ds_despesa,\n" + " dt_inclusion\n" + "FROM tb_despesa\n" + "where cd_tipo = ? and\n" + "DATE(dt_inclusion) between ? and ?;"; PreparedStatement ps = connection.prepareStatement(SQL); ps.setString(1, tipoDespesa); ps.setString(2, dtinicio); ps.setString(3, dtfim); ResultSet rs = ps.executeQuery(); while (rs.next()) { Despesa despesa = new Despesa(); despesa.setCd_despesa(rs.getInt("cd_despesa")); despesa.setCd_tipo(rs.getInt("cd_tipo")); despesa.setVl_despesa(rs.getFloat("vl_despesa")); despesa.setDs_despesa(rs.getString("ds_despesa")); despesa.setDt_inclusion(rs.getDate("dt_inclusion")); listaDeDespesas.add(despesa); } } catch (SQLException e) { throw new RuntimeException("Falha ao listar despesas.", e); } return listaDeDespesas; } }
11,740
0.503196
0.501917
269
41.631969
26.814146
125
false
false
0
0
0
0
0
0
0.687732
false
false
13
6bb58979d7cc3d323a3c35f9bdc64353dba92578
4,836,133,210,776
4d8f476590de64049511436a5a54086bfd631266
/app/src/main/java/com/example/gajanan/recyclerviewex/CustomAdapter.java
10c31edaaa043aaf1dc4d3d1634f6403ca98bde0
[]
no_license
gajanankorde/RecyclerViewEx
https://github.com/gajanankorde/RecyclerViewEx
fb48839df14749ab33f6a1ae82df34e6f9628dfd
fcb7913d7b0dc8f328996f82dfad82ced09ffe10
refs/heads/master
2020-08-04T14:23:15.758000
2019-11-22T17:48:38
2019-11-22T17:48:38
212,166,056
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.gajanan.recyclerviewex; import android.content.Context; import android.content.Intent; 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 android.widget.Toast; import com.bumptech.glide.Glide; import java.util.ArrayList; public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.MyViewHolder> { ArrayList<String> personNames; ArrayList<Integer> personImages; ArrayList<String> tenure; // Context context; /* public CustomAdapter(Context context, ArrayList<String> personNames,ArrayList<Integer> personImages) { this.context = context; this.personNames = personNames; this.personImages=personImages; } */ public CustomAdapter(Context context, ArrayList<String> personNames,ArrayList<Integer> personImages,ArrayList<String> tenure) { this.context = context; this.personNames = personNames; this.personImages=personImages; this.tenure=tenure; } @Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // infalte the item Layout View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.rowlayout, parent, false); // set the view's size, margins, paddings and layout parameters MyViewHolder vh = new MyViewHolder(v); // pass the view to View Holder return vh; } /* @Override public void onBindViewHolder(MyViewHolder holder, final int position) { // set the data in items holder.name.setText(personNames.get(position)); //holder.image.setImageResource(personImages.get(position)); //we are using glide img lib to load img in circular fashion // requires updated SDK repository Glide.with(context) .load(contact.getImage()) .apply(RequestOptions.circleCropTransform()) .into(holder.thumbnail); Glide.with(context) .load(personImages.get(position)) // add your image url .transform(new CircleTransform(context)) // applying the image transformer .into(holder.image); // implement setOnClickListener event on item view. holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // display a toast with person name on item click Toast.makeText(context, personNames.get(position), Toast.LENGTH_SHORT).show(); } }); } */ @Override public void onBindViewHolder(MyViewHolder holder, final int position) { // set the data in items holder.name.setText(personNames.get(position)); holder.tenure.setText(tenure.get(position)); //holder.image.setImageResource(personImages.get(position)); //we are using glide img lib to load img in circular fashion /* // requires updated SDK repository Glide.with(context) .load(contact.getImage()) .apply(RequestOptions.circleCropTransform()) .into(holder.thumbnail); */ Glide.with(context) .load(personImages.get(position)) // add your image url .transform(new CircleTransform(context)) // applying the image transformer .into(holder.image); // implement setOnClickListener event on item view. holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // display a toast with person name on item click Toast.makeText(context, "You Clicked : "+personNames.get(position), Toast.LENGTH_SHORT).show(); Intent intent = new Intent(context, GalleryActivity.class); intent.putExtra("personImages", personImages.get(position)); intent.putExtra("personNames", personNames.get(position)); intent.putExtra("tenure", tenure.get(position)); context.startActivity(intent); } }); } @Override public int getItemCount() { return personNames.size(); } public class MyViewHolder extends RecyclerView.ViewHolder { // initialize the item view's TextView name; TextView tenure; ImageView image; public MyViewHolder(View itemView) { super(itemView); // get the reference of item view's name = (TextView) itemView.findViewById(R.id.name); image=(ImageView)itemView.findViewById(R.id.img); tenure = (TextView) itemView.findViewById(R.id.tenure); } } }
UTF-8
Java
4,931
java
CustomAdapter.java
Java
[]
null
[]
package com.example.gajanan.recyclerviewex; import android.content.Context; import android.content.Intent; 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 android.widget.Toast; import com.bumptech.glide.Glide; import java.util.ArrayList; public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.MyViewHolder> { ArrayList<String> personNames; ArrayList<Integer> personImages; ArrayList<String> tenure; // Context context; /* public CustomAdapter(Context context, ArrayList<String> personNames,ArrayList<Integer> personImages) { this.context = context; this.personNames = personNames; this.personImages=personImages; } */ public CustomAdapter(Context context, ArrayList<String> personNames,ArrayList<Integer> personImages,ArrayList<String> tenure) { this.context = context; this.personNames = personNames; this.personImages=personImages; this.tenure=tenure; } @Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // infalte the item Layout View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.rowlayout, parent, false); // set the view's size, margins, paddings and layout parameters MyViewHolder vh = new MyViewHolder(v); // pass the view to View Holder return vh; } /* @Override public void onBindViewHolder(MyViewHolder holder, final int position) { // set the data in items holder.name.setText(personNames.get(position)); //holder.image.setImageResource(personImages.get(position)); //we are using glide img lib to load img in circular fashion // requires updated SDK repository Glide.with(context) .load(contact.getImage()) .apply(RequestOptions.circleCropTransform()) .into(holder.thumbnail); Glide.with(context) .load(personImages.get(position)) // add your image url .transform(new CircleTransform(context)) // applying the image transformer .into(holder.image); // implement setOnClickListener event on item view. holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // display a toast with person name on item click Toast.makeText(context, personNames.get(position), Toast.LENGTH_SHORT).show(); } }); } */ @Override public void onBindViewHolder(MyViewHolder holder, final int position) { // set the data in items holder.name.setText(personNames.get(position)); holder.tenure.setText(tenure.get(position)); //holder.image.setImageResource(personImages.get(position)); //we are using glide img lib to load img in circular fashion /* // requires updated SDK repository Glide.with(context) .load(contact.getImage()) .apply(RequestOptions.circleCropTransform()) .into(holder.thumbnail); */ Glide.with(context) .load(personImages.get(position)) // add your image url .transform(new CircleTransform(context)) // applying the image transformer .into(holder.image); // implement setOnClickListener event on item view. holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // display a toast with person name on item click Toast.makeText(context, "You Clicked : "+personNames.get(position), Toast.LENGTH_SHORT).show(); Intent intent = new Intent(context, GalleryActivity.class); intent.putExtra("personImages", personImages.get(position)); intent.putExtra("personNames", personNames.get(position)); intent.putExtra("tenure", tenure.get(position)); context.startActivity(intent); } }); } @Override public int getItemCount() { return personNames.size(); } public class MyViewHolder extends RecyclerView.ViewHolder { // initialize the item view's TextView name; TextView tenure; ImageView image; public MyViewHolder(View itemView) { super(itemView); // get the reference of item view's name = (TextView) itemView.findViewById(R.id.name); image=(ImageView)itemView.findViewById(R.id.img); tenure = (TextView) itemView.findViewById(R.id.tenure); } } }
4,931
0.638004
0.637802
162
29.425926
29.587452
131
false
false
0
0
0
0
0
0
0.444444
false
false
13
80b2c2d4d677b26f39c4477725a33af00b634658
12,567,074,322,834
5db29fa5cdcec9411383d279c25f4fba82fe6046
/src/main/java/MediumQuestions/OptimalUtilization.java
0bf16695b87c2824e2d02cbc6b9706bff74afc63
[]
no_license
MatthewCroft/CompetitiveProgramming
https://github.com/MatthewCroft/CompetitiveProgramming
37389ec0751aa85c7064db3c82f698a3360c0208
7932c9da0b51996a7cd60f7cd1017af67844b746
refs/heads/master
2020-07-19T08:27:54.219000
2019-09-22T23:49:36
2019-09-22T23:49:36
206,410,626
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package MediumQuestions; public class OptimalUtilization { }
UTF-8
Java
62
java
OptimalUtilization.java
Java
[]
null
[]
package MediumQuestions; public class OptimalUtilization { }
62
0.822581
0.822581
4
14.5
14.361406
33
false
false
0
0
0
0
0
0
0.25
false
false
13
c414b0948b6a1f778d9bb24bfaf6558fd20b84be
4,664,334,534,791
e0fba9903bda6756429083d4eec970a294d079ad
/App/app/src/main/java/com/example/fedsev/feedback/CallRecyclerAdapter.java
ce035d9587e50d880a190406d99c7ff1e1094fe6
[]
no_license
ayushgit2498/Feedback-System
https://github.com/ayushgit2498/Feedback-System
a8ee7368c28d8c5001d8ea4d7439f9f1f1ecbe02
20cfc8da24a66bb212d9d3cf8fb631df3c714544
refs/heads/master
2022-06-30T02:37:32.472000
2019-06-02T14:09:44
2019-06-02T14:09:44
189,853,732
0
0
null
false
2022-06-21T01:12:48
2019-06-02T14:04:40
2019-06-02T14:10:30
2022-06-21T01:12:48
16,281
0
0
3
CSS
false
false
package com.example.fedsev.feedback; import android.accessibilityservice.GestureDescription; import android.graphics.Color; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import java.sql.Array; import java.util.ArrayList; public class CallRecyclerAdapter extends RecyclerView.Adapter<CallRecyclerAdapter.ViewHolder> { ArrayList<RecycleData> finalL; CallRecyclerAdapter(ArrayList<RecycleData> finalL){ this.finalL = finalL; } @NonNull @Override public CallRecyclerAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { return new ViewHolder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.list_layout, viewGroup, false)); } @Override public void onBindViewHolder(@NonNull CallRecyclerAdapter.ViewHolder viewHolder, int i) { viewHolder.header.setText(finalL.get(i).getHeader()); viewHolder.footer.setText(finalL.get(i).getFooter()); String s = getColor(finalL.get(i).getColor()); viewHolder.linearLayout.setBackgroundColor(Color.parseColor(s)); } @Override public int getItemCount() { return finalL.size(); } public class ViewHolder extends RecyclerView.ViewHolder { private TextView header,footer; private LinearLayout linearLayout; public ViewHolder(@NonNull View itemView) { super(itemView); header = itemView.findViewById(R.id.header); footer = itemView.findViewById(R.id.footer); linearLayout = itemView.findViewById(R.id.linear); } } public String getColor(int value){ switch (value){ case 1:{ return "#A24936"; } case 2:{ return "#D36135"; } case 3:{ return "#395C6B"; } case 4:{ return "#68B0AB"; } } return "#005B41"; } }
UTF-8
Java
2,191
java
CallRecyclerAdapter.java
Java
[]
null
[]
package com.example.fedsev.feedback; import android.accessibilityservice.GestureDescription; import android.graphics.Color; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import java.sql.Array; import java.util.ArrayList; public class CallRecyclerAdapter extends RecyclerView.Adapter<CallRecyclerAdapter.ViewHolder> { ArrayList<RecycleData> finalL; CallRecyclerAdapter(ArrayList<RecycleData> finalL){ this.finalL = finalL; } @NonNull @Override public CallRecyclerAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { return new ViewHolder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.list_layout, viewGroup, false)); } @Override public void onBindViewHolder(@NonNull CallRecyclerAdapter.ViewHolder viewHolder, int i) { viewHolder.header.setText(finalL.get(i).getHeader()); viewHolder.footer.setText(finalL.get(i).getFooter()); String s = getColor(finalL.get(i).getColor()); viewHolder.linearLayout.setBackgroundColor(Color.parseColor(s)); } @Override public int getItemCount() { return finalL.size(); } public class ViewHolder extends RecyclerView.ViewHolder { private TextView header,footer; private LinearLayout linearLayout; public ViewHolder(@NonNull View itemView) { super(itemView); header = itemView.findViewById(R.id.header); footer = itemView.findViewById(R.id.footer); linearLayout = itemView.findViewById(R.id.linear); } } public String getColor(int value){ switch (value){ case 1:{ return "#A24936"; } case 2:{ return "#D36135"; } case 3:{ return "#395C6B"; } case 4:{ return "#68B0AB"; } } return "#005B41"; } }
2,191
0.654039
0.641716
71
29.859156
26.105579
123
false
false
0
0
0
0
0
0
0.521127
false
false
13
f2ba49f10f425fd8e1c49f226ec9201979a72c4c
33,217,277,123,093
8dadbc8631f2d2bc78c5fb8576dcc127bd31c5b1
/src/main/java/com/qfggk/simpleweb/service/imp/UserServiceImp.java
58a33228f00c682df51f03cd3f6534413cf4d9a8
[]
no_license
851605063/simpleweb
https://github.com/851605063/simpleweb
87ab780fe20f70d0d3417fb5c0eb43be1a28c646
0e1ab56178e0b68266ebcff0028ce9400d1cebc1
refs/heads/master
2023-05-02T17:06:13.256000
2021-06-03T14:08:51
2021-06-03T14:08:51
357,629,962
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.qfggk.simpleweb.service.imp; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.qfggk.simpleweb.bean.User; import com.qfggk.simpleweb.mapper.UserMapper; import com.qfggk.simpleweb.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class UserServiceImp extends ServiceImpl<UserMapper,User> implements UserService { }
UTF-8
Java
481
java
UserServiceImp.java
Java
[]
null
[]
package com.qfggk.simpleweb.service.imp; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.qfggk.simpleweb.bean.User; import com.qfggk.simpleweb.mapper.UserMapper; import com.qfggk.simpleweb.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class UserServiceImp extends ServiceImpl<UserMapper,User> implements UserService { }
481
0.837838
0.837838
17
27.294117
28.135731
89
false
false
0
0
0
0
0
0
0.529412
false
false
13
99edfba823990ecb260dc2cb199ad3775272dfb6
6,932,077,222,347
92a3c75054f77baee5ec077b8bf9cda93c638739
/src/main/java/org/arachna/netweaver/sonar/SonarBuilder.java
7c35cee78c14ab999107b55c09ac60b48e0bc593
[]
no_license
xudonny/NWDI-Sonar-Plugin
https://github.com/xudonny/NWDI-Sonar-Plugin
78fcc96aa964047ab4f0ee32e2b70d48049f5436
6cbb72b89f388a4047c2c38f1718247dca0cd922
refs/heads/master
2022-03-04T09:36:12.256000
2019-01-23T20:04:47
2019-01-23T20:04:47
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * */ package org.arachna.netweaver.sonar; import hudson.Extension; import hudson.Launcher; import hudson.model.BuildListener; import hudson.model.AbstractBuild; import hudson.model.AbstractProject; import hudson.tasks.BuildStepDescriptor; import hudson.tasks.Builder; import hudson.tasks.Maven; import hudson.tasks.Maven.MavenInstallation; import hudson.tools.ToolInstallation; import java.io.FileWriter; import java.io.IOException; import java.util.logging.Logger; import org.arachna.ant.AntHelper; import org.arachna.netweaver.dc.types.DevelopmentComponent; import org.arachna.netweaver.dc.types.DevelopmentComponentType; import org.arachna.netweaver.hudson.nwdi.DCWithJavaSourceAcceptingFilter; import org.arachna.netweaver.hudson.nwdi.NWDIBuild; import org.arachna.netweaver.hudson.nwdi.NWDIProject; import org.arachna.netweaver.hudson.util.FilePathHelper; import org.arachna.velocity.VelocityHelper; import org.kohsuke.stapler.DataBoundConstructor; /** * Jenkins builder that executes the maven sonar plugin for NetWeaver * development components. * * @author Dirk Weigenand */ public class SonarBuilder extends Builder { /** * Descriptor for {@link SonarBuilder}. */ @Extension public static final DescriptorImpl DESCRIPTOR = new DescriptorImpl(); /** * Data bound constructor. Used for populating a {@link SonarBuilder} instance * from form fields in <code>config.jelly</code>. */ @DataBoundConstructor public SonarBuilder() { } /** * {@inheritDoc} */ @Override public boolean perform(final AbstractBuild<?, ?> build, final Launcher launcher, final BuildListener listener) throws InterruptedException, IOException { boolean result = true; final NWDIBuild nwdiBuild = (NWDIBuild) build; final AntHelper antHelper = new AntHelper(FilePathHelper.makeAbsolute(build.getWorkspace()), nwdiBuild.getDevelopmentComponentFactory()); final SonarPomGenerator pomGenerator = new SonarPomGenerator(antHelper, nwdiBuild.getDevelopmentComponentFactory(), new VelocityHelper().getVelocityEngine(), nwdiBuild.getNumber()); String pomLocation = ""; final MavenInstallation maven = getRequiredMavenInstallation(launcher); if (maven != null) { // FIXME: get JVM options from configuration. final String jvmOptions = ""; final String properties = ""; for (final DevelopmentComponent component : nwdiBuild .getAffectedDevelopmentComponents(new DCWithJavaSourceAcceptingFilter())) { if (component.getCompartment() != null) { if (!antHelper.createSourceFileSets(component).isEmpty() || !component.getResourceFolders().isEmpty()) { try { pomLocation = String.format("%s/sonar-pom.xml", antHelper.getBaseLocation(component)); pomGenerator.execute(component, new FileWriter(pomLocation)); DevelopmentComponentType componentType = component.getType(); if (DevelopmentComponentType.J2EEEjbModule.equals(componentType) || DevelopmentComponentType.J2EEWebModule.equals(componentType) || DevelopmentComponentType.J2EE.equals(componentType) || DevelopmentComponentType.Java.equals(componentType)) { result |= new Maven("test sonar:sonar", maven.getName(), pomLocation, properties, jvmOptions).perform(nwdiBuild, launcher, listener); listener.getLogger().println(String.format("Component %s is of type %s.", component.getName(), component.getType())); } if (componentType.equals(DevelopmentComponentType.J2EEWebModule)) { result |= new Maven("sonar:sonar", maven.getName(), pomLocation, properties, jvmOptions) .perform(nwdiBuild, launcher, listener); // + " -Dsonar.language=js" } else { listener.getLogger().println( String.format("Component %s is not a web module.", component.getName())); } } catch (final IOException ioe) { Logger.getLogger("NWDI-Sonar-Plugin") .warning(String.format("Could not create %s:\n%s", pomLocation, ioe.getMessage())); } } else { listener.getLogger().println(String.format("Component %s has empty source or resource folders.", component.getName())); } } else { listener.getLogger().println( String.format("%s:%s has no compartment!", component.getVendor(), component.getName())); } } } else { listener.getLogger().println("No Maven installation found!"); } return result; } private MavenInstallation getRequiredMavenInstallation(final Launcher launcher) throws IOException, InterruptedException { final MavenInstallation.DescriptorImpl descriptor = ToolInstallation.all() .get(MavenInstallation.DescriptorImpl.class); final MavenInstallation[] installations = descriptor.getInstallations(); MavenInstallation maven = null; for (final MavenInstallation installation : installations) { if (installation.getExists() && installation.meetsMavenReqVersion(launcher, MavenInstallation.MAVEN_30)) { maven = installation; } } if (installations.length > 0) { maven = installations[0]; } return maven; } /** * {@inheritDoc} */ @Override public DescriptorImpl getDescriptor() { return DESCRIPTOR; } /** * Descriptor for {@link SonarBuilder}. */ public static final class DescriptorImpl extends BuildStepDescriptor<Builder> { /** * Create descriptor for NWDI-CheckStyle-Builder and load global configuration * data. */ public DescriptorImpl() { load(); } /** * * {@inheritDoc} */ @Override public boolean isApplicable(final Class<? extends AbstractProject> aClass) { return NWDIProject.class.equals(aClass); } /** * This human readable name is used in the configuration screen. */ @Override public String getDisplayName() { return "NWDI Sonar Builder"; } } }
UTF-8
Java
5,828
java
SonarBuilder.java
Java
[ { "context": "etWeaver\n * development components.\n * \n * @author Dirk Weigenand\n */\npublic class SonarBuilder extends Builder {\n\t", "end": 1095, "score": 0.9998650550842285, "start": 1081, "tag": "NAME", "value": "Dirk Weigenand" } ]
null
[]
/** * */ package org.arachna.netweaver.sonar; import hudson.Extension; import hudson.Launcher; import hudson.model.BuildListener; import hudson.model.AbstractBuild; import hudson.model.AbstractProject; import hudson.tasks.BuildStepDescriptor; import hudson.tasks.Builder; import hudson.tasks.Maven; import hudson.tasks.Maven.MavenInstallation; import hudson.tools.ToolInstallation; import java.io.FileWriter; import java.io.IOException; import java.util.logging.Logger; import org.arachna.ant.AntHelper; import org.arachna.netweaver.dc.types.DevelopmentComponent; import org.arachna.netweaver.dc.types.DevelopmentComponentType; import org.arachna.netweaver.hudson.nwdi.DCWithJavaSourceAcceptingFilter; import org.arachna.netweaver.hudson.nwdi.NWDIBuild; import org.arachna.netweaver.hudson.nwdi.NWDIProject; import org.arachna.netweaver.hudson.util.FilePathHelper; import org.arachna.velocity.VelocityHelper; import org.kohsuke.stapler.DataBoundConstructor; /** * Jenkins builder that executes the maven sonar plugin for NetWeaver * development components. * * @author <NAME> */ public class SonarBuilder extends Builder { /** * Descriptor for {@link SonarBuilder}. */ @Extension public static final DescriptorImpl DESCRIPTOR = new DescriptorImpl(); /** * Data bound constructor. Used for populating a {@link SonarBuilder} instance * from form fields in <code>config.jelly</code>. */ @DataBoundConstructor public SonarBuilder() { } /** * {@inheritDoc} */ @Override public boolean perform(final AbstractBuild<?, ?> build, final Launcher launcher, final BuildListener listener) throws InterruptedException, IOException { boolean result = true; final NWDIBuild nwdiBuild = (NWDIBuild) build; final AntHelper antHelper = new AntHelper(FilePathHelper.makeAbsolute(build.getWorkspace()), nwdiBuild.getDevelopmentComponentFactory()); final SonarPomGenerator pomGenerator = new SonarPomGenerator(antHelper, nwdiBuild.getDevelopmentComponentFactory(), new VelocityHelper().getVelocityEngine(), nwdiBuild.getNumber()); String pomLocation = ""; final MavenInstallation maven = getRequiredMavenInstallation(launcher); if (maven != null) { // FIXME: get JVM options from configuration. final String jvmOptions = ""; final String properties = ""; for (final DevelopmentComponent component : nwdiBuild .getAffectedDevelopmentComponents(new DCWithJavaSourceAcceptingFilter())) { if (component.getCompartment() != null) { if (!antHelper.createSourceFileSets(component).isEmpty() || !component.getResourceFolders().isEmpty()) { try { pomLocation = String.format("%s/sonar-pom.xml", antHelper.getBaseLocation(component)); pomGenerator.execute(component, new FileWriter(pomLocation)); DevelopmentComponentType componentType = component.getType(); if (DevelopmentComponentType.J2EEEjbModule.equals(componentType) || DevelopmentComponentType.J2EEWebModule.equals(componentType) || DevelopmentComponentType.J2EE.equals(componentType) || DevelopmentComponentType.Java.equals(componentType)) { result |= new Maven("test sonar:sonar", maven.getName(), pomLocation, properties, jvmOptions).perform(nwdiBuild, launcher, listener); listener.getLogger().println(String.format("Component %s is of type %s.", component.getName(), component.getType())); } if (componentType.equals(DevelopmentComponentType.J2EEWebModule)) { result |= new Maven("sonar:sonar", maven.getName(), pomLocation, properties, jvmOptions) .perform(nwdiBuild, launcher, listener); // + " -Dsonar.language=js" } else { listener.getLogger().println( String.format("Component %s is not a web module.", component.getName())); } } catch (final IOException ioe) { Logger.getLogger("NWDI-Sonar-Plugin") .warning(String.format("Could not create %s:\n%s", pomLocation, ioe.getMessage())); } } else { listener.getLogger().println(String.format("Component %s has empty source or resource folders.", component.getName())); } } else { listener.getLogger().println( String.format("%s:%s has no compartment!", component.getVendor(), component.getName())); } } } else { listener.getLogger().println("No Maven installation found!"); } return result; } private MavenInstallation getRequiredMavenInstallation(final Launcher launcher) throws IOException, InterruptedException { final MavenInstallation.DescriptorImpl descriptor = ToolInstallation.all() .get(MavenInstallation.DescriptorImpl.class); final MavenInstallation[] installations = descriptor.getInstallations(); MavenInstallation maven = null; for (final MavenInstallation installation : installations) { if (installation.getExists() && installation.meetsMavenReqVersion(launcher, MavenInstallation.MAVEN_30)) { maven = installation; } } if (installations.length > 0) { maven = installations[0]; } return maven; } /** * {@inheritDoc} */ @Override public DescriptorImpl getDescriptor() { return DESCRIPTOR; } /** * Descriptor for {@link SonarBuilder}. */ public static final class DescriptorImpl extends BuildStepDescriptor<Builder> { /** * Create descriptor for NWDI-CheckStyle-Builder and load global configuration * data. */ public DescriptorImpl() { load(); } /** * * {@inheritDoc} */ @Override public boolean isApplicable(final Class<? extends AbstractProject> aClass) { return NWDIProject.class.equals(aClass); } /** * This human readable name is used in the configuration screen. */ @Override public String getDisplayName() { return "NWDI Sonar Builder"; } } }
5,820
0.724091
0.722718
180
31.377777
30.208563
121
false
false
0
0
0
0
0
0
2.877778
false
false
13
643abf7fd4e386db782cef3bdc33d40e79ef8af2
27,015,344,355,990
635f1ccbce0f7d34f828dd79147694fc1b23af8a
/app/src/main/java/org/d3ifcool/finpro/core/models/Plotting.java
cc5678c03ac3af54b1a68c3fa209811f724b703f
[]
no_license
haryandrafatwa/tugas_akhir
https://github.com/haryandrafatwa/tugas_akhir
b6c80785a1e37dcea309a7ba83cd692041434227
786b358a5b35f3acec9a8846b03a16ae1e4774b2
refs/heads/master
2023-07-18T13:03:44.059000
2021-08-13T11:59:47
2021-08-13T11:59:47
360,329,277
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.d3ifcool.finpro.core.models; import android.os.Build; import android.os.Parcel; import android.os.Parcelable; import androidx.annotation.RequiresApi; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; /** * Created by Faisal Amir * FrogoBox Inc License * ========================================= * Finpro * Copyright (C) 27/01/2019. * All rights reserved * ----------------------------------------- * Name : Muhammad Faisal Amir * E-mail : faisalamircs@gmail.com * Line : bullbee117 * Phone : 081357108568 * Majors : D3 Teknik Informatika 2016 * Campus : Telkom University * ----------------------------------------- * id.amirisback.frogobox */ public class Plotting implements Parcelable { @Expose @SerializedName("id") private int id; @Expose @SerializedName("nip_dosen_1") private String nip_dosen_1; @Expose @SerializedName("nama_dosen_1") private String nama_dosen_1; @Expose @SerializedName("kode_dosen_1") private String kode_dosen_1; @Expose @SerializedName("kode_dosen_2") private String kode_dosen_2; @Expose @SerializedName("nip_dosen_2") private String nip_dosen_2; @Expose @SerializedName("nama_dosen_2") private String nama_dosen_2; @Expose @SerializedName("nip_pembimbing_1") private String nip_pembimbing_1; @Expose @SerializedName("nama_pembimbing_1") private String nama_pembimbing_1; @Expose @SerializedName("kode_pembimbing_1") private String kode_pembimbing_1; @Expose @SerializedName("kode_pembimbing_2") private String kode_pembimbing_2; @Expose @SerializedName("nip_pembimbing_2") private String nip_pembimbing_2; @Expose @SerializedName("nama_pembimbing_2") private String nama_pembimbing_2; @Expose @SerializedName("success") private int success; @Expose @SerializedName("message") private String message; public Plotting(int success, String message) { this.success = success; this.message = message; } public Plotting(int id, String nip_pembimbing_1, String nama_pembimbing_1, String kode_pembimbing_1, String kode_pembimbing_2, String nip_pembimbing_2, String nama_pembimbing_2, String message, int success) { this.id = id; this.nip_pembimbing_1 = nip_pembimbing_1; this.nama_pembimbing_1 = nama_pembimbing_1; this.kode_pembimbing_1 = kode_pembimbing_1; this.kode_pembimbing_2 = kode_pembimbing_2; this.nip_pembimbing_2 = nip_pembimbing_2; this.nama_pembimbing_2 = nama_pembimbing_2; this.success = success; this.message = message; } public Plotting(int id, String nip_dosen_1, String nama_dosen_1, String kode_dosen_1, String kode_dosen_2, String nip_dosen_2, String nama_dosen_2, int success, String message) { this.id = id; this.nip_dosen_1 = nip_dosen_1; this.nama_dosen_1 = nama_dosen_1; this.kode_dosen_1 = kode_dosen_1; this.kode_dosen_2 = kode_dosen_2; this.nip_dosen_2 = nip_dosen_2; this.nama_dosen_2 = nama_dosen_2; this.success = success; this.message = message; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNip_pembimbing_1() { return nip_pembimbing_1; } public void setNip_pembimbing_1(String nip_pembimbing_1) { this.nip_pembimbing_1 = nip_pembimbing_1; } public String getNama_pembimbing_1() { return nama_pembimbing_1; } public void setNama_pembimbing_1(String nama_pembimbing_1) { this.nama_pembimbing_1 = nama_pembimbing_1; } public String getKode_pembimbing_1() { return kode_pembimbing_1; } public void setKode_pembimbing_1(String kode_pembimbing_1) { this.kode_pembimbing_1 = kode_pembimbing_1; } public String getKode_pembimbing_2() { return kode_pembimbing_2; } public void setKode_pembimbing_2(String kode_pembimbing_2) { this.kode_pembimbing_2 = kode_pembimbing_2; } public String getNip_pembimbing_2() { return nip_pembimbing_2; } public void setNip_pembimbing_2(String nip_pembimbing_2) { this.nip_pembimbing_2 = nip_pembimbing_2; } public String getNama_pembimbing_2() { return nama_pembimbing_2; } public void setNama_pembimbing_2(String nama_pembimbing_2) { this.nama_pembimbing_2 = nama_pembimbing_2; } public int getSuccess() { return success; } public void setSuccess(int success) { this.success = success; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getNip_dosen_1() { return nip_dosen_1; } public void setNip_dosen_1(String nip_dosen_1) { this.nip_dosen_1 = nip_dosen_1; } public String getNama_dosen_1() { return nama_dosen_1; } public void setNama_dosen_1(String nama_dosen_1) { this.nama_dosen_1 = nama_dosen_1; } public String getKode_dosen_1() { return kode_dosen_1; } public void setKode_dosen_1(String kode_dosen_1) { this.kode_dosen_1 = kode_dosen_1; } public String getKode_dosen_2() { return kode_dosen_2; } public void setKode_dosen_2(String kode_dosen_2) { this.kode_dosen_2 = kode_dosen_2; } public String getNip_dosen_2() { return nip_dosen_2; } public void setNip_dosen_2(String nip_dosen_2) { this.nip_dosen_2 = nip_dosen_2; } public String getNama_dosen_2() { return nama_dosen_2; } public void setNama_dosen_2(String nama_dosen_2) { this.nama_dosen_2 = nama_dosen_2; } public static Creator<Plotting> getCREATOR() { return CREATOR; } protected Plotting(Parcel in) { id = in.readInt(); nip_pembimbing_1 = in.readString(); nama_pembimbing_1 = in.readString(); kode_pembimbing_1 = in.readString(); nip_pembimbing_2 = in.readString(); nama_pembimbing_2 = in.readString(); kode_pembimbing_2 = in.readString(); nip_dosen_1 = in.readString(); nama_dosen_1 = in.readString(); kode_dosen_1 = in.readString(); nip_dosen_2 = in.readString(); nama_dosen_2 = in.readString(); kode_dosen_2 = in.readString(); success = in.readInt(); message = in.readString(); } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(id); dest.writeString(nip_pembimbing_1); dest.writeString(nama_pembimbing_1); dest.writeString(kode_pembimbing_1); dest.writeString(nip_pembimbing_2); dest.writeString(nama_pembimbing_2); dest.writeString(kode_pembimbing_2); dest.writeString(nip_dosen_1); dest.writeString(nama_dosen_1); dest.writeString(kode_dosen_1); dest.writeString(nip_dosen_2); dest.writeString(nama_dosen_2); dest.writeString(kode_dosen_2); dest.writeInt(success); dest.writeString(message); } @Override public int describeContents() { return 0; } public static final Creator<Plotting> CREATOR = new Creator<Plotting>() { @Override public Plotting createFromParcel(Parcel in) { return new Plotting(in); } @Override public Plotting[] newArray(int size) { return new Plotting[size]; } }; }
UTF-8
Java
7,774
java
Plotting.java
Java
[ { "context": "son.annotations.SerializedName;\n\n/**\n * Created by Faisal Amir\n * FrogoBox Inc License\n * ======================", "end": 289, "score": 0.9998893737792969, "start": 278, "tag": "NAME", "value": "Faisal Amir" }, { "context": "------------------------------------\n *...
null
[]
package org.d3ifcool.finpro.core.models; import android.os.Build; import android.os.Parcel; import android.os.Parcelable; import androidx.annotation.RequiresApi; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; /** * Created by <NAME> * FrogoBox Inc License * ========================================= * Finpro * Copyright (C) 27/01/2019. * All rights reserved * ----------------------------------------- * Name : <NAME> * E-mail : <EMAIL> * Line : bullbee117 * Phone : 081357108568 * Majors : D3 Teknik Informatika 2016 * Campus : Telkom University * ----------------------------------------- * id.amirisback.frogobox */ public class Plotting implements Parcelable { @Expose @SerializedName("id") private int id; @Expose @SerializedName("nip_dosen_1") private String nip_dosen_1; @Expose @SerializedName("nama_dosen_1") private String nama_dosen_1; @Expose @SerializedName("kode_dosen_1") private String kode_dosen_1; @Expose @SerializedName("kode_dosen_2") private String kode_dosen_2; @Expose @SerializedName("nip_dosen_2") private String nip_dosen_2; @Expose @SerializedName("nama_dosen_2") private String nama_dosen_2; @Expose @SerializedName("nip_pembimbing_1") private String nip_pembimbing_1; @Expose @SerializedName("nama_pembimbing_1") private String nama_pembimbing_1; @Expose @SerializedName("kode_pembimbing_1") private String kode_pembimbing_1; @Expose @SerializedName("kode_pembimbing_2") private String kode_pembimbing_2; @Expose @SerializedName("nip_pembimbing_2") private String nip_pembimbing_2; @Expose @SerializedName("nama_pembimbing_2") private String nama_pembimbing_2; @Expose @SerializedName("success") private int success; @Expose @SerializedName("message") private String message; public Plotting(int success, String message) { this.success = success; this.message = message; } public Plotting(int id, String nip_pembimbing_1, String nama_pembimbing_1, String kode_pembimbing_1, String kode_pembimbing_2, String nip_pembimbing_2, String nama_pembimbing_2, String message, int success) { this.id = id; this.nip_pembimbing_1 = nip_pembimbing_1; this.nama_pembimbing_1 = nama_pembimbing_1; this.kode_pembimbing_1 = kode_pembimbing_1; this.kode_pembimbing_2 = kode_pembimbing_2; this.nip_pembimbing_2 = nip_pembimbing_2; this.nama_pembimbing_2 = nama_pembimbing_2; this.success = success; this.message = message; } public Plotting(int id, String nip_dosen_1, String nama_dosen_1, String kode_dosen_1, String kode_dosen_2, String nip_dosen_2, String nama_dosen_2, int success, String message) { this.id = id; this.nip_dosen_1 = nip_dosen_1; this.nama_dosen_1 = nama_dosen_1; this.kode_dosen_1 = kode_dosen_1; this.kode_dosen_2 = kode_dosen_2; this.nip_dosen_2 = nip_dosen_2; this.nama_dosen_2 = nama_dosen_2; this.success = success; this.message = message; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNip_pembimbing_1() { return nip_pembimbing_1; } public void setNip_pembimbing_1(String nip_pembimbing_1) { this.nip_pembimbing_1 = nip_pembimbing_1; } public String getNama_pembimbing_1() { return nama_pembimbing_1; } public void setNama_pembimbing_1(String nama_pembimbing_1) { this.nama_pembimbing_1 = nama_pembimbing_1; } public String getKode_pembimbing_1() { return kode_pembimbing_1; } public void setKode_pembimbing_1(String kode_pembimbing_1) { this.kode_pembimbing_1 = kode_pembimbing_1; } public String getKode_pembimbing_2() { return kode_pembimbing_2; } public void setKode_pembimbing_2(String kode_pembimbing_2) { this.kode_pembimbing_2 = kode_pembimbing_2; } public String getNip_pembimbing_2() { return nip_pembimbing_2; } public void setNip_pembimbing_2(String nip_pembimbing_2) { this.nip_pembimbing_2 = nip_pembimbing_2; } public String getNama_pembimbing_2() { return nama_pembimbing_2; } public void setNama_pembimbing_2(String nama_pembimbing_2) { this.nama_pembimbing_2 = nama_pembimbing_2; } public int getSuccess() { return success; } public void setSuccess(int success) { this.success = success; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getNip_dosen_1() { return nip_dosen_1; } public void setNip_dosen_1(String nip_dosen_1) { this.nip_dosen_1 = nip_dosen_1; } public String getNama_dosen_1() { return nama_dosen_1; } public void setNama_dosen_1(String nama_dosen_1) { this.nama_dosen_1 = nama_dosen_1; } public String getKode_dosen_1() { return kode_dosen_1; } public void setKode_dosen_1(String kode_dosen_1) { this.kode_dosen_1 = kode_dosen_1; } public String getKode_dosen_2() { return kode_dosen_2; } public void setKode_dosen_2(String kode_dosen_2) { this.kode_dosen_2 = kode_dosen_2; } public String getNip_dosen_2() { return nip_dosen_2; } public void setNip_dosen_2(String nip_dosen_2) { this.nip_dosen_2 = nip_dosen_2; } public String getNama_dosen_2() { return nama_dosen_2; } public void setNama_dosen_2(String nama_dosen_2) { this.nama_dosen_2 = nama_dosen_2; } public static Creator<Plotting> getCREATOR() { return CREATOR; } protected Plotting(Parcel in) { id = in.readInt(); nip_pembimbing_1 = in.readString(); nama_pembimbing_1 = in.readString(); kode_pembimbing_1 = in.readString(); nip_pembimbing_2 = in.readString(); nama_pembimbing_2 = in.readString(); kode_pembimbing_2 = in.readString(); nip_dosen_1 = in.readString(); nama_dosen_1 = in.readString(); kode_dosen_1 = in.readString(); nip_dosen_2 = in.readString(); nama_dosen_2 = in.readString(); kode_dosen_2 = in.readString(); success = in.readInt(); message = in.readString(); } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(id); dest.writeString(nip_pembimbing_1); dest.writeString(nama_pembimbing_1); dest.writeString(kode_pembimbing_1); dest.writeString(nip_pembimbing_2); dest.writeString(nama_pembimbing_2); dest.writeString(kode_pembimbing_2); dest.writeString(nip_dosen_1); dest.writeString(nama_dosen_1); dest.writeString(kode_dosen_1); dest.writeString(nip_dosen_2); dest.writeString(nama_dosen_2); dest.writeString(kode_dosen_2); dest.writeInt(success); dest.writeString(message); } @Override public int describeContents() { return 0; } public static final Creator<Plotting> CREATOR = new Creator<Plotting>() { @Override public Plotting createFromParcel(Parcel in) { return new Plotting(in); } @Override public Plotting[] newArray(int size) { return new Plotting[size]; } }; }
7,740
0.614613
0.590687
298
25.087248
23.541889
212
false
false
0
0
0
0
0
0
0.419463
false
false
13
8a698531706effebbe07da010fe17f7a20202542
5,179,730,619,416
13e5f56207e5040728ca0e01047e4315452bc4bb
/src/com/ibeifeng/ssh/model/Employee.java
1a1fa9268c0881983285f9bfa2c1af90892fabc8
[]
no_license
hylaccount/database
https://github.com/hylaccount/database
3317c804161670fb2c1b35f3e2ee512a7412ccb2
6a36c960eecfc23fb2d84245bb740c7b96032914
refs/heads/master
2021-01-17T17:39:46.222000
2017-02-24T09:17:11
2017-02-24T09:17:11
83,009,216
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ibeifeng.ssh.model; import org.hibernate.annotations.GenericGenerator; import org.junit.Test; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; /** * Created by zmzy on 2017/2/17. */ @Entity @Table(name = "t_emp") public class Employee { private int id; private String name; private double salary; @Id @GenericGenerator(name = "mid",strategy = "native") @GeneratedValue(generator = "mid") public int getId() { return id; } public void setId(int id) { this.id = id; } 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; } }
UTF-8
Java
901
java
Employee.java
Java
[ { "context": "import javax.persistence.Table;\n\n/**\n * Created by zmzy on 2017/2/17.\n */\n@Entity\n@Table(name = \"t_emp\")\n", "end": 266, "score": 0.9996143579483032, "start": 262, "tag": "USERNAME", "value": "zmzy" } ]
null
[]
package com.ibeifeng.ssh.model; import org.hibernate.annotations.GenericGenerator; import org.junit.Test; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; /** * Created by zmzy on 2017/2/17. */ @Entity @Table(name = "t_emp") public class Employee { private int id; private String name; private double salary; @Id @GenericGenerator(name = "mid",strategy = "native") @GeneratedValue(generator = "mid") public int getId() { return id; } public void setId(int id) { this.id = id; } 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; } }
901
0.63818
0.630411
47
18.170214
15.190029
55
false
false
0
0
0
0
0
0
0.361702
false
false
13
014da88e4c49dd7a1f932b246705710b6106b270
16,681,652,982,122
efad64cf9e72ffefdd971f9d159f527cadecf743
/webserver/src/main/java/auth/webserver/service/impl/RoleServiceImpl.java
df91c83dfaa5782afe5ccf54f2a38bb89f2c0822
[]
no_license
Haobaoshui/auth
https://github.com/Haobaoshui/auth
98f166f0a4b95650b2ba0f8585b937e7968b72b9
d08ad15d5d02f8999d12e075a502ea0be90311de
refs/heads/main
2023-08-04T21:16:54.979000
2021-08-21T04:29:31
2021-08-21T04:29:31
397,822,433
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package auth.webserver.service.impl; import auth.webserver.model.Page; import auth.webserver.model.roles.Role; import auth.webserver.model.roles.RoleView; import auth.webserver.model.user.UserSessionInfo; import auth.webserver.repository.RoleRepository; import auth.webserver.service.LogsService; import auth.webserver.service.RolePermissionService; import auth.webserver.service.RoleService; import auth.webserver.utility.SessionUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; @Service public class RoleServiceImpl implements RoleService { private final RoleRepository roleRepository; private LogsService logsService; @Autowired RolePermissionService rolePermissionService; @Autowired public RoleServiceImpl(RoleRepository roleRepository, LogsService logsService) { this.roleRepository = roleRepository; this.logsService = logsService; } @Override public String add(Role role) { UserSessionInfo userinfo = SessionUser.getSessionUser(); if (userinfo == null) return null; if (isExistByName(role.getName())) return null; String id = roleRepository.add(role); if (id != null) { role.setId(id); //日志:增加用户 logsService.addLog(role); } return id; } @Override public String add(String name) { return roleRepository.add(name); } @Override public int deleteById(String id) { return roleRepository.deleteById(id); } @Override public int delete(Role role) { if (role == null || role.getId() == null) return 0; UserSessionInfo userinfo = SessionUser.getSessionUser(); if (userinfo == null) return 0; Role roleDeleted = getById(role.getId()); if (roleDeleted == null) return 0; int result = roleRepository.delete(role); //日志:删除用户 logsService.deleteLog(roleDeleted); return result; } @Override public int deleteAll() { return roleRepository.deleteAll(); } @Override public int update(Role role) { UserSessionInfo userinfo = SessionUser.getSessionUser(); if (userinfo == null) return 0; if (!roleRepository.isExistById(role.getId())) return 0; int result = roleRepository.update(role); role = getById(role.getId()); //日志:更新用户 logsService.updateLog(role); return result; } @Override public int update(String id, String name) { return roleRepository.update(id, name); } @Override public boolean isExistById(String id) { return roleRepository.isExistById(id); } @Override public boolean isExistByName(String name) { return roleRepository.isExistByName(name); } @Override public int getCount() { return roleRepository.getCount(); } @Override public int getLikeNameCount(String name) { return roleRepository.getLikeNameCount(name); } @Override public Role getById(String id) { return roleRepository.getById(id); } @Override public List<Role> getByLikeName(String name) { return roleRepository.getByLikeName(name); } @Override public List<Role> getAll() { return roleRepository.getAll(); } @Override public Page<Role> getPage(int pageNo, int pageSize) { return roleRepository.getPage(pageNo, pageSize); } @Override public Page<Role> getSearchedPage(String searchText, Integer pageNo, Integer pageSize) { return roleRepository.getPage(searchText, pageNo, pageSize); } @Override public List<RoleView> getAllRoleViews() { List<Role> roleList = roleRepository.getAll(); if (roleList == null || roleList.size() == 0) return null; List<RoleView> roleViewList = new ArrayList<>(); for (Role role : roleList) { RoleView roleView = new RoleView(); roleView.setRole(role); roleView.setPermissionList(rolePermissionService.getPermissionsByRoleId(role.getId())); roleViewList.add(roleView); } return roleViewList; } @Override public Page<RoleView> getViewPage(int pageNo, int pageSize) { Page<Role> rolePage = roleRepository.getPage(pageNo, pageSize); if (rolePage == null) return null; List<RoleView> roleViewList = new ArrayList<>(); for (Role role : rolePage.getResult()) { RoleView roleView = new RoleView(); roleView.setRole(role); roleView.setPermissionList(rolePermissionService.getPermissionsByRoleId(role.getId())); roleViewList.add(roleView); } return new Page<>(rolePage.getStart(), rolePage.getTotalCount(), pageSize, roleViewList); } }
UTF-8
Java
5,013
java
RoleServiceImpl.java
Java
[]
null
[]
package auth.webserver.service.impl; import auth.webserver.model.Page; import auth.webserver.model.roles.Role; import auth.webserver.model.roles.RoleView; import auth.webserver.model.user.UserSessionInfo; import auth.webserver.repository.RoleRepository; import auth.webserver.service.LogsService; import auth.webserver.service.RolePermissionService; import auth.webserver.service.RoleService; import auth.webserver.utility.SessionUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; @Service public class RoleServiceImpl implements RoleService { private final RoleRepository roleRepository; private LogsService logsService; @Autowired RolePermissionService rolePermissionService; @Autowired public RoleServiceImpl(RoleRepository roleRepository, LogsService logsService) { this.roleRepository = roleRepository; this.logsService = logsService; } @Override public String add(Role role) { UserSessionInfo userinfo = SessionUser.getSessionUser(); if (userinfo == null) return null; if (isExistByName(role.getName())) return null; String id = roleRepository.add(role); if (id != null) { role.setId(id); //日志:增加用户 logsService.addLog(role); } return id; } @Override public String add(String name) { return roleRepository.add(name); } @Override public int deleteById(String id) { return roleRepository.deleteById(id); } @Override public int delete(Role role) { if (role == null || role.getId() == null) return 0; UserSessionInfo userinfo = SessionUser.getSessionUser(); if (userinfo == null) return 0; Role roleDeleted = getById(role.getId()); if (roleDeleted == null) return 0; int result = roleRepository.delete(role); //日志:删除用户 logsService.deleteLog(roleDeleted); return result; } @Override public int deleteAll() { return roleRepository.deleteAll(); } @Override public int update(Role role) { UserSessionInfo userinfo = SessionUser.getSessionUser(); if (userinfo == null) return 0; if (!roleRepository.isExistById(role.getId())) return 0; int result = roleRepository.update(role); role = getById(role.getId()); //日志:更新用户 logsService.updateLog(role); return result; } @Override public int update(String id, String name) { return roleRepository.update(id, name); } @Override public boolean isExistById(String id) { return roleRepository.isExistById(id); } @Override public boolean isExistByName(String name) { return roleRepository.isExistByName(name); } @Override public int getCount() { return roleRepository.getCount(); } @Override public int getLikeNameCount(String name) { return roleRepository.getLikeNameCount(name); } @Override public Role getById(String id) { return roleRepository.getById(id); } @Override public List<Role> getByLikeName(String name) { return roleRepository.getByLikeName(name); } @Override public List<Role> getAll() { return roleRepository.getAll(); } @Override public Page<Role> getPage(int pageNo, int pageSize) { return roleRepository.getPage(pageNo, pageSize); } @Override public Page<Role> getSearchedPage(String searchText, Integer pageNo, Integer pageSize) { return roleRepository.getPage(searchText, pageNo, pageSize); } @Override public List<RoleView> getAllRoleViews() { List<Role> roleList = roleRepository.getAll(); if (roleList == null || roleList.size() == 0) return null; List<RoleView> roleViewList = new ArrayList<>(); for (Role role : roleList) { RoleView roleView = new RoleView(); roleView.setRole(role); roleView.setPermissionList(rolePermissionService.getPermissionsByRoleId(role.getId())); roleViewList.add(roleView); } return roleViewList; } @Override public Page<RoleView> getViewPage(int pageNo, int pageSize) { Page<Role> rolePage = roleRepository.getPage(pageNo, pageSize); if (rolePage == null) return null; List<RoleView> roleViewList = new ArrayList<>(); for (Role role : rolePage.getResult()) { RoleView roleView = new RoleView(); roleView.setRole(role); roleView.setPermissionList(rolePermissionService.getPermissionsByRoleId(role.getId())); roleViewList.add(roleView); } return new Page<>(rolePage.getStart(), rolePage.getTotalCount(), pageSize, roleViewList); } }
5,013
0.654812
0.653607
198
24.136364
24.083118
99
false
false
0
0
0
0
0
0
0.444444
false
false
13
61b4689f84607e6c9312bb1ade1bb93f2dc6a4be
18,872,086,309,872
306d2b6b8868aa3e80c03e1f54f36f1bc9f84191
/publit-io/src/main/java/com/publit/publit_io/utils/SHAGenerator.java
f701338f7196a8c32e011f4afaf10250a68ea0f6
[]
no_license
ob1y2k/publitio_android_sdk
https://github.com/ob1y2k/publitio_android_sdk
5d92b6bf852b2a26cdc30073dd3b512e2bff89fa
d9f63dab0ad40992925ae9e37bbf58de477cd24d
refs/heads/master
2021-06-22T03:56:30.339000
2019-12-02T14:49:12
2019-12-02T14:49:12
148,630,329
7
6
null
false
2021-01-16T09:49:24
2018-09-13T11:51:56
2021-01-16T09:45:55
2019-12-02T14:50:14
19,953
6
4
1
Java
false
false
package com.publit.publit_io.utils; import com.publit.publit_io.constant.Constant; import com.publit.publit_io.exception.PublitioExceptions; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Date; import java.util.Random; public class SHAGenerator { //API timestamp is the current UNIX timestamp (32 bits signed integer). private String apiTimeStamp; //API nonce is an 8 digits random number. private String apiNonce; //SHA-1 digest of the api_secret, api_timestamp and api_nonce. private String apiSignature; //To check valid api-key and api-secret. private boolean isValidated = false; //Public Constructor public SHAGenerator() { try { isValidated = validateAPI(APIConfiguration.apiKey, APIConfiguration.apiSecret); } catch (PublitioExceptions publitioExceptions) { publitioExceptions.printStackTrace(); } generateSHA(); } /** * Generate SHA-1 digest of the apiTimeStamp, apiNonce and apiSecret. */ private void generateSHA() { //Generate current api time stamp. apiTimeStamp = String.valueOf(new Date().getTime() / 1000); //Generate 8 digit random number. Random rnd = new Random(); apiNonce = String.valueOf(10000000L + ((long) rnd.nextInt(900000) * 100) + rnd.nextInt(100)); if (isValidated) { String concatinatedString = apiTimeStamp.concat(apiNonce).concat(APIConfiguration.apiSecret); apiSignature = hashString(concatinatedString, Constant.ALGORITHM); } } /** * @param concatinatedString It is used to generate SHA-1 digest. * @param algorithm The name of the algorithm requested. * @return Hex String which is used as api signature. */ private String hashString(String concatinatedString, String algorithm) { try { MessageDigest digest = MessageDigest.getInstance(algorithm); byte[] hashedBytes = digest.digest(concatinatedString.getBytes("UTF-8")); return convertByteArrayToHexString(hashedBytes); } catch (NoSuchAlgorithmException | UnsupportedEncodingException ex) { return ""; } } /** * @param hashedBytes Byte Array from which the api signature will generated. * @return api signature. */ private String convertByteArrayToHexString(byte[] hashedBytes) { StringBuilder stringBuffer = new StringBuilder(); for (byte hashedByte : hashedBytes) { stringBuffer.append(Integer.toString((hashedByte & 0xff) + 0x100, 16) .substring(1)); } return stringBuffer.toString(); } /** * To check the null or empty value for api key and api secret. * * @param apiKey API key identifies the user to the API. * @param apiSecret API secret is used to generate SHA-1 digest. * @return Boolean(True / False) value which indicates validations. */ private boolean validateAPI(String apiKey, String apiSecret) throws PublitioExceptions { if (apiSecret == null || apiSecret.isEmpty() || apiKey == null || apiKey.isEmpty()) { throw new PublitioExceptions("Publitio API key or API secret is not set."); } return true; } /** * Gives the current time stamp. * * @return The current time stamp. */ public String getApiTimeStamp() { return apiTimeStamp; } /** * Gives the 8 digit api nonce. * * @return The 8 digit api nonce. */ public String getApiNonce() { return apiNonce; } /** * Gives the api signature. * * @return The api signature. */ public String getApiSignature() { return apiSignature; } }
UTF-8
Java
3,910
java
SHAGenerator.java
Java
[]
null
[]
package com.publit.publit_io.utils; import com.publit.publit_io.constant.Constant; import com.publit.publit_io.exception.PublitioExceptions; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Date; import java.util.Random; public class SHAGenerator { //API timestamp is the current UNIX timestamp (32 bits signed integer). private String apiTimeStamp; //API nonce is an 8 digits random number. private String apiNonce; //SHA-1 digest of the api_secret, api_timestamp and api_nonce. private String apiSignature; //To check valid api-key and api-secret. private boolean isValidated = false; //Public Constructor public SHAGenerator() { try { isValidated = validateAPI(APIConfiguration.apiKey, APIConfiguration.apiSecret); } catch (PublitioExceptions publitioExceptions) { publitioExceptions.printStackTrace(); } generateSHA(); } /** * Generate SHA-1 digest of the apiTimeStamp, apiNonce and apiSecret. */ private void generateSHA() { //Generate current api time stamp. apiTimeStamp = String.valueOf(new Date().getTime() / 1000); //Generate 8 digit random number. Random rnd = new Random(); apiNonce = String.valueOf(10000000L + ((long) rnd.nextInt(900000) * 100) + rnd.nextInt(100)); if (isValidated) { String concatinatedString = apiTimeStamp.concat(apiNonce).concat(APIConfiguration.apiSecret); apiSignature = hashString(concatinatedString, Constant.ALGORITHM); } } /** * @param concatinatedString It is used to generate SHA-1 digest. * @param algorithm The name of the algorithm requested. * @return Hex String which is used as api signature. */ private String hashString(String concatinatedString, String algorithm) { try { MessageDigest digest = MessageDigest.getInstance(algorithm); byte[] hashedBytes = digest.digest(concatinatedString.getBytes("UTF-8")); return convertByteArrayToHexString(hashedBytes); } catch (NoSuchAlgorithmException | UnsupportedEncodingException ex) { return ""; } } /** * @param hashedBytes Byte Array from which the api signature will generated. * @return api signature. */ private String convertByteArrayToHexString(byte[] hashedBytes) { StringBuilder stringBuffer = new StringBuilder(); for (byte hashedByte : hashedBytes) { stringBuffer.append(Integer.toString((hashedByte & 0xff) + 0x100, 16) .substring(1)); } return stringBuffer.toString(); } /** * To check the null or empty value for api key and api secret. * * @param apiKey API key identifies the user to the API. * @param apiSecret API secret is used to generate SHA-1 digest. * @return Boolean(True / False) value which indicates validations. */ private boolean validateAPI(String apiKey, String apiSecret) throws PublitioExceptions { if (apiSecret == null || apiSecret.isEmpty() || apiKey == null || apiKey.isEmpty()) { throw new PublitioExceptions("Publitio API key or API secret is not set."); } return true; } /** * Gives the current time stamp. * * @return The current time stamp. */ public String getApiTimeStamp() { return apiTimeStamp; } /** * Gives the 8 digit api nonce. * * @return The 8 digit api nonce. */ public String getApiNonce() { return apiNonce; } /** * Gives the api signature. * * @return The api signature. */ public String getApiSignature() { return apiSignature; } }
3,910
0.644501
0.633504
128
29.546875
28.7089
105
false
false
0
0
0
0
0
0
0.359375
false
false
13
fcea3c10630eb650330bb97c118aecae0e92b4bd
1,503,238,577,307
86e5eded3571832d51a88fddeeb2518f901598ff
/src/de/freiburg/uni/iig/sisi/model/safetyrequirements/UsageControl.java
604ef63be9b74dad182416bcc15c62538b59c944
[]
no_license
sebald/SiSi
https://github.com/sebald/SiSi
e536ccfabefeee1033c13a243fccb5ad405295bf
08ecd7d6a213126b9cb4d1b759387c46e7f76082
refs/heads/master
2016-09-06T08:01:04.428000
2012-07-17T12:50:50
2012-07-17T12:50:50
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.freiburg.uni.iig.sisi.model.safetyrequirements; import de.freiburg.uni.iig.sisi.model.ModelObject; import de.freiburg.uni.iig.sisi.model.net.Transition; public class UsageControl extends ModelObject { public enum UsageControlType { USAGE_RESTRICTION("UR"), ACTION_REQUIREMENT("AR"), UNKNOWN("unkown"); private String abbreviation; private UsageControlType(String s) { abbreviation = s; } @Override public String toString() { return abbreviation; } } private final UsageControlType type; private final Transition objective; private final Transition eventually; public UsageControl(String id, String name, String type, Transition objective, Transition eventually) { super(id, name); this.objective = objective; this.eventually = eventually; switch (type) { case "ur": this.type = UsageControlType.USAGE_RESTRICTION; break; case "ar": this.type = UsageControlType.ACTION_REQUIREMENT; break; default: this.type = UsageControlType.UNKNOWN; break; } } public Transition getObjective() { return objective; } public Transition getEventually() { return eventually; } public UsageControlType getType() { return type; } }
UTF-8
Java
1,239
java
UsageControl.java
Java
[]
null
[]
package de.freiburg.uni.iig.sisi.model.safetyrequirements; import de.freiburg.uni.iig.sisi.model.ModelObject; import de.freiburg.uni.iig.sisi.model.net.Transition; public class UsageControl extends ModelObject { public enum UsageControlType { USAGE_RESTRICTION("UR"), ACTION_REQUIREMENT("AR"), UNKNOWN("unkown"); private String abbreviation; private UsageControlType(String s) { abbreviation = s; } @Override public String toString() { return abbreviation; } } private final UsageControlType type; private final Transition objective; private final Transition eventually; public UsageControl(String id, String name, String type, Transition objective, Transition eventually) { super(id, name); this.objective = objective; this.eventually = eventually; switch (type) { case "ur": this.type = UsageControlType.USAGE_RESTRICTION; break; case "ar": this.type = UsageControlType.ACTION_REQUIREMENT; break; default: this.type = UsageControlType.UNKNOWN; break; } } public Transition getObjective() { return objective; } public Transition getEventually() { return eventually; } public UsageControlType getType() { return type; } }
1,239
0.7159
0.7159
61
19.311476
20.145813
104
false
false
0
0
0
0
0
0
2.081967
false
false
13
9710462729ade351fc4ec4cb1276a86e70e6ac69
16,269,336,134,178
29ae0c7c20dc13ecb0445159bf49e0987d2d16bb
/src/main/java/com/rs/epl/NB/service/ReciptPushToFg.java
609c87aaf576d2a9a6ab590c1cf13728c0f53768
[]
no_license
Nandhacs7/EPL
https://github.com/Nandhacs7/EPL
8f7fab7926d7ad63d627f47adf22c9dc25b6f487
0ab5fb90ddb37c13ce7eba230d76459a73d2a96b
refs/heads/master
2021-07-19T16:59:50.786000
2017-10-30T11:02:57
2017-10-30T11:02:57
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rs.epl.NB.service; import java.io.FileNotFoundException; import java.io.IOException; import javax.xml.bind.JAXBException; import com.fa.component.policy.Policy; import com.rs.epl.NB.policyrepository.Status; public interface ReciptPushToFg { public String ReciptpushToFg(Policy poltst, Status oemstatus) throws JAXBException, FileNotFoundException, IOException; }
UTF-8
Java
393
java
ReciptPushToFg.java
Java
[]
null
[]
package com.rs.epl.NB.service; import java.io.FileNotFoundException; import java.io.IOException; import javax.xml.bind.JAXBException; import com.fa.component.policy.Policy; import com.rs.epl.NB.policyrepository.Status; public interface ReciptPushToFg { public String ReciptpushToFg(Policy poltst, Status oemstatus) throws JAXBException, FileNotFoundException, IOException; }
393
0.798982
0.798982
13
28.23077
31.491522
120
false
false
0
0
0
0
0
0
0.846154
false
false
13
5f4a0199ac96c0a408d5699d035c565e9d9ebc6e
28,458,453,314,735
e236796f2f5ac94914f24a8d349d6612bd9f1693
/hgshop-goods-service/src/main/java/com/wjiayi/hgshop/dao/SpecDao.java
9834747dd8bffa00b554139f088cd239eac34e80
[]
no_license
WeiJiaYi-afk/wjiayi-hgshop
https://github.com/WeiJiaYi-afk/wjiayi-hgshop
099492b88c447ccb98c18cef05fbce9fbb31567d
17900e9e0dfcb23e4da2515eab39664ff967a767
refs/heads/master
2022-12-22T10:30:10.811000
2020-04-09T07:55:39
2020-04-09T07:55:39
254,306,532
0
0
null
false
2022-12-15T23:58:31
2020-04-09T07:52:29
2020-04-09T08:08:01
2022-12-15T23:58:29
218,883
0
0
10
JavaScript
false
false
package com.wjiayi.hgshop.dao; import java.util.List; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import com.wjiayi.hgshop.pojo.Spec; import com.wjiayi.hgshop.pojo.SpecOption; public interface SpecDao { //添加 int addSpec(Spec spec); //添加子表 int addSpecOption(SpecOption specOption); //修改 int updateSpec(Spec spec); //详情,回显 Spec getById(Integer id); //批删 int deleteBatch(int[] ids); //删除子表 int deleteSpecOption(int id); //子表的批删 int deleteOptionBatch(int[] ids); //查询 List<Spec> list(Spec spec); //查询所有的规格 @Select("select id,spec_name specName from hg_spec order by spec_name") List<Spec> listAll(); //根据spuId查询一条数据 List<SpecOption> listOptionsBySpecId(@Param("value")Integer spuId); }
UTF-8
Java
871
java
SpecDao.java
Java
[]
null
[]
package com.wjiayi.hgshop.dao; import java.util.List; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import com.wjiayi.hgshop.pojo.Spec; import com.wjiayi.hgshop.pojo.SpecOption; public interface SpecDao { //添加 int addSpec(Spec spec); //添加子表 int addSpecOption(SpecOption specOption); //修改 int updateSpec(Spec spec); //详情,回显 Spec getById(Integer id); //批删 int deleteBatch(int[] ids); //删除子表 int deleteSpecOption(int id); //子表的批删 int deleteOptionBatch(int[] ids); //查询 List<Spec> list(Spec spec); //查询所有的规格 @Select("select id,spec_name specName from hg_spec order by spec_name") List<Spec> listAll(); //根据spuId查询一条数据 List<SpecOption> listOptionsBySpecId(@Param("value")Integer spuId); }
871
0.708492
0.708492
35
20.542856
18.76523
72
false
false
0
0
0
0
0
0
1.085714
false
false
13
8c95ac558ba196c8ea8bd926aff0d5a3cd50856b
15,839,839,390,255
152f67331dfeafd4bf51fbc88dd212b1462656ba
/src/main/java/org/com/controller/XDorm.java
0f3eab64382b4079b1321b4cf737d6df9632ef51
[]
no_license
zhengke947083276/gongyu
https://github.com/zhengke947083276/gongyu
fdf0d9ffcf937ad31dba4e51c279ce93983cf3f4
f3c2b152779b8bb8a2c981bdf05bd898ccc06f60
refs/heads/master
2020-03-18T12:14:22.782000
2018-06-25T09:41:06
2018-06-25T09:41:06
134,716,505
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.com.controller; import org.apache.poi.hssf.usermodel.*; import org.com.entity.TblDorm; import org.com.entity.User; import org.com.service.TblDormService; import org.com.view.ViewExcel; import org.com.view.ViewPDF; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.portlet.ModelAndView; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @Controller public class XDorm { @Autowired TblDormService tblDormService; @RequestMapping(value = "/excel") public ModelAndView viewExcel() { Map<String, Object> model = new HashMap<>(); List<TblDorm> tblDorms = tblDormService.selectAll(); model.put("tblDormList", tblDorms); return new ModelAndView(new ViewExcel(), model); } // @RequestMapping("/pdf") // public ModelAndView viewPDF(){ // Map<String, Object> model = new HashMap<>(); // model.put("userList", getStudents()); // return new ModelAndView(new ViewPDF(), model); // } @RequestMapping("/pdf") public ModelAndView viewPDF(){ ModelAndView mv = new ModelAndView(); ViewPDF viewPDF = new ViewPDF(); mv.setView(viewPDF); return mv; } private List<User> getStudents() { List<User> userList = new ArrayList<>(); User user = new User(1,"zhengke1", "0000",12,"男"); User user1 = new User(2,"zhengke1", "0000",13,"男"); userList.add(user); userList.add(user1); return userList; } }
UTF-8
Java
1,893
java
XDorm.java
Java
[ { "context": "ew ArrayList<>();\n User user = new User(1,\"zhengke1\", \"0000\",12,\"男\");\n User user1 = new User(2", "end": 1720, "score": 0.9996384382247925, "start": 1712, "tag": "USERNAME", "value": "zhengke1" }, { "context": " \"0000\",12,\"男\");\n User use...
null
[]
package org.com.controller; import org.apache.poi.hssf.usermodel.*; import org.com.entity.TblDorm; import org.com.entity.User; import org.com.service.TblDormService; import org.com.view.ViewExcel; import org.com.view.ViewPDF; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.portlet.ModelAndView; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @Controller public class XDorm { @Autowired TblDormService tblDormService; @RequestMapping(value = "/excel") public ModelAndView viewExcel() { Map<String, Object> model = new HashMap<>(); List<TblDorm> tblDorms = tblDormService.selectAll(); model.put("tblDormList", tblDorms); return new ModelAndView(new ViewExcel(), model); } // @RequestMapping("/pdf") // public ModelAndView viewPDF(){ // Map<String, Object> model = new HashMap<>(); // model.put("userList", getStudents()); // return new ModelAndView(new ViewPDF(), model); // } @RequestMapping("/pdf") public ModelAndView viewPDF(){ ModelAndView mv = new ModelAndView(); ViewPDF viewPDF = new ViewPDF(); mv.setView(viewPDF); return mv; } private List<User> getStudents() { List<User> userList = new ArrayList<>(); User user = new User(1,"zhengke1", "0000",12,"男"); User user1 = new User(2,"zhengke1", "0000",13,"男"); userList.add(user); userList.add(user1); return userList; } }
1,893
0.693489
0.68396
61
29.967213
19.065002
62
false
false
0
0
0
0
0
0
0.852459
false
false
13
278399e8c855b8d4b9a0c20b6066cdc951babda2
23,313,082,534,591
658fbd3de5e6d493123f519956e5be9f135ecb86
/src/main/java/com/rainsoft/oracle/LoadOracleData.java
1d0f2bead184ad82ea550aa1a84fb085f8c2b898
[]
no_license
weidongcao/beijingThirdPeriod
https://github.com/weidongcao/beijingThirdPeriod
622c3fbe4f3d39679576ce6d97c775f3ade8ca60
135ecb39ca6e113588f4db7efdaf502af6b052fa
refs/heads/master
2022-07-07T03:12:31.265000
2019-07-27T10:48:29
2019-07-27T10:48:29
94,533,083
6
0
null
false
2022-07-01T17:32:46
2017-06-16T10:22:37
2019-07-27T10:49:17
2022-07-01T17:32:45
9,193
6
0
6
Java
false
false
package com.rainsoft.oracle; import com.rainsoft.conf.ConfigurationManager; import com.rainsoft.jdbc.JDBCHelper; import com.rainsoft.utils.DateFormatUtils; import com.rainsoft.utils.JdbcUtils; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.RandomStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; import java.sql.ResultSetMetaData; import java.text.ParseException; import java.util.Date; /** * Oracle 数据导出 * Created by CaoWeiDong on 2017-08-05. */ public class LoadOracleData { private static final Logger logger = LoggerFactory.getLogger(LoadOracleData.class); // private static int maxFileDataSize = ConfigurationManager.getInteger("max_oracle_data_file_lines"); // private static String path = ConfigurationManager.getProperty("load_oracle_data_local_dir"); public static void main(String[] args) throws ParseException, IOException { String tableName = args[0]; String startTime = args[1]; String endTime = args[2]; String templateSql = "select * from ${tableName} where capture_time >= to_date('${startTime}' ,'YYYY-MM-DD HH24:MI:SS') and capture_time < to_date('${endTime}' ,'YYYY-MM-DD HH24:MI:SS')"; String sql = templateSql.replace("${tableName}", tableName); sql = sql.replace("${startTime}", startTime); sql = sql.replace("${endTime}", endTime); int maxFileDataSize = ConfigurationManager.getInteger("data.file.max.lines"); JDBCHelper helper = JDBCHelper.getInstance(); logger.info("开始执行sql: {}", sql); logger.info("数据文件本地生成目录: {}", ConfigurationManager.getProperty("load.data.workspace") + File.separator + "data" + File.separator + tableName); logger.info("文件生成后移动的目录: {}", ConfigurationManager.getProperty("load.data.workspace") + File.separator + "pool" + File.separator + tableName); helper.executeQueryBySql(sql, rs -> { logger.info("查询完成,开始处理数据..."); ResultSetMetaData rsm = rs.getMetaData(); int colSize = rsm.getColumnCount(); int fileDataSize = 0; int fileCount = 0; StringBuffer sb = new StringBuffer(); while (rs.next()) { for (int i = 1; i <= colSize; i++) { int type = rsm.getColumnType(i); if (i < colSize) { sb.append(JdbcUtils.getFieldValue(rs, type, i)).append("\t"); } else { sb.append(JdbcUtils.getFieldValue(rs, type, i)); } } sb.append("\r\n"); fileDataSize++; if (fileDataSize >= maxFileDataSize) { String fileName = writeStringToFile(sb, tableName); sb = new StringBuffer(); fileCount++; fileDataSize = 0; logger.info("sql返回结果生成第 {} 个数据文件,文件名{}", fileCount, fileName); } } if (sb.length() > 0) { String fileName = writeStringToFile(sb, tableName); fileCount++; logger.info("sql返回结果生成最后一个数据第 {} 个数据文件,文件名{}", fileCount, fileName); } logger.info("一次查询的数据处理完毕..."); }); } /** * 将查询出来的数据写入到文件 * * @param sb */ private static String writeStringToFile(StringBuffer sb, String tableName) { String constantPath = ConfigurationManager.getProperty("load.data.workspace"); //${basePath}/${workType}/${tableName}/${tableDataFileName} String filePathTemplate = constantPath + File.separator //${basePath} + "${dir}" + File.separator //${workType} + tableName + File.separator //${workType} + tableName + "_data_" + DateFormatUtils.NO_SEPARATOR_FORMAT.format(new Date()) + "${random}.tsv"; //${tableDataFileName} String createFilePath = filePathTemplate.replace("${dir}", "data"); String random = RandomStringUtils.randomAlphabetic(8); createFilePath = createFilePath.replace("${random}", random); File createFile = new File(createFilePath); File parentDir = createFile.getParentFile(); if (!parentDir.exists() || !parentDir.isDirectory()) { parentDir.mkdirs(); } File moveFile = new File(filePathTemplate.replace("${dir}", "pool").replace("${random}", random)); parentDir = moveFile.getParentFile(); if (!parentDir.exists() || !parentDir.isDirectory()) { parentDir.mkdirs(); } try { createFile.createNewFile(); FileUtils.writeStringToFile(createFile, sb.toString(), "utf-8", false); createFile.renameTo(moveFile); logger.info("已将数据文件移动到处理目录下..."); } catch (IOException e) { e.printStackTrace(); logger.error("生产数据文件失败..."); System.exit(-1); } return moveFile.getName(); } }
UTF-8
Java
5,461
java
LoadOracleData.java
Java
[ { "context": "a.util.Date;\r\n\r\n/**\r\n * Oracle 数据导出\r\n * Created by CaoWeiDong on 2017-08-05.\r\n */\r\npublic class LoadOracleData ", "end": 546, "score": 0.9867229461669922, "start": 536, "tag": "NAME", "value": "CaoWeiDong" } ]
null
[]
package com.rainsoft.oracle; import com.rainsoft.conf.ConfigurationManager; import com.rainsoft.jdbc.JDBCHelper; import com.rainsoft.utils.DateFormatUtils; import com.rainsoft.utils.JdbcUtils; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.RandomStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; import java.sql.ResultSetMetaData; import java.text.ParseException; import java.util.Date; /** * Oracle 数据导出 * Created by CaoWeiDong on 2017-08-05. */ public class LoadOracleData { private static final Logger logger = LoggerFactory.getLogger(LoadOracleData.class); // private static int maxFileDataSize = ConfigurationManager.getInteger("max_oracle_data_file_lines"); // private static String path = ConfigurationManager.getProperty("load_oracle_data_local_dir"); public static void main(String[] args) throws ParseException, IOException { String tableName = args[0]; String startTime = args[1]; String endTime = args[2]; String templateSql = "select * from ${tableName} where capture_time >= to_date('${startTime}' ,'YYYY-MM-DD HH24:MI:SS') and capture_time < to_date('${endTime}' ,'YYYY-MM-DD HH24:MI:SS')"; String sql = templateSql.replace("${tableName}", tableName); sql = sql.replace("${startTime}", startTime); sql = sql.replace("${endTime}", endTime); int maxFileDataSize = ConfigurationManager.getInteger("data.file.max.lines"); JDBCHelper helper = JDBCHelper.getInstance(); logger.info("开始执行sql: {}", sql); logger.info("数据文件本地生成目录: {}", ConfigurationManager.getProperty("load.data.workspace") + File.separator + "data" + File.separator + tableName); logger.info("文件生成后移动的目录: {}", ConfigurationManager.getProperty("load.data.workspace") + File.separator + "pool" + File.separator + tableName); helper.executeQueryBySql(sql, rs -> { logger.info("查询完成,开始处理数据..."); ResultSetMetaData rsm = rs.getMetaData(); int colSize = rsm.getColumnCount(); int fileDataSize = 0; int fileCount = 0; StringBuffer sb = new StringBuffer(); while (rs.next()) { for (int i = 1; i <= colSize; i++) { int type = rsm.getColumnType(i); if (i < colSize) { sb.append(JdbcUtils.getFieldValue(rs, type, i)).append("\t"); } else { sb.append(JdbcUtils.getFieldValue(rs, type, i)); } } sb.append("\r\n"); fileDataSize++; if (fileDataSize >= maxFileDataSize) { String fileName = writeStringToFile(sb, tableName); sb = new StringBuffer(); fileCount++; fileDataSize = 0; logger.info("sql返回结果生成第 {} 个数据文件,文件名{}", fileCount, fileName); } } if (sb.length() > 0) { String fileName = writeStringToFile(sb, tableName); fileCount++; logger.info("sql返回结果生成最后一个数据第 {} 个数据文件,文件名{}", fileCount, fileName); } logger.info("一次查询的数据处理完毕..."); }); } /** * 将查询出来的数据写入到文件 * * @param sb */ private static String writeStringToFile(StringBuffer sb, String tableName) { String constantPath = ConfigurationManager.getProperty("load.data.workspace"); //${basePath}/${workType}/${tableName}/${tableDataFileName} String filePathTemplate = constantPath + File.separator //${basePath} + "${dir}" + File.separator //${workType} + tableName + File.separator //${workType} + tableName + "_data_" + DateFormatUtils.NO_SEPARATOR_FORMAT.format(new Date()) + "${random}.tsv"; //${tableDataFileName} String createFilePath = filePathTemplate.replace("${dir}", "data"); String random = RandomStringUtils.randomAlphabetic(8); createFilePath = createFilePath.replace("${random}", random); File createFile = new File(createFilePath); File parentDir = createFile.getParentFile(); if (!parentDir.exists() || !parentDir.isDirectory()) { parentDir.mkdirs(); } File moveFile = new File(filePathTemplate.replace("${dir}", "pool").replace("${random}", random)); parentDir = moveFile.getParentFile(); if (!parentDir.exists() || !parentDir.isDirectory()) { parentDir.mkdirs(); } try { createFile.createNewFile(); FileUtils.writeStringToFile(createFile, sb.toString(), "utf-8", false); createFile.renameTo(moveFile); logger.info("已将数据文件移动到处理目录下..."); } catch (IOException e) { e.printStackTrace(); logger.error("生产数据文件失败..."); System.exit(-1); } return moveFile.getName(); } }
5,461
0.578625
0.573645
126
39.436508
34.65556
195
false
false
0
0
0
0
0
0
0.84127
false
false
13