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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2b110d12e6d8eabe77b4676ac4f82275cc717cc5
| 24,051,816,898,532
|
dce31ffd42e70d22a18496505e02bcef8bb95a04
|
/ThreadForBackUp.java
|
36f9fce411a23a06b23b1912da65faa94a8a6855
|
[] |
no_license
|
iryna-kovalenko/Java_coding
|
https://github.com/iryna-kovalenko/Java_coding
|
5442d266e3c67381356971d2e73b1e7a4851a98a
|
fbdcc4116b0c5e06fd6cb96268224bde0f9bd1e0
|
refs/heads/main
| 2023-04-04T15:28:59.249000
| 2021-04-10T18:50:20
| 2021-04-10T18:50:20
| 352,096,493
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.IOException;
import java.net.Socket;
public class ThreadForBackUp extends Thread{
DataInputStream in;
Socket serverSocket;
public ThreadForBackUp(Socket serverSocket) {
try {
in = new DataInputStream( serverSocket.getInputStream());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
this.start();
}
public void run(){
String mString;
try {
while(true) {
if(in.available()>0) {
mString=in.readUTF();
if(mString.charAt(0)=='1') {
System.out.println(" Server is alive ");
}}
}
}
catch (IOException e) {
System.out.println(" Exception in Thread back-up ");
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
|
UTF-8
|
Java
| 969
|
java
|
ThreadForBackUp.java
|
Java
|
[] | null |
[] |
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.IOException;
import java.net.Socket;
public class ThreadForBackUp extends Thread{
DataInputStream in;
Socket serverSocket;
public ThreadForBackUp(Socket serverSocket) {
try {
in = new DataInputStream( serverSocket.getInputStream());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
this.start();
}
public void run(){
String mString;
try {
while(true) {
if(in.available()>0) {
mString=in.readUTF();
if(mString.charAt(0)=='1') {
System.out.println(" Server is alive ");
}}
}
}
catch (IOException e) {
System.out.println(" Exception in Thread back-up ");
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| 969
| 0.55418
| 0.551084
| 51
| 16.960785
| 15.678086
| 60
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 2.843137
| false
| false
|
2
|
76c78cdee553d960766585d87b53f807f9759561
| 9,320,079,068,476
|
577152b68812e2ab4154cb3c05c2db0cfac56602
|
/src/main/java/Model/MonthToNum/MonthToNum.java
|
e77351b155b6c3a770595ccaaf86293304d9f6e9
|
[
"MIT"
] |
permissive
|
ducthong230497/CloverBrowser
|
https://github.com/ducthong230497/CloverBrowser
|
9c7395ab58e68fdbb03fdaac362bc1e9de4b7722
|
e595f05a11f6be156cc9bf9d096248c324732f1b
|
refs/heads/master
| 2020-03-21T15:55:19.059000
| 2018-06-14T15:01:08
| 2018-06-14T15:01:08
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package Model.MonthToNum;
import com.sun.istack.internal.NotNull;
public class MonthToNum {
@NotNull
public static String changeMonthToNum(String m){
switch (m){
case "Jan": return "01";
case "Feb": return "02";
case "Mar": return "03";
case "Apr": return "04";
case "May": return "05";
case "Jun": return "06";
case "Jul": return "07";
case "Aug": return "08";
case "Sep": return "09";
case "Oct": return "10";
case "Nov": return "11";
case "Dec": return "12";
default:return"";
}
}
}
|
UTF-8
|
Java
| 672
|
java
|
MonthToNum.java
|
Java
|
[] | null |
[] |
package Model.MonthToNum;
import com.sun.istack.internal.NotNull;
public class MonthToNum {
@NotNull
public static String changeMonthToNum(String m){
switch (m){
case "Jan": return "01";
case "Feb": return "02";
case "Mar": return "03";
case "Apr": return "04";
case "May": return "05";
case "Jun": return "06";
case "Jul": return "07";
case "Aug": return "08";
case "Sep": return "09";
case "Oct": return "10";
case "Nov": return "11";
case "Dec": return "12";
default:return"";
}
}
}
| 672
| 0.482143
| 0.446429
| 24
| 27
| 14.410645
| 52
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.625
| false
| false
|
2
|
9a3b9d01ac04f956967cf3cb3343c5092b2b355b
| 33,621,004,022,956
|
9144d176a3dbf57b88ece663a5afdf04f9a86f1e
|
/database/mongo-repository/src/main/java/com/ilt/cms/repository/patient/patientVisit/PatientReferralRepository.java
|
47b29baf17c9c0b92a882ab147a13cc0c7fd9474
|
[] |
no_license
|
chaturangalagama/clinic-cutomized-bussines-microservice
|
https://github.com/chaturangalagama/clinic-cutomized-bussines-microservice
|
fdb7475473a4f7d6b9ec8f0036a6075bc90a0ef9
|
7077bc0e9b932ea3cded00d7de9cfa83b61fe066
|
refs/heads/main
| 2023-06-15T22:47:21.754000
| 2021-07-14T16:36:41
| 2021-07-14T16:36:41
| 384,223,490
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ilt.cms.repository.patient.patientVisit;
import com.ilt.cms.core.entity.consultation.PatientReferral;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.List;
@Repository
public interface PatientReferralRepository extends MongoRepository<PatientReferral, String> {
List<PatientReferral> findAllByPatientReferrals_doctorIdAndPatientReferrals_appointmentDateTimeBetween(String doctorId, LocalDateTime start, LocalDateTime end);
}
|
UTF-8
|
Java
| 564
|
java
|
PatientReferralRepository.java
|
Java
|
[] | null |
[] |
package com.ilt.cms.repository.patient.patientVisit;
import com.ilt.cms.core.entity.consultation.PatientReferral;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.List;
@Repository
public interface PatientReferralRepository extends MongoRepository<PatientReferral, String> {
List<PatientReferral> findAllByPatientReferrals_doctorIdAndPatientReferrals_appointmentDateTimeBetween(String doctorId, LocalDateTime start, LocalDateTime end);
}
| 564
| 0.858156
| 0.858156
| 14
| 39.285713
| 45.276024
| 164
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.714286
| false
| false
|
2
|
5226008fc991668982a32ca232a7de9b3ba60e03
| 34,273,839,029,846
|
c260cdee9ce414a63774e07d7a0c4a7cdf55c960
|
/app/src/main/java/com/example/muslim/QuranText_85Activity.java
|
3f49c494fe7381dbc3072fde97600395b527b393
|
[] |
no_license
|
Mohammedomargallya39/Muslim
|
https://github.com/Mohammedomargallya39/Muslim
|
15aac37a979163fef3697fdc75b274b9b87ca7d2
|
612d57a64d29158f513fbfcabf9e5debd0928bc0
|
refs/heads/master
| 2023-04-09T03:33:22.699000
| 2021-04-14T11:37:25
| 2021-04-14T11:37:25
| 357,877,819
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.muslim;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Bundle;
import java.util.ArrayList;
public class QuranText_85Activity extends AppCompatActivity {
ArrayList<Alborog> alborogs = new ArrayList<>();
RecyclerView recyclerView;
quran_text_85_adapter quran_text_85_adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quran_text_85);
alborogs.add(new Alborog("بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيمِ"));
alborogs.add(new Alborog("وَالسَّمَاءِ ذَاتِ الْبُرُوجِ (1)"));
alborogs.add(new Alborog("وَالْيَوْمِ الْمَوْعُودِ (2)"));
alborogs.add(new Alborog("وَشَاهِدٍ وَمَشْهُودٍ (3)"));
alborogs.add(new Alborog("قُتِلَ أَصْحَابُ الْأُخْدُودِ (4)"));
alborogs.add(new Alborog("النَّارِ ذَاتِ الْوَقُودِ (5)"));
alborogs.add(new Alborog("إِذْ هُمْ عَلَيْهَا قُعُودٌ (6)"));
alborogs.add(new Alborog("وَهُمْ عَلَى مَا يَفْعَلُونَ بِالْمُؤْمِنِينَ شُهُودٌ (7)"));
alborogs.add(new Alborog("وَمَا نَقَمُوا مِنْهُمْ إِلَّا أَنْ يُؤْمِنُوا بِاللَّهِ الْعَزِيزِ الْحَمِيدِ (8)"));
alborogs.add(new Alborog("الَّذِي لَهُ مُلْكُ السَّمَاوَاتِ وَالْأَرْضِ وَاللَّهُ عَلَى كُلِّ شَيْءٍ شَهِيدٌ (9)"));
alborogs.add(new Alborog("إِنَّ الَّذِينَ فَتَنُوا الْمُؤْمِنِينَ وَالْمُؤْمِنَاتِ ثُمَّ لَمْ يَتُوبُوا فَلَهُمْ عَذَابُ جَهَنَّمَ وَلَهُمْ عَذَابُ الْحَرِيقِ (10)"));
alborogs.add(new Alborog("إِنَّ الَّذِينَ آَمَنُوا وَعَمِلُوا الصَّالِحَاتِ لَهُمْ جَنَّاتٌ تَجْرِي مِنْ تَحْتِهَا الْأَنْهَارُ ذَلِكَ الْفَوْزُ الْكَبِيرُ (11)"));
alborogs.add(new Alborog("إِنَّ بَطْشَ رَبِّكَ لَشَدِيدٌ (12)"));
alborogs.add(new Alborog("إِنَّهُ هُوَ يُبْدِئُ وَيُعِيدُ (13)"));
alborogs.add(new Alborog("وَهُوَ الْغَفُورُ الْوَدُودُ (14)"));
alborogs.add(new Alborog("ذُو الْعَرْشِ الْمَجِيدُ (15)"));
alborogs.add(new Alborog("فَعَّالٌ لِمَا يُرِيدُ (16)"));
alborogs.add(new Alborog("هَلْ أَتَاكَ حَدِيثُ الْجُنُودِ (17)"));
alborogs.add(new Alborog("فِرْعَوْنَ وَثَمُودَ (18)"));
alborogs.add(new Alborog("بَلِ الَّذِينَ كَفَرُوا فِي تَكْذِيبٍ (19)"));
alborogs.add(new Alborog("وَاللَّهُ مِنْ وَرَائِهِمْ مُحِيطٌ (20)"));
alborogs.add(new Alborog("بَلْ هُوَ قُرْآَنٌ مَجِيدٌ (21)"));
alborogs.add(new Alborog("فِي لَوْحٍ مَحْفُوظٍ (22)"));
quran_text_85_adapter = new quran_text_85_adapter(alborogs ,QuranText_85Activity.this);
recyclerView = findViewById(R.id.rv_85);
recyclerView.setLayoutManager(new LinearLayoutManager(QuranText_85Activity.this));
recyclerView.setAdapter(quran_text_85_adapter);
}
}
|
UTF-8
|
Java
| 3,763
|
java
|
QuranText_85Activity.java
|
Java
|
[] | null |
[] |
package com.example.muslim;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Bundle;
import java.util.ArrayList;
public class QuranText_85Activity extends AppCompatActivity {
ArrayList<Alborog> alborogs = new ArrayList<>();
RecyclerView recyclerView;
quran_text_85_adapter quran_text_85_adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quran_text_85);
alborogs.add(new Alborog("بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيمِ"));
alborogs.add(new Alborog("وَالسَّمَاءِ ذَاتِ الْبُرُوجِ (1)"));
alborogs.add(new Alborog("وَالْيَوْمِ الْمَوْعُودِ (2)"));
alborogs.add(new Alborog("وَشَاهِدٍ وَمَشْهُودٍ (3)"));
alborogs.add(new Alborog("قُتِلَ أَصْحَابُ الْأُخْدُودِ (4)"));
alborogs.add(new Alborog("النَّارِ ذَاتِ الْوَقُودِ (5)"));
alborogs.add(new Alborog("إِذْ هُمْ عَلَيْهَا قُعُودٌ (6)"));
alborogs.add(new Alborog("وَهُمْ عَلَى مَا يَفْعَلُونَ بِالْمُؤْمِنِينَ شُهُودٌ (7)"));
alborogs.add(new Alborog("وَمَا نَقَمُوا مِنْهُمْ إِلَّا أَنْ يُؤْمِنُوا بِاللَّهِ الْعَزِيزِ الْحَمِيدِ (8)"));
alborogs.add(new Alborog("الَّذِي لَهُ مُلْكُ السَّمَاوَاتِ وَالْأَرْضِ وَاللَّهُ عَلَى كُلِّ شَيْءٍ شَهِيدٌ (9)"));
alborogs.add(new Alborog("إِنَّ الَّذِينَ فَتَنُوا الْمُؤْمِنِينَ وَالْمُؤْمِنَاتِ ثُمَّ لَمْ يَتُوبُوا فَلَهُمْ عَذَابُ جَهَنَّمَ وَلَهُمْ عَذَابُ الْحَرِيقِ (10)"));
alborogs.add(new Alborog("إِنَّ الَّذِينَ آَمَنُوا وَعَمِلُوا الصَّالِحَاتِ لَهُمْ جَنَّاتٌ تَجْرِي مِنْ تَحْتِهَا الْأَنْهَارُ ذَلِكَ الْفَوْزُ الْكَبِيرُ (11)"));
alborogs.add(new Alborog("إِنَّ بَطْشَ رَبِّكَ لَشَدِيدٌ (12)"));
alborogs.add(new Alborog("إِنَّهُ هُوَ يُبْدِئُ وَيُعِيدُ (13)"));
alborogs.add(new Alborog("وَهُوَ الْغَفُورُ الْوَدُودُ (14)"));
alborogs.add(new Alborog("ذُو الْعَرْشِ الْمَجِيدُ (15)"));
alborogs.add(new Alborog("فَعَّالٌ لِمَا يُرِيدُ (16)"));
alborogs.add(new Alborog("هَلْ أَتَاكَ حَدِيثُ الْجُنُودِ (17)"));
alborogs.add(new Alborog("فِرْعَوْنَ وَثَمُودَ (18)"));
alborogs.add(new Alborog("بَلِ الَّذِينَ كَفَرُوا فِي تَكْذِيبٍ (19)"));
alborogs.add(new Alborog("وَاللَّهُ مِنْ وَرَائِهِمْ مُحِيطٌ (20)"));
alborogs.add(new Alborog("بَلْ هُوَ قُرْآَنٌ مَجِيدٌ (21)"));
alborogs.add(new Alborog("فِي لَوْحٍ مَحْفُوظٍ (22)"));
quran_text_85_adapter = new quran_text_85_adapter(alborogs ,QuranText_85Activity.this);
recyclerView = findViewById(R.id.rv_85);
recyclerView.setLayoutManager(new LinearLayoutManager(QuranText_85Activity.this));
recyclerView.setAdapter(quran_text_85_adapter);
}
}
| 3,763
| 0.589112
| 0.570042
| 56
| 50.517857
| 41.136528
| 175
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.696429
| false
| false
|
2
|
3d96d71dc4c8cd6ac386a0c25a18a54a85063750
| 34,849,364,643,720
|
5c159f239640fe36335fcb4cf611953c4d19c907
|
/src/DP/prg42895/Main.java
|
26d97714e3eb916b981e7b69d729f532da3eb0da
|
[] |
no_license
|
kuser16/Algorithm-practice
|
https://github.com/kuser16/Algorithm-practice
|
0a95dd3b39a23d41eb0188b9c8ebd6beed9e4fdb
|
9ae7cfa7a358ccd2315c3f692989ff8e2a88aa0f
|
refs/heads/master
| 2023-08-29T01:24:15.624000
| 2021-10-27T13:59:59
| 2021-10-27T13:59:59
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package DP.prg42895;
import java.util.HashSet;
public class Main {
public static void main(String[] args) {
Solution sol = new Solution();
System.out.println(sol.solution(11, 11));
}
}
class Solution {
public int solution(int N, int number) {
if (N == number) return 1;
int ans = -1;
HashSet<Integer>[] set = new HashSet[9];
for (int i = 1; i <= 8; i++) set[i] = new HashSet<>();
set[1].add(N);
for (int i = 2; i <= 8; i++) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < i; j++) sb.append(N);
set[i].add(Integer.parseInt(sb.toString()));
for (int j = 1; j < i; j++) {
for (int v1 : set[j]) {
for (int v2 : set[i-j]) {
set[i].add(v1 + v2);
if (v1-v2 > 0) set[i].add(v1 - v2);
set[i].add(v1 * v2);
if (v2 != 0) set[i].add(v1 / v2);
}
}
}
if (set[i].contains(number)) {
ans = i;
break;
}
}
return ans;
}
}
|
UTF-8
|
Java
| 1,206
|
java
|
Main.java
|
Java
|
[] | null |
[] |
package DP.prg42895;
import java.util.HashSet;
public class Main {
public static void main(String[] args) {
Solution sol = new Solution();
System.out.println(sol.solution(11, 11));
}
}
class Solution {
public int solution(int N, int number) {
if (N == number) return 1;
int ans = -1;
HashSet<Integer>[] set = new HashSet[9];
for (int i = 1; i <= 8; i++) set[i] = new HashSet<>();
set[1].add(N);
for (int i = 2; i <= 8; i++) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < i; j++) sb.append(N);
set[i].add(Integer.parseInt(sb.toString()));
for (int j = 1; j < i; j++) {
for (int v1 : set[j]) {
for (int v2 : set[i-j]) {
set[i].add(v1 + v2);
if (v1-v2 > 0) set[i].add(v1 - v2);
set[i].add(v1 * v2);
if (v2 != 0) set[i].add(v1 / v2);
}
}
}
if (set[i].contains(number)) {
ans = i;
break;
}
}
return ans;
}
}
| 1,206
| 0.403814
| 0.375622
| 45
| 25.799999
| 19.910467
| 62
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.644444
| false
| false
|
2
|
f451208112bb1bb8666537acb9f92a9faa5df96d
| 3,341,484,614,023
|
e8f055fde11a10dc92f6a66dc93febbb7c577dca
|
/eureka-client/src/main/java/com/jtt/hhl/controller/HelloController.java
|
5dbb5ce1aabab500c02846958d4f48ef980b48d8
|
[] |
no_license
|
honghailiang/springhhl
|
https://github.com/honghailiang/springhhl
|
c295cc83f62522182db8f7ce6612ed76946423ba
|
9660a86c5e6088413121870c445107092c30a89a
|
refs/heads/master
| 2021-06-10T02:49:52.602000
| 2021-04-14T14:03:01
| 2021-04-14T14:03:01
| 163,585,347
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.jtt.hhl.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Description: 服务提供者注册
* @Author: Herman
* @CreateDate: 2018/12/30 20:48
*/
@RestController
public class HelloController {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private DiscoveryClient discoveryClient;
@Value("${server.port}")
private String ip;
@RequestMapping("/hello")
public String index(){
String services = "Services: " + discoveryClient.getServices()+" ip :" + ip;
logger.info(services);
return "Hello World";
}
}
|
UTF-8
|
Java
| 949
|
java
|
HelloController.java
|
Java
|
[
{
"context": "troller;\n\n/**\n * @Description: 服务提供者注册\n * @Author: Herman\n * @CreateDate: 2018/12/30 20:48\n */\n@RestControl",
"end": 453,
"score": 0.999175488948822,
"start": 447,
"tag": "NAME",
"value": "Herman"
}
] | null |
[] |
package com.jtt.hhl.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Description: 服务提供者注册
* @Author: Herman
* @CreateDate: 2018/12/30 20:48
*/
@RestController
public class HelloController {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private DiscoveryClient discoveryClient;
@Value("${server.port}")
private String ip;
@RequestMapping("/hello")
public String index(){
String services = "Services: " + discoveryClient.getServices()+" ip :" + ip;
logger.info(services);
return "Hello World";
}
}
| 949
| 0.740107
| 0.725134
| 32
| 28.21875
| 23.700916
| 84
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.4375
| false
| false
|
2
|
a9d84e4a58a3b9ab16e67a9b8c7c61c7ab1a834c
| 35,261,681,502,553
|
68374eb2631cb33ccd8d7924a16bfb79ad08040a
|
/core/src/main/java/com/gengoai/hermes/ml/feature/LexicalFeatures.java
|
30764eb04480c8cb472285e1c412b0cedd055497
|
[
"Apache-2.0"
] |
permissive
|
gengoai/hermes
|
https://github.com/gengoai/hermes
|
92f413788f2870b51369b440d8e479824bdd3ce0
|
78f48e9edee397907d7ac0bda32fb5ea24f6be4a
|
refs/heads/master
| 2021-06-02T06:27:26.783000
| 2020-07-31T16:47:23
| 2020-07-31T16:47:23
| 130,230,032
| 2
| 1
|
Apache-2.0
| false
| 2020-05-03T15:02:55
| 2018-04-19T14:41:39
| 2020-05-03T15:01:18
| 2020-05-03T15:02:54
| 18,298
| 0
| 0
| 0
|
Java
| false
| false
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.gengoai.hermes.ml.feature;
import com.gengoai.hermes.*;
import com.gengoai.hermes.morphology.PennTreeBank;
import com.gengoai.math.Math2;
import com.gengoai.string.Strings;
import lombok.NonNull;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.Stream;
/**
* @author David B. Bracewell
*/
public final class LexicalFeatures {
private static final Pattern capPeriod = Pattern.compile("^[A-Z]\\.$");
private static final Pattern ordinalPattern = Pattern.compile("\\d+(nd|rd|st|th)");
private static final Set<String> cardinalNames = Set.of("one",
"two",
"three",
"four",
"five",
"six",
"seven",
"eight",
"nine",
"ten",
"eleven",
"twelve",
"thirteen",
"fourteen",
"fifteen",
"sixteen",
"seventeen",
"eighteen",
"nineteen",
"twenty",
"thirty",
"forty",
"fifty",
"sixty",
"seventy",
"eighty",
"ninety",
"hundred",
"thousand",
"million",
"billion",
"trillion");
private static final Set<String> ordinalNames = Set.of("first",
"second",
"third",
"fourth",
"fifth",
"sixth",
"seventh",
"eighth",
"ninth",
"tenth",
"eleventh",
"twelfth",
"thirteenth",
"fourteenth",
"fifteenth",
"sixteenth",
"seventeenth",
"eighteenth",
"nineteenth",
"twentieth",
"thirtieth",
"fortieth",
"fiftieth",
"sixtieth",
"seventieth",
"eightieth",
"ninetieth",
"hundredth",
"thousandth",
"millionth",
"billionth");
private static final Set<String> percentNames = Set.of("%", "pct", "pct.", "percent");
public static boolean isCardinalNumber(@NonNull HString word) {
String norm = word.toLowerCase();
if(Strings.isDigit(word) ||
cardinalNames.contains(norm) ||
word.pos().isInstance(PennTreeBank.CD) ||
Strings.isDigit(word.replaceAll("\\W+", "")) ||
Math2.tryParseDouble(norm) != null) {
return true;
}
if(norm.contains("-") && norm.length() > 1) {
return Stream.of(norm.split("-")).allMatch(s -> isCardinalNumber(Fragments.stringWrapper(s)));
}
if(norm.contains("/") && norm.length() > 1) {
return Stream.of(norm.split("/")).allMatch(s -> isCardinalNumber(Fragments.stringWrapper(s)));
}
return false;
}
public static boolean isDigit(HString word) {
return isCardinalNumber(word) || isOrdinalNumber(word) || word.pos().isNumeral();
}
public static boolean isOrdinalNumber(@NonNull HString word) {
final String lower = word.toLowerCase();
if(ordinalNames.contains(lower) || ordinalPattern.matcher(lower).matches()) {
return true;
}
if(lower.contains("-") && lower.length() > 1) {
String[] parts = lower.split("-");
if(parts.length > 1) {
for(int i = 0; i < parts.length - 1; i++) {
if(!isDigit(Fragments.stringWrapper(parts[i]))) {
return false;
}
}
return isOrdinalNumber(Fragments.stringWrapper(parts[parts.length - 1]));
}
}
return false;
}
public static boolean isPercent(@NonNull HString word) {
if(percentNames.contains(word.toLowerCase())) {
return true;
} else if(isCardinalNumber(word)) {
Annotation next = word.next(Types.TOKEN);
return next.sentence() == word.sentence() && isPercent(next);
}
return false;
}
public static void main(String[] args) {
Document d = Document.create("33% of the Lts. in the Navy who contract the disease die within 23 days.");
d.annotate(Types.TOKEN, Types.SENTENCE);
for(Annotation token : d.tokens()) {
System.out.println(token + " : " + isDigit(token) + " : " + isPercent(token));
System.out.println(Features.IsEndOfSentence.applyAsFeatures(token));
System.out.println();
}
}
public static String shape(@NonNull HString string) {
if(Strings.isNullOrBlank(string)) {
return Strings.EMPTY;
}
StringBuilder builder = new StringBuilder();
String last = Strings.EMPTY;
String cur = Strings.EMPTY;
int repeated = 0;
for(int ci = 0; ci < string.length(); ci++) {
char c = string.charAt(ci);
if(Character.isUpperCase(c)) {
cur = "X";
} else if(Character.isLowerCase(c)) {
cur = "x";
} else if(Character.isDigit(c)) {
cur = "d";
} else if(c == '.' || c == ',') {
cur = ".";
} else if(c == ';' || c == ':' || c == '?' || c == '!') {
cur = ";";
} else if(c == '+' || c == '-' || c == '*' || c == '/' || c == '=' || c == '|' || c == '_') {
cur = "-";
} else if(c == '(' || c == '{' || c == '[' || c == '<') {
cur = "(";
} else if(c == ')' || c == '}' || c == ']' || c == '>') {
cur = ")";
} else {
cur = Character.toString(c);
}
if(last.equals(cur)) {
repeated++;
} else {
repeated = 0;
}
if(repeated < 4) {
builder.append(cur);
}
}
return builder.toString();
}
public static String wordClass(@NonNull HString string) {
if(Character.getType(string.charAt(0)) == Character.CURRENCY_SYMBOL) {
return "CURRENCY";
}
if(string.contentEqualsIgnoreCase("'s")) {
return "POSSESSIVE";
}
StringPattern pattern = StringPattern.recognize(string.toString());
String feat;
if(pattern.isAllLowerCaseLetter()) {
feat = "lc";
} else if(pattern.digits() == 2) {
feat = "2d";
} else if(pattern.digits() == 4) {
feat = "4d";
} else if(pattern.containsDigit()) {
if(pattern.containsLetters()) {
feat = "an";
} else if(pattern.containsHyphen()) {
feat = "dd";
} else if(pattern.containsSlash()) {
feat = "ds";
} else if(pattern.containsComma()) {
feat = "dc";
} else if(pattern.containsPeriod()) {
feat = "dp";
} else {
feat = "num";
}
} else if(pattern.isAllCapitalLetter() && string.length() == 1) {
feat = "sc";
} else if(pattern.isAllCapitalLetter()) {
feat = "ac";
} else if(capPeriod.matcher(string).find()) {
feat = "cp";
} else if(pattern.isInitialCapitalLetter()) {
feat = "ic";
} else {
feat = "other";
}
return feat;
}
private LexicalFeatures() {
throw new IllegalAccessError();
}
}//END OF LexicalFeatures
|
UTF-8
|
Java
| 10,965
|
java
|
LexicalFeatures.java
|
Java
|
[
{
"context": "n;\nimport java.util.stream.Stream;\n\n/**\n * @author David B. Bracewell\n */\npublic final class LexicalFeatures {\n priva",
"end": 1139,
"score": 0.9998555779457092,
"start": 1121,
"tag": "NAME",
"value": "David B. Bracewell"
}
] | null |
[] |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.gengoai.hermes.ml.feature;
import com.gengoai.hermes.*;
import com.gengoai.hermes.morphology.PennTreeBank;
import com.gengoai.math.Math2;
import com.gengoai.string.Strings;
import lombok.NonNull;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.Stream;
/**
* @author <NAME>
*/
public final class LexicalFeatures {
private static final Pattern capPeriod = Pattern.compile("^[A-Z]\\.$");
private static final Pattern ordinalPattern = Pattern.compile("\\d+(nd|rd|st|th)");
private static final Set<String> cardinalNames = Set.of("one",
"two",
"three",
"four",
"five",
"six",
"seven",
"eight",
"nine",
"ten",
"eleven",
"twelve",
"thirteen",
"fourteen",
"fifteen",
"sixteen",
"seventeen",
"eighteen",
"nineteen",
"twenty",
"thirty",
"forty",
"fifty",
"sixty",
"seventy",
"eighty",
"ninety",
"hundred",
"thousand",
"million",
"billion",
"trillion");
private static final Set<String> ordinalNames = Set.of("first",
"second",
"third",
"fourth",
"fifth",
"sixth",
"seventh",
"eighth",
"ninth",
"tenth",
"eleventh",
"twelfth",
"thirteenth",
"fourteenth",
"fifteenth",
"sixteenth",
"seventeenth",
"eighteenth",
"nineteenth",
"twentieth",
"thirtieth",
"fortieth",
"fiftieth",
"sixtieth",
"seventieth",
"eightieth",
"ninetieth",
"hundredth",
"thousandth",
"millionth",
"billionth");
private static final Set<String> percentNames = Set.of("%", "pct", "pct.", "percent");
public static boolean isCardinalNumber(@NonNull HString word) {
String norm = word.toLowerCase();
if(Strings.isDigit(word) ||
cardinalNames.contains(norm) ||
word.pos().isInstance(PennTreeBank.CD) ||
Strings.isDigit(word.replaceAll("\\W+", "")) ||
Math2.tryParseDouble(norm) != null) {
return true;
}
if(norm.contains("-") && norm.length() > 1) {
return Stream.of(norm.split("-")).allMatch(s -> isCardinalNumber(Fragments.stringWrapper(s)));
}
if(norm.contains("/") && norm.length() > 1) {
return Stream.of(norm.split("/")).allMatch(s -> isCardinalNumber(Fragments.stringWrapper(s)));
}
return false;
}
public static boolean isDigit(HString word) {
return isCardinalNumber(word) || isOrdinalNumber(word) || word.pos().isNumeral();
}
public static boolean isOrdinalNumber(@NonNull HString word) {
final String lower = word.toLowerCase();
if(ordinalNames.contains(lower) || ordinalPattern.matcher(lower).matches()) {
return true;
}
if(lower.contains("-") && lower.length() > 1) {
String[] parts = lower.split("-");
if(parts.length > 1) {
for(int i = 0; i < parts.length - 1; i++) {
if(!isDigit(Fragments.stringWrapper(parts[i]))) {
return false;
}
}
return isOrdinalNumber(Fragments.stringWrapper(parts[parts.length - 1]));
}
}
return false;
}
public static boolean isPercent(@NonNull HString word) {
if(percentNames.contains(word.toLowerCase())) {
return true;
} else if(isCardinalNumber(word)) {
Annotation next = word.next(Types.TOKEN);
return next.sentence() == word.sentence() && isPercent(next);
}
return false;
}
public static void main(String[] args) {
Document d = Document.create("33% of the Lts. in the Navy who contract the disease die within 23 days.");
d.annotate(Types.TOKEN, Types.SENTENCE);
for(Annotation token : d.tokens()) {
System.out.println(token + " : " + isDigit(token) + " : " + isPercent(token));
System.out.println(Features.IsEndOfSentence.applyAsFeatures(token));
System.out.println();
}
}
public static String shape(@NonNull HString string) {
if(Strings.isNullOrBlank(string)) {
return Strings.EMPTY;
}
StringBuilder builder = new StringBuilder();
String last = Strings.EMPTY;
String cur = Strings.EMPTY;
int repeated = 0;
for(int ci = 0; ci < string.length(); ci++) {
char c = string.charAt(ci);
if(Character.isUpperCase(c)) {
cur = "X";
} else if(Character.isLowerCase(c)) {
cur = "x";
} else if(Character.isDigit(c)) {
cur = "d";
} else if(c == '.' || c == ',') {
cur = ".";
} else if(c == ';' || c == ':' || c == '?' || c == '!') {
cur = ";";
} else if(c == '+' || c == '-' || c == '*' || c == '/' || c == '=' || c == '|' || c == '_') {
cur = "-";
} else if(c == '(' || c == '{' || c == '[' || c == '<') {
cur = "(";
} else if(c == ')' || c == '}' || c == ']' || c == '>') {
cur = ")";
} else {
cur = Character.toString(c);
}
if(last.equals(cur)) {
repeated++;
} else {
repeated = 0;
}
if(repeated < 4) {
builder.append(cur);
}
}
return builder.toString();
}
public static String wordClass(@NonNull HString string) {
if(Character.getType(string.charAt(0)) == Character.CURRENCY_SYMBOL) {
return "CURRENCY";
}
if(string.contentEqualsIgnoreCase("'s")) {
return "POSSESSIVE";
}
StringPattern pattern = StringPattern.recognize(string.toString());
String feat;
if(pattern.isAllLowerCaseLetter()) {
feat = "lc";
} else if(pattern.digits() == 2) {
feat = "2d";
} else if(pattern.digits() == 4) {
feat = "4d";
} else if(pattern.containsDigit()) {
if(pattern.containsLetters()) {
feat = "an";
} else if(pattern.containsHyphen()) {
feat = "dd";
} else if(pattern.containsSlash()) {
feat = "ds";
} else if(pattern.containsComma()) {
feat = "dc";
} else if(pattern.containsPeriod()) {
feat = "dp";
} else {
feat = "num";
}
} else if(pattern.isAllCapitalLetter() && string.length() == 1) {
feat = "sc";
} else if(pattern.isAllCapitalLetter()) {
feat = "ac";
} else if(capPeriod.matcher(string).find()) {
feat = "cp";
} else if(pattern.isInitialCapitalLetter()) {
feat = "ic";
} else {
feat = "other";
}
return feat;
}
private LexicalFeatures() {
throw new IllegalAccessError();
}
}//END OF LexicalFeatures
| 10,953
| 0.384405
| 0.381943
| 256
| 41.832031
| 26.533129
| 111
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.789063
| false
| false
|
2
|
db8e62ab5dc382e6ce161a4ccb6c6f36e2d71708
| 3,513,283,276,482
|
2dd2bfa7ab96bf371b3e45b3aec469442de24119
|
/SE/src/se/SE.java
|
dc4fd224e394d0e04558308b16744ab0165498b1
|
[
"Unlicense"
] |
permissive
|
riviar/SE
|
https://github.com/riviar/SE
|
f2f1e5ceb010b9acc41432957e67a43409d3db61
|
397016cb31cee91249db5d99a8064bb3bb28cbdd
|
refs/heads/master
| 2021-01-21T19:16:03.741000
| 2013-12-16T15:32:33
| 2013-12-16T15:32:33
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package se;
import entity.Route;
import entity.Solution;
import gui.SEFrame;
import readwriter.DBManager;
import readwriter.FileManager;
/**
*
* @author Rafał
*/
public class SE {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws Exception {
//FileManager fileManager = new FileManager();
//fileManager.readFileSolution("resources/solution.txt");
//fileManager.readFileInstance("resources/instance.txt");
//Solution solution = fileManager.getSolution();
//DBManager db = new DBManager();
//db.create(solution);
SEFrame frame = new SEFrame();
frame.show();
}
}
|
UTF-8
|
Java
| 725
|
java
|
SE.java
|
Java
|
[
{
"context": "\nimport readwriter.FileManager;\n\n/**\n *\n * @author Rafał\n */\npublic class SE {\n\n /**\n * @param args",
"end": 163,
"score": 0.9997242093086243,
"start": 158,
"tag": "NAME",
"value": "Rafał"
}
] | null |
[] |
package se;
import entity.Route;
import entity.Solution;
import gui.SEFrame;
import readwriter.DBManager;
import readwriter.FileManager;
/**
*
* @author Rafał
*/
public class SE {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws Exception {
//FileManager fileManager = new FileManager();
//fileManager.readFileSolution("resources/solution.txt");
//fileManager.readFileInstance("resources/instance.txt");
//Solution solution = fileManager.getSolution();
//DBManager db = new DBManager();
//db.create(solution);
SEFrame frame = new SEFrame();
frame.show();
}
}
| 725
| 0.625691
| 0.625691
| 32
| 21.625
| 20.711939
| 65
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.4375
| false
| false
|
2
|
9377eb6c64f69751b990994f274314a35796a037
| 11,252,814,337,654
|
54c5fe5662c932380b232831a6fef4e2aead1f86
|
/src/week3JAVA/ex4/Messenger.java
|
ed071c641563f047af095b0e28654beaee2d435f
|
[] |
no_license
|
HosamZ/HosamZ
|
https://github.com/HosamZ/HosamZ
|
92f5478a931899bd8a60dacc10aa8bc29e2a90bd
|
fda031a98fa7d98956854168725497781f634538
|
refs/heads/master
| 2020-04-06T17:53:04.845000
| 2019-02-22T13:53:38
| 2019-02-22T13:53:38
| 157,676,801
| 0
| 1
| null | null | null | null | null | null | null | null | null | null | null | null | null |
//package week3JAVA.ex4;
//
//public class Messenger {
//}
|
UTF-8
|
Java
| 59
|
java
|
Messenger.java
|
Java
|
[] | null |
[] |
//package week3JAVA.ex4;
//
//public class Messenger {
//}
| 59
| 0.661017
| 0.627119
| 4
| 13.75
| 11.277743
| 26
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.25
| false
| false
|
2
|
e975e8b2dc4d15d1f498c0c0b683e4eff384ae37
| 32,530,082,351,464
|
3150f14eded71bcf5a1940aee84e9713928899e4
|
/lphy/src/lphy/parser/DataModelParser.java
|
834a52b4cadb15f4c7c45208b1df04aee325f812
|
[] |
no_license
|
alexeid/graphicalModelSimulation
|
https://github.com/alexeid/graphicalModelSimulation
|
4296caaca796da898ae52a85358ba4e3fc65567d
|
ad789719c13c4b3bb638d2eef9fbe308164ad50b
|
refs/heads/master
| 2020-09-12T23:15:20.387000
| 2020-09-11T04:58:36
| 2020-09-11T04:58:36
| 222,587,684
| 3
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
// Generated from /Users/alexeidrummond/Git/graphicalModelSimulation/lphy/src/lphy/parser/DataModel.g4 by ANTLR 4.8
package lphy.parser;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class DataModelParser extends Parser {
static { RuntimeMetaData.checkVersion("4.8", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9,
T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, T__14=15, T__15=16, T__16=17,
T__17=18, T__18=19, T__19=20, T__20=21, T__21=22, T__22=23, T__23=24,
T__24=25, T__25=26, T__26=27, T__27=28, T__28=29, T__29=30, T__30=31,
T__31=32, T__32=33, DATA=34, MODEL=35, NAME=36, ARROW=37, LENGTH=38, DIM=39,
DECIMAL_LITERAL=40, HEX_LITERAL=41, OCT_LITERAL=42, BINARY_LITERAL=43,
FLOAT_LITERAL=44, HEX_FLOAT_LITERAL=45, STRING_LITERAL=46, TILDE=47, WS=48,
COMMENT=49, LINE_COMMENT=50;
public static final int
RULE_input = 0, RULE_datablock = 1, RULE_modelblock = 2, RULE_relations = 3,
RULE_relation_list = 4, RULE_relation = 5, RULE_for_loop = 6, RULE_counter = 7,
RULE_assignment = 8, RULE_determ_relation = 9, RULE_stoch_relation = 10,
RULE_var = 11, RULE_range_list = 12, RULE_range_element = 13, RULE_constant = 14,
RULE_expression_list = 15, RULE_unnamed_expression_list = 16, RULE_methodCall = 17,
RULE_distribution = 18, RULE_named_expression = 19, RULE_expression = 20;
private static String[] makeRuleNames() {
return new String[] {
"input", "datablock", "modelblock", "relations", "relation_list", "relation",
"for_loop", "counter", "assignment", "determ_relation", "stoch_relation",
"var", "range_list", "range_element", "constant", "expression_list",
"unnamed_expression_list", "methodCall", "distribution", "named_expression",
"expression"
};
}
public static final String[] ruleNames = makeRuleNames();
private static String[] makeLiteralNames() {
return new String[] {
null, "'{'", "'}'", "';'", "'for'", "'('", "'in'", "')'", "'='", "'['",
"']'", "','", "'-'", "'true'", "'false'", "'++'", "'--'", "'+'", "'**'",
"'*'", "'/'", "'%'", "'<'", "'>'", "'<='", "'>='", "'=='", "'!='", "'&'",
"'^'", "'|'", "'&&'", "'||'", "':'", "'data'", "'model'", null, "'<-'",
"'length'", "'dim'", null, null, null, null, null, null, null, "'~'"
};
}
private static final String[] _LITERAL_NAMES = makeLiteralNames();
private static String[] makeSymbolicNames() {
return new String[] {
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, "DATA", "MODEL",
"NAME", "ARROW", "LENGTH", "DIM", "DECIMAL_LITERAL", "HEX_LITERAL", "OCT_LITERAL",
"BINARY_LITERAL", "FLOAT_LITERAL", "HEX_FLOAT_LITERAL", "STRING_LITERAL",
"TILDE", "WS", "COMMENT", "LINE_COMMENT"
};
}
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "<INVALID>";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
@Override
public String getGrammarFileName() { return "DataModel.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public ATN getATN() { return _ATN; }
public DataModelParser(TokenStream input) {
super(input);
_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
public static class InputContext extends ParserRuleContext {
public DatablockContext datablock() {
return getRuleContext(DatablockContext.class,0);
}
public ModelblockContext modelblock() {
return getRuleContext(ModelblockContext.class,0);
}
public InputContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_input; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterInput(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitInput(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitInput(this);
else return visitor.visitChildren(this);
}
}
public final InputContext input() throws RecognitionException {
InputContext _localctx = new InputContext(_ctx, getState());
enterRule(_localctx, 0, RULE_input);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(43);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==DATA) {
{
setState(42);
datablock();
}
}
setState(46);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==MODEL) {
{
setState(45);
modelblock();
}
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class DatablockContext extends ParserRuleContext {
public TerminalNode DATA() { return getToken(DataModelParser.DATA, 0); }
public RelationsContext relations() {
return getRuleContext(RelationsContext.class,0);
}
public DatablockContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_datablock; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterDatablock(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitDatablock(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitDatablock(this);
else return visitor.visitChildren(this);
}
}
public final DatablockContext datablock() throws RecognitionException {
DatablockContext _localctx = new DatablockContext(_ctx, getState());
enterRule(_localctx, 2, RULE_datablock);
try {
enterOuterAlt(_localctx, 1);
{
setState(48);
match(DATA);
setState(49);
relations();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ModelblockContext extends ParserRuleContext {
public TerminalNode MODEL() { return getToken(DataModelParser.MODEL, 0); }
public RelationsContext relations() {
return getRuleContext(RelationsContext.class,0);
}
public ModelblockContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_modelblock; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterModelblock(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitModelblock(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitModelblock(this);
else return visitor.visitChildren(this);
}
}
public final ModelblockContext modelblock() throws RecognitionException {
ModelblockContext _localctx = new ModelblockContext(_ctx, getState());
enterRule(_localctx, 4, RULE_modelblock);
try {
enterOuterAlt(_localctx, 1);
{
setState(51);
match(MODEL);
setState(52);
relations();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class RelationsContext extends ParserRuleContext {
public Relation_listContext relation_list() {
return getRuleContext(Relation_listContext.class,0);
}
public RelationsContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_relations; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterRelations(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitRelations(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitRelations(this);
else return visitor.visitChildren(this);
}
}
public final RelationsContext relations() throws RecognitionException {
RelationsContext _localctx = new RelationsContext(_ctx, getState());
enterRule(_localctx, 6, RULE_relations);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(54);
match(T__0);
setState(56);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==T__3 || _la==NAME) {
{
setState(55);
relation_list(0);
}
}
setState(58);
match(T__1);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Relation_listContext extends ParserRuleContext {
public RelationContext relation() {
return getRuleContext(RelationContext.class,0);
}
public Relation_listContext relation_list() {
return getRuleContext(Relation_listContext.class,0);
}
public Relation_listContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_relation_list; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterRelation_list(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitRelation_list(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitRelation_list(this);
else return visitor.visitChildren(this);
}
}
public final Relation_listContext relation_list() throws RecognitionException {
return relation_list(0);
}
private Relation_listContext relation_list(int _p) throws RecognitionException {
ParserRuleContext _parentctx = _ctx;
int _parentState = getState();
Relation_listContext _localctx = new Relation_listContext(_ctx, _parentState);
Relation_listContext _prevctx = _localctx;
int _startState = 8;
enterRecursionRule(_localctx, 8, RULE_relation_list, _p);
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
{
setState(61);
relation();
}
_ctx.stop = _input.LT(-1);
setState(67);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,3,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
{
_localctx = new Relation_listContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_relation_list);
setState(63);
if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)");
setState(64);
relation();
}
}
}
setState(69);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,3,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
unrollRecursionContexts(_parentctx);
}
return _localctx;
}
public static class RelationContext extends ParserRuleContext {
public Stoch_relationContext stoch_relation() {
return getRuleContext(Stoch_relationContext.class,0);
}
public Determ_relationContext determ_relation() {
return getRuleContext(Determ_relationContext.class,0);
}
public For_loopContext for_loop() {
return getRuleContext(For_loopContext.class,0);
}
public RelationContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_relation; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterRelation(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitRelation(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitRelation(this);
else return visitor.visitChildren(this);
}
}
public final RelationContext relation() throws RecognitionException {
RelationContext _localctx = new RelationContext(_ctx, getState());
enterRule(_localctx, 10, RULE_relation);
try {
setState(79);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,4,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
setState(70);
stoch_relation();
setState(71);
match(T__2);
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(73);
determ_relation();
setState(74);
match(T__2);
}
break;
case 3:
enterOuterAlt(_localctx, 3);
{
setState(76);
for_loop();
setState(77);
match(T__2);
}
break;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class For_loopContext extends ParserRuleContext {
public CounterContext counter() {
return getRuleContext(CounterContext.class,0);
}
public RelationsContext relations() {
return getRuleContext(RelationsContext.class,0);
}
public For_loopContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_for_loop; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterFor_loop(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitFor_loop(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitFor_loop(this);
else return visitor.visitChildren(this);
}
}
public final For_loopContext for_loop() throws RecognitionException {
For_loopContext _localctx = new For_loopContext(_ctx, getState());
enterRule(_localctx, 12, RULE_for_loop);
try {
enterOuterAlt(_localctx, 1);
{
setState(81);
counter();
setState(82);
relations();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class CounterContext extends ParserRuleContext {
public TerminalNode NAME() { return getToken(DataModelParser.NAME, 0); }
public Range_elementContext range_element() {
return getRuleContext(Range_elementContext.class,0);
}
public CounterContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_counter; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterCounter(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitCounter(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitCounter(this);
else return visitor.visitChildren(this);
}
}
public final CounterContext counter() throws RecognitionException {
CounterContext _localctx = new CounterContext(_ctx, getState());
enterRule(_localctx, 14, RULE_counter);
try {
enterOuterAlt(_localctx, 1);
{
setState(84);
match(T__3);
setState(85);
match(T__4);
setState(86);
match(NAME);
setState(87);
match(T__5);
setState(88);
range_element();
setState(89);
match(T__6);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class AssignmentContext extends ParserRuleContext {
public TerminalNode ARROW() { return getToken(DataModelParser.ARROW, 0); }
public AssignmentContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_assignment; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterAssignment(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitAssignment(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitAssignment(this);
else return visitor.visitChildren(this);
}
}
public final AssignmentContext assignment() throws RecognitionException {
AssignmentContext _localctx = new AssignmentContext(_ctx, getState());
enterRule(_localctx, 16, RULE_assignment);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(91);
_la = _input.LA(1);
if ( !(_la==T__7 || _la==ARROW) ) {
_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Determ_relationContext extends ParserRuleContext {
public VarContext var() {
return getRuleContext(VarContext.class,0);
}
public AssignmentContext assignment() {
return getRuleContext(AssignmentContext.class,0);
}
public ExpressionContext expression() {
return getRuleContext(ExpressionContext.class,0);
}
public Determ_relationContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_determ_relation; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterDeterm_relation(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitDeterm_relation(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitDeterm_relation(this);
else return visitor.visitChildren(this);
}
}
public final Determ_relationContext determ_relation() throws RecognitionException {
Determ_relationContext _localctx = new Determ_relationContext(_ctx, getState());
enterRule(_localctx, 18, RULE_determ_relation);
try {
enterOuterAlt(_localctx, 1);
{
setState(93);
var();
setState(94);
assignment();
setState(95);
expression(0);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Stoch_relationContext extends ParserRuleContext {
public VarContext var() {
return getRuleContext(VarContext.class,0);
}
public TerminalNode TILDE() { return getToken(DataModelParser.TILDE, 0); }
public DistributionContext distribution() {
return getRuleContext(DistributionContext.class,0);
}
public Stoch_relationContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_stoch_relation; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterStoch_relation(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitStoch_relation(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitStoch_relation(this);
else return visitor.visitChildren(this);
}
}
public final Stoch_relationContext stoch_relation() throws RecognitionException {
Stoch_relationContext _localctx = new Stoch_relationContext(_ctx, getState());
enterRule(_localctx, 20, RULE_stoch_relation);
try {
enterOuterAlt(_localctx, 1);
{
setState(97);
var();
setState(98);
match(TILDE);
setState(99);
distribution();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class VarContext extends ParserRuleContext {
public TerminalNode NAME() { return getToken(DataModelParser.NAME, 0); }
public Range_listContext range_list() {
return getRuleContext(Range_listContext.class,0);
}
public VarContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_var; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterVar(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitVar(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitVar(this);
else return visitor.visitChildren(this);
}
}
public final VarContext var() throws RecognitionException {
VarContext _localctx = new VarContext(_ctx, getState());
enterRule(_localctx, 22, RULE_var);
try {
setState(107);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,5,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
setState(101);
match(NAME);
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(102);
match(NAME);
setState(103);
match(T__8);
setState(104);
range_list(0);
setState(105);
match(T__9);
}
break;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Range_listContext extends ParserRuleContext {
public Range_elementContext range_element() {
return getRuleContext(Range_elementContext.class,0);
}
public Range_listContext range_list() {
return getRuleContext(Range_listContext.class,0);
}
public Range_listContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_range_list; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterRange_list(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitRange_list(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitRange_list(this);
else return visitor.visitChildren(this);
}
}
public final Range_listContext range_list() throws RecognitionException {
return range_list(0);
}
private Range_listContext range_list(int _p) throws RecognitionException {
ParserRuleContext _parentctx = _ctx;
int _parentState = getState();
Range_listContext _localctx = new Range_listContext(_ctx, _parentState);
Range_listContext _prevctx = _localctx;
int _startState = 24;
enterRecursionRule(_localctx, 24, RULE_range_list, _p);
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
{
setState(110);
range_element();
}
_ctx.stop = _input.LT(-1);
setState(117);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,6,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
{
_localctx = new Range_listContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_range_list);
setState(112);
if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)");
setState(113);
match(T__10);
setState(114);
range_element();
}
}
}
setState(119);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,6,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
unrollRecursionContexts(_parentctx);
}
return _localctx;
}
public static class Range_elementContext extends ParserRuleContext {
public ExpressionContext expression() {
return getRuleContext(ExpressionContext.class,0);
}
public Range_elementContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_range_element; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterRange_element(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitRange_element(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitRange_element(this);
else return visitor.visitChildren(this);
}
}
public final Range_elementContext range_element() throws RecognitionException {
Range_elementContext _localctx = new Range_elementContext(_ctx, getState());
enterRule(_localctx, 26, RULE_range_element);
try {
setState(122);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,7,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(121);
expression(0);
}
break;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ConstantContext extends ParserRuleContext {
public TerminalNode FLOAT_LITERAL() { return getToken(DataModelParser.FLOAT_LITERAL, 0); }
public TerminalNode DECIMAL_LITERAL() { return getToken(DataModelParser.DECIMAL_LITERAL, 0); }
public TerminalNode OCT_LITERAL() { return getToken(DataModelParser.OCT_LITERAL, 0); }
public TerminalNode HEX_LITERAL() { return getToken(DataModelParser.HEX_LITERAL, 0); }
public TerminalNode HEX_FLOAT_LITERAL() { return getToken(DataModelParser.HEX_FLOAT_LITERAL, 0); }
public TerminalNode STRING_LITERAL() { return getToken(DataModelParser.STRING_LITERAL, 0); }
public ConstantContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_constant; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterConstant(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitConstant(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitConstant(this);
else return visitor.visitChildren(this);
}
}
public final ConstantContext constant() throws RecognitionException {
ConstantContext _localctx = new ConstantContext(_ctx, getState());
enterRule(_localctx, 28, RULE_constant);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(125);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==T__11) {
{
setState(124);
match(T__11);
}
}
setState(127);
_la = _input.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__12) | (1L << T__13) | (1L << DECIMAL_LITERAL) | (1L << HEX_LITERAL) | (1L << OCT_LITERAL) | (1L << FLOAT_LITERAL) | (1L << HEX_FLOAT_LITERAL) | (1L << STRING_LITERAL))) != 0)) ) {
_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Expression_listContext extends ParserRuleContext {
public List<Named_expressionContext> named_expression() {
return getRuleContexts(Named_expressionContext.class);
}
public Named_expressionContext named_expression(int i) {
return getRuleContext(Named_expressionContext.class,i);
}
public Expression_listContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_expression_list; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterExpression_list(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitExpression_list(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitExpression_list(this);
else return visitor.visitChildren(this);
}
}
public final Expression_listContext expression_list() throws RecognitionException {
Expression_listContext _localctx = new Expression_listContext(_ctx, getState());
enterRule(_localctx, 30, RULE_expression_list);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(129);
named_expression();
setState(134);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__10) {
{
{
setState(130);
match(T__10);
setState(131);
named_expression();
}
}
setState(136);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Unnamed_expression_listContext extends ParserRuleContext {
public List<ExpressionContext> expression() {
return getRuleContexts(ExpressionContext.class);
}
public ExpressionContext expression(int i) {
return getRuleContext(ExpressionContext.class,i);
}
public Unnamed_expression_listContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_unnamed_expression_list; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterUnnamed_expression_list(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitUnnamed_expression_list(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitUnnamed_expression_list(this);
else return visitor.visitChildren(this);
}
}
public final Unnamed_expression_listContext unnamed_expression_list() throws RecognitionException {
Unnamed_expression_listContext _localctx = new Unnamed_expression_listContext(_ctx, getState());
enterRule(_localctx, 32, RULE_unnamed_expression_list);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(137);
expression(0);
setState(142);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__10) {
{
{
setState(138);
match(T__10);
setState(139);
expression(0);
}
}
setState(144);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class MethodCallContext extends ParserRuleContext {
public TerminalNode NAME() { return getToken(DataModelParser.NAME, 0); }
public Expression_listContext expression_list() {
return getRuleContext(Expression_listContext.class,0);
}
public Unnamed_expression_listContext unnamed_expression_list() {
return getRuleContext(Unnamed_expression_listContext.class,0);
}
public MethodCallContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_methodCall; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterMethodCall(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitMethodCall(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitMethodCall(this);
else return visitor.visitChildren(this);
}
}
public final MethodCallContext methodCall() throws RecognitionException {
MethodCallContext _localctx = new MethodCallContext(_ctx, getState());
enterRule(_localctx, 34, RULE_methodCall);
int _la;
try {
setState(157);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,13,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
setState(145);
match(NAME);
setState(146);
match(T__4);
setState(148);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==NAME) {
{
setState(147);
expression_list();
}
}
setState(150);
match(T__6);
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(151);
match(NAME);
setState(152);
match(T__4);
setState(154);
_errHandler.sync(this);
_la = _input.LA(1);
if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__4) | (1L << T__8) | (1L << T__11) | (1L << T__12) | (1L << T__13) | (1L << T__14) | (1L << T__15) | (1L << T__16) | (1L << NAME) | (1L << DECIMAL_LITERAL) | (1L << HEX_LITERAL) | (1L << OCT_LITERAL) | (1L << FLOAT_LITERAL) | (1L << HEX_FLOAT_LITERAL) | (1L << STRING_LITERAL))) != 0)) {
{
setState(153);
unnamed_expression_list();
}
}
setState(156);
match(T__6);
}
break;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class DistributionContext extends ParserRuleContext {
public TerminalNode NAME() { return getToken(DataModelParser.NAME, 0); }
public Expression_listContext expression_list() {
return getRuleContext(Expression_listContext.class,0);
}
public DistributionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_distribution; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterDistribution(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitDistribution(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitDistribution(this);
else return visitor.visitChildren(this);
}
}
public final DistributionContext distribution() throws RecognitionException {
DistributionContext _localctx = new DistributionContext(_ctx, getState());
enterRule(_localctx, 36, RULE_distribution);
try {
enterOuterAlt(_localctx, 1);
{
setState(159);
match(NAME);
setState(160);
match(T__4);
setState(161);
expression_list();
setState(162);
match(T__6);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Named_expressionContext extends ParserRuleContext {
public TerminalNode NAME() { return getToken(DataModelParser.NAME, 0); }
public ExpressionContext expression() {
return getRuleContext(ExpressionContext.class,0);
}
public Named_expressionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_named_expression; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterNamed_expression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitNamed_expression(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitNamed_expression(this);
else return visitor.visitChildren(this);
}
}
public final Named_expressionContext named_expression() throws RecognitionException {
Named_expressionContext _localctx = new Named_expressionContext(_ctx, getState());
enterRule(_localctx, 38, RULE_named_expression);
try {
enterOuterAlt(_localctx, 1);
{
setState(164);
match(NAME);
setState(165);
match(T__7);
setState(166);
expression(0);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ExpressionContext extends ParserRuleContext {
public Token prefix;
public Token bop;
public Token postfix;
public ConstantContext constant() {
return getRuleContext(ConstantContext.class,0);
}
public TerminalNode NAME() { return getToken(DataModelParser.NAME, 0); }
public List<ExpressionContext> expression() {
return getRuleContexts(ExpressionContext.class);
}
public ExpressionContext expression(int i) {
return getRuleContext(ExpressionContext.class,i);
}
public Unnamed_expression_listContext unnamed_expression_list() {
return getRuleContext(Unnamed_expression_listContext.class,0);
}
public MethodCallContext methodCall() {
return getRuleContext(MethodCallContext.class,0);
}
public Range_listContext range_list() {
return getRuleContext(Range_listContext.class,0);
}
public ExpressionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_expression; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterExpression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitExpression(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitExpression(this);
else return visitor.visitChildren(this);
}
}
public final ExpressionContext expression() throws RecognitionException {
return expression(0);
}
private ExpressionContext expression(int _p) throws RecognitionException {
ParserRuleContext _parentctx = _ctx;
int _parentState = getState();
ExpressionContext _localctx = new ExpressionContext(_ctx, _parentState);
ExpressionContext _prevctx = _localctx;
int _startState = 40;
enterRecursionRule(_localctx, 40, RULE_expression, _p);
int _la;
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
setState(182);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,14,_ctx) ) {
case 1:
{
setState(169);
constant();
}
break;
case 2:
{
setState(170);
match(NAME);
}
break;
case 3:
{
setState(171);
match(T__4);
setState(172);
expression(0);
setState(173);
match(T__6);
}
break;
case 4:
{
setState(175);
match(T__8);
setState(176);
unnamed_expression_list();
setState(177);
match(T__9);
}
break;
case 5:
{
setState(179);
methodCall();
}
break;
case 6:
{
setState(180);
((ExpressionContext)_localctx).prefix = _input.LT(1);
_la = _input.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__11) | (1L << T__14) | (1L << T__15) | (1L << T__16))) != 0)) ) {
((ExpressionContext)_localctx).prefix = (Token)_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
setState(181);
expression(12);
}
break;
}
_ctx.stop = _input.LT(-1);
setState(234);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,17,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
setState(232);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,16,_ctx) ) {
case 1:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(184);
if (!(precpred(_ctx, 11))) throw new FailedPredicateException(this, "precpred(_ctx, 11)");
setState(185);
((ExpressionContext)_localctx).bop = _input.LT(1);
_la = _input.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__17) | (1L << T__18) | (1L << T__19) | (1L << T__20))) != 0)) ) {
((ExpressionContext)_localctx).bop = (Token)_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
setState(186);
expression(12);
}
break;
case 2:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(187);
if (!(precpred(_ctx, 10))) throw new FailedPredicateException(this, "precpred(_ctx, 10)");
setState(188);
((ExpressionContext)_localctx).bop = _input.LT(1);
_la = _input.LA(1);
if ( !(_la==T__11 || _la==T__16) ) {
((ExpressionContext)_localctx).bop = (Token)_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
setState(189);
expression(11);
}
break;
case 3:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(190);
if (!(precpred(_ctx, 9))) throw new FailedPredicateException(this, "precpred(_ctx, 9)");
setState(198);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,15,_ctx) ) {
case 1:
{
setState(191);
match(T__21);
setState(192);
match(T__21);
}
break;
case 2:
{
setState(193);
match(T__22);
setState(194);
match(T__22);
setState(195);
match(T__22);
}
break;
case 3:
{
setState(196);
match(T__22);
setState(197);
match(T__22);
}
break;
}
setState(200);
expression(10);
}
break;
case 4:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(201);
if (!(precpred(_ctx, 8))) throw new FailedPredicateException(this, "precpred(_ctx, 8)");
setState(202);
((ExpressionContext)_localctx).bop = _input.LT(1);
_la = _input.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24))) != 0)) ) {
((ExpressionContext)_localctx).bop = (Token)_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
setState(203);
expression(9);
}
break;
case 5:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(204);
if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)");
setState(205);
((ExpressionContext)_localctx).bop = _input.LT(1);
_la = _input.LA(1);
if ( !(_la==T__25 || _la==T__26) ) {
((ExpressionContext)_localctx).bop = (Token)_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
setState(206);
expression(8);
}
break;
case 6:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(207);
if (!(precpred(_ctx, 6))) throw new FailedPredicateException(this, "precpred(_ctx, 6)");
setState(208);
((ExpressionContext)_localctx).bop = match(T__27);
setState(209);
expression(7);
}
break;
case 7:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(210);
if (!(precpred(_ctx, 5))) throw new FailedPredicateException(this, "precpred(_ctx, 5)");
setState(211);
((ExpressionContext)_localctx).bop = match(T__28);
setState(212);
expression(6);
}
break;
case 8:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(213);
if (!(precpred(_ctx, 4))) throw new FailedPredicateException(this, "precpred(_ctx, 4)");
setState(214);
((ExpressionContext)_localctx).bop = match(T__29);
setState(215);
expression(5);
}
break;
case 9:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(216);
if (!(precpred(_ctx, 3))) throw new FailedPredicateException(this, "precpred(_ctx, 3)");
setState(217);
((ExpressionContext)_localctx).bop = match(T__30);
setState(218);
expression(4);
}
break;
case 10:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(219);
if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)");
setState(220);
((ExpressionContext)_localctx).bop = match(T__31);
setState(221);
expression(3);
}
break;
case 11:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(222);
if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)");
setState(223);
((ExpressionContext)_localctx).bop = match(T__32);
setState(224);
expression(2);
}
break;
case 12:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(225);
if (!(precpred(_ctx, 15))) throw new FailedPredicateException(this, "precpred(_ctx, 15)");
setState(226);
match(T__8);
setState(227);
range_list(0);
setState(228);
match(T__9);
}
break;
case 13:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(230);
if (!(precpred(_ctx, 13))) throw new FailedPredicateException(this, "precpred(_ctx, 13)");
setState(231);
((ExpressionContext)_localctx).postfix = _input.LT(1);
_la = _input.LA(1);
if ( !(_la==T__14 || _la==T__15) ) {
((ExpressionContext)_localctx).postfix = (Token)_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
}
break;
}
}
}
setState(236);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,17,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
unrollRecursionContexts(_parentctx);
}
return _localctx;
}
public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
switch (ruleIndex) {
case 4:
return relation_list_sempred((Relation_listContext)_localctx, predIndex);
case 12:
return range_list_sempred((Range_listContext)_localctx, predIndex);
case 20:
return expression_sempred((ExpressionContext)_localctx, predIndex);
}
return true;
}
private boolean relation_list_sempred(Relation_listContext _localctx, int predIndex) {
switch (predIndex) {
case 0:
return precpred(_ctx, 1);
}
return true;
}
private boolean range_list_sempred(Range_listContext _localctx, int predIndex) {
switch (predIndex) {
case 1:
return precpred(_ctx, 1);
}
return true;
}
private boolean expression_sempred(ExpressionContext _localctx, int predIndex) {
switch (predIndex) {
case 2:
return precpred(_ctx, 11);
case 3:
return precpred(_ctx, 10);
case 4:
return precpred(_ctx, 9);
case 5:
return precpred(_ctx, 8);
case 6:
return precpred(_ctx, 7);
case 7:
return precpred(_ctx, 6);
case 8:
return precpred(_ctx, 5);
case 9:
return precpred(_ctx, 4);
case 10:
return precpred(_ctx, 3);
case 11:
return precpred(_ctx, 2);
case 12:
return precpred(_ctx, 1);
case 13:
return precpred(_ctx, 15);
case 14:
return precpred(_ctx, 13);
}
return true;
}
public static final String _serializedATN =
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\64\u00f0\4\2\t\2"+
"\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+
"\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+
"\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\3\2\5\2.\n\2\3\2\5\2\61\n\2\3"+
"\3\3\3\3\3\3\4\3\4\3\4\3\5\3\5\5\5;\n\5\3\5\3\5\3\6\3\6\3\6\3\6\3\6\7"+
"\6D\n\6\f\6\16\6G\13\6\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\5\7R\n\7\3"+
"\b\3\b\3\b\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3\n\3\n\3\13\3\13\3\13\3\13\3\f"+
"\3\f\3\f\3\f\3\r\3\r\3\r\3\r\3\r\3\r\5\rn\n\r\3\16\3\16\3\16\3\16\3\16"+
"\3\16\7\16v\n\16\f\16\16\16y\13\16\3\17\3\17\5\17}\n\17\3\20\5\20\u0080"+
"\n\20\3\20\3\20\3\21\3\21\3\21\7\21\u0087\n\21\f\21\16\21\u008a\13\21"+
"\3\22\3\22\3\22\7\22\u008f\n\22\f\22\16\22\u0092\13\22\3\23\3\23\3\23"+
"\5\23\u0097\n\23\3\23\3\23\3\23\3\23\5\23\u009d\n\23\3\23\5\23\u00a0\n"+
"\23\3\24\3\24\3\24\3\24\3\24\3\25\3\25\3\25\3\25\3\26\3\26\3\26\3\26\3"+
"\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\5\26\u00b9\n\26\3\26"+
"\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\5\26"+
"\u00c9\n\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26"+
"\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26"+
"\3\26\3\26\3\26\3\26\3\26\3\26\7\26\u00eb\n\26\f\26\16\26\u00ee\13\26"+
"\3\26\2\5\n\32*\27\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*\2\n\4"+
"\2\n\n\'\'\5\2\17\20*,.\60\4\2\16\16\21\23\3\2\24\27\4\2\16\16\23\23\3"+
"\2\30\33\3\2\34\35\3\2\21\22\2\u00fd\2-\3\2\2\2\4\62\3\2\2\2\6\65\3\2"+
"\2\2\b8\3\2\2\2\n>\3\2\2\2\fQ\3\2\2\2\16S\3\2\2\2\20V\3\2\2\2\22]\3\2"+
"\2\2\24_\3\2\2\2\26c\3\2\2\2\30m\3\2\2\2\32o\3\2\2\2\34|\3\2\2\2\36\177"+
"\3\2\2\2 \u0083\3\2\2\2\"\u008b\3\2\2\2$\u009f\3\2\2\2&\u00a1\3\2\2\2"+
"(\u00a6\3\2\2\2*\u00b8\3\2\2\2,.\5\4\3\2-,\3\2\2\2-.\3\2\2\2.\60\3\2\2"+
"\2/\61\5\6\4\2\60/\3\2\2\2\60\61\3\2\2\2\61\3\3\2\2\2\62\63\7$\2\2\63"+
"\64\5\b\5\2\64\5\3\2\2\2\65\66\7%\2\2\66\67\5\b\5\2\67\7\3\2\2\28:\7\3"+
"\2\29;\5\n\6\2:9\3\2\2\2:;\3\2\2\2;<\3\2\2\2<=\7\4\2\2=\t\3\2\2\2>?\b"+
"\6\1\2?@\5\f\7\2@E\3\2\2\2AB\f\3\2\2BD\5\f\7\2CA\3\2\2\2DG\3\2\2\2EC\3"+
"\2\2\2EF\3\2\2\2F\13\3\2\2\2GE\3\2\2\2HI\5\26\f\2IJ\7\5\2\2JR\3\2\2\2"+
"KL\5\24\13\2LM\7\5\2\2MR\3\2\2\2NO\5\16\b\2OP\7\5\2\2PR\3\2\2\2QH\3\2"+
"\2\2QK\3\2\2\2QN\3\2\2\2R\r\3\2\2\2ST\5\20\t\2TU\5\b\5\2U\17\3\2\2\2V"+
"W\7\6\2\2WX\7\7\2\2XY\7&\2\2YZ\7\b\2\2Z[\5\34\17\2[\\\7\t\2\2\\\21\3\2"+
"\2\2]^\t\2\2\2^\23\3\2\2\2_`\5\30\r\2`a\5\22\n\2ab\5*\26\2b\25\3\2\2\2"+
"cd\5\30\r\2de\7\61\2\2ef\5&\24\2f\27\3\2\2\2gn\7&\2\2hi\7&\2\2ij\7\13"+
"\2\2jk\5\32\16\2kl\7\f\2\2ln\3\2\2\2mg\3\2\2\2mh\3\2\2\2n\31\3\2\2\2o"+
"p\b\16\1\2pq\5\34\17\2qw\3\2\2\2rs\f\3\2\2st\7\r\2\2tv\5\34\17\2ur\3\2"+
"\2\2vy\3\2\2\2wu\3\2\2\2wx\3\2\2\2x\33\3\2\2\2yw\3\2\2\2z}\3\2\2\2{}\5"+
"*\26\2|z\3\2\2\2|{\3\2\2\2}\35\3\2\2\2~\u0080\7\16\2\2\177~\3\2\2\2\177"+
"\u0080\3\2\2\2\u0080\u0081\3\2\2\2\u0081\u0082\t\3\2\2\u0082\37\3\2\2"+
"\2\u0083\u0088\5(\25\2\u0084\u0085\7\r\2\2\u0085\u0087\5(\25\2\u0086\u0084"+
"\3\2\2\2\u0087\u008a\3\2\2\2\u0088\u0086\3\2\2\2\u0088\u0089\3\2\2\2\u0089"+
"!\3\2\2\2\u008a\u0088\3\2\2\2\u008b\u0090\5*\26\2\u008c\u008d\7\r\2\2"+
"\u008d\u008f\5*\26\2\u008e\u008c\3\2\2\2\u008f\u0092\3\2\2\2\u0090\u008e"+
"\3\2\2\2\u0090\u0091\3\2\2\2\u0091#\3\2\2\2\u0092\u0090\3\2\2\2\u0093"+
"\u0094\7&\2\2\u0094\u0096\7\7\2\2\u0095\u0097\5 \21\2\u0096\u0095\3\2"+
"\2\2\u0096\u0097\3\2\2\2\u0097\u0098\3\2\2\2\u0098\u00a0\7\t\2\2\u0099"+
"\u009a\7&\2\2\u009a\u009c\7\7\2\2\u009b\u009d\5\"\22\2\u009c\u009b\3\2"+
"\2\2\u009c\u009d\3\2\2\2\u009d\u009e\3\2\2\2\u009e\u00a0\7\t\2\2\u009f"+
"\u0093\3\2\2\2\u009f\u0099\3\2\2\2\u00a0%\3\2\2\2\u00a1\u00a2\7&\2\2\u00a2"+
"\u00a3\7\7\2\2\u00a3\u00a4\5 \21\2\u00a4\u00a5\7\t\2\2\u00a5\'\3\2\2\2"+
"\u00a6\u00a7\7&\2\2\u00a7\u00a8\7\n\2\2\u00a8\u00a9\5*\26\2\u00a9)\3\2"+
"\2\2\u00aa\u00ab\b\26\1\2\u00ab\u00b9\5\36\20\2\u00ac\u00b9\7&\2\2\u00ad"+
"\u00ae\7\7\2\2\u00ae\u00af\5*\26\2\u00af\u00b0\7\t\2\2\u00b0\u00b9\3\2"+
"\2\2\u00b1\u00b2\7\13\2\2\u00b2\u00b3\5\"\22\2\u00b3\u00b4\7\f\2\2\u00b4"+
"\u00b9\3\2\2\2\u00b5\u00b9\5$\23\2\u00b6\u00b7\t\4\2\2\u00b7\u00b9\5*"+
"\26\16\u00b8\u00aa\3\2\2\2\u00b8\u00ac\3\2\2\2\u00b8\u00ad\3\2\2\2\u00b8"+
"\u00b1\3\2\2\2\u00b8\u00b5\3\2\2\2\u00b8\u00b6\3\2\2\2\u00b9\u00ec\3\2"+
"\2\2\u00ba\u00bb\f\r\2\2\u00bb\u00bc\t\5\2\2\u00bc\u00eb\5*\26\16\u00bd"+
"\u00be\f\f\2\2\u00be\u00bf\t\6\2\2\u00bf\u00eb\5*\26\r\u00c0\u00c8\f\13"+
"\2\2\u00c1\u00c2\7\30\2\2\u00c2\u00c9\7\30\2\2\u00c3\u00c4\7\31\2\2\u00c4"+
"\u00c5\7\31\2\2\u00c5\u00c9\7\31\2\2\u00c6\u00c7\7\31\2\2\u00c7\u00c9"+
"\7\31\2\2\u00c8\u00c1\3\2\2\2\u00c8\u00c3\3\2\2\2\u00c8\u00c6\3\2\2\2"+
"\u00c9\u00ca\3\2\2\2\u00ca\u00eb\5*\26\f\u00cb\u00cc\f\n\2\2\u00cc\u00cd"+
"\t\7\2\2\u00cd\u00eb\5*\26\13\u00ce\u00cf\f\t\2\2\u00cf\u00d0\t\b\2\2"+
"\u00d0\u00eb\5*\26\n\u00d1\u00d2\f\b\2\2\u00d2\u00d3\7\36\2\2\u00d3\u00eb"+
"\5*\26\t\u00d4\u00d5\f\7\2\2\u00d5\u00d6\7\37\2\2\u00d6\u00eb\5*\26\b"+
"\u00d7\u00d8\f\6\2\2\u00d8\u00d9\7 \2\2\u00d9\u00eb\5*\26\7\u00da\u00db"+
"\f\5\2\2\u00db\u00dc\7!\2\2\u00dc\u00eb\5*\26\6\u00dd\u00de\f\4\2\2\u00de"+
"\u00df\7\"\2\2\u00df\u00eb\5*\26\5\u00e0\u00e1\f\3\2\2\u00e1\u00e2\7#"+
"\2\2\u00e2\u00eb\5*\26\4\u00e3\u00e4\f\21\2\2\u00e4\u00e5\7\13\2\2\u00e5"+
"\u00e6\5\32\16\2\u00e6\u00e7\7\f\2\2\u00e7\u00eb\3\2\2\2\u00e8\u00e9\f"+
"\17\2\2\u00e9\u00eb\t\t\2\2\u00ea\u00ba\3\2\2\2\u00ea\u00bd\3\2\2\2\u00ea"+
"\u00c0\3\2\2\2\u00ea\u00cb\3\2\2\2\u00ea\u00ce\3\2\2\2\u00ea\u00d1\3\2"+
"\2\2\u00ea\u00d4\3\2\2\2\u00ea\u00d7\3\2\2\2\u00ea\u00da\3\2\2\2\u00ea"+
"\u00dd\3\2\2\2\u00ea\u00e0\3\2\2\2\u00ea\u00e3\3\2\2\2\u00ea\u00e8\3\2"+
"\2\2\u00eb\u00ee\3\2\2\2\u00ec\u00ea\3\2\2\2\u00ec\u00ed\3\2\2\2\u00ed"+
"+\3\2\2\2\u00ee\u00ec\3\2\2\2\24-\60:EQmw|\177\u0088\u0090\u0096\u009c"+
"\u009f\u00b8\u00c8\u00ea\u00ec";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
}
|
UTF-8
|
Java
| 61,060
|
java
|
DataModelParser.java
|
Java
|
[
{
"context": "// Generated from /Users/alexeidrummond/Git/graphicalModelSimulation/lphy/src/lphy/parser",
"end": 39,
"score": 0.9995000958442688,
"start": 25,
"tag": "USERNAME",
"value": "alexeidrummond"
}
] | null |
[] |
// Generated from /Users/alexeidrummond/Git/graphicalModelSimulation/lphy/src/lphy/parser/DataModel.g4 by ANTLR 4.8
package lphy.parser;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class DataModelParser extends Parser {
static { RuntimeMetaData.checkVersion("4.8", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9,
T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, T__14=15, T__15=16, T__16=17,
T__17=18, T__18=19, T__19=20, T__20=21, T__21=22, T__22=23, T__23=24,
T__24=25, T__25=26, T__26=27, T__27=28, T__28=29, T__29=30, T__30=31,
T__31=32, T__32=33, DATA=34, MODEL=35, NAME=36, ARROW=37, LENGTH=38, DIM=39,
DECIMAL_LITERAL=40, HEX_LITERAL=41, OCT_LITERAL=42, BINARY_LITERAL=43,
FLOAT_LITERAL=44, HEX_FLOAT_LITERAL=45, STRING_LITERAL=46, TILDE=47, WS=48,
COMMENT=49, LINE_COMMENT=50;
public static final int
RULE_input = 0, RULE_datablock = 1, RULE_modelblock = 2, RULE_relations = 3,
RULE_relation_list = 4, RULE_relation = 5, RULE_for_loop = 6, RULE_counter = 7,
RULE_assignment = 8, RULE_determ_relation = 9, RULE_stoch_relation = 10,
RULE_var = 11, RULE_range_list = 12, RULE_range_element = 13, RULE_constant = 14,
RULE_expression_list = 15, RULE_unnamed_expression_list = 16, RULE_methodCall = 17,
RULE_distribution = 18, RULE_named_expression = 19, RULE_expression = 20;
private static String[] makeRuleNames() {
return new String[] {
"input", "datablock", "modelblock", "relations", "relation_list", "relation",
"for_loop", "counter", "assignment", "determ_relation", "stoch_relation",
"var", "range_list", "range_element", "constant", "expression_list",
"unnamed_expression_list", "methodCall", "distribution", "named_expression",
"expression"
};
}
public static final String[] ruleNames = makeRuleNames();
private static String[] makeLiteralNames() {
return new String[] {
null, "'{'", "'}'", "';'", "'for'", "'('", "'in'", "')'", "'='", "'['",
"']'", "','", "'-'", "'true'", "'false'", "'++'", "'--'", "'+'", "'**'",
"'*'", "'/'", "'%'", "'<'", "'>'", "'<='", "'>='", "'=='", "'!='", "'&'",
"'^'", "'|'", "'&&'", "'||'", "':'", "'data'", "'model'", null, "'<-'",
"'length'", "'dim'", null, null, null, null, null, null, null, "'~'"
};
}
private static final String[] _LITERAL_NAMES = makeLiteralNames();
private static String[] makeSymbolicNames() {
return new String[] {
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, "DATA", "MODEL",
"NAME", "ARROW", "LENGTH", "DIM", "DECIMAL_LITERAL", "HEX_LITERAL", "OCT_LITERAL",
"BINARY_LITERAL", "FLOAT_LITERAL", "HEX_FLOAT_LITERAL", "STRING_LITERAL",
"TILDE", "WS", "COMMENT", "LINE_COMMENT"
};
}
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "<INVALID>";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
@Override
public String getGrammarFileName() { return "DataModel.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public ATN getATN() { return _ATN; }
public DataModelParser(TokenStream input) {
super(input);
_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
public static class InputContext extends ParserRuleContext {
public DatablockContext datablock() {
return getRuleContext(DatablockContext.class,0);
}
public ModelblockContext modelblock() {
return getRuleContext(ModelblockContext.class,0);
}
public InputContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_input; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterInput(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitInput(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitInput(this);
else return visitor.visitChildren(this);
}
}
public final InputContext input() throws RecognitionException {
InputContext _localctx = new InputContext(_ctx, getState());
enterRule(_localctx, 0, RULE_input);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(43);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==DATA) {
{
setState(42);
datablock();
}
}
setState(46);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==MODEL) {
{
setState(45);
modelblock();
}
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class DatablockContext extends ParserRuleContext {
public TerminalNode DATA() { return getToken(DataModelParser.DATA, 0); }
public RelationsContext relations() {
return getRuleContext(RelationsContext.class,0);
}
public DatablockContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_datablock; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterDatablock(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitDatablock(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitDatablock(this);
else return visitor.visitChildren(this);
}
}
public final DatablockContext datablock() throws RecognitionException {
DatablockContext _localctx = new DatablockContext(_ctx, getState());
enterRule(_localctx, 2, RULE_datablock);
try {
enterOuterAlt(_localctx, 1);
{
setState(48);
match(DATA);
setState(49);
relations();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ModelblockContext extends ParserRuleContext {
public TerminalNode MODEL() { return getToken(DataModelParser.MODEL, 0); }
public RelationsContext relations() {
return getRuleContext(RelationsContext.class,0);
}
public ModelblockContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_modelblock; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterModelblock(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitModelblock(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitModelblock(this);
else return visitor.visitChildren(this);
}
}
public final ModelblockContext modelblock() throws RecognitionException {
ModelblockContext _localctx = new ModelblockContext(_ctx, getState());
enterRule(_localctx, 4, RULE_modelblock);
try {
enterOuterAlt(_localctx, 1);
{
setState(51);
match(MODEL);
setState(52);
relations();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class RelationsContext extends ParserRuleContext {
public Relation_listContext relation_list() {
return getRuleContext(Relation_listContext.class,0);
}
public RelationsContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_relations; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterRelations(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitRelations(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitRelations(this);
else return visitor.visitChildren(this);
}
}
public final RelationsContext relations() throws RecognitionException {
RelationsContext _localctx = new RelationsContext(_ctx, getState());
enterRule(_localctx, 6, RULE_relations);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(54);
match(T__0);
setState(56);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==T__3 || _la==NAME) {
{
setState(55);
relation_list(0);
}
}
setState(58);
match(T__1);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Relation_listContext extends ParserRuleContext {
public RelationContext relation() {
return getRuleContext(RelationContext.class,0);
}
public Relation_listContext relation_list() {
return getRuleContext(Relation_listContext.class,0);
}
public Relation_listContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_relation_list; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterRelation_list(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitRelation_list(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitRelation_list(this);
else return visitor.visitChildren(this);
}
}
public final Relation_listContext relation_list() throws RecognitionException {
return relation_list(0);
}
private Relation_listContext relation_list(int _p) throws RecognitionException {
ParserRuleContext _parentctx = _ctx;
int _parentState = getState();
Relation_listContext _localctx = new Relation_listContext(_ctx, _parentState);
Relation_listContext _prevctx = _localctx;
int _startState = 8;
enterRecursionRule(_localctx, 8, RULE_relation_list, _p);
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
{
setState(61);
relation();
}
_ctx.stop = _input.LT(-1);
setState(67);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,3,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
{
_localctx = new Relation_listContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_relation_list);
setState(63);
if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)");
setState(64);
relation();
}
}
}
setState(69);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,3,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
unrollRecursionContexts(_parentctx);
}
return _localctx;
}
public static class RelationContext extends ParserRuleContext {
public Stoch_relationContext stoch_relation() {
return getRuleContext(Stoch_relationContext.class,0);
}
public Determ_relationContext determ_relation() {
return getRuleContext(Determ_relationContext.class,0);
}
public For_loopContext for_loop() {
return getRuleContext(For_loopContext.class,0);
}
public RelationContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_relation; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterRelation(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitRelation(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitRelation(this);
else return visitor.visitChildren(this);
}
}
public final RelationContext relation() throws RecognitionException {
RelationContext _localctx = new RelationContext(_ctx, getState());
enterRule(_localctx, 10, RULE_relation);
try {
setState(79);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,4,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
setState(70);
stoch_relation();
setState(71);
match(T__2);
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(73);
determ_relation();
setState(74);
match(T__2);
}
break;
case 3:
enterOuterAlt(_localctx, 3);
{
setState(76);
for_loop();
setState(77);
match(T__2);
}
break;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class For_loopContext extends ParserRuleContext {
public CounterContext counter() {
return getRuleContext(CounterContext.class,0);
}
public RelationsContext relations() {
return getRuleContext(RelationsContext.class,0);
}
public For_loopContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_for_loop; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterFor_loop(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitFor_loop(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitFor_loop(this);
else return visitor.visitChildren(this);
}
}
public final For_loopContext for_loop() throws RecognitionException {
For_loopContext _localctx = new For_loopContext(_ctx, getState());
enterRule(_localctx, 12, RULE_for_loop);
try {
enterOuterAlt(_localctx, 1);
{
setState(81);
counter();
setState(82);
relations();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class CounterContext extends ParserRuleContext {
public TerminalNode NAME() { return getToken(DataModelParser.NAME, 0); }
public Range_elementContext range_element() {
return getRuleContext(Range_elementContext.class,0);
}
public CounterContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_counter; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterCounter(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitCounter(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitCounter(this);
else return visitor.visitChildren(this);
}
}
public final CounterContext counter() throws RecognitionException {
CounterContext _localctx = new CounterContext(_ctx, getState());
enterRule(_localctx, 14, RULE_counter);
try {
enterOuterAlt(_localctx, 1);
{
setState(84);
match(T__3);
setState(85);
match(T__4);
setState(86);
match(NAME);
setState(87);
match(T__5);
setState(88);
range_element();
setState(89);
match(T__6);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class AssignmentContext extends ParserRuleContext {
public TerminalNode ARROW() { return getToken(DataModelParser.ARROW, 0); }
public AssignmentContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_assignment; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterAssignment(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitAssignment(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitAssignment(this);
else return visitor.visitChildren(this);
}
}
public final AssignmentContext assignment() throws RecognitionException {
AssignmentContext _localctx = new AssignmentContext(_ctx, getState());
enterRule(_localctx, 16, RULE_assignment);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(91);
_la = _input.LA(1);
if ( !(_la==T__7 || _la==ARROW) ) {
_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Determ_relationContext extends ParserRuleContext {
public VarContext var() {
return getRuleContext(VarContext.class,0);
}
public AssignmentContext assignment() {
return getRuleContext(AssignmentContext.class,0);
}
public ExpressionContext expression() {
return getRuleContext(ExpressionContext.class,0);
}
public Determ_relationContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_determ_relation; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterDeterm_relation(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitDeterm_relation(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitDeterm_relation(this);
else return visitor.visitChildren(this);
}
}
public final Determ_relationContext determ_relation() throws RecognitionException {
Determ_relationContext _localctx = new Determ_relationContext(_ctx, getState());
enterRule(_localctx, 18, RULE_determ_relation);
try {
enterOuterAlt(_localctx, 1);
{
setState(93);
var();
setState(94);
assignment();
setState(95);
expression(0);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Stoch_relationContext extends ParserRuleContext {
public VarContext var() {
return getRuleContext(VarContext.class,0);
}
public TerminalNode TILDE() { return getToken(DataModelParser.TILDE, 0); }
public DistributionContext distribution() {
return getRuleContext(DistributionContext.class,0);
}
public Stoch_relationContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_stoch_relation; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterStoch_relation(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitStoch_relation(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitStoch_relation(this);
else return visitor.visitChildren(this);
}
}
public final Stoch_relationContext stoch_relation() throws RecognitionException {
Stoch_relationContext _localctx = new Stoch_relationContext(_ctx, getState());
enterRule(_localctx, 20, RULE_stoch_relation);
try {
enterOuterAlt(_localctx, 1);
{
setState(97);
var();
setState(98);
match(TILDE);
setState(99);
distribution();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class VarContext extends ParserRuleContext {
public TerminalNode NAME() { return getToken(DataModelParser.NAME, 0); }
public Range_listContext range_list() {
return getRuleContext(Range_listContext.class,0);
}
public VarContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_var; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterVar(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitVar(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitVar(this);
else return visitor.visitChildren(this);
}
}
public final VarContext var() throws RecognitionException {
VarContext _localctx = new VarContext(_ctx, getState());
enterRule(_localctx, 22, RULE_var);
try {
setState(107);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,5,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
setState(101);
match(NAME);
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(102);
match(NAME);
setState(103);
match(T__8);
setState(104);
range_list(0);
setState(105);
match(T__9);
}
break;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Range_listContext extends ParserRuleContext {
public Range_elementContext range_element() {
return getRuleContext(Range_elementContext.class,0);
}
public Range_listContext range_list() {
return getRuleContext(Range_listContext.class,0);
}
public Range_listContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_range_list; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterRange_list(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitRange_list(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitRange_list(this);
else return visitor.visitChildren(this);
}
}
public final Range_listContext range_list() throws RecognitionException {
return range_list(0);
}
private Range_listContext range_list(int _p) throws RecognitionException {
ParserRuleContext _parentctx = _ctx;
int _parentState = getState();
Range_listContext _localctx = new Range_listContext(_ctx, _parentState);
Range_listContext _prevctx = _localctx;
int _startState = 24;
enterRecursionRule(_localctx, 24, RULE_range_list, _p);
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
{
setState(110);
range_element();
}
_ctx.stop = _input.LT(-1);
setState(117);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,6,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
{
_localctx = new Range_listContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_range_list);
setState(112);
if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)");
setState(113);
match(T__10);
setState(114);
range_element();
}
}
}
setState(119);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,6,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
unrollRecursionContexts(_parentctx);
}
return _localctx;
}
public static class Range_elementContext extends ParserRuleContext {
public ExpressionContext expression() {
return getRuleContext(ExpressionContext.class,0);
}
public Range_elementContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_range_element; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterRange_element(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitRange_element(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitRange_element(this);
else return visitor.visitChildren(this);
}
}
public final Range_elementContext range_element() throws RecognitionException {
Range_elementContext _localctx = new Range_elementContext(_ctx, getState());
enterRule(_localctx, 26, RULE_range_element);
try {
setState(122);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,7,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(121);
expression(0);
}
break;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ConstantContext extends ParserRuleContext {
public TerminalNode FLOAT_LITERAL() { return getToken(DataModelParser.FLOAT_LITERAL, 0); }
public TerminalNode DECIMAL_LITERAL() { return getToken(DataModelParser.DECIMAL_LITERAL, 0); }
public TerminalNode OCT_LITERAL() { return getToken(DataModelParser.OCT_LITERAL, 0); }
public TerminalNode HEX_LITERAL() { return getToken(DataModelParser.HEX_LITERAL, 0); }
public TerminalNode HEX_FLOAT_LITERAL() { return getToken(DataModelParser.HEX_FLOAT_LITERAL, 0); }
public TerminalNode STRING_LITERAL() { return getToken(DataModelParser.STRING_LITERAL, 0); }
public ConstantContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_constant; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterConstant(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitConstant(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitConstant(this);
else return visitor.visitChildren(this);
}
}
public final ConstantContext constant() throws RecognitionException {
ConstantContext _localctx = new ConstantContext(_ctx, getState());
enterRule(_localctx, 28, RULE_constant);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(125);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==T__11) {
{
setState(124);
match(T__11);
}
}
setState(127);
_la = _input.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__12) | (1L << T__13) | (1L << DECIMAL_LITERAL) | (1L << HEX_LITERAL) | (1L << OCT_LITERAL) | (1L << FLOAT_LITERAL) | (1L << HEX_FLOAT_LITERAL) | (1L << STRING_LITERAL))) != 0)) ) {
_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Expression_listContext extends ParserRuleContext {
public List<Named_expressionContext> named_expression() {
return getRuleContexts(Named_expressionContext.class);
}
public Named_expressionContext named_expression(int i) {
return getRuleContext(Named_expressionContext.class,i);
}
public Expression_listContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_expression_list; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterExpression_list(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitExpression_list(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitExpression_list(this);
else return visitor.visitChildren(this);
}
}
public final Expression_listContext expression_list() throws RecognitionException {
Expression_listContext _localctx = new Expression_listContext(_ctx, getState());
enterRule(_localctx, 30, RULE_expression_list);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(129);
named_expression();
setState(134);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__10) {
{
{
setState(130);
match(T__10);
setState(131);
named_expression();
}
}
setState(136);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Unnamed_expression_listContext extends ParserRuleContext {
public List<ExpressionContext> expression() {
return getRuleContexts(ExpressionContext.class);
}
public ExpressionContext expression(int i) {
return getRuleContext(ExpressionContext.class,i);
}
public Unnamed_expression_listContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_unnamed_expression_list; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterUnnamed_expression_list(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitUnnamed_expression_list(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitUnnamed_expression_list(this);
else return visitor.visitChildren(this);
}
}
public final Unnamed_expression_listContext unnamed_expression_list() throws RecognitionException {
Unnamed_expression_listContext _localctx = new Unnamed_expression_listContext(_ctx, getState());
enterRule(_localctx, 32, RULE_unnamed_expression_list);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(137);
expression(0);
setState(142);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__10) {
{
{
setState(138);
match(T__10);
setState(139);
expression(0);
}
}
setState(144);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class MethodCallContext extends ParserRuleContext {
public TerminalNode NAME() { return getToken(DataModelParser.NAME, 0); }
public Expression_listContext expression_list() {
return getRuleContext(Expression_listContext.class,0);
}
public Unnamed_expression_listContext unnamed_expression_list() {
return getRuleContext(Unnamed_expression_listContext.class,0);
}
public MethodCallContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_methodCall; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterMethodCall(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitMethodCall(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitMethodCall(this);
else return visitor.visitChildren(this);
}
}
public final MethodCallContext methodCall() throws RecognitionException {
MethodCallContext _localctx = new MethodCallContext(_ctx, getState());
enterRule(_localctx, 34, RULE_methodCall);
int _la;
try {
setState(157);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,13,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
setState(145);
match(NAME);
setState(146);
match(T__4);
setState(148);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==NAME) {
{
setState(147);
expression_list();
}
}
setState(150);
match(T__6);
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(151);
match(NAME);
setState(152);
match(T__4);
setState(154);
_errHandler.sync(this);
_la = _input.LA(1);
if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__4) | (1L << T__8) | (1L << T__11) | (1L << T__12) | (1L << T__13) | (1L << T__14) | (1L << T__15) | (1L << T__16) | (1L << NAME) | (1L << DECIMAL_LITERAL) | (1L << HEX_LITERAL) | (1L << OCT_LITERAL) | (1L << FLOAT_LITERAL) | (1L << HEX_FLOAT_LITERAL) | (1L << STRING_LITERAL))) != 0)) {
{
setState(153);
unnamed_expression_list();
}
}
setState(156);
match(T__6);
}
break;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class DistributionContext extends ParserRuleContext {
public TerminalNode NAME() { return getToken(DataModelParser.NAME, 0); }
public Expression_listContext expression_list() {
return getRuleContext(Expression_listContext.class,0);
}
public DistributionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_distribution; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterDistribution(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitDistribution(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitDistribution(this);
else return visitor.visitChildren(this);
}
}
public final DistributionContext distribution() throws RecognitionException {
DistributionContext _localctx = new DistributionContext(_ctx, getState());
enterRule(_localctx, 36, RULE_distribution);
try {
enterOuterAlt(_localctx, 1);
{
setState(159);
match(NAME);
setState(160);
match(T__4);
setState(161);
expression_list();
setState(162);
match(T__6);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Named_expressionContext extends ParserRuleContext {
public TerminalNode NAME() { return getToken(DataModelParser.NAME, 0); }
public ExpressionContext expression() {
return getRuleContext(ExpressionContext.class,0);
}
public Named_expressionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_named_expression; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterNamed_expression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitNamed_expression(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitNamed_expression(this);
else return visitor.visitChildren(this);
}
}
public final Named_expressionContext named_expression() throws RecognitionException {
Named_expressionContext _localctx = new Named_expressionContext(_ctx, getState());
enterRule(_localctx, 38, RULE_named_expression);
try {
enterOuterAlt(_localctx, 1);
{
setState(164);
match(NAME);
setState(165);
match(T__7);
setState(166);
expression(0);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ExpressionContext extends ParserRuleContext {
public Token prefix;
public Token bop;
public Token postfix;
public ConstantContext constant() {
return getRuleContext(ConstantContext.class,0);
}
public TerminalNode NAME() { return getToken(DataModelParser.NAME, 0); }
public List<ExpressionContext> expression() {
return getRuleContexts(ExpressionContext.class);
}
public ExpressionContext expression(int i) {
return getRuleContext(ExpressionContext.class,i);
}
public Unnamed_expression_listContext unnamed_expression_list() {
return getRuleContext(Unnamed_expression_listContext.class,0);
}
public MethodCallContext methodCall() {
return getRuleContext(MethodCallContext.class,0);
}
public Range_listContext range_list() {
return getRuleContext(Range_listContext.class,0);
}
public ExpressionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_expression; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).enterExpression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DataModelListener ) ((DataModelListener)listener).exitExpression(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DataModelVisitor ) return ((DataModelVisitor<? extends T>)visitor).visitExpression(this);
else return visitor.visitChildren(this);
}
}
public final ExpressionContext expression() throws RecognitionException {
return expression(0);
}
private ExpressionContext expression(int _p) throws RecognitionException {
ParserRuleContext _parentctx = _ctx;
int _parentState = getState();
ExpressionContext _localctx = new ExpressionContext(_ctx, _parentState);
ExpressionContext _prevctx = _localctx;
int _startState = 40;
enterRecursionRule(_localctx, 40, RULE_expression, _p);
int _la;
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
setState(182);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,14,_ctx) ) {
case 1:
{
setState(169);
constant();
}
break;
case 2:
{
setState(170);
match(NAME);
}
break;
case 3:
{
setState(171);
match(T__4);
setState(172);
expression(0);
setState(173);
match(T__6);
}
break;
case 4:
{
setState(175);
match(T__8);
setState(176);
unnamed_expression_list();
setState(177);
match(T__9);
}
break;
case 5:
{
setState(179);
methodCall();
}
break;
case 6:
{
setState(180);
((ExpressionContext)_localctx).prefix = _input.LT(1);
_la = _input.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__11) | (1L << T__14) | (1L << T__15) | (1L << T__16))) != 0)) ) {
((ExpressionContext)_localctx).prefix = (Token)_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
setState(181);
expression(12);
}
break;
}
_ctx.stop = _input.LT(-1);
setState(234);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,17,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
setState(232);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,16,_ctx) ) {
case 1:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(184);
if (!(precpred(_ctx, 11))) throw new FailedPredicateException(this, "precpred(_ctx, 11)");
setState(185);
((ExpressionContext)_localctx).bop = _input.LT(1);
_la = _input.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__17) | (1L << T__18) | (1L << T__19) | (1L << T__20))) != 0)) ) {
((ExpressionContext)_localctx).bop = (Token)_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
setState(186);
expression(12);
}
break;
case 2:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(187);
if (!(precpred(_ctx, 10))) throw new FailedPredicateException(this, "precpred(_ctx, 10)");
setState(188);
((ExpressionContext)_localctx).bop = _input.LT(1);
_la = _input.LA(1);
if ( !(_la==T__11 || _la==T__16) ) {
((ExpressionContext)_localctx).bop = (Token)_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
setState(189);
expression(11);
}
break;
case 3:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(190);
if (!(precpred(_ctx, 9))) throw new FailedPredicateException(this, "precpred(_ctx, 9)");
setState(198);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,15,_ctx) ) {
case 1:
{
setState(191);
match(T__21);
setState(192);
match(T__21);
}
break;
case 2:
{
setState(193);
match(T__22);
setState(194);
match(T__22);
setState(195);
match(T__22);
}
break;
case 3:
{
setState(196);
match(T__22);
setState(197);
match(T__22);
}
break;
}
setState(200);
expression(10);
}
break;
case 4:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(201);
if (!(precpred(_ctx, 8))) throw new FailedPredicateException(this, "precpred(_ctx, 8)");
setState(202);
((ExpressionContext)_localctx).bop = _input.LT(1);
_la = _input.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24))) != 0)) ) {
((ExpressionContext)_localctx).bop = (Token)_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
setState(203);
expression(9);
}
break;
case 5:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(204);
if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)");
setState(205);
((ExpressionContext)_localctx).bop = _input.LT(1);
_la = _input.LA(1);
if ( !(_la==T__25 || _la==T__26) ) {
((ExpressionContext)_localctx).bop = (Token)_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
setState(206);
expression(8);
}
break;
case 6:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(207);
if (!(precpred(_ctx, 6))) throw new FailedPredicateException(this, "precpred(_ctx, 6)");
setState(208);
((ExpressionContext)_localctx).bop = match(T__27);
setState(209);
expression(7);
}
break;
case 7:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(210);
if (!(precpred(_ctx, 5))) throw new FailedPredicateException(this, "precpred(_ctx, 5)");
setState(211);
((ExpressionContext)_localctx).bop = match(T__28);
setState(212);
expression(6);
}
break;
case 8:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(213);
if (!(precpred(_ctx, 4))) throw new FailedPredicateException(this, "precpred(_ctx, 4)");
setState(214);
((ExpressionContext)_localctx).bop = match(T__29);
setState(215);
expression(5);
}
break;
case 9:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(216);
if (!(precpred(_ctx, 3))) throw new FailedPredicateException(this, "precpred(_ctx, 3)");
setState(217);
((ExpressionContext)_localctx).bop = match(T__30);
setState(218);
expression(4);
}
break;
case 10:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(219);
if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)");
setState(220);
((ExpressionContext)_localctx).bop = match(T__31);
setState(221);
expression(3);
}
break;
case 11:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(222);
if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)");
setState(223);
((ExpressionContext)_localctx).bop = match(T__32);
setState(224);
expression(2);
}
break;
case 12:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(225);
if (!(precpred(_ctx, 15))) throw new FailedPredicateException(this, "precpred(_ctx, 15)");
setState(226);
match(T__8);
setState(227);
range_list(0);
setState(228);
match(T__9);
}
break;
case 13:
{
_localctx = new ExpressionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_expression);
setState(230);
if (!(precpred(_ctx, 13))) throw new FailedPredicateException(this, "precpred(_ctx, 13)");
setState(231);
((ExpressionContext)_localctx).postfix = _input.LT(1);
_la = _input.LA(1);
if ( !(_la==T__14 || _la==T__15) ) {
((ExpressionContext)_localctx).postfix = (Token)_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
}
break;
}
}
}
setState(236);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,17,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
unrollRecursionContexts(_parentctx);
}
return _localctx;
}
public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
switch (ruleIndex) {
case 4:
return relation_list_sempred((Relation_listContext)_localctx, predIndex);
case 12:
return range_list_sempred((Range_listContext)_localctx, predIndex);
case 20:
return expression_sempred((ExpressionContext)_localctx, predIndex);
}
return true;
}
private boolean relation_list_sempred(Relation_listContext _localctx, int predIndex) {
switch (predIndex) {
case 0:
return precpred(_ctx, 1);
}
return true;
}
private boolean range_list_sempred(Range_listContext _localctx, int predIndex) {
switch (predIndex) {
case 1:
return precpred(_ctx, 1);
}
return true;
}
private boolean expression_sempred(ExpressionContext _localctx, int predIndex) {
switch (predIndex) {
case 2:
return precpred(_ctx, 11);
case 3:
return precpred(_ctx, 10);
case 4:
return precpred(_ctx, 9);
case 5:
return precpred(_ctx, 8);
case 6:
return precpred(_ctx, 7);
case 7:
return precpred(_ctx, 6);
case 8:
return precpred(_ctx, 5);
case 9:
return precpred(_ctx, 4);
case 10:
return precpred(_ctx, 3);
case 11:
return precpred(_ctx, 2);
case 12:
return precpred(_ctx, 1);
case 13:
return precpred(_ctx, 15);
case 14:
return precpred(_ctx, 13);
}
return true;
}
public static final String _serializedATN =
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\64\u00f0\4\2\t\2"+
"\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+
"\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+
"\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\3\2\5\2.\n\2\3\2\5\2\61\n\2\3"+
"\3\3\3\3\3\3\4\3\4\3\4\3\5\3\5\5\5;\n\5\3\5\3\5\3\6\3\6\3\6\3\6\3\6\7"+
"\6D\n\6\f\6\16\6G\13\6\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\5\7R\n\7\3"+
"\b\3\b\3\b\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3\n\3\n\3\13\3\13\3\13\3\13\3\f"+
"\3\f\3\f\3\f\3\r\3\r\3\r\3\r\3\r\3\r\5\rn\n\r\3\16\3\16\3\16\3\16\3\16"+
"\3\16\7\16v\n\16\f\16\16\16y\13\16\3\17\3\17\5\17}\n\17\3\20\5\20\u0080"+
"\n\20\3\20\3\20\3\21\3\21\3\21\7\21\u0087\n\21\f\21\16\21\u008a\13\21"+
"\3\22\3\22\3\22\7\22\u008f\n\22\f\22\16\22\u0092\13\22\3\23\3\23\3\23"+
"\5\23\u0097\n\23\3\23\3\23\3\23\3\23\5\23\u009d\n\23\3\23\5\23\u00a0\n"+
"\23\3\24\3\24\3\24\3\24\3\24\3\25\3\25\3\25\3\25\3\26\3\26\3\26\3\26\3"+
"\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\5\26\u00b9\n\26\3\26"+
"\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\5\26"+
"\u00c9\n\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26"+
"\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26"+
"\3\26\3\26\3\26\3\26\3\26\3\26\7\26\u00eb\n\26\f\26\16\26\u00ee\13\26"+
"\3\26\2\5\n\32*\27\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*\2\n\4"+
"\2\n\n\'\'\5\2\17\20*,.\60\4\2\16\16\21\23\3\2\24\27\4\2\16\16\23\23\3"+
"\2\30\33\3\2\34\35\3\2\21\22\2\u00fd\2-\3\2\2\2\4\62\3\2\2\2\6\65\3\2"+
"\2\2\b8\3\2\2\2\n>\3\2\2\2\fQ\3\2\2\2\16S\3\2\2\2\20V\3\2\2\2\22]\3\2"+
"\2\2\24_\3\2\2\2\26c\3\2\2\2\30m\3\2\2\2\32o\3\2\2\2\34|\3\2\2\2\36\177"+
"\3\2\2\2 \u0083\3\2\2\2\"\u008b\3\2\2\2$\u009f\3\2\2\2&\u00a1\3\2\2\2"+
"(\u00a6\3\2\2\2*\u00b8\3\2\2\2,.\5\4\3\2-,\3\2\2\2-.\3\2\2\2.\60\3\2\2"+
"\2/\61\5\6\4\2\60/\3\2\2\2\60\61\3\2\2\2\61\3\3\2\2\2\62\63\7$\2\2\63"+
"\64\5\b\5\2\64\5\3\2\2\2\65\66\7%\2\2\66\67\5\b\5\2\67\7\3\2\2\28:\7\3"+
"\2\29;\5\n\6\2:9\3\2\2\2:;\3\2\2\2;<\3\2\2\2<=\7\4\2\2=\t\3\2\2\2>?\b"+
"\6\1\2?@\5\f\7\2@E\3\2\2\2AB\f\3\2\2BD\5\f\7\2CA\3\2\2\2DG\3\2\2\2EC\3"+
"\2\2\2EF\3\2\2\2F\13\3\2\2\2GE\3\2\2\2HI\5\26\f\2IJ\7\5\2\2JR\3\2\2\2"+
"KL\5\24\13\2LM\7\5\2\2MR\3\2\2\2NO\5\16\b\2OP\7\5\2\2PR\3\2\2\2QH\3\2"+
"\2\2QK\3\2\2\2QN\3\2\2\2R\r\3\2\2\2ST\5\20\t\2TU\5\b\5\2U\17\3\2\2\2V"+
"W\7\6\2\2WX\7\7\2\2XY\7&\2\2YZ\7\b\2\2Z[\5\34\17\2[\\\7\t\2\2\\\21\3\2"+
"\2\2]^\t\2\2\2^\23\3\2\2\2_`\5\30\r\2`a\5\22\n\2ab\5*\26\2b\25\3\2\2\2"+
"cd\5\30\r\2de\7\61\2\2ef\5&\24\2f\27\3\2\2\2gn\7&\2\2hi\7&\2\2ij\7\13"+
"\2\2jk\5\32\16\2kl\7\f\2\2ln\3\2\2\2mg\3\2\2\2mh\3\2\2\2n\31\3\2\2\2o"+
"p\b\16\1\2pq\5\34\17\2qw\3\2\2\2rs\f\3\2\2st\7\r\2\2tv\5\34\17\2ur\3\2"+
"\2\2vy\3\2\2\2wu\3\2\2\2wx\3\2\2\2x\33\3\2\2\2yw\3\2\2\2z}\3\2\2\2{}\5"+
"*\26\2|z\3\2\2\2|{\3\2\2\2}\35\3\2\2\2~\u0080\7\16\2\2\177~\3\2\2\2\177"+
"\u0080\3\2\2\2\u0080\u0081\3\2\2\2\u0081\u0082\t\3\2\2\u0082\37\3\2\2"+
"\2\u0083\u0088\5(\25\2\u0084\u0085\7\r\2\2\u0085\u0087\5(\25\2\u0086\u0084"+
"\3\2\2\2\u0087\u008a\3\2\2\2\u0088\u0086\3\2\2\2\u0088\u0089\3\2\2\2\u0089"+
"!\3\2\2\2\u008a\u0088\3\2\2\2\u008b\u0090\5*\26\2\u008c\u008d\7\r\2\2"+
"\u008d\u008f\5*\26\2\u008e\u008c\3\2\2\2\u008f\u0092\3\2\2\2\u0090\u008e"+
"\3\2\2\2\u0090\u0091\3\2\2\2\u0091#\3\2\2\2\u0092\u0090\3\2\2\2\u0093"+
"\u0094\7&\2\2\u0094\u0096\7\7\2\2\u0095\u0097\5 \21\2\u0096\u0095\3\2"+
"\2\2\u0096\u0097\3\2\2\2\u0097\u0098\3\2\2\2\u0098\u00a0\7\t\2\2\u0099"+
"\u009a\7&\2\2\u009a\u009c\7\7\2\2\u009b\u009d\5\"\22\2\u009c\u009b\3\2"+
"\2\2\u009c\u009d\3\2\2\2\u009d\u009e\3\2\2\2\u009e\u00a0\7\t\2\2\u009f"+
"\u0093\3\2\2\2\u009f\u0099\3\2\2\2\u00a0%\3\2\2\2\u00a1\u00a2\7&\2\2\u00a2"+
"\u00a3\7\7\2\2\u00a3\u00a4\5 \21\2\u00a4\u00a5\7\t\2\2\u00a5\'\3\2\2\2"+
"\u00a6\u00a7\7&\2\2\u00a7\u00a8\7\n\2\2\u00a8\u00a9\5*\26\2\u00a9)\3\2"+
"\2\2\u00aa\u00ab\b\26\1\2\u00ab\u00b9\5\36\20\2\u00ac\u00b9\7&\2\2\u00ad"+
"\u00ae\7\7\2\2\u00ae\u00af\5*\26\2\u00af\u00b0\7\t\2\2\u00b0\u00b9\3\2"+
"\2\2\u00b1\u00b2\7\13\2\2\u00b2\u00b3\5\"\22\2\u00b3\u00b4\7\f\2\2\u00b4"+
"\u00b9\3\2\2\2\u00b5\u00b9\5$\23\2\u00b6\u00b7\t\4\2\2\u00b7\u00b9\5*"+
"\26\16\u00b8\u00aa\3\2\2\2\u00b8\u00ac\3\2\2\2\u00b8\u00ad\3\2\2\2\u00b8"+
"\u00b1\3\2\2\2\u00b8\u00b5\3\2\2\2\u00b8\u00b6\3\2\2\2\u00b9\u00ec\3\2"+
"\2\2\u00ba\u00bb\f\r\2\2\u00bb\u00bc\t\5\2\2\u00bc\u00eb\5*\26\16\u00bd"+
"\u00be\f\f\2\2\u00be\u00bf\t\6\2\2\u00bf\u00eb\5*\26\r\u00c0\u00c8\f\13"+
"\2\2\u00c1\u00c2\7\30\2\2\u00c2\u00c9\7\30\2\2\u00c3\u00c4\7\31\2\2\u00c4"+
"\u00c5\7\31\2\2\u00c5\u00c9\7\31\2\2\u00c6\u00c7\7\31\2\2\u00c7\u00c9"+
"\7\31\2\2\u00c8\u00c1\3\2\2\2\u00c8\u00c3\3\2\2\2\u00c8\u00c6\3\2\2\2"+
"\u00c9\u00ca\3\2\2\2\u00ca\u00eb\5*\26\f\u00cb\u00cc\f\n\2\2\u00cc\u00cd"+
"\t\7\2\2\u00cd\u00eb\5*\26\13\u00ce\u00cf\f\t\2\2\u00cf\u00d0\t\b\2\2"+
"\u00d0\u00eb\5*\26\n\u00d1\u00d2\f\b\2\2\u00d2\u00d3\7\36\2\2\u00d3\u00eb"+
"\5*\26\t\u00d4\u00d5\f\7\2\2\u00d5\u00d6\7\37\2\2\u00d6\u00eb\5*\26\b"+
"\u00d7\u00d8\f\6\2\2\u00d8\u00d9\7 \2\2\u00d9\u00eb\5*\26\7\u00da\u00db"+
"\f\5\2\2\u00db\u00dc\7!\2\2\u00dc\u00eb\5*\26\6\u00dd\u00de\f\4\2\2\u00de"+
"\u00df\7\"\2\2\u00df\u00eb\5*\26\5\u00e0\u00e1\f\3\2\2\u00e1\u00e2\7#"+
"\2\2\u00e2\u00eb\5*\26\4\u00e3\u00e4\f\21\2\2\u00e4\u00e5\7\13\2\2\u00e5"+
"\u00e6\5\32\16\2\u00e6\u00e7\7\f\2\2\u00e7\u00eb\3\2\2\2\u00e8\u00e9\f"+
"\17\2\2\u00e9\u00eb\t\t\2\2\u00ea\u00ba\3\2\2\2\u00ea\u00bd\3\2\2\2\u00ea"+
"\u00c0\3\2\2\2\u00ea\u00cb\3\2\2\2\u00ea\u00ce\3\2\2\2\u00ea\u00d1\3\2"+
"\2\2\u00ea\u00d4\3\2\2\2\u00ea\u00d7\3\2\2\2\u00ea\u00da\3\2\2\2\u00ea"+
"\u00dd\3\2\2\2\u00ea\u00e0\3\2\2\2\u00ea\u00e3\3\2\2\2\u00ea\u00e8\3\2"+
"\2\2\u00eb\u00ee\3\2\2\2\u00ec\u00ea\3\2\2\2\u00ec\u00ed\3\2\2\2\u00ed"+
"+\3\2\2\2\u00ee\u00ec\3\2\2\2\24-\60:EQmw|\177\u0088\u0090\u0096\u009c"+
"\u009f\u00b8\u00c8\u00ea\u00ec";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
}
| 61,060
| 0.66623
| 0.605863
| 1,861
| 31.810854
| 30.800074
| 345
| false
| false
| 0
| 0
| 48
| 0.00167
| 81
| 0.001327
| 3.674906
| false
| false
|
2
|
b713b4358e4ee9a4e1dac59c0a13d81676a4a82e
| 23,106,924,080,547
|
b2ebc6e99c76f51c6be1bb642e36adb241ed9013
|
/Android Avatar Builder/app/src/main/java/com/example/android/android_me/ui/MainActivity.java
|
464bb4e9f59eb43873d8dad136bc13cd46f94b51
|
[] |
no_license
|
cyberfuego/Projects
|
https://github.com/cyberfuego/Projects
|
c6b01656d09637a937f8945bc6cdad2de47c93cf
|
05eda1702534bad874f86c84a58be1cf3311551a
|
refs/heads/master
| 2020-04-16T11:40:21.576000
| 2019-11-27T17:21:18
| 2019-11-27T17:21:18
| 165,546,616
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.android.android_me.ui;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.GridView;
import com.example.android.android_me.R;
import com.example.android.android_me.data.AndroidImageAssets;
public class MainActivity extends AppCompatActivity implements MasterListFragment.ImageClickListener {
int headposition, bodyposition, legposition, absoluteposiotion;
Button button;
Boolean mTwoPaneLayout = false;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, AndroidMeActivity.class);
Bundle bundle = new Bundle();
Log.d("Position", " " + headposition + bodyposition + legposition);
bundle.putInt("head", headposition);
bundle.putInt("body", bodyposition);
bundle.putInt("leg", legposition);
intent.putExtras(bundle);
startActivity(intent);
}
});
if (findViewById(R.id.android_me_linear_layout) != null) {
// button.setVisibility(View.GONE);
mTwoPaneLayout = true;
GridView grid = (GridView) findViewById(R.id.grid);
grid.setNumColumns(2);
button.setVisibility(View.GONE);
if(savedInstanceState == null) {
Log.d("Ankush", "Hi I am inside Tab View");
// Create a new head BodyPartFragment
BodyPartFragment headFragment = new BodyPartFragment();
// Set the list of image id's for the head fragment and set the position to the second image in the list
headFragment.setImageIds(AndroidImageAssets.getHeads());
headFragment.setListIndex(headposition);
// Add the fragment to its container using a FragmentManager and a Transaction
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction()
.add(R.id.head_container, headFragment)
.commit();
// Create and display the body and leg BodyPartFragments
BodyPartFragment bodyFragment = new BodyPartFragment();
bodyFragment.setImageIds(AndroidImageAssets.getBodies());
bodyFragment.setListIndex(bodyposition);
fragmentManager.beginTransaction()
.add(R.id.body_container, bodyFragment)
.commit();
BodyPartFragment legFragment = new BodyPartFragment();
legFragment.setImageIds(AndroidImageAssets.getLegs());
legFragment.setListIndex(legposition);
fragmentManager.beginTransaction()
.add(R.id.leg_container, legFragment)
.commit();
}
}
}
@Override
public void imageClicked(int position) {
absoluteposiotion = position;
int elementchanged = absoluteposiotion / 12;
int sendposition = absoluteposiotion - elementchanged * 12;
switch (elementchanged) {
case 0:
headposition = sendposition;
if(mTwoPaneLayout) {
BodyPartFragment fragment = new BodyPartFragment();
FragmentManager manager = getSupportFragmentManager();
fragment.setImageIds(AndroidImageAssets.getHeads());
fragment.setListIndex(headposition);
manager.beginTransaction().replace(R.id.head_container, fragment).commit();
}
break;
case 1:
bodyposition = sendposition;
if(mTwoPaneLayout) {
BodyPartFragment fragment2 = new BodyPartFragment();
FragmentManager manager2 = getSupportFragmentManager();
fragment2.setImageIds(AndroidImageAssets.getBodies());
fragment2.setListIndex(bodyposition);
manager2.beginTransaction().replace(R.id.body_container, fragment2).commit();
}
break;
case 2:
legposition = sendposition;
if(mTwoPaneLayout) {
BodyPartFragment fragment3 = new BodyPartFragment();
FragmentManager manager3 = getSupportFragmentManager();
fragment3.setImageIds(AndroidImageAssets.getLegs());
fragment3.setListIndex(legposition);
manager3.beginTransaction().replace(R.id.leg_container, fragment3).commit();
}
break;
}
Log.d("Position", " " + headposition + bodyposition + legposition);
}
}
|
UTF-8
|
Java
| 5,335
|
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package com.example.android.android_me.ui;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.GridView;
import com.example.android.android_me.R;
import com.example.android.android_me.data.AndroidImageAssets;
public class MainActivity extends AppCompatActivity implements MasterListFragment.ImageClickListener {
int headposition, bodyposition, legposition, absoluteposiotion;
Button button;
Boolean mTwoPaneLayout = false;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, AndroidMeActivity.class);
Bundle bundle = new Bundle();
Log.d("Position", " " + headposition + bodyposition + legposition);
bundle.putInt("head", headposition);
bundle.putInt("body", bodyposition);
bundle.putInt("leg", legposition);
intent.putExtras(bundle);
startActivity(intent);
}
});
if (findViewById(R.id.android_me_linear_layout) != null) {
// button.setVisibility(View.GONE);
mTwoPaneLayout = true;
GridView grid = (GridView) findViewById(R.id.grid);
grid.setNumColumns(2);
button.setVisibility(View.GONE);
if(savedInstanceState == null) {
Log.d("Ankush", "Hi I am inside Tab View");
// Create a new head BodyPartFragment
BodyPartFragment headFragment = new BodyPartFragment();
// Set the list of image id's for the head fragment and set the position to the second image in the list
headFragment.setImageIds(AndroidImageAssets.getHeads());
headFragment.setListIndex(headposition);
// Add the fragment to its container using a FragmentManager and a Transaction
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction()
.add(R.id.head_container, headFragment)
.commit();
// Create and display the body and leg BodyPartFragments
BodyPartFragment bodyFragment = new BodyPartFragment();
bodyFragment.setImageIds(AndroidImageAssets.getBodies());
bodyFragment.setListIndex(bodyposition);
fragmentManager.beginTransaction()
.add(R.id.body_container, bodyFragment)
.commit();
BodyPartFragment legFragment = new BodyPartFragment();
legFragment.setImageIds(AndroidImageAssets.getLegs());
legFragment.setListIndex(legposition);
fragmentManager.beginTransaction()
.add(R.id.leg_container, legFragment)
.commit();
}
}
}
@Override
public void imageClicked(int position) {
absoluteposiotion = position;
int elementchanged = absoluteposiotion / 12;
int sendposition = absoluteposiotion - elementchanged * 12;
switch (elementchanged) {
case 0:
headposition = sendposition;
if(mTwoPaneLayout) {
BodyPartFragment fragment = new BodyPartFragment();
FragmentManager manager = getSupportFragmentManager();
fragment.setImageIds(AndroidImageAssets.getHeads());
fragment.setListIndex(headposition);
manager.beginTransaction().replace(R.id.head_container, fragment).commit();
}
break;
case 1:
bodyposition = sendposition;
if(mTwoPaneLayout) {
BodyPartFragment fragment2 = new BodyPartFragment();
FragmentManager manager2 = getSupportFragmentManager();
fragment2.setImageIds(AndroidImageAssets.getBodies());
fragment2.setListIndex(bodyposition);
manager2.beginTransaction().replace(R.id.body_container, fragment2).commit();
}
break;
case 2:
legposition = sendposition;
if(mTwoPaneLayout) {
BodyPartFragment fragment3 = new BodyPartFragment();
FragmentManager manager3 = getSupportFragmentManager();
fragment3.setImageIds(AndroidImageAssets.getLegs());
fragment3.setListIndex(legposition);
manager3.beginTransaction().replace(R.id.leg_container, fragment3).commit();
}
break;
}
Log.d("Position", " " + headposition + bodyposition + legposition);
}
}
| 5,335
| 0.599813
| 0.595689
| 122
| 42.729507
| 27.50709
| 120
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.713115
| false
| false
|
2
|
cc28608c860a9b1797cce0a42a6e96e1b4bc297c
| 7,129,645,747,816
|
8c457dc4b813248515b76a5dec1937e64feca169
|
/src/main/java/blockchain/Block.java
|
4005a92474ca80bb98df2e4d215f7abb55e341e3
|
[] |
no_license
|
ProjectDIVT/divt-blockchain
|
https://github.com/ProjectDIVT/divt-blockchain
|
e619796d8513912adf2eab90df4e6cac482d1b77
|
dd81fed233b59ef6d3d686780e71b8dd8c5ae944
|
refs/heads/master
| 2021-04-30T05:31:41.930000
| 2018-05-06T21:51:28
| 2018-05-06T21:51:28
| 121,417,870
| 1
| 1
| null | false
| 2018-02-20T21:20:56
| 2018-02-13T18:12:20
| 2018-02-19T20:02:11
| 2018-02-20T21:15:47
| 4
| 1
| 1
| 0
|
Java
| false
| null |
package blockchain;
import org.json.JSONObject;
import util.CryptoUtil;
public class Block {
private int blockFile;
private int index;
private String previousHash;
private String hash;
private long timestamp;
private long nonce;
private long blockchainDifficulty;
public long getBlockchainDifficulty() {
return blockchainDifficulty;
}
public void setBlockchainDifficulty(long blockchainDifficulty) {
this.blockchainDifficulty = blockchainDifficulty;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public String getPreviousHash() {
return previousHash;
}
public void setPreviousHash(String previousHash) {
this.previousHash = previousHash;
}
public String getHash() {
return this.hash;
}
public void setHash(String hash) {
this.hash = hash;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
public long getNonce() {
return nonce;
}
public void setNonce(long nonce) {
this.nonce = nonce;
}
public int getBlockFile() {
return blockFile;
}
public void setBlockFile(int blockFile) {
this.blockFile = blockFile;
}
/**
* Hashes the block parameters and returns it.
*
* @return String The hash of the block.
*/
public String toHash() {
return CryptoUtil.hash(this.index + this.previousHash + this.timestamp + this.nonce);
}
/**
* Returns the first 15 characters from the block hash as a number
*
* @return long The hash of the block as a number.
*/
public long getDifficulty() {
return Long.parseLong(this.hash.substring(0, 15), 16);
}
/**
* Returns the first block of the network also known as the genesis block.
*
* @return Block The genesis block.
*/
static Block getGenesis() {
Block block = new Block();
block.index = 0;
block.previousHash = "0";
block.hash = "0000000000000000";
block.timestamp = 0;
block.nonce = 0;
block.blockFile = 0;
block.blockchainDifficulty = (long) 1e15;
return block;
}
/**
* Creates a JSON with the block parameters.
*
* @return JSONObject The block as a JSON.
*/
public JSONObject toJSON() {
JSONObject json = new JSONObject();
json.put("index", this.getIndex());
json.put("hash", this.getHash());
json.put("timestamp", this.getTimestamp());
json.put("nonce", this.getNonce());
json.put("previousHash", this.getPreviousHash());
json.put("blockchainDifficulty", this.getBlockchainDifficulty());
json.put("blockFile", this.getBlockFile());
return json;
}
/**
* Sets the block parameters from the JSON.
*
* @param json
* The JSON to get the parameters from.
*/
public void fromJSON(JSONObject json) {
this.setIndex(json.getInt("index"));
this.setNonce(json.getLong("nonce"));
this.setPreviousHash(json.getString("previousHash"));
this.setHash(json.getString("hash"));
this.setTimestamp(json.getLong("timestamp"));
this.setBlockchainDifficulty(json.getLong("blockchainDifficulty"));
this.setBlockFile(json.getInt("blockFile"));
}
/**
* Returns the block parameters as a line.
*
* @return String The block parameters on a single line.
*/
public String toFile() {
return index + " " + hash + " " + previousHash + " " + timestamp + " " + nonce + " " + blockchainDifficulty + "\n";
}
/**
* Returns a Block instance from a file line.
*
* @param line
* The line from a file with block parameters.
* @param blockFile
* The number of the block file.
* @return Block The block from the line.
*/
public static Block fromFile(String line, int blockFile) {
String[] params = line.split(" "); // Have to be validate
Block block = new Block();
block.index = Integer.parseInt(params[0]);
block.hash = params[1];
block.previousHash = params[2];
block.timestamp = Long.parseLong(params[3]);
block.nonce = Long.parseLong(params[4]);
block.blockchainDifficulty = Long.parseLong(params[5]); // Validate
block.setBlockFile(blockFile);
return block;
}
}
|
UTF-8
|
Java
| 4,070
|
java
|
Block.java
|
Java
|
[] | null |
[] |
package blockchain;
import org.json.JSONObject;
import util.CryptoUtil;
public class Block {
private int blockFile;
private int index;
private String previousHash;
private String hash;
private long timestamp;
private long nonce;
private long blockchainDifficulty;
public long getBlockchainDifficulty() {
return blockchainDifficulty;
}
public void setBlockchainDifficulty(long blockchainDifficulty) {
this.blockchainDifficulty = blockchainDifficulty;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public String getPreviousHash() {
return previousHash;
}
public void setPreviousHash(String previousHash) {
this.previousHash = previousHash;
}
public String getHash() {
return this.hash;
}
public void setHash(String hash) {
this.hash = hash;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
public long getNonce() {
return nonce;
}
public void setNonce(long nonce) {
this.nonce = nonce;
}
public int getBlockFile() {
return blockFile;
}
public void setBlockFile(int blockFile) {
this.blockFile = blockFile;
}
/**
* Hashes the block parameters and returns it.
*
* @return String The hash of the block.
*/
public String toHash() {
return CryptoUtil.hash(this.index + this.previousHash + this.timestamp + this.nonce);
}
/**
* Returns the first 15 characters from the block hash as a number
*
* @return long The hash of the block as a number.
*/
public long getDifficulty() {
return Long.parseLong(this.hash.substring(0, 15), 16);
}
/**
* Returns the first block of the network also known as the genesis block.
*
* @return Block The genesis block.
*/
static Block getGenesis() {
Block block = new Block();
block.index = 0;
block.previousHash = "0";
block.hash = "0000000000000000";
block.timestamp = 0;
block.nonce = 0;
block.blockFile = 0;
block.blockchainDifficulty = (long) 1e15;
return block;
}
/**
* Creates a JSON with the block parameters.
*
* @return JSONObject The block as a JSON.
*/
public JSONObject toJSON() {
JSONObject json = new JSONObject();
json.put("index", this.getIndex());
json.put("hash", this.getHash());
json.put("timestamp", this.getTimestamp());
json.put("nonce", this.getNonce());
json.put("previousHash", this.getPreviousHash());
json.put("blockchainDifficulty", this.getBlockchainDifficulty());
json.put("blockFile", this.getBlockFile());
return json;
}
/**
* Sets the block parameters from the JSON.
*
* @param json
* The JSON to get the parameters from.
*/
public void fromJSON(JSONObject json) {
this.setIndex(json.getInt("index"));
this.setNonce(json.getLong("nonce"));
this.setPreviousHash(json.getString("previousHash"));
this.setHash(json.getString("hash"));
this.setTimestamp(json.getLong("timestamp"));
this.setBlockchainDifficulty(json.getLong("blockchainDifficulty"));
this.setBlockFile(json.getInt("blockFile"));
}
/**
* Returns the block parameters as a line.
*
* @return String The block parameters on a single line.
*/
public String toFile() {
return index + " " + hash + " " + previousHash + " " + timestamp + " " + nonce + " " + blockchainDifficulty + "\n";
}
/**
* Returns a Block instance from a file line.
*
* @param line
* The line from a file with block parameters.
* @param blockFile
* The number of the block file.
* @return Block The block from the line.
*/
public static Block fromFile(String line, int blockFile) {
String[] params = line.split(" "); // Have to be validate
Block block = new Block();
block.index = Integer.parseInt(params[0]);
block.hash = params[1];
block.previousHash = params[2];
block.timestamp = Long.parseLong(params[3]);
block.nonce = Long.parseLong(params[4]);
block.blockchainDifficulty = Long.parseLong(params[5]); // Validate
block.setBlockFile(blockFile);
return block;
}
}
| 4,070
| 0.685995
| 0.676904
| 171
| 22.80117
| 21.62969
| 117
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.549708
| false
| false
|
2
|
a8e00a44486e5f1be97419fe6d3aa8cfea8f3f1f
| 35,639,638,624,625
|
8aef98121aa7eb7759e6a968056a2c8473a76921
|
/app/src/main/java/com/example/spaventas/myapplication/MainActivity.java
|
0997f2858dad85f5a53daeda4aef1347b86a6ed6
|
[] |
no_license
|
andreall0/Choice
|
https://github.com/andreall0/Choice
|
422f4b9aeab8db8929975d0e58941b943aeb01f6
|
c2d2a3046aa94560960515db01a83f7b01cb6411
|
refs/heads/master
| 2021-01-22T03:31:12.892000
| 2017-06-22T10:58:12
| 2017-06-22T10:58:12
| 92,386,822
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.spaventas.myapplication;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
}
public void onProfile(View view){
Intent intent = new Intent(this, profileActivity.class); //meccanismo tramite cui un'activity ne lancia un'altra
startActivity(intent);
}
}
|
UTF-8
|
Java
| 594
|
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package com.example.spaventas.myapplication;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
}
public void onProfile(View view){
Intent intent = new Intent(this, profileActivity.class); //meccanismo tramite cui un'activity ne lancia un'altra
startActivity(intent);
}
}
| 594
| 0.744108
| 0.742424
| 20
| 28.700001
| 28.390316
| 120
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.5
| false
| false
|
2
|
e05393155fb084ad147377052aab73bd352c0876
| 34,256,659,166,875
|
6f296f8e15dc16120dec718226ff0c46c2b39472
|
/JImage/src/br/uninove/jimage/view/components/icon/IconDemoApp.java
|
90c64d2026dbe8f6d1db13b375d156340d7fc97a
|
[] |
no_license
|
dilnei/jimageclassifier
|
https://github.com/dilnei/jimageclassifier
|
fabc1435f0ca43e740602e4ef08d4cf7c256219b
|
62008134479dd7f18a3e665189cf0fd7620ee4cd
|
refs/heads/master
| 2020-01-21T05:39:13.289000
| 2010-06-29T16:39:54
| 2010-06-29T16:39:54
| 35,392,247
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package br.uninove.jimage.view.components.icon;
import java.awt.BorderLayout;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.image.BufferedImage;
import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JToolBar;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
public class IconDemoApp extends JFrame {
private JLabel photographLabel = new JLabel();
private JToolBar buttonBar = new JToolBar();
private String imagedir = "images/";
private MissingIcon placeholderIcon = new MissingIcon();
/**
* Lista de todas as descrições dos arquivos de imagem. Estes
* correspondem um a um com os nomes do arquivo de imagem.
*/
private String[] imageCaptions = { "Original SUNW Logo", "The Clocktower",
"Clocktower from the West", "The Mansion", "Sun Auditorium"};
/**
* Lista de todos os arquivos de imagem para carregar.
*/
private String[] imageFileNames = { "sunw01.jpg", "sunw02.jpg",
"sunw03.jpg", "sunw04.jpg", "sunw05.jpg"};
public static void main(String args[]) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
IconDemoApp app = new IconDemoApp();
app.setVisible(true);
}
});
}
public IconDemoApp() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("Icon Demo: Please Select an Image");
// Um label para exibir as fotos
photographLabel.setVerticalTextPosition(JLabel.BOTTOM);
photographLabel.setHorizontalTextPosition(JLabel.CENTER);
photographLabel.setHorizontalAlignment(JLabel.CENTER);
photographLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
// We add two glue components. Later in process() we will add miniatura buttons
// to the toolbar inbetween thease glue compoents. This will center the
// buttons in the toolbar.
buttonBar.add(Box.createGlue());
buttonBar.add(Box.createGlue());
add(buttonBar, BorderLayout.SOUTH);
add(photographLabel, BorderLayout.CENTER);
setSize(400, 300);
setLocationRelativeTo(null);
// iniciar o carregamento da imagem SwingWorker em um segmento de segundo plano
loadimages.execute();
}
/**
* Classe SwingWorker que carrega as imagens de uma discussão de fundo e solicita publicar
* Quando um novo está pronto para ser exibido.
*
* Usamos Void param SwingWroker como o primeiro, já que não precisará retornar
* Qualquer coisa de doInBackground().
*/
private SwingWorker<Void, MiniaturaAction> loadimages = new SwingWorker<Void, MiniaturaAction>() {
/**
* Cria em tamanho maior e versões miniatura dos arquivos de imagem de destino.
*/
@Override
protected Void doInBackground() throws Exception {
for (int i = 0; i < imageCaptions.length; i++) {
ImageIcon icon;
icon = createImageIcon(imagedir + imageFileNames[i], imageCaptions[i]);
MiniaturaAction thumbAction;
if(icon != null){
ImageIcon miniaturaIcon = new ImageIcon(getScaledImage(icon.getImage(), 32, 32));
thumbAction = new MiniaturaAction(icon, miniaturaIcon, imageCaptions[i]);
}else{
// the image failed to load for some reason
// so load a placeholder instead
thumbAction = new MiniaturaAction(placeholderIcon, placeholderIcon, imageCaptions[i]);
}
publish(thumbAction);
}
// Infelizmente temos de devolver alguma coisa, e só é válido null para
// return when the return type is void.
return null;
}
/**
* Processar todas as imagens carregadas.
*/
@Override
protected void process(List<MiniaturaAction> chunks) {
for (MiniaturaAction miniaturaAction : chunks) {
JButton minuaturaButton = new JButton(miniaturaAction);
// add the new button BEFORE the last glue
// this centers the buttons in the toolbar
buttonBar.add(minuaturaButton, buttonBar.getComponentCount() - 1);
}
}
};
/**
* Cria um ImageIcon se o caminho for válido.
* @param String - caminho da imagem
* @param String - descrição da imagem
*/
protected ImageIcon createImageIcon(String path,
String description) {
java.net.URL imgURL = getClass().getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL, description);
} else {
System.err.println("Não foi possível encontrar o arquivo: " + path);
return null;
}
}
/**
* Redimensiona uma imagem usando um objeto Graphics2D um BufferedImage.
* @param srcImg - imagem de origem para escala
* @param w - largura desejada
* @param h - altura desejada
* @return - A nova imagem redimensionada
*/
private Image getScaledImage(Image srcImg, int w, int h){
BufferedImage resizedImg = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = resizedImg.createGraphics();
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2.drawImage(srcImg, 0, 0, w, h, null);
g2.dispose();
return resizedImg;
}
private class MiniaturaAction extends AbstractAction{
/**
* O ícone da imagem que sera exibida completa.
*/
private Icon displayPhoto;
/**
* @param photo
* foto que sera exibita completa
* @param miniatura
* miniatura da imagem.
* @param desc
* descrição de cada miniatura que sera exibita
*/
public MiniaturaAction(Icon photo, Icon miniatura, String desc){
displayPhoto = photo;
putValue(SHORT_DESCRIPTION, desc);
// The LARGE_ICON_KEY is the key for setting the
// icon when an Action is applied to a button.
putValue(LARGE_ICON_KEY, miniatura);
}
/**
* Mostra a imagem completa na área principal e define o título da aplicação.
*/
public void actionPerformed(ActionEvent e) {
photographLabel.setIcon(displayPhoto);
setTitle("Icon: " + getValue(SHORT_DESCRIPTION).toString());
}
}
}
|
ISO-8859-1
|
Java
| 7,313
|
java
|
IconDemoApp.java
|
Java
|
[] | null |
[] |
package br.uninove.jimage.view.components.icon;
import java.awt.BorderLayout;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.image.BufferedImage;
import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JToolBar;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
public class IconDemoApp extends JFrame {
private JLabel photographLabel = new JLabel();
private JToolBar buttonBar = new JToolBar();
private String imagedir = "images/";
private MissingIcon placeholderIcon = new MissingIcon();
/**
* Lista de todas as descrições dos arquivos de imagem. Estes
* correspondem um a um com os nomes do arquivo de imagem.
*/
private String[] imageCaptions = { "Original SUNW Logo", "The Clocktower",
"Clocktower from the West", "The Mansion", "Sun Auditorium"};
/**
* Lista de todos os arquivos de imagem para carregar.
*/
private String[] imageFileNames = { "sunw01.jpg", "sunw02.jpg",
"sunw03.jpg", "sunw04.jpg", "sunw05.jpg"};
public static void main(String args[]) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
IconDemoApp app = new IconDemoApp();
app.setVisible(true);
}
});
}
public IconDemoApp() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("Icon Demo: Please Select an Image");
// Um label para exibir as fotos
photographLabel.setVerticalTextPosition(JLabel.BOTTOM);
photographLabel.setHorizontalTextPosition(JLabel.CENTER);
photographLabel.setHorizontalAlignment(JLabel.CENTER);
photographLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
// We add two glue components. Later in process() we will add miniatura buttons
// to the toolbar inbetween thease glue compoents. This will center the
// buttons in the toolbar.
buttonBar.add(Box.createGlue());
buttonBar.add(Box.createGlue());
add(buttonBar, BorderLayout.SOUTH);
add(photographLabel, BorderLayout.CENTER);
setSize(400, 300);
setLocationRelativeTo(null);
// iniciar o carregamento da imagem SwingWorker em um segmento de segundo plano
loadimages.execute();
}
/**
* Classe SwingWorker que carrega as imagens de uma discussão de fundo e solicita publicar
* Quando um novo está pronto para ser exibido.
*
* Usamos Void param SwingWroker como o primeiro, já que não precisará retornar
* Qualquer coisa de doInBackground().
*/
private SwingWorker<Void, MiniaturaAction> loadimages = new SwingWorker<Void, MiniaturaAction>() {
/**
* Cria em tamanho maior e versões miniatura dos arquivos de imagem de destino.
*/
@Override
protected Void doInBackground() throws Exception {
for (int i = 0; i < imageCaptions.length; i++) {
ImageIcon icon;
icon = createImageIcon(imagedir + imageFileNames[i], imageCaptions[i]);
MiniaturaAction thumbAction;
if(icon != null){
ImageIcon miniaturaIcon = new ImageIcon(getScaledImage(icon.getImage(), 32, 32));
thumbAction = new MiniaturaAction(icon, miniaturaIcon, imageCaptions[i]);
}else{
// the image failed to load for some reason
// so load a placeholder instead
thumbAction = new MiniaturaAction(placeholderIcon, placeholderIcon, imageCaptions[i]);
}
publish(thumbAction);
}
// Infelizmente temos de devolver alguma coisa, e só é válido null para
// return when the return type is void.
return null;
}
/**
* Processar todas as imagens carregadas.
*/
@Override
protected void process(List<MiniaturaAction> chunks) {
for (MiniaturaAction miniaturaAction : chunks) {
JButton minuaturaButton = new JButton(miniaturaAction);
// add the new button BEFORE the last glue
// this centers the buttons in the toolbar
buttonBar.add(minuaturaButton, buttonBar.getComponentCount() - 1);
}
}
};
/**
* Cria um ImageIcon se o caminho for válido.
* @param String - caminho da imagem
* @param String - descrição da imagem
*/
protected ImageIcon createImageIcon(String path,
String description) {
java.net.URL imgURL = getClass().getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL, description);
} else {
System.err.println("Não foi possível encontrar o arquivo: " + path);
return null;
}
}
/**
* Redimensiona uma imagem usando um objeto Graphics2D um BufferedImage.
* @param srcImg - imagem de origem para escala
* @param w - largura desejada
* @param h - altura desejada
* @return - A nova imagem redimensionada
*/
private Image getScaledImage(Image srcImg, int w, int h){
BufferedImage resizedImg = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = resizedImg.createGraphics();
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2.drawImage(srcImg, 0, 0, w, h, null);
g2.dispose();
return resizedImg;
}
private class MiniaturaAction extends AbstractAction{
/**
* O ícone da imagem que sera exibida completa.
*/
private Icon displayPhoto;
/**
* @param photo
* foto que sera exibita completa
* @param miniatura
* miniatura da imagem.
* @param desc
* descrição de cada miniatura que sera exibita
*/
public MiniaturaAction(Icon photo, Icon miniatura, String desc){
displayPhoto = photo;
putValue(SHORT_DESCRIPTION, desc);
// The LARGE_ICON_KEY is the key for setting the
// icon when an Action is applied to a button.
putValue(LARGE_ICON_KEY, miniatura);
}
/**
* Mostra a imagem completa na área principal e define o título da aplicação.
*/
public void actionPerformed(ActionEvent e) {
photographLabel.setIcon(displayPhoto);
setTitle("Icon: " + getValue(SHORT_DESCRIPTION).toString());
}
}
}
| 7,313
| 0.593416
| 0.588615
| 226
| 31.256638
| 26.825155
| 107
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.535398
| false
| false
|
2
|
f5746dd8a0e23c60c87edbdf73424490531a44f2
| 18,588,618,489,783
|
1e4b317d7455a79be634a22cd24b35c9a9a78a63
|
/app/src/main/java/xyz/julianpeters/timedlists/providers/ListsContentProvider.java
|
129be6b9fd1c3d730bd1735eab06bcd18988fdc1
|
[
"MIT"
] |
permissive
|
ZireJP/TimedLists
|
https://github.com/ZireJP/TimedLists
|
6104ee04aadff12fc09f5f6cecea7aa240e2a3c4
|
7ee5349024e0ea058b3fb05c772a44fda2df9a2f
|
refs/heads/master
| 2021-01-20T18:14:52.574000
| 2017-05-20T16:04:48
| 2017-05-20T16:04:48
| 90,912,680
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package xyz.julianpeters.timedlists.providers;
import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
import java.util.HashMap;
import xyz.julianpeters.timedlists.providers.helpers.Item;
import xyz.julianpeters.timedlists.providers.helpers.ItemInItem;
/**
* Created by julian on 08.05.17.
*/
public class ListsContentProvider extends ContentProvider {
private static final String TAG = "ListsContentProvider";
private static final String DATABASE_NAME = "lists.db";
private static final int DATABASE_VERSION = 11;
public static final String LISTS_TABLE_NAME = "lists";
public static final String USER_TABLE_NAME = "table_";
public static final String AUTHORITY = "xyz.julianpeters.timedlists.providers.ListsContentProvider";
private static final UriMatcher sUriMatcher;
private static final int LISTS = 1;
private static final int LISTS_ID = 2;
private static final int USER_TABLE = 3;
private static final int USER_TABLE_ID = 4;
private static HashMap<String, String> listsProjectionMap;
private static class DatabaseHelper extends SQLiteOpenHelper {
public DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + LISTS_TABLE_NAME + " (" + Item.Items.ITEM_ID
+ " INTEGER PRIMARY KEY AUTOINCREMENT, " + Item.Items.TITLE + " VARCHAR(255), "
+ Item.Items.NOTES + " VARCHAR(8000), "
+ Item.Items.TIME + " INTEGER, " + Item.Items.IS_LIST + " BOOLEAN, "
+ Item.Items.ORDER + " INTEGER, "
+ Item.Items.LINKS + " INTEGER, "
+ Item.Items.TAG + " VARCHAR(8));");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Log.w(TAG, "Upgrading database from version " + oldVersion + " to " + newVersion
+ ", which will destroy all old data");
db.execSQL("DROP TABLE IF EXISTS " + LISTS_TABLE_NAME);
Cursor c = db.rawQuery("SELECT name FROM sqlite_master WHERE name LIKE 'table_%'", null);
if (c.moveToFirst()) {
do {
String table = c.getString(0);
Log.w(TAG, "Dropped table " + table);
db.execSQL("DROP TABLE IF EXISTS " + table);
} while (c.moveToNext());
}
c.close();
onCreate(db);
}
}
private DatabaseHelper dbHelper;
@Override
public boolean onCreate() {
dbHelper = new DatabaseHelper(getContext());
return true;
}
@Nullable
@Override
public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
switch (sUriMatcher.match(uri)) {
case LISTS:
qb.setTables(LISTS_TABLE_NAME);
qb.setProjectionMap(listsProjectionMap);
break;
case LISTS_ID:
qb.setTables(LISTS_TABLE_NAME);
qb.setProjectionMap(listsProjectionMap);
selection = Item.Items.ITEM_ID + " = " + uri.getLastPathSegment();
break;
case USER_TABLE:
qb.setTables(selection);
selection = null;
break;
case USER_TABLE_ID:
qb.setTables(ItemInItem.ItemInItems.table(uri.getLastPathSegment()));
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
SQLiteDatabase db = dbHelper.getReadableDatabase();
Cursor c = qb.query(db, projection, selection, selectionArgs, null, null, sortOrder);
c.setNotificationUri(getContext().getContentResolver(), uri);
return c;
}
@Nullable
@Override
public String getType(@NonNull Uri uri) {
switch (sUriMatcher.match(uri)) {
case LISTS:
return Item.Items.CONTENT_TYPE;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
}
@Nullable
@Override
public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) {
ContentValues val;
if (values != null) {
val = new ContentValues(values);
} else {
val = new ContentValues();
}
SQLiteDatabase db = dbHelper.getWritableDatabase();
long rowId;
long tabRow;
switch (sUriMatcher.match(uri)) {
case LISTS:
rowId = db.insert(LISTS_TABLE_NAME, Item.Items.TIME, val);
createNewList(db, Long.toString(rowId));
if (rowId > 0) {
Uri itemUri = ContentUris.withAppendedId(Item.Items.CONTENT_URI, rowId);
getContext().getContentResolver().notifyChange(itemUri, null);
return itemUri;
}
throw new SQLException("Failed to insert row into " + uri);
case USER_TABLE_ID:
String tableId = uri.getLastPathSegment();
tabRow = db.insert(USER_TABLE_NAME + tableId, ItemInItem.ItemInItems.REPEAT, val);
if (tabRow > 0) {
Uri itemUri = ContentUris.withAppendedId(ItemInItem.ItemInItems.CONTENT_URI, tabRow);
getContext().getContentResolver().notifyChange(itemUri, null);
return itemUri;
}
throw new SQLException("Failed to insert row into " + uri);
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
}
@Override
public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) {
SQLiteDatabase db = dbHelper.getWritableDatabase();
int count;
switch (sUriMatcher.match(uri)) {
case LISTS:
dropLists(db, selection, selectionArgs);
count = db.delete(LISTS_TABLE_NAME, selection, selectionArgs);
break;
case LISTS_ID:
selection = selection + "_id = " + uri.getLastPathSegment();
dropLists(db, selection, selectionArgs);
count = db.delete(LISTS_TABLE_NAME, selection, selectionArgs);
break;
case USER_TABLE:
count = db.delete(selectionArgs[0], selection, new String[]{selectionArgs[1]});
break;
case USER_TABLE_ID:
count = db.delete(USER_TABLE_NAME + uri.getLastPathSegment(), selection, selectionArgs);
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
getContext().getContentResolver().notifyChange(uri, null);
return count;
}
@Override
public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) {
SQLiteDatabase db = dbHelper.getWritableDatabase();
int count;
switch (sUriMatcher.match(uri)) {
case LISTS:
count = db.update(LISTS_TABLE_NAME, values, selection, selectionArgs);
break;
case LISTS_ID:
selection = Item.Items.ITEM_ID + " = " + uri.getLastPathSegment();
count = db.update(LISTS_TABLE_NAME, values, selection, selectionArgs);
break;
case USER_TABLE:
count = 0;
break;
case USER_TABLE_ID:
count = db.update(USER_TABLE_NAME + uri.getLastPathSegment(), values, selection, selectionArgs);
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
getContext().getContentResolver().notifyChange(uri, null);
getContext().getContentResolver().notifyChange(ItemInItem.ItemInItems.CONTENT_URI, null);
return count;
}
public int getRows(String table_id) {
SQLiteDatabase db = dbHelper.getReadableDatabase();
String count = "SELECT count(*) FROM " + table_id;
Cursor cursor = db.rawQuery(count, null);
cursor.moveToFirst();
int i = cursor.getInt(0);
cursor.close();
return i;
}
@Nullable
@Override
public Bundle call(@NonNull String method, @Nullable String arg, @Nullable Bundle extras) {
SQLiteDatabase db;
Bundle bundle = new Bundle();
switch (method) {
case "getRows":
bundle.putInt("rows", getRows(USER_TABLE_NAME + arg));
return bundle;
case "deleteAllItemsOf":
db = dbHelper.getWritableDatabase();
bundle.putInt("deletes", deleteAllItemsOf(db, arg));
return bundle;
case "deleteIncrement":
db = dbHelper.getWritableDatabase();
String y = extras.getString("position");
String tabley = extras.getString("table");
String ordery = extras.getString("order");
db.execSQL("UPDATE " + tabley + " SET " + ordery + " = " + ordery + " -1" + " WHERE " + ordery + " > " + y);
return null;
case "appendNotes":
db = dbHelper.getWritableDatabase();
db.execSQL("UPDATE " + LISTS_TABLE_NAME + " SET " + Item.Items.NOTES + " = " + extras.getString("string") + " WHERE " + Item.Items.ITEM_ID + " = " + arg);
default:
return null;
}
}
public void createNewList(SQLiteDatabase db, String _id) {
db.execSQL("CREATE TABLE " + ItemInItem.ItemInItems.table(_id) + " ("
+ Item.Items.ITEM_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ ItemInItem.ItemInItems.NAME + " VARCHAR(255),"
+ ItemInItem.ItemInItems.REPEAT + " INTEGER, "
+ ItemInItem.ItemInItems.ORDER + " INTEGER, "
+ ItemInItem.ItemInItems.FOREIGN_KEY + " INTEGER, FOREIGN KEY ("
+ ItemInItem.ItemInItems.FOREIGN_KEY + ") REFERENCES "
+ LISTS_TABLE_NAME + "(" + Item.Items.ITEM_ID + "));");
}
public void dropLists(SQLiteDatabase db, @Nullable String selection, @Nullable String[] selectionArgs) {
Cursor c = db.query(LISTS_TABLE_NAME, new String[]{Item.Items.ITEM_ID}, selection, selectionArgs, null, null, null);
if (c.moveToFirst()) {
do {
dropList(db, c.getString(0));
} while (c.moveToNext());
}
c.close();
}
public void dropList(SQLiteDatabase db, String _id) {
db.execSQL("DROP TABLE IF EXISTS " + ItemInItem.ItemInItems.table(_id));
Log.d("Dropped Table", "table_" + _id);
}
public int deleteAllItemsOf(SQLiteDatabase db, String _id) {
int i = _deleteAllItemsOf(db, _id);
getContext().getContentResolver().notifyChange(Item.Items.CONTENT_URI, null);
return i;
}
private int _deleteAllItemsOf(SQLiteDatabase db, String _id) {
int i = 0;
Cursor linkCursor = db.query(LISTS_TABLE_NAME, new String[]{Item.Items.LINKS}, Item.Items._ID + " = " + _id, null, null, null, null);
linkCursor.moveToFirst();
int links = linkCursor.getInt(0);
if (links > 0) {
ContentValues values = new ContentValues();
values.put(Item.Items.LINKS, links - 1);
db.update(LISTS_TABLE_NAME, values, Item.Items.ITEM_ID + " = " + _id, null);
return i;
} else {
Cursor c = db.query(ItemInItem.ItemInItems.table(_id), new String[]{ItemInItem.ItemInItems.FOREIGN_KEY}, null, null, null, null, null);
if (c.moveToFirst()) {
do {
i += _deleteAllItemsOf(db, c.getString(0));
} while (c.moveToNext());
}
c.close();
dropList(db, _id);
i += db.delete(LISTS_TABLE_NAME, Item.Items.ITEM_ID + " = ?", new String[]{_id});
return i;
}
}
static {
sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
sUriMatcher.addURI(AUTHORITY, LISTS_TABLE_NAME, LISTS);
sUriMatcher.addURI(AUTHORITY, LISTS_TABLE_NAME + "/#", LISTS_ID);
sUriMatcher.addURI(AUTHORITY, USER_TABLE_NAME, USER_TABLE);
sUriMatcher.addURI(AUTHORITY, USER_TABLE_NAME + "/*", USER_TABLE_ID);
listsProjectionMap = new HashMap<String, String>();
listsProjectionMap.put(Item.Items.ITEM_ID, Item.Items.ITEM_ID);
listsProjectionMap.put(Item.Items.TITLE, Item.Items.TITLE);
listsProjectionMap.put(Item.Items.TIME, Item.Items.TIME);
listsProjectionMap.put(Item.Items.IS_LIST, Item.Items.IS_LIST);
listsProjectionMap.put(Item.Items.TAG, Item.Items.TAG);
listsProjectionMap.put(Item.Items.NOTES, Item.Items.NOTES);
listsProjectionMap.put(Item.Items.ORDER, Item.Items.ORDER);
listsProjectionMap.put(Item.Items.LINKS, Item.Items.LINKS);
}
}
|
UTF-8
|
Java
| 13,919
|
java
|
ListsContentProvider.java
|
Java
|
[
{
"context": "s.providers.helpers.ItemInItem;\n\n/**\n * Created by julian on 08.05.17.\n */\n\npublic class ListsContentProvid",
"end": 785,
"score": 0.9992139339447021,
"start": 779,
"tag": "USERNAME",
"value": "julian"
}
] | null |
[] |
package xyz.julianpeters.timedlists.providers;
import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
import java.util.HashMap;
import xyz.julianpeters.timedlists.providers.helpers.Item;
import xyz.julianpeters.timedlists.providers.helpers.ItemInItem;
/**
* Created by julian on 08.05.17.
*/
public class ListsContentProvider extends ContentProvider {
private static final String TAG = "ListsContentProvider";
private static final String DATABASE_NAME = "lists.db";
private static final int DATABASE_VERSION = 11;
public static final String LISTS_TABLE_NAME = "lists";
public static final String USER_TABLE_NAME = "table_";
public static final String AUTHORITY = "xyz.julianpeters.timedlists.providers.ListsContentProvider";
private static final UriMatcher sUriMatcher;
private static final int LISTS = 1;
private static final int LISTS_ID = 2;
private static final int USER_TABLE = 3;
private static final int USER_TABLE_ID = 4;
private static HashMap<String, String> listsProjectionMap;
private static class DatabaseHelper extends SQLiteOpenHelper {
public DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + LISTS_TABLE_NAME + " (" + Item.Items.ITEM_ID
+ " INTEGER PRIMARY KEY AUTOINCREMENT, " + Item.Items.TITLE + " VARCHAR(255), "
+ Item.Items.NOTES + " VARCHAR(8000), "
+ Item.Items.TIME + " INTEGER, " + Item.Items.IS_LIST + " BOOLEAN, "
+ Item.Items.ORDER + " INTEGER, "
+ Item.Items.LINKS + " INTEGER, "
+ Item.Items.TAG + " VARCHAR(8));");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Log.w(TAG, "Upgrading database from version " + oldVersion + " to " + newVersion
+ ", which will destroy all old data");
db.execSQL("DROP TABLE IF EXISTS " + LISTS_TABLE_NAME);
Cursor c = db.rawQuery("SELECT name FROM sqlite_master WHERE name LIKE 'table_%'", null);
if (c.moveToFirst()) {
do {
String table = c.getString(0);
Log.w(TAG, "Dropped table " + table);
db.execSQL("DROP TABLE IF EXISTS " + table);
} while (c.moveToNext());
}
c.close();
onCreate(db);
}
}
private DatabaseHelper dbHelper;
@Override
public boolean onCreate() {
dbHelper = new DatabaseHelper(getContext());
return true;
}
@Nullable
@Override
public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
switch (sUriMatcher.match(uri)) {
case LISTS:
qb.setTables(LISTS_TABLE_NAME);
qb.setProjectionMap(listsProjectionMap);
break;
case LISTS_ID:
qb.setTables(LISTS_TABLE_NAME);
qb.setProjectionMap(listsProjectionMap);
selection = Item.Items.ITEM_ID + " = " + uri.getLastPathSegment();
break;
case USER_TABLE:
qb.setTables(selection);
selection = null;
break;
case USER_TABLE_ID:
qb.setTables(ItemInItem.ItemInItems.table(uri.getLastPathSegment()));
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
SQLiteDatabase db = dbHelper.getReadableDatabase();
Cursor c = qb.query(db, projection, selection, selectionArgs, null, null, sortOrder);
c.setNotificationUri(getContext().getContentResolver(), uri);
return c;
}
@Nullable
@Override
public String getType(@NonNull Uri uri) {
switch (sUriMatcher.match(uri)) {
case LISTS:
return Item.Items.CONTENT_TYPE;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
}
@Nullable
@Override
public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) {
ContentValues val;
if (values != null) {
val = new ContentValues(values);
} else {
val = new ContentValues();
}
SQLiteDatabase db = dbHelper.getWritableDatabase();
long rowId;
long tabRow;
switch (sUriMatcher.match(uri)) {
case LISTS:
rowId = db.insert(LISTS_TABLE_NAME, Item.Items.TIME, val);
createNewList(db, Long.toString(rowId));
if (rowId > 0) {
Uri itemUri = ContentUris.withAppendedId(Item.Items.CONTENT_URI, rowId);
getContext().getContentResolver().notifyChange(itemUri, null);
return itemUri;
}
throw new SQLException("Failed to insert row into " + uri);
case USER_TABLE_ID:
String tableId = uri.getLastPathSegment();
tabRow = db.insert(USER_TABLE_NAME + tableId, ItemInItem.ItemInItems.REPEAT, val);
if (tabRow > 0) {
Uri itemUri = ContentUris.withAppendedId(ItemInItem.ItemInItems.CONTENT_URI, tabRow);
getContext().getContentResolver().notifyChange(itemUri, null);
return itemUri;
}
throw new SQLException("Failed to insert row into " + uri);
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
}
@Override
public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) {
SQLiteDatabase db = dbHelper.getWritableDatabase();
int count;
switch (sUriMatcher.match(uri)) {
case LISTS:
dropLists(db, selection, selectionArgs);
count = db.delete(LISTS_TABLE_NAME, selection, selectionArgs);
break;
case LISTS_ID:
selection = selection + "_id = " + uri.getLastPathSegment();
dropLists(db, selection, selectionArgs);
count = db.delete(LISTS_TABLE_NAME, selection, selectionArgs);
break;
case USER_TABLE:
count = db.delete(selectionArgs[0], selection, new String[]{selectionArgs[1]});
break;
case USER_TABLE_ID:
count = db.delete(USER_TABLE_NAME + uri.getLastPathSegment(), selection, selectionArgs);
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
getContext().getContentResolver().notifyChange(uri, null);
return count;
}
@Override
public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) {
SQLiteDatabase db = dbHelper.getWritableDatabase();
int count;
switch (sUriMatcher.match(uri)) {
case LISTS:
count = db.update(LISTS_TABLE_NAME, values, selection, selectionArgs);
break;
case LISTS_ID:
selection = Item.Items.ITEM_ID + " = " + uri.getLastPathSegment();
count = db.update(LISTS_TABLE_NAME, values, selection, selectionArgs);
break;
case USER_TABLE:
count = 0;
break;
case USER_TABLE_ID:
count = db.update(USER_TABLE_NAME + uri.getLastPathSegment(), values, selection, selectionArgs);
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
getContext().getContentResolver().notifyChange(uri, null);
getContext().getContentResolver().notifyChange(ItemInItem.ItemInItems.CONTENT_URI, null);
return count;
}
public int getRows(String table_id) {
SQLiteDatabase db = dbHelper.getReadableDatabase();
String count = "SELECT count(*) FROM " + table_id;
Cursor cursor = db.rawQuery(count, null);
cursor.moveToFirst();
int i = cursor.getInt(0);
cursor.close();
return i;
}
@Nullable
@Override
public Bundle call(@NonNull String method, @Nullable String arg, @Nullable Bundle extras) {
SQLiteDatabase db;
Bundle bundle = new Bundle();
switch (method) {
case "getRows":
bundle.putInt("rows", getRows(USER_TABLE_NAME + arg));
return bundle;
case "deleteAllItemsOf":
db = dbHelper.getWritableDatabase();
bundle.putInt("deletes", deleteAllItemsOf(db, arg));
return bundle;
case "deleteIncrement":
db = dbHelper.getWritableDatabase();
String y = extras.getString("position");
String tabley = extras.getString("table");
String ordery = extras.getString("order");
db.execSQL("UPDATE " + tabley + " SET " + ordery + " = " + ordery + " -1" + " WHERE " + ordery + " > " + y);
return null;
case "appendNotes":
db = dbHelper.getWritableDatabase();
db.execSQL("UPDATE " + LISTS_TABLE_NAME + " SET " + Item.Items.NOTES + " = " + extras.getString("string") + " WHERE " + Item.Items.ITEM_ID + " = " + arg);
default:
return null;
}
}
public void createNewList(SQLiteDatabase db, String _id) {
db.execSQL("CREATE TABLE " + ItemInItem.ItemInItems.table(_id) + " ("
+ Item.Items.ITEM_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ ItemInItem.ItemInItems.NAME + " VARCHAR(255),"
+ ItemInItem.ItemInItems.REPEAT + " INTEGER, "
+ ItemInItem.ItemInItems.ORDER + " INTEGER, "
+ ItemInItem.ItemInItems.FOREIGN_KEY + " INTEGER, FOREIGN KEY ("
+ ItemInItem.ItemInItems.FOREIGN_KEY + ") REFERENCES "
+ LISTS_TABLE_NAME + "(" + Item.Items.ITEM_ID + "));");
}
public void dropLists(SQLiteDatabase db, @Nullable String selection, @Nullable String[] selectionArgs) {
Cursor c = db.query(LISTS_TABLE_NAME, new String[]{Item.Items.ITEM_ID}, selection, selectionArgs, null, null, null);
if (c.moveToFirst()) {
do {
dropList(db, c.getString(0));
} while (c.moveToNext());
}
c.close();
}
public void dropList(SQLiteDatabase db, String _id) {
db.execSQL("DROP TABLE IF EXISTS " + ItemInItem.ItemInItems.table(_id));
Log.d("Dropped Table", "table_" + _id);
}
public int deleteAllItemsOf(SQLiteDatabase db, String _id) {
int i = _deleteAllItemsOf(db, _id);
getContext().getContentResolver().notifyChange(Item.Items.CONTENT_URI, null);
return i;
}
private int _deleteAllItemsOf(SQLiteDatabase db, String _id) {
int i = 0;
Cursor linkCursor = db.query(LISTS_TABLE_NAME, new String[]{Item.Items.LINKS}, Item.Items._ID + " = " + _id, null, null, null, null);
linkCursor.moveToFirst();
int links = linkCursor.getInt(0);
if (links > 0) {
ContentValues values = new ContentValues();
values.put(Item.Items.LINKS, links - 1);
db.update(LISTS_TABLE_NAME, values, Item.Items.ITEM_ID + " = " + _id, null);
return i;
} else {
Cursor c = db.query(ItemInItem.ItemInItems.table(_id), new String[]{ItemInItem.ItemInItems.FOREIGN_KEY}, null, null, null, null, null);
if (c.moveToFirst()) {
do {
i += _deleteAllItemsOf(db, c.getString(0));
} while (c.moveToNext());
}
c.close();
dropList(db, _id);
i += db.delete(LISTS_TABLE_NAME, Item.Items.ITEM_ID + " = ?", new String[]{_id});
return i;
}
}
static {
sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
sUriMatcher.addURI(AUTHORITY, LISTS_TABLE_NAME, LISTS);
sUriMatcher.addURI(AUTHORITY, LISTS_TABLE_NAME + "/#", LISTS_ID);
sUriMatcher.addURI(AUTHORITY, USER_TABLE_NAME, USER_TABLE);
sUriMatcher.addURI(AUTHORITY, USER_TABLE_NAME + "/*", USER_TABLE_ID);
listsProjectionMap = new HashMap<String, String>();
listsProjectionMap.put(Item.Items.ITEM_ID, Item.Items.ITEM_ID);
listsProjectionMap.put(Item.Items.TITLE, Item.Items.TITLE);
listsProjectionMap.put(Item.Items.TIME, Item.Items.TIME);
listsProjectionMap.put(Item.Items.IS_LIST, Item.Items.IS_LIST);
listsProjectionMap.put(Item.Items.TAG, Item.Items.TAG);
listsProjectionMap.put(Item.Items.NOTES, Item.Items.NOTES);
listsProjectionMap.put(Item.Items.ORDER, Item.Items.ORDER);
listsProjectionMap.put(Item.Items.LINKS, Item.Items.LINKS);
}
}
| 13,919
| 0.585674
| 0.583016
| 343
| 39.580173
| 31.921165
| 170
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.90379
| false
| false
|
2
|
3b20ea955de08349c7ac07069bac1211aeaa3f63
| 24,953,760,012,106
|
0045dcb21d9fdb0a993c3d34f315c1915138ada7
|
/googl/ConstructBTfromInorderPostOrder_106.java
|
d2d3616dd6c11efd989b30a76b226627ba3d3fb6
|
[] |
no_license
|
daydreamerlee/LC
|
https://github.com/daydreamerlee/LC
|
a7555590a47412314a19849a47129730cbe0f44e
|
bdfdd9c896feee288fd191cf77c16728f8c245e4
|
refs/heads/master
| 2018-12-22T16:46:31.003000
| 2018-10-01T16:07:28
| 2018-10-01T16:07:28
| 116,524,423
| 2
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package googl;
import ch2.TreeNode;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Administrator on 2/13/2018.
*/
public class ConstructBTfromInorderPostOrder_106 {
public TreeNode buildTree(int[] inorder, int[] postorder) {
if (inorder == null || inorder.length == 0) return null;
Map<Integer, Integer> inorderMap = new HashMap<>();
for (int i = 0; i < inorder.length; i++) {
inorderMap.put(inorder[i], i);
}
return helper(inorder, 0, inorder.length - 1, postorder, 0, postorder.length - 1, inorderMap);
}
public TreeNode helper(int[] inorder, int is, int ie, int[] postorder, int ps, int pe, Map<Integer, Integer> inorderMap) {
if (is > ie) return null;
TreeNode root = new TreeNode(postorder[pe]);
int indexInInorder = inorderMap.get(postorder[pe]);
root.left = helper(inorder, is, indexInInorder - 1, postorder, ps, pe + indexInInorder - ie - 1, inorderMap);
root.right = helper(inorder, indexInInorder + 1, ie, postorder, pe + indexInInorder - ie + 1, pe - 1, inorderMap);
return root;
}
/*省了一个 map,但浪费了时间找 post-end 在 inorder 里的位置*/
public TreeNode buildTree_search(int[] inorder, int[] postorder) {
if (inorder == null || inorder.length == 0) return null;
return helper(inorder, 0, inorder.length - 1, postorder, 0, postorder.length - 1);
}
public TreeNode helper(int[] inorder, int is, int ie, int[] postorder, int ps, int pe) {
if (is > ie) return null;
TreeNode root = new TreeNode(postorder[pe]);
System.out.println("postorder: " + postorder[pe]);
int index = search(inorder, is, ie, postorder[pe]);
System.out.println(index);
root.left = helper(inorder, is, index - 1, postorder, ps, pe + index - ie - 1);
root.right = helper(inorder, index + 1, ie, postorder, pe + index - ie + 1, pe - 1);
return root;
}
public int search(int[] inorder, int is, int ie, int target) {
for (int i = is; i <= ie; i++) {
if (inorder[i] == target) {
return i;
}
}
return ie;
}
public static void main(String[] args) {
ConstructBTfromInorderPostOrder_106 inst = new ConstructBTfromInorderPostOrder_106();
int[] inorder = {3, 2, 1};
int[] postorder = {3, 2, 1};
inst.buildTree(inorder, postorder);
}
}
|
UTF-8
|
Java
| 2,488
|
java
|
ConstructBTfromInorderPostOrder_106.java
|
Java
|
[
{
"context": ".HashMap;\nimport java.util.Map;\n\n/**\n * Created by Administrator on 2/13/2018.\n */\npublic class ConstructBTfromIno",
"end": 118,
"score": 0.7481608986854553,
"start": 105,
"tag": "NAME",
"value": "Administrator"
}
] | null |
[] |
package googl;
import ch2.TreeNode;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Administrator on 2/13/2018.
*/
public class ConstructBTfromInorderPostOrder_106 {
public TreeNode buildTree(int[] inorder, int[] postorder) {
if (inorder == null || inorder.length == 0) return null;
Map<Integer, Integer> inorderMap = new HashMap<>();
for (int i = 0; i < inorder.length; i++) {
inorderMap.put(inorder[i], i);
}
return helper(inorder, 0, inorder.length - 1, postorder, 0, postorder.length - 1, inorderMap);
}
public TreeNode helper(int[] inorder, int is, int ie, int[] postorder, int ps, int pe, Map<Integer, Integer> inorderMap) {
if (is > ie) return null;
TreeNode root = new TreeNode(postorder[pe]);
int indexInInorder = inorderMap.get(postorder[pe]);
root.left = helper(inorder, is, indexInInorder - 1, postorder, ps, pe + indexInInorder - ie - 1, inorderMap);
root.right = helper(inorder, indexInInorder + 1, ie, postorder, pe + indexInInorder - ie + 1, pe - 1, inorderMap);
return root;
}
/*省了一个 map,但浪费了时间找 post-end 在 inorder 里的位置*/
public TreeNode buildTree_search(int[] inorder, int[] postorder) {
if (inorder == null || inorder.length == 0) return null;
return helper(inorder, 0, inorder.length - 1, postorder, 0, postorder.length - 1);
}
public TreeNode helper(int[] inorder, int is, int ie, int[] postorder, int ps, int pe) {
if (is > ie) return null;
TreeNode root = new TreeNode(postorder[pe]);
System.out.println("postorder: " + postorder[pe]);
int index = search(inorder, is, ie, postorder[pe]);
System.out.println(index);
root.left = helper(inorder, is, index - 1, postorder, ps, pe + index - ie - 1);
root.right = helper(inorder, index + 1, ie, postorder, pe + index - ie + 1, pe - 1);
return root;
}
public int search(int[] inorder, int is, int ie, int target) {
for (int i = is; i <= ie; i++) {
if (inorder[i] == target) {
return i;
}
}
return ie;
}
public static void main(String[] args) {
ConstructBTfromInorderPostOrder_106 inst = new ConstructBTfromInorderPostOrder_106();
int[] inorder = {3, 2, 1};
int[] postorder = {3, 2, 1};
inst.buildTree(inorder, postorder);
}
}
| 2,488
| 0.600245
| 0.582315
| 69
| 34.565216
| 34.398548
| 126
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.42029
| false
| false
|
2
|
19958dcac0745b51cbddadd2db33523c88088873
| 31,559,419,742,040
|
4537e4fdfebbb9aff29867e5fbe9a0db9001b181
|
/WeCampus/WeCampus/src/main/java/com/westudio/wecampus/data/model/User.java
|
a42506a1364b061c3a8b962c15ecb2082bf546a9
|
[] |
no_license
|
adohe-zz/wecampus_classic
|
https://github.com/adohe-zz/wecampus_classic
|
78f0144e023d922b43a9cf4ce10ae665c2f3f2b2
|
4471b23a4c6554232ae92e5248e0daf7817ca471
|
refs/heads/master
| 2021-05-27T02:03:27.083000
| 2014-03-22T07:26:45
| 2014-03-22T07:26:45
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.westudio.wecampus.data.model;
import android.database.Cursor;
import com.westudio.wecampus.data.UserDataHelper;
import java.io.Serializable;
import java.util.ArrayList;
/**
* Created by jam on 13-9-19.
*/
public class User implements Serializable {
public int id;
public String name;
public String birthday;
public String avatar;
public String contact_email;
public int count_of_fans;
public int count_of_followings;
public int count_of_follow_organizations;
public int count_of_follow_activities;
public int count_of_join_activities;
public String email;
public String emotion;
public String nickname;
public int school_id;
public String school_name;
public String gender;
public String phone;
public String stage;
public String words;
public String password;
public String token;
public School school;
public boolean can_follow = true;
public String like_activity;
public String attend_activity;
public String like_organization;
public static User fromCursor(Cursor cursor) {
User user = new User();
user.id = cursor.getInt(cursor.getColumnIndex(UserDataHelper.UserDBInfo.ID));
user.words = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.WORDS));
user.name = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.NAME));
user.avatar = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.AVATAR));
user.birthday = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.BIRTHDAY));
user.contact_email = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.CONTANT_EMAIL));
user.count_of_fans = cursor.getInt(cursor.getColumnIndex(UserDataHelper.UserDBInfo.CONT_OF_FANS));
user.count_of_follow_activities = cursor.getInt(cursor.getColumnIndex(
UserDataHelper.UserDBInfo.CONT_OF_FOLLOW_ACTIVITIES));
user.count_of_follow_organizations = cursor.getInt(cursor.getColumnIndex(
UserDataHelper.UserDBInfo.CONT_OF_FOLLOW_ORGANIZATIONS));
user.count_of_join_activities = cursor.getInt(cursor.getColumnIndex(UserDataHelper.UserDBInfo.CONT_OF_JOIN_ACTIVITIES));
user.count_of_followings = cursor.getInt(cursor.getColumnIndex(UserDataHelper.UserDBInfo.CONT_OF_FOLLOWER));
user.email = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.EMAIL));
user.emotion = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.EMOTION));
user.nickname = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.NICKNAME));
user.school_id = cursor.getInt(cursor.getColumnIndex(UserDataHelper.UserDBInfo.SCHOOL_ID));
user.school_name = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.SCHOOL_NAME));
user.gender = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.GENDER));
user.phone = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.PHONE));
user.stage = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.STAGE));
user.can_follow = cursor.getInt(cursor.getColumnIndex(UserDataHelper.UserDBInfo.CAN_FOLLOW)) > 0;
user.like_activity = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.LIKE_ACTIVITY));
user.attend_activity = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.ATTEND_ACTIVITY));
user.like_organization = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.LIKE_ORGANIZATION));
return user;
}
public class UserListData {
public ArrayList<User> objects;
public ArrayList<User> getObjects() {
return objects;
}
public void setObjects(ArrayList<User> objects) {
this.objects = objects;
}
}
}
|
UTF-8
|
Java
| 3,917
|
java
|
User.java
|
Java
|
[
{
"context": "le;\nimport java.util.ArrayList;\n\n/**\n * Created by jam on 13-9-19.\n */\npublic class User implements Seri",
"end": 206,
"score": 0.9979546070098877,
"start": 203,
"tag": "USERNAME",
"value": "jam"
}
] | null |
[] |
package com.westudio.wecampus.data.model;
import android.database.Cursor;
import com.westudio.wecampus.data.UserDataHelper;
import java.io.Serializable;
import java.util.ArrayList;
/**
* Created by jam on 13-9-19.
*/
public class User implements Serializable {
public int id;
public String name;
public String birthday;
public String avatar;
public String contact_email;
public int count_of_fans;
public int count_of_followings;
public int count_of_follow_organizations;
public int count_of_follow_activities;
public int count_of_join_activities;
public String email;
public String emotion;
public String nickname;
public int school_id;
public String school_name;
public String gender;
public String phone;
public String stage;
public String words;
public String password;
public String token;
public School school;
public boolean can_follow = true;
public String like_activity;
public String attend_activity;
public String like_organization;
public static User fromCursor(Cursor cursor) {
User user = new User();
user.id = cursor.getInt(cursor.getColumnIndex(UserDataHelper.UserDBInfo.ID));
user.words = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.WORDS));
user.name = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.NAME));
user.avatar = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.AVATAR));
user.birthday = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.BIRTHDAY));
user.contact_email = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.CONTANT_EMAIL));
user.count_of_fans = cursor.getInt(cursor.getColumnIndex(UserDataHelper.UserDBInfo.CONT_OF_FANS));
user.count_of_follow_activities = cursor.getInt(cursor.getColumnIndex(
UserDataHelper.UserDBInfo.CONT_OF_FOLLOW_ACTIVITIES));
user.count_of_follow_organizations = cursor.getInt(cursor.getColumnIndex(
UserDataHelper.UserDBInfo.CONT_OF_FOLLOW_ORGANIZATIONS));
user.count_of_join_activities = cursor.getInt(cursor.getColumnIndex(UserDataHelper.UserDBInfo.CONT_OF_JOIN_ACTIVITIES));
user.count_of_followings = cursor.getInt(cursor.getColumnIndex(UserDataHelper.UserDBInfo.CONT_OF_FOLLOWER));
user.email = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.EMAIL));
user.emotion = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.EMOTION));
user.nickname = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.NICKNAME));
user.school_id = cursor.getInt(cursor.getColumnIndex(UserDataHelper.UserDBInfo.SCHOOL_ID));
user.school_name = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.SCHOOL_NAME));
user.gender = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.GENDER));
user.phone = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.PHONE));
user.stage = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.STAGE));
user.can_follow = cursor.getInt(cursor.getColumnIndex(UserDataHelper.UserDBInfo.CAN_FOLLOW)) > 0;
user.like_activity = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.LIKE_ACTIVITY));
user.attend_activity = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.ATTEND_ACTIVITY));
user.like_organization = cursor.getString(cursor.getColumnIndex(UserDataHelper.UserDBInfo.LIKE_ORGANIZATION));
return user;
}
public class UserListData {
public ArrayList<User> objects;
public ArrayList<User> getObjects() {
return objects;
}
public void setObjects(ArrayList<User> objects) {
this.objects = objects;
}
}
}
| 3,917
| 0.733725
| 0.732193
| 82
| 46.768291
| 37.156982
| 128
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.719512
| false
| false
|
2
|
403f8ec1aeeefb93ff6304eae0153501fd997d5e
| 17,763,984,772,159
|
e90655b6c61c3ae959e5e5ee8dbf99e366628847
|
/app/src/main/java/mota/dev/happytesting/Views/Adapters/viewholders/ObservationViewHolder.java
|
128e050e2f65e9568293655348d8014859921b57
|
[
"MIT"
] |
permissive
|
VunterSlaush/happy_testing
|
https://github.com/VunterSlaush/happy_testing
|
4eaa519588bce640222237e80aeea90cce414535
|
80533af6adcf1d1fafe10d274acc136116d088de
|
refs/heads/master
| 2021-01-20T14:15:34.913000
| 2017-08-15T02:33:28
| 2017-08-15T02:33:28
| 90,576,995
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package mota.dev.happytesting.Views.adapters.viewholders;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import java.util.List;
import java.util.Observable;
import java.util.Observer;
import mota.dev.happytesting.ViewModel.items.ItemObservationViewModel;
import mota.dev.happytesting.Views.adapters.ImageAdapter;
import mota.dev.happytesting.Views.adapters.ObservationAdapter;
import mota.dev.happytesting.Views.interfaces.Hideable;
import mota.dev.happytesting.Views.interfaces.Selectable;
import mota.dev.happytesting.databinding.ObservationItemBinding;
import mota.dev.happytesting.models.Image;
import mota.dev.happytesting.models.Observation;
/**
* Created by Slaush on 18/06/2017.
*/
public class ObservationViewHolder extends BaseViewHolder<Observation> implements Observer, Selectable<Image>, Hideable
{
private ObservationItemBinding binding;
public ObservationViewHolder(ObservationItemBinding binding)
{
super(binding.itemObservation);
this.binding = binding;
setupAdapter();
}
private void setupAdapter()
{
ImageAdapter adapter = new ImageAdapter();
GridLayoutManager gridLayoutManager = new GridLayoutManager(itemView.getContext(), 5);
binding.mosaicoRecyclerView.setLayoutManager(gridLayoutManager);
binding.mosaicoRecyclerView.setAdapter(adapter);
}
@Override
public void onBind()
{
if(binding.getViewModel() == null) {
ItemObservationViewModel viewModel = new ItemObservationViewModel(itemView.getContext(),this, this);
viewModel.addObserver(this);
viewModel.setObservation(item);
binding.setViewModel(viewModel);
}else
{
binding.getViewModel().setObservation(item);
}
}
@Override
public void update(Observable observable, Object o)
{
if(observable instanceof ItemObservationViewModel)
{
ImageAdapter adapter = (ImageAdapter) binding.mosaicoRecyclerView.getAdapter();
ItemObservationViewModel viewModel = (ItemObservationViewModel) observable;
adapter.setList(viewModel.getImages());
binding.mosaicoRecyclerView.getItemAnimator().endAnimations();
}
}
@Override
public List<Image> getSelected()
{
ImageAdapter adapter = (ImageAdapter) binding.mosaicoRecyclerView.getAdapter();
return adapter.getSelectedImages();
}
@Override
public void hide()
{
binding.getRoot().setVisibility(View.GONE);
}
@Override
public void show()
{
binding.getRoot().setVisibility(View.VISIBLE);
}
}
|
UTF-8
|
Java
| 2,768
|
java
|
ObservationViewHolder.java
|
Java
|
[
{
"context": "appytesting.models.Observation;\n\n/**\n * Created by Slaush on 18/06/2017.\n */\n\n\npublic class ObservationView",
"end": 779,
"score": 0.6932611465454102,
"start": 773,
"tag": "NAME",
"value": "Slaush"
}
] | null |
[] |
package mota.dev.happytesting.Views.adapters.viewholders;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import java.util.List;
import java.util.Observable;
import java.util.Observer;
import mota.dev.happytesting.ViewModel.items.ItemObservationViewModel;
import mota.dev.happytesting.Views.adapters.ImageAdapter;
import mota.dev.happytesting.Views.adapters.ObservationAdapter;
import mota.dev.happytesting.Views.interfaces.Hideable;
import mota.dev.happytesting.Views.interfaces.Selectable;
import mota.dev.happytesting.databinding.ObservationItemBinding;
import mota.dev.happytesting.models.Image;
import mota.dev.happytesting.models.Observation;
/**
* Created by Slaush on 18/06/2017.
*/
public class ObservationViewHolder extends BaseViewHolder<Observation> implements Observer, Selectable<Image>, Hideable
{
private ObservationItemBinding binding;
public ObservationViewHolder(ObservationItemBinding binding)
{
super(binding.itemObservation);
this.binding = binding;
setupAdapter();
}
private void setupAdapter()
{
ImageAdapter adapter = new ImageAdapter();
GridLayoutManager gridLayoutManager = new GridLayoutManager(itemView.getContext(), 5);
binding.mosaicoRecyclerView.setLayoutManager(gridLayoutManager);
binding.mosaicoRecyclerView.setAdapter(adapter);
}
@Override
public void onBind()
{
if(binding.getViewModel() == null) {
ItemObservationViewModel viewModel = new ItemObservationViewModel(itemView.getContext(),this, this);
viewModel.addObserver(this);
viewModel.setObservation(item);
binding.setViewModel(viewModel);
}else
{
binding.getViewModel().setObservation(item);
}
}
@Override
public void update(Observable observable, Object o)
{
if(observable instanceof ItemObservationViewModel)
{
ImageAdapter adapter = (ImageAdapter) binding.mosaicoRecyclerView.getAdapter();
ItemObservationViewModel viewModel = (ItemObservationViewModel) observable;
adapter.setList(viewModel.getImages());
binding.mosaicoRecyclerView.getItemAnimator().endAnimations();
}
}
@Override
public List<Image> getSelected()
{
ImageAdapter adapter = (ImageAdapter) binding.mosaicoRecyclerView.getAdapter();
return adapter.getSelectedImages();
}
@Override
public void hide()
{
binding.getRoot().setVisibility(View.GONE);
}
@Override
public void show()
{
binding.getRoot().setVisibility(View.VISIBLE);
}
}
| 2,768
| 0.71315
| 0.709176
| 90
| 29.755556
| 29.009697
| 119
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.477778
| false
| false
|
2
|
a64fbe3ce88a2e4cad8fb770ee5bc3cc6be7e084
| 7,997,229,149,478
|
1fb6f229dd0e5a4965f23bf54b7051b3deb96f12
|
/Código Fonte do Projeto/drcabral-sgam-cc6817ec7864/src/controller/InstrutorBean.java
|
f7417c002405905c2b6bf5e06aa7c133f962bb1a
|
[] |
no_license
|
ezequiel454/Projeto-BD
|
https://github.com/ezequiel454/Projeto-BD
|
7ceadedf06c507946491992f3840d99aca228121
|
4492260de1032e4718f45cec3b660e3fa358278c
|
refs/heads/master
| 2016-08-11T06:33:35.166000
| 2015-09-24T21:57:49
| 2015-09-24T21:57:49
| 43,085,075
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import javax.servlet.ServletContext;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRParameter;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import models.Acesso;
import models.EnderecoPessoa;
import models.Instrutor;
import models.InstrutorModalidade;
import models.InstrutorModalidadeUnidade;
import models.LogAcesso;
import models.Modalidade;
import models.TelefonePessoa;
import models.Unidade;
import business.AcessoBusiness;
import business.EnderecoPessoaBusiness;
import business.InstrutorBusiness;
import business.InstrutorModalidadeBusiness;
import business.InstrutorModalidadeUnidadeBusiness;
import business.LogAcessoBusiness;
import business.TelefonePessoaBusiness;
@ManagedBean(name = "instrutor")
@SessionScoped
public class InstrutorBean {
@ManagedProperty(value="#{login}")
private LoginBean loginBean;
private Instrutor instrutor = null;
private EnderecoPessoa endereco = null;
private List<TelefonePessoa> telefones = null;
private TelefonePessoa telefone = null;
private DataModel<Instrutor> model;
private DataModel<InstrutorModalidadeUnidade> modelImus;
private InstrutorModalidadeUnidade instrutorModalidadeUnidade; //para o editar da visualização das modalidades
private int idModalidadePesquisa;
@PostConstruct
public void init() {
if (instrutor == null) {
instrutor = new Instrutor();
endereco = new EnderecoPessoa();
telefones = new ArrayList<TelefonePessoa>();
telefone = new TelefonePessoa();
instrutorModalidadeUnidade = new InstrutorModalidadeUnidade();
}
}
public Instrutor getInstrutor() {
return instrutor;
}
public void setInstrutor(Instrutor instrutor) {
this.instrutor = instrutor;
}
public void atualizarInstrutor(){
EnderecoPessoaBusiness epB = new EnderecoPessoaBusiness();
epB.update(instrutor.getEndereco());
InstrutorBusiness iB = new InstrutorBusiness();
iB.update(instrutor);
//inserindo na tabela de log
AcessoBusiness aB = new AcessoBusiness();
Acesso acesso = new Acesso();
acesso.setDataAcesso(new Date(System.currentTimeMillis()));
acesso.setTipo("Atualização");
acesso.setNomeTabelaAfetada("Instrutor");
aB.salvar(acesso);
LogAcessoBusiness laB = new LogAcessoBusiness();
LogAcesso la = new LogAcesso();
la.setAcesso(acesso);
la.setUsuario(loginBean.getUsuario());
laB.salvar(la);
//zerando o bean
instrutor = new Instrutor();
endereco = new EnderecoPessoa();
telefones = new ArrayList<TelefonePessoa>();
telefone = new TelefonePessoa();
instrutorModalidadeUnidade = new InstrutorModalidadeUnidade();
try {
FacesContext.getCurrentInstance().getExternalContext().redirect("listarInstrutor.xhtml");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void cadastrarInstrutor(){
cadastrarEndereco();
instrutor.setEndereco(endereco);
InstrutorBusiness instrutorBusiness = new InstrutorBusiness();
instrutorBusiness.salvar(instrutor);
cadastrarTelefones();
//inserindo na tabela de log
AcessoBusiness aB = new AcessoBusiness();
Acesso acesso = new Acesso();
acesso.setDataAcesso(new Date(System.currentTimeMillis()));
acesso.setTipo("Cadastro");
acesso.setNomeTabelaAfetada("Instrutor");
aB.salvar(acesso);
LogAcessoBusiness laB = new LogAcessoBusiness();
LogAcesso la = new LogAcesso();
la.setAcesso(acesso);
la.setUsuario(loginBean.getUsuario());
laB.salvar(la);
//zerando o bean
instrutor = new Instrutor();
endereco = new EnderecoPessoa();
telefones = new ArrayList<TelefonePessoa>();
telefone = new TelefonePessoa();
instrutorModalidadeUnidade = new InstrutorModalidadeUnidade();
try {
FacesContext.getCurrentInstance().getExternalContext().redirect("listarInstrutor.xhtml");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void cadastrarTelefones(){
TelefonePessoaBusiness telefoneUnidadeBusiness = new TelefonePessoaBusiness();
telefone.setPessoa(instrutor);
telefoneUnidadeBusiness.salvar(telefone);
}
public void cadastrarEndereco(){
EnderecoPessoaBusiness enderecoBusiness = new EnderecoPessoaBusiness();
enderecoBusiness.salvar(endereco);
}
public void addTelefoneEditar(){
telefone.setPessoa(instrutor);
telefones.add(telefone);
//salvando o novo telefone no banco
TelefonePessoaBusiness tpB = new TelefonePessoaBusiness();
tpB.salvar(telefone);
//zerando o bean
telefone = new TelefonePessoa();
}
public String removerTelefone(){
for (int i = 0; i < telefones.size(); i++){
if (telefones.get(i).getNumero().equals(telefone.getNumero())){
telefones.remove(i);
i--;
}
}
TelefonePessoaBusiness tpB = new TelefonePessoaBusiness();
tpB.deletar(telefone);
//zerando o bean
telefone = new TelefonePessoa();
return "";
}
public String editarIMU(){
return "editarInstrutorModalidadeUnidade";
}
public String editar(){
return "editarInstrutor?faces-redirect=true";
}
public String verModalidades(){
return "modalidadesInstrutor?faces-redirect=true";
}
public String verTelefones(){
return "telefonesInstrutor?faces-redirect=true";
}
public String voltarListarInstrutor(){
return "listarInstrutor?faces-redirect=true";
}
public DataModel<InstrutorModalidadeUnidade> getTodosModalidadeInstrutor() throws Exception {
InstrutorModalidadeUnidadeBusiness imuB = new InstrutorModalidadeUnidadeBusiness();
Unidade unidade= new Unidade();
unidade.setNome(loginBean.getNomeUnidade());
ArrayList<InstrutorModalidadeUnidade> imus = new ArrayList<InstrutorModalidadeUnidade>();
imus = (ArrayList<InstrutorModalidadeUnidade>) imuB.listar(unidade); //todos os instrutoresModalidadeUnidade
//eliminando objetos que tem o instrutor diferente do selecionado
for (int i = 0; i < imus.size(); i++) {
if(!imus.get(i).getInstrutorModalidade().getInstrutor().getCpf().equals(instrutor.getCpf())){
imus.remove(i);
i--;
}
}
modelImus = new ListDataModel<InstrutorModalidadeUnidade>(imus);
return modelImus;
}
public List<InstrutorModalidade> getTodosInstrutorModalidade(){
InstrutorModalidadeBusiness imB = new InstrutorModalidadeBusiness();
return imB.listar();
}
public List<TelefonePessoa> getTodosTelefones(){
TelefonePessoaBusiness tpB = new TelefonePessoaBusiness();
ArrayList<TelefonePessoa> retorno = (ArrayList<TelefonePessoa>) tpB.listar(instrutor);
instrutor.setTelefones(retorno);
telefones = retorno;
return retorno;
}
public DataModel<Instrutor> getTodos() throws Exception {
if(idModalidadePesquisa != 0){
InstrutorModalidadeBusiness imB = new InstrutorModalidadeBusiness();
Modalidade modalidade = new Modalidade();
modalidade.setIdModalidade(idModalidadePesquisa);
ArrayList<InstrutorModalidade> instrutoresModalidade = (ArrayList<InstrutorModalidade>) imB.listar(modalidade);
ArrayList<Instrutor> instrutores = new ArrayList<Instrutor>();
for (int i = 0; i < instrutoresModalidade.size(); i++) {
instrutores.add(instrutoresModalidade.get(i).getInstrutor());
}
model = new ListDataModel<Instrutor>(instrutores);
}else{
InstrutorBusiness iB = new InstrutorBusiness();
model = new ListDataModel<Instrutor>(iB.listar());
}
return model;
}
public EnderecoPessoa getEndereco() {
return endereco;
}
public void setEndereco(EnderecoPessoa endereco) {
this.endereco = endereco;
}
public List<TelefonePessoa> getTelefones() {
return telefones;
}
public void setTelefones(List<TelefonePessoa> telefones) {
this.telefones = telefones;
}
public TelefonePessoa getTelefone() {
return telefone;
}
public void setTelefone(TelefonePessoa telefone) {
this.telefone = telefone;
}
public void setLoginBean(LoginBean loginBean) {
this.loginBean = loginBean;
}
public DataModel<Instrutor> getModel() {
return model;
}
public void setModel(DataModel<Instrutor> model) {
this.model = model;
}
public DataModel<InstrutorModalidadeUnidade> getModelImus() {
return modelImus;
}
public int getIdModalidadePesquisa() {
return idModalidadePesquisa;
}
public void setIdModalidadePesquisa(int idModalidadePesquisa) {
this.idModalidadePesquisa = idModalidadePesquisa;
}
public void setModelImus(DataModel<InstrutorModalidadeUnidade> modelImus) {
this.modelImus = modelImus;
}
public InstrutorModalidadeUnidade getInstrutorModalidadeUnidade() {
return instrutorModalidadeUnidade;
}
public void setInstrutorModalidadeUnidade(
InstrutorModalidadeUnidade instrutorModalidadeUnidade) {
this.instrutorModalidadeUnidade = instrutorModalidadeUnidade;
}
public String gerarInstrutor() {
try {
Unidade u = new Unidade();
u.setNome(loginBean.getNomeUnidade());
InstrutorModalidadeUnidadeBusiness um = new InstrutorModalidadeUnidadeBusiness();
ArrayList<InstrutorModalidadeUnidade> instrutorModalidadeUnidade = (ArrayList<InstrutorModalidadeUnidade>) um.listarPorSalario(u);
Map<String, Object> params = new HashMap<String, Object>();
params.put("date", new Date());
params.put(JRParameter.REPORT_LOCALE, new Locale("pt","BR"));
//recebe o cmainho do esquema de relatorio escolhido
JasperReport report = JasperCompileManager.compileReport(
((ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext()).getRealPath("/resources/modelos/InstrutorSalario.jrxml"));
//recebe a lista
JasperPrint print = JasperFillManager.fillReport(report, params, new JRBeanCollectionDataSource(instrutorModalidadeUnidade));
JasperExportManager.exportReportToPdfFile(print,
((ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext()).getRealPath("/resources/relatorios/InstrutorPorSalario.pdf"));
} catch (JRException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "pdfInstrutores.xhtml";
}
}
|
ISO-8859-1
|
Java
| 10,675
|
java
|
InstrutorBean.java
|
Java
|
[
{
"context": "po(\"Atualização\");\n\t\tacesso.setNomeTabelaAfetada(\"Instrutor\");\n\t\taB.salvar(acesso);\n\n\t\tLogAcessoBusiness laB ",
"end": 2916,
"score": 0.9704822301864624,
"start": 2907,
"tag": "NAME",
"value": "Instrutor"
},
{
"context": "tTipo(\"Cadastro\");\n\t\tacesso.setNomeTabelaAfetada(\"Instrutor\");\n\t\taB.salvar(acesso);\n\n\t\tLogAcessoBusiness laB ",
"end": 4007,
"score": 0.8853123188018799,
"start": 3998,
"tag": "NAME",
"value": "Instrutor"
}
] | null |
[] |
package controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import javax.servlet.ServletContext;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRParameter;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import models.Acesso;
import models.EnderecoPessoa;
import models.Instrutor;
import models.InstrutorModalidade;
import models.InstrutorModalidadeUnidade;
import models.LogAcesso;
import models.Modalidade;
import models.TelefonePessoa;
import models.Unidade;
import business.AcessoBusiness;
import business.EnderecoPessoaBusiness;
import business.InstrutorBusiness;
import business.InstrutorModalidadeBusiness;
import business.InstrutorModalidadeUnidadeBusiness;
import business.LogAcessoBusiness;
import business.TelefonePessoaBusiness;
@ManagedBean(name = "instrutor")
@SessionScoped
public class InstrutorBean {
@ManagedProperty(value="#{login}")
private LoginBean loginBean;
private Instrutor instrutor = null;
private EnderecoPessoa endereco = null;
private List<TelefonePessoa> telefones = null;
private TelefonePessoa telefone = null;
private DataModel<Instrutor> model;
private DataModel<InstrutorModalidadeUnidade> modelImus;
private InstrutorModalidadeUnidade instrutorModalidadeUnidade; //para o editar da visualização das modalidades
private int idModalidadePesquisa;
@PostConstruct
public void init() {
if (instrutor == null) {
instrutor = new Instrutor();
endereco = new EnderecoPessoa();
telefones = new ArrayList<TelefonePessoa>();
telefone = new TelefonePessoa();
instrutorModalidadeUnidade = new InstrutorModalidadeUnidade();
}
}
public Instrutor getInstrutor() {
return instrutor;
}
public void setInstrutor(Instrutor instrutor) {
this.instrutor = instrutor;
}
public void atualizarInstrutor(){
EnderecoPessoaBusiness epB = new EnderecoPessoaBusiness();
epB.update(instrutor.getEndereco());
InstrutorBusiness iB = new InstrutorBusiness();
iB.update(instrutor);
//inserindo na tabela de log
AcessoBusiness aB = new AcessoBusiness();
Acesso acesso = new Acesso();
acesso.setDataAcesso(new Date(System.currentTimeMillis()));
acesso.setTipo("Atualização");
acesso.setNomeTabelaAfetada("Instrutor");
aB.salvar(acesso);
LogAcessoBusiness laB = new LogAcessoBusiness();
LogAcesso la = new LogAcesso();
la.setAcesso(acesso);
la.setUsuario(loginBean.getUsuario());
laB.salvar(la);
//zerando o bean
instrutor = new Instrutor();
endereco = new EnderecoPessoa();
telefones = new ArrayList<TelefonePessoa>();
telefone = new TelefonePessoa();
instrutorModalidadeUnidade = new InstrutorModalidadeUnidade();
try {
FacesContext.getCurrentInstance().getExternalContext().redirect("listarInstrutor.xhtml");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void cadastrarInstrutor(){
cadastrarEndereco();
instrutor.setEndereco(endereco);
InstrutorBusiness instrutorBusiness = new InstrutorBusiness();
instrutorBusiness.salvar(instrutor);
cadastrarTelefones();
//inserindo na tabela de log
AcessoBusiness aB = new AcessoBusiness();
Acesso acesso = new Acesso();
acesso.setDataAcesso(new Date(System.currentTimeMillis()));
acesso.setTipo("Cadastro");
acesso.setNomeTabelaAfetada("Instrutor");
aB.salvar(acesso);
LogAcessoBusiness laB = new LogAcessoBusiness();
LogAcesso la = new LogAcesso();
la.setAcesso(acesso);
la.setUsuario(loginBean.getUsuario());
laB.salvar(la);
//zerando o bean
instrutor = new Instrutor();
endereco = new EnderecoPessoa();
telefones = new ArrayList<TelefonePessoa>();
telefone = new TelefonePessoa();
instrutorModalidadeUnidade = new InstrutorModalidadeUnidade();
try {
FacesContext.getCurrentInstance().getExternalContext().redirect("listarInstrutor.xhtml");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void cadastrarTelefones(){
TelefonePessoaBusiness telefoneUnidadeBusiness = new TelefonePessoaBusiness();
telefone.setPessoa(instrutor);
telefoneUnidadeBusiness.salvar(telefone);
}
public void cadastrarEndereco(){
EnderecoPessoaBusiness enderecoBusiness = new EnderecoPessoaBusiness();
enderecoBusiness.salvar(endereco);
}
public void addTelefoneEditar(){
telefone.setPessoa(instrutor);
telefones.add(telefone);
//salvando o novo telefone no banco
TelefonePessoaBusiness tpB = new TelefonePessoaBusiness();
tpB.salvar(telefone);
//zerando o bean
telefone = new TelefonePessoa();
}
public String removerTelefone(){
for (int i = 0; i < telefones.size(); i++){
if (telefones.get(i).getNumero().equals(telefone.getNumero())){
telefones.remove(i);
i--;
}
}
TelefonePessoaBusiness tpB = new TelefonePessoaBusiness();
tpB.deletar(telefone);
//zerando o bean
telefone = new TelefonePessoa();
return "";
}
public String editarIMU(){
return "editarInstrutorModalidadeUnidade";
}
public String editar(){
return "editarInstrutor?faces-redirect=true";
}
public String verModalidades(){
return "modalidadesInstrutor?faces-redirect=true";
}
public String verTelefones(){
return "telefonesInstrutor?faces-redirect=true";
}
public String voltarListarInstrutor(){
return "listarInstrutor?faces-redirect=true";
}
public DataModel<InstrutorModalidadeUnidade> getTodosModalidadeInstrutor() throws Exception {
InstrutorModalidadeUnidadeBusiness imuB = new InstrutorModalidadeUnidadeBusiness();
Unidade unidade= new Unidade();
unidade.setNome(loginBean.getNomeUnidade());
ArrayList<InstrutorModalidadeUnidade> imus = new ArrayList<InstrutorModalidadeUnidade>();
imus = (ArrayList<InstrutorModalidadeUnidade>) imuB.listar(unidade); //todos os instrutoresModalidadeUnidade
//eliminando objetos que tem o instrutor diferente do selecionado
for (int i = 0; i < imus.size(); i++) {
if(!imus.get(i).getInstrutorModalidade().getInstrutor().getCpf().equals(instrutor.getCpf())){
imus.remove(i);
i--;
}
}
modelImus = new ListDataModel<InstrutorModalidadeUnidade>(imus);
return modelImus;
}
public List<InstrutorModalidade> getTodosInstrutorModalidade(){
InstrutorModalidadeBusiness imB = new InstrutorModalidadeBusiness();
return imB.listar();
}
public List<TelefonePessoa> getTodosTelefones(){
TelefonePessoaBusiness tpB = new TelefonePessoaBusiness();
ArrayList<TelefonePessoa> retorno = (ArrayList<TelefonePessoa>) tpB.listar(instrutor);
instrutor.setTelefones(retorno);
telefones = retorno;
return retorno;
}
public DataModel<Instrutor> getTodos() throws Exception {
if(idModalidadePesquisa != 0){
InstrutorModalidadeBusiness imB = new InstrutorModalidadeBusiness();
Modalidade modalidade = new Modalidade();
modalidade.setIdModalidade(idModalidadePesquisa);
ArrayList<InstrutorModalidade> instrutoresModalidade = (ArrayList<InstrutorModalidade>) imB.listar(modalidade);
ArrayList<Instrutor> instrutores = new ArrayList<Instrutor>();
for (int i = 0; i < instrutoresModalidade.size(); i++) {
instrutores.add(instrutoresModalidade.get(i).getInstrutor());
}
model = new ListDataModel<Instrutor>(instrutores);
}else{
InstrutorBusiness iB = new InstrutorBusiness();
model = new ListDataModel<Instrutor>(iB.listar());
}
return model;
}
public EnderecoPessoa getEndereco() {
return endereco;
}
public void setEndereco(EnderecoPessoa endereco) {
this.endereco = endereco;
}
public List<TelefonePessoa> getTelefones() {
return telefones;
}
public void setTelefones(List<TelefonePessoa> telefones) {
this.telefones = telefones;
}
public TelefonePessoa getTelefone() {
return telefone;
}
public void setTelefone(TelefonePessoa telefone) {
this.telefone = telefone;
}
public void setLoginBean(LoginBean loginBean) {
this.loginBean = loginBean;
}
public DataModel<Instrutor> getModel() {
return model;
}
public void setModel(DataModel<Instrutor> model) {
this.model = model;
}
public DataModel<InstrutorModalidadeUnidade> getModelImus() {
return modelImus;
}
public int getIdModalidadePesquisa() {
return idModalidadePesquisa;
}
public void setIdModalidadePesquisa(int idModalidadePesquisa) {
this.idModalidadePesquisa = idModalidadePesquisa;
}
public void setModelImus(DataModel<InstrutorModalidadeUnidade> modelImus) {
this.modelImus = modelImus;
}
public InstrutorModalidadeUnidade getInstrutorModalidadeUnidade() {
return instrutorModalidadeUnidade;
}
public void setInstrutorModalidadeUnidade(
InstrutorModalidadeUnidade instrutorModalidadeUnidade) {
this.instrutorModalidadeUnidade = instrutorModalidadeUnidade;
}
public String gerarInstrutor() {
try {
Unidade u = new Unidade();
u.setNome(loginBean.getNomeUnidade());
InstrutorModalidadeUnidadeBusiness um = new InstrutorModalidadeUnidadeBusiness();
ArrayList<InstrutorModalidadeUnidade> instrutorModalidadeUnidade = (ArrayList<InstrutorModalidadeUnidade>) um.listarPorSalario(u);
Map<String, Object> params = new HashMap<String, Object>();
params.put("date", new Date());
params.put(JRParameter.REPORT_LOCALE, new Locale("pt","BR"));
//recebe o cmainho do esquema de relatorio escolhido
JasperReport report = JasperCompileManager.compileReport(
((ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext()).getRealPath("/resources/modelos/InstrutorSalario.jrxml"));
//recebe a lista
JasperPrint print = JasperFillManager.fillReport(report, params, new JRBeanCollectionDataSource(instrutorModalidadeUnidade));
JasperExportManager.exportReportToPdfFile(print,
((ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext()).getRealPath("/resources/relatorios/InstrutorPorSalario.pdf"));
} catch (JRException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "pdfInstrutores.xhtml";
}
}
| 10,675
| 0.769281
| 0.768906
| 359
| 28.724234
| 27.059498
| 153
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.855153
| false
| false
|
2
|
f42f8d169037061efbb3e4431a365e045d1e916a
| 19,069,654,835,607
|
3a9caa64427cf2c29e3511adea6d671a70c3bbe3
|
/com/digits/sdk/android/bf.java
|
15051b40e6e16cb63713ae36dca0b15fcaba076c
|
[] |
no_license
|
DrOpossum/HAG-APP-obfuscated
|
https://github.com/DrOpossum/HAG-APP-obfuscated
|
9590d1f77ecccd63c4f5eeec1561e9e995005f48
|
f801ce550c03e6d8c78b7e01e2c6deaf39900ede
|
refs/heads/master
| 2020-02-25T12:10:31.442000
| 2017-08-15T12:48:12
| 2017-08-15T12:48:12
| 100,375,772
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.digits.sdk.android;
import android.app.Activity;
import android.os.Bundle;
import android.os.ResultReceiver;
import android.widget.EditText;
import android.widget.TextView;
import c.a.a.a.a.b.i;
import com.digits.sdk.android.bh.e;
import com.digits.sdk.android.bh.f;
/* compiled from: PinCodeActivityDelegate */
final class bf extends ac {
EditText f1664a;
StateButton f1665b;
TextView f1666c;
ah f1667d;
bf() {
}
public final int mo1695c() {
return f.dgts__activity_pin_code;
}
public final void mo1690a(Activity activity, Bundle bundle) {
this.f1664a = (EditText) activity.findViewById(e.dgts__confirmationEditText);
this.f1665b = (StateButton) activity.findViewById(e.dgts__createAccount);
this.f1666c = (TextView) activity.findViewById(e.dgts__termsTextCreateAccount);
this.f1667d = new bg((ResultReceiver) bundle.getParcelable("receiver"), this.f1665b, this.f1664a, bundle.getString("request_id"), bundle.getLong("user_id"), bundle.getString("phone_number"));
m1455a(activity, this.f1667d, this.f1664a);
mo1692a(activity, this.f1667d, this.f1665b);
mo1691a(activity, this.f1667d, this.f1666c);
i.b(activity, this.f1664a);
}
public final boolean mo1693a(Bundle bundle) {
return i.a(bundle, new String[]{"receiver", "phone_number", "request_id", "user_id"});
}
public final void mo1694b() {
this.f1667d.b();
}
}
|
UTF-8
|
Java
| 1,478
|
java
|
bf.java
|
Java
|
[] | null |
[] |
package com.digits.sdk.android;
import android.app.Activity;
import android.os.Bundle;
import android.os.ResultReceiver;
import android.widget.EditText;
import android.widget.TextView;
import c.a.a.a.a.b.i;
import com.digits.sdk.android.bh.e;
import com.digits.sdk.android.bh.f;
/* compiled from: PinCodeActivityDelegate */
final class bf extends ac {
EditText f1664a;
StateButton f1665b;
TextView f1666c;
ah f1667d;
bf() {
}
public final int mo1695c() {
return f.dgts__activity_pin_code;
}
public final void mo1690a(Activity activity, Bundle bundle) {
this.f1664a = (EditText) activity.findViewById(e.dgts__confirmationEditText);
this.f1665b = (StateButton) activity.findViewById(e.dgts__createAccount);
this.f1666c = (TextView) activity.findViewById(e.dgts__termsTextCreateAccount);
this.f1667d = new bg((ResultReceiver) bundle.getParcelable("receiver"), this.f1665b, this.f1664a, bundle.getString("request_id"), bundle.getLong("user_id"), bundle.getString("phone_number"));
m1455a(activity, this.f1667d, this.f1664a);
mo1692a(activity, this.f1667d, this.f1665b);
mo1691a(activity, this.f1667d, this.f1666c);
i.b(activity, this.f1664a);
}
public final boolean mo1693a(Bundle bundle) {
return i.a(bundle, new String[]{"receiver", "phone_number", "request_id", "user_id"});
}
public final void mo1694b() {
this.f1667d.b();
}
}
| 1,478
| 0.686062
| 0.618403
| 44
| 32.590908
| 35.667225
| 199
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.931818
| false
| false
|
2
|
7c000de046fb6d6b6f2aa7063bacd356366fee6d
| 31,129,922,989,377
|
5f1d04f51c17ef595279432a92feb6af98e9a1fd
|
/ISS Project/src/main/java/ubb/project/iss/service/AttendanceServiceImpl.java
|
60dcff61888612b2a797dbf80aa11dd7b80a66b9
|
[] |
no_license
|
justinhoUBB/ISS
|
https://github.com/justinhoUBB/ISS
|
835aa3ca727a1be48f0dcc8959592b27af47626b
|
09bb20ca83333532766275930c4acdc12ccc76eb
|
refs/heads/master
| 2021-01-16T07:19:46.897000
| 2020-05-28T14:16:17
| 2020-05-28T14:16:17
| 243,021,935
| 0
| 0
| null | false
| 2021-01-06T03:31:28
| 2020-02-25T14:37:03
| 2020-05-28T14:16:29
| 2021-01-06T03:31:26
| 3,331
| 0
| 0
| 1
|
JavaScript
| false
| false
|
package ubb.project.iss.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import ubb.project.iss.domain.Attendance;
import ubb.project.iss.domain.Conference;
import ubb.project.iss.domain.UserAccount;
import ubb.project.iss.repository.AttendanceRepository;
import ubb.project.iss.repository.ConferenceRepository;
import ubb.project.iss.repository.UserRepository;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class AttendanceServiceImpl implements AttendanceService {
@Autowired
AttendanceRepository attendanceRepository;
@Autowired
UserRepository userRepository;
@Autowired
ConferenceRepository conferenceRepository;
@Override
public List<Attendance> getAll() {
return attendanceRepository.findAll();
}
@Override
public Attendance save(Attendance userSignup) {
return attendanceRepository.save(userSignup);
}
@Override
public void removeAttendance(Attendance attendance) {
attendanceRepository.delete(attendance);
}
@Override
public Attendance getById(Long id) {
return attendanceRepository.findById(id).get();
}
@Override
public ArrayList<UserAccount> getAllUsersAttendingConference(long conference_id) {
return (ArrayList<UserAccount>) attendanceRepository.findAll().stream().
filter(attendance -> attendance.getConference_id() == conference_id).
map(attendance -> userRepository.findById(attendance.getUser_id()).get()).
collect(Collectors.toList());
}
@Override
public ArrayList<Conference> getAllConferencesAttendedByUser(long user_id) {
return (ArrayList<Conference>) attendanceRepository.findAll().stream().
filter(attendance -> attendance.getUser_id() == user_id).
map(attendance -> conferenceRepository.findById(attendance.getConference_id()).get()).
collect(Collectors.toList());
}
}
|
UTF-8
|
Java
| 2,069
|
java
|
AttendanceServiceImpl.java
|
Java
|
[] | null |
[] |
package ubb.project.iss.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import ubb.project.iss.domain.Attendance;
import ubb.project.iss.domain.Conference;
import ubb.project.iss.domain.UserAccount;
import ubb.project.iss.repository.AttendanceRepository;
import ubb.project.iss.repository.ConferenceRepository;
import ubb.project.iss.repository.UserRepository;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class AttendanceServiceImpl implements AttendanceService {
@Autowired
AttendanceRepository attendanceRepository;
@Autowired
UserRepository userRepository;
@Autowired
ConferenceRepository conferenceRepository;
@Override
public List<Attendance> getAll() {
return attendanceRepository.findAll();
}
@Override
public Attendance save(Attendance userSignup) {
return attendanceRepository.save(userSignup);
}
@Override
public void removeAttendance(Attendance attendance) {
attendanceRepository.delete(attendance);
}
@Override
public Attendance getById(Long id) {
return attendanceRepository.findById(id).get();
}
@Override
public ArrayList<UserAccount> getAllUsersAttendingConference(long conference_id) {
return (ArrayList<UserAccount>) attendanceRepository.findAll().stream().
filter(attendance -> attendance.getConference_id() == conference_id).
map(attendance -> userRepository.findById(attendance.getUser_id()).get()).
collect(Collectors.toList());
}
@Override
public ArrayList<Conference> getAllConferencesAttendedByUser(long user_id) {
return (ArrayList<Conference>) attendanceRepository.findAll().stream().
filter(attendance -> attendance.getUser_id() == user_id).
map(attendance -> conferenceRepository.findById(attendance.getConference_id()).get()).
collect(Collectors.toList());
}
}
| 2,069
| 0.724988
| 0.724988
| 60
| 33.5
| 28.221445
| 102
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.35
| false
| false
|
2
|
8defc4e4f574260634d4e70d6008995b7ef9933b
| 12,403,865,592,411
|
d0266007b43693b22f9b520f3d172bfb0b271a94
|
/src/entities/MovingBlock.java
|
942e1cf121be53859adf884a617a87ca1c1f30be
|
[] |
no_license
|
andrew-peng-144/Rifter
|
https://github.com/andrew-peng-144/Rifter
|
0aeaa1b25f833afb200ce6805c23f94f50451b95
|
77ccfc87cc028ba6a021016365123b5cd06b0a39
|
refs/heads/master
| 2022-01-07T10:30:35.041000
| 2019-05-20T15:46:14
| 2019-05-20T15:46:14
| 104,680,773
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package entities;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.kek.Constants;
import com.kek.PlayScreen;
public class MovingBlock extends Entity {
float maxDistInTiles;
Vector2 spawnPoint;
public MovingBlock(Body body, Sprite sprite, PlayScreen screen, float maxDistInTiles) {
super(body, sprite, screen);
spawnPoint = body.getWorldCenter();
this.maxDistInTiles=maxDistInTiles;
}
@Override
public void update(float dt) {
super.update(dt);
if(spawnPoint.dst(body.getPosition()) >= maxDistInTiles/Constants.TPM) {
destroy();
}
}
}
|
UTF-8
|
Java
| 685
|
java
|
MovingBlock.java
|
Java
|
[] | null |
[] |
package entities;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.kek.Constants;
import com.kek.PlayScreen;
public class MovingBlock extends Entity {
float maxDistInTiles;
Vector2 spawnPoint;
public MovingBlock(Body body, Sprite sprite, PlayScreen screen, float maxDistInTiles) {
super(body, sprite, screen);
spawnPoint = body.getWorldCenter();
this.maxDistInTiles=maxDistInTiles;
}
@Override
public void update(float dt) {
super.update(dt);
if(spawnPoint.dst(body.getPosition()) >= maxDistInTiles/Constants.TPM) {
destroy();
}
}
}
| 685
| 0.719708
| 0.713869
| 29
| 21.620689
| 22.150604
| 88
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.551724
| false
| false
|
2
|
4a8e78e1a98e21d21c42827c35266246b902146e
| 36,240,934,049,849
|
7e11ab63323691aba6f33d9f39dc0f0e6a714106
|
/app/src/main/java/com/pakistan/feeding/feedingpakistan/Main.java
|
61bfd7b6c90b4b9d9a2933ed29f874786669fcba
|
[] |
no_license
|
faiziali98/Feed-Pakistan
|
https://github.com/faiziali98/Feed-Pakistan
|
2abe8ba7a9f6d0af78ca3bfd3edee871da308029
|
148d3bf97af9828ecaf3f1b4e1b8fe0e8106b053
|
refs/heads/master
| 2020-03-06T19:27:33.321000
| 2018-03-27T18:18:11
| 2018-03-27T18:18:11
| 127,028,457
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.pakistan.feeding.feedingpakistan;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Display;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TabHost;
import android.widget.TextView;
/**
* Created by Faizan on 7/26/2015.
*/
public class Main extends AppCompatActivity {
// int counter;
// Button add, sub,menu;
// TextView display;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TabHost th=(TabHost)findViewById(R.id.tabHost);
th.setup();
TabHost.TabSpec specs=th.newTabSpec("tag1");
specs.setContent(R.id.tab1);
specs.setIndicator("Counter");
th.addTab(specs);
specs=th.newTabSpec("tag2");
specs.setContent(R.id.tab2);
specs.setIndicator("Live chat");
th.addTab(specs);
specs=th.newTabSpec("tag2");
specs.setContent(R.id.tab2);
specs.setIndicator("Maps");
th.addTab(specs);
// counter=0;
// add=(Button)findViewById(R.id.add);
// sub=(Button)findViewById(R.id.sub);
// menu=(Button)findViewById(R.id.menu);
// display=(TextView)findViewById(R.id.text);
//
// add.setOnClickListener(new View.OnClickListener() {
// public void onClick(View v) {
// counter++;
// display.setText("Your Total is " + counter);
// }
// });
// sub.setOnClickListener(new View.OnClickListener() {
// public void onClick(View v) {
// counter--;
// display.setText("Your Total is " + counter);
// }
// });
// menu.setOnClickListener(new View.OnClickListener() {
// public void onClick(View v) {
// Intent startApp = new Intent("com.pakistan.feeding.feedingpakistan.menu");
// startActivity(startApp);
// }
// });
// FragmentManager fragmentManager=getFragmentManager();
// FragmentTransaction fragmentTransaction=fragmentManager.beginTransaction();
// WindowManager wm=getWindowManager();
// Display d=wm.getDefaultDisplay();
//
// if (d.getWidth()>d.getHeight()) {
// Fagmanet1 fragment1=new Fagmanet1();
// fragmentTransaction.replace(android.R.id.content,fragment1);
// }else{
// Fagmanet2 fragment2=new Fagmanet2();
// fragmentTransaction.replace(android.R.id.content,fragment2);
// }
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
protected void onPause() {
super.onPause();
finish();
}
}
|
UTF-8
|
Java
| 3,633
|
java
|
Main.java
|
Java
|
[
{
"context": "mport android.widget.TextView;\n\n\n/**\n * Created by Faizan on 7/26/2015.\n */\npublic class Main extends AppCo",
"end": 494,
"score": 0.9945685863494873,
"start": 488,
"tag": "USERNAME",
"value": "Faizan"
}
] | null |
[] |
package com.pakistan.feeding.feedingpakistan;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Display;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TabHost;
import android.widget.TextView;
/**
* Created by Faizan on 7/26/2015.
*/
public class Main extends AppCompatActivity {
// int counter;
// Button add, sub,menu;
// TextView display;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TabHost th=(TabHost)findViewById(R.id.tabHost);
th.setup();
TabHost.TabSpec specs=th.newTabSpec("tag1");
specs.setContent(R.id.tab1);
specs.setIndicator("Counter");
th.addTab(specs);
specs=th.newTabSpec("tag2");
specs.setContent(R.id.tab2);
specs.setIndicator("Live chat");
th.addTab(specs);
specs=th.newTabSpec("tag2");
specs.setContent(R.id.tab2);
specs.setIndicator("Maps");
th.addTab(specs);
// counter=0;
// add=(Button)findViewById(R.id.add);
// sub=(Button)findViewById(R.id.sub);
// menu=(Button)findViewById(R.id.menu);
// display=(TextView)findViewById(R.id.text);
//
// add.setOnClickListener(new View.OnClickListener() {
// public void onClick(View v) {
// counter++;
// display.setText("Your Total is " + counter);
// }
// });
// sub.setOnClickListener(new View.OnClickListener() {
// public void onClick(View v) {
// counter--;
// display.setText("Your Total is " + counter);
// }
// });
// menu.setOnClickListener(new View.OnClickListener() {
// public void onClick(View v) {
// Intent startApp = new Intent("com.pakistan.feeding.feedingpakistan.menu");
// startActivity(startApp);
// }
// });
// FragmentManager fragmentManager=getFragmentManager();
// FragmentTransaction fragmentTransaction=fragmentManager.beginTransaction();
// WindowManager wm=getWindowManager();
// Display d=wm.getDefaultDisplay();
//
// if (d.getWidth()>d.getHeight()) {
// Fagmanet1 fragment1=new Fagmanet1();
// fragmentTransaction.replace(android.R.id.content,fragment1);
// }else{
// Fagmanet2 fragment2=new Fagmanet2();
// fragmentTransaction.replace(android.R.id.content,fragment2);
// }
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
protected void onPause() {
super.onPause();
finish();
}
}
| 3,633
| 0.6218
| 0.615469
| 106
| 33.273586
| 21.473341
| 92
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.650943
| false
| false
|
2
|
6a0f685dd4eede5fa8ce99531810cd0319d754f7
| 2,954,937,538,105
|
d17e3e7b653526ce982252925704ad6ff0202556
|
/webplat/src/main/java/com/tjs/admin/xintuo/controller/XinTuoGsControler.java
|
9c54eeee5b1f17d997dea849500bc9757b95fe10
|
[] |
no_license
|
tjs123/webplat
|
https://github.com/tjs123/webplat
|
338d01a4009d6a4204152388e099994a3cb50b58
|
f8bfada0f8e670c1838ee29c117a5724e98ac470
|
refs/heads/master
| 2015-08-21T17:55:19.930000
| 2015-08-20T08:34:22
| 2015-08-20T08:34:22
| 32,330,529
| 2
| 12
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.tjs.admin.xintuo.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.tjs.admin.xintuo.model.ProductXtgs;
import com.tjs.admin.xintuo.service.IProductXtgsService;
/**
* 系统产品//http://127.0.0.1:8080/webplat/product/xt/list?method=getXtList
*
* @author 何志刚
* @since 2015年3月21日 下午3:54:00
**/
@Controller
@RequestMapping(value = "/admin/xintuo/xintuogs")
public class XinTuoGsControler {
@Resource
private IProductXtgsService iProductXtService;
@RequestMapping("/xtgsIndex")
public String xtgsIndex() {
return "admin/xintuo/xtgsIndex";
}
@RequestMapping("/listDataCount")
@ResponseBody
public Map<String, Integer> listDataCount(XinTuoGsCtrlModel xintuoGsCtrlModel, Model model) {
Map<String, Integer> result = new HashMap<String, Integer>();
Integer total = iProductXtService.countProductXtgs(xintuoGsCtrlModel);
result.put("total", total.intValue());
return result;
}
@RequestMapping("/listData")
public String listData(XinTuoGsCtrlModel xintuoGsCtrlModel, Model model) {
List<ProductXtgs> showData = new ArrayList<ProductXtgs>();
showData = iProductXtService.selectProductXtgs(xintuoGsCtrlModel);
model.addAttribute("showData", showData);
model.addAttribute("ctrlData", xintuoGsCtrlModel);
return "admin/xintuo/gsListData";
}
@RequestMapping("/insert")
public String insert(ProductXtgs productXtgs, XinTuoGsCtrlModel xintuoGsCtrlModel, Model model) {
model.addAttribute(productXtgs);
model.addAttribute("ctrlData", xintuoGsCtrlModel);
return "admin/xintuo/insertGs";
}
@RequestMapping("/insertData")
@ResponseBody
public Map<String, Object> insertData(ProductXtgs productXtgs, XinTuoGsCtrlModel xintuoGsCtrlModel, Model model) {
Map<String, Object> result = new HashMap<String, Object>();
int id = iProductXtService.insertProductXtgs(productXtgs);
result.put("code", "0");
result.put("bizData", productXtgs);
return result;
}
@RequestMapping("/update")
public String update(@RequestParam(value="id",required=false) Long xtgsId, XinTuoGsCtrlModel xintuoGsCtrlModel, Model model) {
ProductXtgs productXtgs = iProductXtService.findByProductXtgsId(xtgsId);
System.err.println(">>>>>>"+productXtgs.getXgtsStatus());
model.addAttribute(productXtgs);
model.addAttribute("ctrlData", xintuoGsCtrlModel);
return "admin/xintuo/updateGs";
}
@RequestMapping("/updateData")
@ResponseBody
public Map<String, Object> updateData(ProductXtgs productXtgs, XinTuoGsCtrlModel xintuoGsCtrlModel, Model model) {
Map<String, Object> result = new HashMap<String, Object>();
iProductXtService.updateProductXtgs(productXtgs);
result.put("code", "0");
result.put("bizData", productXtgs);
return result;
}
@RequestMapping("/view")
public String view(@RequestParam(value="id",required=false) Long xtgsId, XinTuoGsCtrlModel xintuoGsCtrlModel, Model model) {
ProductXtgs productXtgs = iProductXtService.findByProductXtgsId(xtgsId);
model.addAttribute(productXtgs);
model.addAttribute("ctrlData", xintuoGsCtrlModel);
return "admin/xintuo/viewGs";
}
@RequestMapping("/deleteData")
public Map<String, Object> deleteData(@RequestParam(value="ids",required=false) Long[] xtgsIds, XinTuoGsCtrlModel xintuoGsCtrlModel, Model model) {
Map<String, Object> result = new HashMap<String, Object>();
iProductXtService.deleteBatchProductXtgs(xtgsIds);;
result.put("code", "0");
model.addAttribute("ctrlData", xintuoGsCtrlModel);
return result;
}
}
|
UTF-8
|
Java
| 4,331
|
java
|
XinTuoGsControler.java
|
Java
|
[
{
"context": "ervice.IProductXtgsService;\r\n/**\r\n * 系统产品//http://127.0.0.1:8080/webplat/product/xt/list?method=getXtList\r\n *",
"end": 662,
"score": 0.9985988140106201,
"start": 653,
"tag": "IP_ADDRESS",
"value": "127.0.0.1"
},
{
"context": "product/xt/list?method=getXtList\r\n * \r\n * @author 何志刚\r\n * @since 2015年3月21日 下午3:54:00\r\n **/\r\n@Controlle",
"end": 729,
"score": 0.9994070529937744,
"start": 726,
"tag": "NAME",
"value": "何志刚"
}
] | null |
[] |
package com.tjs.admin.xintuo.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.tjs.admin.xintuo.model.ProductXtgs;
import com.tjs.admin.xintuo.service.IProductXtgsService;
/**
* 系统产品//http://127.0.0.1:8080/webplat/product/xt/list?method=getXtList
*
* @author 何志刚
* @since 2015年3月21日 下午3:54:00
**/
@Controller
@RequestMapping(value = "/admin/xintuo/xintuogs")
public class XinTuoGsControler {
@Resource
private IProductXtgsService iProductXtService;
@RequestMapping("/xtgsIndex")
public String xtgsIndex() {
return "admin/xintuo/xtgsIndex";
}
@RequestMapping("/listDataCount")
@ResponseBody
public Map<String, Integer> listDataCount(XinTuoGsCtrlModel xintuoGsCtrlModel, Model model) {
Map<String, Integer> result = new HashMap<String, Integer>();
Integer total = iProductXtService.countProductXtgs(xintuoGsCtrlModel);
result.put("total", total.intValue());
return result;
}
@RequestMapping("/listData")
public String listData(XinTuoGsCtrlModel xintuoGsCtrlModel, Model model) {
List<ProductXtgs> showData = new ArrayList<ProductXtgs>();
showData = iProductXtService.selectProductXtgs(xintuoGsCtrlModel);
model.addAttribute("showData", showData);
model.addAttribute("ctrlData", xintuoGsCtrlModel);
return "admin/xintuo/gsListData";
}
@RequestMapping("/insert")
public String insert(ProductXtgs productXtgs, XinTuoGsCtrlModel xintuoGsCtrlModel, Model model) {
model.addAttribute(productXtgs);
model.addAttribute("ctrlData", xintuoGsCtrlModel);
return "admin/xintuo/insertGs";
}
@RequestMapping("/insertData")
@ResponseBody
public Map<String, Object> insertData(ProductXtgs productXtgs, XinTuoGsCtrlModel xintuoGsCtrlModel, Model model) {
Map<String, Object> result = new HashMap<String, Object>();
int id = iProductXtService.insertProductXtgs(productXtgs);
result.put("code", "0");
result.put("bizData", productXtgs);
return result;
}
@RequestMapping("/update")
public String update(@RequestParam(value="id",required=false) Long xtgsId, XinTuoGsCtrlModel xintuoGsCtrlModel, Model model) {
ProductXtgs productXtgs = iProductXtService.findByProductXtgsId(xtgsId);
System.err.println(">>>>>>"+productXtgs.getXgtsStatus());
model.addAttribute(productXtgs);
model.addAttribute("ctrlData", xintuoGsCtrlModel);
return "admin/xintuo/updateGs";
}
@RequestMapping("/updateData")
@ResponseBody
public Map<String, Object> updateData(ProductXtgs productXtgs, XinTuoGsCtrlModel xintuoGsCtrlModel, Model model) {
Map<String, Object> result = new HashMap<String, Object>();
iProductXtService.updateProductXtgs(productXtgs);
result.put("code", "0");
result.put("bizData", productXtgs);
return result;
}
@RequestMapping("/view")
public String view(@RequestParam(value="id",required=false) Long xtgsId, XinTuoGsCtrlModel xintuoGsCtrlModel, Model model) {
ProductXtgs productXtgs = iProductXtService.findByProductXtgsId(xtgsId);
model.addAttribute(productXtgs);
model.addAttribute("ctrlData", xintuoGsCtrlModel);
return "admin/xintuo/viewGs";
}
@RequestMapping("/deleteData")
public Map<String, Object> deleteData(@RequestParam(value="ids",required=false) Long[] xtgsIds, XinTuoGsCtrlModel xintuoGsCtrlModel, Model model) {
Map<String, Object> result = new HashMap<String, Object>();
iProductXtService.deleteBatchProductXtgs(xtgsIds);;
result.put("code", "0");
model.addAttribute("ctrlData", xintuoGsCtrlModel);
return result;
}
}
| 4,331
| 0.698398
| 0.692593
| 119
| 34.193275
| 31.963287
| 152
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.117647
| false
| false
|
2
|
f93f41ac370529f4f2e6a8a7c9b39b0101e77fd6
| 36,043,365,559,433
|
6ba79b39f799b477e356aae5a1b1fa71c39589f9
|
/src/com/osp/biz/model/meeting/OspMeetingdoc.java
|
6d33d0cbb8eb87225f0214963a8ad146974d9f4a
|
[] |
no_license
|
xinxing185/appstore
|
https://github.com/xinxing185/appstore
|
1e65569c1436c0b0d516f4fe210b44f550bc1cc7
|
1995b27625fb06fce5bdce542dd891f46ac1d172
|
refs/heads/master
| 2019-01-10T10:26:05.741000
| 2016-11-23T08:06:32
| 2016-11-23T08:06:32
| 74,535,696
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Powered By wufuwei
*/
package com.osp.biz.model.meeting;
import com.osp.biz.model.BaseEntity;
public class OspMeetingdoc extends BaseEntity {
//columns START
private java.lang.Long id;
private java.lang.Long meetingid;
private java.lang.String filename;
private java.lang.String filetype;
private java.lang.Long filesize;
private java.lang.String downloadurl;
private java.lang.String createuser;
private java.sql.Timestamp createdate;
private java.lang.String updateuser;
private java.sql.Timestamp updatedate;
//columns END
public OspMeetingdoc(){
}
public OspMeetingdoc(
java.lang.Long id
){
this.id = id;
}
public void setId(java.lang.Long value) {
this.id = value;
}
public java.lang.Long getId() {
return this.id;
}
public void setMeetingid(java.lang.Long value) {
this.meetingid = value;
}
public java.lang.Long getMeetingid() {
return this.meetingid;
}
public void setFilename(java.lang.String value) {
this.filename = value;
}
public java.lang.String getFilename() {
return this.filename;
}
public void setFiletype(java.lang.String value) {
this.filetype = value;
}
public java.lang.String getFiletype() {
return this.filetype;
}
public void setFilesize(java.lang.Long value) {
this.filesize = value;
}
public java.lang.Long getFilesize() {
return this.filesize;
}
public void setDownloadurl(java.lang.String value) {
this.downloadurl = value;
}
public java.lang.String getDownloadurl() {
return this.downloadurl;
}
public void setCreateuser(java.lang.String value) {
this.createuser = value;
}
public java.lang.String getCreateuser() {
return this.createuser;
}
public void setCreatedate(java.sql.Timestamp value) {
this.createdate = value;
}
public java.sql.Timestamp getCreatedate() {
return this.createdate;
}
public void setUpdateuser(java.lang.String value) {
this.updateuser = value;
}
public java.lang.String getUpdateuser() {
return this.updateuser;
}
public void setUpdatedate(java.sql.Timestamp value) {
this.updatedate = value;
}
public java.sql.Timestamp getUpdatedate() {
return this.updatedate;
}
public String toString() {
StringBuffer bf=new StringBuffer();
return bf
.append(",Id="+getId())
.append(",Meetingid="+getMeetingid())
.append(",Filename="+getFilename())
.append(",Filetype="+getFiletype())
.append(",Filesize="+getFilesize())
.append(",Downloadurl="+getDownloadurl())
.append(",Createuser="+getCreateuser())
.append(",Createdate="+getCreatedate())
.append(",Updateuser="+getUpdateuser())
.append(",Updatedate="+getUpdatedate())
.toString();
}
}
|
UTF-8
|
Java
| 2,835
|
java
|
OspMeetingdoc.java
|
Java
|
[
{
"context": "/*\r\n * Powered By wufuwei\r\n */\r\n\r\npackage com.osp.biz.model.meeting;\r\n\r\nimp",
"end": 25,
"score": 0.9974672198295593,
"start": 18,
"tag": "USERNAME",
"value": "wufuwei"
}
] | null |
[] |
/*
* Powered By wufuwei
*/
package com.osp.biz.model.meeting;
import com.osp.biz.model.BaseEntity;
public class OspMeetingdoc extends BaseEntity {
//columns START
private java.lang.Long id;
private java.lang.Long meetingid;
private java.lang.String filename;
private java.lang.String filetype;
private java.lang.Long filesize;
private java.lang.String downloadurl;
private java.lang.String createuser;
private java.sql.Timestamp createdate;
private java.lang.String updateuser;
private java.sql.Timestamp updatedate;
//columns END
public OspMeetingdoc(){
}
public OspMeetingdoc(
java.lang.Long id
){
this.id = id;
}
public void setId(java.lang.Long value) {
this.id = value;
}
public java.lang.Long getId() {
return this.id;
}
public void setMeetingid(java.lang.Long value) {
this.meetingid = value;
}
public java.lang.Long getMeetingid() {
return this.meetingid;
}
public void setFilename(java.lang.String value) {
this.filename = value;
}
public java.lang.String getFilename() {
return this.filename;
}
public void setFiletype(java.lang.String value) {
this.filetype = value;
}
public java.lang.String getFiletype() {
return this.filetype;
}
public void setFilesize(java.lang.Long value) {
this.filesize = value;
}
public java.lang.Long getFilesize() {
return this.filesize;
}
public void setDownloadurl(java.lang.String value) {
this.downloadurl = value;
}
public java.lang.String getDownloadurl() {
return this.downloadurl;
}
public void setCreateuser(java.lang.String value) {
this.createuser = value;
}
public java.lang.String getCreateuser() {
return this.createuser;
}
public void setCreatedate(java.sql.Timestamp value) {
this.createdate = value;
}
public java.sql.Timestamp getCreatedate() {
return this.createdate;
}
public void setUpdateuser(java.lang.String value) {
this.updateuser = value;
}
public java.lang.String getUpdateuser() {
return this.updateuser;
}
public void setUpdatedate(java.sql.Timestamp value) {
this.updatedate = value;
}
public java.sql.Timestamp getUpdatedate() {
return this.updatedate;
}
public String toString() {
StringBuffer bf=new StringBuffer();
return bf
.append(",Id="+getId())
.append(",Meetingid="+getMeetingid())
.append(",Filename="+getFilename())
.append(",Filetype="+getFiletype())
.append(",Filesize="+getFilesize())
.append(",Downloadurl="+getDownloadurl())
.append(",Createuser="+getCreateuser())
.append(",Createdate="+getCreatedate())
.append(",Updateuser="+getUpdateuser())
.append(",Updatedate="+getUpdatedate())
.toString();
}
}
| 2,835
| 0.669489
| 0.669489
| 135
| 18.985186
| 17.866993
| 54
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.622222
| false
| false
|
2
|
616df5a5983eceaf5c7dae840b6ff5d0f1aa5ed5
| 34,471,407,536,308
|
9897fc019ef0b3d3addcaec9b139b157dfcb9464
|
/Lab3/exercise06_1/src/main/java/cs544/exercise06_1/App.java
|
21af0a4058decac03e9fefd3944b7e7ec371dece
|
[] |
no_license
|
YogenRaii/EA_LABS
|
https://github.com/YogenRaii/EA_LABS
|
b3c7ec2b92967f6c0b1b86768693f894991f621a
|
2bcd3fc3ef0eddcd587a51d2e55c57a9cadb32d3
|
refs/heads/master
| 2018-01-08T11:27:53.854000
| 2015-11-09T22:20:37
| 2015-11-09T22:20:37
| 45,467,497
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package cs544.exercise06_1;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
public class App {
private static final SessionFactory sessionFactory;
private static final ServiceRegistry serviceRegistry;
static {
Configuration configuration = new Configuration();
configuration.configure();
serviceRegistry = new StandardServiceRegistryBuilder().applySettings(
configuration.getProperties()).build();
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
}
public static void main(String[] args) {
// Hibernate placeholders
Session session = null;
Transaction tx = null;
try {
session = sessionFactory.openSession();
tx = session.beginTransaction();
Payment payment=new Payment("12/08/06",1200.0);
Patient patient=new Patient("Yogen Rai","1000N","Fairfield","52557");
Doctor doctor=new Doctor("Eye Doctor","Frank","Brown");
Appointment appointment=new Appointment("15/05/08",patient,payment,doctor);
session.persist(appointment);
tx.commit();
} catch (HibernateException e) {
if (tx != null) {
System.err.println("Rolling back: " + e.getMessage());
tx.rollback();
}
} finally {
if (session != null) {
session.close();
}
}
try {
session = sessionFactory.openSession();
tx = session.beginTransaction();
List<Appointment> appointments=session.createQuery("from Appointment").list();
for(Appointment appointment:appointments){
System.out.println(appointment);
}
tx.commit();
} catch (HibernateException e) {
if (tx != null) {
System.err.println("Rolling back: " + e.getMessage());
tx.rollback();
}
} finally {
if (session != null) {
session.close();
}
}
}
}
|
UTF-8
|
Java
| 2,542
|
java
|
App.java
|
Java
|
[
{
"context": "1200.0);\n Patient patient=new Patient(\"Yogen Rai\",\"1000N\",\"Fairfield\",\"52557\");\n Doctor",
"end": 1317,
"score": 0.9998770952224731,
"start": 1308,
"tag": "NAME",
"value": "Yogen Rai"
}
] | null |
[] |
package cs544.exercise06_1;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
public class App {
private static final SessionFactory sessionFactory;
private static final ServiceRegistry serviceRegistry;
static {
Configuration configuration = new Configuration();
configuration.configure();
serviceRegistry = new StandardServiceRegistryBuilder().applySettings(
configuration.getProperties()).build();
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
}
public static void main(String[] args) {
// Hibernate placeholders
Session session = null;
Transaction tx = null;
try {
session = sessionFactory.openSession();
tx = session.beginTransaction();
Payment payment=new Payment("12/08/06",1200.0);
Patient patient=new Patient("<NAME>","1000N","Fairfield","52557");
Doctor doctor=new Doctor("Eye Doctor","Frank","Brown");
Appointment appointment=new Appointment("15/05/08",patient,payment,doctor);
session.persist(appointment);
tx.commit();
} catch (HibernateException e) {
if (tx != null) {
System.err.println("Rolling back: " + e.getMessage());
tx.rollback();
}
} finally {
if (session != null) {
session.close();
}
}
try {
session = sessionFactory.openSession();
tx = session.beginTransaction();
List<Appointment> appointments=session.createQuery("from Appointment").list();
for(Appointment appointment:appointments){
System.out.println(appointment);
}
tx.commit();
} catch (HibernateException e) {
if (tx != null) {
System.err.println("Rolling back: " + e.getMessage());
tx.rollback();
}
} finally {
if (session != null) {
session.close();
}
}
}
}
| 2,539
| 0.603068
| 0.59048
| 81
| 30.382715
| 23.341568
| 90
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.666667
| false
| false
|
2
|
bd61ddbbccf13512ada9bc43b480e97b80e404e5
| 29,875,792,541,332
|
f2c753bc0d39e437923d7076b7b8dea86d42ca51
|
/employlib/src/main/java/com/zhixing/employlib/model/grading/GradListDetailPostBean.java
|
8f20bdeebda54587aa3974ce86d34a83699e48ce
|
[] |
no_license
|
520ZH1314/ZhiXings
|
https://github.com/520ZH1314/ZhiXings
|
05608236d5a51b794fdd0026335dc7430e96ef8f
|
7f733b1677c512b893dcc019483912e480ac2c05
|
refs/heads/master
| 2020-07-28T19:20:38.590000
| 2019-08-23T01:57:28
| 2019-08-23T01:57:28
| 209,503,628
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.zhixing.employlib.model.grading;
public class GradListDetailPostBean {
public GradListDetailPostBean(String appCode, String apiCode, String tenantId, String startDate, String endDate, String userCode) {
AppCode = appCode;
ApiCode = apiCode;
TenantId = tenantId;
StartDate = startDate;
EndDate = endDate;
UserCode = userCode;
}
/**
* AppCode : EMS
* ApiCode : GetUserEventInfo
* TenantId : 00000000-0000-0000-0000-000000000001
* StartDate : 2019-03-27
* EndDate : 2019-03-27
* UserCode : 06153
*/
private String AppCode;
private String ApiCode;
private String TenantId;
private String StartDate;
private String EndDate;
private String UserCode;
public String getAppCode() {
return AppCode;
}
public void setAppCode(String AppCode) {
this.AppCode = AppCode;
}
public String getApiCode() {
return ApiCode;
}
public void setApiCode(String ApiCode) {
this.ApiCode = ApiCode;
}
public String getTenantId() {
return TenantId;
}
public void setTenantId(String TenantId) {
this.TenantId = TenantId;
}
public String getStartDate() {
return StartDate;
}
public void setStartDate(String StartDate) {
this.StartDate = StartDate;
}
public String getEndDate() {
return EndDate;
}
public void setEndDate(String EndDate) {
this.EndDate = EndDate;
}
public String getUserCode() {
return UserCode;
}
public void setUserCode(String UserCode) {
this.UserCode = UserCode;
}
}
|
UTF-8
|
Java
| 1,693
|
java
|
GradListDetailPostBean.java
|
Java
|
[] | null |
[] |
package com.zhixing.employlib.model.grading;
public class GradListDetailPostBean {
public GradListDetailPostBean(String appCode, String apiCode, String tenantId, String startDate, String endDate, String userCode) {
AppCode = appCode;
ApiCode = apiCode;
TenantId = tenantId;
StartDate = startDate;
EndDate = endDate;
UserCode = userCode;
}
/**
* AppCode : EMS
* ApiCode : GetUserEventInfo
* TenantId : 00000000-0000-0000-0000-000000000001
* StartDate : 2019-03-27
* EndDate : 2019-03-27
* UserCode : 06153
*/
private String AppCode;
private String ApiCode;
private String TenantId;
private String StartDate;
private String EndDate;
private String UserCode;
public String getAppCode() {
return AppCode;
}
public void setAppCode(String AppCode) {
this.AppCode = AppCode;
}
public String getApiCode() {
return ApiCode;
}
public void setApiCode(String ApiCode) {
this.ApiCode = ApiCode;
}
public String getTenantId() {
return TenantId;
}
public void setTenantId(String TenantId) {
this.TenantId = TenantId;
}
public String getStartDate() {
return StartDate;
}
public void setStartDate(String StartDate) {
this.StartDate = StartDate;
}
public String getEndDate() {
return EndDate;
}
public void setEndDate(String EndDate) {
this.EndDate = EndDate;
}
public String getUserCode() {
return UserCode;
}
public void setUserCode(String UserCode) {
this.UserCode = UserCode;
}
}
| 1,693
| 0.623154
| 0.591849
| 77
| 20.987013
| 20.39703
| 135
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.38961
| false
| false
|
2
|
0a7d1570c9328d2ce33ad4b28ba2ad54432c3765
| 33,904,471,851,902
|
26ebda9ba34d33738180fcc89c16921068fb8649
|
/Universal/src/main/java/me/fixeddev/ebcm/CommandAction.java
|
50ca743bb9846ba255b54407736f02d73ea00e1f
|
[
"MIT"
] |
permissive
|
FixedDev/EBCM
|
https://github.com/FixedDev/EBCM
|
44e9911f166e1ace20ff98d8658dceb09012c3d3
|
3a7cb69d68efdb2c7c9cc9873be7547f68d5878b
|
refs/heads/master
| 2020-09-28T10:31:40.013000
| 2020-05-30T00:20:37
| 2020-05-30T00:20:37
| 226,759,852
| 20
| 9
|
MIT
| false
| 2020-08-05T19:19:07
| 2019-12-09T01:30:56
| 2020-08-04T12:18:09
| 2020-08-05T19:19:07
| 350
| 14
| 3
| 0
|
Java
| false
| false
|
package me.fixeddev.ebcm;
import me.fixeddev.ebcm.exception.CommandException;
public interface CommandAction {
boolean execute(CommandContext parameters) throws CommandException;
}
|
UTF-8
|
Java
| 187
|
java
|
CommandAction.java
|
Java
|
[] | null |
[] |
package me.fixeddev.ebcm;
import me.fixeddev.ebcm.exception.CommandException;
public interface CommandAction {
boolean execute(CommandContext parameters) throws CommandException;
}
| 187
| 0.823529
| 0.823529
| 7
| 25.714285
| 25.81093
| 71
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.428571
| false
| false
|
2
|
4bb4b61a3434f6f2e0a490b80ebdbf823bf2ae1d
| 18,803,366,880,690
|
14fd887fe9247aef4e9f978291780578c4441ded
|
/dvasp-business/src/main/java/com/glsx/vasp/business/modules/order/model/StoreOrderModel.java
|
f2278346f82bb2a34d6fdcdddf6a5f007c715649
|
[] |
no_license
|
levphon/dvas-platform
|
https://github.com/levphon/dvas-platform
|
bb51fff885d043360b3fc71484784e0dad2ddbbc
|
d88b9bc652a49ae2f6434435d99f91b5aef05a00
|
refs/heads/master
| 2022-11-06T10:51:55.605000
| 2019-11-25T01:53:43
| 2019-11-25T01:53:43
| 223,840,794
| 0
| 0
| null | false
| 2022-10-12T20:34:20
| 2019-11-25T01:50:35
| 2019-11-25T02:00:42
| 2022-10-12T20:34:17
| 1,284
| 0
| 0
| 13
|
Java
| false
| false
|
package com.glsx.vasp.business.modules.order.model;
import com.glsx.vasp.business.modules.order.entity.StoreOrder;
import com.glsx.vasp.entity.BaseEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
/**
* 门店订单表
*
* @author liumh
* @date 2019-04-09 14:21:28
*/
public class StoreOrderModel extends StoreOrder {
private String picUrl;
public String getPicUrl() {
return picUrl;
}
public void setPicUrl(String picUrl) {
this.picUrl = picUrl;
}
}
|
UTF-8
|
Java
| 558
|
java
|
StoreOrderModel.java
|
Java
|
[
{
"context": "java.math.BigDecimal;\n\n/**\n * 门店订单表\n * \n * @author liumh\n * @date 2019-04-09 14:21:28\n */\npublic class Sto",
"end": 318,
"score": 0.9996362328529358,
"start": 313,
"tag": "USERNAME",
"value": "liumh"
}
] | null |
[] |
package com.glsx.vasp.business.modules.order.model;
import com.glsx.vasp.business.modules.order.entity.StoreOrder;
import com.glsx.vasp.entity.BaseEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
/**
* 门店订单表
*
* @author liumh
* @date 2019-04-09 14:21:28
*/
public class StoreOrderModel extends StoreOrder {
private String picUrl;
public String getPicUrl() {
return picUrl;
}
public void setPicUrl(String picUrl) {
this.picUrl = picUrl;
}
}
| 558
| 0.751825
| 0.726277
| 28
| 18.571428
| 18.233463
| 62
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.678571
| false
| false
|
2
|
41d9a958f664911a4e47626bc55c398750c89f12
| 34,144,990,025,590
|
6f2115375e2808ea577d4ff4b24983a003edc1f9
|
/src/com/oracle/jsp/dao/ProductPropertyDao.java
|
4369cdb372ae56e578a88ac2790426aebc165c06
|
[] |
no_license
|
2756299678/Eshop
|
https://github.com/2756299678/Eshop
|
a696feb79fb9e8eda4ba87ece1e7e5e3469e09a1
|
87d6d99f64e72e9ebeb33b06edf7d27922881a0d
|
refs/heads/master
| 2020-03-30T01:59:09.344000
| 2018-09-27T15:40:43
| 2018-09-27T15:40:43
| 150,606,012
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.oracle.jsp.dao;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import com.oracle.jsp.bean.ProductOptionBean;
import com.oracle.jsp.bean.ProductPropertyBean;
import com.oracle.jsp.bean.ProductTypeBean;
import com.oracle.jsp.util.DBUtil;
public class ProductPropertyDao {
/**
* 商品添加分类属性
* @author BaoHui
*
*/
public boolean add(ProductPropertyBean productPropertyBean)
{
String sql = "insert into product_type_property(name,product_type_id,sort,create_date) values ('"+productPropertyBean.getName()
+"','"+productPropertyBean.getProductTypeId()+"','"+productPropertyBean.getSort()+"',now())";
Connection conn = DBUtil.getConn();
Statement state = null;
boolean f =false;
int a = 0;
try{
state = conn.createStatement();
a=state.executeUpdate(sql);
}catch(Exception e)
{
e.printStackTrace();
}finally{
DBUtil.close(state, conn);
}
if(a>0)
{
f= true;
}
return f;
}
/**
* 通过分类获取所有属性
* @param typeId
* @return
* @param args
*/
public List<ProductPropertyBean> getListByType(int typeId){
String sql = "select * from product_type_property where product_type_id='"+typeId+"'";
List<ProductPropertyBean> list =new ArrayList<>();
Connection conn=DBUtil.getConn();
Statement state = null;
ResultSet rs =null;
try{
state =conn.createStatement();
rs =state.executeQuery(sql);
ProductPropertyBean productPropertyBean = null;
while(rs.next())
{
int id = rs.getInt("id");
String name = rs.getString("name");
int sort = rs.getInt("sort");
String createDate=rs.getString("create_date");
productPropertyBean = new ProductPropertyBean(id,sort,typeId,name,createDate);
list.add(productPropertyBean);
}
}catch(SQLException e)
{
e.printStackTrace();
}finally{
DBUtil.close(rs, state, conn);
}
return list;
}
/**
* 更新分类数据
* @param productTypeBean
* @return
*/
public boolean update(ProductPropertyBean productPropertyBean)
{
String sql= "update product_type_property set name='"+productPropertyBean.getName()+
"',sort='"+productPropertyBean.getSort()+"',product_type_id='"+productPropertyBean.getProductTypeId()+
"' where id='"+productPropertyBean.getId()+"'";
Connection conn = DBUtil.getConn();
Statement state = null;
boolean f =false;
int a = 0;
try{
state = conn.createStatement();
a=state.executeUpdate(sql);
}catch(Exception e)
{
e.printStackTrace();
}finally{
DBUtil.close(state, conn);
}
if(a>0)
{
f= true;
}
return f;
}
/**
* 通过id得到分类的类型
* @param id
* @return
*/
public ProductPropertyBean getPropertyById(int propertyId){
String sql="select * from product_type_property where id='"+propertyId+"'";
Connection conn = DBUtil.getConn();
Statement state = null;
ResultSet rs = null;
ProductPropertyBean productPropertyBean =null;
try{
state =conn.createStatement();
rs =state.executeQuery(sql);
while(rs.next())
{
int id = rs.getInt("id");
int productTypeId = rs.getInt("product_type_id");
String name=rs.getString("name");
int sort = rs.getInt("sort");
String createDate=rs.getString("create_date");
productPropertyBean = new ProductPropertyBean(id,sort,productTypeId,name,createDate);
}
}catch(Exception e)
{
e.printStackTrace();
}finally{
DBUtil.close(state, conn);
}
return productPropertyBean;
}
/**
* 删除商品类型
* @param id
* @return
*/
public boolean delete(int id){
boolean f=true;
//删除属性下的额选项
ProductOptionDao productOptionDao=new ProductOptionDao();
List<ProductOptionBean>optionBeans=productOptionDao.getOptionByProperty(id);
for(ProductOptionBean optionBean:optionBeans){
boolean r1 = productOptionDao.delete(optionBean.getId());
if(!r1){
f=false;
}
}
String sql="delete from product_type_property where id='"+id+"'";
Connection conn = DBUtil.getConn();
Statement state = null;
int a = 0;
try{
state = conn.createStatement();
a=state.executeUpdate(sql);
}catch(Exception e)
{
e.printStackTrace();
}finally{
DBUtil.close(state, conn);
}
if(a>0)
{
f= true;
}
return f;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
|
GB18030
|
Java
| 4,619
|
java
|
ProductPropertyDao.java
|
Java
|
[
{
"context": "ductPropertyDao {\r\n\t/**\r\n\t * 商品添加分类属性\r\n\t * @author BaoHui\r\n\t *\r\n\t */\r\n\tpublic boolean add(ProductPrope",
"end": 449,
"score": 0.8505690693855286,
"start": 448,
"tag": "NAME",
"value": "B"
},
{
"context": "ctPropertyDao {\r\n\t/**\r\n\t * 商品添加分类属性\r\n\t * @author BaoHui\r\n\t *\r\n\t */\r\n\tpublic boolean add(ProductProperty",
"end": 452,
"score": 0.5493261218070984,
"start": 449,
"tag": "USERNAME",
"value": "aoH"
},
{
"context": "ropertyDao {\r\n\t/**\r\n\t * 商品添加分类属性\r\n\t * @author BaoHui\r\n\t *\r\n\t */\r\n\tpublic boolean add(ProductPropertyBe",
"end": 454,
"score": 0.6570864915847778,
"start": 452,
"tag": "NAME",
"value": "ui"
}
] | null |
[] |
package com.oracle.jsp.dao;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import com.oracle.jsp.bean.ProductOptionBean;
import com.oracle.jsp.bean.ProductPropertyBean;
import com.oracle.jsp.bean.ProductTypeBean;
import com.oracle.jsp.util.DBUtil;
public class ProductPropertyDao {
/**
* 商品添加分类属性
* @author BaoHui
*
*/
public boolean add(ProductPropertyBean productPropertyBean)
{
String sql = "insert into product_type_property(name,product_type_id,sort,create_date) values ('"+productPropertyBean.getName()
+"','"+productPropertyBean.getProductTypeId()+"','"+productPropertyBean.getSort()+"',now())";
Connection conn = DBUtil.getConn();
Statement state = null;
boolean f =false;
int a = 0;
try{
state = conn.createStatement();
a=state.executeUpdate(sql);
}catch(Exception e)
{
e.printStackTrace();
}finally{
DBUtil.close(state, conn);
}
if(a>0)
{
f= true;
}
return f;
}
/**
* 通过分类获取所有属性
* @param typeId
* @return
* @param args
*/
public List<ProductPropertyBean> getListByType(int typeId){
String sql = "select * from product_type_property where product_type_id='"+typeId+"'";
List<ProductPropertyBean> list =new ArrayList<>();
Connection conn=DBUtil.getConn();
Statement state = null;
ResultSet rs =null;
try{
state =conn.createStatement();
rs =state.executeQuery(sql);
ProductPropertyBean productPropertyBean = null;
while(rs.next())
{
int id = rs.getInt("id");
String name = rs.getString("name");
int sort = rs.getInt("sort");
String createDate=rs.getString("create_date");
productPropertyBean = new ProductPropertyBean(id,sort,typeId,name,createDate);
list.add(productPropertyBean);
}
}catch(SQLException e)
{
e.printStackTrace();
}finally{
DBUtil.close(rs, state, conn);
}
return list;
}
/**
* 更新分类数据
* @param productTypeBean
* @return
*/
public boolean update(ProductPropertyBean productPropertyBean)
{
String sql= "update product_type_property set name='"+productPropertyBean.getName()+
"',sort='"+productPropertyBean.getSort()+"',product_type_id='"+productPropertyBean.getProductTypeId()+
"' where id='"+productPropertyBean.getId()+"'";
Connection conn = DBUtil.getConn();
Statement state = null;
boolean f =false;
int a = 0;
try{
state = conn.createStatement();
a=state.executeUpdate(sql);
}catch(Exception e)
{
e.printStackTrace();
}finally{
DBUtil.close(state, conn);
}
if(a>0)
{
f= true;
}
return f;
}
/**
* 通过id得到分类的类型
* @param id
* @return
*/
public ProductPropertyBean getPropertyById(int propertyId){
String sql="select * from product_type_property where id='"+propertyId+"'";
Connection conn = DBUtil.getConn();
Statement state = null;
ResultSet rs = null;
ProductPropertyBean productPropertyBean =null;
try{
state =conn.createStatement();
rs =state.executeQuery(sql);
while(rs.next())
{
int id = rs.getInt("id");
int productTypeId = rs.getInt("product_type_id");
String name=rs.getString("name");
int sort = rs.getInt("sort");
String createDate=rs.getString("create_date");
productPropertyBean = new ProductPropertyBean(id,sort,productTypeId,name,createDate);
}
}catch(Exception e)
{
e.printStackTrace();
}finally{
DBUtil.close(state, conn);
}
return productPropertyBean;
}
/**
* 删除商品类型
* @param id
* @return
*/
public boolean delete(int id){
boolean f=true;
//删除属性下的额选项
ProductOptionDao productOptionDao=new ProductOptionDao();
List<ProductOptionBean>optionBeans=productOptionDao.getOptionByProperty(id);
for(ProductOptionBean optionBean:optionBeans){
boolean r1 = productOptionDao.delete(optionBean.getId());
if(!r1){
f=false;
}
}
String sql="delete from product_type_property where id='"+id+"'";
Connection conn = DBUtil.getConn();
Statement state = null;
int a = 0;
try{
state = conn.createStatement();
a=state.executeUpdate(sql);
}catch(Exception e)
{
e.printStackTrace();
}finally{
DBUtil.close(state, conn);
}
if(a>0)
{
f= true;
}
return f;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
| 4,619
| 0.654212
| 0.652443
| 180
| 23.127777
| 22.845381
| 129
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 2.5
| false
| false
|
2
|
f4c8636591d466f0cd4d194fd6619b21469f9cae
| 36,644,660,969,962
|
df4d9f7ebdd0cdd85a4f9b22728979ce2d44104e
|
/targil4/src/java/controller/checking_detaild_student.java
|
52c098d2865b96a8265db7b126232ef2c59e1489
|
[] |
no_license
|
MaayanGrin/Library-system-Web
|
https://github.com/MaayanGrin/Library-system-Web
|
5f9447f4b89b522834479833387945d26d0268e6
|
c18e7abc50864718aa5fbd65f9a9fedfef40c994
|
refs/heads/master
| 2020-04-08T11:43:27.731000
| 2018-11-27T10:28:52
| 2018-11-27T10:28:52
| 159,317,280
| 1
| 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 controller;
import DB.dbclass;
import java.io.IOException;
import java.io.PrintWriter;
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 mod.helper;
import mod.student;
/**
*
* @author Maayan
*/
@WebServlet(name = "checking_detaild_student", urlPatterns = {"/checking_detaild_student"})
public class checking_detaild_student extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
helper h=new helper();
try {
String firstname=request.getParameter("firstname");
String lastname=request.getParameter("lastname");
String email=request.getParameter("email");
String id=request.getParameter("id");
String error="";
String nextpage="";
if (h.isNullOrEmpty(firstname)) {
error += "First name is empty.<br/>";
}
if (h.isNullOrEmpty(lastname)) {
error += "Last name is empty.<br/>";
}
if (h.isNullOrEmpty(id)|id.length()!=9) {
error += " id is empty or illegal.<br/>";
}
if (h.isNullOrEmpty(email)) {
error += "mail is empty.<br/>";
}
if(!error.equals("")) {
nextpage="/erroradd.jsp" ;
request.getSession().setAttribute("err",error);
request.getSession().setAttribute("pri","AddStudent.jsp");
request.getRequestDispatcher(nextpage).forward(request, response);
return;
}
DB.dbclass db=new dbclass();
if(db.isExistsstudent(id)==true){
nextpage="/erroradd.jsp" ;
String err="the student already in the system";
request.getSession().setAttribute("pri","AddStudent.jsp");
request.getSession().setAttribute("err",err);
request.getRequestDispatcher(nextpage).forward(request, response);
}
else{
db=new dbclass();
student temp=new student();
temp.setFirstname(firstname);
temp.setLastname(lastname);
temp.setEmail(email);
temp.setId(id);
temp.setPenalty(0);
int c=db.setstudent(temp);
if(c==0){
nextpage="/erroradd.jsp" ;
String err="The details were not received. Please try again";
request.getSession().setAttribute("err",err);
request.getSession().setAttribute("pri","AddStudent.jsp");
request.getRequestDispatcher(nextpage).forward(request, response);
}
nextpage="/ssuccess.jsp";
String success="Details successfully added";
request.getSession().setAttribute("success",success);
request.getRequestDispatcher(nextpage).forward(request, response);
}
}
catch(Exception e){
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
|
UTF-8
|
Java
| 5,263
|
java
|
checking_detaild_student.java
|
Java
|
[
{
"context": "elper;\r\nimport mod.student;\r\n\r\n/**\r\n *\r\n * @author Maayan\r\n */\r\n@WebServlet(name = \"checking_detaild_studen",
"end": 580,
"score": 0.9596843123435974,
"start": 574,
"tag": "NAME",
"value": "Maayan"
}
] | 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 controller;
import DB.dbclass;
import java.io.IOException;
import java.io.PrintWriter;
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 mod.helper;
import mod.student;
/**
*
* @author Maayan
*/
@WebServlet(name = "checking_detaild_student", urlPatterns = {"/checking_detaild_student"})
public class checking_detaild_student extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
helper h=new helper();
try {
String firstname=request.getParameter("firstname");
String lastname=request.getParameter("lastname");
String email=request.getParameter("email");
String id=request.getParameter("id");
String error="";
String nextpage="";
if (h.isNullOrEmpty(firstname)) {
error += "First name is empty.<br/>";
}
if (h.isNullOrEmpty(lastname)) {
error += "Last name is empty.<br/>";
}
if (h.isNullOrEmpty(id)|id.length()!=9) {
error += " id is empty or illegal.<br/>";
}
if (h.isNullOrEmpty(email)) {
error += "mail is empty.<br/>";
}
if(!error.equals("")) {
nextpage="/erroradd.jsp" ;
request.getSession().setAttribute("err",error);
request.getSession().setAttribute("pri","AddStudent.jsp");
request.getRequestDispatcher(nextpage).forward(request, response);
return;
}
DB.dbclass db=new dbclass();
if(db.isExistsstudent(id)==true){
nextpage="/erroradd.jsp" ;
String err="the student already in the system";
request.getSession().setAttribute("pri","AddStudent.jsp");
request.getSession().setAttribute("err",err);
request.getRequestDispatcher(nextpage).forward(request, response);
}
else{
db=new dbclass();
student temp=new student();
temp.setFirstname(firstname);
temp.setLastname(lastname);
temp.setEmail(email);
temp.setId(id);
temp.setPenalty(0);
int c=db.setstudent(temp);
if(c==0){
nextpage="/erroradd.jsp" ;
String err="The details were not received. Please try again";
request.getSession().setAttribute("err",err);
request.getSession().setAttribute("pri","AddStudent.jsp");
request.getRequestDispatcher(nextpage).forward(request, response);
}
nextpage="/ssuccess.jsp";
String success="Details successfully added";
request.getSession().setAttribute("success",success);
request.getRequestDispatcher(nextpage).forward(request, response);
}
}
catch(Exception e){
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| 5,263
| 0.587308
| 0.586548
| 141
| 35.326241
| 25.49913
| 123
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.560284
| false
| false
|
2
|
067e132f428029f1f7c2f09665699b049773ca86
| 34,041,910,814,948
|
cb9588183c36626a655fd49c9708ddd5a757a963
|
/core/src/main/java/com/capgemini/lionsii/aeat/ssii/fact/ws/suministrolr/SuministroLRFacturasRecibidas.java
|
c44e9db889f66b61fef05e4c415b1f467291a65a
|
[] |
no_license
|
jajimene/lionsiito
|
https://github.com/jajimene/lionsiito
|
ba806da8ec0ff27942606c88a5195126d621cc36
|
d953b4389c279262cc485db7e49a6f487ef2a9c9
|
refs/heads/master
| 2021-03-19T07:19:05.225000
| 2017-06-14T23:36:51
| 2017-06-14T23:36:51
| 94,380,855
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.capgemini.lionsii.aeat.ssii.fact.ws.suministrolr;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.capgemini.lionsii.aeat.ssii.fact.ws.suministroinformacion.SuministroInformacion;
/**
* <p>Clase Java para anonymous complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* <complexType>
* <complexContent>
* <extension base="{https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/fact/ws/SuministroInformacion.xsd}SuministroInformacion">
* <sequence>
* <element name="RegistroLRFacturasRecibidas" type="{https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/fact/ws/SuministroLR.xsd}LRFacturasRecibidasType" maxOccurs="10000"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"registroLRFacturasRecibidas"
})
@XmlRootElement(name = "SuministroLRFacturasRecibidas")
public class SuministroLRFacturasRecibidas
extends SuministroInformacion
{
@XmlElement(name = "RegistroLRFacturasRecibidas", required = true)
protected List<LRFacturasRecibidasType> registroLRFacturasRecibidas;
/**
* Gets the value of the registroLRFacturasRecibidas property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the registroLRFacturasRecibidas property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getRegistroLRFacturasRecibidas().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link LRFacturasRecibidasType }
*
*
*/
public List<LRFacturasRecibidasType> getRegistroLRFacturasRecibidas() {
if (registroLRFacturasRecibidas == null) {
registroLRFacturasRecibidas = new ArrayList<LRFacturasRecibidasType>();
}
return this.registroLRFacturasRecibidas;
}
}
|
UTF-8
|
Java
| 2,584
|
java
|
SuministroLRFacturasRecibidas.java
|
Java
|
[] | null |
[] |
package com.capgemini.lionsii.aeat.ssii.fact.ws.suministrolr;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.capgemini.lionsii.aeat.ssii.fact.ws.suministroinformacion.SuministroInformacion;
/**
* <p>Clase Java para anonymous complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* <complexType>
* <complexContent>
* <extension base="{https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/fact/ws/SuministroInformacion.xsd}SuministroInformacion">
* <sequence>
* <element name="RegistroLRFacturasRecibidas" type="{https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/fact/ws/SuministroLR.xsd}LRFacturasRecibidasType" maxOccurs="10000"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"registroLRFacturasRecibidas"
})
@XmlRootElement(name = "SuministroLRFacturasRecibidas")
public class SuministroLRFacturasRecibidas
extends SuministroInformacion
{
@XmlElement(name = "RegistroLRFacturasRecibidas", required = true)
protected List<LRFacturasRecibidasType> registroLRFacturasRecibidas;
/**
* Gets the value of the registroLRFacturasRecibidas property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the registroLRFacturasRecibidas property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getRegistroLRFacturasRecibidas().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link LRFacturasRecibidasType }
*
*
*/
public List<LRFacturasRecibidasType> getRegistroLRFacturasRecibidas() {
if (registroLRFacturasRecibidas == null) {
registroLRFacturasRecibidas = new ArrayList<LRFacturasRecibidasType>();
}
return this.registroLRFacturasRecibidas;
}
}
| 2,584
| 0.713235
| 0.710526
| 74
| 33.905407
| 39.837566
| 231
| false
| false
| 0
| 0
| 0
| 0
| 81
| 0.059211
| 0.364865
| false
| false
|
2
|
28b00b281129d3b9e844f5ec0b1e928d046463f8
| 16,260,746,226,989
|
7ed3c733f0ded2da14a81eedfa3c989a17bef92a
|
/src/com/yrazlik/designpatterns/b_observerpattern/interfaces/Observer.java
|
921b05beee0b0640a72614b406816d893583a0e8
|
[] |
no_license
|
yrazlik/DesignPatterns
|
https://github.com/yrazlik/DesignPatterns
|
e33dc322eb3f3f1e98d3408ff15252b5a0ce8576
|
0be1c4d492a0e4289faa16966e85040808ca7cfd
|
refs/heads/master
| 2021-01-13T17:06:59.829000
| 2017-05-12T05:58:21
| 2017-05-12T05:58:21
| 69,995,484
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.yrazlik.designpatterns.b_observerpattern.interfaces;
/**
* Created by yrazlik on 06/10/16.
*/
public interface Observer {
void unsubscribe();
void update(float temp, float humidity, float pressure);
}
|
UTF-8
|
Java
| 224
|
java
|
Observer.java
|
Java
|
[
{
"context": "s.b_observerpattern.interfaces;\n\n/**\n * Created by yrazlik on 06/10/16.\n */\npublic interface Observer {\n ",
"end": 91,
"score": 0.9996590614318848,
"start": 84,
"tag": "USERNAME",
"value": "yrazlik"
}
] | null |
[] |
package com.yrazlik.designpatterns.b_observerpattern.interfaces;
/**
* Created by yrazlik on 06/10/16.
*/
public interface Observer {
void unsubscribe();
void update(float temp, float humidity, float pressure);
}
| 224
| 0.732143
| 0.705357
| 9
| 23.888889
| 23.553459
| 64
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.555556
| false
| false
|
2
|
4c20060481f3a41f2c82d4a4a0f0d5cf78d4cd36
| 33,002,528,741,960
|
db104952aa86c0ac8ec21d3f208992b54ef16d6b
|
/GSTESTE/src/Gerador.java
|
93843895448fcf545f4ffd173238a4295bb438b2
|
[
"MIT"
] |
permissive
|
BlackPhillip63/Sistema-de-voo-AED
|
https://github.com/BlackPhillip63/Sistema-de-voo-AED
|
a2da024b6a763a362a02dd893785c6984f1f1553
|
080ef2b276167d81307ba852b4ef6ff4c9c8b5a8
|
refs/heads/master
| 2020-09-16T04:20:34.889000
| 2019-12-12T07:15:38
| 2019-12-12T07:15:38
| 223,651,209
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
import org.graphstream.algorithm.generator.Generator;
import org.graphstream.graph.Node;
import org.graphstream.stream.SourceBase;
public class Gerador extends SourceBase implements Generator {
int currentIndex = 0;
int edgeId = 0;
public void begin() {
addNode();
}
public boolean nextEvents() {
addNode();
return true;
}
public void end() {
// Nothing to do
}
protected void addNode() {
sendNodeAdded(sourceId, Integer.toString(currentIndex));
for(int i = 0; i < currentIndex; i++)
sendEdgeAdded(sourceId, Integer.toString(edgeId++),
Integer.toString(i), Integer.toString(currentIndex), false);
currentIndex++;
}
}
|
UTF-8
|
Java
| 802
|
java
|
Gerador.java
|
Java
|
[] | null |
[] |
import org.graphstream.algorithm.generator.Generator;
import org.graphstream.graph.Node;
import org.graphstream.stream.SourceBase;
public class Gerador extends SourceBase implements Generator {
int currentIndex = 0;
int edgeId = 0;
public void begin() {
addNode();
}
public boolean nextEvents() {
addNode();
return true;
}
public void end() {
// Nothing to do
}
protected void addNode() {
sendNodeAdded(sourceId, Integer.toString(currentIndex));
for(int i = 0; i < currentIndex; i++)
sendEdgeAdded(sourceId, Integer.toString(edgeId++),
Integer.toString(i), Integer.toString(currentIndex), false);
currentIndex++;
}
}
| 802
| 0.586035
| 0.582294
| 37
| 19.675676
| 21.342831
| 76
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.540541
| false
| false
|
2
|
74080f8439fbe3686e9b93f2253c4dee23f2ac35
| 35,416,300,334,879
|
5f52c3ce557cd9570c536009df9a8720ce89cd2d
|
/src/by/htp/aggregationAndComposition/task2/TestCar.java
|
f63325005606c29985aa68391e9e3eecbbd8e232
|
[] |
no_license
|
zheka-kudr/HomeTask_Java_AggregationAndComposition
|
https://github.com/zheka-kudr/HomeTask_Java_AggregationAndComposition
|
80194896d45ece74dc6ed30f5942b343b42fe5b5
|
ab9dba593c719dbc403bb75cfe25ef8874a46644
|
refs/heads/master
| 2020-06-02T14:33:03.592000
| 2019-06-10T15:01:47
| 2019-06-10T15:01:47
| 191,189,808
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package by.htp.aggregationAndComposition.task2;
import java.util.ArrayList;
public class TestCar {
public static void main(String[] args) {
ArrayList<Wheel> wheels = new ArrayList<>();
Wheel wheel1 = new Wheel(14);
Wheel wheel2 = new Wheel(14);
Wheel wheel3 = new Wheel(14);
Wheel wheel4 = new Wheel(14);
wheels.add(wheel1);
wheels.add(wheel2);
wheels.add(wheel3);
wheels.add(wheel4);
Engine engine = new Engine(250, 120, 80000);
Car car = new Car("Geely", 10, engine, wheels);
System.out.println(car.getModel());
System.out.println(car.getInTank());
car.fillUp(15);
System.out.println(car.getInTank());
car.drive();
System.out.println(car.isMove());
Wheel wheel = new Wheel(15);
car.changeWheel(wheel, 3);
car.stop();
car.changeWheel(wheel, 2);
System.out.println(car.getWheels());
System.out.println(car.getEngine());
System.out.println(car);
}
}
|
UTF-8
|
Java
| 1,056
|
java
|
TestCar.java
|
Java
|
[
{
"context": "ine(250, 120, 80000);\n\n Car car = new Car(\"Geely\", 10, engine, wheels);\n\n System.out.printl",
"end": 550,
"score": 0.9997625350952148,
"start": 545,
"tag": "NAME",
"value": "Geely"
}
] | null |
[] |
package by.htp.aggregationAndComposition.task2;
import java.util.ArrayList;
public class TestCar {
public static void main(String[] args) {
ArrayList<Wheel> wheels = new ArrayList<>();
Wheel wheel1 = new Wheel(14);
Wheel wheel2 = new Wheel(14);
Wheel wheel3 = new Wheel(14);
Wheel wheel4 = new Wheel(14);
wheels.add(wheel1);
wheels.add(wheel2);
wheels.add(wheel3);
wheels.add(wheel4);
Engine engine = new Engine(250, 120, 80000);
Car car = new Car("Geely", 10, engine, wheels);
System.out.println(car.getModel());
System.out.println(car.getInTank());
car.fillUp(15);
System.out.println(car.getInTank());
car.drive();
System.out.println(car.isMove());
Wheel wheel = new Wheel(15);
car.changeWheel(wheel, 3);
car.stop();
car.changeWheel(wheel, 2);
System.out.println(car.getWheels());
System.out.println(car.getEngine());
System.out.println(car);
}
}
| 1,056
| 0.588068
| 0.553977
| 37
| 27.540541
| 17.507673
| 55
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.891892
| false
| false
|
2
|
1816953a04e5551aed1f88fa981423a3698960cd
| 35,192,962,036,407
|
17a4d19f5550ef1a12a5d2e4b61f4d8d2463d674
|
/src/main/java/com/bairei/crudespringmvccrud/controllers/RegisterController.java
|
539ce33f79eb59028d481c09321e3d420440a4d7
|
[] |
no_license
|
Bairei/crudespringmvccrud
|
https://github.com/Bairei/crudespringmvccrud
|
7563437a8fff10d6d1a1b0a877e628cdff8216f1
|
509271e14aec07689280e21c6c2bb0393e88c47b
|
refs/heads/master
| 2021-01-23T08:29:13.653000
| 2018-05-06T19:57:37
| 2018-05-06T19:57:37
| 101,222,897
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.bairei.crudespringmvccrud.controllers;
import com.bairei.crudespringmvccrud.domain.User;
import com.bairei.crudespringmvccrud.services.LoginService;
import com.bairei.crudespringmvccrud.services.RoleService;
import com.bairei.crudespringmvccrud.services.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class RegisterController {
private UserService userService;
private RoleService roleService;
private LoginService loginService;
@Autowired
public RegisterController(UserService userService, RoleService roleService,
LoginService loginService) {
this.userService = userService;
this.roleService = roleService;
this.loginService = loginService;
}
@RequestMapping(value = "/register", method = RequestMethod.GET)
public String userForm(Model model){
model.addAttribute("user", new User());
return "userform";
}
@RequestMapping(value = "/register", method = RequestMethod.POST)
public String saveUser(@ModelAttribute @Validated User user, BindingResult result){
if (result.hasErrors()){
return "userform";
}
if (user.getSecret().equals("superacc")){
user.setRoles(roleService.createAdminRole());
} else user.setRoles(roleService.createUserRole());
String plain = user.getPassword();
try {
userService.save(user);
} catch (Exception e) {
return "userform";
}
loginService.autoLogin(user.getEmail(),plain);
return "redirect:/";
}
}
|
UTF-8
|
Java
| 2,029
|
java
|
RegisterController.java
|
Java
|
[] | null |
[] |
package com.bairei.crudespringmvccrud.controllers;
import com.bairei.crudespringmvccrud.domain.User;
import com.bairei.crudespringmvccrud.services.LoginService;
import com.bairei.crudespringmvccrud.services.RoleService;
import com.bairei.crudespringmvccrud.services.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class RegisterController {
private UserService userService;
private RoleService roleService;
private LoginService loginService;
@Autowired
public RegisterController(UserService userService, RoleService roleService,
LoginService loginService) {
this.userService = userService;
this.roleService = roleService;
this.loginService = loginService;
}
@RequestMapping(value = "/register", method = RequestMethod.GET)
public String userForm(Model model){
model.addAttribute("user", new User());
return "userform";
}
@RequestMapping(value = "/register", method = RequestMethod.POST)
public String saveUser(@ModelAttribute @Validated User user, BindingResult result){
if (result.hasErrors()){
return "userform";
}
if (user.getSecret().equals("superacc")){
user.setRoles(roleService.createAdminRole());
} else user.setRoles(roleService.createUserRole());
String plain = user.getPassword();
try {
userService.save(user);
} catch (Exception e) {
return "userform";
}
loginService.autoLogin(user.getEmail(),plain);
return "redirect:/";
}
}
| 2,029
| 0.718088
| 0.718088
| 57
| 34.596493
| 24.149286
| 87
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.631579
| false
| false
|
2
|
ec097427c668b405374527ccc77d350dc531f663
| 36,172,214,589,164
|
3f07c6c593bf8191f07e478762b81057937035eb
|
/jt_server/common-core/src/main/java/com/junteng/commoncore/service/holiday/entity/Holidays.java
|
76f637b9b928483da6ef5cf07fafed13f8c69ea9
|
[] |
no_license
|
wxf52977/mtytest
|
https://github.com/wxf52977/mtytest
|
b44bb858d142e21d449ccb2be4fad27d6428cba2
|
aafcfcd98734e603f78b1201754f8eb6e496bf34
|
refs/heads/master
| 2020-06-27T17:43:48.224000
| 2020-05-22T16:19:14
| 2020-05-22T16:19:14
| 200,009,595
| 2
| 0
| null | false
| 2020-07-02T03:23:00
| 2019-08-01T08:25:53
| 2020-05-22T16:19:31
| 2020-07-02T03:22:58
| 8,022
| 1
| 0
| 1
|
Java
| false
| false
|
package com.junteng.commoncore.service.holiday.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 基础服务-节假日表:存储节假日信息,供门店选择团单可用时间
* </p>
*
* @author Administrator
* @since 2019-06-26
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("base_holidays")
@ApiModel(value = "基础服务-节假日表:存储节假日信息,供门店选择团单可用时间")
public class Holidays extends Model<Holidays> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "节假日id")
@TableId(type = IdType.ID_WORKER)
@JsonSerialize(using = ToStringSerializer.class)
private Long holidayId;
@ApiModelProperty(value = "节假日名称")
@TableField("holiday_name")
private String holidayName;
@ApiModelProperty(value = "创建时间")
@TableField("create_time")
private Date createTime;
@ApiModelProperty(value = "更新时间")
@TableField("update_time")
private Date updateTime;
@ApiModelProperty(value = "是否删除 1-是 2-否")
@TableField("is_deleted")
private Integer isDeleted;
@Override
protected Serializable pkVal() {
return this.holidayId;
}
}
|
UTF-8
|
Java
| 1,790
|
java
|
Holidays.java
|
Java
|
[
{
"context": "础服务-节假日表:存储节假日信息,供门店选择团单可用时间\n * </p>\n *\n * @author Administrator\n * @since 2019-06-26\n */\n@Data\n@EqualsAndHashCode",
"end": 722,
"score": 0.5045156478881836,
"start": 709,
"tag": "USERNAME",
"value": "Administrator"
}
] | null |
[] |
package com.junteng.commoncore.service.holiday.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 基础服务-节假日表:存储节假日信息,供门店选择团单可用时间
* </p>
*
* @author Administrator
* @since 2019-06-26
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("base_holidays")
@ApiModel(value = "基础服务-节假日表:存储节假日信息,供门店选择团单可用时间")
public class Holidays extends Model<Holidays> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "节假日id")
@TableId(type = IdType.ID_WORKER)
@JsonSerialize(using = ToStringSerializer.class)
private Long holidayId;
@ApiModelProperty(value = "节假日名称")
@TableField("holiday_name")
private String holidayName;
@ApiModelProperty(value = "创建时间")
@TableField("create_time")
private Date createTime;
@ApiModelProperty(value = "更新时间")
@TableField("update_time")
private Date updateTime;
@ApiModelProperty(value = "是否删除 1-是 2-否")
@TableField("is_deleted")
private Integer isDeleted;
@Override
protected Serializable pkVal() {
return this.holidayId;
}
}
| 1,790
| 0.747858
| 0.741126
| 62
| 25.370968
| 19.79755
| 65
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.33871
| false
| false
|
2
|
86eda74e8cb196a5893aa371400229f4612769e8
| 33,809,982,583,508
|
7333142ea43d37f94fc809aea092451541605af2
|
/Server_Springboot/src/main/java/com/ssafy/happyhouse/interceptor/ConfirmInterceptor.java
|
048d8e3a914f6f9dca7eef197a24f72d53f22f75
|
[] |
no_license
|
jjuyeon/HouseNote
|
https://github.com/jjuyeon/HouseNote
|
2980a7d317ffc06734ea790bfd609d68e738129a
|
6295751f3743a35b43881a9b84231a579f5a101e
|
refs/heads/main
| 2023-06-07T14:05:48.555000
| 2021-06-23T15:53:09
| 2021-06-23T15:53:09
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ssafy.happyhouse.interceptor;
import javax.servlet.http.*;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import com.ssafy.happyhouse.model.UserDto;
public class ConfirmInterceptor extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
HttpSession session = request.getSession();
UserDto memberDto = (UserDto) session.getAttribute("userinfo");
if(memberDto == null) {
response.sendRedirect(request.getContextPath());
return false;
}
return true;
}
}
|
UTF-8
|
Java
| 630
|
java
|
ConfirmInterceptor.java
|
Java
|
[] | null |
[] |
package com.ssafy.happyhouse.interceptor;
import javax.servlet.http.*;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import com.ssafy.happyhouse.model.UserDto;
public class ConfirmInterceptor extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
HttpSession session = request.getSession();
UserDto memberDto = (UserDto) session.getAttribute("userinfo");
if(memberDto == null) {
response.sendRedirect(request.getContextPath());
return false;
}
return true;
}
}
| 630
| 0.78254
| 0.78254
| 25
| 24.200001
| 28.065638
| 99
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.4
| false
| false
|
2
|
d69a340203fb2f89076c84c649108b41bae43383
| 28,759,101,076,284
|
6c62a650f675874c20253e2891692d1b1c5bd331
|
/web/src/main/java/org/opencord/olt/rest/OltWebResource.java
|
3c12365ec7b69b68556d956f6cf23724c69751eb
|
[] |
no_license
|
teone/onos-olt-app
|
https://github.com/teone/onos-olt-app
|
2c20adf65bc050bc14fa79dc1b0de67bd722f0bd
|
702ecfee05cb424c4fa79e8e4ea6b9568e3a9676
|
refs/heads/master
| 2023-07-28T06:36:52.288000
| 2021-09-13T18:04:02
| 2021-09-13T18:04:02
| 392,434,176
| 0
| 0
| null | false
| 2021-09-13T18:02:44
| 2021-08-03T19:36:28
| 2021-09-13T15:53:22
| 2021-09-13T18:02:08
| 972
| 0
| 0
| 1
|
Java
| false
| false
|
package org.opencord.olt.rest;
import org.onlab.packet.VlanId;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
import org.onosproject.net.PortNumber;
import org.onosproject.rest.AbstractWebResource;
import org.opencord.olt.OltService;
import org.slf4j.Logger;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.Optional;
import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
import static org.slf4j.LoggerFactory.getLogger;
/**
* OLT REST APIs.
*/
@Path("oltapp")
public class OltWebResource extends AbstractWebResource {
private final Logger log = getLogger(getClass());
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("status")
public Response status() {
return Response.ok().build();
}
/**
* Provision a subscriber.
*
* @param device device id
* @param port port number
* @return 200 OK or 500 Internal Server Error
*/
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("{device}/{port}")
public Response provisionSubscriber(
@PathParam("device") String device,
@PathParam("port") long port) {
OltService service = get(OltService.class);
DeviceId deviceId = DeviceId.deviceId(device);
PortNumber portNumber = PortNumber.portNumber(port);
ConnectPoint connectPoint = new ConnectPoint(deviceId, portNumber);
try {
service.provisionSubscriber(connectPoint);
} catch (Exception e) {
log.error("Can't provision subscriber {} due to exception", connectPoint, e);
return Response.status(INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
}
return ok("").build();
}
/**
* Remove the provisioning for a subscriber.
*
* @param device device id
* @param port port number
* @return 204 NO CONTENT
*/
@DELETE
@Path("{device}/{port}")
public Response removeSubscriber(
@PathParam("device")String device,
@PathParam("port")long port) {
OltService service = get(OltService.class);
DeviceId deviceId = DeviceId.deviceId(device);
PortNumber portNumber = PortNumber.portNumber(port);
ConnectPoint connectPoint = new ConnectPoint(deviceId, portNumber);
try {
service.removeSubscriber(connectPoint);
} catch (Exception e) {
log.error("Can't remove subscriber {} due to exception", connectPoint, e);
return Response.status(INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
}
return Response.noContent().build();
}
/**
* Provision service for a subscriber.
*
* @param portName Name of the port on which the subscriber is connected
* @return 200 OK or 204 NO CONTENT
*/
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("services/{portName}")
public Response provisionServices(
@PathParam("portName") String portName) {
OltService service = get(OltService.class);
Optional<VlanId> emptyVlan = Optional.empty();
Optional<Integer> emptyTpId = Optional.empty();
// Check if we can find the connect point to which this subscriber is connected
ConnectPoint cp = service.findSubscriberConnectPoint(portName);
if (cp == null) {
log.warn("ConnectPoint not found for {}", portName);
return Response.status(INTERNAL_SERVER_ERROR)
.entity("ConnectPoint not found for " + portName).build();
}
if (service.provisionSubscriber(cp)) {
return ok("").build();
}
return Response.noContent().build();
}
/**
* Removes services for a subscriber.
*
* @param portName Name of the port on which the subscriber is connected
* @return 200 OK or 204 NO CONTENT
*/
@DELETE
@Produces(MediaType.APPLICATION_JSON)
@Path("services/{portName}")
public Response deleteServices(
@PathParam("portName") String portName) {
OltService service = get(OltService.class);
ConnectPoint cp = service.findSubscriberConnectPoint(portName);
if (cp == null) {
log.warn("ConnectPoint not found for {}", portName);
return Response.status(INTERNAL_SERVER_ERROR)
.entity("ConnectPoint not found for " + portName).build();
}
if (service.removeSubscriber(cp)) {
return ok("").build();
}
return Response.noContent().build();
}
/**
* Provision service with particular tags for a subscriber.
*
* @param portName Name of the port on which the subscriber is connected
* @param sTagVal additional outer tag on this port
* @param cTagVal additional innter tag on this port
* @param tpIdVal technology profile id
* @return 200 OK or 204 NO CONTENT
*/
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path("services/{portName}/{sTag}/{cTag}/{tpId}")
public Response provisionAdditionalVlans(
@PathParam("portName") String portName,
@PathParam("sTag") String sTagVal,
@PathParam("cTag") String cTagVal,
@PathParam("tpId") String tpIdVal) {
OltService service = get(OltService.class);
VlanId cTag = VlanId.vlanId(cTagVal);
VlanId sTag = VlanId.vlanId(sTagVal);
Integer tpId = Integer.valueOf(tpIdVal);
ConnectPoint cp = service.findSubscriberConnectPoint(portName);
if (cp == null) {
log.warn("ConnectPoint not found for {}", portName);
return Response.status(INTERNAL_SERVER_ERROR)
.entity("ConnectPoint not found for " + portName).build();
}
//TODO create methods and pass elements
if (service.provisionSubscriber(cp, cTag, sTag, tpId)) {
return ok("").build();
}
return Response.noContent().build();
}
/**
* Removes additional vlans of a particular subscriber.
*
* @param portName Name of the port on which the subscriber is connected
* @param sTagVal additional outer tag on this port which needs to be removed
* @param cTagVal additional inner tag on this port which needs to be removed
* @param tpIdVal additional technology profile id
* @return 200 OK or 204 NO CONTENT
*/
@DELETE
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path("services/{portName}/{sTag}/{cTag}/{tpId}")
public Response removeAdditionalVlans(
@PathParam("portName") String portName,
@PathParam("sTag") String sTagVal,
@PathParam("cTag") String cTagVal,
@PathParam("tpId") String tpIdVal) {
OltService service = get(OltService.class);
VlanId cTag = VlanId.vlanId(cTagVal);
VlanId sTag = VlanId.vlanId(sTagVal);
Integer tpId = Integer.valueOf(tpIdVal);
ConnectPoint cp = service.findSubscriberConnectPoint(portName);
if (cp == null) {
log.warn("ConnectPoint not found for {}", portName);
return Response.status(INTERNAL_SERVER_ERROR)
.entity("ConnectPoint not found for " + portName).build();
}
if (service.removeSubscriber(cp, cTag, sTag, tpId)) {
return ok("").build();
}
return Response.noContent().build();
}
}
|
UTF-8
|
Java
| 7,740
|
java
|
OltWebResource.java
|
Java
|
[] | null |
[] |
package org.opencord.olt.rest;
import org.onlab.packet.VlanId;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
import org.onosproject.net.PortNumber;
import org.onosproject.rest.AbstractWebResource;
import org.opencord.olt.OltService;
import org.slf4j.Logger;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.Optional;
import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
import static org.slf4j.LoggerFactory.getLogger;
/**
* OLT REST APIs.
*/
@Path("oltapp")
public class OltWebResource extends AbstractWebResource {
private final Logger log = getLogger(getClass());
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("status")
public Response status() {
return Response.ok().build();
}
/**
* Provision a subscriber.
*
* @param device device id
* @param port port number
* @return 200 OK or 500 Internal Server Error
*/
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("{device}/{port}")
public Response provisionSubscriber(
@PathParam("device") String device,
@PathParam("port") long port) {
OltService service = get(OltService.class);
DeviceId deviceId = DeviceId.deviceId(device);
PortNumber portNumber = PortNumber.portNumber(port);
ConnectPoint connectPoint = new ConnectPoint(deviceId, portNumber);
try {
service.provisionSubscriber(connectPoint);
} catch (Exception e) {
log.error("Can't provision subscriber {} due to exception", connectPoint, e);
return Response.status(INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
}
return ok("").build();
}
/**
* Remove the provisioning for a subscriber.
*
* @param device device id
* @param port port number
* @return 204 NO CONTENT
*/
@DELETE
@Path("{device}/{port}")
public Response removeSubscriber(
@PathParam("device")String device,
@PathParam("port")long port) {
OltService service = get(OltService.class);
DeviceId deviceId = DeviceId.deviceId(device);
PortNumber portNumber = PortNumber.portNumber(port);
ConnectPoint connectPoint = new ConnectPoint(deviceId, portNumber);
try {
service.removeSubscriber(connectPoint);
} catch (Exception e) {
log.error("Can't remove subscriber {} due to exception", connectPoint, e);
return Response.status(INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
}
return Response.noContent().build();
}
/**
* Provision service for a subscriber.
*
* @param portName Name of the port on which the subscriber is connected
* @return 200 OK or 204 NO CONTENT
*/
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("services/{portName}")
public Response provisionServices(
@PathParam("portName") String portName) {
OltService service = get(OltService.class);
Optional<VlanId> emptyVlan = Optional.empty();
Optional<Integer> emptyTpId = Optional.empty();
// Check if we can find the connect point to which this subscriber is connected
ConnectPoint cp = service.findSubscriberConnectPoint(portName);
if (cp == null) {
log.warn("ConnectPoint not found for {}", portName);
return Response.status(INTERNAL_SERVER_ERROR)
.entity("ConnectPoint not found for " + portName).build();
}
if (service.provisionSubscriber(cp)) {
return ok("").build();
}
return Response.noContent().build();
}
/**
* Removes services for a subscriber.
*
* @param portName Name of the port on which the subscriber is connected
* @return 200 OK or 204 NO CONTENT
*/
@DELETE
@Produces(MediaType.APPLICATION_JSON)
@Path("services/{portName}")
public Response deleteServices(
@PathParam("portName") String portName) {
OltService service = get(OltService.class);
ConnectPoint cp = service.findSubscriberConnectPoint(portName);
if (cp == null) {
log.warn("ConnectPoint not found for {}", portName);
return Response.status(INTERNAL_SERVER_ERROR)
.entity("ConnectPoint not found for " + portName).build();
}
if (service.removeSubscriber(cp)) {
return ok("").build();
}
return Response.noContent().build();
}
/**
* Provision service with particular tags for a subscriber.
*
* @param portName Name of the port on which the subscriber is connected
* @param sTagVal additional outer tag on this port
* @param cTagVal additional innter tag on this port
* @param tpIdVal technology profile id
* @return 200 OK or 204 NO CONTENT
*/
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path("services/{portName}/{sTag}/{cTag}/{tpId}")
public Response provisionAdditionalVlans(
@PathParam("portName") String portName,
@PathParam("sTag") String sTagVal,
@PathParam("cTag") String cTagVal,
@PathParam("tpId") String tpIdVal) {
OltService service = get(OltService.class);
VlanId cTag = VlanId.vlanId(cTagVal);
VlanId sTag = VlanId.vlanId(sTagVal);
Integer tpId = Integer.valueOf(tpIdVal);
ConnectPoint cp = service.findSubscriberConnectPoint(portName);
if (cp == null) {
log.warn("ConnectPoint not found for {}", portName);
return Response.status(INTERNAL_SERVER_ERROR)
.entity("ConnectPoint not found for " + portName).build();
}
//TODO create methods and pass elements
if (service.provisionSubscriber(cp, cTag, sTag, tpId)) {
return ok("").build();
}
return Response.noContent().build();
}
/**
* Removes additional vlans of a particular subscriber.
*
* @param portName Name of the port on which the subscriber is connected
* @param sTagVal additional outer tag on this port which needs to be removed
* @param cTagVal additional inner tag on this port which needs to be removed
* @param tpIdVal additional technology profile id
* @return 200 OK or 204 NO CONTENT
*/
@DELETE
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path("services/{portName}/{sTag}/{cTag}/{tpId}")
public Response removeAdditionalVlans(
@PathParam("portName") String portName,
@PathParam("sTag") String sTagVal,
@PathParam("cTag") String cTagVal,
@PathParam("tpId") String tpIdVal) {
OltService service = get(OltService.class);
VlanId cTag = VlanId.vlanId(cTagVal);
VlanId sTag = VlanId.vlanId(sTagVal);
Integer tpId = Integer.valueOf(tpIdVal);
ConnectPoint cp = service.findSubscriberConnectPoint(portName);
if (cp == null) {
log.warn("ConnectPoint not found for {}", portName);
return Response.status(INTERNAL_SERVER_ERROR)
.entity("ConnectPoint not found for " + portName).build();
}
if (service.removeSubscriber(cp, cTag, sTag, tpId)) {
return ok("").build();
}
return Response.noContent().build();
}
}
| 7,740
| 0.634367
| 0.629845
| 214
| 35.168224
| 23.841372
| 89
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.439252
| false
| false
|
2
|
cb174b4c327164d7669ddd30fdb97eb7f9eaeb02
| 24,721,831,799,121
|
157f8c4acf9c1ce1868169187ae9e7e2d44982ed
|
/App/MyApplication/app/src/test/java/com/example/kylemiller/cardgame/BlackjackGameTest.java
|
7fdab9127ff1d46b6dfb27db2cbefb92a98f1fcc
|
[] |
no_license
|
Kylemiller995/AndroidCardGame
|
https://github.com/Kylemiller995/AndroidCardGame
|
a769c048e8d9900f0754b0785d6b4c4532d1a579
|
b320fedb4f2d5f6155bf878e3e8d2775764b202e
|
refs/heads/master
| 2021-08-30T20:30:13.812000
| 2017-12-19T10:01:22
| 2017-12-19T10:01:22
| 104,562,923
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.kylemiller.cardgame;
import org.junit.Before;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
/**
* Created by kylemiller on 25/09/2017.
*/
public class BlackjackGameTest {
BlackjackGame blackjack;
BlackjackDealer blackjackDealer;
Participant humanPlayer;
Participant computerPlayer;
@Before
public void setUp(){
blackjackDealer = new BlackjackDealer(1);
blackjack = new BlackjackGame(blackjackDealer);
humanPlayer = new Player("kyle");
computerPlayer = new ComputerPlayer();
}
@Test
public void getGameTable() {
assertEquals(blackjack.getGameTable().size(), 0);
}
@Test
public void canAddPlayer(){
blackjack.addPlayer(humanPlayer);
assertEquals(blackjack.getGameTable().size(), 1);
}
@Test
public void checkBlackjack() {
blackjackDealer.deal(humanPlayer);
blackjackDealer.deal(humanPlayer);
blackjackDealer.deal(humanPlayer);
blackjackDealer.deal(humanPlayer);
blackjackDealer.deal(humanPlayer);
blackjack.addPlayer(humanPlayer);
assertEquals(blackjack.checkBlackjack(), humanPlayer);
}
@Test
public void addPlayer() {
blackjack.addPlayer(humanPlayer);
assertEquals(blackjack.getGameTable().size(), 1);
}
@Test
public void getBlackjackDealer() {
assertEquals(blackjack.getBlackjackDealer(), blackjackDealer);
}
@Test
public void playTurn() {
blackjack.addPlayer(humanPlayer);
blackjack.addPlayer(computerPlayer);
blackjack.playTurn("twist");
blackjack.playTurn("twist");
assertEquals(humanPlayer.getHand().size(), 2);
}
@Test
public void dealerGetsCards() {
blackjack.addPlayer(humanPlayer);
blackjack.addPlayer(computerPlayer);
Card card1 = new Card(CardSuit.CLUBS,CardValue.FOUR);
Card card2 = new Card(CardSuit.CLUBS,CardValue.NINE);
computerPlayer.getHand().add(card1);
computerPlayer.getHand().add(card2);
blackjack.playTurn("stick");
assertEquals(blackjack.getGameTable().get(1).getHand().size(), 3 );
}
@Test
public void dealerTurnTest(){
blackjack.addPlayer(humanPlayer);
blackjack.addPlayer(computerPlayer);
Card card1 = new Card(CardSuit.CLUBS,CardValue.EIGHT);
Card card2 = new Card(CardSuit.CLUBS,CardValue.THREE);
computerPlayer.getHand().add(card1);
computerPlayer.getHand().add(card2);
blackjack.playTurn("stick");
assertEquals(blackjack.getGameTable().get(1).getHand().size(), 3);
}
@Test
public void sumHand() {
Card card1 = new Card(CardSuit.CLUBS,CardValue.EIGHT);
Card card2 = new Card(CardSuit.CLUBS,CardValue.EIGHT);
humanPlayer.getHand().add(card1);
humanPlayer.getHand().add(card2);
assertEquals(blackjack.sumHand(humanPlayer), 16);
}
@Test
public void getWinner() {
blackjack.addPlayer(humanPlayer);
blackjack.addPlayer(computerPlayer);
Card card1 = new Card(CardSuit.CLUBS,CardValue.EIGHT);
Card card2 = new Card(CardSuit.CLUBS,CardValue.THREE);
humanPlayer.getHand().add(card1);
humanPlayer.getHand().add(card2);
Card card3 = new Card(CardSuit.CLUBS,CardValue.FIVE);
Card card4 = new Card(CardSuit.CLUBS,CardValue.QUEEN);
computerPlayer.getHand().add(card3);
computerPlayer.getHand().add(card4);
assertEquals(blackjack.getWinner(), computerPlayer);
}
@Test
public void checkBust(){
blackjack.addPlayer(humanPlayer);
Card card1 = new Card(CardSuit.CLUBS,CardValue.EIGHT);
Card card2 = new Card(CardSuit.CLUBS,CardValue.EIGHT);
Card card3 = new Card(CardSuit.CLUBS,CardValue.EIGHT);
Card card4 = new Card(CardSuit.CLUBS,CardValue.THREE);
humanPlayer.getHand().add(card3);
humanPlayer.getHand().add(card4);
blackjack.checkBustAndBlackjack(humanPlayer);
}
@Test
public void checkSitDown(){
blackjack.sitDownAtTable(humanPlayer);
assertEquals(blackjack.getGameTable().size(), 2);
}
@Test
public void checkAceCheker(){
Card card1 = new Card(CardSuit.CLUBS,CardValue.ACE);
Card card2 = new Card(CardSuit.CLUBS,CardValue.ACE);
humanPlayer.addCard(card1);
humanPlayer.addCard(card2);
assertEquals(blackjack.sumHand(humanPlayer), 12);
}
}
|
UTF-8
|
Java
| 4,591
|
java
|
BlackjackGameTest.java
|
Java
|
[
{
"context": "package com.example.kylemiller.cardgame;\n\nimport org.junit.Before;\nimport org.ju",
"end": 30,
"score": 0.60495924949646,
"start": 20,
"tag": "USERNAME",
"value": "kylemiller"
},
{
"context": ".framework.Assert.assertEquals;\n\n/**\n * Created by kylemiller on 25/09/2017.\n */\npublic class BlackjackGameTest",
"end": 171,
"score": 0.9995701313018799,
"start": 161,
"tag": "USERNAME",
"value": "kylemiller"
},
{
"context": "ackjackDealer);\n humanPlayer = new Player(\"kyle\");\n computerPlayer = new ComputerPlayer();",
"end": 534,
"score": 0.9988454580307007,
"start": 530,
"tag": "USERNAME",
"value": "kyle"
}
] | null |
[] |
package com.example.kylemiller.cardgame;
import org.junit.Before;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
/**
* Created by kylemiller on 25/09/2017.
*/
public class BlackjackGameTest {
BlackjackGame blackjack;
BlackjackDealer blackjackDealer;
Participant humanPlayer;
Participant computerPlayer;
@Before
public void setUp(){
blackjackDealer = new BlackjackDealer(1);
blackjack = new BlackjackGame(blackjackDealer);
humanPlayer = new Player("kyle");
computerPlayer = new ComputerPlayer();
}
@Test
public void getGameTable() {
assertEquals(blackjack.getGameTable().size(), 0);
}
@Test
public void canAddPlayer(){
blackjack.addPlayer(humanPlayer);
assertEquals(blackjack.getGameTable().size(), 1);
}
@Test
public void checkBlackjack() {
blackjackDealer.deal(humanPlayer);
blackjackDealer.deal(humanPlayer);
blackjackDealer.deal(humanPlayer);
blackjackDealer.deal(humanPlayer);
blackjackDealer.deal(humanPlayer);
blackjack.addPlayer(humanPlayer);
assertEquals(blackjack.checkBlackjack(), humanPlayer);
}
@Test
public void addPlayer() {
blackjack.addPlayer(humanPlayer);
assertEquals(blackjack.getGameTable().size(), 1);
}
@Test
public void getBlackjackDealer() {
assertEquals(blackjack.getBlackjackDealer(), blackjackDealer);
}
@Test
public void playTurn() {
blackjack.addPlayer(humanPlayer);
blackjack.addPlayer(computerPlayer);
blackjack.playTurn("twist");
blackjack.playTurn("twist");
assertEquals(humanPlayer.getHand().size(), 2);
}
@Test
public void dealerGetsCards() {
blackjack.addPlayer(humanPlayer);
blackjack.addPlayer(computerPlayer);
Card card1 = new Card(CardSuit.CLUBS,CardValue.FOUR);
Card card2 = new Card(CardSuit.CLUBS,CardValue.NINE);
computerPlayer.getHand().add(card1);
computerPlayer.getHand().add(card2);
blackjack.playTurn("stick");
assertEquals(blackjack.getGameTable().get(1).getHand().size(), 3 );
}
@Test
public void dealerTurnTest(){
blackjack.addPlayer(humanPlayer);
blackjack.addPlayer(computerPlayer);
Card card1 = new Card(CardSuit.CLUBS,CardValue.EIGHT);
Card card2 = new Card(CardSuit.CLUBS,CardValue.THREE);
computerPlayer.getHand().add(card1);
computerPlayer.getHand().add(card2);
blackjack.playTurn("stick");
assertEquals(blackjack.getGameTable().get(1).getHand().size(), 3);
}
@Test
public void sumHand() {
Card card1 = new Card(CardSuit.CLUBS,CardValue.EIGHT);
Card card2 = new Card(CardSuit.CLUBS,CardValue.EIGHT);
humanPlayer.getHand().add(card1);
humanPlayer.getHand().add(card2);
assertEquals(blackjack.sumHand(humanPlayer), 16);
}
@Test
public void getWinner() {
blackjack.addPlayer(humanPlayer);
blackjack.addPlayer(computerPlayer);
Card card1 = new Card(CardSuit.CLUBS,CardValue.EIGHT);
Card card2 = new Card(CardSuit.CLUBS,CardValue.THREE);
humanPlayer.getHand().add(card1);
humanPlayer.getHand().add(card2);
Card card3 = new Card(CardSuit.CLUBS,CardValue.FIVE);
Card card4 = new Card(CardSuit.CLUBS,CardValue.QUEEN);
computerPlayer.getHand().add(card3);
computerPlayer.getHand().add(card4);
assertEquals(blackjack.getWinner(), computerPlayer);
}
@Test
public void checkBust(){
blackjack.addPlayer(humanPlayer);
Card card1 = new Card(CardSuit.CLUBS,CardValue.EIGHT);
Card card2 = new Card(CardSuit.CLUBS,CardValue.EIGHT);
Card card3 = new Card(CardSuit.CLUBS,CardValue.EIGHT);
Card card4 = new Card(CardSuit.CLUBS,CardValue.THREE);
humanPlayer.getHand().add(card3);
humanPlayer.getHand().add(card4);
blackjack.checkBustAndBlackjack(humanPlayer);
}
@Test
public void checkSitDown(){
blackjack.sitDownAtTable(humanPlayer);
assertEquals(blackjack.getGameTable().size(), 2);
}
@Test
public void checkAceCheker(){
Card card1 = new Card(CardSuit.CLUBS,CardValue.ACE);
Card card2 = new Card(CardSuit.CLUBS,CardValue.ACE);
humanPlayer.addCard(card1);
humanPlayer.addCard(card2);
assertEquals(blackjack.sumHand(humanPlayer), 12);
}
}
| 4,591
| 0.653235
| 0.641908
| 154
| 28.681818
| 22.776072
| 75
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.681818
| false
| false
|
2
|
e80c520b83a26a8f9bbae9864507ca5ed2f2b26b
| 37,967,510,902,647
|
7251a3b5dd93b9becb1a3a91a5042e6536ac8ef7
|
/Zozmom/src/com/zozmom/model/HongbaoModel.java
|
b2f9ca49752ba8ddc01aa354d66c037b6bb2b9dd
|
[] |
no_license
|
CQBOBOZHU/zozmom
|
https://github.com/CQBOBOZHU/zozmom
|
55d69e70938466de9572f692af867641e5fd6d5b
|
0ec056f53552bc51100fdfa508dbf0e7567a9f18
|
refs/heads/master
| 2021-07-07T19:10:14.447000
| 2020-12-08T03:32:14
| 2020-12-08T03:32:14
| 73,664,545
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.zozmom.model;
public class HongbaoModel extends BaseModel {
String startTime;
int usedPrice;//用户使用次红包的最低消费
String title;
String phone;
String bonusId;// 红包ID
int status;// 红包类型 0 可用 1已使用 2已过期
int discountPrice;// 红包额度
String endTime;
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public int getUsedPrice() {
return usedPrice;
}
public void setUsedPrice(int usedPrice) {
this.usedPrice = usedPrice;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getBonusId() {
return bonusId;
}
public void setBonusId(String bonusId) {
this.bonusId = bonusId;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getDiscountPrice() {
return discountPrice;
}
public void setDiscountPrice(int discountPrice) {
this.discountPrice = discountPrice;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
}
|
UTF-8
|
Java
| 1,370
|
java
|
HongbaoModel.java
|
Java
|
[] | null |
[] |
package com.zozmom.model;
public class HongbaoModel extends BaseModel {
String startTime;
int usedPrice;//用户使用次红包的最低消费
String title;
String phone;
String bonusId;// 红包ID
int status;// 红包类型 0 可用 1已使用 2已过期
int discountPrice;// 红包额度
String endTime;
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public int getUsedPrice() {
return usedPrice;
}
public void setUsedPrice(int usedPrice) {
this.usedPrice = usedPrice;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getBonusId() {
return bonusId;
}
public void setBonusId(String bonusId) {
this.bonusId = bonusId;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getDiscountPrice() {
return discountPrice;
}
public void setDiscountPrice(int discountPrice) {
this.discountPrice = discountPrice;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
}
| 1,370
| 0.683206
| 0.680916
| 62
| 19.129032
| 14.294691
| 50
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.580645
| false
| false
|
2
|
19f3c373a3041b04c1c312fb84b1d11c201f8af5
| 35,064,113,034,301
|
bfa860d7626233cc1b57b4b26854290156f63aca
|
/eBay-AuctionService/src/edu/ucla/cs/cs144/SearchServlet.java
|
cfca7b5d586aaf9d2c97d90d5744f992b3bb2808
|
[] |
no_license
|
mirajshah05/eBay-AuctionService
|
https://github.com/mirajshah05/eBay-AuctionService
|
adf514d986045ab8e6fd592fa07c3aff83a601ff
|
e52ed5090e51b640ef6663800bba440d29e893bd
|
refs/heads/master
| 2020-04-05T22:52:58.934000
| 2015-03-31T17:15:13
| 2015-03-31T17:15:13
| 33,197,910
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package edu.ucla.cs.cs144;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class SearchServlet extends HttpServlet implements Servlet {
public SearchServlet() {}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
// your codes here
try{
String pageTitle = "My Page Title";
//Enumeration<String> parameterNames = request.getParameterNames();
String query = "default";
query=URLEncoder.encode(request.getParameter("q"),"UTF-8");
String skip = request.getParameter("numResultsToSkip");
String return1 = request.getParameter("numResultsToReturn");
int skp = 0;
int nskip = Integer.parseInt(skip);//Integer.parseInt();
int nreturn = 20000;//Integer.parseInt(request.getParameter("return"));
int ret = Integer.parseInt(return1);
if(ret<1){ret=20000;}
AuctionSearchClient search = new AuctionSearchClient();
//System.out.println("skip "+skip+" return"+return1);
SearchResult results[] = search.basicSearch(query,skp,ret);
//int length = results.length;
//int length = 0;
//List<String> temp = new ArrayList<String>();
List<String> item = new ArrayList<String>() {};
List<String> name = new ArrayList<String>() {};
/*for(int i=0;i<results.length;i++)
item.add(results[i]);*/
//int max = 25;
int pages = (int) Math.ceil(results.length/15);
if((results.length%15)!=0){pages++;}
if(pages<=0){pages=1;}
for(int i=nskip;i<results.length&&i<(15+nskip);i++){
String a = results[i].getItemId();
item.add(a);
name.add(results[i].getName());
//System.out.println(" "+a);
}
request.setAttribute("query_string",query);
request.setAttribute("item", item);
request.setAttribute("name", name);
request.setAttribute("links", String.valueOf(pages));
request.setAttribute("tlength", String.valueOf(results.length));
request.setAttribute("start", String.valueOf(skip));
request.getRequestDispatcher("/index.jsp").forward(request, response);
}
catch(Exception E){
request.getRequestDispatcher("/item").forward(request,response);
}
}
}
|
UTF-8
|
Java
| 2,731
|
java
|
SearchServlet.java
|
Java
|
[] | null |
[] |
package edu.ucla.cs.cs144;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class SearchServlet extends HttpServlet implements Servlet {
public SearchServlet() {}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
// your codes here
try{
String pageTitle = "My Page Title";
//Enumeration<String> parameterNames = request.getParameterNames();
String query = "default";
query=URLEncoder.encode(request.getParameter("q"),"UTF-8");
String skip = request.getParameter("numResultsToSkip");
String return1 = request.getParameter("numResultsToReturn");
int skp = 0;
int nskip = Integer.parseInt(skip);//Integer.parseInt();
int nreturn = 20000;//Integer.parseInt(request.getParameter("return"));
int ret = Integer.parseInt(return1);
if(ret<1){ret=20000;}
AuctionSearchClient search = new AuctionSearchClient();
//System.out.println("skip "+skip+" return"+return1);
SearchResult results[] = search.basicSearch(query,skp,ret);
//int length = results.length;
//int length = 0;
//List<String> temp = new ArrayList<String>();
List<String> item = new ArrayList<String>() {};
List<String> name = new ArrayList<String>() {};
/*for(int i=0;i<results.length;i++)
item.add(results[i]);*/
//int max = 25;
int pages = (int) Math.ceil(results.length/15);
if((results.length%15)!=0){pages++;}
if(pages<=0){pages=1;}
for(int i=nskip;i<results.length&&i<(15+nskip);i++){
String a = results[i].getItemId();
item.add(a);
name.add(results[i].getName());
//System.out.println(" "+a);
}
request.setAttribute("query_string",query);
request.setAttribute("item", item);
request.setAttribute("name", name);
request.setAttribute("links", String.valueOf(pages));
request.setAttribute("tlength", String.valueOf(results.length));
request.setAttribute("start", String.valueOf(skip));
request.getRequestDispatcher("/index.jsp").forward(request, response);
}
catch(Exception E){
request.getRequestDispatcher("/item").forward(request,response);
}
}
}
| 2,731
| 0.628707
| 0.61699
| 72
| 36.930557
| 24.685987
| 119
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.916667
| false
| false
|
2
|
5d1223c898d63596cc8947733cc9ffa2a62a9890
| 31,361,851,244,259
|
e5997d7707ecdef1aa3f57a40127d1cd87550e7b
|
/src/gov/dost/bulacan/iris/ui/shared/FileItem.java
|
ea085369d73153950254aea980f18a739c0f94f6
|
[
"MIT"
] |
permissive
|
melvinperello/javafx-dost3-bulacan-iris
|
https://github.com/melvinperello/javafx-dost3-bulacan-iris
|
0ea69f97c6fea368d82cabace6e248de6a254269
|
e5f6e392959c09fbb4e485a0c449123e509c0987
|
refs/heads/master
| 2022-12-17T15:08:13.184000
| 2019-12-11T14:43:05
| 2019-12-11T14:43:05
| 222,215,220
| 0
| 0
|
MIT
| false
| 2022-12-06T00:44:30
| 2019-11-17T07:54:12
| 2019-12-11T14:43:20
| 2022-12-06T00:44:29
| 39,188
| 0
| 0
| 3
|
Java
| false
| false
|
/**
* Information Retrieval Integrated System ( I.R.I.S. )
* Republic of The Philippines, DOST Regional Office No. III
* Provincial Science Technology Center, City of Malolos, Bulacan
*
* Afterschool Creatives "Captivating Creativity"
*
* Copyright 2018 Jhon Melvin Perello
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
package gov.dost.bulacan.iris.ui.shared;
import gov.dost.bulacan.iris.Context;
import gov.dost.bulacan.iris.FileExtensions;
import gov.dost.bulacan.iris.RaidContext;
import gov.dost.bulacan.iris.models.SystemFileModel;
import java.util.Locale;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Pane;
import org.afterschoolcreatives.polaris.javafx.fxml.PolarisFxController;
import org.afterschoolcreatives.polaris.javafx.scene.control.PolarisCustomListAdapter;
/**
*
* @author Jhon Melvin
*/
public class FileItem extends PolarisFxController implements PolarisCustomListAdapter.Listable {
@FXML
private ImageView img_icon;
@FXML
private Label lbl_file_name;
@FXML
private Label lbl_description;
public FileItem() {
this.documentModel = null;
}
private SystemFileModel documentModel;
public SystemFileModel getDocumentModel() {
return documentModel;
}
public void setDocumentModel(SystemFileModel documentModel) {
this.documentModel = documentModel;
}
//--------------------------------------------------------------------------
@Override
protected void setup() {
this.lbl_file_name.setText(this.documentModel.getDocName());
final String f_ext = this.documentModel.getLinkedModel().getExtenstion().toLowerCase(Locale.ENGLISH);
//----------------------------------------------------------------------
final String prettyName = FileExtensions.recognizeFile(f_ext);
final String f_icon = FileExtensions.getDisplayIcon(prettyName);
this.img_icon.setImage(new Image(Context
.getResourceStream("drawable/file_extensions/" + f_icon)));
//----------------------------------------------------------------------
String descriptiveText = "";
final String prettySize = RaidContext.getStringFileSize(this.getDocumentModel().getLinkedModel().getSize());
descriptiveText = prettyName + " ( " + prettySize + " ) " + " - "
+ this.documentModel.auditToString();
this.lbl_description.setText(descriptiveText);
}
@Override
public Pane getCellGraphic() {
return this.getRootPane();
}
}
|
UTF-8
|
Java
| 3,681
|
java
|
FileItem.java
|
Java
|
[
{
"context": "ives \"Captivating Creativity\"\n *\n * Copyright 2018 Jhon Melvin Perello\n *\n * Permission is hereby granted, free of charg",
"end": 280,
"score": 0.999774158000946,
"start": 261,
"tag": "NAME",
"value": "Jhon Melvin Perello"
},
{
"context": "ntrol.PolarisCustomListAdapter;\n\n/**\n *\n * @author Jhon Melvin\n */\npublic class FileItem extends PolarisFxContro",
"end": 1961,
"score": 0.9998037815093994,
"start": 1950,
"tag": "NAME",
"value": "Jhon Melvin"
}
] | null |
[] |
/**
* Information Retrieval Integrated System ( I.R.I.S. )
* Republic of The Philippines, DOST Regional Office No. III
* Provincial Science Technology Center, City of Malolos, Bulacan
*
* Afterschool Creatives "Captivating Creativity"
*
* Copyright 2018 <NAME>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
package gov.dost.bulacan.iris.ui.shared;
import gov.dost.bulacan.iris.Context;
import gov.dost.bulacan.iris.FileExtensions;
import gov.dost.bulacan.iris.RaidContext;
import gov.dost.bulacan.iris.models.SystemFileModel;
import java.util.Locale;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Pane;
import org.afterschoolcreatives.polaris.javafx.fxml.PolarisFxController;
import org.afterschoolcreatives.polaris.javafx.scene.control.PolarisCustomListAdapter;
/**
*
* @author <NAME>
*/
public class FileItem extends PolarisFxController implements PolarisCustomListAdapter.Listable {
@FXML
private ImageView img_icon;
@FXML
private Label lbl_file_name;
@FXML
private Label lbl_description;
public FileItem() {
this.documentModel = null;
}
private SystemFileModel documentModel;
public SystemFileModel getDocumentModel() {
return documentModel;
}
public void setDocumentModel(SystemFileModel documentModel) {
this.documentModel = documentModel;
}
//--------------------------------------------------------------------------
@Override
protected void setup() {
this.lbl_file_name.setText(this.documentModel.getDocName());
final String f_ext = this.documentModel.getLinkedModel().getExtenstion().toLowerCase(Locale.ENGLISH);
//----------------------------------------------------------------------
final String prettyName = FileExtensions.recognizeFile(f_ext);
final String f_icon = FileExtensions.getDisplayIcon(prettyName);
this.img_icon.setImage(new Image(Context
.getResourceStream("drawable/file_extensions/" + f_icon)));
//----------------------------------------------------------------------
String descriptiveText = "";
final String prettySize = RaidContext.getStringFileSize(this.getDocumentModel().getLinkedModel().getSize());
descriptiveText = prettyName + " ( " + prettySize + " ) " + " - "
+ this.documentModel.auditToString();
this.lbl_description.setText(descriptiveText);
}
@Override
public Pane getCellGraphic() {
return this.getRootPane();
}
}
| 3,663
| 0.685683
| 0.684597
| 97
| 36.948452
| 31.557955
| 116
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.56701
| false
| false
|
2
|
0d8d35f8ce86b90c1a6f2e22c342b1d36bd4d535
| 36,704,790,531,925
|
693c7ed8d72abce75bbff2b09e72acf01905cbda
|
/applications/order/src/main/java/io/pivotal/order/repository/OrderRepository.java
|
35f14cf77eb3e17ad8cdd9c06366798ec737b684
|
[] |
no_license
|
klenke/ecommerce-data-app
|
https://github.com/klenke/ecommerce-data-app
|
62969fbf7ea2d0d633dc12291b01c35679105e43
|
1d3df19e776635014671fabb373f1e85e907461d
|
refs/heads/master
| 2020-03-25T00:50:12.615000
| 2018-08-03T14:43:31
| 2018-08-03T14:43:31
| 143,208,300
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package io.pivotal.order.repository;
import io.pivotal.order.domain.Order;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface OrderRepository extends CrudRepository<Order, Long> {
public List<Order> findByAccountIdOrderByOrderDateAsc(Long account_id);
public Order findByAccountIdAndOrderNumber(Long account_id, Long order_number);
}
|
UTF-8
|
Java
| 453
|
java
|
OrderRepository.java
|
Java
|
[] | null |
[] |
package io.pivotal.order.repository;
import io.pivotal.order.domain.Order;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface OrderRepository extends CrudRepository<Order, Long> {
public List<Order> findByAccountIdOrderByOrderDateAsc(Long account_id);
public Order findByAccountIdAndOrderNumber(Long account_id, Long order_number);
}
| 453
| 0.830022
| 0.830022
| 15
| 29.200001
| 29.480389
| 81
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.6
| false
| false
|
2
|
33c1d6b4867bdf2121baac972b2ed3c39d1ee4ee
| 36,129,264,917,200
|
248014cb9a3fa870e40a45e031643e9de8a8b96b
|
/rpc-sample-service/src/main/java/com/gomeplus/rpc/sample/service/RpcBootstrap.java
|
c9aaa3d9b368d2a505ae3ec179387bd06e512772
|
[] |
no_license
|
chenping025/rpc-sample
|
https://github.com/chenping025/rpc-sample
|
22d5d74a858eb896fc951e26a2859ef30e5deb5e
|
200b986a9aca9488a8685e5c79bb8c7ad6bce4d4
|
refs/heads/master
| 2020-03-19T07:39:41.283000
| 2018-06-05T07:48:48
| 2018-06-05T07:48:48
| 136,136,944
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.gomeplus.rpc.sample.service;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* 启动springContext,构造rpcService框架,将标有rpcService注解的
* 业务类发布到rpcService中
* @author
*
*/
public class RpcBootstrap {
@SuppressWarnings("resource")
public static void main(String[] args) {
new ClassPathXmlApplicationContext("spring.xml");
}
}
|
UTF-8
|
Java
| 414
|
java
|
RpcBootstrap.java
|
Java
|
[] | null |
[] |
package com.gomeplus.rpc.sample.service;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* 启动springContext,构造rpcService框架,将标有rpcService注解的
* 业务类发布到rpcService中
* @author
*
*/
public class RpcBootstrap {
@SuppressWarnings("resource")
public static void main(String[] args) {
new ClassPathXmlApplicationContext("spring.xml");
}
}
| 414
| 0.776882
| 0.776882
| 17
| 20.882353
| 22.520271
| 74
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.470588
| false
| false
|
2
|
07a6339bdccb0d83f51eed34c7cda2e72d77b2ed
| 36,910,948,965,650
|
bd6bca7e6418cb15caba46abffb0c283f4687cb6
|
/app/src/main/java/com/example/csce490m3research/EditTipActivity.java
|
81a86bd94aa328e98a52f578bc046c8efccf0921
|
[] |
no_license
|
SCCapstone/iTipper
|
https://github.com/SCCapstone/iTipper
|
885cc6fff54979459060d98084a8420431a7df92
|
befbe08b5bc508ae355519a668211ae92a5fdd8d
|
refs/heads/master
| 2022-04-24T07:37:52.720000
| 2020-04-27T18:27:44
| 2020-04-27T18:27:44
| 205,369,815
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.csce490m3research;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.TimePicker;
import android.widget.Toast;
import com.google.firebase.Timestamp;
import com.google.firebase.firestore.FirebaseFirestore;
import java.util.Date;
import java.util.Objects;
/**
* Class allows user to edit the tip values and updates firestore with the new data
*/
public class EditTipActivity extends ToolbarActivity {
String path;
DatePicker tipDatePicker;
TimePicker tipTimePicker;
EditText tipEditValue;
Button doneButton;
FirebaseFirestore db = FirebaseFirestore.getInstance();
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_edit_tip);
super.onCreate(savedInstanceState);
setTitle("Edit Tip");
Intent intent = getIntent();
if (intent.hasExtra("path")) {
path = intent.getStringExtra("path");
} else {
Toast.makeText(this, "Couldn't load tip data.", Toast.LENGTH_LONG)
.show();
startActivity(new Intent(this, ShiftListActivity.class));
}
tipDatePicker = findViewById(R.id.tipDatePicker);
tipTimePicker = findViewById(R.id.tipTimePicker);
tipEditValue = findViewById(R.id.tipEditValue);
// Initialize edit value to whatever the tip is in the database
tipEditValue.setText(intent.getStringExtra("value"));
// Initialize the date and time picker, too
Date date = new Date(intent.getStringExtra("date"));
tipDatePicker.updateDate(date.getYear()+1900, date.getMonth(), date.getDate());
tipTimePicker.setHour(date.getHours());
tipTimePicker.setMinute(date.getMinutes());
final Date oldDate = getPickerDate();
double oldVal = 0;
try {
oldVal = new Tip(getTipEditValue()).getValue();
} catch (InvalidTipException e) {
e.printStackTrace();
}
doneButton = findViewById(R.id.done_editing_tip_button);
final double finalOldVal = oldVal;
doneButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Use try to check for valid tip value.
try {
if (!tipEditValue.getText().toString().isEmpty()) {
Date newDate = getPickerDate();
Timestamp newTimestamp = new Timestamp(newDate);
double newVal = new Tip(tipEditValue.getText().toString()).getValue();
/* If nothing has been edited, don't send update request to database
and don't send "Tip edited!" message to user.
Just exit the activity. */
if (newVal == finalOldVal && newDate.equals(oldDate)) {
finish();
} else {
/* If either the value or date has changed, send "Tip edited!" message,
but only send update request for fields that changed. */
if (!(newVal == finalOldVal)) {
Tip tip = new Tip(tipEditValue.getText().toString());
db.document(path).update("value", tip.getValue());
}
if (!newDate.equals(oldDate)) {
db.document(path).update("time", newTimestamp);
}
// Finally, exit the activity and inform the user data has changed.
Toast.makeText(v.getContext(), "Tip edited!", Toast.LENGTH_SHORT)
.show();
finish();
}
}
} catch (InvalidTipException e) {
e.printStackTrace();
Toast.makeText(v.getContext(), e.getMessage(), Toast.LENGTH_LONG).show();
} catch (NumberFormatException e) {
e.printStackTrace();
String errText =
"You entered something that couldn't be interpreted as a number.";
Toast.makeText(v.getContext(), errText, Toast.LENGTH_LONG).show();
}
}
});
}
/**
* Form a Date from the values currently displayed in the date and time picker.
* @return Date corresponding to date and time on each picker on the screen
*/
Date getPickerDate() {
return new Date(
tipDatePicker.getYear() - 1900,
tipDatePicker.getMonth(),
tipDatePicker.getDayOfMonth(),
tipTimePicker.getHour(),
tipTimePicker.getMinute()
);
}
/**
* Grab the string currently in the Edit Value text box.
* @return String currently in Edit Value edit text view
*/
String getTipEditValue() {
return tipEditValue.getText().toString();
}
}
|
UTF-8
|
Java
| 5,395
|
java
|
EditTipActivity.java
|
Java
|
[] | null |
[] |
package com.example.csce490m3research;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.TimePicker;
import android.widget.Toast;
import com.google.firebase.Timestamp;
import com.google.firebase.firestore.FirebaseFirestore;
import java.util.Date;
import java.util.Objects;
/**
* Class allows user to edit the tip values and updates firestore with the new data
*/
public class EditTipActivity extends ToolbarActivity {
String path;
DatePicker tipDatePicker;
TimePicker tipTimePicker;
EditText tipEditValue;
Button doneButton;
FirebaseFirestore db = FirebaseFirestore.getInstance();
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_edit_tip);
super.onCreate(savedInstanceState);
setTitle("Edit Tip");
Intent intent = getIntent();
if (intent.hasExtra("path")) {
path = intent.getStringExtra("path");
} else {
Toast.makeText(this, "Couldn't load tip data.", Toast.LENGTH_LONG)
.show();
startActivity(new Intent(this, ShiftListActivity.class));
}
tipDatePicker = findViewById(R.id.tipDatePicker);
tipTimePicker = findViewById(R.id.tipTimePicker);
tipEditValue = findViewById(R.id.tipEditValue);
// Initialize edit value to whatever the tip is in the database
tipEditValue.setText(intent.getStringExtra("value"));
// Initialize the date and time picker, too
Date date = new Date(intent.getStringExtra("date"));
tipDatePicker.updateDate(date.getYear()+1900, date.getMonth(), date.getDate());
tipTimePicker.setHour(date.getHours());
tipTimePicker.setMinute(date.getMinutes());
final Date oldDate = getPickerDate();
double oldVal = 0;
try {
oldVal = new Tip(getTipEditValue()).getValue();
} catch (InvalidTipException e) {
e.printStackTrace();
}
doneButton = findViewById(R.id.done_editing_tip_button);
final double finalOldVal = oldVal;
doneButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Use try to check for valid tip value.
try {
if (!tipEditValue.getText().toString().isEmpty()) {
Date newDate = getPickerDate();
Timestamp newTimestamp = new Timestamp(newDate);
double newVal = new Tip(tipEditValue.getText().toString()).getValue();
/* If nothing has been edited, don't send update request to database
and don't send "Tip edited!" message to user.
Just exit the activity. */
if (newVal == finalOldVal && newDate.equals(oldDate)) {
finish();
} else {
/* If either the value or date has changed, send "Tip edited!" message,
but only send update request for fields that changed. */
if (!(newVal == finalOldVal)) {
Tip tip = new Tip(tipEditValue.getText().toString());
db.document(path).update("value", tip.getValue());
}
if (!newDate.equals(oldDate)) {
db.document(path).update("time", newTimestamp);
}
// Finally, exit the activity and inform the user data has changed.
Toast.makeText(v.getContext(), "Tip edited!", Toast.LENGTH_SHORT)
.show();
finish();
}
}
} catch (InvalidTipException e) {
e.printStackTrace();
Toast.makeText(v.getContext(), e.getMessage(), Toast.LENGTH_LONG).show();
} catch (NumberFormatException e) {
e.printStackTrace();
String errText =
"You entered something that couldn't be interpreted as a number.";
Toast.makeText(v.getContext(), errText, Toast.LENGTH_LONG).show();
}
}
});
}
/**
* Form a Date from the values currently displayed in the date and time picker.
* @return Date corresponding to date and time on each picker on the screen
*/
Date getPickerDate() {
return new Date(
tipDatePicker.getYear() - 1900,
tipDatePicker.getMonth(),
tipDatePicker.getDayOfMonth(),
tipTimePicker.getHour(),
tipTimePicker.getMinute()
);
}
/**
* Grab the string currently in the Edit Value text box.
* @return String currently in Edit Value edit text view
*/
String getTipEditValue() {
return tipEditValue.getText().toString();
}
}
| 5,395
| 0.564226
| 0.561817
| 145
| 36.206898
| 28.167454
| 95
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.558621
| false
| false
|
2
|
18977d1f93224e8eafe8aa2d98873b1e2c7e2534
| 34,780,645,197,845
|
2070599f4bd20683a4c0eb773757478a2e15dfa3
|
/Algorithms/simpleArraySum.java
|
3fc3d230eb46d80b724b75becab047ffe31fe595
|
[] |
no_license
|
TigranYengiba04/HackerRank-JAVA
|
https://github.com/TigranYengiba04/HackerRank-JAVA
|
cd37dde00547aa8f3d2871f00a401fbc377d3953
|
c99e058f77ff45046fa500d9a6f0ab5de63d5808
|
refs/heads/master
| 2020-08-04T15:23:50.562000
| 2019-11-10T19:26:49
| 2019-11-10T19:26:49
| 212,183,488
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
int simpleArraySum(int[] arr){
int result = 0;
for(byte i = 0; i < arr.length; i++){
result += arr[i];
}
return result;
}
|
UTF-8
|
Java
| 151
|
java
|
simpleArraySum.java
|
Java
|
[] | null |
[] |
int simpleArraySum(int[] arr){
int result = 0;
for(byte i = 0; i < arr.length; i++){
result += arr[i];
}
return result;
}
| 151
| 0.496689
| 0.483444
| 7
| 19.857143
| 12.855556
| 41
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.714286
| false
| false
|
2
|
4724a906ef16957f3381504166c3ad4d95e08455
| 3,410,204,091,352
|
3b53c2d5c659217a55ea35bc6dc740c7cafc3aa0
|
/publishers/nature/src/main/java/wwmm/pubcrawler/crawlers/nature/tasks/NatureBibliographyCrawlSeedTask.java
|
8742c4a014beb827b31a6571f9605409c74944eb
|
[] |
no_license
|
BlueObelisk/pub-crawler
|
https://github.com/BlueObelisk/pub-crawler
|
5d9e964b326a1a6c74325f9178a0aff85714c247
|
764923b723146c267b67e030f2fd5d6cd8e53a7e
|
refs/heads/master
| 2022-06-27T10:27:15.615000
| 2012-06-25T19:14:04
| 2012-06-25T19:14:04
| 230,638,482
| 0
| 0
| null | false
| 2022-05-20T21:20:48
| 2019-12-28T17:04:32
| 2020-01-04T19:30:13
| 2022-05-20T21:20:47
| 2,274
| 0
| 0
| 18
|
HTML
| false
| false
|
package wwmm.pubcrawler.crawlers.nature.tasks;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import wwmm.pubcrawler.crawler.Task;
import wwmm.pubcrawler.crawler.TaskQueue;
import wwmm.pubcrawler.crawlers.nature.NaturePublicationListCrawlTaskFactory;
import javax.inject.Inject;
/**
* @author Sam Adams
*/
public class NatureBibliographyCrawlSeedTask implements Runnable {
private static final Logger LOG = LoggerFactory.getLogger(NatureBibliographyCrawlSeedTask.class);
private final TaskQueue taskQueue;
private final NaturePublicationListCrawlTaskFactory crawlTaskFactory;
@Inject
public NatureBibliographyCrawlSeedTask(final TaskQueue taskQueue, final NaturePublicationListCrawlTaskFactory factory) {
this.taskQueue = taskQueue;
this.crawlTaskFactory = factory;
}
@Override
public void run() {
try {
enqueueSeedTask();
} catch (Exception e) {
LOG.error("Error seeding crawl", e);
}
}
private void enqueueSeedTask() {
final Task task = crawlTaskFactory.createCrawlTask();
taskQueue.queueTask(task);
}
}
|
UTF-8
|
Java
| 1,150
|
java
|
NatureBibliographyCrawlSeedTask.java
|
Java
|
[
{
"context": "tory;\n\nimport javax.inject.Inject;\n\n/**\n * @author Sam Adams\n */\npublic class NatureBibliographyCrawlSeedTask ",
"end": 316,
"score": 0.9997994303703308,
"start": 307,
"tag": "NAME",
"value": "Sam Adams"
}
] | null |
[] |
package wwmm.pubcrawler.crawlers.nature.tasks;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import wwmm.pubcrawler.crawler.Task;
import wwmm.pubcrawler.crawler.TaskQueue;
import wwmm.pubcrawler.crawlers.nature.NaturePublicationListCrawlTaskFactory;
import javax.inject.Inject;
/**
* @author <NAME>
*/
public class NatureBibliographyCrawlSeedTask implements Runnable {
private static final Logger LOG = LoggerFactory.getLogger(NatureBibliographyCrawlSeedTask.class);
private final TaskQueue taskQueue;
private final NaturePublicationListCrawlTaskFactory crawlTaskFactory;
@Inject
public NatureBibliographyCrawlSeedTask(final TaskQueue taskQueue, final NaturePublicationListCrawlTaskFactory factory) {
this.taskQueue = taskQueue;
this.crawlTaskFactory = factory;
}
@Override
public void run() {
try {
enqueueSeedTask();
} catch (Exception e) {
LOG.error("Error seeding crawl", e);
}
}
private void enqueueSeedTask() {
final Task task = crawlTaskFactory.createCrawlTask();
taskQueue.queueTask(task);
}
}
| 1,147
| 0.728696
| 0.726957
| 40
| 27.75
| 29.119366
| 124
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.45
| false
| false
|
2
|
e40f917769ab8e1e73c0494be223bed3ec73a0b6
| 37,331,855,767,150
|
ea87c00b5dbb09744343344abd60c866131595e0
|
/cs-jclouds/src/main/java/io/cloudslang/content/jclouds/entities/aws/NetworkInterfaceAttachmentStatus.java
|
60dd15d18729bf08aaf0165dc137e50edb035fa4
|
[
"Apache-2.0"
] |
permissive
|
hanh45/cs-actions
|
https://github.com/hanh45/cs-actions
|
3c288e137494241382261584955fade4ec5ed575
|
92cab9e30707d7d5aa8e728edd7b48e7440b6de2
|
refs/heads/master
| 2021-01-11T01:25:32.360000
| 2016-10-11T10:37:02
| 2016-10-11T10:37:02
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package io.cloudslang.content.jclouds.entities.aws;
import io.cloudslang.content.jclouds.entities.constants.Constants;
import org.apache.commons.lang3.StringUtils;
/**
* Created by Mihai Tusa.
* 6/8/2016.
*/
public enum NetworkInterfaceAttachmentStatus {
ATTACHING,
ATTACHED,
DETACHING,
DETACHED;
public static String getValue(String input) throws Exception {
if (StringUtils.isBlank(input)) {
return Constants.Miscellaneous.NOT_RELEVANT;
}
try {
return valueOf(input.toUpperCase()).toString().toLowerCase();
} catch (IllegalArgumentException iae) {
throw new RuntimeException("Unrecognized networkInterfaceAttachmentStatus value: [" + input + "]. " +
"Valid values are: attaching, attached, detaching, detached.");
}
}
}
|
UTF-8
|
Java
| 849
|
java
|
NetworkInterfaceAttachmentStatus.java
|
Java
|
[
{
"context": "ache.commons.lang3.StringUtils;\n\n/**\n * Created by Mihai Tusa.\n * 6/8/2016.\n */\npublic enum NetworkInterfaceAtt",
"end": 194,
"score": 0.9998636245727539,
"start": 184,
"tag": "NAME",
"value": "Mihai Tusa"
}
] | null |
[] |
package io.cloudslang.content.jclouds.entities.aws;
import io.cloudslang.content.jclouds.entities.constants.Constants;
import org.apache.commons.lang3.StringUtils;
/**
* Created by <NAME>.
* 6/8/2016.
*/
public enum NetworkInterfaceAttachmentStatus {
ATTACHING,
ATTACHED,
DETACHING,
DETACHED;
public static String getValue(String input) throws Exception {
if (StringUtils.isBlank(input)) {
return Constants.Miscellaneous.NOT_RELEVANT;
}
try {
return valueOf(input.toUpperCase()).toString().toLowerCase();
} catch (IllegalArgumentException iae) {
throw new RuntimeException("Unrecognized networkInterfaceAttachmentStatus value: [" + input + "]. " +
"Valid values are: attaching, attached, detaching, detached.");
}
}
}
| 845
| 0.665489
| 0.657244
| 28
| 29.321428
| 30.044079
| 113
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.464286
| false
| false
|
2
|
091e0bcd42be5eaaa07bf9c8f460e8d62331e73c
| 37,331,855,763,173
|
4d85e546bf35a74320208a4ad06dc0512c58a5de
|
/MyBatis_03_Iolist/src/com/biz/iolist/service/ProductServiceV1.java
|
1ac97b4b3833f6d86146694c06d39390da449b09
|
[] |
no_license
|
leeiter/JDBC_2019_10
|
https://github.com/leeiter/JDBC_2019_10
|
eac82d2646c365dfd1e9c6fa81b370c6b37364af
|
55692b1cb2c4153ee7b07cd637437f01ac39ad42
|
refs/heads/master
| 2020-08-14T21:34:52.031000
| 2019-11-01T07:58:42
| 2019-11-01T07:58:42
| 215,235,560
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.biz.iolist.service;
import java.util.List;
import java.util.Scanner;
import com.biz.iolist.config.DBConnection;
import com.biz.iolist.dao.ProductDao;
import com.biz.iolist.persistence.ProductDTO;
public class ProductServiceV1 {
protected ProductDao proDao;
protected Scanner scanner;
public ProductServiceV1() {
this.proDao = DBConnection.getSqlSessionFactory().openSession(true).getMapper(ProductDao.class);
scanner = new Scanner(System.in);
}
public void proUpdate() {
//
// List<ProductDTO> proList = proDao.selectAll();
// for(ProductDTO dto : proList) {
// System.out.println(dto.toString());
// }
System.out.println("==================================");
System.out.print("수정할 상품코드");
String strPCode = scanner.nextLine();
strPCode = strPCode.toUpperCase();
ProductDTO proDTO = proDao.findById(strPCode);
System.out.println("=================================");
System.out.printf("상품코드 : %s\n", proDTO.getP_code());
System.out.printf("상품이름 : %s\n", proDTO.getP_name());
System.out.printf("매입단가 : %d\n", proDTO.getP_iprice());
System.out.printf("매출단가 : %d\n", proDTO.getP_oprice());
String strVAT = proDTO.getP_vat().equals("1") ? "과세" : "면세";
System.out.printf("과세여부(1:과세,0:면세 : %s)\n", strVAT);
System.out.println("=================================");
System.out.printf("변경할 상품명(%s) >> ", proDTO.getP_name());
String strName = scanner.nextLine();
if(!strName.trim().isEmpty()) {
proDTO.setP_name(strName);
}
System.out.printf("변경할 매입단가(%d) >> ", proDTO.getP_iprice());
String strIPrice = scanner.nextLine();
/*
* 만약 매입단가를 입력하지 않고 그냥 enter만 눌렀다면
* Integer.valueOF(strIprice)에서 Exerption이 발생할 것이다.
* try{} 감싸진 코드에서 Exceprion이 발생하면
* 나머지 코드는 무시되고 cathchh() jump 한다.
*
* 이런 기능ㅇ르 역 이용하여
* 값을 입력하지 않거나 , 문자열등ㅇ르 포함하면
*/
try {
proDTO.setP_iprice(Integer.valueOf(strIPrice));
} catch (Exception e) {
// TODO: handle exception
}
System.out.printf("변경할 매출단가(%d) >> ", proDTO.getP_oprice());
String strOPrice = scanner.nextLine();
try {
proDTO.setP_iprice(Integer.valueOf(strOPrice));
} catch (Exception e) {
// TODO: handle exception
}
/*
* proDTO의 필드변수들은
* 각 항목을 입력받을때 Enter만 입력했다면
* 원래 DB tavle에서 가져온 값이 그대로 유지 될 ㅓㄳ이고
*
* ]값을 입력했다면
* 새로운 값으로 변경되어 있을 것이다.
*/
int ret = proDao.update(proDTO);
if(ret > 0) {
System.out.println("데이터변경완료");
} else {
System.out.println("데이터실패완료");
}
System.out.println(proDao.findById(strPCode).toString());
}
}
|
UTF-8
|
Java
| 2,993
|
java
|
ProductServiceV1.java
|
Java
|
[] | null |
[] |
package com.biz.iolist.service;
import java.util.List;
import java.util.Scanner;
import com.biz.iolist.config.DBConnection;
import com.biz.iolist.dao.ProductDao;
import com.biz.iolist.persistence.ProductDTO;
public class ProductServiceV1 {
protected ProductDao proDao;
protected Scanner scanner;
public ProductServiceV1() {
this.proDao = DBConnection.getSqlSessionFactory().openSession(true).getMapper(ProductDao.class);
scanner = new Scanner(System.in);
}
public void proUpdate() {
//
// List<ProductDTO> proList = proDao.selectAll();
// for(ProductDTO dto : proList) {
// System.out.println(dto.toString());
// }
System.out.println("==================================");
System.out.print("수정할 상품코드");
String strPCode = scanner.nextLine();
strPCode = strPCode.toUpperCase();
ProductDTO proDTO = proDao.findById(strPCode);
System.out.println("=================================");
System.out.printf("상품코드 : %s\n", proDTO.getP_code());
System.out.printf("상품이름 : %s\n", proDTO.getP_name());
System.out.printf("매입단가 : %d\n", proDTO.getP_iprice());
System.out.printf("매출단가 : %d\n", proDTO.getP_oprice());
String strVAT = proDTO.getP_vat().equals("1") ? "과세" : "면세";
System.out.printf("과세여부(1:과세,0:면세 : %s)\n", strVAT);
System.out.println("=================================");
System.out.printf("변경할 상품명(%s) >> ", proDTO.getP_name());
String strName = scanner.nextLine();
if(!strName.trim().isEmpty()) {
proDTO.setP_name(strName);
}
System.out.printf("변경할 매입단가(%d) >> ", proDTO.getP_iprice());
String strIPrice = scanner.nextLine();
/*
* 만약 매입단가를 입력하지 않고 그냥 enter만 눌렀다면
* Integer.valueOF(strIprice)에서 Exerption이 발생할 것이다.
* try{} 감싸진 코드에서 Exceprion이 발생하면
* 나머지 코드는 무시되고 cathchh() jump 한다.
*
* 이런 기능ㅇ르 역 이용하여
* 값을 입력하지 않거나 , 문자열등ㅇ르 포함하면
*/
try {
proDTO.setP_iprice(Integer.valueOf(strIPrice));
} catch (Exception e) {
// TODO: handle exception
}
System.out.printf("변경할 매출단가(%d) >> ", proDTO.getP_oprice());
String strOPrice = scanner.nextLine();
try {
proDTO.setP_iprice(Integer.valueOf(strOPrice));
} catch (Exception e) {
// TODO: handle exception
}
/*
* proDTO의 필드변수들은
* 각 항목을 입력받을때 Enter만 입력했다면
* 원래 DB tavle에서 가져온 값이 그대로 유지 될 ㅓㄳ이고
*
* ]값을 입력했다면
* 새로운 값으로 변경되어 있을 것이다.
*/
int ret = proDao.update(proDTO);
if(ret > 0) {
System.out.println("데이터변경완료");
} else {
System.out.println("데이터실패완료");
}
System.out.println(proDao.findById(strPCode).toString());
}
}
| 2,993
| 0.624268
| 0.621927
| 103
| 23.893204
| 21.740711
| 98
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 2.165049
| false
| false
|
2
|
36ca18bf3e77c2e491689e3f8b4eb0920a2b0e78
| 34,084,860,510,332
|
8174b2f881a43612a34773309f20e281244316aa
|
/configRepo-dao/src/test/java/dbunit/BaseDbTestCase.java
|
5d4b32a4f26428cf5f664a280aa793cffcb62df6
|
[] |
no_license
|
wyzhangjie/configRepo
|
https://github.com/wyzhangjie/configRepo
|
0154a86078ac7e613abb63844162e42b3b476002
|
953e815e6e0d0cc036ca41cb7f57c594996f2906
|
refs/heads/master
| 2020-05-29T15:11:12.224000
| 2019-04-17T11:09:42
| 2019-04-17T11:09:42
| 67,579,091
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package dbunit;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import javax.annotation.Resource;
import javax.sql.DataSource;
@ContextConfiguration(locations = { "classpath:/conf/service/applicationContext-test.xml" }, inheritLocations = false)
public abstract class BaseDbTestCase extends BaseBusinessTestCase {
protected JdbcTemplate jdbcTemplate;
private DataSource dataSource;
protected DataSource getDataSource() {
return dataSource;
}
protected JdbcTemplate getSimpleJdbcTemplate() {
return jdbcTemplate;
}
@Resource(name = "dataSourceDemo")
public void setDataSource(DataSource dataSource) {
this.dataSource = dataSource;
jdbcTemplate = new JdbcTemplate(dataSource);
}
public String getDbunitDir() {
return "data";
}
public String getDbunitFile() {
return "sample_data_cust.xml";
}
}
|
UTF-8
|
Java
| 1,056
|
java
|
BaseDbTestCase.java
|
Java
|
[] | null |
[] |
package dbunit;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import javax.annotation.Resource;
import javax.sql.DataSource;
@ContextConfiguration(locations = { "classpath:/conf/service/applicationContext-test.xml" }, inheritLocations = false)
public abstract class BaseDbTestCase extends BaseBusinessTestCase {
protected JdbcTemplate jdbcTemplate;
private DataSource dataSource;
protected DataSource getDataSource() {
return dataSource;
}
protected JdbcTemplate getSimpleJdbcTemplate() {
return jdbcTemplate;
}
@Resource(name = "dataSourceDemo")
public void setDataSource(DataSource dataSource) {
this.dataSource = dataSource;
jdbcTemplate = new JdbcTemplate(dataSource);
}
public String getDbunitDir() {
return "data";
}
public String getDbunitFile() {
return "sample_data_cust.xml";
}
}
| 1,056
| 0.715909
| 0.715909
| 39
| 26.076923
| 25.734726
| 118
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.384615
| false
| false
|
2
|
ae144ccac1579a95d7288b029369cc8bbf21feaf
| 34,815,004,948,201
|
585bb76472d518179a9a5c2fc9ba9a5d165e742a
|
/src/main/java/snowpaw/teslapunk/client/gui/GuiDynamoStirling.java
|
06eaacfffff564a7f3e0b40e25420b9cbaac0626
|
[] |
no_license
|
KitsuneAlex/Teslapunk
|
https://github.com/KitsuneAlex/Teslapunk
|
de312b81b0881d63f1ff5727a930fda0b2cb1a21
|
fd2d3e230cc31d3b3a2b46d6c7283a1e91b599b0
|
refs/heads/master
| 2016-08-29T17:51:29.787000
| 2016-08-01T15:44:46
| 2016-08-01T15:44:46
| 54,524,078
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package snowpaw.teslapunk.client.gui;
import net.minecraft.entity.player.InventoryPlayer;
import snowpaw.teslapunk.common.inventory.ContainerDynamoStirling;
import snowpaw.teslapunk.common.tile.TileBase;
public class GuiDynamoStirling extends GuiBase {
public GuiDynamoStirling(InventoryPlayer inventoryPlayer, TileBase tile) {
super(inventoryPlayer, tile, new ContainerDynamoStirling(inventoryPlayer, tile));
}
@Override
public void drawBackground(float partialTicks, int mouseX, int mouseY) {
}
@Override
public void drawForeground(int mouseX, int mouseY) {
}
}
|
UTF-8
|
Java
| 635
|
java
|
GuiDynamoStirling.java
|
Java
|
[] | null |
[] |
package snowpaw.teslapunk.client.gui;
import net.minecraft.entity.player.InventoryPlayer;
import snowpaw.teslapunk.common.inventory.ContainerDynamoStirling;
import snowpaw.teslapunk.common.tile.TileBase;
public class GuiDynamoStirling extends GuiBase {
public GuiDynamoStirling(InventoryPlayer inventoryPlayer, TileBase tile) {
super(inventoryPlayer, tile, new ContainerDynamoStirling(inventoryPlayer, tile));
}
@Override
public void drawBackground(float partialTicks, int mouseX, int mouseY) {
}
@Override
public void drawForeground(int mouseX, int mouseY) {
}
}
| 635
| 0.740157
| 0.740157
| 23
| 25.608696
| 30.211918
| 89
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.521739
| false
| false
|
2
|
fea98c31808788751b0e11dfae8121d44af9d82d
| 34,497,177,379,025
|
dd05af919a65e5e7f2d0e53dd691fc737e4d2130
|
/app/src/main/java/com/example/michel/sqlliteejem/splash.java
|
7f08f4927c44b594981efce5b5ff81d499a39631
|
[] |
no_license
|
michelclar/SqlLiteEjem
|
https://github.com/michelclar/SqlLiteEjem
|
d2da54828d9bed8017183ce45c6cb9947d663b36
|
3e465f4230998470e637403550f95a2c50fdc1a3
|
refs/heads/master
| 2021-01-10T06:37:40.671000
| 2015-11-28T13:31:58
| 2015-11-28T13:31:58
| 46,623,093
| 0
| 1
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.michel.sqlliteejem;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import java.util.Timer;
import java.util.TimerTask;
/**
* Created by Michel on 21/11/2015.
*/
public class splash extends Activity {
//set duration of the splash screen
private static final long SPLASH_SCREEN_DELAY = 2000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
//metodo para el timer del splash
TimerTask task = new TimerTask() {
@Override
public void run() {
//inicia la proxima actividad (MainActivity.class)
Intent myIntent = new Intent().setClass(
splash.this, MainActivity.class);
startActivity(myIntent);
//cerramos la actividad para que el usuario no se pueda devolver al splash screen
finish();
}
};
//simulamos el proceso de carga de datos, que se hace al iniciar la app
Timer timer = new Timer();
timer.schedule(task, SPLASH_SCREEN_DELAY);
}
}
|
UTF-8
|
Java
| 1,210
|
java
|
splash.java
|
Java
|
[
{
"context": "package com.example.michel.sqlliteejem;\n\nimport android.app.Activity;\nimport",
"end": 26,
"score": 0.6855713129043579,
"start": 20,
"tag": "USERNAME",
"value": "michel"
},
{
"context": "er;\nimport java.util.TimerTask;\n\n/**\n * Created by Michel on 21/11/2015.\n */\npublic class splash extends Ac",
"end": 205,
"score": 0.997338593006134,
"start": 199,
"tag": "NAME",
"value": "Michel"
}
] | null |
[] |
package com.example.michel.sqlliteejem;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import java.util.Timer;
import java.util.TimerTask;
/**
* Created by Michel on 21/11/2015.
*/
public class splash extends Activity {
//set duration of the splash screen
private static final long SPLASH_SCREEN_DELAY = 2000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
//metodo para el timer del splash
TimerTask task = new TimerTask() {
@Override
public void run() {
//inicia la proxima actividad (MainActivity.class)
Intent myIntent = new Intent().setClass(
splash.this, MainActivity.class);
startActivity(myIntent);
//cerramos la actividad para que el usuario no se pueda devolver al splash screen
finish();
}
};
//simulamos el proceso de carga de datos, que se hace al iniciar la app
Timer timer = new Timer();
timer.schedule(task, SPLASH_SCREEN_DELAY);
}
}
| 1,210
| 0.62562
| 0.615702
| 43
| 27.139534
| 24.131983
| 97
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.418605
| false
| false
|
2
|
aefc29e8439dee1996a08b7539d523f6399f8bbb
| 34,497,177,377,598
|
addcf0807ac14ce2766b4da01d84dc5bd939ff32
|
/devxschool/src/MirlanJuly/Practice1/LoopExc3.java
|
e0d871e9a3fa2cee6f49e4e790776e88be1797c9
|
[] |
no_license
|
Mirgul-Abdralieva/devXSchoolProject
|
https://github.com/Mirgul-Abdralieva/devXSchoolProject
|
e2f58158a92fe8780acd3ce0fc8382f0c0a79a2e
|
8a3b4fc41d3596f34a4b2265ba5ffd22c485c043
|
refs/heads/master
| 2022-12-23T14:26:11.423000
| 2020-09-29T14:37:48
| 2020-09-29T14:37:48
| 298,486,388
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package MirlanJuly.Practice1;
public class LoopExc3 {
public static void main(String[] args) {
long powerOfNum = power(2, 5);
System.out.println(powerOfNum);
}
public static void printMultTable(int number){
for (int i = 0; i <= 10; i++) {
System.out.println(number + "x" + i + "=" +(number*i));
}
}
public static long power(long number, int p) {
long result = 1;
for (int i = 1; i <=p; i++) {
result = result * number;
}
return result;
}
}
|
UTF-8
|
Java
| 602
|
java
|
LoopExc3.java
|
Java
|
[] | null |
[] |
package MirlanJuly.Practice1;
public class LoopExc3 {
public static void main(String[] args) {
long powerOfNum = power(2, 5);
System.out.println(powerOfNum);
}
public static void printMultTable(int number){
for (int i = 0; i <= 10; i++) {
System.out.println(number + "x" + i + "=" +(number*i));
}
}
public static long power(long number, int p) {
long result = 1;
for (int i = 1; i <=p; i++) {
result = result * number;
}
return result;
}
}
| 602
| 0.483389
| 0.468439
| 25
| 23.08
| 20.72278
| 71
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.52
| false
| false
|
2
|
9da73cb9c3cac8128d83a7c0b1d6b8d35d76a984
| 17,154,099,435,161
|
547ea9e9a15948b2ada0fb2cd33eb7960269b021
|
/src/main/java/xyz/yuxx/community/controller/HelloController.java
|
d54244d3e712493d515f91888048b43e521b7507
|
[] |
no_license
|
Hyxx-cx/community
|
https://github.com/Hyxx-cx/community
|
1c3760686adbf1e80d6702f49ffacb89625dac8d
|
010ff456860291615fecf0643b3c3610dce74985
|
refs/heads/master
| 2022-07-16T18:05:15.829000
| 2020-01-05T12:04:48
| 2020-01-05T12:04:48
| 226,875,247
| 0
| 0
| null | false
| 2022-01-21T23:35:09
| 2019-12-09T13:15:15
| 2020-01-05T12:05:02
| 2022-01-21T23:35:07
| 534
| 0
| 0
| 1
|
Java
| false
| false
|
package xyz.yuxx.community.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
public class HelloController {
/**
* @return
* @RequestParam:绑定请求中的参数; 自SpringMVC4.2之后,RequestParam内部多了一个name参数
* name和value是等价的,都是指定前台的参数名。二者只能存在一个,不能同时使用。
* required:该参数是否为必传项。默认是true,表示请求中一定要传入对应的参数
*/
@GetMapping("/greeting")
public String greeting(@RequestParam(value = "name", required = false, defaultValue = "world") String name, Model model) {
model.addAttribute("name", name);
return "greeting";
}
}
|
UTF-8
|
Java
| 898
|
java
|
HelloController.java
|
Java
|
[] | null |
[] |
package xyz.yuxx.community.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
public class HelloController {
/**
* @return
* @RequestParam:绑定请求中的参数; 自SpringMVC4.2之后,RequestParam内部多了一个name参数
* name和value是等价的,都是指定前台的参数名。二者只能存在一个,不能同时使用。
* required:该参数是否为必传项。默认是true,表示请求中一定要传入对应的参数
*/
@GetMapping("/greeting")
public String greeting(@RequestParam(value = "name", required = false, defaultValue = "world") String name, Model model) {
model.addAttribute("name", name);
return "greeting";
}
}
| 898
| 0.737637
| 0.73489
| 22
| 32.090908
| 29.886009
| 126
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.5
| false
| false
|
2
|
c968267d0f3c699f5aa2e70d71754698cc6e83cb
| 35,244,501,686,500
|
69db4c16a9da104e0aac49a6f7ef2719d196f6f1
|
/ee-domain/src/main/java/se/axel/service/LocalWisdomService.java
|
5eb0f961d207f8162329aae0a1139ef4d268e5bc
|
[] |
no_license
|
axelhjalm/ee7
|
https://github.com/axelhjalm/ee7
|
f83d8933ab7d31d3cfb2b373e0af95f77cde0cfa
|
36fe85286da86bf917c61199876fe53d0f783b51
|
refs/heads/master
| 2016-08-12T02:45:55.986000
| 2015-11-16T19:44:33
| 2015-11-16T19:44:33
| 46,232,077
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package se.axel.service;
import javax.ejb.Local;
import se.axel.domain.Wisdom;
@Local
public interface LocalWisdomService {
Wisdom getWisdom();
}
|
UTF-8
|
Java
| 151
|
java
|
LocalWisdomService.java
|
Java
|
[] | null |
[] |
package se.axel.service;
import javax.ejb.Local;
import se.axel.domain.Wisdom;
@Local
public interface LocalWisdomService {
Wisdom getWisdom();
}
| 151
| 0.768212
| 0.768212
| 11
| 12.727273
| 13.383102
| 37
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.454545
| false
| false
|
2
|
958ef284de296b3152bb57ace714d157d073b1fa
| 39,410,619,919,591
|
0ce71ad58312a7d9fc10e43a1147cf3229555974
|
/socialapp/src/main/java/org/socialapp/service/impl/FBUserServiceImpl.java
|
299fef89ae5cc8f418f54c83c00f4a062cac8cfb
|
[] |
no_license
|
vinodkumarjeeru/social-spm
|
https://github.com/vinodkumarjeeru/social-spm
|
bfc21bf8412f1c9c03bdea1bf03acfe057ca7bf1
|
ad2a1e42e15a48e3eed07dde2d1fc7f1afcefa1a
|
refs/heads/master
| 2018-12-29T19:19:05.246000
| 2014-04-10T08:46:06
| 2014-04-10T08:46:06
| 32,660,280
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
*
*/
package org.socialapp.service.impl;
import org.apache.log4j.Logger;
import org.hibernate.Query;
import org.socialapp.dao.FBUserDAO;
import org.socialapp.dao.impl.FBUserDAOImpl;
import org.socialapp.domain.sub.FBUser;
import org.socialapp.queries.SocialAppQueries;
import org.socialapp.service.FBUserService;
import org.socialapp.utils.HibernateUtils;
/**
* @author Sudarsan
*
*/
public class FBUserServiceImpl implements FBUserService {
private FBUserDAO fbUserDAO = new FBUserDAOImpl();
private static final Logger LOG = Logger.getLogger(FBUserServiceImpl.class);
/*
* (non-Javadoc)
*
* @see
* org.socialapp.service.FBUserService#create(org.socialapp.domain.sub.FBUser
* )
*/
@Override
public void create(FBUser fbUser) {
try {
HibernateUtils.beginTransaction();
fbUserDAO.save(fbUser);
HibernateUtils.commitTransaction();
} catch (Exception exception) {
LOG.debug("", exception);
}
}
/*
* (non-Javadoc)
*
* @see org.socialapp.service.FBUserService#findByFbId(java.lang.String)
*/
@Override
public FBUser findByFbId(String fbId) {
FBUser fbUser = null;
try {
HibernateUtils.beginTransaction();
Query query = HibernateUtils.currentSession()
.createQuery(SocialAppQueries.FBUSER_FIND_BY_FBID)
.setParameter("fbId", fbId);
fbUser = (FBUser) query.uniqueResult();
HibernateUtils.commitTransaction();
} catch (Exception exception) {
LOG.debug("", exception);
}
return fbUser;
}
}
|
UTF-8
|
Java
| 1,552
|
java
|
FBUserServiceImpl.java
|
Java
|
[
{
"context": "socialapp.utils.HibernateUtils;\r\n\r\n/**\r\n * @author Sudarsan\r\n * \r\n */\r\npublic class FBUserServiceImpl impleme",
"end": 403,
"score": 0.9855492115020752,
"start": 395,
"tag": "NAME",
"value": "Sudarsan"
}
] | null |
[] |
/**
*
*/
package org.socialapp.service.impl;
import org.apache.log4j.Logger;
import org.hibernate.Query;
import org.socialapp.dao.FBUserDAO;
import org.socialapp.dao.impl.FBUserDAOImpl;
import org.socialapp.domain.sub.FBUser;
import org.socialapp.queries.SocialAppQueries;
import org.socialapp.service.FBUserService;
import org.socialapp.utils.HibernateUtils;
/**
* @author Sudarsan
*
*/
public class FBUserServiceImpl implements FBUserService {
private FBUserDAO fbUserDAO = new FBUserDAOImpl();
private static final Logger LOG = Logger.getLogger(FBUserServiceImpl.class);
/*
* (non-Javadoc)
*
* @see
* org.socialapp.service.FBUserService#create(org.socialapp.domain.sub.FBUser
* )
*/
@Override
public void create(FBUser fbUser) {
try {
HibernateUtils.beginTransaction();
fbUserDAO.save(fbUser);
HibernateUtils.commitTransaction();
} catch (Exception exception) {
LOG.debug("", exception);
}
}
/*
* (non-Javadoc)
*
* @see org.socialapp.service.FBUserService#findByFbId(java.lang.String)
*/
@Override
public FBUser findByFbId(String fbId) {
FBUser fbUser = null;
try {
HibernateUtils.beginTransaction();
Query query = HibernateUtils.currentSession()
.createQuery(SocialAppQueries.FBUSER_FIND_BY_FBID)
.setParameter("fbId", fbId);
fbUser = (FBUser) query.uniqueResult();
HibernateUtils.commitTransaction();
} catch (Exception exception) {
LOG.debug("", exception);
}
return fbUser;
}
}
| 1,552
| 0.69201
| 0.691366
| 66
| 21.515152
| 21.093761
| 78
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.484848
| false
| false
|
2
|
09c420f904388b4427acc142be8f6515dfd2fb0f
| 37,950,331,056,311
|
7bfed71276d21f768604451e7b7db721b0e53a2c
|
/PotassiumOverload/core/src/com/cucubananas/core/AbstractScreen.java
|
107487384c0e01b5b6a0b4ba4f31defd7796845f
|
[] |
no_license
|
ka5p3rr/PotassiumOverload
|
https://github.com/ka5p3rr/PotassiumOverload
|
2911c4d7da6e4e78e0e543f17e2e5eee5e9cd579
|
f6e18e95eb1f9337683f785756faf86611e7d5e1
|
refs/heads/prod
| 2020-08-23T05:04:08.258000
| 2019-12-23T22:04:29
| 2019-12-23T22:04:29
| 216,549,417
| 0
| 0
| null | false
| 2019-12-23T22:04:31
| 2019-10-21T11:18:15
| 2019-12-17T13:44:37
| 2019-12-23T22:04:30
| 1,165
| 0
| 0
| 2
|
Java
| false
| false
|
package com.cucubananas.core;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
public abstract class AbstractScreen implements Screen {
final PotassiumOverload game;
protected OrthographicCamera camera;
protected SpriteBatch batch;
protected BitmapFont font;
int padding;
int state;
public AbstractScreen(PotassiumOverload game) {
this.game = game;
font = new BitmapFont();
batch = new SpriteBatch();
camera = new OrthographicCamera();
camera.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
padding = 50;
state = 0;
}
@Override
public void render(float delta) {
Gdx.gl.glClearColor(0, 0, 0.2f, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
camera.update();
batch.begin();
batch.end();
}
@Override
public void resize(int width, int height) {
}
@Override
public void show() {
}
@Override
public void pause() {
}
@Override
public void resume() {
}
@Override
public void hide() {
}
@Override
public void dispose() {
}
}
|
UTF-8
|
Java
| 1,441
|
java
|
AbstractScreen.java
|
Java
|
[] | null |
[] |
package com.cucubananas.core;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
public abstract class AbstractScreen implements Screen {
final PotassiumOverload game;
protected OrthographicCamera camera;
protected SpriteBatch batch;
protected BitmapFont font;
int padding;
int state;
public AbstractScreen(PotassiumOverload game) {
this.game = game;
font = new BitmapFont();
batch = new SpriteBatch();
camera = new OrthographicCamera();
camera.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
padding = 50;
state = 0;
}
@Override
public void render(float delta) {
Gdx.gl.glClearColor(0, 0, 0.2f, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
camera.update();
batch.begin();
batch.end();
}
@Override
public void resize(int width, int height) {
}
@Override
public void show() {
}
@Override
public void pause() {
}
@Override
public void resume() {
}
@Override
public void hide() {
}
@Override
public void dispose() {
}
}
| 1,441
| 0.607911
| 0.598196
| 69
| 18.884058
| 18.603052
| 84
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.449275
| false
| false
|
2
|
026462bb0cc867f4c0d31cfff4115d7f73ecf610
| 37,099,927,538,371
|
9ed2a7196ae84ae688a8d2b6814d90106381984e
|
/chapter04/Maven/Technique32/course-tracker-technique-32-end/src/main/java/com/manning/sbip/ch04/service/impl/GoogleRecaptchaService.java
|
422f9e63d7bbbab19d1d2b7cd09fa9644bff1b2a
|
[] |
no_license
|
musibs/spring-boot-in-practice
|
https://github.com/musibs/spring-boot-in-practice
|
22af29978cd739e23c15c4a22a9944522cd8f546
|
67bd3b834ea22c805aa4928b5e9b0eaef5f21568
|
refs/heads/master
| 2023-02-05T16:13:17.303000
| 2020-12-26T16:46:39
| 2020-12-26T16:46:39
| 280,906,950
| 3
| 1
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.manning.sbip.ch04.service.impl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import com.manning.sbip.ch04.dto.RecaptchaDto;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class GoogleRecaptchaService {
private static final String VERIFY_URL = "https://www.google.com/recaptcha/api/siteverify"
+ "?secret={secret}&remoteip={remoteip}&response={response}";
private final RestTemplate restTemplate;
@Value("${captcha.secret.key}")
private String secretKey;
public GoogleRecaptchaService(RestTemplate restTemplate) {
this.restTemplate=restTemplate;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
public RecaptchaDto verify(String ip, String recaptchaResponse) {
Map<String, String> request = new HashMap<>();
request.put("remoteip", ip);
request.put("secret", secretKey);
request.put("response", recaptchaResponse);
ResponseEntity<Map> response = restTemplate.getForEntity(VERIFY_URL, Map.class, request);
Map<String, Object> body = response.getBody();
boolean success = (Boolean)body.get("success");
RecaptchaDto recaptchaDto = new RecaptchaDto();
recaptchaDto.setSuccess(success);
if(!success) {
recaptchaDto.setErrors((List)body.get("error-codes"));
}
return recaptchaDto;
}
}
|
UTF-8
|
Java
| 1,445
|
java
|
GoogleRecaptchaService.java
|
Java
|
[] | null |
[] |
package com.manning.sbip.ch04.service.impl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import com.manning.sbip.ch04.dto.RecaptchaDto;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class GoogleRecaptchaService {
private static final String VERIFY_URL = "https://www.google.com/recaptcha/api/siteverify"
+ "?secret={secret}&remoteip={remoteip}&response={response}";
private final RestTemplate restTemplate;
@Value("${captcha.secret.key}")
private String secretKey;
public GoogleRecaptchaService(RestTemplate restTemplate) {
this.restTemplate=restTemplate;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
public RecaptchaDto verify(String ip, String recaptchaResponse) {
Map<String, String> request = new HashMap<>();
request.put("remoteip", ip);
request.put("secret", secretKey);
request.put("response", recaptchaResponse);
ResponseEntity<Map> response = restTemplate.getForEntity(VERIFY_URL, Map.class, request);
Map<String, Object> body = response.getBody();
boolean success = (Boolean)body.get("success");
RecaptchaDto recaptchaDto = new RecaptchaDto();
recaptchaDto.setSuccess(success);
if(!success) {
recaptchaDto.setErrors((List)body.get("error-codes"));
}
return recaptchaDto;
}
}
| 1,445
| 0.764014
| 0.761246
| 45
| 31.111111
| 24.789085
| 91
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.733333
| false
| false
|
2
|
51e8c9bfc6df3d65ca7f4a6ba96fea5f411ed049
| 15,023,795,645,333
|
fdd6dc38e8a9979bf525e7a968208159d7147b4c
|
/src/main/java/com/wj/service/UseFunctionService.java
|
5d77f73308e83fcf509e9de1a4e422e88e2ff786
|
[] |
no_license
|
ldrqc/wj_springBoot
|
https://github.com/ldrqc/wj_springBoot
|
6686d747cc48bcb09516dc41568dbf67459ee2fd
|
90b2bf4131cac30c8d1b323e15b06aa6afba70fe
|
refs/heads/master
| 2023-08-14T06:24:08.381000
| 2021-09-22T07:30:20
| 2021-09-22T07:30:52
| 409,043,590
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.wj.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @program: wj_springBoot
* @description: useFunctionService
* @author: wj
* @create: 2021-09-08 16:08
**/
@Service
public class UseFunctionService {
@Autowired
FunctionService functionService;
public String sayHelloWord(String word){
return functionService.sayHelloWord(word);
}
}
|
UTF-8
|
Java
| 453
|
java
|
UseFunctionService.java
|
Java
|
[
{
"context": "ot\n * @description: useFunctionService\n * @author: wj\n * @create: 2021-09-08 16:08\n **/\n@Service\npublic",
"end": 217,
"score": 0.9994622468948364,
"start": 215,
"tag": "USERNAME",
"value": "wj"
}
] | null |
[] |
package com.wj.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @program: wj_springBoot
* @description: useFunctionService
* @author: wj
* @create: 2021-09-08 16:08
**/
@Service
public class UseFunctionService {
@Autowired
FunctionService functionService;
public String sayHelloWord(String word){
return functionService.sayHelloWord(word);
}
}
| 453
| 0.739514
| 0.713024
| 21
| 20.571428
| 19.042738
| 62
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.238095
| false
| false
|
3
|
5c7fb7efc5859fa516b894ccf127f6527e444ab4
| 31,722,628,453,271
|
1514767fe308d89885e6a01a6a4ffb4e3e99df70
|
/BetweenTwoSets.java
|
d3b53b39e99f4db80766ec2bbb151fa1b8660cc3
|
[] |
no_license
|
MANOJ-KUMAR-PATNAIK/cts_datastructures_handson
|
https://github.com/MANOJ-KUMAR-PATNAIK/cts_datastructures_handson
|
5beb497ccb8376d6ede8f664164bb7edb5491108
|
b84cd9436c3876a708bc54d9c26c71e3e0a8233b
|
refs/heads/main
| 2023-03-30T00:12:54.942000
| 2021-03-19T10:06:53
| 2021-03-19T10:06:53
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.*;
import java.util.regex.*;
import java.util.stream.*;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;
class Result {
/*
* Complete the 'getTotalX' function below.
*
* The function is expected to return an INTEGER.
* The function accepts following parameters:
* 1. INTEGER_ARRAY a
* 2. INTEGER_ARRAY b
*/
static int gcd (int a, int b) {
if (b == 0)
return a;
else
return gcd (b, a % b);
}
public static int getTotalX(List<Integer> a, List<Integer> b) {
// Write your code here
int count=0;
int factor=a.get(a.size()-1);
int flag, f_gcd=a.get(0);
for(int i=1;i<a.size();i++) {
f_gcd = gcd(f_gcd,a.get(i));
}
while(factor<=b.get(0)){
flag=0;
for(int i=0;i<a.size();i++){
if(factor%a.get(i)!=0){
flag=1;
break;
}
}
if(flag==0){
for(int i=0;i<b.size();i++){
if(b.get(i)%factor!=0){
flag=1;
break;
}
}
}
if(flag==0){
count++;
}
factor+=f_gcd;
}
return count;
}
}
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));
String[] firstMultipleInput = bufferedReader.readLine().replaceAll("\\s+$", "").split(" ");
int n = Integer.parseInt(firstMultipleInput[0]);
int m = Integer.parseInt(firstMultipleInput[1]);
List<Integer> arr = Stream.of(bufferedReader.readLine().replaceAll("\\s+$", "").split(" "))
.map(Integer::parseInt)
.collect(toList());
List<Integer> brr = Stream.of(bufferedReader.readLine().replaceAll("\\s+$", "").split(" "))
.map(Integer::parseInt)
.collect(toList());
int total = Result.getTotalX(arr, brr);
bufferedWriter.write(String.valueOf(total));
bufferedWriter.newLine();
bufferedReader.close();
bufferedWriter.close();
}
}
|
UTF-8
|
Java
| 2,514
|
java
|
BetweenTwoSets.java
|
Java
|
[] | null |
[] |
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.*;
import java.util.regex.*;
import java.util.stream.*;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;
class Result {
/*
* Complete the 'getTotalX' function below.
*
* The function is expected to return an INTEGER.
* The function accepts following parameters:
* 1. INTEGER_ARRAY a
* 2. INTEGER_ARRAY b
*/
static int gcd (int a, int b) {
if (b == 0)
return a;
else
return gcd (b, a % b);
}
public static int getTotalX(List<Integer> a, List<Integer> b) {
// Write your code here
int count=0;
int factor=a.get(a.size()-1);
int flag, f_gcd=a.get(0);
for(int i=1;i<a.size();i++) {
f_gcd = gcd(f_gcd,a.get(i));
}
while(factor<=b.get(0)){
flag=0;
for(int i=0;i<a.size();i++){
if(factor%a.get(i)!=0){
flag=1;
break;
}
}
if(flag==0){
for(int i=0;i<b.size();i++){
if(b.get(i)%factor!=0){
flag=1;
break;
}
}
}
if(flag==0){
count++;
}
factor+=f_gcd;
}
return count;
}
}
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));
String[] firstMultipleInput = bufferedReader.readLine().replaceAll("\\s+$", "").split(" ");
int n = Integer.parseInt(firstMultipleInput[0]);
int m = Integer.parseInt(firstMultipleInput[1]);
List<Integer> arr = Stream.of(bufferedReader.readLine().replaceAll("\\s+$", "").split(" "))
.map(Integer::parseInt)
.collect(toList());
List<Integer> brr = Stream.of(bufferedReader.readLine().replaceAll("\\s+$", "").split(" "))
.map(Integer::parseInt)
.collect(toList());
int total = Result.getTotalX(arr, brr);
bufferedWriter.write(String.valueOf(total));
bufferedWriter.newLine();
bufferedReader.close();
bufferedWriter.close();
}
}
| 2,514
| 0.548528
| 0.540971
| 94
| 25.74468
| 23.952496
| 105
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.553191
| false
| false
|
3
|
dee2bf68dd295196f11d74ea5231bcd06fd0d171
| 3,023,657,004,922
|
08013d7d0042a921cd13b61a6e146eee4d8a0e59
|
/workspace/CircleShit/src/Shit.java
|
69e9eaa792a17d46099ae89200b05a15f1eb270b
|
[] |
no_license
|
handydani/COP3502
|
https://github.com/handydani/COP3502
|
e018475c9f5cb3f87345b8fc1b442d25faca0da3
|
a04331cb86fd6c4394e15354c72fc87ab414e688
|
refs/heads/master
| 2020-04-06T03:51:52.061000
| 2017-02-25T15:42:58
| 2017-02-25T15:42:58
| 83,141,858
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
public class Shit
{
private double radius;
public Shit()
{
radius = 0;
}
public Shit(double newRadius)
{
this.radius = newRadius;
}
double getArea()
{
return Math.PI * radius * radius;
}
double getPerimeter()
{
return 2 * Math.PI * radius;
}
public void setRadius(double newRadius)
{
this.radius = newRadius;
}
public static void main(String[] args)
{
}
}
|
UTF-8
|
Java
| 398
|
java
|
Shit.java
|
Java
|
[] | null |
[] |
public class Shit
{
private double radius;
public Shit()
{
radius = 0;
}
public Shit(double newRadius)
{
this.radius = newRadius;
}
double getArea()
{
return Math.PI * radius * radius;
}
double getPerimeter()
{
return 2 * Math.PI * radius;
}
public void setRadius(double newRadius)
{
this.radius = newRadius;
}
public static void main(String[] args)
{
}
}
| 398
| 0.633166
| 0.628141
| 32
| 11.40625
| 13.069189
| 40
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.21875
| false
| false
|
3
|
de144a81bc4f6459fe3729a0f0c2b6b42aaddc8c
| 23,261,542,884,176
|
cf1472b249ac36829997f62c422f01e1223bb34c
|
/app/src/main/java/com/weilay/pos/SendTicketBeginAvtivity.java
|
ce86b7c3549dde6a0111d5a20cbc4adf99659577
|
[] |
no_license
|
MaybeUreRight/ZhiFuKe
|
https://github.com/MaybeUreRight/ZhiFuKe
|
fe934471b7ed22b686089003658104f62831063b
|
59dfdc53d8066bcc70aa9a2a4dd4004638e7f889
|
refs/heads/master
| 2020-03-21T09:12:46.173000
| 2018-06-25T07:50:30
| 2018-06-25T07:50:30
| 138,388,179
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.weilay.pos;
import com.bumptech.glide.Glide;
import com.framework.utils.StringUtil;
import com.google.zxing.WriterException;
import com.weilay.pos.app.UrlDefine;
import com.weilay.pos.entity.SendTicketInfo;
import com.weilay.pos.titleactivity.TitleActivity;
import com.weilay.pos.util.EncodingHandler;
import com.weilay.pos.util.T;
import com.weilay.pos.util.USBComPort;
import android.app.Dialog;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.ImageView;
import android.widget.TextView;
public class SendTicketBeginAvtivity extends TitleActivity {
private ImageView logo_iv, ticket_qrcode_iv;
private TextView merchantName_tv, cardInfo_tv, date_tv, finish_tv,
sendticket_stock;
private SendTicketInfo sti;
private Dialog ticketBegin_dialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentLayout(R.layout.sendticketbegin_layout);
setTitle("发券");
sti = (SendTicketInfo) getIntent().getParcelableExtra("sti");
if(sti==null || StringUtil.isBank(sti.getUrl2qrcode())){
T.showCenter("获取不到卡券信息");
finish();
return;
}
init();
initDatas();
reg();
}
private void init() {
logo_iv = (ImageView) findViewById(R.id.merchantlogo_iv);
merchantName_tv = (TextView) findViewById(R.id.merchantname_tv);
cardInfo_tv = (TextView) findViewById(R.id.cardinfo_tv);
date_tv = (TextView) findViewById(R.id.sendticket_deadline);
ticket_qrcode_iv = (ImageView) findViewById(R.id.ticket_qrcode);
finish_tv = (TextView) findViewById(R.id.sendticket_finish);
finish_tv.setText("发券");
sendticket_stock = (TextView) findViewById(R.id.sendticket_stock);
ticketBegin_dialog = new Dialog(SendTicketBeginAvtivity.this,
android.R.style.Animation);
ticketBegin_dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
ticketBegin_dialog.setContentView(R.layout.sendticket_cardqr_layout);
}
private void initDatas(){
createQR(sti.getUrl2qrcode(),ticket_qrcode_iv);
finish_tv.setText("发券");
finish_tv.setEnabled(true);
}
private void reg() {
Glide.with(SendTicketBeginAvtivity.this).load(UrlDefine.BASE_URL + sti.getMerchantlogo()).into(logo_iv);
merchantName_tv.setText(sti.getMerchentname());
cardInfo_tv.setText(sti.getCardinfo());
date_tv.setText(sti.getDeadline());
sendticket_stock.setText(sti.getStock() + "张");
createQR(sti.getUrl2qrcode(), ticket_qrcode_iv);
finish_tv.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
USBComPort usbComPort = new USBComPort();
if (usbComPort.SendTicket(sti)) {
} else {
T.showCenter("打印失败!找不到打印机.");
}
}
});
}
private void createQR(String QRurl, ImageView iv) {
// 生成二维码图片,第一个参数是二维码的内容,第二个参数是正方形图片的边长,单位是像素
Bitmap qrcodeBitmap;
try {
qrcodeBitmap = EncodingHandler.createQRCode(QRurl, 700);
iv.setImageBitmap(qrcodeBitmap);
} catch (WriterException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
|
UTF-8
|
Java
| 3,321
|
java
|
SendTicketBeginAvtivity.java
|
Java
|
[] | null |
[] |
package com.weilay.pos;
import com.bumptech.glide.Glide;
import com.framework.utils.StringUtil;
import com.google.zxing.WriterException;
import com.weilay.pos.app.UrlDefine;
import com.weilay.pos.entity.SendTicketInfo;
import com.weilay.pos.titleactivity.TitleActivity;
import com.weilay.pos.util.EncodingHandler;
import com.weilay.pos.util.T;
import com.weilay.pos.util.USBComPort;
import android.app.Dialog;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.ImageView;
import android.widget.TextView;
public class SendTicketBeginAvtivity extends TitleActivity {
private ImageView logo_iv, ticket_qrcode_iv;
private TextView merchantName_tv, cardInfo_tv, date_tv, finish_tv,
sendticket_stock;
private SendTicketInfo sti;
private Dialog ticketBegin_dialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentLayout(R.layout.sendticketbegin_layout);
setTitle("发券");
sti = (SendTicketInfo) getIntent().getParcelableExtra("sti");
if(sti==null || StringUtil.isBank(sti.getUrl2qrcode())){
T.showCenter("获取不到卡券信息");
finish();
return;
}
init();
initDatas();
reg();
}
private void init() {
logo_iv = (ImageView) findViewById(R.id.merchantlogo_iv);
merchantName_tv = (TextView) findViewById(R.id.merchantname_tv);
cardInfo_tv = (TextView) findViewById(R.id.cardinfo_tv);
date_tv = (TextView) findViewById(R.id.sendticket_deadline);
ticket_qrcode_iv = (ImageView) findViewById(R.id.ticket_qrcode);
finish_tv = (TextView) findViewById(R.id.sendticket_finish);
finish_tv.setText("发券");
sendticket_stock = (TextView) findViewById(R.id.sendticket_stock);
ticketBegin_dialog = new Dialog(SendTicketBeginAvtivity.this,
android.R.style.Animation);
ticketBegin_dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
ticketBegin_dialog.setContentView(R.layout.sendticket_cardqr_layout);
}
private void initDatas(){
createQR(sti.getUrl2qrcode(),ticket_qrcode_iv);
finish_tv.setText("发券");
finish_tv.setEnabled(true);
}
private void reg() {
Glide.with(SendTicketBeginAvtivity.this).load(UrlDefine.BASE_URL + sti.getMerchantlogo()).into(logo_iv);
merchantName_tv.setText(sti.getMerchentname());
cardInfo_tv.setText(sti.getCardinfo());
date_tv.setText(sti.getDeadline());
sendticket_stock.setText(sti.getStock() + "张");
createQR(sti.getUrl2qrcode(), ticket_qrcode_iv);
finish_tv.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
USBComPort usbComPort = new USBComPort();
if (usbComPort.SendTicket(sti)) {
} else {
T.showCenter("打印失败!找不到打印机.");
}
}
});
}
private void createQR(String QRurl, ImageView iv) {
// 生成二维码图片,第一个参数是二维码的内容,第二个参数是正方形图片的边长,单位是像素
Bitmap qrcodeBitmap;
try {
qrcodeBitmap = EncodingHandler.createQRCode(QRurl, 700);
iv.setImageBitmap(qrcodeBitmap);
} catch (WriterException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| 3,321
| 0.746629
| 0.744748
| 103
| 29.961164
| 22.562931
| 106
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 2.174757
| false
| false
|
3
|
3fa09a787fe36252b4302380a18b411f57e43542
| 14,087,492,783,051
|
ab613205bdd4c14419c79695e32dff67c28f77d6
|
/servlet/src/main/java/org/zpli/listener/MyHttpSessionListener.java
|
39964f7e90ba1335eceabf17e74434bae1e110fc
|
[] |
no_license
|
zpli1991/LearnDemo
|
https://github.com/zpli1991/LearnDemo
|
2d7f1fc6d55d21d37620baba0f8e49aacf2a1251
|
f053256ffb2ca4affd89a98eabfdac852bc886b6
|
refs/heads/master
| 2021-02-16T19:40:47.109000
| 2020-08-20T09:29:50
| 2020-08-20T09:29:50
| 245,039,383
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.zpli.listener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
/**
* @Description: TODO
* @Copyright: Copyright © 深圳兆日科技股份有限公司(300333)
* @author: 李宗萍(0677)
* @Date: 2020/3/10 17:07
*/
public class MyHttpSessionListener implements HttpSessionListener {
@Override
public void sessionCreated(HttpSessionEvent se) {
System.out.println("--------------- MyHttpSessionListener 监听器启动 ---------------");
}
@Override
public void sessionDestroyed(HttpSessionEvent se) {
System.out.println("--------------- MyHttpSessionListener 监听器销毁 ---------------");
}
}
|
UTF-8
|
Java
| 709
|
java
|
MyHttpSessionListener.java
|
Java
|
[
{
"context": "ght: Copyright © 深圳兆日科技股份有限公司(300333)\n * @author: 李宗萍(0677)\n * @Date: 2020/3/10 17:07\n */\npublic class ",
"end": 209,
"score": 0.9997995495796204,
"start": 206,
"tag": "NAME",
"value": "李宗萍"
}
] | null |
[] |
package org.zpli.listener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
/**
* @Description: TODO
* @Copyright: Copyright © 深圳兆日科技股份有限公司(300333)
* @author: 李宗萍(0677)
* @Date: 2020/3/10 17:07
*/
public class MyHttpSessionListener implements HttpSessionListener {
@Override
public void sessionCreated(HttpSessionEvent se) {
System.out.println("--------------- MyHttpSessionListener 监听器启动 ---------------");
}
@Override
public void sessionDestroyed(HttpSessionEvent se) {
System.out.println("--------------- MyHttpSessionListener 监听器销毁 ---------------");
}
}
| 709
| 0.656923
| 0.624615
| 23
| 27.26087
| 28.125832
| 90
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.217391
| false
| false
|
3
|
bbcf0c3d99af11d284bc57419cf744ee37d04a18
| 14,087,492,785,336
|
2a0b4a117ab45af859de5360af7b9d61fec47958
|
/src/mx/uatx/curriculums/dto/RegistroEmpleadoDTO.java
|
8be7e3a41a00c5bd938d94e87c4a3a5dcbd1072d
|
[] |
no_license
|
gustavo102/SACVuamcc
|
https://github.com/gustavo102/SACVuamcc
|
471642b3500e18d7801282d6af8586b1aa354c05
|
a5459b4788a5c91b0437b8c0197bf8969146260b
|
refs/heads/master
| 2021-01-16T23:16:01.318000
| 2015-10-03T05:15:58
| 2015-10-03T05:15:58
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package mx.uatx.curriculums.dto;
public class RegistroEmpleadoDTO {
int idEmpleado;
String nombre;
String ap;
String am;
String numeroE;
String contrasena;
String correo;
String desclic1;
int idRol;
int idLicenciatura;
int estatus;
String descripcion;
int idLic;
String descripcionLic;
int idRol1;
String descripcionRol;
public String getDesclic1() {
return desclic1;
}
public void setDesclic1(String desclic1) {
this.desclic1 = desclic1;
}
public int getIdLicenciatura() {
return idLicenciatura;
}
public void setIdLicenciatura(int idLicenciatura) {
this.idLicenciatura = idLicenciatura;
}
public int getIdRol1() {
return idRol1;
}
public void setIdRol1(int idRol1) {
this.idRol1 = idRol1;
}
public String getDescripcionRol() {
return descripcionRol;
}
public void setDescripcionRol(String descripcionRol) {
this.descripcionRol = descripcionRol;
}
public int getIdLic() {
return idLic;
}
public void setIdLic(int idLic) {
this.idLic = idLic;
}
public String getDescripcionLic() {
return descripcionLic;
}
public void setDescripcionLic(String descripcionLic) {
this.descripcionLic = descripcionLic;
}
public int getIdEmpleado() {
return idEmpleado;
}
public void setIdEmpleado(int idEmpleado) {
this.idEmpleado = idEmpleado;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getAp() {
return ap;
}
public void setAp(String ap) {
this.ap = ap;
}
public String getAm() {
return am;
}
public void setAm(String am) {
this.am = am;
}
public String getNumeroE() {
return numeroE;
}
public void setNumeroE(String numeroE) {
this.numeroE = numeroE;
}
public String getContrasena() {
return contrasena;
}
public void setContrasena(String contrasena) {
this.contrasena = contrasena;
}
public String getCorreo() {
return correo;
}
public void setCorreo(String correo) {
this.correo = correo;
}
public int getIdRol() {
return idRol;
}
public void setIdRol(int idRol) {
this.idRol = idRol;
}
public int getEstatus() {
return estatus;
}
public void setEstatus(int estatus) {
this.estatus = estatus;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
}
|
UTF-8
|
Java
| 2,244
|
java
|
RegistroEmpleadoDTO.java
|
Java
|
[] | null |
[] |
package mx.uatx.curriculums.dto;
public class RegistroEmpleadoDTO {
int idEmpleado;
String nombre;
String ap;
String am;
String numeroE;
String contrasena;
String correo;
String desclic1;
int idRol;
int idLicenciatura;
int estatus;
String descripcion;
int idLic;
String descripcionLic;
int idRol1;
String descripcionRol;
public String getDesclic1() {
return desclic1;
}
public void setDesclic1(String desclic1) {
this.desclic1 = desclic1;
}
public int getIdLicenciatura() {
return idLicenciatura;
}
public void setIdLicenciatura(int idLicenciatura) {
this.idLicenciatura = idLicenciatura;
}
public int getIdRol1() {
return idRol1;
}
public void setIdRol1(int idRol1) {
this.idRol1 = idRol1;
}
public String getDescripcionRol() {
return descripcionRol;
}
public void setDescripcionRol(String descripcionRol) {
this.descripcionRol = descripcionRol;
}
public int getIdLic() {
return idLic;
}
public void setIdLic(int idLic) {
this.idLic = idLic;
}
public String getDescripcionLic() {
return descripcionLic;
}
public void setDescripcionLic(String descripcionLic) {
this.descripcionLic = descripcionLic;
}
public int getIdEmpleado() {
return idEmpleado;
}
public void setIdEmpleado(int idEmpleado) {
this.idEmpleado = idEmpleado;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getAp() {
return ap;
}
public void setAp(String ap) {
this.ap = ap;
}
public String getAm() {
return am;
}
public void setAm(String am) {
this.am = am;
}
public String getNumeroE() {
return numeroE;
}
public void setNumeroE(String numeroE) {
this.numeroE = numeroE;
}
public String getContrasena() {
return contrasena;
}
public void setContrasena(String contrasena) {
this.contrasena = contrasena;
}
public String getCorreo() {
return correo;
}
public void setCorreo(String correo) {
this.correo = correo;
}
public int getIdRol() {
return idRol;
}
public void setIdRol(int idRol) {
this.idRol = idRol;
}
public int getEstatus() {
return estatus;
}
public void setEstatus(int estatus) {
this.estatus = estatus;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
}
| 2,244
| 0.754011
| 0.747772
| 126
| 16.809525
| 14.63943
| 54
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.642857
| false
| false
|
3
|
40241f933bb24694b7bb06d527f1d27fd28a573c
| 4,277,787,427,972
|
6a9c79a9efd354225c9c7f84588685b9047df17c
|
/src/main/java/subaraki/umbralux/item/armor/model/ModelNecromancerArmor.java
|
ef46a2814d6c395e5a1f4eb5f8e981c283ba5538
|
[] |
no_license
|
Aaron1011/Rpg-Addon-UmbraLux
|
https://github.com/Aaron1011/Rpg-Addon-UmbraLux
|
7e3df5bef57d98956edfea5a2dc5df838dda683c
|
ba5dcb8b5f610f711f3ae899503f9d8f015ef6eb
|
refs/heads/master
| 2020-03-19T04:34:55.433000
| 2018-01-27T09:11:50
| 2018-01-27T09:11:50
| 135,843,931
| 0
| 0
| null | true
| 2018-06-02T18:51:45
| 2018-06-02T18:51:44
| 2017-05-07T03:15:26
| 2018-01-27T09:12:01
| 152
| 0
| 0
| 0
| null | false
| null |
package subaraki.umbralux.item.armor.model;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelNecromancerArmor extends ModelBiped {
// fields
private ModelRenderer head;
private ModelRenderer body;
private ModelRenderer rightarm;
private ModelRenderer leftarm;
private ModelRenderer rightleg;
private ModelRenderer leftleg;
private ModelRenderer Spaulder_1;
private ModelRenderer Spaulder_2;
private ModelRenderer Shape3;
private ModelRenderer ToeTipR;
private ModelRenderer Shape5;
private ModelRenderer ToeTipL;
private ModelRenderer TieTop;
private ModelRenderer TieBottom;
public ModelNecromancerArmor(float par1) {
super(par1, 0, 65, 64);
textureWidth = 65;
textureHeight = 64;
Spaulder_1 = new ModelRenderer(this, 0, 32);
Spaulder_1.addBox(0F, -2F, -2.5F, 5, 1, 5, par1 / 1.9f);
Spaulder_1.setRotationPoint(0F, 0F, 0F);
Spaulder_1.setTextureSize(65, 64);
Spaulder_1.mirror = true;
setRotation(Spaulder_1, 0F, 0F, 0.5235988F);
Spaulder_2 = new ModelRenderer(this, 0, 32);
Spaulder_2.addBox(0F, 0F, -2.5F, 5, 1, 5, par1 / 1.9f);
Spaulder_2.setRotationPoint(0F, 0F, 0F);
Spaulder_2.setTextureSize(65, 64);
Spaulder_2.mirror = true;
setRotation(Spaulder_2, 0F, 0F, 0.7872665F);
Shape3 = new ModelRenderer(this, 0, 41);
Shape3.addBox(-2.5F, 5F, -2.5F, 5, 2, 5, par1 / 1.5f);
Shape3.setRotationPoint(0F, 0F, 0F);
Shape3.setTextureSize(65, 64);
Shape3.mirror = true;
setRotation(Shape3, 0F, 0F, 0F);
Shape5 = new ModelRenderer(this, 0, 41);
Shape5.addBox(-2.5F, 5F, -2.5F, 5, 2, 5, par1 / 1.5f);
Shape5.setRotationPoint(0F, 0F, 0F);
Shape5.setTextureSize(65, 64);
Shape5.mirror = true;
setRotation(Shape5, 0F, 0F, 0F);
ToeTipR = new ModelRenderer(this, 0, 38);
ToeTipR.addBox(-2F, 11F, -4F, 4, 2, 1);
ToeTipR.setRotationPoint(0F, 0F, 0F);
ToeTipR.setTextureSize(65, 64);
ToeTipR.mirror = true;
setRotation(ToeTipR, 0F, 0F, 0F);
ToeTipL = new ModelRenderer(this, 0, 38);
ToeTipL.addBox(-2F, 11F, -4F, 4, 2, 1);
ToeTipL.setRotationPoint(0F, 0F, 0F);
ToeTipL.setTextureSize(65, 64);
ToeTipL.mirror = true;
setRotation(ToeTipL, 0F, 0F, 0F);
TieTop = new ModelRenderer(this, 22, 32);
TieTop.addBox(1F, 1F, -3.5F, 1, 1, 1);
TieTop.setRotationPoint(0F, 0F, 0F);
TieTop.setTextureSize(65, 64);
TieTop.mirror = true;
setRotation(TieTop, 0F, 0F, 0.7853982F);
TieBottom = new ModelRenderer(this, 22, 34);
TieBottom.addBox(-0.5F, 2.5F, -3.4F, 1, 5, 1);
TieBottom.setRotationPoint(0F, 0F, 0F);
TieBottom.setTextureSize(65, 64);
TieBottom.mirror = true;
setRotation(TieBottom, 0F, 0F, 0F);
bipedBody.addChild(TieBottom);
bipedBody.addChild(TieTop);
bipedRightLeg.addChild(ToeTipR);
bipedRightLeg.addChild(Shape3);
bipedLeftLeg.addChild(Shape5);
bipedLeftLeg.addChild(ToeTipL);
bipedLeftArm.addChild(Spaulder_1);
bipedLeftArm.addChild(Spaulder_2);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3,
float f4, float f5) {
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
this.bipedHead.isHidden = true;
}
private void setRotation(ModelRenderer model, float x, float y, float z) {
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}
|
UTF-8
|
Java
| 3,382
|
java
|
ModelNecromancerArmor.java
|
Java
|
[] | null |
[] |
package subaraki.umbralux.item.armor.model;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelNecromancerArmor extends ModelBiped {
// fields
private ModelRenderer head;
private ModelRenderer body;
private ModelRenderer rightarm;
private ModelRenderer leftarm;
private ModelRenderer rightleg;
private ModelRenderer leftleg;
private ModelRenderer Spaulder_1;
private ModelRenderer Spaulder_2;
private ModelRenderer Shape3;
private ModelRenderer ToeTipR;
private ModelRenderer Shape5;
private ModelRenderer ToeTipL;
private ModelRenderer TieTop;
private ModelRenderer TieBottom;
public ModelNecromancerArmor(float par1) {
super(par1, 0, 65, 64);
textureWidth = 65;
textureHeight = 64;
Spaulder_1 = new ModelRenderer(this, 0, 32);
Spaulder_1.addBox(0F, -2F, -2.5F, 5, 1, 5, par1 / 1.9f);
Spaulder_1.setRotationPoint(0F, 0F, 0F);
Spaulder_1.setTextureSize(65, 64);
Spaulder_1.mirror = true;
setRotation(Spaulder_1, 0F, 0F, 0.5235988F);
Spaulder_2 = new ModelRenderer(this, 0, 32);
Spaulder_2.addBox(0F, 0F, -2.5F, 5, 1, 5, par1 / 1.9f);
Spaulder_2.setRotationPoint(0F, 0F, 0F);
Spaulder_2.setTextureSize(65, 64);
Spaulder_2.mirror = true;
setRotation(Spaulder_2, 0F, 0F, 0.7872665F);
Shape3 = new ModelRenderer(this, 0, 41);
Shape3.addBox(-2.5F, 5F, -2.5F, 5, 2, 5, par1 / 1.5f);
Shape3.setRotationPoint(0F, 0F, 0F);
Shape3.setTextureSize(65, 64);
Shape3.mirror = true;
setRotation(Shape3, 0F, 0F, 0F);
Shape5 = new ModelRenderer(this, 0, 41);
Shape5.addBox(-2.5F, 5F, -2.5F, 5, 2, 5, par1 / 1.5f);
Shape5.setRotationPoint(0F, 0F, 0F);
Shape5.setTextureSize(65, 64);
Shape5.mirror = true;
setRotation(Shape5, 0F, 0F, 0F);
ToeTipR = new ModelRenderer(this, 0, 38);
ToeTipR.addBox(-2F, 11F, -4F, 4, 2, 1);
ToeTipR.setRotationPoint(0F, 0F, 0F);
ToeTipR.setTextureSize(65, 64);
ToeTipR.mirror = true;
setRotation(ToeTipR, 0F, 0F, 0F);
ToeTipL = new ModelRenderer(this, 0, 38);
ToeTipL.addBox(-2F, 11F, -4F, 4, 2, 1);
ToeTipL.setRotationPoint(0F, 0F, 0F);
ToeTipL.setTextureSize(65, 64);
ToeTipL.mirror = true;
setRotation(ToeTipL, 0F, 0F, 0F);
TieTop = new ModelRenderer(this, 22, 32);
TieTop.addBox(1F, 1F, -3.5F, 1, 1, 1);
TieTop.setRotationPoint(0F, 0F, 0F);
TieTop.setTextureSize(65, 64);
TieTop.mirror = true;
setRotation(TieTop, 0F, 0F, 0.7853982F);
TieBottom = new ModelRenderer(this, 22, 34);
TieBottom.addBox(-0.5F, 2.5F, -3.4F, 1, 5, 1);
TieBottom.setRotationPoint(0F, 0F, 0F);
TieBottom.setTextureSize(65, 64);
TieBottom.mirror = true;
setRotation(TieBottom, 0F, 0F, 0F);
bipedBody.addChild(TieBottom);
bipedBody.addChild(TieTop);
bipedRightLeg.addChild(ToeTipR);
bipedRightLeg.addChild(Shape3);
bipedLeftLeg.addChild(Shape5);
bipedLeftLeg.addChild(ToeTipL);
bipedLeftArm.addChild(Spaulder_1);
bipedLeftArm.addChild(Spaulder_2);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3,
float f4, float f5) {
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
this.bipedHead.isHidden = true;
}
private void setRotation(ModelRenderer model, float x, float y, float z) {
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}
| 3,382
| 0.711709
| 0.635719
| 104
| 31.528847
| 15.927695
| 75
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 3.557692
| false
| false
|
3
|
4344293ed7d1f09f3b4f59fa9759c6630bb9032f
| 23,484,881,240,988
|
7e55187149366c6cde7fd0907aee3ace6e3f9d20
|
/AutoAndUnboxingChallengeOne/src/com/projekt2501/Bank.java
|
ebb4609cb394bc0eedbf70082120e2a14c752144
|
[] |
no_license
|
adamyi87/JavaComplete
|
https://github.com/adamyi87/JavaComplete
|
d2574811bc0fcdd855fdf6a3d242dbedb6a03312
|
7161f86d8cb1d0a64c9d895fe3fb5199b997ed33
|
refs/heads/master
| 2016-08-12T08:14:04.148000
| 2016-02-17T20:04:42
| 2016-02-17T20:04:42
| 48,669,991
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.projekt2501;
import java.util.ArrayList;
/**
* Created by ay-sam on 2/4/16.
*/
public class Bank {
private String name;
private ArrayList<Branch> branches;
//GETTERS
public String getName(){
return this.name;
}
public ArrayList<Branch> getBranches(){
return this.branches;
}
public Bank(String name){
this.name = name;
this.branches = new ArrayList<Branch>();
}
//PUBLIC METHODS
public boolean addBranch(String branchName){
if(findBranch(branchName) == null){
branches.add(new Branch(branchName));
return true;
}
return false;
}
public boolean addCustomer(String branchName, String customerName, double amount){
Branch foundBranch = findBranch(branchName);
if(foundBranch != null){
return foundBranch.newCustomers(customerName, amount);
}
return false;
}
public boolean addCustomerTransaction(String branchName, String customerName, double amount){
Branch foundBranch = findBranch(branchName);
if(foundBranch != null){
return foundBranch.addCustomerTransaction(customerName, amount);
}
else{
return false;
}
}
public boolean listCustomers(String branchName, boolean showTransactions){
Branch foundBranch = findBranch(branchName);
if(foundBranch != null){
System.out.println("Customer details for branch: " + foundBranch.getName());
ArrayList<Customer> branchCustomers = foundBranch.getMyCustomers();
for(int i=0; i<branchCustomers.size(); i++){
Customer foundCustomer = branchCustomers.get(i);
System.out.println("Customer: " + foundCustomer.getName() + "[" + i + "]");
if(showTransactions){
System.out.println("Transactions");
ArrayList<Double> transactions = foundCustomer.getTransactions();
for(int j=0; j<transactions.size(); j++){
System.out.println("[" + (j+1) + "] Amount: " + transactions.get(j));
}
}
}
return true;
}
else{
return false;
}
}
public Branch findBranch(String name){
for(int i=0; i<branches.size(); i++){
Branch foundBranch = branches.get(i);
if(foundBranch.getName().equalsIgnoreCase(name)){
return foundBranch;
}
}
return null;
}
public void showBranches(){
if(branches.size() == 0){
System.out.println("There are not current branches.");
}
else{
for(int i=0; i<branches.size(); i++){
System.out.println((i+1) + ". " + branches.get(i).getName());
}
}
}
}
|
UTF-8
|
Java
| 2,919
|
java
|
Bank.java
|
Java
|
[
{
"context": "1;\n\nimport java.util.ArrayList;\n\n/**\n * Created by ay-sam on 2/4/16.\n */\npublic class Bank {\n private St",
"end": 79,
"score": 0.9997141361236572,
"start": 73,
"tag": "USERNAME",
"value": "ay-sam"
}
] | null |
[] |
package com.projekt2501;
import java.util.ArrayList;
/**
* Created by ay-sam on 2/4/16.
*/
public class Bank {
private String name;
private ArrayList<Branch> branches;
//GETTERS
public String getName(){
return this.name;
}
public ArrayList<Branch> getBranches(){
return this.branches;
}
public Bank(String name){
this.name = name;
this.branches = new ArrayList<Branch>();
}
//PUBLIC METHODS
public boolean addBranch(String branchName){
if(findBranch(branchName) == null){
branches.add(new Branch(branchName));
return true;
}
return false;
}
public boolean addCustomer(String branchName, String customerName, double amount){
Branch foundBranch = findBranch(branchName);
if(foundBranch != null){
return foundBranch.newCustomers(customerName, amount);
}
return false;
}
public boolean addCustomerTransaction(String branchName, String customerName, double amount){
Branch foundBranch = findBranch(branchName);
if(foundBranch != null){
return foundBranch.addCustomerTransaction(customerName, amount);
}
else{
return false;
}
}
public boolean listCustomers(String branchName, boolean showTransactions){
Branch foundBranch = findBranch(branchName);
if(foundBranch != null){
System.out.println("Customer details for branch: " + foundBranch.getName());
ArrayList<Customer> branchCustomers = foundBranch.getMyCustomers();
for(int i=0; i<branchCustomers.size(); i++){
Customer foundCustomer = branchCustomers.get(i);
System.out.println("Customer: " + foundCustomer.getName() + "[" + i + "]");
if(showTransactions){
System.out.println("Transactions");
ArrayList<Double> transactions = foundCustomer.getTransactions();
for(int j=0; j<transactions.size(); j++){
System.out.println("[" + (j+1) + "] Amount: " + transactions.get(j));
}
}
}
return true;
}
else{
return false;
}
}
public Branch findBranch(String name){
for(int i=0; i<branches.size(); i++){
Branch foundBranch = branches.get(i);
if(foundBranch.getName().equalsIgnoreCase(name)){
return foundBranch;
}
}
return null;
}
public void showBranches(){
if(branches.size() == 0){
System.out.println("There are not current branches.");
}
else{
for(int i=0; i<branches.size(); i++){
System.out.println((i+1) + ". " + branches.get(i).getName());
}
}
}
}
| 2,919
| 0.557383
| 0.552244
| 94
| 30.053192
| 26.251795
| 97
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.5
| false
| false
|
3
|
dbb0cbaa186f2cee8276e9bd945039561e680f72
| 27,599,459,857,906
|
b37cbef35c1aad17f563a05b3d4f596ee52ea2db
|
/app/src/main/java/Fragment/QuillList.java
|
f19b9106ec3860ea0be714d64199842899a3e1cb
|
[] |
no_license
|
pyxler/QuillcityV3
|
https://github.com/pyxler/QuillcityV3
|
18811c22d599a2c07e35e4976f216365ae0554f7
|
fa1e4022073d00b9e3bc97ab003966fa93cfb77a
|
refs/heads/master
| 2021-01-01T18:29:36.557000
| 2015-02-22T05:19:29
| 2015-02-22T05:19:29
| 31,146,459
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package Fragment;
import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import com.example.peter.quillcityv3.R;
import java.util.ArrayList;
import Adapter.PoemAdapter;
import Model.Poem;
/**
* A simple {@link Fragment} subclass.
*/
public class QuillList extends Fragment {
Selection mListener;
/* Fields */
private static volatile QuillList instance;
private ArrayList<Poem> mPoems;
public static QuillList getInstance(){
if(instance == null)
instance = new QuillList();
return instance;
}
public QuillList() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_quill_list, container, false);
}
@Override
public void onActivityCreated(Bundle savedInstanceStates){
super.onActivityCreated(savedInstanceStates);
mListener = (Selection) getActivity();
mPoems = new ArrayList<Poem>();
mPoems.add(new Poem("The person sitting across you in the bus","Hey, you look cute!"));
mPoems.add(new Poem("Shakespeare", "All the world's a stage and all the men and women merely players"));
mPoems.add(new Poem("Shakespeare", "Tomorrow and Tomorrow and Tomorrow Creeps in this petty pace from day to day to the last syllable of recorded time"));
mPoems.add(new Poem("Napoleon","Je ne suis pas mechant, je suis vainqueur"));
mPoems.add(new Poem("Jules Cesar","Je suis venu, J'ai vu, J'ai vaincu"));
//declares list view
ListView listView = (ListView) getActivity().findViewById(R.id.quill_listview);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
mListener.Selected(mPoems.get(position));
}
});
//adapter
PoemAdapter poemAdapter = new PoemAdapter(getActivity().getBaseContext(), mPoems);
listView.setAdapter(poemAdapter);
}
public interface Selection{
public void Selected(Poem poem);
}
}
|
UTF-8
|
Java
| 2,485
|
java
|
QuillList.java
|
Java
|
[
{
"context": ", you look cute!\"));\n mPoems.add(new Poem(\"Shakespeare\", \"All the world's a stage and all the men and wo",
"end": 1436,
"score": 0.9957560300827026,
"start": 1425,
"tag": "NAME",
"value": "Shakespeare"
},
{
"context": "n merely players\"));\n mPoems.add(new Poem(\"Shakespeare\", \"Tomorrow and Tomorrow and Tomorrow Creeps in t",
"end": 1549,
"score": 0.9977370500564575,
"start": 1538,
"tag": "NAME",
"value": "Shakespeare"
},
{
"context": "of recorded time\"));\n mPoems.add(new Poem(\"Napoleon\",\"Je ne suis pas mechant, je suis vainqueur\"));\n ",
"end": 1709,
"score": 0.9993651509284973,
"start": 1701,
"tag": "NAME",
"value": "Napoleon"
},
{
"context": "e suis vainqueur\"));\n mPoems.add(new Poem(\"Jules Cesar\",\"Je suis venu, J'ai vu, J'ai vaincu\"));\n\n\n ",
"end": 1798,
"score": 0.9998235702514648,
"start": 1787,
"tag": "NAME",
"value": "Jules Cesar"
}
] | null |
[] |
package Fragment;
import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import com.example.peter.quillcityv3.R;
import java.util.ArrayList;
import Adapter.PoemAdapter;
import Model.Poem;
/**
* A simple {@link Fragment} subclass.
*/
public class QuillList extends Fragment {
Selection mListener;
/* Fields */
private static volatile QuillList instance;
private ArrayList<Poem> mPoems;
public static QuillList getInstance(){
if(instance == null)
instance = new QuillList();
return instance;
}
public QuillList() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_quill_list, container, false);
}
@Override
public void onActivityCreated(Bundle savedInstanceStates){
super.onActivityCreated(savedInstanceStates);
mListener = (Selection) getActivity();
mPoems = new ArrayList<Poem>();
mPoems.add(new Poem("The person sitting across you in the bus","Hey, you look cute!"));
mPoems.add(new Poem("Shakespeare", "All the world's a stage and all the men and women merely players"));
mPoems.add(new Poem("Shakespeare", "Tomorrow and Tomorrow and Tomorrow Creeps in this petty pace from day to day to the last syllable of recorded time"));
mPoems.add(new Poem("Napoleon","Je ne suis pas mechant, je suis vainqueur"));
mPoems.add(new Poem("<NAME>","Je suis venu, J'ai vu, J'ai vaincu"));
//declares list view
ListView listView = (ListView) getActivity().findViewById(R.id.quill_listview);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
mListener.Selected(mPoems.get(position));
}
});
//adapter
PoemAdapter poemAdapter = new PoemAdapter(getActivity().getBaseContext(), mPoems);
listView.setAdapter(poemAdapter);
}
public interface Selection{
public void Selected(Poem poem);
}
}
| 2,480
| 0.672032
| 0.67163
| 87
| 27.563219
| 31.815813
| 162
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.563218
| false
| false
|
3
|
79a75e76c16af2e93378fb101277f92cff27919e
| 2,551,210,579,834
|
ca786eb78f5c686ee70ab6de95391ead1cb7f6da
|
/test/level20/lesson10/bonus01/Solution.java
|
caebbd06f6d6b48f42c9e9610a758a3aa2007a25
|
[] |
no_license
|
serandver/javarush_course
|
https://github.com/serandver/javarush_course
|
1a23cebfecc2b8b850984ef76c8d9ea82a1719a2
|
46db17183be655c1e89883868278f4bba80fcf6b
|
refs/heads/master
| 2015-08-21T00:57:57.571000
| 2015-08-10T14:27:27
| 2015-08-10T14:27:27
| 31,425,576
| 0
| 1
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.javarush.test.level20.lesson10.bonus01;
import java.util.*;
/* Алгоритмы-числа
Число S состоит из M чисел, например, S=370 и M(количество цифр)=3
Реализовать логику метода getNumbers, который должен среди натуральных чисел меньше N (long)
находить все числа, удовлетворяющие следующему критерию:
число S равно сумме его цифр, возведенных в M степень
getNumbers должен возвращать все такие числа в порядке возрастания
Пример искомого числа:
370 = 3*3*3 + 7*7*7 + 0*0*0
8208 = 8*8*8*8 + 2*2*2*2 + 0*0*0*0 + 8*8*8*8
На выполнение дается 10 секунд и 50 МБ памяти.
*/
public class Solution {
public static int[] getNumbers(int N) {
int[] result = null;
List<Integer> list = new ArrayList<>();
for (int n = 1; n< N; n++){
int sum = 0, temp, r;
int q=0;
temp = n;
int length = (int)(Math.log10(n)+1);
while( temp != 0 )
{
for (int i = 0; i< length; i++) {
int prod = 1;
r = temp%10;
for(int j = 0; j< length; j++){
prod = prod *r;
}
sum = sum + prod;
temp = temp/10;
}
}
if ( n == sum ){list.add(n);}
}
result = new int[list.size()];
for (int i = 0; i < list.size(); i++) {
result[i] = list.get(i);
}
return result;
}
public static void main (String[] args) {
long timeStart = System.currentTimeMillis();
long memoryStart = Runtime.getRuntime().freeMemory();
int[] ints = getNumbers(146511208);
for (int i: ints) {
System.out.println(i);
}
long timeEnd = System.currentTimeMillis();
long memoryEnd = Runtime.getRuntime().freeMemory();
long time = timeEnd - timeStart;
long memory = (memoryStart - memoryEnd) / 1024;
System.out.println(String.format("Time: %d ms", time));
System.out.println(String.format("Memory: %d KB", memory));
}
}
|
UTF-8
|
Java
| 2,424
|
java
|
Solution.java
|
Java
|
[] | null |
[] |
package com.javarush.test.level20.lesson10.bonus01;
import java.util.*;
/* Алгоритмы-числа
Число S состоит из M чисел, например, S=370 и M(количество цифр)=3
Реализовать логику метода getNumbers, который должен среди натуральных чисел меньше N (long)
находить все числа, удовлетворяющие следующему критерию:
число S равно сумме его цифр, возведенных в M степень
getNumbers должен возвращать все такие числа в порядке возрастания
Пример искомого числа:
370 = 3*3*3 + 7*7*7 + 0*0*0
8208 = 8*8*8*8 + 2*2*2*2 + 0*0*0*0 + 8*8*8*8
На выполнение дается 10 секунд и 50 МБ памяти.
*/
public class Solution {
public static int[] getNumbers(int N) {
int[] result = null;
List<Integer> list = new ArrayList<>();
for (int n = 1; n< N; n++){
int sum = 0, temp, r;
int q=0;
temp = n;
int length = (int)(Math.log10(n)+1);
while( temp != 0 )
{
for (int i = 0; i< length; i++) {
int prod = 1;
r = temp%10;
for(int j = 0; j< length; j++){
prod = prod *r;
}
sum = sum + prod;
temp = temp/10;
}
}
if ( n == sum ){list.add(n);}
}
result = new int[list.size()];
for (int i = 0; i < list.size(); i++) {
result[i] = list.get(i);
}
return result;
}
public static void main (String[] args) {
long timeStart = System.currentTimeMillis();
long memoryStart = Runtime.getRuntime().freeMemory();
int[] ints = getNumbers(146511208);
for (int i: ints) {
System.out.println(i);
}
long timeEnd = System.currentTimeMillis();
long memoryEnd = Runtime.getRuntime().freeMemory();
long time = timeEnd - timeStart;
long memory = (memoryStart - memoryEnd) / 1024;
System.out.println(String.format("Time: %d ms", time));
System.out.println(String.format("Memory: %d KB", memory));
}
}
| 2,424
| 0.530969
| 0.495981
| 67
| 30.567163
| 21.771694
| 92
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.656716
| false
| false
|
3
|
925ac6222706d52361b90594ddd669b5ac9a8183
| 24,395,414,287,155
|
2251733943f26f9f1da9693f6b6f6fe005f3a96d
|
/src/main/java/me/liuli/ez4h/translators/bedrock/entity/SetEntityMotionPacketTranslator.java
|
5dd5743fce85c6886e30691a83176df13cad0b00
|
[
"MIT"
] |
permissive
|
UnlegitMC/EZ4H
|
https://github.com/UnlegitMC/EZ4H
|
d8791011350ff40073a48701398a8ad96b7bd0f9
|
32ffc68460053c3b06d8301d9f6654335e104cf0
|
refs/heads/main
| 2023-06-25T07:11:49
| 2023-02-13T15:58:59
| 2023-02-13T15:58:59
| 306,857,058
| 19
| 16
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package me.liuli.ez4h.translators.bedrock.entity;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityVelocityPacket;
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.BedrockPacket;
import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket;
import me.liuli.ez4h.minecraft.Client;
import me.liuli.ez4h.translators.BedrockTranslator;
public class SetEntityMotionPacketTranslator implements BedrockTranslator {
@Override
public void translate(BedrockPacket inPacket, Client client) {
SetEntityMotionPacket packet = (SetEntityMotionPacket) inPacket;
Vector3f motion = packet.getMotion();
client.sendPacket(new ServerEntityVelocityPacket((int) packet.getRuntimeEntityId(), motion.getX(), motion.getY(), motion.getZ()));
}
@Override
public Class<? extends BedrockPacket> getPacketClass() {
return SetEntityMotionPacket.class;
}
}
|
UTF-8
|
Java
| 947
|
java
|
SetEntityMotionPacketTranslator.java
|
Java
|
[
{
"context": "4h.translators.bedrock.entity;\n\nimport com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEnt",
"end": 79,
"score": 0.9991968274116516,
"start": 69,
"tag": "USERNAME",
"value": "steveice10"
}
] | null |
[] |
package me.liuli.ez4h.translators.bedrock.entity;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityVelocityPacket;
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.BedrockPacket;
import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket;
import me.liuli.ez4h.minecraft.Client;
import me.liuli.ez4h.translators.BedrockTranslator;
public class SetEntityMotionPacketTranslator implements BedrockTranslator {
@Override
public void translate(BedrockPacket inPacket, Client client) {
SetEntityMotionPacket packet = (SetEntityMotionPacket) inPacket;
Vector3f motion = packet.getMotion();
client.sendPacket(new ServerEntityVelocityPacket((int) packet.getRuntimeEntityId(), motion.getX(), motion.getY(), motion.getZ()));
}
@Override
public Class<? extends BedrockPacket> getPacketClass() {
return SetEntityMotionPacket.class;
}
}
| 947
| 0.782471
| 0.775079
| 22
| 42.045456
| 35.140598
| 138
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.681818
| false
| false
|
3
|
0feafdf6fef14f64b35658323dc1c17a73e7a367
| 26,405,458,936,061
|
95da84497134f70b6eaa5fbc704ae41913de470e
|
/src/com/gz/websocket/protocol/server/test/ReceivedTestHandler.java
|
d9a4eb451ba3ceccc815bac026db28b4f9c040fc
|
[] |
no_license
|
huangchenghua/WebSocketFramework
|
https://github.com/huangchenghua/WebSocketFramework
|
696a20e09e7f301bacc5f09e689026514b861547
|
23bb27bf464011d845757baba8e4c1f5ffea6e9f
|
refs/heads/master
| 2020-04-06T06:25:38.281000
| 2017-04-18T06:41:56
| 2017-04-18T06:41:56
| 73,795,568
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.gz.websocket.protocol.server.test;
import com.alibaba.fastjson.JSONObject;
import com.gz.websocket.msg.ProtocolMsg;
import com.gz.websocket.protocol.server.ProtocolServerMsgHandler;
import io.netty.channel.Channel;
public class ReceivedTestHandler implements ProtocolServerMsgHandler {
@Override
public void onMsgReceived(ProtocolMsg msg) {
JSONObject json = msg.getJson();
int serverId = json.getIntValue("");
}
@Override
public void onSessionClosed(Channel channel) {
// TODO Auto-generated method stub
}
}
|
UTF-8
|
Java
| 545
|
java
|
ReceivedTestHandler.java
|
Java
|
[] | null |
[] |
package com.gz.websocket.protocol.server.test;
import com.alibaba.fastjson.JSONObject;
import com.gz.websocket.msg.ProtocolMsg;
import com.gz.websocket.protocol.server.ProtocolServerMsgHandler;
import io.netty.channel.Channel;
public class ReceivedTestHandler implements ProtocolServerMsgHandler {
@Override
public void onMsgReceived(ProtocolMsg msg) {
JSONObject json = msg.getJson();
int serverId = json.getIntValue("");
}
@Override
public void onSessionClosed(Channel channel) {
// TODO Auto-generated method stub
}
}
| 545
| 0.779817
| 0.779817
| 24
| 21.708334
| 22.751335
| 70
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.958333
| false
| false
|
3
|
5adabd4af962920f0a15557ee02d628189335c52
| 21,543,555,967,994
|
963212f9ece3f4e13a4f0213e7984dab1df376f5
|
/qardio_source/cfr_dec/com/google/android/gms/common/util/zzi.java
|
7da0dbe1b54125287f1859868cfa2bd8a53c4145
|
[] |
no_license
|
weitat95/mastersDissertation
|
https://github.com/weitat95/mastersDissertation
|
2648638bee64ea50cc93344708a58800a0f2af14
|
d465bb52b543dea05c799d1972374e877957a80c
|
refs/heads/master
| 2020-06-08T17:31:51.767000
| 2019-12-15T19:09:41
| 2019-12-15T19:09:41
| 193,271,681
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Decompiled with CFR 0.147.
*
* Could not load the following classes:
* android.annotation.TargetApi
* android.content.Context
* android.content.pm.PackageManager
*/
package com.google.android.gms.common.util;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.pm.PackageManager;
import com.google.android.gms.common.util.zzq;
public final class zzi {
private static Boolean zzgei;
private static Boolean zzgej;
private static Boolean zzgek;
/*
* Enabled aggressive block sorting
*/
@TargetApi(value=20)
public static boolean zzcs(Context context) {
if (zzgei == null) {
boolean bl = zzq.zzamm() && context.getPackageManager().hasSystemFeature("android.hardware.type.watch");
zzgei = bl;
}
return zzgei;
}
@TargetApi(value=24)
public static boolean zzct(Context context) {
return (!zzq.isAtLeastN() || zzi.zzcu(context)) && zzi.zzcs(context);
}
/*
* Enabled aggressive block sorting
*/
@TargetApi(value=21)
public static boolean zzcu(Context context) {
if (zzgej == null) {
boolean bl = zzq.zzamn() && context.getPackageManager().hasSystemFeature("cn.google");
zzgej = bl;
}
return zzgej;
}
/*
* Enabled aggressive block sorting
*/
public static boolean zzcv(Context context) {
if (zzgek == null) {
boolean bl = context.getPackageManager().hasSystemFeature("android.hardware.type.iot") || context.getPackageManager().hasSystemFeature("android.hardware.type.embedded");
zzgek = bl;
}
return zzgek;
}
}
|
UTF-8
|
Java
| 1,714
|
java
|
zzi.java
|
Java
|
[] | null |
[] |
/*
* Decompiled with CFR 0.147.
*
* Could not load the following classes:
* android.annotation.TargetApi
* android.content.Context
* android.content.pm.PackageManager
*/
package com.google.android.gms.common.util;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.pm.PackageManager;
import com.google.android.gms.common.util.zzq;
public final class zzi {
private static Boolean zzgei;
private static Boolean zzgej;
private static Boolean zzgek;
/*
* Enabled aggressive block sorting
*/
@TargetApi(value=20)
public static boolean zzcs(Context context) {
if (zzgei == null) {
boolean bl = zzq.zzamm() && context.getPackageManager().hasSystemFeature("android.hardware.type.watch");
zzgei = bl;
}
return zzgei;
}
@TargetApi(value=24)
public static boolean zzct(Context context) {
return (!zzq.isAtLeastN() || zzi.zzcu(context)) && zzi.zzcs(context);
}
/*
* Enabled aggressive block sorting
*/
@TargetApi(value=21)
public static boolean zzcu(Context context) {
if (zzgej == null) {
boolean bl = zzq.zzamn() && context.getPackageManager().hasSystemFeature("cn.google");
zzgej = bl;
}
return zzgej;
}
/*
* Enabled aggressive block sorting
*/
public static boolean zzcv(Context context) {
if (zzgek == null) {
boolean bl = context.getPackageManager().hasSystemFeature("android.hardware.type.iot") || context.getPackageManager().hasSystemFeature("android.hardware.type.embedded");
zzgek = bl;
}
return zzgek;
}
}
| 1,714
| 0.63769
| 0.631855
| 60
| 27.549999
| 30.358099
| 181
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.366667
| false
| false
|
3
|
57c89c99524b6300895a452fa4fe3c99bcae15de
| 21,543,555,967,945
|
af1128c153493216d15ca73b6bd182f1846f20d2
|
/Connect4.java
|
8a7168325c80f009f11b5080c6e3de3ad967c70d
|
[] |
no_license
|
ecrum19/Connect4Project
|
https://github.com/ecrum19/Connect4Project
|
d74bb917a65c7e7e3d25c8e720a1d03edacf77fc
|
566025f86abbaaaa46bdfd0a250508b051a88d93
|
refs/heads/master
| 2023-01-13T11:28:38.217000
| 2019-04-08T16:09:26
| 2019-04-08T16:09:26
| 180,184,247
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.Scanner;
public class Connect4 {
final static int Width = 6;
final static int Height = 7;
static char[][] board = new char[Width][Height];
public char[][] getBoard() {
return board;
}
public static void CreateBoard() {
//fills board with '.' for the width and height
for (int w = 0; Width > w; w += 1) {
for (int h = 0; Height > h; h += 1) {
board[w][h] = '.';
}
}
}
public static void PrintBoard() {
//prints the board
for (int w = 0; Width > w; w += 1) {
for (int h = 0; Height > h; h += 1) {
System.out.print(board[w][h]);
}
System.out.println();
}
System.out.println();
}
public void player1UI() {
int x = UI.promptInt("Enter Column of desired move location: ");
int y = UI.promptInt("Enter Row of desired move location: ");
board[x][y] = 1;
}
public void player2UI() {
int a = UI.promptInt("Enter Column of desired move location: ");
int b = UI.promptInt("Enter Row of desired move location: ");
board[a][b] = 0;
}
public static void main(String[] args) {
CreateBoard();
PrintBoard();
}
}
|
UTF-8
|
Java
| 1,300
|
java
|
Connect4.java
|
Java
|
[] | null |
[] |
import java.util.Scanner;
public class Connect4 {
final static int Width = 6;
final static int Height = 7;
static char[][] board = new char[Width][Height];
public char[][] getBoard() {
return board;
}
public static void CreateBoard() {
//fills board with '.' for the width and height
for (int w = 0; Width > w; w += 1) {
for (int h = 0; Height > h; h += 1) {
board[w][h] = '.';
}
}
}
public static void PrintBoard() {
//prints the board
for (int w = 0; Width > w; w += 1) {
for (int h = 0; Height > h; h += 1) {
System.out.print(board[w][h]);
}
System.out.println();
}
System.out.println();
}
public void player1UI() {
int x = UI.promptInt("Enter Column of desired move location: ");
int y = UI.promptInt("Enter Row of desired move location: ");
board[x][y] = 1;
}
public void player2UI() {
int a = UI.promptInt("Enter Column of desired move location: ");
int b = UI.promptInt("Enter Row of desired move location: ");
board[a][b] = 0;
}
public static void main(String[] args) {
CreateBoard();
PrintBoard();
}
}
| 1,300
| 0.505385
| 0.493846
| 50
| 25
| 21.299765
| 72
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.5
| false
| false
|
3
|
1ca9e8bf9727449f78d5b715bf1beaf72e419eba
| 28,303,834,492,911
|
acb0a333b43ee7423118431bc58f69d8069ed4a2
|
/Basics144 - Chosing the collections/src/Main.java
|
24de267bbb42af1e38a36003e6a84b10ec81e3ba
|
[] |
no_license
|
avramus/Basics-Java
|
https://github.com/avramus/Basics-Java
|
141c9b993c2f5175ad075743da0a5a71b59fd6b2
|
62b8423399bd39e32eb9a9c2d45fb0516ecba642
|
refs/heads/master
| 2017-12-04T03:51:46.656000
| 2016-06-23T16:10:55
| 2016-06-23T16:10:55
| 60,987,578
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
public class Main {
public static void main(String[] args) {
/////////// LISTS /////////////////////
/*
* objects are indexed objects are stored in the way they are given
* iteration are pretty fast can store double values hard to find an
* item fast to find an item, given the index
*/
// good for extraction and adding at the end
List<Integer> list1 = new ArrayList<Integer>();
// good for extraction anywhere, but slower that array at end
List<Integer> list2 = new LinkedList<Integer>();
/////////// SETS ///////////////
/*
* no multiple elements good at finding items
*/
// no order is given
Set<Integer> set1 = new HashSet<Integer>();
// the order in which we introduce
Set<Integer> set2 = new LinkedHashSet<Integer>();
// sorted
Set<Integer> set3 = new TreeSet<Integer>();
///////////// HashMaps //////////////
/*
* key value pairs good for introducing pairs not good for iteration
*/
// keys are not in any order
Map<Integer, String> map1 = new HashMap<Integer, String>();
// keys are sorted
Map<Integer, String> map2 = new TreeMap<Integer, String>();
// keys are added in the given order
Map<Integer, String> map3 = new LinkedHashMap<Integer, String>();
}
}
|
UTF-8
|
Java
| 1,603
|
java
|
Main.java
|
Java
|
[] | null |
[] |
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
public class Main {
public static void main(String[] args) {
/////////// LISTS /////////////////////
/*
* objects are indexed objects are stored in the way they are given
* iteration are pretty fast can store double values hard to find an
* item fast to find an item, given the index
*/
// good for extraction and adding at the end
List<Integer> list1 = new ArrayList<Integer>();
// good for extraction anywhere, but slower that array at end
List<Integer> list2 = new LinkedList<Integer>();
/////////// SETS ///////////////
/*
* no multiple elements good at finding items
*/
// no order is given
Set<Integer> set1 = new HashSet<Integer>();
// the order in which we introduce
Set<Integer> set2 = new LinkedHashSet<Integer>();
// sorted
Set<Integer> set3 = new TreeSet<Integer>();
///////////// HashMaps //////////////
/*
* key value pairs good for introducing pairs not good for iteration
*/
// keys are not in any order
Map<Integer, String> map1 = new HashMap<Integer, String>();
// keys are sorted
Map<Integer, String> map2 = new TreeMap<Integer, String>();
// keys are added in the given order
Map<Integer, String> map3 = new LinkedHashMap<Integer, String>();
}
}
| 1,603
| 0.638178
| 0.633188
| 60
| 24.716667
| 22.496735
| 70
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.483333
| false
| false
|
3
|
78edd22ff5f751ef3b47125f07e25f90d5e2b76d
| 3,745,211,486,425
|
ede46a2d0bb3f06aeea06fe21eb7ee395bb0b1e5
|
/project-module-user/project-module-user-api/src/main/java/project/module/realm/map/service/map/CoreUserRoleOrgService.java
|
638dd798ded9f90be006b1d980798b3fe4e1b81a
|
[] |
no_license
|
kakaCat/project-module
|
https://github.com/kakaCat/project-module
|
e12b409d9592680fcded3cd9cb1e378e14a59344
|
1a051e600fd778e9d6c089acf4dc43ff4591a010
|
refs/heads/master
| 2022-07-04T04:19:06.684000
| 2019-11-01T02:39:50
| 2019-11-01T02:39:50
| 188,809,447
| 0
| 0
| null | false
| 2020-10-13T16:34:26
| 2019-05-27T09:05:17
| 2019-11-01T02:40:00
| 2020-10-13T16:34:25
| 213
| 0
| 0
| 1
|
Java
| false
| false
|
package project.module.realm.map.service.map;
import project.module.realm.map.domain.po.CoreUserRoleOrgPo;
public interface CoreUserRoleOrgService {
int inserEntity(CoreUserRoleOrgPo entity);
int updateById(CoreUserRoleOrgPo entity);
CoreUserRoleOrgPo selectByPrimaryKey(Integer id);
}
|
UTF-8
|
Java
| 306
|
java
|
CoreUserRoleOrgService.java
|
Java
|
[] | null |
[] |
package project.module.realm.map.service.map;
import project.module.realm.map.domain.po.CoreUserRoleOrgPo;
public interface CoreUserRoleOrgService {
int inserEntity(CoreUserRoleOrgPo entity);
int updateById(CoreUserRoleOrgPo entity);
CoreUserRoleOrgPo selectByPrimaryKey(Integer id);
}
| 306
| 0.797386
| 0.797386
| 15
| 19.4
| 23.960524
| 60
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.333333
| false
| false
|
3
|
52da388fc6f37fd25b589ef5969877b9c92f5140
| 34,059,090,697,255
|
09b9ef9f4d622d8c4aedb82be4d520f92a683d0f
|
/net.sf.anathema.basics.item/src/net/sf/anathema/basics/item/plugin/IBasicItemPluginConstants.java
|
856140719f9d3cfa21ef4250afbdfdd9a8e7ae4c
|
[] |
no_license
|
anathema/anathema-rcp
|
https://github.com/anathema/anathema-rcp
|
a10491b7b3eae5d6cce2c7eb480110f741a86dd4
|
558a47659a96a7065ab703d43740a353b43e96de
|
refs/heads/master
| 2020-02-26T14:50:50.304000
| 2009-10-20T11:12:27
| 2009-10-20T11:12:27
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package net.sf.anathema.basics.item.plugin;
public interface IBasicItemPluginConstants {
public static final String PLUGIN_ID = "net.sf.anathema.basics.item"; //$NON-NLS-1$
}
|
UTF-8
|
Java
| 183
|
java
|
IBasicItemPluginConstants.java
|
Java
|
[] | null |
[] |
package net.sf.anathema.basics.item.plugin;
public interface IBasicItemPluginConstants {
public static final String PLUGIN_ID = "net.sf.anathema.basics.item"; //$NON-NLS-1$
}
| 183
| 0.748634
| 0.743169
| 6
| 28.833334
| 31.68289
| 85
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.333333
| false
| false
|
3
|
32162a1a2cf9105896d4c6b46488b8f2a4805d9d
| 34,059,090,696,653
|
63217713ab72bfe01df57c582a63a01234a9db7f
|
/java-learning/train/WebServer/src/com/wuyue/server02/Server06.java
|
8aca94856adce27a638bc6cf77a9a5d6f97417ab
|
[
"MIT"
] |
permissive
|
DeltaV235/Learning-notes
|
https://github.com/DeltaV235/Learning-notes
|
deea414880df7ac3aef87e9286936361433404ff
|
87ad20c2c53a6240994d02f8cb083b89055e4059
|
refs/heads/master
| 2020-06-30T21:38:02.251000
| 2020-06-25T02:28:12
| 2020-06-25T02:29:09
| 200,957,792
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.wuyue.server02;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
/**
* 加入了servlet
*/
public class Server06 {
private ServerSocket serverSocket;
public static void main(String[] args) {
Server06 server06 = new Server06();
server06.start();
server06.receive();
}
// 启动服务
public void start() {
try {
serverSocket = new ServerSocket(10240);
} catch (IOException e) {
e.printStackTrace();
System.out.println("服务器启动失败");
}
}
// 接收连接
public void receive() {
try {
while (true) {
Socket client = serverSocket.accept();
System.out.println("\n一个客户端建立了连接");
Request request = new Request(client);
Response response = new Response(client);
Servlet servlet = new LoginServlet();
servlet.service(request, response);
// 写出到客户端
response.push(200);
}
} catch (
IOException e) {
e.printStackTrace();
System.out.println("客户端错误");
}
}
// 停止服务
public void stop() {
}
}
|
UTF-8
|
Java
| 1,337
|
java
|
Server06.java
|
Java
|
[] | null |
[] |
package com.wuyue.server02;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
/**
* 加入了servlet
*/
public class Server06 {
private ServerSocket serverSocket;
public static void main(String[] args) {
Server06 server06 = new Server06();
server06.start();
server06.receive();
}
// 启动服务
public void start() {
try {
serverSocket = new ServerSocket(10240);
} catch (IOException e) {
e.printStackTrace();
System.out.println("服务器启动失败");
}
}
// 接收连接
public void receive() {
try {
while (true) {
Socket client = serverSocket.accept();
System.out.println("\n一个客户端建立了连接");
Request request = new Request(client);
Response response = new Response(client);
Servlet servlet = new LoginServlet();
servlet.service(request, response);
// 写出到客户端
response.push(200);
}
} catch (
IOException e) {
e.printStackTrace();
System.out.println("客户端错误");
}
}
// 停止服务
public void stop() {
}
}
| 1,337
| 0.518785
| 0.501199
| 54
| 22.166666
| 17.58024
| 57
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.388889
| false
| false
|
3
|
cfb54aec5ff2c246a4b2dbe6c2790399e115d701
| 17,763,984,803,094
|
f9c1eef2ee53411d73b16314e9d3ff1610f04f50
|
/src/leetcode/字符串/基础/_387_字符串中的第一个唯一字符.java
|
1bc27e2c17c655dc103fdd3b541b66b12a3607cc
|
[] |
no_license
|
lzn312/algorithm
|
https://github.com/lzn312/algorithm
|
6016955d6340dd24e40f34c3b98ba7b6eea4b775
|
3617c072a23104f58b49e476869bb42c3d401cbd
|
refs/heads/master
| 2021-06-14T00:35:00.630000
| 2021-04-08T14:58:31
| 2021-04-08T14:58:31
| 163,779,499
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package leetcode.字符串.基础;
import java.util.HashMap;
import java.util.Map;
/**
* 给定一个字符串,找到它的第一个不重复的字符,并返回它的索引。如果不存在,则返回 -1。
*
*
*
* 示例:
*
* s = "leetcode"
* 返回 0
*
* s = "loveleetcode"
* 返回 2
*
*
* 提示:你可以假定该字符串只包含小写字母。
**/
public class _387_字符串中的第一个唯一字符 {
/**
* 我们假设就只有小写字母,那么就26个字符,
* 我们可以用一个Map存储26个字母出现的次数,然后在便利一边返回
**/
public int firstUniqChar(String s) {
Map<Character,Integer> map = new HashMap<>(26);
char[] chars = s.toCharArray();
for (char aChar : chars) {
map.merge(aChar, 1, Integer::sum);
}
int result = -1;
for (int i = 0; i < chars.length; i++) {
if (map.get(chars[i]) == 1) {
return i;
}
}
return result;
}
}
|
UTF-8
|
Java
| 1,054
|
java
|
_387_字符串中的第一个唯一字符.java
|
Java
|
[
{
"context": "* 示例:\n *\n * s = \"leetcode\"\n * 返回 0\n *\n * s = \"loveleetcode\"\n * 返回 2\n * \n *\n * 提示:你可以假定该字符串只包含小写字母。\n **/\npub",
"end": 196,
"score": 0.536461591720581,
"start": 188,
"tag": "USERNAME",
"value": "leetcode"
}
] | null |
[] |
package leetcode.字符串.基础;
import java.util.HashMap;
import java.util.Map;
/**
* 给定一个字符串,找到它的第一个不重复的字符,并返回它的索引。如果不存在,则返回 -1。
*
*
*
* 示例:
*
* s = "leetcode"
* 返回 0
*
* s = "loveleetcode"
* 返回 2
*
*
* 提示:你可以假定该字符串只包含小写字母。
**/
public class _387_字符串中的第一个唯一字符 {
/**
* 我们假设就只有小写字母,那么就26个字符,
* 我们可以用一个Map存储26个字母出现的次数,然后在便利一边返回
**/
public int firstUniqChar(String s) {
Map<Character,Integer> map = new HashMap<>(26);
char[] chars = s.toCharArray();
for (char aChar : chars) {
map.merge(aChar, 1, Integer::sum);
}
int result = -1;
for (int i = 0; i < chars.length; i++) {
if (map.get(chars[i]) == 1) {
return i;
}
}
return result;
}
}
| 1,054
| 0.515152
| 0.494949
| 45
| 16.6
| 16.13471
| 55
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.311111
| false
| false
|
3
|
f7d32b411680f8007a89c3e6f076f0df42078a54
| 37,074,157,718,633
|
a0330788010aedc9ccdc05a4f4bb0e815bb038f3
|
/app/src/main/java/a2is70/quizmaster/database/Database.java
|
ed5abad1bf201c718b22cd641241cc41019b31d1
|
[] |
no_license
|
DarkSeraphim/2IS70-app
|
https://github.com/DarkSeraphim/2IS70-app
|
cd8a94a66896c4463d93205b54f6f371fbcfa249
|
85bedae930a61535d1949c51b258c3da2eeb3e1e
|
refs/heads/master
| 2021-06-16T12:57:40.728000
| 2017-04-23T21:36:29
| 2017-04-23T21:36:29
| 81,307,111
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package a2is70.quizmaster.database;
public class Database {
}
|
UTF-8
|
Java
| 64
|
java
|
Database.java
|
Java
|
[] | null |
[] |
package a2is70.quizmaster.database;
public class Database {
}
| 64
| 0.78125
| 0.734375
| 5
| 11.8
| 14.551976
| 35
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.2
| false
| false
|
3
|
c64a277ba24a1d6b385ba4c7a271bb8c7f412461
| 37,074,157,717,654
|
759c8633e36ce9457cdf303043e4e5244280799e
|
/src/test/files/LowerCameCaseMapper.java
|
bde8c763076a4a42bf1b18009243dff8c06d7f1f
|
[] |
no_license
|
ImTravis/self-defined-sonar-java
|
https://github.com/ImTravis/self-defined-sonar-java
|
3617d6ab31adedeb56cb2f32f27dea35b2f25f2d
|
348749d8ab148992bb38dbaa5060f7deb28e72a4
|
refs/heads/master
| 2022-07-10T05:49:00.728000
| 2020-03-06T08:07:23
| 2020-03-06T08:07:23
| 245,361,732
| 0
| 0
| null | false
| 2022-06-28T23:27:17
| 2020-03-06T08:01:05
| 2020-03-06T08:07:52
| 2022-06-28T23:27:17
| 34
| 0
| 0
| 4
|
Java
| false
| false
|
package org.finger.java.rule.checks.namerules;
/**
* Created by huqingen on 2017/3/17.
*/
public class LowerCameCaseMapper {
private String ID;// Noncompliant
private String UserName;// Noncompliant
private String password;// Compliant
private static final String NO_BB_CC_DD_CC_SSS = "2212313213";
public String getUserInfo(String info) { // Noncompliant
String Yes = "Yes";// Noncompliant
return info+Yes;
}
public void GetPassword(){} // Noncompliant
public void getUser(String UserInfo) {// Noncompliant
}
}
|
UTF-8
|
Java
| 572
|
java
|
LowerCameCaseMapper.java
|
Java
|
[
{
"context": "ger.java.rule.checks.namerules;\n\n/**\n * Created by huqingen on 2017/3/17.\n */\npublic class LowerCameCaseMappe",
"end": 74,
"score": 0.9995617270469666,
"start": 66,
"tag": "USERNAME",
"value": "huqingen"
}
] | null |
[] |
package org.finger.java.rule.checks.namerules;
/**
* Created by huqingen on 2017/3/17.
*/
public class LowerCameCaseMapper {
private String ID;// Noncompliant
private String UserName;// Noncompliant
private String password;// Compliant
private static final String NO_BB_CC_DD_CC_SSS = "2212313213";
public String getUserInfo(String info) { // Noncompliant
String Yes = "Yes";// Noncompliant
return info+Yes;
}
public void GetPassword(){} // Noncompliant
public void getUser(String UserInfo) {// Noncompliant
}
}
| 572
| 0.681818
| 0.652098
| 23
| 23.869566
| 22.940952
| 66
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.304348
| false
| false
|
3
|
7075c05576d6489b9e27fb561d1a0abcd725afdd
| 27,084,063,827,527
|
500d59faccfc2bef0f568f5b7f0014e2b7dbaef9
|
/src/main/java/test53/visitor/visitor0/VisitorB.java
|
d312d252dc653b95f7f4288aefcbe47469f1cd2f
|
[
"MIT"
] |
permissive
|
qinyaoting/java-patterns
|
https://github.com/qinyaoting/java-patterns
|
d96f7b746dae8ce76bcd5483e09227fef77b68d7
|
e4fddb8dabd8bc93ca880193742abc6802c4a07d
|
refs/heads/master
| 2020-03-26T07:30:30.779000
| 2018-08-20T09:42:37
| 2018-08-20T09:42:37
| 144,657,978
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package test53.visitor.visitor0;
/**
* Created with IntelliJ IDEA.
* User: chin
* Date: 8/14/18
* Time: 11:01 AM
* To change this template use File | Settings | File Templates.
* Description:
*/
public class VisitorB implements Visitor {
@Override
public void visit(NodeA nodeA) {
System.out.println(nodeA.operationA());
}
@Override
public void visit(NodeB nodeB) {
System.out.println(nodeB.operationB());
}
}
|
UTF-8
|
Java
| 459
|
java
|
VisitorB.java
|
Java
|
[
{
"context": "tor0;\n\n/**\n * Created with IntelliJ IDEA.\n * User: chin\n * Date: 8/14/18\n * Time: 11:01 AM\n * To change t",
"end": 82,
"score": 0.9989550113677979,
"start": 78,
"tag": "USERNAME",
"value": "chin"
}
] | null |
[] |
package test53.visitor.visitor0;
/**
* Created with IntelliJ IDEA.
* User: chin
* Date: 8/14/18
* Time: 11:01 AM
* To change this template use File | Settings | File Templates.
* Description:
*/
public class VisitorB implements Visitor {
@Override
public void visit(NodeA nodeA) {
System.out.println(nodeA.operationA());
}
@Override
public void visit(NodeB nodeB) {
System.out.println(nodeB.operationB());
}
}
| 459
| 0.655773
| 0.62963
| 21
| 20.857143
| 18.26338
| 64
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.238095
| false
| false
|
3
|
50f088ca8e54417fea111a007d652e107f4aa8e8
| 37,263,136,276,926
|
2eaaf73a8468ef0b7d966040d11d18c9c73d39e8
|
/Items/AIS.java
|
5949aa0dbd248a52286fab965cc213863b0390d4
|
[] |
no_license
|
gameMaker7/RPG-Game
|
https://github.com/gameMaker7/RPG-Game
|
40e64ea93e0568f7c09bebdf39b72273e071ffbf
|
c10fe3a76f60513c7ab644499017d995a938fa52
|
refs/heads/master
| 2021-01-19T11:17:34.647000
| 2015-01-29T20:12:11
| 2015-01-29T20:12:11
| 30,038,822
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package Items;
public enum AIS {
// Actions In Shop
Create, Buy, Exit
}
|
UTF-8
|
Java
| 74
|
java
|
AIS.java
|
Java
|
[] | null |
[] |
package Items;
public enum AIS {
// Actions In Shop
Create, Buy, Exit
}
| 74
| 0.689189
| 0.689189
| 6
| 11.333333
| 7.781745
| 18
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.666667
| false
| false
|
3
|
565aeffa7b5cd0ae6827947148593758407bfaef
| 34,093,450,443,183
|
440ae4d8c0795d651aa25b5c25c1b0c6a653f8e5
|
/CalendarFXSampler/src/main/java/com/calendarfx/demo/views/HelloRecurrenceView.java
|
16de3c36f2c457e04050ae1a1b09264f8784d329
|
[
"Apache-2.0"
] |
permissive
|
JerJohn15/CalendarFX
|
https://github.com/JerJohn15/CalendarFX
|
adf310d5426c18b4553de107eec7531db4fc66ed
|
c9980d990e04fc363a9fc6ebe7fa502a6cf61239
|
refs/heads/master
| 2021-07-16T11:09:48.130000
| 2017-10-20T11:54:30
| 2017-10-20T11:54:30
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* Copyright (C) 2015, 2016 Dirk Lemmermann Software & Consulting (dlsc.com)
*
* This file is part of CalendarFX.
*/
package com.calendarfx.demo.views;
import com.calendarfx.demo.CalendarFXSample;
import com.calendarfx.view.RecurrenceView;
import javafx.geometry.Orientation;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.control.Separator;
import javafx.scene.layout.VBox;
public class HelloRecurrenceView extends CalendarFXSample {
@Override
public String getSampleName() {
return "Recurrence View";
}
@Override
protected Node createControl() {
RecurrenceView view = new RecurrenceView();
Label label = new Label("Rule: " + view.getRecurrenceRule());
label.setMaxWidth(300);
label.setWrapText(true);
view.recurrenceRuleProperty().addListener(it -> label.setText(view.getRecurrenceRule()));
Separator separator = new Separator(Orientation.HORIZONTAL);
VBox box = new VBox(20);
box.setFillWidth(true);
box.getChildren().addAll(view, separator, label);
box.setAlignment(Pos.CENTER);
return box;
}
@Override
protected Class<?> getJavaDocClass() {
return RecurrenceView.class;
}
@Override
public String getSampleDescription() {
return "The recurrence view allows the user to specify recurrence rules according to RFC 2445.";
}
public static void main(String[] args) {
launch(args);
}
}
|
UTF-8
|
Java
| 1,413
|
java
|
HelloRecurrenceView.java
|
Java
|
[
{
"context": "/**\n * Copyright (C) 2015, 2016 Dirk Lemmermann Software & Consulting (dlsc.com) \n * \n * This fil",
"end": 47,
"score": 0.9996242523193359,
"start": 32,
"tag": "NAME",
"value": "Dirk Lemmermann"
}
] | null |
[] |
/**
* Copyright (C) 2015, 2016 <NAME> Software & Consulting (dlsc.com)
*
* This file is part of CalendarFX.
*/
package com.calendarfx.demo.views;
import com.calendarfx.demo.CalendarFXSample;
import com.calendarfx.view.RecurrenceView;
import javafx.geometry.Orientation;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.control.Separator;
import javafx.scene.layout.VBox;
public class HelloRecurrenceView extends CalendarFXSample {
@Override
public String getSampleName() {
return "Recurrence View";
}
@Override
protected Node createControl() {
RecurrenceView view = new RecurrenceView();
Label label = new Label("Rule: " + view.getRecurrenceRule());
label.setMaxWidth(300);
label.setWrapText(true);
view.recurrenceRuleProperty().addListener(it -> label.setText(view.getRecurrenceRule()));
Separator separator = new Separator(Orientation.HORIZONTAL);
VBox box = new VBox(20);
box.setFillWidth(true);
box.getChildren().addAll(view, separator, label);
box.setAlignment(Pos.CENTER);
return box;
}
@Override
protected Class<?> getJavaDocClass() {
return RecurrenceView.class;
}
@Override
public String getSampleDescription() {
return "The recurrence view allows the user to specify recurrence rules according to RFC 2445.";
}
public static void main(String[] args) {
launch(args);
}
}
| 1,404
| 0.748761
| 0.73673
| 59
| 22.949152
| 23.940197
| 98
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.20339
| false
| false
|
3
|
d4c0df446a9261ab007474af543ea73782e68f59
| 34,471,407,561,832
|
3a2fc46704bbff9d8029ac023c5457a97aa9c900
|
/tour/acctpay/screen/src/main/java/com/tourgeek/tour/acctpay/screen/trx/VendorScreenRecord.java
|
14fba82db2f1c7c16689ac75276cdf3696875b2d
|
[] |
no_license
|
tourgeek/tourgeek
|
https://github.com/tourgeek/tourgeek
|
e44c9ab5db53a31c221dbcf4185141c58d13d94b
|
c32282e9daf1f26e79d60123b10756ba8244e3c8
|
refs/heads/master
| 2023-08-25T14:27:29.200000
| 2023-04-01T20:19:53
| 2023-04-01T20:19:53
| 11,162,837
| 4
| 1
| null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* @(#)VendorScreenRecord.
* Copyright © 2013 tourgeek.com. All rights reserved.
* GPL3 Open Source Software License.
*/
package com.tourgeek.tour.acctpay.screen.trx;
import java.util.*;
import org.jbundle.base.db.*;
import org.jbundle.thin.base.util.*;
import org.jbundle.thin.base.db.*;
import org.jbundle.base.db.event.*;
import org.jbundle.base.db.filter.*;
import org.jbundle.base.field.*;
import org.jbundle.base.field.convert.*;
import org.jbundle.base.field.event.*;
import org.jbundle.base.model.*;
import org.jbundle.base.util.*;
import org.jbundle.model.*;
import org.jbundle.model.db.*;
import org.jbundle.model.screen.*;
import com.tourgeek.tour.base.db.*;
import com.tourgeek.tour.acctpay.db.*;
import com.tourgeek.tour.base.field.*;
/**
* VendorScreenRecord - Fields for Vendor display.
*/
public class VendorScreenRecord extends ScreenRecord
{
private static final long serialVersionUID = 1L;
public static final String VENDOR_KEY = "VendorKey";
public static final String VENDOR_NAME = "VendorName";
public static final String VENDOR_COUNTRY = "VendorCountry";
public static final String BALANCE = "Balance";
public static final String VENDOR_ID = "VendorID";
public static final String TOUR_ID = "TourID";
public static final String TOTAL = "Total";
public static final String SELECT_FLAG = "SelectFlag";
public static final String TOTAL_SELECTED = "TotalSelected";
public static final String DISPLAY_TYPE = "DisplayType";
public static final String DISPLAY_ACTIVE = "DisplayActive";
/**
* Default constructor.
*/
public VendorScreenRecord()
{
super();
}
/**
* Constructor.
*/
public VendorScreenRecord(RecordOwner screen)
{
this();
this.init(screen);
}
/**
* Initialize class fields.
*/
public void init(RecordOwner screen)
{
super.init(screen);
}
public static final String VENDOR_SCREEN_RECORD_FILE = null; // Screen field
/**
* Add this field in the Record's field sequence.
*/
public BaseField setupField(int iFieldSeq)
{
BaseField field = null;
if (iFieldSeq == 0)
field = new ShortField(this, VENDOR_KEY, Constants.DEFAULT_FIELD_LENGTH, null, null);
if (iFieldSeq == 1)
field = new StringField(this, VENDOR_NAME, 10, null, null);
if (iFieldSeq == 2)
field = new CountryField(this, VENDOR_COUNTRY, Constants.DEFAULT_FIELD_LENGTH, null, null);
if (iFieldSeq == 3)
field = new FullCurrencyField(this, BALANCE, Constants.DEFAULT_FIELD_LENGTH, null, null);
if (iFieldSeq == 4)
field = new VendorField(this, VENDOR_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
if (iFieldSeq == 5)
field = new TourField(this, TOUR_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
if (iFieldSeq == 6)
field = new FullCurrencyField(this, TOTAL, Constants.DEFAULT_FIELD_LENGTH, null, null);
if (iFieldSeq == 7)
field = new BooleanField(this, SELECT_FLAG, Constants.DEFAULT_FIELD_LENGTH, null, null);
if (iFieldSeq == 8)
field = new FullCurrencyField(this, TOTAL_SELECTED, Constants.DEFAULT_FIELD_LENGTH, null, null);
if (iFieldSeq == 9)
field = new ApTrxClassField(this, DISPLAY_TYPE, Constants.DEFAULT_FIELD_LENGTH, null, null);
if (iFieldSeq == 10)
field = new BooleanField(this, DISPLAY_ACTIVE, Constants.DEFAULT_FIELD_LENGTH, null, new Boolean(true));
if (field == null)
field = super.setupField(iFieldSeq);
return field;
}
}
|
UTF-8
|
Java
| 3,700
|
java
|
VendorScreenRecord.java
|
Java
|
[] | null |
[] |
/**
* @(#)VendorScreenRecord.
* Copyright © 2013 tourgeek.com. All rights reserved.
* GPL3 Open Source Software License.
*/
package com.tourgeek.tour.acctpay.screen.trx;
import java.util.*;
import org.jbundle.base.db.*;
import org.jbundle.thin.base.util.*;
import org.jbundle.thin.base.db.*;
import org.jbundle.base.db.event.*;
import org.jbundle.base.db.filter.*;
import org.jbundle.base.field.*;
import org.jbundle.base.field.convert.*;
import org.jbundle.base.field.event.*;
import org.jbundle.base.model.*;
import org.jbundle.base.util.*;
import org.jbundle.model.*;
import org.jbundle.model.db.*;
import org.jbundle.model.screen.*;
import com.tourgeek.tour.base.db.*;
import com.tourgeek.tour.acctpay.db.*;
import com.tourgeek.tour.base.field.*;
/**
* VendorScreenRecord - Fields for Vendor display.
*/
public class VendorScreenRecord extends ScreenRecord
{
private static final long serialVersionUID = 1L;
public static final String VENDOR_KEY = "VendorKey";
public static final String VENDOR_NAME = "VendorName";
public static final String VENDOR_COUNTRY = "VendorCountry";
public static final String BALANCE = "Balance";
public static final String VENDOR_ID = "VendorID";
public static final String TOUR_ID = "TourID";
public static final String TOTAL = "Total";
public static final String SELECT_FLAG = "SelectFlag";
public static final String TOTAL_SELECTED = "TotalSelected";
public static final String DISPLAY_TYPE = "DisplayType";
public static final String DISPLAY_ACTIVE = "DisplayActive";
/**
* Default constructor.
*/
public VendorScreenRecord()
{
super();
}
/**
* Constructor.
*/
public VendorScreenRecord(RecordOwner screen)
{
this();
this.init(screen);
}
/**
* Initialize class fields.
*/
public void init(RecordOwner screen)
{
super.init(screen);
}
public static final String VENDOR_SCREEN_RECORD_FILE = null; // Screen field
/**
* Add this field in the Record's field sequence.
*/
public BaseField setupField(int iFieldSeq)
{
BaseField field = null;
if (iFieldSeq == 0)
field = new ShortField(this, VENDOR_KEY, Constants.DEFAULT_FIELD_LENGTH, null, null);
if (iFieldSeq == 1)
field = new StringField(this, VENDOR_NAME, 10, null, null);
if (iFieldSeq == 2)
field = new CountryField(this, VENDOR_COUNTRY, Constants.DEFAULT_FIELD_LENGTH, null, null);
if (iFieldSeq == 3)
field = new FullCurrencyField(this, BALANCE, Constants.DEFAULT_FIELD_LENGTH, null, null);
if (iFieldSeq == 4)
field = new VendorField(this, VENDOR_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
if (iFieldSeq == 5)
field = new TourField(this, TOUR_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
if (iFieldSeq == 6)
field = new FullCurrencyField(this, TOTAL, Constants.DEFAULT_FIELD_LENGTH, null, null);
if (iFieldSeq == 7)
field = new BooleanField(this, SELECT_FLAG, Constants.DEFAULT_FIELD_LENGTH, null, null);
if (iFieldSeq == 8)
field = new FullCurrencyField(this, TOTAL_SELECTED, Constants.DEFAULT_FIELD_LENGTH, null, null);
if (iFieldSeq == 9)
field = new ApTrxClassField(this, DISPLAY_TYPE, Constants.DEFAULT_FIELD_LENGTH, null, null);
if (iFieldSeq == 10)
field = new BooleanField(this, DISPLAY_ACTIVE, Constants.DEFAULT_FIELD_LENGTH, null, new Boolean(true));
if (field == null)
field = super.setupField(iFieldSeq);
return field;
}
}
| 3,700
| 0.655853
| 0.650446
| 102
| 35.264706
| 29.095827
| 116
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.911765
| false
| false
|
3
|
cf394aeceb1df3b628651a423822293a7411fe7c
| 34,471,407,561,739
|
3f7c3c3e9268888c38b11a8f577dd6f907ecab6a
|
/Unit5/src/CharacterAnalyzer.java
|
a87afe8cb090bcdff776e9a1668def3f0de6158e
|
[] |
no_license
|
parkj2996/APCSA-2018
|
https://github.com/parkj2996/APCSA-2018
|
bd06b92c730a920915cba10c0847e8d067c4279e
|
29ae064a5d292c50863a02f526414620ec0c9945
|
refs/heads/master
| 2021-04-25T07:04:25.643000
| 2018-02-26T17:30:51
| 2018-02-26T17:30:51
| 122,226,613
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
import static java.lang.System.*;
import java.util.Scanner;
public class CharacterAnalyzer
{
private char theChar;
private int theAscii;
public CharacterAnalyzer()
{
}
public CharacterAnalyzer(char c)
{
theChar = c;
}
public void setChar(char c)
{
theChar = c;
}
public char getChar()
{
return theChar;
}
public boolean isUpper( )
{
if (Character.isUpperCase(theChar) == true)
{
return true;
}
return false;
}
public boolean isLower( )
{
if (Character.isLowerCase(theChar) == true)
{
return true;
}
return false;
}
public int getASCII( )
{
int ascii = (int) theChar;
theAscii = ascii;
return ascii;
}
public boolean isNumber( )
{
if (theAscii >= 48 || theAscii <= 57)
{
return true;
}
return false;
}
public String toString()
{
if (isUpper() == true)
{
return ""+getChar() + " is an uppercase character. ASCII == " + getASCII() + "\n";
}
if (isLower() == true)
{
return ""+getChar() + " is a lowercase character. ASCII == " + getASCII() + "\n";
}
if (isNumber() == true)
{
return ""+getChar() + " is a number. ASCII == " + getASCII() + "\n";
}
return "nothing";
}
}
|
UTF-8
|
Java
| 1,187
|
java
|
CharacterAnalyzer.java
|
Java
|
[] | null |
[] |
import static java.lang.System.*;
import java.util.Scanner;
public class CharacterAnalyzer
{
private char theChar;
private int theAscii;
public CharacterAnalyzer()
{
}
public CharacterAnalyzer(char c)
{
theChar = c;
}
public void setChar(char c)
{
theChar = c;
}
public char getChar()
{
return theChar;
}
public boolean isUpper( )
{
if (Character.isUpperCase(theChar) == true)
{
return true;
}
return false;
}
public boolean isLower( )
{
if (Character.isLowerCase(theChar) == true)
{
return true;
}
return false;
}
public int getASCII( )
{
int ascii = (int) theChar;
theAscii = ascii;
return ascii;
}
public boolean isNumber( )
{
if (theAscii >= 48 || theAscii <= 57)
{
return true;
}
return false;
}
public String toString()
{
if (isUpper() == true)
{
return ""+getChar() + " is an uppercase character. ASCII == " + getASCII() + "\n";
}
if (isLower() == true)
{
return ""+getChar() + " is a lowercase character. ASCII == " + getASCII() + "\n";
}
if (isNumber() == true)
{
return ""+getChar() + " is a number. ASCII == " + getASCII() + "\n";
}
return "nothing";
}
}
| 1,187
| 0.595619
| 0.592249
| 79
| 14.037974
| 17.818666
| 85
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.658228
| false
| false
|
3
|
f9cf51706cc874153f0ca5ef77943baf2e61dd00
| 4,793,183,568,786
|
d4882a5bd0719d114873cf164de35873634cc8f6
|
/src/test/java/com/ironman/ma/Algorithms/Hashing/Core/CrazyNumbers/SolutionTest.java
|
050303f7961606b42f94aac1d8d445ae8dee1120
|
[
"Apache-2.0"
] |
permissive
|
ironmanMA/design
|
https://github.com/ironmanMA/design
|
8d512bc3930ed7d3d9643ed88901bb17287af8ae
|
52bc8ddf4af45405ecbccf0dc23181b5e29e850d
|
refs/heads/master
| 2022-05-24T03:29:19.397000
| 2018-03-19T06:43:13
| 2018-03-19T06:43:13
| 98,342,452
| 0
| 1
|
Apache-2.0
| false
| 2022-05-20T20:46:00
| 2017-07-25T19:28:09
| 2018-03-19T06:43:37
| 2022-05-20T20:45:59
| 1,100
| 0
| 0
| 2
|
Java
| false
| false
|
package com.ironman.ma.Algorithms.Hashing.Core.CrazyNumbers;
import junit.framework.TestCase;
public class SolutionTest extends TestCase {
public void testColorful() {
// System.out.println(new Solution().colorful(236));
int []arr =new int[]{1,2,-2,4,-4};
System.out.println(new Solution().lszero(arr));
}
}
|
UTF-8
|
Java
| 341
|
java
|
SolutionTest.java
|
Java
|
[] | null |
[] |
package com.ironman.ma.Algorithms.Hashing.Core.CrazyNumbers;
import junit.framework.TestCase;
public class SolutionTest extends TestCase {
public void testColorful() {
// System.out.println(new Solution().colorful(236));
int []arr =new int[]{1,2,-2,4,-4};
System.out.println(new Solution().lszero(arr));
}
}
| 341
| 0.677419
| 0.653959
| 12
| 27.5
| 23.813511
| 60
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.75
| false
| false
|
3
|
bffab885330d1a18e8765f9cf00ff3180d9e3c5e
| 2,516,850,895,952
|
a972cb5a3df7ac351c69913e69b8570e78018d29
|
/app/src/main/java/com/novia/licencecode/db/DataSamsat.java
|
244f710eea72a37736d9826f339b56745e3ce30f
|
[] |
no_license
|
mzennis/LicenseCode
|
https://github.com/mzennis/LicenseCode
|
c756f2b3936cffbe27519c7fc0003db91743aec1
|
46a40aefa96454c91c3f8af36892bcd74cbc1a57
|
refs/heads/master
| 2020-03-22T18:09:03.648000
| 2018-07-10T16:27:37
| 2018-07-10T16:27:37
| 140,440,418
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.novia.licencecode.db;
import android.content.Context;
/**
* Created by meta on 10/07/18.
*/
public class DataSamsat {
public static void save(Context context) {
SamsatDb db = new SamsatDb(context);
Samsat samsat = new Samsat();
samsat.address = "Kantor Bersama Samsat Jakarta Utara Pusat, Jl. Gunung Sahari No. 13, " +
"Pademangan, Jakarta Utara 14420, email: samsatpusat@gmail.com" +
"\nTelp: (021) 64715202, 6405826\n" +
"Fax: (021) 6405826";
samsat.name = "Unit PKB & BBN-KB Jakarta Pusat";
samsat.lat = -6.137323;
samsat.lon = 106.833297;
db.insert(samsat);
samsat.address = "Kantor Bersama Samsat Jakarta Barat, Jl. Daan Mogot KM. 13, Cengkareng, " +
"Jakarta Barat 11720, email: unit_pelayanan_samsat_barat@yahoo.co.id" +
"\nTelp: (021) 5442283, 5442301, 5442302\n" +
"Fax: (021) 5442283";
samsat.name = "Unit PKB & BBN-KB Jakarta Barat";
samsat.lat = -6.153667;
samsat.lon = 106.738311;
db.insert(samsat);
samsat.address = "Kantor Bersama Samsat Jakarta Utara Pusat, Jl. Gunung Sahari No. 13, " +
"Pademangan, Jakarta Utara 14420, email: samsatutara@yahoo.com" +
"\nTelp: (021) 64715202\n" +
"Fax: (021) 6404304, 6404918";
samsat.name = "Unit PKB & BBN-KB Jakarta Utara";
samsat.lat = -6.137323;
samsat.lon = 106.833297;
db.insert(samsat);
samsat.address = "Komplek Gedung Polda Metro Jaya, Jl. Jendral Gatot Subroto, Kebayoran Baru," +
" Jakarta Selatan 12110, email: samsat.selatan@yahoo.com dan " +
"uppkb.samsatselatan@jakarta.go.id" +
"\n Telp: (021) 5737219\n" +
"Fax: (021) 5255382";
samsat.name = "Unit PKB & BBN-KB Jakarta Selatan";
samsat.lat = -6.223468;
samsat.lon = 106.814274;
db.insert(samsat);
samsat.address = "Kantor Bersama Samsat Jakarta Timur, Jl. D.I. Panjaitan Kav. 55, Jatinegara," +
" Jakarta Timur 13410, email: samsat.timur@yahoo.co.id" +
"\nTelp: (021) 8199849-52, 8199854";
samsat.name = "Unit PKB & BBN-KB Jakarta Timur";
samsat.lat = -6.229504;
samsat.lon = 106.87688;
db.insert(samsat);
samsat.address = "Kantor Dinas Pelayanan Pajak, Jl. Abdul Muis No. 66 Lantai 1 dan 10, Petojo " +
"Selatan-Gambir, Jakarta Pusat 10160, email: upt.humasdpp@gmail.com, " +
"Facebook: Humas Pajak Jakarta, Website: dpp.jakarta.go.id, Instagram: " +
"humaspajakjakarta, Pinterest: Humas Pajak Jakarta, Twitter: @humaspajakjkt, Youtube: " +
"Humas Pajak Jakarta, Google +: upt.humasdpp@gmail.com" +
"\nTelp: (021) 3865580-85 ext 5036 & 5037, atau (021) 3865629 " +
"dan Tlp/Fax : (021) 3865765";
samsat.name = "Unit Pelayanan Penyuluhan dan Layanan Informasi (Humas DPP)";
samsat.lat = -6.184263;
samsat.lon = 106.8272497;
db.insert(samsat);
}
}
|
UTF-8
|
Java
| 3,190
|
java
|
DataSamsat.java
|
Java
|
[
{
"context": "import android.content.Context;\n\n/**\n * Created by meta on 10/07/18.\n */\npublic class DataSamsat {\n\n p",
"end": 90,
"score": 0.947904109954834,
"start": 86,
"tag": "USERNAME",
"value": "meta"
},
{
"context": " \"Pademangan, Jakarta Utara 14420, email: samsatpusat@gmail.com\" +\n \"\\nTelp: (021) 64715202, 64058",
"end": 443,
"score": 0.9999325275421143,
"start": 422,
"tag": "EMAIL",
"value": "samsatpusat@gmail.com"
},
{
"context": ", \" +\n \"Jakarta Barat 11720, email: unit_pelayanan_samsat_barat@yahoo.co.id\" +\n \"\\nTelp: (021) 5442283, 544230",
"end": 875,
"score": 0.999932587146759,
"start": 836,
"tag": "EMAIL",
"value": "unit_pelayanan_samsat_barat@yahoo.co.id"
},
{
"context": " \"Pademangan, Jakarta Utara 14420, email: samsatutara@yahoo.com\" +\n \"\\nTelp: (021) 64715202\\n\" +\n ",
"end": 1306,
"score": 0.9999359846115112,
"start": 1285,
"tag": "EMAIL",
"value": "samsatutara@yahoo.com"
},
{
"context": " +\n \" Jakarta Selatan 12110, email: samsat.selatan@yahoo.com dan \" +\n \"uppkb.samsatselatan@jaka",
"end": 1729,
"score": 0.999935507774353,
"start": 1705,
"tag": "EMAIL",
"value": "samsat.selatan@yahoo.com"
},
{
"context": "samsat.selatan@yahoo.com dan \" +\n \"uppkb.samsatselatan@jakarta.go.id\" +\n \"\\n Telp: (021) 5737219\\n\" +\n ",
"end": 1788,
"score": 0.9999356865882874,
"start": 1755,
"tag": "EMAIL",
"value": "uppkb.samsatselatan@jakarta.go.id"
},
{
"context": ",\" +\n \" Jakarta Timur 13410, email: samsat.timur@yahoo.co.id\" +\n \"\\nTelp: (021) 8199849-52, 819",
"end": 2203,
"score": 0.9999346733093262,
"start": 2179,
"tag": "EMAIL",
"value": "samsat.timur@yahoo.co.id"
},
{
"context": " \"Selatan-Gambir, Jakarta Pusat 10160, email: upt.humasdpp@gmail.com, \" +\n \"Facebook: Humas Pajak Jakar",
"end": 2598,
"score": 0.9999083280563354,
"start": 2576,
"tag": "EMAIL",
"value": "upt.humasdpp@gmail.com"
},
{
"context": "humasdpp@gmail.com, \" +\n \"Facebook: Humas Pajak Jakarta, Website: dpp.jakarta.go.id, Instagram: \" +\n ",
"end": 2650,
"score": 0.7581496238708496,
"start": 2631,
"tag": "NAME",
"value": "Humas Pajak Jakarta"
},
{
"context": "pp.jakarta.go.id, Instagram: \" +\n \"humaspajakjakarta, Pinterest: Humas Pajak Jakarta, Twitter: @humasp",
"end": 2729,
"score": 0.9868738055229187,
"start": 2712,
"tag": "USERNAME",
"value": "humaspajakjakarta"
},
{
"context": "kjakarta, Pinterest: Humas Pajak Jakarta, Twitter: @humaspajakjkt, Youtube: \" +\n \"Humas Pajak Jakart",
"end": 2786,
"score": 0.9986780285835266,
"start": 2772,
"tag": "USERNAME",
"value": "@humaspajakjkt"
},
{
"context": " +\n \"Humas Pajak Jakarta, Google +: upt.humasdpp@gmail.com\" +\n \"\\nTelp: (021) 3865580-85 ext ",
"end": 2871,
"score": 0.9998652338981628,
"start": 2849,
"tag": "EMAIL",
"value": "upt.humasdpp@gmail.com"
}
] | null |
[] |
package com.novia.licencecode.db;
import android.content.Context;
/**
* Created by meta on 10/07/18.
*/
public class DataSamsat {
public static void save(Context context) {
SamsatDb db = new SamsatDb(context);
Samsat samsat = new Samsat();
samsat.address = "Kantor Bersama Samsat Jakarta Utara Pusat, Jl. Gunung Sahari No. 13, " +
"Pademangan, Jakarta Utara 14420, email: <EMAIL>" +
"\nTelp: (021) 64715202, 6405826\n" +
"Fax: (021) 6405826";
samsat.name = "Unit PKB & BBN-KB Jakarta Pusat";
samsat.lat = -6.137323;
samsat.lon = 106.833297;
db.insert(samsat);
samsat.address = "Kantor Bersama Samsat Jakarta Barat, Jl. Daan Mogot KM. 13, Cengkareng, " +
"Jakarta Barat 11720, email: <EMAIL>" +
"\nTelp: (021) 5442283, 5442301, 5442302\n" +
"Fax: (021) 5442283";
samsat.name = "Unit PKB & BBN-KB Jakarta Barat";
samsat.lat = -6.153667;
samsat.lon = 106.738311;
db.insert(samsat);
samsat.address = "Kantor Bersama Samsat Jakarta Utara Pusat, Jl. Gunung Sahari No. 13, " +
"Pademangan, Jakarta Utara 14420, email: <EMAIL>" +
"\nTelp: (021) 64715202\n" +
"Fax: (021) 6404304, 6404918";
samsat.name = "Unit PKB & BBN-KB Jakarta Utara";
samsat.lat = -6.137323;
samsat.lon = 106.833297;
db.insert(samsat);
samsat.address = "Komplek Gedung Polda Metro Jaya, Jl. Jendral Gatot Subroto, Kebayoran Baru," +
" Jakarta Selatan 12110, email: <EMAIL> dan " +
"<EMAIL>" +
"\n Telp: (021) 5737219\n" +
"Fax: (021) 5255382";
samsat.name = "Unit PKB & BBN-KB Jakarta Selatan";
samsat.lat = -6.223468;
samsat.lon = 106.814274;
db.insert(samsat);
samsat.address = "Kantor Bersama Samsat Jakarta Timur, Jl. D.I. Panjaitan Kav. 55, Jatinegara," +
" Jakarta Timur 13410, email: <EMAIL>" +
"\nTelp: (021) 8199849-52, 8199854";
samsat.name = "Unit PKB & BBN-KB Jakarta Timur";
samsat.lat = -6.229504;
samsat.lon = 106.87688;
db.insert(samsat);
samsat.address = "Kantor Dinas Pelayanan Pajak, Jl. Abdul Muis No. 66 Lantai 1 dan 10, Petojo " +
"Selatan-Gambir, Jakarta Pusat 10160, email: <EMAIL>, " +
"Facebook: <NAME>, Website: dpp.jakarta.go.id, Instagram: " +
"humaspajakjakarta, Pinterest: Humas Pajak Jakarta, Twitter: @humaspajakjkt, Youtube: " +
"Humas Pajak Jakarta, Google +: <EMAIL>" +
"\nTelp: (021) 3865580-85 ext 5036 & 5037, atau (021) 3865629 " +
"dan Tlp/Fax : (021) 3865765";
samsat.name = "Unit Pelayanan Penyuluhan dan Layanan Informasi (Humas DPP)";
samsat.lat = -6.184263;
samsat.lon = 106.8272497;
db.insert(samsat);
}
}
| 3,027
| 0.57931
| 0.480878
| 71
| 43.929577
| 31.11194
| 105
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| false
| false
|
3
|
ca3549e7934523e4912bc988f7d8bf27532a2679
| 23,227,183,191,904
|
5eb90a0d72c68df36276de106c9b060207f955c0
|
/app/src/main/java/net/yupol/transmissionremote/app/transport/request/PortTestRequest.java
|
abec7ce130883e977141dbc771828226458f0c05
|
[
"Apache-2.0"
] |
permissive
|
y-polek/TransmissionRemote
|
https://github.com/y-polek/TransmissionRemote
|
c74aa6c26b08e17d372d073eb01c73fa3048d32c
|
10e06894194201524dff11b6b50d416bad630e95
|
refs/heads/develop
| 2023-03-17T18:25:22.623000
| 2023-03-12T10:30:51
| 2023-03-12T10:30:51
| 58,270,602
| 159
| 52
|
Apache-2.0
| false
| 2023-09-09T09:43:22
| 2016-05-07T14:54:30
| 2023-08-13T11:33:03
| 2023-09-09T09:43:21
| 5,308
| 138
| 37
| 43
|
Java
| false
| false
|
package net.yupol.transmissionremote.app.transport.request;
import net.yupol.transmissionremote.app.model.json.PortTestResult;
import org.json.JSONObject;
public class PortTestRequest extends Request<PortTestResult> {
public PortTestRequest() {
super(PortTestResult.class);
}
@Override
public String getMethod() {
return "port-test";
}
@Override
public JSONObject getArguments() {
return null;
}
}
|
UTF-8
|
Java
| 460
|
java
|
PortTestRequest.java
|
Java
|
[] | null |
[] |
package net.yupol.transmissionremote.app.transport.request;
import net.yupol.transmissionremote.app.model.json.PortTestResult;
import org.json.JSONObject;
public class PortTestRequest extends Request<PortTestResult> {
public PortTestRequest() {
super(PortTestResult.class);
}
@Override
public String getMethod() {
return "port-test";
}
@Override
public JSONObject getArguments() {
return null;
}
}
| 460
| 0.697826
| 0.697826
| 22
| 19.90909
| 21.142179
| 66
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.272727
| false
| false
|
3
|
47addc36a4009a2fb55e286ac0a2c4c390165b14
| 16,200,616,698,372
|
fcbfa8ff6c1305a8ccd4c912aafe42b30f64e0cf
|
/MenuBI/app/src/main/java/com/example/menubi/AjoutePlat.java
|
9d18f740902083cc0d80412aef3c90f31e3c69d9
|
[] |
no_license
|
AminaInf/Team-5
|
https://github.com/AminaInf/Team-5
|
9ab3e790e4fbe975549f229469ca7dc5fc3ca148
|
b55cd2b9a48a2a2dbe036541b61580fe48fe9273
|
refs/heads/master
| 2020-12-20T17:15:48.544000
| 2020-02-03T14:37:59
| 2020-02-03T14:37:59
| 236,151,711
| 0
| 0
| null | true
| 2020-01-25T09:50:08
| 2020-01-25T09:50:08
| 2020-01-24T17:27:54
| 2020-01-24T17:27:52
| 6,280
| 0
| 0
| 0
| null | false
| false
|
package com.example.menubi;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.Toast;
import com.example.menubi.Model.Plat;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
public class AjoutePlat extends AppCompatActivity {
EditText nomPlat,descriptionPlat,prix;
ImageButton btnInputImage;
ImageView imageplat;
Button btnValide;
Plat plat;
DatabaseReference reff;
public static final int IMAGE_PICK_CODE = 1000;
public static final int PERMISSION_CODE = 1001;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ajoute_plat);
// initialisation des bouton et editext
nomPlat = (EditText) findViewById(R.id.nomPlat);
descriptionPlat = (EditText) findViewById(R.id.descriptionPlat);
prix = (EditText) findViewById(R.id.prix);
btnInputImage =(ImageButton) findViewById(R.id.btnInputImage);
imageplat = (ImageView) findViewById(R.id.imageplat);
btnValide = (Button) findViewById(R.id.btnValider);
reff = FirebaseDatabase.getInstance().getReference().child("Plat");
//Listener Bouton input image
btnInputImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
if (checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
== PackageManager.PERMISSION_DENIED){
//permission nom accorder
String permissions = (Manifest.permission.READ_EXTERNAL_STORAGE);
requestPermissions(new String[]{permissions}, PERMISSION_CODE);
}
else {
//permission accorder
choisirImageGallerie();
}
}
else {
// System os is less then marshmailcw
choisirImageGallerie();
}
}
});
btnValide.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String nom = nomPlat.getText().toString();
String desc = descriptionPlat.getText().toString();
String pr = descriptionPlat.getText().toString();
plat.setNomPlat(nom);
plat.setDescription(desc);
plat.setPrix(pr);
reff.push().setValue(plat);
Toast.makeText(AjoutePlat.this,"Donnée inserer avec succes", Toast.LENGTH_LONG).show();
}
});
}
private void choisirImageGallerie() {
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("image/*");
startActivityForResult(intent, IMAGE_PICK_CODE);
}
//resultat de image choisi
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK && requestCode == IMAGE_PICK_CODE ){
imageplat.setImageURI(data.getData());
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode){
case PERMISSION_CODE:{
if (grantResults.length >=0 && grantResults[0] == PackageManager.PERMISSION_GRANTED){
//permission est accorder
}
else {
//permission n'est pas accordé
Toast.makeText(this,"Permission non accordé", Toast.LENGTH_SHORT).show();
}
}
}
}
}
|
UTF-8
|
Java
| 4,444
|
java
|
AjoutePlat.java
|
Java
|
[] | null |
[] |
package com.example.menubi;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.Toast;
import com.example.menubi.Model.Plat;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
public class AjoutePlat extends AppCompatActivity {
EditText nomPlat,descriptionPlat,prix;
ImageButton btnInputImage;
ImageView imageplat;
Button btnValide;
Plat plat;
DatabaseReference reff;
public static final int IMAGE_PICK_CODE = 1000;
public static final int PERMISSION_CODE = 1001;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ajoute_plat);
// initialisation des bouton et editext
nomPlat = (EditText) findViewById(R.id.nomPlat);
descriptionPlat = (EditText) findViewById(R.id.descriptionPlat);
prix = (EditText) findViewById(R.id.prix);
btnInputImage =(ImageButton) findViewById(R.id.btnInputImage);
imageplat = (ImageView) findViewById(R.id.imageplat);
btnValide = (Button) findViewById(R.id.btnValider);
reff = FirebaseDatabase.getInstance().getReference().child("Plat");
//Listener Bouton input image
btnInputImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
if (checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
== PackageManager.PERMISSION_DENIED){
//permission nom accorder
String permissions = (Manifest.permission.READ_EXTERNAL_STORAGE);
requestPermissions(new String[]{permissions}, PERMISSION_CODE);
}
else {
//permission accorder
choisirImageGallerie();
}
}
else {
// System os is less then marshmailcw
choisirImageGallerie();
}
}
});
btnValide.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String nom = nomPlat.getText().toString();
String desc = descriptionPlat.getText().toString();
String pr = descriptionPlat.getText().toString();
plat.setNomPlat(nom);
plat.setDescription(desc);
plat.setPrix(pr);
reff.push().setValue(plat);
Toast.makeText(AjoutePlat.this,"Donnée inserer avec succes", Toast.LENGTH_LONG).show();
}
});
}
private void choisirImageGallerie() {
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("image/*");
startActivityForResult(intent, IMAGE_PICK_CODE);
}
//resultat de image choisi
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK && requestCode == IMAGE_PICK_CODE ){
imageplat.setImageURI(data.getData());
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode){
case PERMISSION_CODE:{
if (grantResults.length >=0 && grantResults[0] == PackageManager.PERMISSION_GRANTED){
//permission est accorder
}
else {
//permission n'est pas accordé
Toast.makeText(this,"Permission non accordé", Toast.LENGTH_SHORT).show();
}
}
}
}
}
| 4,444
| 0.618329
| 0.616077
| 131
| 32.900764
| 27.638853
| 121
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.549618
| false
| false
|
3
|
4e3913a0a2ea705dcbe3e6205efc3e8952b11257
| 31,894,427,202,924
|
437f3effa2af2031631b3643cadeaaa6a2ad3069
|
/Service method for sign up/Signup_servicess.java
|
34207ee82a36295458b0348d83468eadf33ffe41
|
[] |
no_license
|
krishnajanolia1994/project-online-examination-System-
|
https://github.com/krishnajanolia1994/project-online-examination-System-
|
290bf5d347a7add6f6f2b2074cc447272ed62f3f
|
e0915a37ab1def6bfcefc7765938ccd4832ea90f
|
refs/heads/master
| 2018-09-19T16:18:39.209000
| 2017-06-08T08:43:54
| 2017-06-08T08:43:54
| 93,726,640
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.krishna;
import com.mysql.jdbc.*;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.PreparedStatement;
import com.mysql.jdbc.Statement;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.sql.*;
import java.io.IOException;
import java.sql.*;
public class Signup_servicess {
public void service(HttpServletRequest req,HttpServletResponse res,String Table_name) throws IOException
{
String First_name=req.getParameter("First_name");
String Last_name=req.getParameter("Last_Name");
String email_adress=req.getParameter("Email_Address");
String password=req.getParameter("password");
try {
Class.forName("com.mysql.jdbc.Driver");
try {
Connection con=(Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/Online_Exanmination_System", "root","");
Statement st=(Statement) con.createStatement();
String Quary1="select First_Name From"+ Table_name +" Where First_Name = "+ First_name;
String Quary2="select Last_Name From"+ Table_name +" Where Last_Name = "+ Last_name;
String Quary3="inset into"+Table_name+"(Last_Name,Email_Address,Password,First_Name) values(?,?,?,?)";
String Eror="";
String sendr="";
if(Table_name.equals("student_login_table"))
{
sendr+="sign-up-login-form/index.html";
}
else
{
sendr+="sign-up-login-form/index.html1";
}
//code to check Whether First_name is already Exist or not
ResultSet rs=st.executeQuery(Quary1);
HttpSession session= req.getSession();
if(rs.next())
{
Eror+="user name is Allraidy Exist";
session.setAttribute("error", Eror);
res.sendRedirect(sendr);
}
else
{
//code to check whether last name is exist or not
rs=st.executeQuery(Quary2);
if(rs.next())
{
Eror+="user Last Name is Allraidy Exist";
session.setAttribute("error", Eror);
res.sendRedirect(sendr);
}
else
{
PreparedStatement pst=(PreparedStatement) con.prepareStatement(Quary3);
pst.executeUpdate();
pst.setString(1,Last_name);
pst.setString(2,email_adress);
pst.setString(1,password);
pst.setString(4,First_name);
}
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
|
UTF-8
|
Java
| 2,508
|
java
|
Signup_servicess.java
|
Java
|
[] | null |
[] |
package com.krishna;
import com.mysql.jdbc.*;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.PreparedStatement;
import com.mysql.jdbc.Statement;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.sql.*;
import java.io.IOException;
import java.sql.*;
public class Signup_servicess {
public void service(HttpServletRequest req,HttpServletResponse res,String Table_name) throws IOException
{
String First_name=req.getParameter("First_name");
String Last_name=req.getParameter("Last_Name");
String email_adress=req.getParameter("Email_Address");
String password=req.getParameter("password");
try {
Class.forName("com.mysql.jdbc.Driver");
try {
Connection con=(Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/Online_Exanmination_System", "root","");
Statement st=(Statement) con.createStatement();
String Quary1="select First_Name From"+ Table_name +" Where First_Name = "+ First_name;
String Quary2="select Last_Name From"+ Table_name +" Where Last_Name = "+ Last_name;
String Quary3="inset into"+Table_name+"(Last_Name,Email_Address,Password,First_Name) values(?,?,?,?)";
String Eror="";
String sendr="";
if(Table_name.equals("student_login_table"))
{
sendr+="sign-up-login-form/index.html";
}
else
{
sendr+="sign-up-login-form/index.html1";
}
//code to check Whether First_name is already Exist or not
ResultSet rs=st.executeQuery(Quary1);
HttpSession session= req.getSession();
if(rs.next())
{
Eror+="user name is Allraidy Exist";
session.setAttribute("error", Eror);
res.sendRedirect(sendr);
}
else
{
//code to check whether last name is exist or not
rs=st.executeQuery(Quary2);
if(rs.next())
{
Eror+="user Last Name is Allraidy Exist";
session.setAttribute("error", Eror);
res.sendRedirect(sendr);
}
else
{
PreparedStatement pst=(PreparedStatement) con.prepareStatement(Quary3);
pst.executeUpdate();
pst.setString(1,Last_name);
pst.setString(2,email_adress);
pst.setString(1,password);
pst.setString(4,First_name);
}
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| 2,508
| 0.675837
| 0.669856
| 85
| 28.505882
| 26.486677
| 129
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 3.8
| false
| false
|
3
|
7ddebd5580c728158d0358e157b84d84ce48555a
| 31,894,427,203,777
|
13ed24a1824fe486a08b582398ff5b532e1728e5
|
/initialBettingSW/src/fr/uv1/bettingServices/Competition.java
|
70e2a92985eacbc9303ff936f350b5ab2d4d31a7
|
[] |
no_license
|
marthiam/Filrouge
|
https://github.com/marthiam/Filrouge
|
b05e382c12234dc03f0b83fd30e011b3a3980cfd
|
7c85f3473d917b791abdd9d819c9d598f5cb6fd9
|
refs/heads/master
| 2020-04-05T12:47:59.035000
| 2014-05-26T17:11:37
| 2014-05-26T17:11:37
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
*
*/
package fr.uv1.bettingServices;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import fr.uv1.bettingServices.exceptions.BadParametersException;
import fr.uv1.bettingServices.exceptions.CompetitionException;
import fr.uv1.bettingServices.exceptions.ExistingCompetitorException;
import fr.uv1.bettingServices.exceptions.SubscriberException;
import fr.uv1.utils.MyCalendar;
/**
* @author Mamadou
* Mariam
*
*/
public class Competition {
/** La taille minimum du nom d'une compétition */
private static final int LONG_COMPETITION = 4;
/** La contrainte que le nom de la compétition doit verifier */
private static final String REGEX_COMPETITION = new String(
"[a-zA-Z0-9\\-\\_]*");
/** L'identifiant de la compétition */
private int id_competition;
/** Le nom de la compétition */
private String nomCompetition;
/** La date de la compétition */
private MyCalendar dateCompetition;
/** Le montant total misé sur la compétition */
private long montantTotalMise;
/** La liste des compétiteurs */
private Collection<Competitor> competitors;
/** La liste des paris */
private ArrayList<Pari> betList;
/**
* Constructeur
* @param nomCompetition
* Le nom de la competition
* @param dateCompetition
* La date de la competition
* @param montantTotalMise
* Le montant total misé sur la compétition
* @param competitors
* La liste des compétiteurs
* @throws BadParametersException
* est levée si l'un de paramètre est invalide ou non instancié
*
* @throws CompetitionException
* est levée si la date de fermeture de la competition est passée
*
*/
public Competition(String nomCompetition, MyCalendar dateCompetition,
ArrayList<Competitor> competitors) throws BadParametersException,
CompetitionException {
this.setNomCompetition(nomCompetition);
this.setDateCompetition(dateCompetition);
this.montantTotalMise = 0;
this.competitors = new ArrayList<Competitor>();
this.setCompetitors(competitors);
this.betList = new ArrayList<Pari>();
}
/**
* Renvoie l'identifiant de la competition
* @return id_compétition
* l'identifiant de la competition
*/
public int getId_competition() {
return id_competition;
}
/**
* Met à jour l'identifiant de la competition
* @param id_compétition
* le nouveau identifiant
*/
public void setId_competition(int id_competition) {
this.id_competition = id_competition;
}
/**
* Renvoie le nom de la compétition
* @return
* le nom de la compétition
*/
public String getNomCompetition() {
return nomCompetition;
}
/**
* Met à le jour nom de la compétition
* @param nomCompetition
* le nouveau nom de la compétition
*/
public void setNomCompetition(String nomCompetition)
throws BadParametersException {
checkStringNomCompetition(nomCompetition);
this.nomCompetition = nomCompetition;
}
/**
* Renvoie la date de fermetue de competion
* @return
* la date de fermeture de la compétition
*/
public MyCalendar getDateCompetition() {
return dateCompetition;
}
/**
* Met à jour la date de fermetue de competion
* @param date
* la nouvelle date de la compétition
* @throws BadParametersException
* est levée si la date n'est pas instancié
* @throws CompetitionException
* est levée si la date est passée
*/
public void setDateCompetition(MyCalendar newDate)
throws CompetitionException, BadParametersException {
if(newDate ==null)throw new BadParametersException("la date de fermeture doit être instancié ");
if (newDate.isInThePast() )
throw new CompetitionException("Cette date est passée");
this.dateCompetition = newDate;
}
/**
* Renvoie le montant total misé sur la competition
* @return
* Le montant total misé sur la compétition
*/
public long getMontantTotalMise() {
return montantTotalMise;
}
/**
* Met à jour le montant total misé sur la competition
* @param newMontantTotalMise
* Le nouveau montant total misé sur la compétition
* @throws BadParametersException
* est leveé si ce montant est < 0
*/
public void setMontantTotalMise(long newMontantTotalMise)
throws BadParametersException {
if (newMontantTotalMise < 0)
throw new BadParametersException(newMontantTotalMise
+ " est un montant total invalide");
this.montantTotalMise = newMontantTotalMise;
}
/**
* Renvoie les competiteurs de la competition
* @return
* La liste des competiteurs de la competition
*/
public Collection<Competitor> getCompetitors() {
return competitors;
}
/**
* Met à jour le competiteurs de competition
* @param competitors
* La nouvelle liste de competiteurs
* @throws CompetitionException
* est levée si le nombre de competiteur est <2 ou si ils ne sont pas du même type reel
* @throws BadParametersException
* est levée si la liste ou l'un des competiteur est non instancié ou si elle est vide
* @see fr.uv1.bettingServices.Competition#addCompetitor(Competitor)
*/
public void setCompetitors(ArrayList<Competitor> competitors)
throws CompetitionException, BadParametersException {
if (competitors == null || competitors.size() == 0)
throw new BadParametersException(
"La liste des compétiteurs n'a pas été instancié");
if (competitors.size() < 2) {
throw new CompetitionException(
"Une compétition doit avoir au moins deux competiteurs");
}
int i = 0;
if (competitors.get(i) instanceof Individual) {
while (i < competitors.size()) {
/* Si le premier compétiteur est un compétiteur de type Individual,
* on s'assure que tous les autres compétiteurs sont des
* compétiteurs de type Individual
*
*/
if (!(competitors.get(i) instanceof Individual)) {
throw new CompetitionException(
"Les compétiteurs d'une compétition doivent être instance d'une "
+ "meme classe");
} else {
this.addCompetitor(((ArrayList<Competitor>) competitors)
.get(i));
i++;
}
}
} else {
i = 0;
if (competitors.get(i) instanceof Team) {
Team team = (Team) ((ArrayList<Competitor>) competitors).get(i);
while (i < competitors.size()) {
/* Si le premier compétiteur est un compétiteur de type Team,
* on s'assure que tous les autres compétiteurs sont des
* compétiteurs de type Team
*/
if (!(competitors.get(i) instanceof Team)) {
throw new CompetitionException(
"Les compétiteurs d'une compétition doivent être instance d'une "
+ "meme classe");
} else {
if (team.getMembers() == null)
throw new CompetitionException();
this.addCompetitor(((ArrayList<Competitor>) competitors)
.get(i));
i++;
}
}
}
}
}
/**
* Renvoie les paris d'une competition
*
* @return
* La liste des paris sur la compétition
*/
public ArrayList<Pari> getBetList() {
return betList;
}
/**
* Met à jour les paris d'une competition
* @param betList
* La nouvelle liste de pari
* @throws BadParametersException
* est levée si la nouvelle liste de paris ne correspond pas à cette competition.
*/
public void setBetList(ArrayList<Pari> betList) throws BadParametersException {
for(Pari p : betList){
if(p instanceof PariWinner ){
if(!(this.participe(((PariWinner) p).getWinner()))){
throw new BadParametersException("cette liste de paris ne correspont pas à cette competition");
}
}else{
if(!(this.participe(((PariPodium) p).getWinner())) ||! (this.participe(((PariPodium) p).getSecond())) || !(this.participe(((PariPodium) p).getThird())) ){
throw new BadParametersException("cette liste de paris ne correspont pas à cette competition");
}
}
this.montantTotalMise +=p.getMise();
}
this.betList = betList;
}
/**
* Renvoie si le competiteur participe à la competirion
* @param competitor
* le competitor à regarder
* @return
* vrai si le competiteur est un competiteur de cette competition
*/
public boolean participe(Competitor competitor ){
for (Competitor c :this.competitors ){
if(c.equals(competitor)){
return true;
}
}
return false ;
}
/**
* Supprime tous les paris qu'un joueur a fait sur une
* compétition
*
* @param subscriber
* le joueur dont les paris seront supprimés
*
* @throws CompetitionException
* est levée si: <br>
* La compétition est fermée
*/
public void supprimerParisCompetition(Subscriber subscriber)
throws CompetitionException {
long numberTokens = 0;
if (this.isInThePast())
throw new CompetitionException("La compétition est fermée");
for (Pari pari : this.betList) {
if (pari.getSubscriber().equals(subscriber))
numberTokens += pari.getMise();
this.betList.remove(pari);
}
try {
subscriber.crediter(numberTokens);
} catch (BadParametersException e) {
e.printStackTrace();
}
}
/**
* Parier sur le vainqueur<br>
* On débite le compte du joueur du montant misé.
*
* @param pariwin
* Le pari qui contient: <br>
* Le pari qui contient le montant de la mise <br>
* Le joueur qui fait le pari <br>
* Le compétiteur sur lesquels il parie <br>
*
* @throws CompetitionException
* est levé si: <br>
* Le compétiteur ne participe pas à la compétition sur laquelle le
* joueur fait le pari <br>
* La date de la competition est passée <br>
* Le joueur est un competiteur de la competition
* sur laquelle il fait le pari <br>
*
* @throws BadParametersException
* est levé si: <br>
* le pari n'a pas été instancié
* @throws SubscriberException
* est levé si: <br>
* le joueur n'a pas assez de jetons <br>
*/
public void parierSurLeVainqueur(PariWinner pariwin)
throws CompetitionException,
SubscriberException, BadParametersException {
if (pariwin == null)
throw new BadParametersException("paramètre pari non instancié");
boolean trouve = this.getCompetitors().contains(pariwin.getWinner());
if (!trouve) {
throw new CompetitionException(
"Ce competiteur ne participe pas à cette competition");
}
if (this.isInThePast())
throw new CompetitionException(
"La date de la competition est passée");
if (pariwin.getWinner() instanceof Individual) {
Person subcriber = (Person) pariwin.getSubscriber();
Person competiteur;
for (Competitor c : this.getCompetitors()) {
competiteur = (Person) c;
if (competiteur.equals(subcriber)) {
throw new CompetitionException(
"Le joueur est un competiteur de la competition");
}
}
} else if (pariwin.getWinner() instanceof Team) {
Team team;
Person competiteur = null;
for (Competitor competitor : this.getCompetitors()) {
team = (Team) competitor;
for (Competitor member : team.getMembers()) {
competiteur = (Person) member;
if (pariwin.getSubscriber().equals(competiteur)) {
throw new CompetitionException(
"Le joueur fait partie d'une équipe de la compétition");
}
}
}
}
pariwin.getSubscriber().debiter(pariwin.getMise());
betList.add(pariwin);
this.montantTotalMise += pariwin.getMise();
}
/**
* Parier sur le podium <br>
* On débite le compte du joueur du montant misé.
*
* @param paripod
* Le pari qui contient: <br>
* Le pari qui contient le montant de la mise <br>
* Le joueur qui fait le pari <br>
* Les trois compétiteurs sur lesquels il parie <br>
*
* @throws CompetitionException
* est levé si: <br>
* l'un au moins des trois compétiteurs
* ne participe pas à la compétition sur laquelle il
* fait le pari <br>
* La date de la competition est passée <br>
* Le joueur est un competiteur de la competition
* sur laquelle le joueur fait le pari <br>
*
* @throws BadParametersException
* est levé si: <br>
* le pari n'a pas été instancié
* @throws SubscriberException
* est levé si: <br>
* le joueur n'a pas assez de jetons <br>
*/
public void parierSurLePodium(PariPodium paripod)
throws CompetitionException, BadParametersException, SubscriberException {
if (paripod == null)
throw new BadParametersException(
"pari avec un pariPodium non instancié");
boolean trouveWinner = this.getCompetitors().contains(
paripod.getWinner());
boolean trouveSecond = this.getCompetitors().contains(
paripod.getSecond());
boolean trouveThird = this.getCompetitors()
.contains(paripod.getThird());
if (!trouveWinner || !trouveSecond || !trouveThird)
throw new CompetitionException(
"Un 1 ou plusieurs de ces trois competiteurs ne participe pas "
+ "à cette competition");
if (this.isInThePast())
throw new CompetitionException(
"La date de la competition est passée");
if (paripod.getWinner() instanceof Individual) {
Person competiteur;
for (Competitor competitor : this.getCompetitors()) {
competiteur = (Person) competitor;
if (paripod.getSubscriber().equals(competiteur))
throw new CompetitionException(
"Le joueur est un competiteur de la competition");
}
} else if (paripod.getWinner() instanceof Team) {
Person competiteur;
Team team;
for (Competitor competitor : this.getCompetitors()) {
team = (Team) competitor;
if (team != null) {
for (Competitor member : team.getMembers()) {
competiteur = (Person) member;
if (paripod.getSubscriber().equals(competiteur)) {
throw new CompetitionException(
"Le joueur fait partie d'une equipe de la competition");
}
}
}
}
}
paripod.getSubscriber().debiter(paripod.getMise());
// On ajoute le pari à la liste des paris de la compétition
this.betList.add(paripod);
this.montantTotalMise += paripod.getMise();
}
/**
* Solder les paris sur le vainqueur <br>
* Le compte de tous les joueurs ayant parié le vrai vainqueur
* de la compétition est credité d'un nombre de jetons égal à: <br>
* (nombre de jetons misé par le joueur * le nombre total de jetons
* misés sur cette compétition) / le nombre total de jetons misés sur
* le vrai vainqueur. <br>
* Si aucun joueur ne mise sur le vrai vainqueur, le compte de chaque
* joueur est crédité du nombre de jetons qu'il a misé sur cette compétition
* La compétition est alors supprimée s'il n'y a plus de pari pour cette
* compétition
*
* @param winner
* competitor winner.
*
* @throws CompetitionException
* est levé si: <br>
* le compétiteur winner ne participe pas à la compétition <br>
* la compétition est toujours ouverte <br>
*
* @throws BadParametersException
* est levé si: <br>
* Le winner n'a pas été instancié <br>
*
*/
public void solderPariWinner(Competitor winner)
throws CompetitionException, BadParametersException {
if (winner == null)
throw new BadParametersException(
"Le vainqueur n'a pas été instancié");
long tokensBettedForWinner = 0;
long tokensWonBySubscriber = 0;
boolean trouve = this.competitors.contains(winner); // si le competiteur existe deja
boolean quelqunATrouverLegagnant = false; // dit si un joueur a parié sur le gagnant
if (!trouve)
throw new CompetitionException("Ce competiteur ne participe pas à cette competition");
if (!(this.isInThePast()))
throw new CompetitionException("Cette compétition est toujours ouverte");
/* On calcule le nombre de jetons misés sur le vrai vainqueur */
for (Pari pari : this.betList) {
if (pari instanceof PariWinner
&& ((PariWinner) pari).getWinner().equals(winner)) {
tokensBettedForWinner += pari.getMise(); // le cumul de la somme miser sur le gagnant
}
}
for (Pari pari : this.betList) {
if (pari instanceof PariWinner) {
if ( pari.getWinner().equals(winner)) {
quelqunATrouverLegagnant = true;
tokensWonBySubscriber = (pari.getMise() * this.montantTotalMise) // cacul du gain d'un joueur ayant gagné
/ tokensBettedForWinner;
try {
pari.getSubscriber().crediter(tokensWonBySubscriber);
} catch (BadParametersException e) {
System.out.println("bug");
}
}
}
}
/*
Si aucun joueur ne mise sur le vrai vainqueur, le compte de chaque
joueur est crédité du nombre de jetons qu'il a misé sur cette compétition
*/
if (!quelqunATrouverLegagnant) {
for (Pari pari : this.betList) {
pari.getSubscriber().crediter(pari.getMise());
this.betList.remove(pari);
}
}
}
/**
* Solder les paris sur le podium <br>
*
* Le compte de tous les joueurs qui ont parié sur le bon podium est
* crédité d'un nombre de jetons égal à : <br>
* (nombre de jetons misé par le joueur * le nombre total de jetons
* misés sur cette compétition) / le nombre total de jetons misés sur
* le bon podium. <br>
* Si aucun joueur ne mise sur le bon podium, le compte de chaque
* joueur est crédité du nombre de jetons qu'il a misé sur cette compétition
* La compétition est alors supprimée s'il n'y a plus de pari pour cette
* compétition
*
* @param winner
* the winner.
* @param second
* the second.
* @param third
* the third.
*
* @throws CompetitionException
* est levée si:<br>
* au moins deux competiteurs sur le podium sont les mêmes <br>
* au moins un des compétiteurs sur le podium ne participe pas à
* la compétition <br>
* la compétition est toujours ouverte
*
* @throws BadParametersException
* est levée si:<br>
* le winner, le second ou le third n'a pas été instancié
*/
public void solderPariPodium(Competitor winner, Competitor second,
Competitor third) throws CompetitionException,
BadParametersException {
if (winner == null)
throw new BadParametersException(
"Le vainqueur n'a pas été instancié");
if (second == null)
throw new BadParametersException(
"Le deuxième n'a pas été instancié");
if (third == null)
throw new BadParametersException(
"Le troisième n'a pas été instancié");
long tokensBettedForPodium = 0;
long tokensWonBySubscriber = 0;
boolean found = false;
boolean trouveWinner = this.competitors.contains(winner);
boolean trouveSecond = this.competitors.contains(second);
boolean trouveThird = this.competitors.contains(third);
if (!trouveWinner || !trouveSecond || !trouveThird)
throw new CompetitionException( "Un ou plusieurs de ces trois competiteurs ne participe pas "+ "à cette compétition");
if (!(this.isInThePast()))
throw new CompetitionException("Cette compétition est toujours ouverte");
/* On calcule le nombre de jetons misés sur le bon podium */
for (Pari pari : this.betList) {
if (pari instanceof PariPodium) {
if (((PariPodium) pari).getWinner().equals(winner)
&& ((PariPodium) pari).getSecond().equals(second)
&& ((PariPodium) pari).getThird().equals(third)) {
tokensBettedForPodium += pari.getMise();
}
}
}
for (Pari pari : this.betList) {
if (pari instanceof PariPodium) {
if (((PariPodium) pari).getWinner().equals(winner)
&& ((PariPodium) pari).getSecond().equals(second)
&& ((PariPodium) pari).getThird().equals(third)) {
found = true;
tokensWonBySubscriber = (pari.getMise() * this.montantTotalMise)
/ tokensBettedForPodium;
try {
pari.getSubscriber().crediter(tokensWonBySubscriber);
} catch (BadParametersException e) {
e.printStackTrace();
}
}
}
}
/*
Si aucun joueur ne mise sur le vrai vainqueur, le compte de chaque
joueur est crédité du nombre de jetons qu'il a misé sur cette compétition
*/
if (!found) {
for (Pari pari : this.betList) {
pari.getSubscriber().crediter(pari.getMise());
this.betList.remove(pari);
}
}
}
/**
* Consulte la liste des paris de la competition.
*
* @return
* une liste de chaîne contenant les pariss de la competition.
*/
public ArrayList<String> consulterParis() {
String infoPari;
ArrayList<String> infoParis = new ArrayList<String>();
for (Pari pari : this.betList) {
infoPari = pari.getSubscriberInfo(); // les infos du jouer
infoParis.add(infoPari);
infoPari= pari.winnerInfo(); // firstname + lastname + borndate of winner
infoParis.add(infoPari);
if (pari instanceof PariPodium){
infoPari=( (PariPodium) pari).secondInfo(); // same for the second
infoParis.add(infoPari);
infoPari=( (PariPodium)pari).thirdInfo(); // same for the third
infoParis.add(infoPari);
}
}
return infoParis;
}
/**
* Ajoute un competiteur à la compétition <br>
*
* @param newCompetitor
* le nouveau competiteur
* @throws CompetitionException
* est levée si le competiteur a dejà été ajouté .
* @throws BadParametersException
* est levée si le competiteur n'est pas instancié .
*/
public void addCompetitor(Competitor newCompetitor)
throws CompetitionException, BadParametersException {
if (newCompetitor == null)
throw new BadParametersException("competiteur non instancié");
if (this.competitors != null&& this.competitors.contains(newCompetitor)) {
//competiteur dejà existant
throw new CompetitionException(" le competiteur "
+ newCompetitor.toString() + " a deja été ajouté");
}
this.competitors.add(newCompetitor);// ajoute un nouveau competiteur
}
/**
* Renvoie si la competition à une date passée
*
* @return vrai si le closing date de la compétition est dans le passé Faux
* sinon
*
*/
public boolean isInThePast() {
return this.getDateCompetition().isInThePast();
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((nomCompetition == null) ? 0 : nomCompetition.hashCode());
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Competition other = (Competition) obj;
if (nomCompetition == null) {
if (other.nomCompetition != null) {
return false;
}
} else if (!nomCompetition.equals(other.nomCompetition)) {
return false;
}
return true;
}
/**
* Renvoie si la liste des paris de la competition est vide
* @return
* vrai si la liste des paris de la compétition est vide Faux sinon
*/
public boolean IsEmptybetList() {
return this.betList.isEmpty();
}
/**
* supprime un competiteur de la competition.
*
* @throws ExistingCompetitorException
* est levée si le competiteur ne participe pas à la competition
* */
public void removeCompetitor(Competitor competitor)
throws ExistingCompetitorException {
if (!(this.competitors.contains(competitor))) {
throw new ExistingCompetitorException("le competiteur "
+ competitor + " ne participe à la compeetition "
+ this.nomCompetition);
}
this.competitors.remove(competitor);
}
/**
* Cette méthode verifie la validité du nom d'une compétition. Seuls les
* lettres, les chiffres, les tirets et underscore sont autorisés. La taille
* de la chaine de caractères doit être au moins LONG_COMPETITION caractères
*
* @param nomCompetition
* Le nom de la compétition à verifier
*
* @throws BadParametersException
* est levé si le nom de la compétition est invalide
*/
private static void checkStringNomCompetition(String nomCompetition)
throws BadParametersException {
if (nomCompetition == null)
throw new BadParametersException(
"Le nom de la compétition n'a pas été instancié");
if (nomCompetition.length() < LONG_COMPETITION)
throw new BadParametersException(
"Le nom de la compétition est moins que "
+ LONG_COMPETITION + "caractères");
// Seuls les lettres et les chiffres sont autorisés
if (!nomCompetition.matches(REGEX_COMPETITION))
throw new BadParametersException("la competition " + nomCompetition
+ " ne verifie pas les contraintes ");
}
/**
* Renvoie la date de fermeture de la competition sous forme de chaine de
* caractère
*
* @return la chaine de caractère correspondant
*/
public String getClosingdate() {
return this.getDateCompetition().get(Calendar.YEAR) + "-"
+ (this.getDateCompetition().get(Calendar.MONTH) + 1) + "-"
+ this.getDateCompetition().get(Calendar.DATE);
}
@Override
public String toString() {
return this.nomCompetition + " " + this.getClosingdate();
}
}
|
ISO-8859-1
|
Java
| 26,274
|
java
|
Competition.java
|
Java
|
[
{
"context": "rt fr.uv1.utils.MyCalendar;\r\n\r\n\r\n/**\r\n * @author \tMamadou\r\n * \t\t\tMariam\r\n * \r\n */\r\n\r\npublic class Competiti",
"end": 468,
"score": 0.9786044359207153,
"start": 461,
"tag": "NAME",
"value": "Mamadou"
},
{
"context": ".MyCalendar;\r\n\r\n\r\n/**\r\n * @author \tMamadou\r\n * \t\t\tMariam\r\n * \r\n */\r\n\r\npublic class Competition {\r\n\r\n\t/** L",
"end": 482,
"score": 0.999742329120636,
"start": 476,
"tag": "NAME",
"value": "Mariam"
},
{
"context": ") {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Parier sur le vainqueur<br>\r\n\t * On débite le compte du ",
"end": 9480,
"score": 0.7369760274887085,
"start": 9474,
"tag": "NAME",
"value": "Parier"
},
{
"context": "ompte du joueur du montant misé.\r\n\t * \r\n\t * @param pariwin\r\n\t * Le pari qui contient: <br>\r\n\t ",
"end": 9576,
"score": 0.684495210647583,
"start": 9572,
"tag": "NAME",
"value": "pari"
},
{
"context": " du joueur du montant misé.\r\n\t * \r\n\t * @param pariwin\r\n\t * Le pari qui contient: <br>\r\n\t * ",
"end": 9579,
"score": 0.5564793944358826,
"start": 9576,
"tag": "USERNAME",
"value": "win"
}
] | null |
[] |
/**
*
*/
package fr.uv1.bettingServices;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import fr.uv1.bettingServices.exceptions.BadParametersException;
import fr.uv1.bettingServices.exceptions.CompetitionException;
import fr.uv1.bettingServices.exceptions.ExistingCompetitorException;
import fr.uv1.bettingServices.exceptions.SubscriberException;
import fr.uv1.utils.MyCalendar;
/**
* @author Mamadou
* Mariam
*
*/
public class Competition {
/** La taille minimum du nom d'une compétition */
private static final int LONG_COMPETITION = 4;
/** La contrainte que le nom de la compétition doit verifier */
private static final String REGEX_COMPETITION = new String(
"[a-zA-Z0-9\\-\\_]*");
/** L'identifiant de la compétition */
private int id_competition;
/** Le nom de la compétition */
private String nomCompetition;
/** La date de la compétition */
private MyCalendar dateCompetition;
/** Le montant total misé sur la compétition */
private long montantTotalMise;
/** La liste des compétiteurs */
private Collection<Competitor> competitors;
/** La liste des paris */
private ArrayList<Pari> betList;
/**
* Constructeur
* @param nomCompetition
* Le nom de la competition
* @param dateCompetition
* La date de la competition
* @param montantTotalMise
* Le montant total misé sur la compétition
* @param competitors
* La liste des compétiteurs
* @throws BadParametersException
* est levée si l'un de paramètre est invalide ou non instancié
*
* @throws CompetitionException
* est levée si la date de fermeture de la competition est passée
*
*/
public Competition(String nomCompetition, MyCalendar dateCompetition,
ArrayList<Competitor> competitors) throws BadParametersException,
CompetitionException {
this.setNomCompetition(nomCompetition);
this.setDateCompetition(dateCompetition);
this.montantTotalMise = 0;
this.competitors = new ArrayList<Competitor>();
this.setCompetitors(competitors);
this.betList = new ArrayList<Pari>();
}
/**
* Renvoie l'identifiant de la competition
* @return id_compétition
* l'identifiant de la competition
*/
public int getId_competition() {
return id_competition;
}
/**
* Met à jour l'identifiant de la competition
* @param id_compétition
* le nouveau identifiant
*/
public void setId_competition(int id_competition) {
this.id_competition = id_competition;
}
/**
* Renvoie le nom de la compétition
* @return
* le nom de la compétition
*/
public String getNomCompetition() {
return nomCompetition;
}
/**
* Met à le jour nom de la compétition
* @param nomCompetition
* le nouveau nom de la compétition
*/
public void setNomCompetition(String nomCompetition)
throws BadParametersException {
checkStringNomCompetition(nomCompetition);
this.nomCompetition = nomCompetition;
}
/**
* Renvoie la date de fermetue de competion
* @return
* la date de fermeture de la compétition
*/
public MyCalendar getDateCompetition() {
return dateCompetition;
}
/**
* Met à jour la date de fermetue de competion
* @param date
* la nouvelle date de la compétition
* @throws BadParametersException
* est levée si la date n'est pas instancié
* @throws CompetitionException
* est levée si la date est passée
*/
public void setDateCompetition(MyCalendar newDate)
throws CompetitionException, BadParametersException {
if(newDate ==null)throw new BadParametersException("la date de fermeture doit être instancié ");
if (newDate.isInThePast() )
throw new CompetitionException("Cette date est passée");
this.dateCompetition = newDate;
}
/**
* Renvoie le montant total misé sur la competition
* @return
* Le montant total misé sur la compétition
*/
public long getMontantTotalMise() {
return montantTotalMise;
}
/**
* Met à jour le montant total misé sur la competition
* @param newMontantTotalMise
* Le nouveau montant total misé sur la compétition
* @throws BadParametersException
* est leveé si ce montant est < 0
*/
public void setMontantTotalMise(long newMontantTotalMise)
throws BadParametersException {
if (newMontantTotalMise < 0)
throw new BadParametersException(newMontantTotalMise
+ " est un montant total invalide");
this.montantTotalMise = newMontantTotalMise;
}
/**
* Renvoie les competiteurs de la competition
* @return
* La liste des competiteurs de la competition
*/
public Collection<Competitor> getCompetitors() {
return competitors;
}
/**
* Met à jour le competiteurs de competition
* @param competitors
* La nouvelle liste de competiteurs
* @throws CompetitionException
* est levée si le nombre de competiteur est <2 ou si ils ne sont pas du même type reel
* @throws BadParametersException
* est levée si la liste ou l'un des competiteur est non instancié ou si elle est vide
* @see fr.uv1.bettingServices.Competition#addCompetitor(Competitor)
*/
public void setCompetitors(ArrayList<Competitor> competitors)
throws CompetitionException, BadParametersException {
if (competitors == null || competitors.size() == 0)
throw new BadParametersException(
"La liste des compétiteurs n'a pas été instancié");
if (competitors.size() < 2) {
throw new CompetitionException(
"Une compétition doit avoir au moins deux competiteurs");
}
int i = 0;
if (competitors.get(i) instanceof Individual) {
while (i < competitors.size()) {
/* Si le premier compétiteur est un compétiteur de type Individual,
* on s'assure que tous les autres compétiteurs sont des
* compétiteurs de type Individual
*
*/
if (!(competitors.get(i) instanceof Individual)) {
throw new CompetitionException(
"Les compétiteurs d'une compétition doivent être instance d'une "
+ "meme classe");
} else {
this.addCompetitor(((ArrayList<Competitor>) competitors)
.get(i));
i++;
}
}
} else {
i = 0;
if (competitors.get(i) instanceof Team) {
Team team = (Team) ((ArrayList<Competitor>) competitors).get(i);
while (i < competitors.size()) {
/* Si le premier compétiteur est un compétiteur de type Team,
* on s'assure que tous les autres compétiteurs sont des
* compétiteurs de type Team
*/
if (!(competitors.get(i) instanceof Team)) {
throw new CompetitionException(
"Les compétiteurs d'une compétition doivent être instance d'une "
+ "meme classe");
} else {
if (team.getMembers() == null)
throw new CompetitionException();
this.addCompetitor(((ArrayList<Competitor>) competitors)
.get(i));
i++;
}
}
}
}
}
/**
* Renvoie les paris d'une competition
*
* @return
* La liste des paris sur la compétition
*/
public ArrayList<Pari> getBetList() {
return betList;
}
/**
* Met à jour les paris d'une competition
* @param betList
* La nouvelle liste de pari
* @throws BadParametersException
* est levée si la nouvelle liste de paris ne correspond pas à cette competition.
*/
public void setBetList(ArrayList<Pari> betList) throws BadParametersException {
for(Pari p : betList){
if(p instanceof PariWinner ){
if(!(this.participe(((PariWinner) p).getWinner()))){
throw new BadParametersException("cette liste de paris ne correspont pas à cette competition");
}
}else{
if(!(this.participe(((PariPodium) p).getWinner())) ||! (this.participe(((PariPodium) p).getSecond())) || !(this.participe(((PariPodium) p).getThird())) ){
throw new BadParametersException("cette liste de paris ne correspont pas à cette competition");
}
}
this.montantTotalMise +=p.getMise();
}
this.betList = betList;
}
/**
* Renvoie si le competiteur participe à la competirion
* @param competitor
* le competitor à regarder
* @return
* vrai si le competiteur est un competiteur de cette competition
*/
public boolean participe(Competitor competitor ){
for (Competitor c :this.competitors ){
if(c.equals(competitor)){
return true;
}
}
return false ;
}
/**
* Supprime tous les paris qu'un joueur a fait sur une
* compétition
*
* @param subscriber
* le joueur dont les paris seront supprimés
*
* @throws CompetitionException
* est levée si: <br>
* La compétition est fermée
*/
public void supprimerParisCompetition(Subscriber subscriber)
throws CompetitionException {
long numberTokens = 0;
if (this.isInThePast())
throw new CompetitionException("La compétition est fermée");
for (Pari pari : this.betList) {
if (pari.getSubscriber().equals(subscriber))
numberTokens += pari.getMise();
this.betList.remove(pari);
}
try {
subscriber.crediter(numberTokens);
} catch (BadParametersException e) {
e.printStackTrace();
}
}
/**
* Parier sur le vainqueur<br>
* On débite le compte du joueur du montant misé.
*
* @param pariwin
* Le pari qui contient: <br>
* Le pari qui contient le montant de la mise <br>
* Le joueur qui fait le pari <br>
* Le compétiteur sur lesquels il parie <br>
*
* @throws CompetitionException
* est levé si: <br>
* Le compétiteur ne participe pas à la compétition sur laquelle le
* joueur fait le pari <br>
* La date de la competition est passée <br>
* Le joueur est un competiteur de la competition
* sur laquelle il fait le pari <br>
*
* @throws BadParametersException
* est levé si: <br>
* le pari n'a pas été instancié
* @throws SubscriberException
* est levé si: <br>
* le joueur n'a pas assez de jetons <br>
*/
public void parierSurLeVainqueur(PariWinner pariwin)
throws CompetitionException,
SubscriberException, BadParametersException {
if (pariwin == null)
throw new BadParametersException("paramètre pari non instancié");
boolean trouve = this.getCompetitors().contains(pariwin.getWinner());
if (!trouve) {
throw new CompetitionException(
"Ce competiteur ne participe pas à cette competition");
}
if (this.isInThePast())
throw new CompetitionException(
"La date de la competition est passée");
if (pariwin.getWinner() instanceof Individual) {
Person subcriber = (Person) pariwin.getSubscriber();
Person competiteur;
for (Competitor c : this.getCompetitors()) {
competiteur = (Person) c;
if (competiteur.equals(subcriber)) {
throw new CompetitionException(
"Le joueur est un competiteur de la competition");
}
}
} else if (pariwin.getWinner() instanceof Team) {
Team team;
Person competiteur = null;
for (Competitor competitor : this.getCompetitors()) {
team = (Team) competitor;
for (Competitor member : team.getMembers()) {
competiteur = (Person) member;
if (pariwin.getSubscriber().equals(competiteur)) {
throw new CompetitionException(
"Le joueur fait partie d'une équipe de la compétition");
}
}
}
}
pariwin.getSubscriber().debiter(pariwin.getMise());
betList.add(pariwin);
this.montantTotalMise += pariwin.getMise();
}
/**
* Parier sur le podium <br>
* On débite le compte du joueur du montant misé.
*
* @param paripod
* Le pari qui contient: <br>
* Le pari qui contient le montant de la mise <br>
* Le joueur qui fait le pari <br>
* Les trois compétiteurs sur lesquels il parie <br>
*
* @throws CompetitionException
* est levé si: <br>
* l'un au moins des trois compétiteurs
* ne participe pas à la compétition sur laquelle il
* fait le pari <br>
* La date de la competition est passée <br>
* Le joueur est un competiteur de la competition
* sur laquelle le joueur fait le pari <br>
*
* @throws BadParametersException
* est levé si: <br>
* le pari n'a pas été instancié
* @throws SubscriberException
* est levé si: <br>
* le joueur n'a pas assez de jetons <br>
*/
public void parierSurLePodium(PariPodium paripod)
throws CompetitionException, BadParametersException, SubscriberException {
if (paripod == null)
throw new BadParametersException(
"pari avec un pariPodium non instancié");
boolean trouveWinner = this.getCompetitors().contains(
paripod.getWinner());
boolean trouveSecond = this.getCompetitors().contains(
paripod.getSecond());
boolean trouveThird = this.getCompetitors()
.contains(paripod.getThird());
if (!trouveWinner || !trouveSecond || !trouveThird)
throw new CompetitionException(
"Un 1 ou plusieurs de ces trois competiteurs ne participe pas "
+ "à cette competition");
if (this.isInThePast())
throw new CompetitionException(
"La date de la competition est passée");
if (paripod.getWinner() instanceof Individual) {
Person competiteur;
for (Competitor competitor : this.getCompetitors()) {
competiteur = (Person) competitor;
if (paripod.getSubscriber().equals(competiteur))
throw new CompetitionException(
"Le joueur est un competiteur de la competition");
}
} else if (paripod.getWinner() instanceof Team) {
Person competiteur;
Team team;
for (Competitor competitor : this.getCompetitors()) {
team = (Team) competitor;
if (team != null) {
for (Competitor member : team.getMembers()) {
competiteur = (Person) member;
if (paripod.getSubscriber().equals(competiteur)) {
throw new CompetitionException(
"Le joueur fait partie d'une equipe de la competition");
}
}
}
}
}
paripod.getSubscriber().debiter(paripod.getMise());
// On ajoute le pari à la liste des paris de la compétition
this.betList.add(paripod);
this.montantTotalMise += paripod.getMise();
}
/**
* Solder les paris sur le vainqueur <br>
* Le compte de tous les joueurs ayant parié le vrai vainqueur
* de la compétition est credité d'un nombre de jetons égal à: <br>
* (nombre de jetons misé par le joueur * le nombre total de jetons
* misés sur cette compétition) / le nombre total de jetons misés sur
* le vrai vainqueur. <br>
* Si aucun joueur ne mise sur le vrai vainqueur, le compte de chaque
* joueur est crédité du nombre de jetons qu'il a misé sur cette compétition
* La compétition est alors supprimée s'il n'y a plus de pari pour cette
* compétition
*
* @param winner
* competitor winner.
*
* @throws CompetitionException
* est levé si: <br>
* le compétiteur winner ne participe pas à la compétition <br>
* la compétition est toujours ouverte <br>
*
* @throws BadParametersException
* est levé si: <br>
* Le winner n'a pas été instancié <br>
*
*/
public void solderPariWinner(Competitor winner)
throws CompetitionException, BadParametersException {
if (winner == null)
throw new BadParametersException(
"Le vainqueur n'a pas été instancié");
long tokensBettedForWinner = 0;
long tokensWonBySubscriber = 0;
boolean trouve = this.competitors.contains(winner); // si le competiteur existe deja
boolean quelqunATrouverLegagnant = false; // dit si un joueur a parié sur le gagnant
if (!trouve)
throw new CompetitionException("Ce competiteur ne participe pas à cette competition");
if (!(this.isInThePast()))
throw new CompetitionException("Cette compétition est toujours ouverte");
/* On calcule le nombre de jetons misés sur le vrai vainqueur */
for (Pari pari : this.betList) {
if (pari instanceof PariWinner
&& ((PariWinner) pari).getWinner().equals(winner)) {
tokensBettedForWinner += pari.getMise(); // le cumul de la somme miser sur le gagnant
}
}
for (Pari pari : this.betList) {
if (pari instanceof PariWinner) {
if ( pari.getWinner().equals(winner)) {
quelqunATrouverLegagnant = true;
tokensWonBySubscriber = (pari.getMise() * this.montantTotalMise) // cacul du gain d'un joueur ayant gagné
/ tokensBettedForWinner;
try {
pari.getSubscriber().crediter(tokensWonBySubscriber);
} catch (BadParametersException e) {
System.out.println("bug");
}
}
}
}
/*
Si aucun joueur ne mise sur le vrai vainqueur, le compte de chaque
joueur est crédité du nombre de jetons qu'il a misé sur cette compétition
*/
if (!quelqunATrouverLegagnant) {
for (Pari pari : this.betList) {
pari.getSubscriber().crediter(pari.getMise());
this.betList.remove(pari);
}
}
}
/**
* Solder les paris sur le podium <br>
*
* Le compte de tous les joueurs qui ont parié sur le bon podium est
* crédité d'un nombre de jetons égal à : <br>
* (nombre de jetons misé par le joueur * le nombre total de jetons
* misés sur cette compétition) / le nombre total de jetons misés sur
* le bon podium. <br>
* Si aucun joueur ne mise sur le bon podium, le compte de chaque
* joueur est crédité du nombre de jetons qu'il a misé sur cette compétition
* La compétition est alors supprimée s'il n'y a plus de pari pour cette
* compétition
*
* @param winner
* the winner.
* @param second
* the second.
* @param third
* the third.
*
* @throws CompetitionException
* est levée si:<br>
* au moins deux competiteurs sur le podium sont les mêmes <br>
* au moins un des compétiteurs sur le podium ne participe pas à
* la compétition <br>
* la compétition est toujours ouverte
*
* @throws BadParametersException
* est levée si:<br>
* le winner, le second ou le third n'a pas été instancié
*/
public void solderPariPodium(Competitor winner, Competitor second,
Competitor third) throws CompetitionException,
BadParametersException {
if (winner == null)
throw new BadParametersException(
"Le vainqueur n'a pas été instancié");
if (second == null)
throw new BadParametersException(
"Le deuxième n'a pas été instancié");
if (third == null)
throw new BadParametersException(
"Le troisième n'a pas été instancié");
long tokensBettedForPodium = 0;
long tokensWonBySubscriber = 0;
boolean found = false;
boolean trouveWinner = this.competitors.contains(winner);
boolean trouveSecond = this.competitors.contains(second);
boolean trouveThird = this.competitors.contains(third);
if (!trouveWinner || !trouveSecond || !trouveThird)
throw new CompetitionException( "Un ou plusieurs de ces trois competiteurs ne participe pas "+ "à cette compétition");
if (!(this.isInThePast()))
throw new CompetitionException("Cette compétition est toujours ouverte");
/* On calcule le nombre de jetons misés sur le bon podium */
for (Pari pari : this.betList) {
if (pari instanceof PariPodium) {
if (((PariPodium) pari).getWinner().equals(winner)
&& ((PariPodium) pari).getSecond().equals(second)
&& ((PariPodium) pari).getThird().equals(third)) {
tokensBettedForPodium += pari.getMise();
}
}
}
for (Pari pari : this.betList) {
if (pari instanceof PariPodium) {
if (((PariPodium) pari).getWinner().equals(winner)
&& ((PariPodium) pari).getSecond().equals(second)
&& ((PariPodium) pari).getThird().equals(third)) {
found = true;
tokensWonBySubscriber = (pari.getMise() * this.montantTotalMise)
/ tokensBettedForPodium;
try {
pari.getSubscriber().crediter(tokensWonBySubscriber);
} catch (BadParametersException e) {
e.printStackTrace();
}
}
}
}
/*
Si aucun joueur ne mise sur le vrai vainqueur, le compte de chaque
joueur est crédité du nombre de jetons qu'il a misé sur cette compétition
*/
if (!found) {
for (Pari pari : this.betList) {
pari.getSubscriber().crediter(pari.getMise());
this.betList.remove(pari);
}
}
}
/**
* Consulte la liste des paris de la competition.
*
* @return
* une liste de chaîne contenant les pariss de la competition.
*/
public ArrayList<String> consulterParis() {
String infoPari;
ArrayList<String> infoParis = new ArrayList<String>();
for (Pari pari : this.betList) {
infoPari = pari.getSubscriberInfo(); // les infos du jouer
infoParis.add(infoPari);
infoPari= pari.winnerInfo(); // firstname + lastname + borndate of winner
infoParis.add(infoPari);
if (pari instanceof PariPodium){
infoPari=( (PariPodium) pari).secondInfo(); // same for the second
infoParis.add(infoPari);
infoPari=( (PariPodium)pari).thirdInfo(); // same for the third
infoParis.add(infoPari);
}
}
return infoParis;
}
/**
* Ajoute un competiteur à la compétition <br>
*
* @param newCompetitor
* le nouveau competiteur
* @throws CompetitionException
* est levée si le competiteur a dejà été ajouté .
* @throws BadParametersException
* est levée si le competiteur n'est pas instancié .
*/
public void addCompetitor(Competitor newCompetitor)
throws CompetitionException, BadParametersException {
if (newCompetitor == null)
throw new BadParametersException("competiteur non instancié");
if (this.competitors != null&& this.competitors.contains(newCompetitor)) {
//competiteur dejà existant
throw new CompetitionException(" le competiteur "
+ newCompetitor.toString() + " a deja été ajouté");
}
this.competitors.add(newCompetitor);// ajoute un nouveau competiteur
}
/**
* Renvoie si la competition à une date passée
*
* @return vrai si le closing date de la compétition est dans le passé Faux
* sinon
*
*/
public boolean isInThePast() {
return this.getDateCompetition().isInThePast();
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((nomCompetition == null) ? 0 : nomCompetition.hashCode());
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Competition other = (Competition) obj;
if (nomCompetition == null) {
if (other.nomCompetition != null) {
return false;
}
} else if (!nomCompetition.equals(other.nomCompetition)) {
return false;
}
return true;
}
/**
* Renvoie si la liste des paris de la competition est vide
* @return
* vrai si la liste des paris de la compétition est vide Faux sinon
*/
public boolean IsEmptybetList() {
return this.betList.isEmpty();
}
/**
* supprime un competiteur de la competition.
*
* @throws ExistingCompetitorException
* est levée si le competiteur ne participe pas à la competition
* */
public void removeCompetitor(Competitor competitor)
throws ExistingCompetitorException {
if (!(this.competitors.contains(competitor))) {
throw new ExistingCompetitorException("le competiteur "
+ competitor + " ne participe à la compeetition "
+ this.nomCompetition);
}
this.competitors.remove(competitor);
}
/**
* Cette méthode verifie la validité du nom d'une compétition. Seuls les
* lettres, les chiffres, les tirets et underscore sont autorisés. La taille
* de la chaine de caractères doit être au moins LONG_COMPETITION caractères
*
* @param nomCompetition
* Le nom de la compétition à verifier
*
* @throws BadParametersException
* est levé si le nom de la compétition est invalide
*/
private static void checkStringNomCompetition(String nomCompetition)
throws BadParametersException {
if (nomCompetition == null)
throw new BadParametersException(
"Le nom de la compétition n'a pas été instancié");
if (nomCompetition.length() < LONG_COMPETITION)
throw new BadParametersException(
"Le nom de la compétition est moins que "
+ LONG_COMPETITION + "caractères");
// Seuls les lettres et les chiffres sont autorisés
if (!nomCompetition.matches(REGEX_COMPETITION))
throw new BadParametersException("la competition " + nomCompetition
+ " ne verifie pas les contraintes ");
}
/**
* Renvoie la date de fermeture de la competition sous forme de chaine de
* caractère
*
* @return la chaine de caractère correspondant
*/
public String getClosingdate() {
return this.getDateCompetition().get(Calendar.YEAR) + "-"
+ (this.getDateCompetition().get(Calendar.MONTH) + 1) + "-"
+ this.getDateCompetition().get(Calendar.DATE);
}
@Override
public String toString() {
return this.nomCompetition + " " + this.getClosingdate();
}
}
| 26,274
| 0.652069
| 0.650955
| 850
| 28.624706
| 24.599648
| 158
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 2.337647
| false
| false
|
3
|
955d5e3a10e09fc972de8e85c01e17790de18f69
| 807,453,920,656
|
22a9834acaf20b77402c0e21eff77fa42b6832b2
|
/Selection_Sort.java
|
99f5f98a72db803b45f78ebcbe2478fae6589abc
|
[
"MIT"
] |
permissive
|
JaikantSharma/Data_Structure_Algorithms
|
https://github.com/JaikantSharma/Data_Structure_Algorithms
|
23aa6110ee683afaaff1e38ccbf1f766358ab088
|
50e4c72adea028cdd1c474f9a31fb0a53777e561
|
refs/heads/master
| 2020-06-16T00:53:38.133000
| 2019-08-10T14:46:56
| 2019-08-10T14:46:56
| 195,436,886
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package tech;
import java.util.Arrays;
/*
* Program is written by Jaikant
*
* This is for Selection Sort
*
* Its to sort using taking one element at time comparing with other elements
*/
public class Selection_Sort {
public static int[] selection_sort(int[] to_sort) {
int[] sorted=to_sort;
//Even though first sort taught is bubble
//but actually this is the method to apply using pen and paper
//using normal for loop
//just take care of boundary conditions
for(int i=0;i<to_sort.length-1;i++) {
for(int j=i+1;j<to_sort.length;j++) {
if(sorted[i]>sorted[j]) {
int temp=sorted[j];
sorted[j]=sorted[i];
sorted[i]=temp;
}
}
}
return sorted;
}
public static void main(String[] args) {
int[] to_sort= {2,65,89,3,1};
int[] sorted=selection_sort(to_sort);
System.out.println(Arrays.toString(sorted));
}
}
|
UTF-8
|
Java
| 890
|
java
|
Selection_Sort.java
|
Java
|
[
{
"context": "ort java.util.Arrays;\n\n/*\n * Program is written by Jaikant\n * \n * This is for Selection Sort \n * \n * Its to ",
"end": 76,
"score": 0.9997280240058899,
"start": 69,
"tag": "NAME",
"value": "Jaikant"
}
] | null |
[] |
package tech;
import java.util.Arrays;
/*
* Program is written by Jaikant
*
* This is for Selection Sort
*
* Its to sort using taking one element at time comparing with other elements
*/
public class Selection_Sort {
public static int[] selection_sort(int[] to_sort) {
int[] sorted=to_sort;
//Even though first sort taught is bubble
//but actually this is the method to apply using pen and paper
//using normal for loop
//just take care of boundary conditions
for(int i=0;i<to_sort.length-1;i++) {
for(int j=i+1;j<to_sort.length;j++) {
if(sorted[i]>sorted[j]) {
int temp=sorted[j];
sorted[j]=sorted[i];
sorted[i]=temp;
}
}
}
return sorted;
}
public static void main(String[] args) {
int[] to_sort= {2,65,89,3,1};
int[] sorted=selection_sort(to_sort);
System.out.println(Arrays.toString(sorted));
}
}
| 890
| 0.641573
| 0.630337
| 45
| 18.777779
| 19.59012
| 77
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.933333
| false
| false
|
3
|
054b0a006cdc2b4c94ff4ae00610d154d18d652a
| 33,354,716,077,571
|
4dd8ef548618f75de78840202e26b002616767c1
|
/product-page.java
|
dfaec5f57cbeaa435194015d1cdaf7613f252269
|
[] |
no_license
|
kushalava/selenium-login
|
https://github.com/kushalava/selenium-login
|
95906d7d1f8be6ad48494e0ac8aa1cb1bfd703ce
|
c4eae21be21f5a15d1f24685c5a1af55a9e3d9d0
|
refs/heads/master
| 2022-05-26T07:39:40.791000
| 2022-05-08T22:19:00
| 2022-05-08T22:19:00
| 138,248,154
| 0
| 0
| null | false
| 2022-05-08T22:19:00
| 2018-06-22T03:04:33
| 2022-05-08T22:08:45
| 2022-05-08T22:19:00
| 7
| 0
| 0
| 0
|
Java
| false
| false
|
package com.myselenium.tutorials;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class CheckBox {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver",
"C:\\Selenium\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
// Browser based commands
driver.get("http://toolsqa.com/automation-practice-form/");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
List<WebElement> CheckBox = driver.findElements(By.name("tool"));
// This will tell you the number of checkboxes are present
int iSize = CheckBox.size();
System.out.println(iSize);
// Start the loop from first checkbox to last checkboxe
for (int i = 0; i < iSize; i++) {
// Store the checkbox name to the string variable, using 'Value'
// attribute
String sValue = (String) CheckBox.get(i).getAttribute("value");
System.out.println(sValue);
// Select the checkbox it the value of the checkbox is same what you
// are looking for
if (sValue.equalsIgnoreCase("selenium webdriver")) {
CheckBox.get(i).click();
// This will take the execution out of for loop
break;
}
}
}
}
|
UTF-8
|
Java
| 1,422
|
java
|
product-page.java
|
Java
|
[] | null |
[] |
package com.myselenium.tutorials;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class CheckBox {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver",
"C:\\Selenium\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
// Browser based commands
driver.get("http://toolsqa.com/automation-practice-form/");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
List<WebElement> CheckBox = driver.findElements(By.name("tool"));
// This will tell you the number of checkboxes are present
int iSize = CheckBox.size();
System.out.println(iSize);
// Start the loop from first checkbox to last checkboxe
for (int i = 0; i < iSize; i++) {
// Store the checkbox name to the string variable, using 'Value'
// attribute
String sValue = (String) CheckBox.get(i).getAttribute("value");
System.out.println(sValue);
// Select the checkbox it the value of the checkbox is same what you
// are looking for
if (sValue.equalsIgnoreCase("selenium webdriver")) {
CheckBox.get(i).click();
// This will take the execution out of for loop
break;
}
}
}
}
| 1,422
| 0.708861
| 0.706751
| 60
| 22.700001
| 23.521126
| 71
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.566667
| false
| false
|
3
|
f38d34fe96b462f11c102f4610b03b62ae8ef0cb
| 28,071,906,297,911
|
28895ae64178a3f8eb62877bd0e909b8c3571e4d
|
/src/main/se450/model/Line.java
|
5ba48bd9435945ee55efad23a37919fbfc4630c7
|
[] |
no_license
|
singingwithcode/Asteroids
|
https://github.com/singingwithcode/Asteroids
|
f17bc3e01bdcd192eb157876794055ac9e657e12
|
b0e4431875ecc7d21042d32680aa31c0a967f574
|
refs/heads/master
| 2023-01-10T21:08:00.496000
| 2020-11-12T06:17:23
| 2020-11-12T06:17:23
| 312,150,983
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package main.se450.model;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Line2D;
import java.util.ArrayList;
import main.se450.collections.LineCollection;
import main.se450.interfaces.IShape;
import main.se450.interfaces.IStrategy;
public class Line extends Shape
{
private Line2D line = new Line2D.Float(0.0f,0.0f,0.0f,0.0f);
public Line(float nLeft, float nTop, float nRight, float nBottom, float nX, float nY, float nRotation, Color cColor, IStrategy iStrategy, String size, int score, int multiplier, int children)
{
super(nLeft, nTop, nRight, nBottom, nX, nY, nRotation, cColor, iStrategy, size, score, multiplier, children);
}
@Override
public void draw(Graphics graphics)
{
line.setLine(getX1(), getY1(), getX3(), getY3());
Graphics2D g2d = (Graphics2D)(graphics);
g2d.setColor(getColor());
g2d.draw(line);
}
@Override
public float getMinX()
{
return Math.min(getX1(), getX3());
}
@Override
public float getMinY()
{
return Math.min(getY1(), getY3());
}
@Override
public float getMaxX()
{
return Math.max(getX1(), getX3());
}
@Override
public float getMaxY()
{
return Math.max(getY1(), getY3());
}
@Override
public LineCollection getLineCollection() {
return null;
}
@Override
public ArrayList<IShape> addChildren() {
return null;
}
}
|
UTF-8
|
Java
| 1,454
|
java
|
Line.java
|
Java
|
[] | null |
[] |
package main.se450.model;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Line2D;
import java.util.ArrayList;
import main.se450.collections.LineCollection;
import main.se450.interfaces.IShape;
import main.se450.interfaces.IStrategy;
public class Line extends Shape
{
private Line2D line = new Line2D.Float(0.0f,0.0f,0.0f,0.0f);
public Line(float nLeft, float nTop, float nRight, float nBottom, float nX, float nY, float nRotation, Color cColor, IStrategy iStrategy, String size, int score, int multiplier, int children)
{
super(nLeft, nTop, nRight, nBottom, nX, nY, nRotation, cColor, iStrategy, size, score, multiplier, children);
}
@Override
public void draw(Graphics graphics)
{
line.setLine(getX1(), getY1(), getX3(), getY3());
Graphics2D g2d = (Graphics2D)(graphics);
g2d.setColor(getColor());
g2d.draw(line);
}
@Override
public float getMinX()
{
return Math.min(getX1(), getX3());
}
@Override
public float getMinY()
{
return Math.min(getY1(), getY3());
}
@Override
public float getMaxX()
{
return Math.max(getX1(), getX3());
}
@Override
public float getMaxY()
{
return Math.max(getY1(), getY3());
}
@Override
public LineCollection getLineCollection() {
return null;
}
@Override
public ArrayList<IShape> addChildren() {
return null;
}
}
| 1,454
| 0.66575
| 0.637552
| 66
| 19.848484
| 29.152287
| 192
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.742424
| false
| false
|
3
|
8e281b2a65f191592fa1c538dc01025bada5e717
| 24,764,781,492,905
|
4b73b8edc983c3316bdbea7df0e65b94102b6972
|
/otherTests/Test For Ass2/Instrictions/actions/CheckAdministrativeObligationsActionTest.java
|
0bd7d5bb3368df0f9703ae198d0047022213d120
|
[] |
no_license
|
orisuchy/SPL-Ass2
|
https://github.com/orisuchy/SPL-Ass2
|
457c27e52ce468ebbc78624faeee3acaa1d05d48
|
ed6d1c93e51da102f8437d49b253cd92b1135432
|
refs/heads/master
| 2021-09-01T21:25:03.430000
| 2017-12-27T09:08:58
| 2017-12-27T09:08:58
| 111,713,975
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package bgu.spl.a2.sim.actions;
import bgu.spl.a2.A;
import bgu.spl.a2.Action;
import bgu.spl.a2.ActorThreadPool;
import bgu.spl.a2.PrivateState;
import bgu.spl.a2.sim.Computer;
import bgu.spl.a2.sim.Warehouse;
import bgu.spl.a2.sim.privateStates.CoursePrivateState;
import bgu.spl.a2.sim.privateStates.DepartmentPrivateState;
import bgu.spl.a2.sim.privateStates.StudentPrivateState;
import org.junit.Test;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Vector;
import static org.junit.Assert.*;
public class CheckAdministrativeObligationsActionTest {
static Vector<Action> actions = new Vector<>();
static Vector<PrivateState> actionsPrivateStates = new Vector<>();
static Vector<String> actionsActorIds = new Vector<>();
static Vector<Action<Boolean>> phasesActions = new Vector<>();
static Vector<PrivateState> phasesPrivateStates = new Vector<>();
static Vector<String> phasesActorsIds = new Vector<>();
@Test(timeout=10000)
public void testAction() {
Vector<Computer> computers = new Vector<>();
for(int i = 1;i < 10;i++){
Computer comp = new Computer("" + i);
try {
Field field = Computer.class.getDeclaredField("successSig");
field.setAccessible(true);
field.set(comp, i);
} catch (Exception e) {
e.printStackTrace();
}
try {
Field field = Computer.class.getDeclaredField("failSig");
field.setAccessible(true);
field.set(comp, -i);
} catch (Exception e) {
e.printStackTrace();
}
computers.add(comp);
}
Warehouse warehouse = new Warehouse(computers);
createCourse("Dep1","A",10,new String[] {});
createCourse("Dep1","B",10,new String[] {});
createCourse("Dep2","C",10,new String[] {});
createCourse("Dep2","D",10,new String[] {});
createStudent("Dep1","1");
createStudent("Dep1","2");
createStudent("Dep1","3");
createStudent("Dep1","4");
createStudent("Dep1","5");
createStudent("Dep1","6");
createStudent("Dep1","7");
createStudent("Dep1","8");
createStudent("Dep1","9");
createStudent("Dep1","10");
createStudent("Dep2","1");
createStudent("Dep2","2");
createStudent("Dep2","3");
createStudent("Dep2","4");
createStudent("Dep2","5");
createStudent("Dep2","6");
createStudent("Dep2","7");
createStudent("Dep2","8");
createStudent("Dep2","9");
createStudent("Dep2","10");
A.createPhase(actions,actionsPrivateStates,actionsActorIds,phasesActions,phasesPrivateStates,phasesActorsIds);
createParticipate("1","A","90");
createParticipate("1","B","-");
createParticipate("1","C","60");
createParticipate("1","D","60");
A.createPhase(actions,actionsPrivateStates,actionsActorIds,phasesActions,phasesPrivateStates,phasesActorsIds);
createParticipate("2","A","90");
createParticipate("2","C","60");
createParticipate("2","D","60");
A.createPhase(actions,actionsPrivateStates,actionsActorIds,phasesActions,phasesPrivateStates,phasesActorsIds);
createParticipate("3","A","90");
createParticipate("3","B","20");
createParticipate("3","C","60");
createParticipate("3","D","55");
A.createPhase(actions,actionsPrivateStates,actionsActorIds,phasesActions,phasesPrivateStates,phasesActorsIds);
createParticipate("4","A","90");
createParticipate("4","B","70");
createParticipate("4","C","60");
A.createPhase(actions,actionsPrivateStates,actionsActorIds,phasesActions,phasesPrivateStates,phasesActorsIds);
createParticipate("5","A","90");
createParticipate("5","B","70");
createParticipate("5","C","60");
A.createPhase(actions,actionsPrivateStates,actionsActorIds,phasesActions,phasesPrivateStates,phasesActorsIds);
createParticipate("6","A","90");
createParticipate("6","B","23");
createParticipate("6","C","60");
A.createPhase(actions,actionsPrivateStates,actionsActorIds,phasesActions,phasesPrivateStates,phasesActorsIds);
createAction("Dep1",new String[] {"1"},"1",new String[] {"A","B","C","D"},warehouse);
createAction("Dep1",new String[] {"2"},"1",new String[] {"A","B"},warehouse);
createAction("Dep2",new String[] {"3"},"1",new String[] {"A"},warehouse);
createAction("Dep2",new String[] {"4"},"1",new String[] {"A","B","C","D"},warehouse);
createAction("Dep1",new String[] {"6","5"},"5",new String[] {"A","B","C"},warehouse);
A.createPhase(actions,actionsPrivateStates,actionsActorIds,phasesActions,phasesPrivateStates,phasesActorsIds);
ActorThreadPool pool = A.initiateActionTest(phasesActions,phasesPrivateStates,phasesActorsIds);
assertEquals(-1,((StudentPrivateState)pool.getActors().get("1")).getSignature());
assertEquals(-1,((StudentPrivateState)pool.getActors().get("2")).getSignature());
assertEquals(1,((StudentPrivateState)pool.getActors().get("3")).getSignature());
assertEquals(-1,((StudentPrivateState)pool.getActors().get("4")).getSignature());
assertEquals(5,((StudentPrivateState)pool.getActors().get("5")).getSignature());
assertEquals(-5,((StudentPrivateState)pool.getActors().get("6")).getSignature());
}
public static void createAction(String department,String[] students,String computer,String[] conditions,
Warehouse warehouse){
CheckAdministrativeObligationsAction check = new CheckAdministrativeObligationsAction(
"Adding",students,computer,conditions,warehouse);
actions.add(check);
actionsPrivateStates.add(new DepartmentPrivateState());
actionsActorIds.add(department);
}
public static void createParticipate(String student,String courseName,String grade){
ParticipatingInCourseAction participate = new ParticipatingInCourseAction(
"Adding",student,courseName,grade);
actions.add(participate);
actionsPrivateStates.add(new CoursePrivateState());
actionsActorIds.add(courseName);
}
public static void createCourse(String department, String courseName, int space,String[] prerequisites){
OpenNewCourseAction course = new OpenNewCourseAction(
"Adding",courseName,space,prerequisites);
actions.add(course);
actionsPrivateStates.add(new DepartmentPrivateState());
actionsActorIds.add(department);
}
public static void createStudent(String department,String studentId){
AddStudentAction student = new AddStudentAction(
"Adding",studentId);
actions.add(student);
actionsPrivateStates.add(new DepartmentPrivateState());
actionsActorIds.add(department);
}
}
|
UTF-8
|
Java
| 7,109
|
java
|
CheckAdministrativeObligationsActionTest.java
|
Java
|
[] | null |
[] |
package bgu.spl.a2.sim.actions;
import bgu.spl.a2.A;
import bgu.spl.a2.Action;
import bgu.spl.a2.ActorThreadPool;
import bgu.spl.a2.PrivateState;
import bgu.spl.a2.sim.Computer;
import bgu.spl.a2.sim.Warehouse;
import bgu.spl.a2.sim.privateStates.CoursePrivateState;
import bgu.spl.a2.sim.privateStates.DepartmentPrivateState;
import bgu.spl.a2.sim.privateStates.StudentPrivateState;
import org.junit.Test;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Vector;
import static org.junit.Assert.*;
public class CheckAdministrativeObligationsActionTest {
static Vector<Action> actions = new Vector<>();
static Vector<PrivateState> actionsPrivateStates = new Vector<>();
static Vector<String> actionsActorIds = new Vector<>();
static Vector<Action<Boolean>> phasesActions = new Vector<>();
static Vector<PrivateState> phasesPrivateStates = new Vector<>();
static Vector<String> phasesActorsIds = new Vector<>();
@Test(timeout=10000)
public void testAction() {
Vector<Computer> computers = new Vector<>();
for(int i = 1;i < 10;i++){
Computer comp = new Computer("" + i);
try {
Field field = Computer.class.getDeclaredField("successSig");
field.setAccessible(true);
field.set(comp, i);
} catch (Exception e) {
e.printStackTrace();
}
try {
Field field = Computer.class.getDeclaredField("failSig");
field.setAccessible(true);
field.set(comp, -i);
} catch (Exception e) {
e.printStackTrace();
}
computers.add(comp);
}
Warehouse warehouse = new Warehouse(computers);
createCourse("Dep1","A",10,new String[] {});
createCourse("Dep1","B",10,new String[] {});
createCourse("Dep2","C",10,new String[] {});
createCourse("Dep2","D",10,new String[] {});
createStudent("Dep1","1");
createStudent("Dep1","2");
createStudent("Dep1","3");
createStudent("Dep1","4");
createStudent("Dep1","5");
createStudent("Dep1","6");
createStudent("Dep1","7");
createStudent("Dep1","8");
createStudent("Dep1","9");
createStudent("Dep1","10");
createStudent("Dep2","1");
createStudent("Dep2","2");
createStudent("Dep2","3");
createStudent("Dep2","4");
createStudent("Dep2","5");
createStudent("Dep2","6");
createStudent("Dep2","7");
createStudent("Dep2","8");
createStudent("Dep2","9");
createStudent("Dep2","10");
A.createPhase(actions,actionsPrivateStates,actionsActorIds,phasesActions,phasesPrivateStates,phasesActorsIds);
createParticipate("1","A","90");
createParticipate("1","B","-");
createParticipate("1","C","60");
createParticipate("1","D","60");
A.createPhase(actions,actionsPrivateStates,actionsActorIds,phasesActions,phasesPrivateStates,phasesActorsIds);
createParticipate("2","A","90");
createParticipate("2","C","60");
createParticipate("2","D","60");
A.createPhase(actions,actionsPrivateStates,actionsActorIds,phasesActions,phasesPrivateStates,phasesActorsIds);
createParticipate("3","A","90");
createParticipate("3","B","20");
createParticipate("3","C","60");
createParticipate("3","D","55");
A.createPhase(actions,actionsPrivateStates,actionsActorIds,phasesActions,phasesPrivateStates,phasesActorsIds);
createParticipate("4","A","90");
createParticipate("4","B","70");
createParticipate("4","C","60");
A.createPhase(actions,actionsPrivateStates,actionsActorIds,phasesActions,phasesPrivateStates,phasesActorsIds);
createParticipate("5","A","90");
createParticipate("5","B","70");
createParticipate("5","C","60");
A.createPhase(actions,actionsPrivateStates,actionsActorIds,phasesActions,phasesPrivateStates,phasesActorsIds);
createParticipate("6","A","90");
createParticipate("6","B","23");
createParticipate("6","C","60");
A.createPhase(actions,actionsPrivateStates,actionsActorIds,phasesActions,phasesPrivateStates,phasesActorsIds);
createAction("Dep1",new String[] {"1"},"1",new String[] {"A","B","C","D"},warehouse);
createAction("Dep1",new String[] {"2"},"1",new String[] {"A","B"},warehouse);
createAction("Dep2",new String[] {"3"},"1",new String[] {"A"},warehouse);
createAction("Dep2",new String[] {"4"},"1",new String[] {"A","B","C","D"},warehouse);
createAction("Dep1",new String[] {"6","5"},"5",new String[] {"A","B","C"},warehouse);
A.createPhase(actions,actionsPrivateStates,actionsActorIds,phasesActions,phasesPrivateStates,phasesActorsIds);
ActorThreadPool pool = A.initiateActionTest(phasesActions,phasesPrivateStates,phasesActorsIds);
assertEquals(-1,((StudentPrivateState)pool.getActors().get("1")).getSignature());
assertEquals(-1,((StudentPrivateState)pool.getActors().get("2")).getSignature());
assertEquals(1,((StudentPrivateState)pool.getActors().get("3")).getSignature());
assertEquals(-1,((StudentPrivateState)pool.getActors().get("4")).getSignature());
assertEquals(5,((StudentPrivateState)pool.getActors().get("5")).getSignature());
assertEquals(-5,((StudentPrivateState)pool.getActors().get("6")).getSignature());
}
public static void createAction(String department,String[] students,String computer,String[] conditions,
Warehouse warehouse){
CheckAdministrativeObligationsAction check = new CheckAdministrativeObligationsAction(
"Adding",students,computer,conditions,warehouse);
actions.add(check);
actionsPrivateStates.add(new DepartmentPrivateState());
actionsActorIds.add(department);
}
public static void createParticipate(String student,String courseName,String grade){
ParticipatingInCourseAction participate = new ParticipatingInCourseAction(
"Adding",student,courseName,grade);
actions.add(participate);
actionsPrivateStates.add(new CoursePrivateState());
actionsActorIds.add(courseName);
}
public static void createCourse(String department, String courseName, int space,String[] prerequisites){
OpenNewCourseAction course = new OpenNewCourseAction(
"Adding",courseName,space,prerequisites);
actions.add(course);
actionsPrivateStates.add(new DepartmentPrivateState());
actionsActorIds.add(department);
}
public static void createStudent(String department,String studentId){
AddStudentAction student = new AddStudentAction(
"Adding",studentId);
actions.add(student);
actionsPrivateStates.add(new DepartmentPrivateState());
actionsActorIds.add(department);
}
}
| 7,109
| 0.644254
| 0.622028
| 181
| 38.281769
| 32.35598
| 118
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.59116
| false
| false
|
3
|
eb4daa8b2168a9abc6bec29c809fd22002ed38dd
| 30,803,505,512,810
|
fedb29ae927c5957819381cb6ee78b0ac736a4a3
|
/src/main/java/br/com/airon/challenges/swresistencesocialnetwork/repository/ReportRepository.java
|
57ebfe68b8c943baa5f4b750b3a01e27be96297c
|
[] |
no_license
|
aironart/sw-resistence-social-network
|
https://github.com/aironart/sw-resistence-social-network
|
14d18189ae6ec41159c577ee4473a9d8ca84bdb5
|
67fcc8301f904af3420f9b4437df0536ceff029b
|
refs/heads/master
| 2023-08-14T02:55:56.948000
| 2021-10-12T02:16:17
| 2021-10-12T02:16:17
| 416,151,063
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package br.com.airon.challenges.swresistencesocialnetwork.repository;
import br.com.airon.challenges.swresistencesocialnetwork.report.MediaTipoRecursoPorRebeldeReport;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import javax.persistence.EntityManager;
import java.util.List;
@Repository
public class ReportRepository {
@Autowired
private EntityManager em;
private static final String SELECT_COUNT_REBELDE = " select count(r) from Rebelde r ";
public long retornaQuantidadeRebeldes() {
StringBuilder sql = new StringBuilder();
sql.append(SELECT_COUNT_REBELDE);
return (long) em.createQuery(sql.toString()).getSingleResult();
}
public long retornaQuantidadeRebeldesNaoTraidores() {
StringBuilder sql = new StringBuilder();
sql.append(SELECT_COUNT_REBELDE);
sql.append(" where r.traidor = false");
return (long) em.createQuery(sql.toString()).getSingleResult();
}
public double retornaPorcentagemTraidores() {
var totalRebeldes = this.retornaQuantidadeRebeldes();
val sql = new StringBuilder(SELECT_COUNT_REBELDE);
sql.append(" where r.traidor = true ");
val totalTraidores = (long) em.createQuery(sql.toString()).getSingleResult();
val quantidadeTraidores = totalTraidores * 100 / totalRebeldes;
return quantidadeTraidores;
}
public double retornaPorcentagemNaoTraidores() {
var totalRebeldes = this.retornaQuantidadeRebeldes();
val sql = new StringBuilder(SELECT_COUNT_REBELDE);
sql.append(" where r.traidor = false ");
val totalNaoTraidores = (long) em.createQuery(sql.toString()).getSingleResult();
val quantidadeNaoTraidores = totalNaoTraidores * 100 / totalRebeldes;
return quantidadeNaoTraidores;
}
public List<MediaTipoRecursoPorRebeldeReport> retornaListaMediaTipoRecursoPorRebelde() {
val totalRebeldes = this.retornaQuantidadeRebeldesNaoTraidores();
val sql = new StringBuilder();
sql.append(" select ");
sql.append(" new br.com.airon.challenges.swresistencesocialnetwork.report.MediaTipoRecursoPorRebeldeReport");
sql.append("(it.id as idItem, it.nome as denItem, sum(ii.quantidade) / " + totalRebeldes + " as quantidade) ");
sql.append(" from ItemInventario ii ");
sql.append(" inner join ii.id.item it ");
sql.append(" inner join ii.id.rebelde re ");
sql.append(" where re.traidor = false ");
sql.append(" group by it.id, it.nome ");
sql.append(" order by it.id ");
var retorno = em.createQuery(sql.toString(), MediaTipoRecursoPorRebeldeReport.class).getResultList();
return retorno;
}
public long retornaPontosPerdidosDevidoTraidores() {
val totalRebeldes = this.retornaQuantidadeRebeldes();
val sql = new StringBuilder();
sql.append(" select sum(ii.quantidade * it.quantidadePontos) ");
sql.append(" from ItemInventario ii ");
sql.append(" inner join ii.id.item it ");
sql.append(" inner join ii.id.rebelde re ");
sql.append(" where re.traidor = true ");
var retorno = (long) em.createQuery(sql.toString()).getSingleResult();
return retorno;
}
}
|
UTF-8
|
Java
| 3,362
|
java
|
ReportRepository.java
|
Java
|
[] | null |
[] |
package br.com.airon.challenges.swresistencesocialnetwork.repository;
import br.com.airon.challenges.swresistencesocialnetwork.report.MediaTipoRecursoPorRebeldeReport;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import javax.persistence.EntityManager;
import java.util.List;
@Repository
public class ReportRepository {
@Autowired
private EntityManager em;
private static final String SELECT_COUNT_REBELDE = " select count(r) from Rebelde r ";
public long retornaQuantidadeRebeldes() {
StringBuilder sql = new StringBuilder();
sql.append(SELECT_COUNT_REBELDE);
return (long) em.createQuery(sql.toString()).getSingleResult();
}
public long retornaQuantidadeRebeldesNaoTraidores() {
StringBuilder sql = new StringBuilder();
sql.append(SELECT_COUNT_REBELDE);
sql.append(" where r.traidor = false");
return (long) em.createQuery(sql.toString()).getSingleResult();
}
public double retornaPorcentagemTraidores() {
var totalRebeldes = this.retornaQuantidadeRebeldes();
val sql = new StringBuilder(SELECT_COUNT_REBELDE);
sql.append(" where r.traidor = true ");
val totalTraidores = (long) em.createQuery(sql.toString()).getSingleResult();
val quantidadeTraidores = totalTraidores * 100 / totalRebeldes;
return quantidadeTraidores;
}
public double retornaPorcentagemNaoTraidores() {
var totalRebeldes = this.retornaQuantidadeRebeldes();
val sql = new StringBuilder(SELECT_COUNT_REBELDE);
sql.append(" where r.traidor = false ");
val totalNaoTraidores = (long) em.createQuery(sql.toString()).getSingleResult();
val quantidadeNaoTraidores = totalNaoTraidores * 100 / totalRebeldes;
return quantidadeNaoTraidores;
}
public List<MediaTipoRecursoPorRebeldeReport> retornaListaMediaTipoRecursoPorRebelde() {
val totalRebeldes = this.retornaQuantidadeRebeldesNaoTraidores();
val sql = new StringBuilder();
sql.append(" select ");
sql.append(" new br.com.airon.challenges.swresistencesocialnetwork.report.MediaTipoRecursoPorRebeldeReport");
sql.append("(it.id as idItem, it.nome as denItem, sum(ii.quantidade) / " + totalRebeldes + " as quantidade) ");
sql.append(" from ItemInventario ii ");
sql.append(" inner join ii.id.item it ");
sql.append(" inner join ii.id.rebelde re ");
sql.append(" where re.traidor = false ");
sql.append(" group by it.id, it.nome ");
sql.append(" order by it.id ");
var retorno = em.createQuery(sql.toString(), MediaTipoRecursoPorRebeldeReport.class).getResultList();
return retorno;
}
public long retornaPontosPerdidosDevidoTraidores() {
val totalRebeldes = this.retornaQuantidadeRebeldes();
val sql = new StringBuilder();
sql.append(" select sum(ii.quantidade * it.quantidadePontos) ");
sql.append(" from ItemInventario ii ");
sql.append(" inner join ii.id.item it ");
sql.append(" inner join ii.id.rebelde re ");
sql.append(" where re.traidor = true ");
var retorno = (long) em.createQuery(sql.toString()).getSingleResult();
return retorno;
}
}
| 3,362
| 0.687983
| 0.686199
| 92
| 35.54348
| 32.079525
| 119
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.586957
| false
| false
|
3
|
0cee824136c7f2bee19c8fa23753efd0e7f138e3
| 33,389,075,820,454
|
4504c533a8e1f90510cdaf239053be860cdc4900
|
/OnlineStore/src/vvr/onlinestore/cart/CartItem.java
|
f8d661a5ef28662a2477688f54ac445fc89ca9df
|
[] |
no_license
|
wangwren/SSH_OnlineStore
|
https://github.com/wangwren/SSH_OnlineStore
|
f031368072aa48feb550949e0f09605b827e4ca4
|
9a6707c6544fb04056e02b6e05a2cdf69fc82d4a
|
refs/heads/master
| 2021-04-09T10:57:20.603000
| 2018-07-05T12:35:38
| 2018-07-05T12:35:38
| 125,514,232
| 0
| 1
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package vvr.onlinestore.cart;
import vvr.onlinestore.product.Product;
/**
* 购物项
* @author wwr
*
*/
public class CartItem {
//商品
private Product product;
//数量
private Integer count = 0;
//小计
private Double subtotal = 0d;
//尺码
private String size = null;
public String getSize() {
return size;
}
public void setSize(String size) {
this.size = size;
}
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
/**
* 小计不需要从外部设置值,所以不需要设置set方法
* @return
*/
public Double getSubtotal() {
return count * product.getShop_price();
}
}
|
GB18030
|
Java
| 817
|
java
|
CartItem.java
|
Java
|
[
{
"context": "nlinestore.product.Product;\n\n/**\n * 购物项\n * @author wwr\n *\n */\npublic class CartItem {\n\n\t//商品\n\tprivate Pr",
"end": 97,
"score": 0.9996138215065002,
"start": 94,
"tag": "USERNAME",
"value": "wwr"
}
] | null |
[] |
package vvr.onlinestore.cart;
import vvr.onlinestore.product.Product;
/**
* 购物项
* @author wwr
*
*/
public class CartItem {
//商品
private Product product;
//数量
private Integer count = 0;
//小计
private Double subtotal = 0d;
//尺码
private String size = null;
public String getSize() {
return size;
}
public void setSize(String size) {
this.size = size;
}
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
/**
* 小计不需要从外部设置值,所以不需要设置set方法
* @return
*/
public Double getSubtotal() {
return count * product.getShop_price();
}
}
| 817
| 0.660027
| 0.657371
| 57
| 12.210526
| 13.419986
| 42
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| false
| false
|
3
|
6cf4d23b7fa7852bb0dc877fee57c5305b705451
| 1,984,274,939,020
|
a373f1fb2949eb4d3b777c7ed59d3cdc71d69531
|
/category/category-shared/src/main/java/org/dominokit/craft/category/shared/request/CategoryRequest.java
|
7baaff22de32265017b16e8b90f9752934f81c1b
|
[] |
no_license
|
rjeeb/old-crafts
|
https://github.com/rjeeb/old-crafts
|
12ad6fe557446f95558e6bf6aaa9b51bd5aea8e9
|
e5e5c9e835d29f23838632a3e836fbdee3fc4d1d
|
refs/heads/master
| 2020-04-07T02:43:27.227000
| 2019-01-07T19:31:43
| 2019-01-07T19:31:43
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.dominokit.craft.category.shared.request;
import org.dominokit.domino.api.shared.request.RequestBean;
import org.dominokit.jacksonapt.annotation.JSONMapper;
@JSONMapper
public class CategoryRequest implements RequestBean {
private String message;
public CategoryRequest() {
}
public CategoryRequest(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
|
UTF-8
|
Java
| 537
|
java
|
CategoryRequest.java
|
Java
|
[] | null |
[] |
package org.dominokit.craft.category.shared.request;
import org.dominokit.domino.api.shared.request.RequestBean;
import org.dominokit.jacksonapt.annotation.JSONMapper;
@JSONMapper
public class CategoryRequest implements RequestBean {
private String message;
public CategoryRequest() {
}
public CategoryRequest(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
| 537
| 0.707635
| 0.707635
| 25
| 20.48
| 20.61285
| 59
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.28
| false
| false
|
3
|
7f1c2c19d9d5370bbd0cc1c9fa87f58dd07d21a1
| 14,053,133,029,098
|
9c9b8b3c94cb17d3c2d3447ec0c985794ddf49de
|
/acg12/src/main/java/com/acg12/dao/SystemGenTableDao.java
|
453f90a5df5002e8908f512adfdb54d1dc69362c
|
[
"Apache-2.0"
] |
permissive
|
KouChengjian/acg12
|
https://github.com/KouChengjian/acg12
|
2bda2d27e03e31368ed831e42f7c721c86a7ba0f
|
16e1be1ac6efed0108339b0cbae8f10c36fe2d5f
|
refs/heads/master
| 2021-01-11T07:08:20.526000
| 2020-05-29T02:09:03
| 2020-05-29T02:09:03
| 72,498,252
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.acg12.dao;
import com.acg12.entity.po.SystemGenTableEntity;
import com.framework.loippi.mybatis.dao.GenericDao;
/**
* DAO - Gen Table
*
* @author Loippi Team
* @version 1.0
*/
public interface SystemGenTableDao extends GenericDao<SystemGenTableEntity, Long> {
}
|
UTF-8
|
Java
| 283
|
java
|
SystemGenTableDao.java
|
Java
|
[
{
"context": "GenericDao;\n\n/**\n * DAO - Gen Table\n * \n * @author Loippi Team\n * @version 1.0\n */\npublic interface SystemGenTab",
"end": 175,
"score": 0.9997645616531372,
"start": 164,
"tag": "NAME",
"value": "Loippi Team"
}
] | null |
[] |
package com.acg12.dao;
import com.acg12.entity.po.SystemGenTableEntity;
import com.framework.loippi.mybatis.dao.GenericDao;
/**
* DAO - Gen Table
*
* @author <NAME>
* @version 1.0
*/
public interface SystemGenTableDao extends GenericDao<SystemGenTableEntity, Long> {
}
| 278
| 0.75265
| 0.731449
| 14
| 19.214285
| 24.157751
| 83
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.285714
| false
| false
|
3
|
ecb8e92e1a39dfa3e89642359e6b3e785c5df3b5
| 16,166,256,920,180
|
2d4d5791750ae9daea5f3cd4832e188dadf82049
|
/spring-call-center/src/main/java/com/almundo/manager/DispatcherImpl.java
|
10358b7c140fe3463f86dff05380eadc1ceb7769
|
[] |
no_license
|
AlexanderIglesias/callCenterTest
|
https://github.com/AlexanderIglesias/callCenterTest
|
ce2a999f92cd85b0032a79309cd519ef8336d584
|
895f2d2f0602be4a84438cd4c75dd0eadcf28201
|
refs/heads/master
| 2021-04-09T16:13:50.893000
| 2018-03-19T04:47:38
| 2018-03-19T04:47:38
| 125,678,056
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.almundo.manager;
import com.almundo.model.EmployedDTO;
import com.almundo.repository.EmployedRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Controller;
import javax.annotation.PostConstruct;
import java.util.List;
import java.util.Map;
@Controller
public class DispatcherImpl implements Dispatcher{
@Autowired
private EmployedRepository employedRepository;
private Map<String, List<EmployedDTO>> employedList = null;
/**
* Setup employees list
*/
@PostConstruct
public void initEmployees() {
this.employedList = employedRepository.getAllEmployees();
}
/**
* Method that processes a number of calls
* @param callsNumber Number of calls
* @return Integer calls completed
*/
public Integer dispatchCall(final Integer callsNumber) {
//processed calls
int processedCalls = 0;
//Iterate number calls
for(int i=1; i <= callsNumber; i++){
//get available employed
final EmployedDTO employed = getAvailableEmployed();
//validate if there are available users
if(employed != null) {
//Start individually call
final RunnableTask task = new RunnableTask(employed);
task.start();
//Add call completed
processedCalls += 1;
}else{
System.out.println("Todos los agentes estan ocupados");
}
}
return processedCalls;
}
/**
* method that returns an available user
* @return Employed
*/
@Async
public EmployedDTO getAvailableEmployed(){
//Iterate all keys for employed type
for (final Map.Entry<String, List<EmployedDTO>> entry : this.employedList.entrySet()) {
//Iterate key for all employed type
for (EmployedDTO employed : entry.getValue()) {
//Validate available users
if(employed.isAvailable()) {
//Change status employed
employed = new EmployedDTO.Builder(employed.getName(), employed.getType(),false).build();
return employed;
}
}
}
return null;
}
public void setEmployedList(Map<String, List<EmployedDTO>> employedList) {
this.employedList = employedList;
}
}
|
UTF-8
|
Java
| 2,505
|
java
|
DispatcherImpl.java
|
Java
|
[] | null |
[] |
package com.almundo.manager;
import com.almundo.model.EmployedDTO;
import com.almundo.repository.EmployedRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Controller;
import javax.annotation.PostConstruct;
import java.util.List;
import java.util.Map;
@Controller
public class DispatcherImpl implements Dispatcher{
@Autowired
private EmployedRepository employedRepository;
private Map<String, List<EmployedDTO>> employedList = null;
/**
* Setup employees list
*/
@PostConstruct
public void initEmployees() {
this.employedList = employedRepository.getAllEmployees();
}
/**
* Method that processes a number of calls
* @param callsNumber Number of calls
* @return Integer calls completed
*/
public Integer dispatchCall(final Integer callsNumber) {
//processed calls
int processedCalls = 0;
//Iterate number calls
for(int i=1; i <= callsNumber; i++){
//get available employed
final EmployedDTO employed = getAvailableEmployed();
//validate if there are available users
if(employed != null) {
//Start individually call
final RunnableTask task = new RunnableTask(employed);
task.start();
//Add call completed
processedCalls += 1;
}else{
System.out.println("Todos los agentes estan ocupados");
}
}
return processedCalls;
}
/**
* method that returns an available user
* @return Employed
*/
@Async
public EmployedDTO getAvailableEmployed(){
//Iterate all keys for employed type
for (final Map.Entry<String, List<EmployedDTO>> entry : this.employedList.entrySet()) {
//Iterate key for all employed type
for (EmployedDTO employed : entry.getValue()) {
//Validate available users
if(employed.isAvailable()) {
//Change status employed
employed = new EmployedDTO.Builder(employed.getName(), employed.getType(),false).build();
return employed;
}
}
}
return null;
}
public void setEmployedList(Map<String, List<EmployedDTO>> employedList) {
this.employedList = employedList;
}
}
| 2,505
| 0.621158
| 0.61996
| 79
| 30.70886
| 23.85619
| 107
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.392405
| false
| false
|
3
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.