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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a1a01d5a66748c527feb81e15495f98944fbd2f2
| 31,052,613,590,704
|
4d440fdc53d3b7627377839894760b77cf398e5b
|
/src/pastesci/PasteSCI.java
|
3a18c2062ff092805192eab9509eaf56743abbc9
|
[] |
no_license
|
KAICES/Paste_SCI
|
https://github.com/KAICES/Paste_SCI
|
0797fbf80a8b7d5b83befcc1dd3ec45b10c7f02b
|
04c9161b8637eda239c9c06a3f7dfcd1aa5037b9
|
refs/heads/master
| 2021-01-20T02:22:38.073000
| 2017-05-16T17:44:17
| 2017-05-16T17:44:17
| 89,398,434
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package pastesci;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.FileReader;
import java.io.IOException;
import java.util.*;
import static java.util.Collections.list;
import javax.swing.filechooser.FileFilter;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.filechooser.FileNameExtensionFilter;
/**
* @author cesar.ramirez
*/
public class PasteSCI {
//** Busqueda de archivos .txt en el directorio para pegar
public static void main(String[] args) throws IOException {
String path = "", path2 = "" ;
String files ;
String f;
int conteo;
JFileChooser chooser = new JFileChooser();
chooser.setMultiSelectionEnabled(false);
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int returnVal = chooser.showOpenDialog(chooser);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
path = (file.getPath());
}
else {
System.exit(0);
}
//*******************************************************************************************************
String filesBrowse;
File folder = new File(path);
File[] listOfFiles = folder.listFiles();
File archivo = null;
FileReader fr = null;
BufferedReader br = null;
String pegado = "";
FileWriter flwriter = null;
String texto = JOptionPane.showInputDialog("Nombre del archivo a guardar")+".txt";
try {
//crea el flujo para escribir en el archivo
flwriter = new FileWriter( path+ "\\"+texto);
//crea un buffer o flujo intermedio antes de escribir directamente en el archivo
BufferedWriter bfwriter = new BufferedWriter(flwriter);
int conteoLinea = 0;
for (int j = 0; j < listOfFiles.length; j++){
if (listOfFiles[j].isFile()){
archivo = new File ( path + "\\" + listOfFiles[j].getName() );
}
fr = new FileReader (archivo);
br = new BufferedReader(fr);
String linea ;
while((linea=br.readLine())!=null) {
String [] lineaComa = linea.split(",");
if (lineaComa.length > 5 ){
conteoLinea++;
lineaComa[0] = Integer.toString(conteoLinea);
StringBuffer cadena = new StringBuffer();
for (int x=0;x<lineaComa.length;x++){
cadena =cadena.append(lineaComa[x]+",");
pegado = cadena.toString() ;
}
System.out.println(pegado);
bfwriter.write(pegado);
bfwriter.newLine();
}
}
}
bfwriter.close();
JOptionPane.showMessageDialog(null,"Archivo "+ texto + " creado satisfactoriamente..");
}
catch(Exception e){
e.printStackTrace();
}
finally{
// En el finally cerramos el fichero, para asegurarnos
// que se cierra tanto si todo va bien como si salta
// una excepcion.
try{
if( null != fr ){
fr.close();
}
}
catch (Exception e2){
e2.printStackTrace();
}
}
}
}
|
UTF-8
|
Java
| 4,538
|
java
|
PasteSCI.java
|
Java
|
[
{
"context": "echooser.FileNameExtensionFilter;\r\n/**\r\n * @author cesar.ramirez\r\n */\r\npublic class PasteSCI { \r\n //** ",
"end": 451,
"score": 0.9780730605125427,
"start": 438,
"tag": "NAME",
"value": "cesar.ramirez"
}
] | null |
[] |
package pastesci;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.FileReader;
import java.io.IOException;
import java.util.*;
import static java.util.Collections.list;
import javax.swing.filechooser.FileFilter;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.filechooser.FileNameExtensionFilter;
/**
* @author cesar.ramirez
*/
public class PasteSCI {
//** Busqueda de archivos .txt en el directorio para pegar
public static void main(String[] args) throws IOException {
String path = "", path2 = "" ;
String files ;
String f;
int conteo;
JFileChooser chooser = new JFileChooser();
chooser.setMultiSelectionEnabled(false);
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int returnVal = chooser.showOpenDialog(chooser);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
path = (file.getPath());
}
else {
System.exit(0);
}
//*******************************************************************************************************
String filesBrowse;
File folder = new File(path);
File[] listOfFiles = folder.listFiles();
File archivo = null;
FileReader fr = null;
BufferedReader br = null;
String pegado = "";
FileWriter flwriter = null;
String texto = JOptionPane.showInputDialog("Nombre del archivo a guardar")+".txt";
try {
//crea el flujo para escribir en el archivo
flwriter = new FileWriter( path+ "\\"+texto);
//crea un buffer o flujo intermedio antes de escribir directamente en el archivo
BufferedWriter bfwriter = new BufferedWriter(flwriter);
int conteoLinea = 0;
for (int j = 0; j < listOfFiles.length; j++){
if (listOfFiles[j].isFile()){
archivo = new File ( path + "\\" + listOfFiles[j].getName() );
}
fr = new FileReader (archivo);
br = new BufferedReader(fr);
String linea ;
while((linea=br.readLine())!=null) {
String [] lineaComa = linea.split(",");
if (lineaComa.length > 5 ){
conteoLinea++;
lineaComa[0] = Integer.toString(conteoLinea);
StringBuffer cadena = new StringBuffer();
for (int x=0;x<lineaComa.length;x++){
cadena =cadena.append(lineaComa[x]+",");
pegado = cadena.toString() ;
}
System.out.println(pegado);
bfwriter.write(pegado);
bfwriter.newLine();
}
}
}
bfwriter.close();
JOptionPane.showMessageDialog(null,"Archivo "+ texto + " creado satisfactoriamente..");
}
catch(Exception e){
e.printStackTrace();
}
finally{
// En el finally cerramos el fichero, para asegurarnos
// que se cierra tanto si todo va bien como si salta
// una excepcion.
try{
if( null != fr ){
fr.close();
}
}
catch (Exception e2){
e2.printStackTrace();
}
}
}
}
| 4,538
| 0.410093
| 0.408109
| 107
| 40.336449
| 24.802752
| 109
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.588785
| false
| false
|
13
|
ccd205ed53edef38df76d1ed27afa407a361dd30
| 34,059,090,661,755
|
5bb09e01494eb9708716ff125f325277aafefed8
|
/common/src/main/java/com/dremio/common/perf/StatsCollectionEligibilityRegistrar.java
|
65c9680dd5ca12dbc9f23dbf79c62649e11a65f5
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
scc-digitalhub/dremio-oss
|
https://github.com/scc-digitalhub/dremio-oss
|
968b373bf12976ad75fae47978a7dd4daeb1ae16
|
d41cb52143b6b0289fc8ed4d970bfcf410a669e8
|
refs/heads/master
| 2022-11-12T09:22:56.667000
| 2022-06-22T22:41:01
| 2022-06-22T22:41:01
| 187,240,816
| 1
| 3
|
Apache-2.0
| true
| 2020-04-26T07:30:31
| 2019-05-17T15:31:00
| 2019-11-18T12:45:40
| 2019-06-12T12:36:17
| 29,081
| 0
| 1
| 1
|
Java
| false
| false
|
/*
* Copyright (C) 2017-2019 Dremio Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.dremio.common.perf;
/*
A global, thread-safe registrar keeping a book of all threads which are eligible for stats collection.
*/
public class StatsCollectionEligibilityRegistrar {
private static final ThreadLocal<Boolean> eligibleThreads = new ThreadLocal<>();
/**
* Adds the current thread to the registry of threads eligible for stats collection
*/
public static void addSelf() {
eligibleThreads.set(true);
}
/**
* Checks if the current thread is eligible for stats collection by checking the {@code ThreadLocal} object.
*
* @return true if the current thread is eligible for stats collection, false otherwise
*/
public static boolean isEligible() {
return Boolean.TRUE.equals(eligibleThreads.get());
}
}
|
UTF-8
|
Java
| 1,376
|
java
|
StatsCollectionEligibilityRegistrar.java
|
Java
|
[] | null |
[] |
/*
* Copyright (C) 2017-2019 Dremio Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.dremio.common.perf;
/*
A global, thread-safe registrar keeping a book of all threads which are eligible for stats collection.
*/
public class StatsCollectionEligibilityRegistrar {
private static final ThreadLocal<Boolean> eligibleThreads = new ThreadLocal<>();
/**
* Adds the current thread to the registry of threads eligible for stats collection
*/
public static void addSelf() {
eligibleThreads.set(true);
}
/**
* Checks if the current thread is eligible for stats collection by checking the {@code ThreadLocal} object.
*
* @return true if the current thread is eligible for stats collection, false otherwise
*/
public static boolean isEligible() {
return Boolean.TRUE.equals(eligibleThreads.get());
}
}
| 1,376
| 0.734738
| 0.726017
| 39
| 34.282051
| 33.984119
| 110
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.282051
| false
| false
|
13
|
98ed282cf459e53554f091286e09d90378fed898
| 25,177,098,310,491
|
5584a86a509510c4d8b34b1775c8fb33ad83ae77
|
/opentach-client/src/main/java/com/opentach/client/util/blackberryRenderer.java
|
58239918506398f6a3f70f3a0bea037f8254aa85
|
[] |
no_license
|
bellmit/practicas_empresa
|
https://github.com/bellmit/practicas_empresa
|
9413899042984516d63a0eb016de59eb3906234b
|
c48ed754503cbe2e03ad9f94b48449e92b431e5e
|
refs/heads/master
| 2023-07-25T20:49:59.247000
| 2020-07-31T10:00:24
| 2020-07-31T10:00:24
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.opentach.client.util;
import java.awt.Color;
import javax.swing.JTable;
import javax.swing.table.TableColumn;
import com.ontimize.gui.table.CellRenderer.CellRendererColorManager;
//public class blackberryRenderer implements CellRendererColorManager {
//
// private static final Color ERRORCOLOR = new Color(0x86, 0x94, 0x97);
//
// public blackberryRenderer(){
// }
//
// public Color getBackground(JTable jt, int row, int col, boolean selected) {
// TableColumn tcError = jt.getColumn("PIN");
// int im = tcError.getModelIndex();
// Object f = jt.getValueAt(row, im);
// if (((String)f)==null){
// return ERRORCOLOR;
//
// }
//
// return null;
// }
//
// public Color getForeground(JTable jt, int row, int col, boolean selected) {
// return null;
// }
//
//
//}
public class blackberryRenderer implements CellRendererColorManager {
private static final Color ERRORCOLOR = new Color(0x86, 0x94, 0x97);
public blackberryRenderer() {}
@Override
public Color getBackground(JTable jt, int row, int col, boolean selected) {
TableColumn tcError = jt.getColumn("PIN");
int im = tcError.getModelIndex();
Object f = jt.getValueAt(row, im);
if (((String) f) == null) {
return blackberryRenderer.ERRORCOLOR;
}
return null;
}
@Override
public Color getForeground(JTable jt, int row, int col, boolean selected) {
return null;
}
}
|
UTF-8
|
Java
| 1,448
|
java
|
blackberryRenderer.java
|
Java
|
[] | null |
[] |
package com.opentach.client.util;
import java.awt.Color;
import javax.swing.JTable;
import javax.swing.table.TableColumn;
import com.ontimize.gui.table.CellRenderer.CellRendererColorManager;
//public class blackberryRenderer implements CellRendererColorManager {
//
// private static final Color ERRORCOLOR = new Color(0x86, 0x94, 0x97);
//
// public blackberryRenderer(){
// }
//
// public Color getBackground(JTable jt, int row, int col, boolean selected) {
// TableColumn tcError = jt.getColumn("PIN");
// int im = tcError.getModelIndex();
// Object f = jt.getValueAt(row, im);
// if (((String)f)==null){
// return ERRORCOLOR;
//
// }
//
// return null;
// }
//
// public Color getForeground(JTable jt, int row, int col, boolean selected) {
// return null;
// }
//
//
//}
public class blackberryRenderer implements CellRendererColorManager {
private static final Color ERRORCOLOR = new Color(0x86, 0x94, 0x97);
public blackberryRenderer() {}
@Override
public Color getBackground(JTable jt, int row, int col, boolean selected) {
TableColumn tcError = jt.getColumn("PIN");
int im = tcError.getModelIndex();
Object f = jt.getValueAt(row, im);
if (((String) f) == null) {
return blackberryRenderer.ERRORCOLOR;
}
return null;
}
@Override
public Color getForeground(JTable jt, int row, int col, boolean selected) {
return null;
}
}
| 1,448
| 0.67058
| 0.658149
| 60
| 22.133333
| 25.50782
| 78
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.333333
| false
| false
|
13
|
bd20fc13f2a968fd679a6cc065da93bbca5291e5
| 25,177,098,311,166
|
8d4b2fef110061e53e199cba361891ac62c7a6b1
|
/com/google/android/gms/p031b/gm.java
|
9325f8afecaaf2d4ca80156a99c90dfa48ea68ca
|
[] |
no_license
|
ksvprasad/AndroidManagerv1
|
https://github.com/ksvprasad/AndroidManagerv1
|
ee9c5f7d76408689026625836a83b7896851a57f
|
0c928186a4da3f4f7bda32bec27e403e11bcceca
|
refs/heads/master
| 2021-01-21T14:28:36.157000
| 2017-06-24T09:32:53
| 2017-06-24T09:32:53
| 95,287,099
| 0
| 1
| null | false
| 2017-06-24T09:32:53
| 2017-06-24T09:05:21
| 2017-06-24T09:23:47
| 2017-06-24T09:32:53
| 0
| 0
| 1
| 0
|
Java
| null | null |
package com.google.android.gms.p031b;
import android.app.Activity;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.customtabs.CustomTabsIntent;
import android.support.customtabs.CustomTabsIntent.Builder;
import android.text.TextUtils;
import com.google.android.gms.ads.internal.C1319u;
import com.google.android.gms.ads.internal.overlay.AdLauncherIntentInfoParcel;
import com.google.android.gms.ads.internal.overlay.AdOverlayInfoParcel;
import com.google.android.gms.ads.internal.overlay.C1047g;
import com.google.android.gms.ads.internal.util.client.C1324b;
import com.google.android.gms.ads.internal.util.client.VersionInfoParcel;
import com.google.android.gms.ads.mediation.C0961e;
import com.google.android.gms.ads.mediation.C1331a;
import com.google.android.gms.ads.mediation.C1345f;
import com.google.android.gms.p031b.de.C1416a;
@id
public class gm implements C0961e {
private Activity f4940a;
private de f4941b;
private C1345f f4942c;
private Uri f4943d;
class C15501 implements C1416a {
final /* synthetic */ gm f4936a;
C15501(gm gmVar) {
this.f4936a = gmVar;
}
}
class C15512 implements C1047g {
final /* synthetic */ gm f4937a;
C15512(gm gmVar) {
this.f4937a = gmVar;
}
public void d_() {
C1324b.m7227a("AdMobCustomTabsAdapter overlay is closed.");
this.f4937a.f4942c.mo1416c(this.f4937a);
this.f4937a.f4941b.m7896a(this.f4937a.f4940a);
}
public void e_() {
C1324b.m7227a("Opening AdMobCustomTabsAdapter overlay.");
this.f4937a.f4942c.mo1413b(this.f4937a);
}
public void f_() {
C1324b.m7227a("AdMobCustomTabsAdapter overlay is paused.");
}
public void mo988g() {
C1324b.m7227a("AdMobCustomTabsAdapter overlay is resumed.");
}
}
public static boolean m8630a(Context context) {
return de.m7894a(context);
}
public void onDestroy() {
C1324b.m7227a("Destroying AdMobCustomTabsAdapter adapter.");
try {
this.f4941b.m7896a(this.f4940a);
} catch (Throwable e) {
C1324b.m7231b("Exception while unbinding from CustomTabsService.", e);
}
}
public void onPause() {
C1324b.m7227a("Pausing AdMobCustomTabsAdapter adapter.");
}
public void onResume() {
C1324b.m7227a("Resuming AdMobCustomTabsAdapter adapter.");
}
public void requestInterstitialAd(Context context, C1345f c1345f, Bundle bundle, C1331a c1331a, Bundle bundle2) {
this.f4942c = c1345f;
if (this.f4942c == null) {
C1324b.m7234d("Listener not set for mediation. Returning.");
} else if (!(context instanceof Activity)) {
C1324b.m7234d("AdMobCustomTabs can only work with Activity context. Bailing out.");
this.f4942c.mo1408a(this, 0);
} else if (gm.m8630a(context)) {
Object string = bundle.getString("tab_url");
if (TextUtils.isEmpty(string)) {
C1324b.m7234d("The tab_url retrieved from mediation metadata is empty. Bailing out.");
this.f4942c.mo1408a(this, 0);
return;
}
this.f4940a = (Activity) context;
this.f4943d = Uri.parse(string);
this.f4941b = new de();
this.f4941b.m7897a(new C15501(this));
this.f4941b.m7898b(this.f4940a);
this.f4942c.mo1407a(this);
} else {
C1324b.m7234d("Default browser does not support custom tabs. Bailing out.");
this.f4942c.mo1408a(this, 0);
}
}
public void showInterstitial() {
CustomTabsIntent build = new Builder(this.f4941b.m7895a()).build();
build.intent.setData(this.f4943d);
final AdOverlayInfoParcel adOverlayInfoParcel = new AdOverlayInfoParcel(new AdLauncherIntentInfoParcel(build.intent), null, new C15512(this), null, new VersionInfoParcel(0, 0, false));
jz.f5567a.post(new Runnable(this) {
final /* synthetic */ gm f4939b;
public void run() {
C1319u.m7181c().m6680a(this.f4939b.f4940a, adOverlayInfoParcel);
}
});
C1319u.m7186h().m9121b(false);
}
}
|
UTF-8
|
Java
| 4,375
|
java
|
gm.java
|
Java
|
[] | null |
[] |
package com.google.android.gms.p031b;
import android.app.Activity;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.customtabs.CustomTabsIntent;
import android.support.customtabs.CustomTabsIntent.Builder;
import android.text.TextUtils;
import com.google.android.gms.ads.internal.C1319u;
import com.google.android.gms.ads.internal.overlay.AdLauncherIntentInfoParcel;
import com.google.android.gms.ads.internal.overlay.AdOverlayInfoParcel;
import com.google.android.gms.ads.internal.overlay.C1047g;
import com.google.android.gms.ads.internal.util.client.C1324b;
import com.google.android.gms.ads.internal.util.client.VersionInfoParcel;
import com.google.android.gms.ads.mediation.C0961e;
import com.google.android.gms.ads.mediation.C1331a;
import com.google.android.gms.ads.mediation.C1345f;
import com.google.android.gms.p031b.de.C1416a;
@id
public class gm implements C0961e {
private Activity f4940a;
private de f4941b;
private C1345f f4942c;
private Uri f4943d;
class C15501 implements C1416a {
final /* synthetic */ gm f4936a;
C15501(gm gmVar) {
this.f4936a = gmVar;
}
}
class C15512 implements C1047g {
final /* synthetic */ gm f4937a;
C15512(gm gmVar) {
this.f4937a = gmVar;
}
public void d_() {
C1324b.m7227a("AdMobCustomTabsAdapter overlay is closed.");
this.f4937a.f4942c.mo1416c(this.f4937a);
this.f4937a.f4941b.m7896a(this.f4937a.f4940a);
}
public void e_() {
C1324b.m7227a("Opening AdMobCustomTabsAdapter overlay.");
this.f4937a.f4942c.mo1413b(this.f4937a);
}
public void f_() {
C1324b.m7227a("AdMobCustomTabsAdapter overlay is paused.");
}
public void mo988g() {
C1324b.m7227a("AdMobCustomTabsAdapter overlay is resumed.");
}
}
public static boolean m8630a(Context context) {
return de.m7894a(context);
}
public void onDestroy() {
C1324b.m7227a("Destroying AdMobCustomTabsAdapter adapter.");
try {
this.f4941b.m7896a(this.f4940a);
} catch (Throwable e) {
C1324b.m7231b("Exception while unbinding from CustomTabsService.", e);
}
}
public void onPause() {
C1324b.m7227a("Pausing AdMobCustomTabsAdapter adapter.");
}
public void onResume() {
C1324b.m7227a("Resuming AdMobCustomTabsAdapter adapter.");
}
public void requestInterstitialAd(Context context, C1345f c1345f, Bundle bundle, C1331a c1331a, Bundle bundle2) {
this.f4942c = c1345f;
if (this.f4942c == null) {
C1324b.m7234d("Listener not set for mediation. Returning.");
} else if (!(context instanceof Activity)) {
C1324b.m7234d("AdMobCustomTabs can only work with Activity context. Bailing out.");
this.f4942c.mo1408a(this, 0);
} else if (gm.m8630a(context)) {
Object string = bundle.getString("tab_url");
if (TextUtils.isEmpty(string)) {
C1324b.m7234d("The tab_url retrieved from mediation metadata is empty. Bailing out.");
this.f4942c.mo1408a(this, 0);
return;
}
this.f4940a = (Activity) context;
this.f4943d = Uri.parse(string);
this.f4941b = new de();
this.f4941b.m7897a(new C15501(this));
this.f4941b.m7898b(this.f4940a);
this.f4942c.mo1407a(this);
} else {
C1324b.m7234d("Default browser does not support custom tabs. Bailing out.");
this.f4942c.mo1408a(this, 0);
}
}
public void showInterstitial() {
CustomTabsIntent build = new Builder(this.f4941b.m7895a()).build();
build.intent.setData(this.f4943d);
final AdOverlayInfoParcel adOverlayInfoParcel = new AdOverlayInfoParcel(new AdLauncherIntentInfoParcel(build.intent), null, new C15512(this), null, new VersionInfoParcel(0, 0, false));
jz.f5567a.post(new Runnable(this) {
final /* synthetic */ gm f4939b;
public void run() {
C1319u.m7181c().m6680a(this.f4939b.f4940a, adOverlayInfoParcel);
}
});
C1319u.m7186h().m9121b(false);
}
}
| 4,375
| 0.642057
| 0.542171
| 123
| 34.569107
| 29.642883
| 192
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.626016
| false
| false
|
13
|
0bf83307bde819ef620ba9024320c8b1e1070cc1
| 8,108,898,312,997
|
6a11c2a6d959ac70a81bbeb3618e10a77e50ce14
|
/TestVerteilung/src/main/java/de/schulte/testverteilung/VerteilungServlet.java
|
d6457799528f9e223116b1614858a0b635681dfa
|
[] |
no_license
|
Ksul/Verteilung
|
https://github.com/Ksul/Verteilung
|
ed06b4e2ecab494c667172b3217640f5a07a8a38
|
513c43e02aa2afe6ff1704bc54cb06179a027468
|
refs/heads/master
| 2021-03-27T13:09:29.983000
| 2016-11-11T16:05:26
| 2016-11-11T16:05:26
| 8,797,320
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package de.schulte.testverteilung;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Properties;
/**
* Servlet implementation class VerteilungServlet
*/
@WebServlet(name = "VerteilungServlet")
public class VerteilungServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private VerteilungServices services = new VerteilungServices();
private Logger logger = LoggerFactory.getLogger(VerteilungServlet.class.getName());
public static final String PARAMETER_FUNCTION = "function";
public static final String PARAMETER_DOCUMENTID = "documentId";
public static final String PARAMETER_DESTINATIONID = "destinationId";
public static final String PARAMETER_CURENTLOCATIONID = "currentLocationId";
public static final String PARAMETER_DOCUMENTTEXT = "documentText";
public static final String PARAMETER_FILEPATH = "filePath";
public static final String PARAMETER_FILENAME = "fileName";
public static final String PARAMETER_IMAGELINK = "imageLink";
public static final String PARAMETER_CMISQUERY = "cmisQuery";
public static final String PARAMETER_MIMETYPE = "mimeType";
public static final String PARAMETER_SERVER = "server";
public static final String PARAMETER_BINDING = "binding";
public static final String PARAMETER_USERNAME = "user";
public static final String PARAMETER_PASSWORD = "password";
public static final String PARAMETER_WITHFOLDER = "withFolder";
public static final String PARAMETER_EXTRACT = "extract";
public static final String PARAMETER_VERSIONSTATE = "versionState";
public static final String PARAMETER_VERSIONCOMMENT = "versionComment";
public static final String PARAMETER_EXTRAPROPERTIES = "extraProperties";
public static final String PARAMETER_TICKET = "ticket";
public static final String PARAMETER_COMMENT = "comment";
public static final String PARAMETER_MAXITEMSPERPAGE = "length";
public static final String PARAMETER_ITEMSTOSKIP = "start";
public static final String PARAMETER_DRAW = "draw";
public static final String PARAMETER_TIMEOUT = "timeout";
public static final String PARAMETER_ORDER = "order[0][column]";
public static final String PARAMETER_ORDERDIRECTION = "order[0][dir]";
public static final String FUNCTION_CLEARINTERNALSTORAGE = "clearInternalStorage";
public static final String FUNCTION_CREATEDOCUMENT = "createDocument";
public static final String FUNCTION_CREATEFOLDER = "createFolder";
public static final String FUNCTION_DELETEDOCUMENT = "deleteDocument";
public static final String FUNCTION_DELETEFOLDER = "deleteFolder";
public static final String FUNCTION_EXTRACTPDFCONTENT = "extractPDFContent";
public static final String FUNCTION_EXTRACTPDFFILE = "extractPDFFile";
public static final String FUNCTION_EXTRACTPDFTOINTERNALSTORAGE = "extractPDFToInternalStorage";
public static final String FUNCTION_EXTRACTZIP = "extractZIP";
public static final String FUNCTION_EXTRACTZIPANDEXTRACTPDFTOINTERNALSTORAGE = "extractZIPAndExtractPDFToInternalStorage";
public static final String FUNCTION_EXTRACTZIPTOINTERNALSTORAGE = "extractZIPToInternalStorage";
public static final String FUNCTION_FINDDOCUMENT = "findDocument";
public static final String FUNCTION_FINDDOCUMENTWITHPAGINATION = "findDocumentWithPagination";
public static final String FUNCTION_GETDATAFROMINTERNALSTORAGE = "getDataFromInternalStorage";
public static final String FUNCTION_GETDOCUMENTCONTENT = "getDocumentContent";
public static final String FUNCTION_GETNODE = "getNode";
public static final String FUNCTION_GETNODEID = "getNodeId";
public static final String FUNCTION_GETNODEBYID = "getNodeById";
public static final String FUNCTION_ISURLAVAILABLE = "isURLAvailable";
public static final String FUNCTION_LISTFOLDERASJSON = "listFolder";
public static final String FUNCTION_LISTFOLDERASJSONWITHPAGINATION = "listFolderWithPagination";
public static final String FUNCTION_MOVENODE = "moveNode";
public static final String FUNCTION_OPENFILE = "openFile";
public static final String FUNCTION_OPENPDF = "openPDF";
public static final String FUNCTION_OPENIMAGE = "openImage";
public static final String FUNCTION_SETPARAMETER = "setParameter";
public static final String FUNCTION_UPDATEDOCUMENT = "updateDocument";
public static final String FUNCTION_UPLOADDOCUMENT = "uploadDocument";
public static final String FUNCTION_UPDATEPROPERTIES = "updateproperties";
public static final String FUNCTION_GETTICKET = "getTicket";
public static final String FUNCTION_GETTICKETWITHUSERANDPASSWORD = "getTicketWithUserAndPassword";
public static final String FUNCTION_GETCOMMENTS = "getComments";
public static final String FUNCTION_ADDCOMMENT = "addComment";
public static final String FUNCTION_QUERY = "query";
public static final String FUNCTION_GETTITLES = "getTitles";
public static final String FUNCTION_ISCONNECTED = "isConnected";
public static final String FUNCTION_GETCONNECTION = "getConnection";
@Override
public void init() {
String server, binding, user, password;
try {
Properties properties = new Properties();
InputStream inputStream = getServletContext().getResourceAsStream("resources/connection.properties");
if (inputStream != null) {
properties.load(inputStream);
server = properties.getProperty("server");
password = properties.getProperty("password");
user = properties.getProperty("user");
binding = properties.getProperty("binding");
if (server != null && server.length() > 0 && password != null && password.length() > 0 &&
user != null && user.length() > 0 && binding!= null && binding.length() > 0)
services.setParameter(server,binding, user, password);
}
}catch (IOException e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
/**
* liefert die Services
* nur für Testzwecke!!!
* @return die Services
*/
protected VerteilungServices getServices() {
return services;
}
/**
* setzt die Parameter
* @param server die Server URL
* @param binding das Binding Teil
* @param user der Username
* @param password das Password
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* ret die Parameter als String
*/
protected JSONObject setParameter(String server,
String binding,
String user,
String password) {
JSONObject obj = new JSONObject();
try {
if (server != null && !server.isEmpty() && binding != null && !binding.isEmpty() && user != null && !user.isEmpty() && password != null && !password.isEmpty()) {
services.setParameter(server, binding, user, password);
obj.put("success", true);
obj.put("data", "Server:" + server + " Binding:" + binding + " User:" + user + " Password:" + password);
} else {
obj.put("success", false);
obj.put("data", "Parameter fehlt: Server: " + server + " Binding: " + binding + " User: " + user + " Password:" + password);
}
} catch (Exception e) {
obj = VerteilungHelper.convertErrorToJSON(e);
}
return obj;
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
doGetOrPost(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
public void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
doGetOrPost(request, response);
}
/**
* diese Methode handelt get und post Requests
* @param req der Request
* @param resp der Response
* @throws IOException
* @throws URISyntaxException
* @throws JSONException
*/
private void doGetOrPost(HttpServletRequest req,
HttpServletResponse resp) throws IOException {
// Get the value of a request parameter; the name is case-sensitive
long start = System.currentTimeMillis();
JSONObject obj = new JSONObject();
String value = req.getParameter(PARAMETER_FUNCTION);
resp.setHeader("Content-Type", "application/json; charset=utf-8");
PrintWriter out = resp.getWriter();
try {
if (value == null || "".equals(value)) {
obj.put("success", false);
obj.put("data", "Function Name is missing!\nPlease check for Tomcat maxPostSize and maxHeaderSizer Property for HTTPConnector");
} else {
logger.info("Call of Method " + value);
if (value.equalsIgnoreCase(FUNCTION_OPENPDF)) {
openPDF(getURLParameter(req, PARAMETER_FILENAME, true), resp);
logger.info("Service " + value + " Duration: " + (System.currentTimeMillis() - start) + " ms");
return;
} else if (value.equalsIgnoreCase(FUNCTION_OPENIMAGE)) {
openImage(getURLParameter(req, PARAMETER_IMAGELINK, true), resp);
logger.info("Service " + value + " Duration: " + (System.currentTimeMillis() - start) + " ms");
return;
} else if (value.equalsIgnoreCase(FUNCTION_SETPARAMETER)) {
obj = setParameter(getURLParameter(req, PARAMETER_SERVER, true), getURLParameter(req, PARAMETER_BINDING, true), getURLParameter(req, PARAMETER_USERNAME, true), getURLParameter(req, PARAMETER_PASSWORD, true));
} else if (value.equalsIgnoreCase(FUNCTION_ISURLAVAILABLE)) {
obj = isURLAvailable(getURLParameter(req, PARAMETER_SERVER, true), getURLParameter(req, PARAMETER_TIMEOUT, true));
} else if (value.equalsIgnoreCase(FUNCTION_GETTICKET)) {
obj = getTicket();
} else if (value.equalsIgnoreCase(FUNCTION_GETTICKETWITHUSERANDPASSWORD)) {
obj = getTicketWithUserAndPassword(getURLParameter(req, PARAMETER_USERNAME, true), getURLParameter(req, PARAMETER_PASSWORD, true), getURLParameter(req, PARAMETER_SERVER, true));
} else if (value.equalsIgnoreCase(FUNCTION_GETCOMMENTS)) {
obj = getComments(getURLParameter(req, PARAMETER_DOCUMENTID, true), getURLParameter(req, PARAMETER_TICKET, true));
} else if (value.equalsIgnoreCase(FUNCTION_ADDCOMMENT)) {
obj = addComment(getURLParameter(req, PARAMETER_DOCUMENTID, true), getURLParameter(req, PARAMETER_TICKET, true), getURLParameter(req, PARAMETER_COMMENT, true));
} else if (value.equalsIgnoreCase(FUNCTION_GETNODE)) {
obj = getNode(getURLParameter(req, PARAMETER_FILEPATH, true));
} else if (value.equalsIgnoreCase(FUNCTION_GETNODEID)) {
obj = getNodeId(getURLParameter(req, PARAMETER_FILEPATH, true));
} else if (value.equalsIgnoreCase(FUNCTION_GETNODEBYID)) {
obj = getNodeById(getURLParameter(req, PARAMETER_DOCUMENTID, true));
} else if (value.equalsIgnoreCase(FUNCTION_FINDDOCUMENT)) {
obj = findDocument(getURLParameter(req, PARAMETER_CMISQUERY, true));
} else if (value.equalsIgnoreCase(FUNCTION_FINDDOCUMENTWITHPAGINATION)) {
String orderColumn = getURLParameter(req, PARAMETER_ORDER, true);
String order = getURLParameter(req, "columns[" + orderColumn.trim() + "][name]", true);
obj = findDocumentWithPagination(getURLParameter(req, PARAMETER_CMISQUERY, true), order, getURLParameter(req, PARAMETER_ORDERDIRECTION, true), getURLParameter(req, PARAMETER_MAXITEMSPERPAGE, true), getURLParameter(req, PARAMETER_ITEMSTOSKIP, true), getURLParameter(req, PARAMETER_DRAW, true));
} else if (value.equalsIgnoreCase(FUNCTION_QUERY)) {
obj = query(getURLParameter(req, PARAMETER_CMISQUERY, true));
} else if (value.equalsIgnoreCase(FUNCTION_UPLOADDOCUMENT)) {
obj = uploadDocument(getURLParameter(req, PARAMETER_DOCUMENTID, true), getURLParameter(req, PARAMETER_FILENAME, true), getURLParameter(req, PARAMETER_VERSIONSTATE, true));
} else if (value.equalsIgnoreCase(FUNCTION_DELETEDOCUMENT)) {
obj = deleteDocument(getURLParameter(req, PARAMETER_DOCUMENTID, true));
} else if (value.equalsIgnoreCase(FUNCTION_CREATEDOCUMENT)) {
obj = createDocument(getURLParameter(req, PARAMETER_DOCUMENTID, true), getURLParameter(req, PARAMETER_FILENAME, true), getURLParameter(req, PARAMETER_DOCUMENTTEXT, true), getURLParameter(req, PARAMETER_MIMETYPE, false), getURLParameter(req, PARAMETER_EXTRAPROPERTIES, false), getURLParameter(req, PARAMETER_VERSIONSTATE, false));
} else if (value.equalsIgnoreCase(FUNCTION_CREATEFOLDER)) {
obj = createFolder(getURLParameter(req, PARAMETER_DOCUMENTID, true), getURLParameter(req, PARAMETER_EXTRAPROPERTIES, true));
} else if (value.equalsIgnoreCase(FUNCTION_DELETEFOLDER)) {
obj = deleteFolder(getURLParameter(req, PARAMETER_DOCUMENTID, true));
} else if (value.equalsIgnoreCase(FUNCTION_GETDOCUMENTCONTENT)) {
obj = getDocumentContent(getURLParameter(req, PARAMETER_DOCUMENTID, true), getURLParameter(req, PARAMETER_EXTRACT, true).equalsIgnoreCase("true"));
} else if (value.equalsIgnoreCase(FUNCTION_UPDATEDOCUMENT)) {
obj = updateDocument(getURLParameter(req, PARAMETER_DOCUMENTID, true), getURLParameter(req, PARAMETER_DOCUMENTTEXT, false), getURLParameter(req, PARAMETER_MIMETYPE, false), getURLParameter(req, PARAMETER_EXTRAPROPERTIES, false), getURLParameter(req, PARAMETER_VERSIONSTATE, false), getURLParameter(req, PARAMETER_VERSIONCOMMENT, false));
} else if (value.equalsIgnoreCase(FUNCTION_UPDATEPROPERTIES)) {
obj = updateProperties(getURLParameter(req, PARAMETER_DOCUMENTID, true), getURLParameter(req, PARAMETER_EXTRAPROPERTIES, true));
} else if (value.equalsIgnoreCase(FUNCTION_MOVENODE)) {
obj = moveNode(getURLParameter(req, PARAMETER_DOCUMENTID, true), getURLParameter(req, PARAMETER_CURENTLOCATIONID, true), getURLParameter(req, PARAMETER_DESTINATIONID, true));
} else if (value.equalsIgnoreCase(FUNCTION_LISTFOLDERASJSON)) {
obj = listFolder(getURLParameter(req, PARAMETER_FILEPATH, true), getURLParameter(req, PARAMETER_WITHFOLDER, true));
} else if (value.equalsIgnoreCase(FUNCTION_LISTFOLDERASJSONWITHPAGINATION)) {
String orderColumn = getURLParameter(req, PARAMETER_ORDER, true);
String order = getURLParameter(req, "columns[" + orderColumn.trim() + "][name]", true);
obj = listFolderWithPagination(getURLParameter(req, PARAMETER_FILEPATH, true), order, getURLParameter(req, PARAMETER_ORDERDIRECTION, true), getURLParameter(req, PARAMETER_WITHFOLDER, true), getURLParameter(req, PARAMETER_MAXITEMSPERPAGE, true), getURLParameter(req, PARAMETER_ITEMSTOSKIP, true), getURLParameter(req, PARAMETER_DRAW, true));
} else if (value.equalsIgnoreCase(FUNCTION_EXTRACTPDFCONTENT)) {
obj = extractPDFContent(getURLParameter(req, PARAMETER_DOCUMENTTEXT, true));
} else if (value.equalsIgnoreCase(FUNCTION_EXTRACTPDFFILE)) {
obj = extractPDFFile(getURLParameter(req, PARAMETER_FILENAME, true));
} else if (value.equalsIgnoreCase(FUNCTION_EXTRACTPDFTOINTERNALSTORAGE)) {
obj = extractPDFToInternalStorage(getURLParameter(req, PARAMETER_DOCUMENTTEXT, true), getURLParameter(req, PARAMETER_FILENAME, true));
} else if (value.equalsIgnoreCase(FUNCTION_EXTRACTZIPTOINTERNALSTORAGE)) {
obj = extractZIPToInternalStorage(getURLParameter(req, PARAMETER_DOCUMENTTEXT, true));
} else if (value.equalsIgnoreCase(FUNCTION_EXTRACTZIP)) {
obj = extractZIP(getURLParameter(req, PARAMETER_DOCUMENTTEXT, true));
} else if (value.equalsIgnoreCase(FUNCTION_EXTRACTZIPANDEXTRACTPDFTOINTERNALSTORAGE)) {
obj = extractZIPAndExtractPDFToInternalStorage(getURLParameter(req, PARAMETER_DOCUMENTTEXT, true));
} else if (value.equalsIgnoreCase(FUNCTION_GETTITLES)) {
obj = getTitles();
} else if (value.equalsIgnoreCase(FUNCTION_ISCONNECTED)) {
obj = isConnected();
} else if (value.equalsIgnoreCase(FUNCTION_GETCONNECTION)) {
obj = getConnection();
} else if (value.equalsIgnoreCase(FUNCTION_GETDATAFROMINTERNALSTORAGE)) {
String fileName = getURLParameter(req, PARAMETER_FILENAME, false);
if (fileName == null || fileName.isEmpty())
obj = getDataFromInternalStorage();
else
obj = getDataFromInternalStorage(fileName);
} else if (value.equalsIgnoreCase(FUNCTION_CLEARINTERNALSTORAGE)) {
obj = clearInternalStorage();
} else if (value.equalsIgnoreCase("openFile")) {
obj = openFile(getURLParameter(req, PARAMETER_FILENAME, true));
} else {
obj.put("success", false);
obj.put("data", "Function " + value + " ist dem Servlet unbekannt!");
}
logger.info("Service " + value + " Duration: " + (System.currentTimeMillis() - start) + " ms");
}
} catch (Exception e) {
obj = VerteilungHelper.convertErrorToJSON(e);
}
out.write(obj.toString());
}
/**
* liefert Informationen zur Connection
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result false keine Connection
* JSONObjekt Die Verbindungsparameter
*/
protected JSONObject getConnection() {
return services.getConnection();
}
/**
* prüft, ob schon eine Verbindung zu einem Alfresco Server besteht
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result true, wenn Verbindung vorhanden
*/
protected JSONObject isConnected() {
return services.isConnected();
}
/**
* liefert den für den Service notwendigen Parameter
* falls der Parameter benötigt wird und dieser nicht vorhanden ist, dann wird eine Exception geworfen.
* @param req der Request
* @param parameter der Name des Parameters
* @param neccesary Flag, ob der Parameter notwendig ist
* @return
* @throws VerteilungException wenn ein notwendiger Parameter nicht gesetzt ist.
*/
private String getURLParameter(HttpServletRequest req,
String parameter,
boolean neccesary) throws VerteilungException {
String param = req.getParameter(parameter);
if (param == null && neccesary)
throw new VerteilungException("Parameter " + parameter + " fehlt");
logger.info("Parameter " + parameter + " found! Value: " + param);
return param;
}
/**
* liefert ein Ticket zur Authentifizierung
* @param user der Name des Users
* @param password das Password
* @param server der Alfresco Server
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result das Ticket als String
*/
protected JSONObject getTicketWithUserAndPassword(String user, String password, String server) {
return services.getTicketWithUserAndPassword(user, password, server);
}
/**
* liefert die vorhandenen Titel
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result die Titel als String
*/
protected JSONObject getTitles() {
return services.getTitles();
}
/**
* liefert ein Ticket zur Authentifizierung
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result das Ticket als String
*/
protected JSONObject getTicket() {
return services.getTicket();
}
/**
* liefert die Kommentare zu einem Knoten
* @param documentId die Id des Knoten
* @param ticket das Ticket zur Identifizierung am Alfresco
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result die Kommentare als JSON Objekt
*/
protected JSONObject getComments(String documentId, String ticket) {
return services.getComments(documentId, ticket);
}
/**
* Fügt zu einem Knoten einen neuen Kommentar hinzu
* @param documentId die Id des Knoten/Folder
* @param ticket das Ticket zur Identifizierung
* @param comment der Kommentar
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result der neue Kommentare als JSON Objekt
*/
protected JSONObject addComment(String documentId, String ticket, String comment) {
return services.addComment(documentId, ticket, comment);
}
/**
* prüft, ob eine Url verfügbar ist
* @param urlString URL des Servers
* @param timeout der Timeout
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result true, wenn die URL verfügbar ist
*/
protected JSONObject isURLAvailable(String urlString, String timeout) {
return services.isURLAvailable(urlString, Integer.parseInt(timeout));
}
/**
* liefert einen Knoten als JSON Objekt zurück
* @param path der Pfad zum Knoten
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result der Node als JSONObject
*/
protected JSONObject getNodeById(String path) {
return services.getNodeById(path);
}
/**
* liefert die ID eines Knoten zurück
* @param path der Pfad zum Knoten
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result der Id des Knotens als String
*/
protected JSONObject getNodeId(String path) {
return services.getNodeId(path);
}
/**
* liefert einen Knoten als JSON Objekt zurück
* @param documentId die Id des Knotens
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result der Node als JSONObject
*/
protected JSONObject getNode(String documentId) {
return services.getNodeById(documentId);
}
/**
* liefert den Inhalt eines Dokumentes. Wenn es sich um eine PDF Dokument handelt, dann wird
* der Text extrahiert.
* @param documentId die Id des Documentes
* @param extract legt fest,ob einPDF Document umgewandelt werden soll
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result das Document als JSONObject
*/
protected JSONObject getDocumentContent(String documentId,
boolean extract) {
return services.getDocumentContent(documentId, extract);
}
/**
* lädt ein Document in den Server
* @param documentId die Id des Folders als String, in das Document geladen werden soll
* @param fileName der Dateiname ( mit Pfad) als String, die hochgeladen werden soll
* @param versionState der VersionsStatus ( none, major, minor, checkedout)
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result Dokument als JSONObject
* @throws VerteilungException
*/
protected JSONObject uploadDocument(String documentId,
String fileName,
String versionState) throws VerteilungException {
return services.uploadDocument(documentId, fileName, versionState);
}
/**
* löscht ein Document
* @param documentId die Id des Dokumentes das gelöscht werden soll als String
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result Dokument als JSONObject
* @throws VerteilungException
*/
protected JSONObject deleteDocument(String documentId) throws VerteilungException {
return services.deleteDocument(documentId);
}
/**
* erzeugt ein Document
* @param documentId die Id des Folders in dem das Dokument erstellt werden soll als String
* @param fileName der Name des Dokumentes als String
* @param documentContent der Inhamountablealt als String
* @param documentType der Typ des Dokumentes
* @param extraCMSProperties zusätzliche Properties
* @param versionState der versionsStatus ( none, major, minor, checkedout)
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result Dokument als JSONObject
* @throws VerteilungException
*/
protected JSONObject createDocument(String documentId,
String fileName,
String documentContent,
String documentType,
String extraCMSProperties,
String versionState) throws VerteilungException {
return services.createDocument(documentId, fileName, documentContent, documentType, extraCMSProperties, versionState);
}
/**
* aktualisiert die Properties eines Dokumentes
* @param documentId Die Id des zu aktualisierenden Dokumentes
* @param extraCMSProperties zusätzliche Properties
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result bei Erfolg nichts, ansonsten der Fehler
* @throws VerteilungException
*/
protected JSONObject updateProperties(String documentId,
String extraCMSProperties) throws VerteilungException {
return services.updateProperties(documentId, extraCMSProperties);
}
/**
* aktualisiert den Inhalt eines Dokumentes
* @param documentId Die Id des zu aktualisierenden Dokumentes
* @param documentContent der neue Inhalt
* @param documentType der Typ des Dokumentes
* @param extraCMSProperties zusätzliche Properties
* @param majorVersion falls Dokument versionierbar, dann wird eine neue Major-Version erzeugt, falls true
* @param versionComment falls Dokument versionierbar, dann kann hier eine Kommentar zur Version mitgegeben werden
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result bei Erfolg nichts, ansonsten der Fehler
* @throws VerteilungException
*/
protected JSONObject updateDocument(String documentId,
String documentContent,
String documentType,
String extraCMSProperties,
String majorVersion,
String versionComment) throws VerteilungException {
//TODO ASpekte
return services.updateDocument(documentId, documentContent, documentType, extraCMSProperties, majorVersion, versionComment);
}
/**
* verschiebt ein Dokument
* @param documentId die Id des des zu verschiebende Knoten
* @param oldFolderId der alte Folder in dem der Knoten liegt
* @param newFolderId der Folder, in das der Knoten verschoben werden soll
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result bei Erfolg das Document als JSONObject, ansonsten der Fehler
* @throws VerteilungException
*/
protected JSONObject moveNode(String documentId,
String oldFolderId,
String newFolderId) throws VerteilungException {
return services.moveNode(documentId, oldFolderId, newFolderId);
}
/**
* erzeugt einen Pfad
* @param documentId die Id des Folders in dem der Folder erstellt werden soll als String
* @param extraProperties die Prperties des neuen Folders
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result Folder als JSONObject
* @throws VerteilungException
*/
protected JSONObject createFolder(String documentId,
String extraProperties) throws VerteilungException {
return services.createFolder(documentId, extraProperties);
}
/**
* löscht einen Pfad
* @param documentId die Id des zu löschenden Pfades als String
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result
* @throws VerteilungException
*/
protected JSONObject deleteFolder(String documentId) throws VerteilungException {
return services.deleteFolder(documentId);
}
/**
* findet Documente mit Pagination
* @param cmisQuery die CMIS Query, mit der der Knoten gesucht werden soll
* @param order die Spalte nach der sortiuert werden soll
* @param orderDirection die Sortierreihenfolge: ASC oder DESC
* @param maxItemsPerPage die maximale Anzahl
* @param start die Startposition
* @param draw die Anzahl Seiten die übersprungen werden soll
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result Dokument als JSONObject
*/
protected JSONObject findDocumentWithPagination(String cmisQuery,
String order,
String orderDirection,
String maxItemsPerPage,
String start,
String draw) throws VerteilungException {
int itemsPerPage = Integer.parseInt(maxItemsPerPage);
int drawPosition = Integer.parseInt(draw);
long startPosition = Long.parseLong(start);
return services.findDocument(cmisQuery, order, orderDirection, itemsPerPage, startPosition, drawPosition);
}
/**
* findet Documente
* @param cmisQuery die CMIS Query, mit der der Knoten gesucht werden soll
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result Dokument als JSONObject
*/
protected JSONObject findDocument(String cmisQuery) throws VerteilungException {
return services.findDocument(cmisQuery, null, null, -1, 0, 0);
}
/**
* führt eien Query durch und liefert die Ergebnisse als JSON Objekte zurück
* @param cmisQuery die Query als String
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result eine Liste mit Strings
*/
protected JSONObject query(String cmisQuery) throws VerteilungException {
return services.query(cmisQuery);
}
/**
* liefert die Dokumente eines Alfresco Folders als JSON Objekte
* @param filePath der Pfad, der geliefert werden soll (als NodeId)
* @param listFolder was soll geliefert werden: 0: Folder und Dokumente, 1: nur Dokumente, -1: nur Folder
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result der Inhalt des Verzeichnisses als JSON Objekte
*/
protected JSONObject listFolder(String filePath,
String listFolder) throws VerteilungException {
return services.listFolder(filePath, null, null, Integer.parseInt(listFolder), -1, 0, 0);
}
/**
* liefert die Dokumente eines Alfresco Folders seitenweise als JSON Objekte
* @param filePath der Pfad, der geliefert werden soll (als NodeId)
* @param order die Spalte nach der sortiuert werden soll
* @param orderDirection die Sortierreihenfolge: ASC oder DESC
* @param listFolder was soll geliefert werden: 0: Folder und Dokumente, 1: nur Dokumente, -1: nur Folder
* @param maxItemsPerPage die maximale Anzahl
* @param start die Startposition
* @param draw die Anzahl Seiten die übersprungen werden soll
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result der Inhalt des Verzeichnisses als JSON Objekte
*/
protected JSONObject listFolderWithPagination(String filePath,
String order,
String orderDirection,
String listFolder,
String maxItemsPerPage,
String start,
String draw) throws VerteilungException {
int itemsPerPage = Integer.parseInt(maxItemsPerPage);
int drawPosition = Integer.parseInt(draw);
long startPosition = Long.parseLong(start);
return services.listFolder(filePath, order, orderDirection,Integer.parseInt(listFolder), itemsPerPage, startPosition, drawPosition);
}
/**
* extrahiert den Inhalt einer PDF Datei.
* @param pdfContent der Inhalt der Datei als Base64 encodeter String
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result der Inhalt der PDF Datei als String
*/
protected JSONObject extractPDFContent(String pdfContent) {
return services.extractPDFContent(pdfContent);
}
/**
* TODO Funktioniert das im Servlet Kontext?
* extrahiert eine PDF Datei.
* @param fileName der Name der PDF-Datei
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result der Inhalt der PDF Datei als String
*/
protected JSONObject extractPDFFile(String fileName) {
return services.extractPDFFile(getServletContext().getRealPath(fileName));
}
/**
* extrahiert den Text aus einer PDF Datei und speichert ihn in den internen Speicher
* @param documentText der Inhalt der PDF Datei als Base64 encodeter String
* @param fileName der Name der PDF Datei
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result bei Erfolg die Anzahl der PDF's, ansonsten der Fehler
*/
protected JSONObject extractPDFToInternalStorage(String documentText,
String fileName) throws VerteilungException {
return services.extractPDFToInternalStorage(documentText, fileName);
}
/**
* entpackt ein ZIP File in den internen Speicher
* @param documentText der Inhalt des ZIP's als Base64 encodeter String
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result bei Erfolg die Anzahl der Dokumente im ZIP File, ansonsten der Fehler
*/
protected JSONObject extractZIPToInternalStorage(String documentText) throws VerteilungException {
return services.extractZIPToInternalStorage(documentText);
}
/**
* extrahiert ein ZIP File und gibt den Inhalt als Base64 encodete Strings zurück
* @param zipContent der Inhalt des ZIP Files
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result der Inhalt der ZIP Datei als JSON Aray mit Base64 encodeten STrings
*/
protected JSONObject extractZIP(String zipContent) {
return services.extractZIP(zipContent);
}
/**
* entpackt ein ZIP File und stellt die Inhalte und die extrahierten PDF Inhalte in den internen Speicher
* @param zipContent der Inhalt der ZIP Datei als Base64 encodeter String
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result bei Erfolg die Anzahl der Dokumente im ZIP File, ansonsten der Fehler
*/
protected JSONObject extractZIPAndExtractPDFToInternalStorage(String zipContent) {
return services.extractZIPAndExtractPDFToInternalStorage(zipContent);
}
/**
* liefert den kompletten Inhalt aus dem internen Speicher
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result bei Erfolg ein JSONObjekt mit den Binärdaten (Base64 encoded) und er Inhalt als Text, ansonsten der Fehler
*/
protected JSONObject getDataFromInternalStorage() {
return services.getDataFromInternalStorage();
}
/**
* liefert den Inhalt aus dem internen Speicher
* @param fileName der Name der zu suchenden Datei
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result bei Erfolg ein JSONObjekt mit den Binärdaten (Base64 encoded) und er Inhalt als Text, ansonsten der Fehler
*/
protected JSONObject getDataFromInternalStorage(String fileName) {
return services.getDataFromInternalStorage(fileName);
}
/**
* löscht den internen Speicher
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result bei Erfolg nichts, ansonsten der Fehler
*/
protected JSONObject clearInternalStorage() {
return services.clearInternalStorage();
}
/**
* TODO macht diese Methode im Servlert Kontext Sinn?
* öffnet eine Datei
* @param fileName der Name der zu öffnenden Datei
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result bei Erfolg der Inhalt der Datei als String, ansonsten der Fehler
*/
protected JSONObject openFile(String fileName) throws VerteilungException {
return services.openFile(getServletContext().getRealPath(fileName).replace("\\", "/"));
}
/**
* öffnet ein Image auf dem Alfrsco Server
* @param link der link zu dem Image
* @param resp der Response zum Öffnen
*/
protected void openImage(String link,
HttpServletResponse resp) {
ServletOutputStream sout = null;
String server = services.getServer();
if (!server.endsWith("/"))
server = server + "/";
try {
String ticket = services.getTicket().getJSONObject("data").getJSONObject("data").getString("ticket");
URL url = new URL(server + link + "&alf_ticket=" + ticket);
InputStream is = url.openStream();
byte[] b = new byte[2048];
int length;
resp.reset();
resp.resetBuffer();
resp.setContentType("image/jpeg");
sout = resp.getOutputStream();
while ((length = is.read(b)) != -1) {
sout.write(b, 0, length);
}
is.close();
sout.flush();
sout.close();
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
} finally {
try {
if (sout != null)
sout.close();
} catch (IOException io) {
logger.error(io.getLocalizedMessage());
io.printStackTrace();
}
}
}
/**
* öffnet ein PDF im Browser
* @param fileName der Filename des PDF Dokumentes
* @param resp der Response zum Öffnen des PDFs
*/
protected void openPDF(String fileName,
HttpServletResponse resp) {
ServletOutputStream sout = null;
try {
for (FileEntry entry : services.getEntries()) {
if (entry.getName().equalsIgnoreCase(fileName)) {
final byte[] bytes = entry.getData();
final String name = entry.getName();
resp.reset();
resp.resetBuffer();
resp.setContentType("application/pdf");
resp.setHeader("Content-Disposition", "inline; filename=" + name + "\"");
resp.setHeader("Cache-Control", "max-age=0");
resp.setContentLength(bytes.length);
sout = resp.getOutputStream();
sout.write(bytes, 0, bytes.length);
sout.flush();
sout.close();
break;
}
}
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
} finally {
try {
if (sout != null)
sout.close();
} catch (IOException io) {
logger.error(io.getLocalizedMessage());
io.printStackTrace();
}
}
}
}
|
UTF-8
|
Java
| 50,165
|
java
|
VerteilungServlet.java
|
Java
|
[
{
"context": " public static final String PARAMETER_USERNAME = \"user\";\n public static final String PARAMETER_PASSWO",
"end": 1803,
"score": 0.9988486170768738,
"start": 1799,
"tag": "USERNAME",
"value": "user"
},
{
"context": " public static final String PARAMETER_PASSWORD = \"password\";\n public static final String PARAMETER_WITHFO",
"end": 1867,
"score": 0.9995020627975464,
"start": 1859,
"tag": "PASSWORD",
"value": "password"
},
{
"context": "er der Username\n * @param password das Password\n * @return ein JSONObject mit den",
"end": 6996,
"score": 0.9899669885635376,
"start": 6984,
"tag": "PASSWORD",
"value": "das Password"
},
{
"context": "g: \" + binding + \" User: \" + user + \" Password:\" + password);\n }\n } catch (Exception e) {\n ",
"end": 8199,
"score": 0.564460277557373,
"start": 8191,
"tag": "PASSWORD",
"value": "password"
},
{
"context": " der Name des Users\n * @param password das Password\n * @param server der Alfresco Server\n ",
"end": 21420,
"score": 0.978112518787384,
"start": 21412,
"tag": "PASSWORD",
"value": "Password"
}
] | null |
[] |
package de.schulte.testverteilung;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Properties;
/**
* Servlet implementation class VerteilungServlet
*/
@WebServlet(name = "VerteilungServlet")
public class VerteilungServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private VerteilungServices services = new VerteilungServices();
private Logger logger = LoggerFactory.getLogger(VerteilungServlet.class.getName());
public static final String PARAMETER_FUNCTION = "function";
public static final String PARAMETER_DOCUMENTID = "documentId";
public static final String PARAMETER_DESTINATIONID = "destinationId";
public static final String PARAMETER_CURENTLOCATIONID = "currentLocationId";
public static final String PARAMETER_DOCUMENTTEXT = "documentText";
public static final String PARAMETER_FILEPATH = "filePath";
public static final String PARAMETER_FILENAME = "fileName";
public static final String PARAMETER_IMAGELINK = "imageLink";
public static final String PARAMETER_CMISQUERY = "cmisQuery";
public static final String PARAMETER_MIMETYPE = "mimeType";
public static final String PARAMETER_SERVER = "server";
public static final String PARAMETER_BINDING = "binding";
public static final String PARAMETER_USERNAME = "user";
public static final String PARAMETER_PASSWORD = "<PASSWORD>";
public static final String PARAMETER_WITHFOLDER = "withFolder";
public static final String PARAMETER_EXTRACT = "extract";
public static final String PARAMETER_VERSIONSTATE = "versionState";
public static final String PARAMETER_VERSIONCOMMENT = "versionComment";
public static final String PARAMETER_EXTRAPROPERTIES = "extraProperties";
public static final String PARAMETER_TICKET = "ticket";
public static final String PARAMETER_COMMENT = "comment";
public static final String PARAMETER_MAXITEMSPERPAGE = "length";
public static final String PARAMETER_ITEMSTOSKIP = "start";
public static final String PARAMETER_DRAW = "draw";
public static final String PARAMETER_TIMEOUT = "timeout";
public static final String PARAMETER_ORDER = "order[0][column]";
public static final String PARAMETER_ORDERDIRECTION = "order[0][dir]";
public static final String FUNCTION_CLEARINTERNALSTORAGE = "clearInternalStorage";
public static final String FUNCTION_CREATEDOCUMENT = "createDocument";
public static final String FUNCTION_CREATEFOLDER = "createFolder";
public static final String FUNCTION_DELETEDOCUMENT = "deleteDocument";
public static final String FUNCTION_DELETEFOLDER = "deleteFolder";
public static final String FUNCTION_EXTRACTPDFCONTENT = "extractPDFContent";
public static final String FUNCTION_EXTRACTPDFFILE = "extractPDFFile";
public static final String FUNCTION_EXTRACTPDFTOINTERNALSTORAGE = "extractPDFToInternalStorage";
public static final String FUNCTION_EXTRACTZIP = "extractZIP";
public static final String FUNCTION_EXTRACTZIPANDEXTRACTPDFTOINTERNALSTORAGE = "extractZIPAndExtractPDFToInternalStorage";
public static final String FUNCTION_EXTRACTZIPTOINTERNALSTORAGE = "extractZIPToInternalStorage";
public static final String FUNCTION_FINDDOCUMENT = "findDocument";
public static final String FUNCTION_FINDDOCUMENTWITHPAGINATION = "findDocumentWithPagination";
public static final String FUNCTION_GETDATAFROMINTERNALSTORAGE = "getDataFromInternalStorage";
public static final String FUNCTION_GETDOCUMENTCONTENT = "getDocumentContent";
public static final String FUNCTION_GETNODE = "getNode";
public static final String FUNCTION_GETNODEID = "getNodeId";
public static final String FUNCTION_GETNODEBYID = "getNodeById";
public static final String FUNCTION_ISURLAVAILABLE = "isURLAvailable";
public static final String FUNCTION_LISTFOLDERASJSON = "listFolder";
public static final String FUNCTION_LISTFOLDERASJSONWITHPAGINATION = "listFolderWithPagination";
public static final String FUNCTION_MOVENODE = "moveNode";
public static final String FUNCTION_OPENFILE = "openFile";
public static final String FUNCTION_OPENPDF = "openPDF";
public static final String FUNCTION_OPENIMAGE = "openImage";
public static final String FUNCTION_SETPARAMETER = "setParameter";
public static final String FUNCTION_UPDATEDOCUMENT = "updateDocument";
public static final String FUNCTION_UPLOADDOCUMENT = "uploadDocument";
public static final String FUNCTION_UPDATEPROPERTIES = "updateproperties";
public static final String FUNCTION_GETTICKET = "getTicket";
public static final String FUNCTION_GETTICKETWITHUSERANDPASSWORD = "getTicketWithUserAndPassword";
public static final String FUNCTION_GETCOMMENTS = "getComments";
public static final String FUNCTION_ADDCOMMENT = "addComment";
public static final String FUNCTION_QUERY = "query";
public static final String FUNCTION_GETTITLES = "getTitles";
public static final String FUNCTION_ISCONNECTED = "isConnected";
public static final String FUNCTION_GETCONNECTION = "getConnection";
@Override
public void init() {
String server, binding, user, password;
try {
Properties properties = new Properties();
InputStream inputStream = getServletContext().getResourceAsStream("resources/connection.properties");
if (inputStream != null) {
properties.load(inputStream);
server = properties.getProperty("server");
password = properties.getProperty("password");
user = properties.getProperty("user");
binding = properties.getProperty("binding");
if (server != null && server.length() > 0 && password != null && password.length() > 0 &&
user != null && user.length() > 0 && binding!= null && binding.length() > 0)
services.setParameter(server,binding, user, password);
}
}catch (IOException e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
/**
* liefert die Services
* nur für Testzwecke!!!
* @return die Services
*/
protected VerteilungServices getServices() {
return services;
}
/**
* setzt die Parameter
* @param server die Server URL
* @param binding das Binding Teil
* @param user der Username
* @param password <PASSWORD>
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* ret die Parameter als String
*/
protected JSONObject setParameter(String server,
String binding,
String user,
String password) {
JSONObject obj = new JSONObject();
try {
if (server != null && !server.isEmpty() && binding != null && !binding.isEmpty() && user != null && !user.isEmpty() && password != null && !password.isEmpty()) {
services.setParameter(server, binding, user, password);
obj.put("success", true);
obj.put("data", "Server:" + server + " Binding:" + binding + " User:" + user + " Password:" + password);
} else {
obj.put("success", false);
obj.put("data", "Parameter fehlt: Server: " + server + " Binding: " + binding + " User: " + user + " Password:" + <PASSWORD>);
}
} catch (Exception e) {
obj = VerteilungHelper.convertErrorToJSON(e);
}
return obj;
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
doGetOrPost(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
public void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
doGetOrPost(request, response);
}
/**
* diese Methode handelt get und post Requests
* @param req der Request
* @param resp der Response
* @throws IOException
* @throws URISyntaxException
* @throws JSONException
*/
private void doGetOrPost(HttpServletRequest req,
HttpServletResponse resp) throws IOException {
// Get the value of a request parameter; the name is case-sensitive
long start = System.currentTimeMillis();
JSONObject obj = new JSONObject();
String value = req.getParameter(PARAMETER_FUNCTION);
resp.setHeader("Content-Type", "application/json; charset=utf-8");
PrintWriter out = resp.getWriter();
try {
if (value == null || "".equals(value)) {
obj.put("success", false);
obj.put("data", "Function Name is missing!\nPlease check for Tomcat maxPostSize and maxHeaderSizer Property for HTTPConnector");
} else {
logger.info("Call of Method " + value);
if (value.equalsIgnoreCase(FUNCTION_OPENPDF)) {
openPDF(getURLParameter(req, PARAMETER_FILENAME, true), resp);
logger.info("Service " + value + " Duration: " + (System.currentTimeMillis() - start) + " ms");
return;
} else if (value.equalsIgnoreCase(FUNCTION_OPENIMAGE)) {
openImage(getURLParameter(req, PARAMETER_IMAGELINK, true), resp);
logger.info("Service " + value + " Duration: " + (System.currentTimeMillis() - start) + " ms");
return;
} else if (value.equalsIgnoreCase(FUNCTION_SETPARAMETER)) {
obj = setParameter(getURLParameter(req, PARAMETER_SERVER, true), getURLParameter(req, PARAMETER_BINDING, true), getURLParameter(req, PARAMETER_USERNAME, true), getURLParameter(req, PARAMETER_PASSWORD, true));
} else if (value.equalsIgnoreCase(FUNCTION_ISURLAVAILABLE)) {
obj = isURLAvailable(getURLParameter(req, PARAMETER_SERVER, true), getURLParameter(req, PARAMETER_TIMEOUT, true));
} else if (value.equalsIgnoreCase(FUNCTION_GETTICKET)) {
obj = getTicket();
} else if (value.equalsIgnoreCase(FUNCTION_GETTICKETWITHUSERANDPASSWORD)) {
obj = getTicketWithUserAndPassword(getURLParameter(req, PARAMETER_USERNAME, true), getURLParameter(req, PARAMETER_PASSWORD, true), getURLParameter(req, PARAMETER_SERVER, true));
} else if (value.equalsIgnoreCase(FUNCTION_GETCOMMENTS)) {
obj = getComments(getURLParameter(req, PARAMETER_DOCUMENTID, true), getURLParameter(req, PARAMETER_TICKET, true));
} else if (value.equalsIgnoreCase(FUNCTION_ADDCOMMENT)) {
obj = addComment(getURLParameter(req, PARAMETER_DOCUMENTID, true), getURLParameter(req, PARAMETER_TICKET, true), getURLParameter(req, PARAMETER_COMMENT, true));
} else if (value.equalsIgnoreCase(FUNCTION_GETNODE)) {
obj = getNode(getURLParameter(req, PARAMETER_FILEPATH, true));
} else if (value.equalsIgnoreCase(FUNCTION_GETNODEID)) {
obj = getNodeId(getURLParameter(req, PARAMETER_FILEPATH, true));
} else if (value.equalsIgnoreCase(FUNCTION_GETNODEBYID)) {
obj = getNodeById(getURLParameter(req, PARAMETER_DOCUMENTID, true));
} else if (value.equalsIgnoreCase(FUNCTION_FINDDOCUMENT)) {
obj = findDocument(getURLParameter(req, PARAMETER_CMISQUERY, true));
} else if (value.equalsIgnoreCase(FUNCTION_FINDDOCUMENTWITHPAGINATION)) {
String orderColumn = getURLParameter(req, PARAMETER_ORDER, true);
String order = getURLParameter(req, "columns[" + orderColumn.trim() + "][name]", true);
obj = findDocumentWithPagination(getURLParameter(req, PARAMETER_CMISQUERY, true), order, getURLParameter(req, PARAMETER_ORDERDIRECTION, true), getURLParameter(req, PARAMETER_MAXITEMSPERPAGE, true), getURLParameter(req, PARAMETER_ITEMSTOSKIP, true), getURLParameter(req, PARAMETER_DRAW, true));
} else if (value.equalsIgnoreCase(FUNCTION_QUERY)) {
obj = query(getURLParameter(req, PARAMETER_CMISQUERY, true));
} else if (value.equalsIgnoreCase(FUNCTION_UPLOADDOCUMENT)) {
obj = uploadDocument(getURLParameter(req, PARAMETER_DOCUMENTID, true), getURLParameter(req, PARAMETER_FILENAME, true), getURLParameter(req, PARAMETER_VERSIONSTATE, true));
} else if (value.equalsIgnoreCase(FUNCTION_DELETEDOCUMENT)) {
obj = deleteDocument(getURLParameter(req, PARAMETER_DOCUMENTID, true));
} else if (value.equalsIgnoreCase(FUNCTION_CREATEDOCUMENT)) {
obj = createDocument(getURLParameter(req, PARAMETER_DOCUMENTID, true), getURLParameter(req, PARAMETER_FILENAME, true), getURLParameter(req, PARAMETER_DOCUMENTTEXT, true), getURLParameter(req, PARAMETER_MIMETYPE, false), getURLParameter(req, PARAMETER_EXTRAPROPERTIES, false), getURLParameter(req, PARAMETER_VERSIONSTATE, false));
} else if (value.equalsIgnoreCase(FUNCTION_CREATEFOLDER)) {
obj = createFolder(getURLParameter(req, PARAMETER_DOCUMENTID, true), getURLParameter(req, PARAMETER_EXTRAPROPERTIES, true));
} else if (value.equalsIgnoreCase(FUNCTION_DELETEFOLDER)) {
obj = deleteFolder(getURLParameter(req, PARAMETER_DOCUMENTID, true));
} else if (value.equalsIgnoreCase(FUNCTION_GETDOCUMENTCONTENT)) {
obj = getDocumentContent(getURLParameter(req, PARAMETER_DOCUMENTID, true), getURLParameter(req, PARAMETER_EXTRACT, true).equalsIgnoreCase("true"));
} else if (value.equalsIgnoreCase(FUNCTION_UPDATEDOCUMENT)) {
obj = updateDocument(getURLParameter(req, PARAMETER_DOCUMENTID, true), getURLParameter(req, PARAMETER_DOCUMENTTEXT, false), getURLParameter(req, PARAMETER_MIMETYPE, false), getURLParameter(req, PARAMETER_EXTRAPROPERTIES, false), getURLParameter(req, PARAMETER_VERSIONSTATE, false), getURLParameter(req, PARAMETER_VERSIONCOMMENT, false));
} else if (value.equalsIgnoreCase(FUNCTION_UPDATEPROPERTIES)) {
obj = updateProperties(getURLParameter(req, PARAMETER_DOCUMENTID, true), getURLParameter(req, PARAMETER_EXTRAPROPERTIES, true));
} else if (value.equalsIgnoreCase(FUNCTION_MOVENODE)) {
obj = moveNode(getURLParameter(req, PARAMETER_DOCUMENTID, true), getURLParameter(req, PARAMETER_CURENTLOCATIONID, true), getURLParameter(req, PARAMETER_DESTINATIONID, true));
} else if (value.equalsIgnoreCase(FUNCTION_LISTFOLDERASJSON)) {
obj = listFolder(getURLParameter(req, PARAMETER_FILEPATH, true), getURLParameter(req, PARAMETER_WITHFOLDER, true));
} else if (value.equalsIgnoreCase(FUNCTION_LISTFOLDERASJSONWITHPAGINATION)) {
String orderColumn = getURLParameter(req, PARAMETER_ORDER, true);
String order = getURLParameter(req, "columns[" + orderColumn.trim() + "][name]", true);
obj = listFolderWithPagination(getURLParameter(req, PARAMETER_FILEPATH, true), order, getURLParameter(req, PARAMETER_ORDERDIRECTION, true), getURLParameter(req, PARAMETER_WITHFOLDER, true), getURLParameter(req, PARAMETER_MAXITEMSPERPAGE, true), getURLParameter(req, PARAMETER_ITEMSTOSKIP, true), getURLParameter(req, PARAMETER_DRAW, true));
} else if (value.equalsIgnoreCase(FUNCTION_EXTRACTPDFCONTENT)) {
obj = extractPDFContent(getURLParameter(req, PARAMETER_DOCUMENTTEXT, true));
} else if (value.equalsIgnoreCase(FUNCTION_EXTRACTPDFFILE)) {
obj = extractPDFFile(getURLParameter(req, PARAMETER_FILENAME, true));
} else if (value.equalsIgnoreCase(FUNCTION_EXTRACTPDFTOINTERNALSTORAGE)) {
obj = extractPDFToInternalStorage(getURLParameter(req, PARAMETER_DOCUMENTTEXT, true), getURLParameter(req, PARAMETER_FILENAME, true));
} else if (value.equalsIgnoreCase(FUNCTION_EXTRACTZIPTOINTERNALSTORAGE)) {
obj = extractZIPToInternalStorage(getURLParameter(req, PARAMETER_DOCUMENTTEXT, true));
} else if (value.equalsIgnoreCase(FUNCTION_EXTRACTZIP)) {
obj = extractZIP(getURLParameter(req, PARAMETER_DOCUMENTTEXT, true));
} else if (value.equalsIgnoreCase(FUNCTION_EXTRACTZIPANDEXTRACTPDFTOINTERNALSTORAGE)) {
obj = extractZIPAndExtractPDFToInternalStorage(getURLParameter(req, PARAMETER_DOCUMENTTEXT, true));
} else if (value.equalsIgnoreCase(FUNCTION_GETTITLES)) {
obj = getTitles();
} else if (value.equalsIgnoreCase(FUNCTION_ISCONNECTED)) {
obj = isConnected();
} else if (value.equalsIgnoreCase(FUNCTION_GETCONNECTION)) {
obj = getConnection();
} else if (value.equalsIgnoreCase(FUNCTION_GETDATAFROMINTERNALSTORAGE)) {
String fileName = getURLParameter(req, PARAMETER_FILENAME, false);
if (fileName == null || fileName.isEmpty())
obj = getDataFromInternalStorage();
else
obj = getDataFromInternalStorage(fileName);
} else if (value.equalsIgnoreCase(FUNCTION_CLEARINTERNALSTORAGE)) {
obj = clearInternalStorage();
} else if (value.equalsIgnoreCase("openFile")) {
obj = openFile(getURLParameter(req, PARAMETER_FILENAME, true));
} else {
obj.put("success", false);
obj.put("data", "Function " + value + " ist dem Servlet unbekannt!");
}
logger.info("Service " + value + " Duration: " + (System.currentTimeMillis() - start) + " ms");
}
} catch (Exception e) {
obj = VerteilungHelper.convertErrorToJSON(e);
}
out.write(obj.toString());
}
/**
* liefert Informationen zur Connection
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result false keine Connection
* JSONObjekt Die Verbindungsparameter
*/
protected JSONObject getConnection() {
return services.getConnection();
}
/**
* prüft, ob schon eine Verbindung zu einem Alfresco Server besteht
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result true, wenn Verbindung vorhanden
*/
protected JSONObject isConnected() {
return services.isConnected();
}
/**
* liefert den für den Service notwendigen Parameter
* falls der Parameter benötigt wird und dieser nicht vorhanden ist, dann wird eine Exception geworfen.
* @param req der Request
* @param parameter der Name des Parameters
* @param neccesary Flag, ob der Parameter notwendig ist
* @return
* @throws VerteilungException wenn ein notwendiger Parameter nicht gesetzt ist.
*/
private String getURLParameter(HttpServletRequest req,
String parameter,
boolean neccesary) throws VerteilungException {
String param = req.getParameter(parameter);
if (param == null && neccesary)
throw new VerteilungException("Parameter " + parameter + " fehlt");
logger.info("Parameter " + parameter + " found! Value: " + param);
return param;
}
/**
* liefert ein Ticket zur Authentifizierung
* @param user der Name des Users
* @param password das <PASSWORD>
* @param server der Alfresco Server
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result das Ticket als String
*/
protected JSONObject getTicketWithUserAndPassword(String user, String password, String server) {
return services.getTicketWithUserAndPassword(user, password, server);
}
/**
* liefert die vorhandenen Titel
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result die Titel als String
*/
protected JSONObject getTitles() {
return services.getTitles();
}
/**
* liefert ein Ticket zur Authentifizierung
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result das Ticket als String
*/
protected JSONObject getTicket() {
return services.getTicket();
}
/**
* liefert die Kommentare zu einem Knoten
* @param documentId die Id des Knoten
* @param ticket das Ticket zur Identifizierung am Alfresco
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result die Kommentare als JSON Objekt
*/
protected JSONObject getComments(String documentId, String ticket) {
return services.getComments(documentId, ticket);
}
/**
* Fügt zu einem Knoten einen neuen Kommentar hinzu
* @param documentId die Id des Knoten/Folder
* @param ticket das Ticket zur Identifizierung
* @param comment der Kommentar
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result der neue Kommentare als JSON Objekt
*/
protected JSONObject addComment(String documentId, String ticket, String comment) {
return services.addComment(documentId, ticket, comment);
}
/**
* prüft, ob eine Url verfügbar ist
* @param urlString URL des Servers
* @param timeout der Timeout
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result true, wenn die URL verfügbar ist
*/
protected JSONObject isURLAvailable(String urlString, String timeout) {
return services.isURLAvailable(urlString, Integer.parseInt(timeout));
}
/**
* liefert einen Knoten als JSON Objekt zurück
* @param path der Pfad zum Knoten
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result der Node als JSONObject
*/
protected JSONObject getNodeById(String path) {
return services.getNodeById(path);
}
/**
* liefert die ID eines Knoten zurück
* @param path der Pfad zum Knoten
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result der Id des Knotens als String
*/
protected JSONObject getNodeId(String path) {
return services.getNodeId(path);
}
/**
* liefert einen Knoten als JSON Objekt zurück
* @param documentId die Id des Knotens
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result der Node als JSONObject
*/
protected JSONObject getNode(String documentId) {
return services.getNodeById(documentId);
}
/**
* liefert den Inhalt eines Dokumentes. Wenn es sich um eine PDF Dokument handelt, dann wird
* der Text extrahiert.
* @param documentId die Id des Documentes
* @param extract legt fest,ob einPDF Document umgewandelt werden soll
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result das Document als JSONObject
*/
protected JSONObject getDocumentContent(String documentId,
boolean extract) {
return services.getDocumentContent(documentId, extract);
}
/**
* lädt ein Document in den Server
* @param documentId die Id des Folders als String, in das Document geladen werden soll
* @param fileName der Dateiname ( mit Pfad) als String, die hochgeladen werden soll
* @param versionState der VersionsStatus ( none, major, minor, checkedout)
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result Dokument als JSONObject
* @throws VerteilungException
*/
protected JSONObject uploadDocument(String documentId,
String fileName,
String versionState) throws VerteilungException {
return services.uploadDocument(documentId, fileName, versionState);
}
/**
* löscht ein Document
* @param documentId die Id des Dokumentes das gelöscht werden soll als String
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result Dokument als JSONObject
* @throws VerteilungException
*/
protected JSONObject deleteDocument(String documentId) throws VerteilungException {
return services.deleteDocument(documentId);
}
/**
* erzeugt ein Document
* @param documentId die Id des Folders in dem das Dokument erstellt werden soll als String
* @param fileName der Name des Dokumentes als String
* @param documentContent der Inhamountablealt als String
* @param documentType der Typ des Dokumentes
* @param extraCMSProperties zusätzliche Properties
* @param versionState der versionsStatus ( none, major, minor, checkedout)
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result Dokument als JSONObject
* @throws VerteilungException
*/
protected JSONObject createDocument(String documentId,
String fileName,
String documentContent,
String documentType,
String extraCMSProperties,
String versionState) throws VerteilungException {
return services.createDocument(documentId, fileName, documentContent, documentType, extraCMSProperties, versionState);
}
/**
* aktualisiert die Properties eines Dokumentes
* @param documentId Die Id des zu aktualisierenden Dokumentes
* @param extraCMSProperties zusätzliche Properties
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result bei Erfolg nichts, ansonsten der Fehler
* @throws VerteilungException
*/
protected JSONObject updateProperties(String documentId,
String extraCMSProperties) throws VerteilungException {
return services.updateProperties(documentId, extraCMSProperties);
}
/**
* aktualisiert den Inhalt eines Dokumentes
* @param documentId Die Id des zu aktualisierenden Dokumentes
* @param documentContent der neue Inhalt
* @param documentType der Typ des Dokumentes
* @param extraCMSProperties zusätzliche Properties
* @param majorVersion falls Dokument versionierbar, dann wird eine neue Major-Version erzeugt, falls true
* @param versionComment falls Dokument versionierbar, dann kann hier eine Kommentar zur Version mitgegeben werden
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result bei Erfolg nichts, ansonsten der Fehler
* @throws VerteilungException
*/
protected JSONObject updateDocument(String documentId,
String documentContent,
String documentType,
String extraCMSProperties,
String majorVersion,
String versionComment) throws VerteilungException {
//TODO ASpekte
return services.updateDocument(documentId, documentContent, documentType, extraCMSProperties, majorVersion, versionComment);
}
/**
* verschiebt ein Dokument
* @param documentId die Id des des zu verschiebende Knoten
* @param oldFolderId der alte Folder in dem der Knoten liegt
* @param newFolderId der Folder, in das der Knoten verschoben werden soll
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result bei Erfolg das Document als JSONObject, ansonsten der Fehler
* @throws VerteilungException
*/
protected JSONObject moveNode(String documentId,
String oldFolderId,
String newFolderId) throws VerteilungException {
return services.moveNode(documentId, oldFolderId, newFolderId);
}
/**
* erzeugt einen Pfad
* @param documentId die Id des Folders in dem der Folder erstellt werden soll als String
* @param extraProperties die Prperties des neuen Folders
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result Folder als JSONObject
* @throws VerteilungException
*/
protected JSONObject createFolder(String documentId,
String extraProperties) throws VerteilungException {
return services.createFolder(documentId, extraProperties);
}
/**
* löscht einen Pfad
* @param documentId die Id des zu löschenden Pfades als String
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result
* @throws VerteilungException
*/
protected JSONObject deleteFolder(String documentId) throws VerteilungException {
return services.deleteFolder(documentId);
}
/**
* findet Documente mit Pagination
* @param cmisQuery die CMIS Query, mit der der Knoten gesucht werden soll
* @param order die Spalte nach der sortiuert werden soll
* @param orderDirection die Sortierreihenfolge: ASC oder DESC
* @param maxItemsPerPage die maximale Anzahl
* @param start die Startposition
* @param draw die Anzahl Seiten die übersprungen werden soll
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result Dokument als JSONObject
*/
protected JSONObject findDocumentWithPagination(String cmisQuery,
String order,
String orderDirection,
String maxItemsPerPage,
String start,
String draw) throws VerteilungException {
int itemsPerPage = Integer.parseInt(maxItemsPerPage);
int drawPosition = Integer.parseInt(draw);
long startPosition = Long.parseLong(start);
return services.findDocument(cmisQuery, order, orderDirection, itemsPerPage, startPosition, drawPosition);
}
/**
* findet Documente
* @param cmisQuery die CMIS Query, mit der der Knoten gesucht werden soll
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result Dokument als JSONObject
*/
protected JSONObject findDocument(String cmisQuery) throws VerteilungException {
return services.findDocument(cmisQuery, null, null, -1, 0, 0);
}
/**
* führt eien Query durch und liefert die Ergebnisse als JSON Objekte zurück
* @param cmisQuery die Query als String
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result eine Liste mit Strings
*/
protected JSONObject query(String cmisQuery) throws VerteilungException {
return services.query(cmisQuery);
}
/**
* liefert die Dokumente eines Alfresco Folders als JSON Objekte
* @param filePath der Pfad, der geliefert werden soll (als NodeId)
* @param listFolder was soll geliefert werden: 0: Folder und Dokumente, 1: nur Dokumente, -1: nur Folder
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result der Inhalt des Verzeichnisses als JSON Objekte
*/
protected JSONObject listFolder(String filePath,
String listFolder) throws VerteilungException {
return services.listFolder(filePath, null, null, Integer.parseInt(listFolder), -1, 0, 0);
}
/**
* liefert die Dokumente eines Alfresco Folders seitenweise als JSON Objekte
* @param filePath der Pfad, der geliefert werden soll (als NodeId)
* @param order die Spalte nach der sortiuert werden soll
* @param orderDirection die Sortierreihenfolge: ASC oder DESC
* @param listFolder was soll geliefert werden: 0: Folder und Dokumente, 1: nur Dokumente, -1: nur Folder
* @param maxItemsPerPage die maximale Anzahl
* @param start die Startposition
* @param draw die Anzahl Seiten die übersprungen werden soll
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result der Inhalt des Verzeichnisses als JSON Objekte
*/
protected JSONObject listFolderWithPagination(String filePath,
String order,
String orderDirection,
String listFolder,
String maxItemsPerPage,
String start,
String draw) throws VerteilungException {
int itemsPerPage = Integer.parseInt(maxItemsPerPage);
int drawPosition = Integer.parseInt(draw);
long startPosition = Long.parseLong(start);
return services.listFolder(filePath, order, orderDirection,Integer.parseInt(listFolder), itemsPerPage, startPosition, drawPosition);
}
/**
* extrahiert den Inhalt einer PDF Datei.
* @param pdfContent der Inhalt der Datei als Base64 encodeter String
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result der Inhalt der PDF Datei als String
*/
protected JSONObject extractPDFContent(String pdfContent) {
return services.extractPDFContent(pdfContent);
}
/**
* TODO Funktioniert das im Servlet Kontext?
* extrahiert eine PDF Datei.
* @param fileName der Name der PDF-Datei
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result der Inhalt der PDF Datei als String
*/
protected JSONObject extractPDFFile(String fileName) {
return services.extractPDFFile(getServletContext().getRealPath(fileName));
}
/**
* extrahiert den Text aus einer PDF Datei und speichert ihn in den internen Speicher
* @param documentText der Inhalt der PDF Datei als Base64 encodeter String
* @param fileName der Name der PDF Datei
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result bei Erfolg die Anzahl der PDF's, ansonsten der Fehler
*/
protected JSONObject extractPDFToInternalStorage(String documentText,
String fileName) throws VerteilungException {
return services.extractPDFToInternalStorage(documentText, fileName);
}
/**
* entpackt ein ZIP File in den internen Speicher
* @param documentText der Inhalt des ZIP's als Base64 encodeter String
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result bei Erfolg die Anzahl der Dokumente im ZIP File, ansonsten der Fehler
*/
protected JSONObject extractZIPToInternalStorage(String documentText) throws VerteilungException {
return services.extractZIPToInternalStorage(documentText);
}
/**
* extrahiert ein ZIP File und gibt den Inhalt als Base64 encodete Strings zurück
* @param zipContent der Inhalt des ZIP Files
* @return ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result der Inhalt der ZIP Datei als JSON Aray mit Base64 encodeten STrings
*/
protected JSONObject extractZIP(String zipContent) {
return services.extractZIP(zipContent);
}
/**
* entpackt ein ZIP File und stellt die Inhalte und die extrahierten PDF Inhalte in den internen Speicher
* @param zipContent der Inhalt der ZIP Datei als Base64 encodeter String
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result bei Erfolg die Anzahl der Dokumente im ZIP File, ansonsten der Fehler
*/
protected JSONObject extractZIPAndExtractPDFToInternalStorage(String zipContent) {
return services.extractZIPAndExtractPDFToInternalStorage(zipContent);
}
/**
* liefert den kompletten Inhalt aus dem internen Speicher
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result bei Erfolg ein JSONObjekt mit den Binärdaten (Base64 encoded) und er Inhalt als Text, ansonsten der Fehler
*/
protected JSONObject getDataFromInternalStorage() {
return services.getDataFromInternalStorage();
}
/**
* liefert den Inhalt aus dem internen Speicher
* @param fileName der Name der zu suchenden Datei
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result bei Erfolg ein JSONObjekt mit den Binärdaten (Base64 encoded) und er Inhalt als Text, ansonsten der Fehler
*/
protected JSONObject getDataFromInternalStorage(String fileName) {
return services.getDataFromInternalStorage(fileName);
}
/**
* löscht den internen Speicher
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result bei Erfolg nichts, ansonsten der Fehler
*/
protected JSONObject clearInternalStorage() {
return services.clearInternalStorage();
}
/**
* TODO macht diese Methode im Servlert Kontext Sinn?
* öffnet eine Datei
* @param fileName der Name der zu öffnenden Datei
* @return obj ein JSONObject mit den Feldern success: true die Operation war erfolgreich
* false ein Fehler ist aufgetreten
* result bei Erfolg der Inhalt der Datei als String, ansonsten der Fehler
*/
protected JSONObject openFile(String fileName) throws VerteilungException {
return services.openFile(getServletContext().getRealPath(fileName).replace("\\", "/"));
}
/**
* öffnet ein Image auf dem Alfrsco Server
* @param link der link zu dem Image
* @param resp der Response zum Öffnen
*/
protected void openImage(String link,
HttpServletResponse resp) {
ServletOutputStream sout = null;
String server = services.getServer();
if (!server.endsWith("/"))
server = server + "/";
try {
String ticket = services.getTicket().getJSONObject("data").getJSONObject("data").getString("ticket");
URL url = new URL(server + link + "&alf_ticket=" + ticket);
InputStream is = url.openStream();
byte[] b = new byte[2048];
int length;
resp.reset();
resp.resetBuffer();
resp.setContentType("image/jpeg");
sout = resp.getOutputStream();
while ((length = is.read(b)) != -1) {
sout.write(b, 0, length);
}
is.close();
sout.flush();
sout.close();
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
} finally {
try {
if (sout != null)
sout.close();
} catch (IOException io) {
logger.error(io.getLocalizedMessage());
io.printStackTrace();
}
}
}
/**
* öffnet ein PDF im Browser
* @param fileName der Filename des PDF Dokumentes
* @param resp der Response zum Öffnen des PDFs
*/
protected void openPDF(String fileName,
HttpServletResponse resp) {
ServletOutputStream sout = null;
try {
for (FileEntry entry : services.getEntries()) {
if (entry.getName().equalsIgnoreCase(fileName)) {
final byte[] bytes = entry.getData();
final String name = entry.getName();
resp.reset();
resp.resetBuffer();
resp.setContentType("application/pdf");
resp.setHeader("Content-Disposition", "inline; filename=" + name + "\"");
resp.setHeader("Cache-Control", "max-age=0");
resp.setContentLength(bytes.length);
sout = resp.getOutputStream();
sout.write(bytes, 0, bytes.length);
sout.flush();
sout.close();
break;
}
}
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
} finally {
try {
if (sout != null)
sout.close();
} catch (IOException io) {
logger.error(io.getLocalizedMessage());
io.printStackTrace();
}
}
}
}
| 50,169
| 0.57588
| 0.574962
| 924
| 53.255413
| 45.498104
| 360
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.672078
| false
| false
|
13
|
7a9c7109290ff7797966213c52a62ccb6bdac16e
| 3,530,463,173,513
|
7b6f7888b65e2febcc51e627796a611ccfb3acae
|
/src/main/java/zyake/libs/sumo/expressions/Expressions.java
|
88d37971904518eba47bf8c7729be620674377a3
|
[] |
no_license
|
zyake/sumo
|
https://github.com/zyake/sumo
|
6932df6c4160717d2eb48ceb0964a2facfb43a48
|
2639bd59555d5fccec690fe225eb875084c7e65a
|
refs/heads/master
| 2020-04-16T02:57:10.611000
| 2015-05-23T09:03:59
| 2015-05-23T09:03:59
| 26,356,799
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package zyake.libs.sumo.expressions;
import zyake.libs.sumo.QueryExpression;
import zyake.libs.sumo.SQL;
import zyake.libs.sumo.SQLRuntimeException;
import zyake.libs.sumo.SUMOException;
import zyake.libs.sumo.unsafe.DisastrousResourceManager;
import zyake.libs.sumo.util.Args;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.concurrent.atomic.AtomicReference;
/**
* An object that generates SQL expressions.
*/
public final class Expressions {
private final static Method getNewConnection;
private final static AtomicReference<ExpressionParser> parserRef = new AtomicReference<>(new NamedExpressionParser());
static {
try {
getNewConnection = DisastrousResourceManager.class.getDeclaredMethod("getNewConnectionYouMustntCallItDirectly");
getNewConnection.setAccessible(true);
} catch (NoSuchMethodException e) {
throw new SUMOException(e);
}
}
private Expressions() {
}
public static void setParserRef(ExpressionParser parser) {
Args.check(parser);
parserRef.set(parser);
}
public static QueryExpression query(String exp, SQL.RowMapper mapper) {
Args.check(exp);
Args.check(mapper);
return parserRef.get().parse(exp, mapper);
}
public static QueryExpression update(String exp) {
Args.check(exp);
return parserRef.get().parse(exp, null);
}
public static QueryExpression updateOne(String tableName) throws SQLRuntimeException {
Args.check(tableName);
try ( Connection connection = getNewConnection() ) {
return new DynamicExpressionBuilder(connection, parserRef.get()).buildUpdateOne(tableName);
} catch (SQLException e) {
throw new SQLRuntimeException(e);
}
}
public static QueryExpression updateWith(String tableName, String whereClause) throws SQLRuntimeException {
Args.check(tableName);
Args.check(whereClause);
try ( Connection connection = getNewConnection() ) {
return new DynamicExpressionBuilder(connection, parserRef.get()).buildUpdate(tableName, whereClause);
} catch (SQLException e) {
throw new SQLRuntimeException(e);
}
}
public static QueryExpression insertOne(String tableName) throws SQLRuntimeException {
Args.check(tableName);
try ( Connection connection = getNewConnection() ) {
return new DynamicExpressionBuilder(connection, parserRef.get()).buildInsertOne(tableName);
} catch (SQLException e) {
throw new SQLRuntimeException(e);
}
}
public static QueryExpression insertWithoutPK(String tableName) throws SQLRuntimeException {
Args.check(tableName);
try ( Connection connection = getNewConnection() ) {
return new DynamicExpressionBuilder(connection, parserRef.get()).buildInsertWithoutPK(tableName);
} catch (SQLException e) {
throw new SQLRuntimeException(e);
}
}
public static QueryExpression selectOne(String tableName, SQL.RowMapper mapper)
throws SQLRuntimeException {
Args.check(tableName);
Args.check(mapper);
try ( Connection connection = getNewConnection() ) {
return new DynamicExpressionBuilder(connection, parserRef.get()).buildSelectOne(tableName, mapper);
} catch (SQLException e) {
throw new SQLRuntimeException(e);
}
}
public static QueryExpression selectWith(String tableName, String whereClause, SQL.RowMapper mapper)
throws SQLRuntimeException {
Args.check(tableName);
Args.check(whereClause);
Args.check(mapper);
try ( Connection connection = getNewConnection() ) {
return new DynamicExpressionBuilder(connection, parserRef.get()).buildSelect(tableName, whereClause, mapper);
} catch (SQLException e) {
throw new SQLRuntimeException(e);
}
}
public static QueryExpression deleteOne(String tableName)
throws SQLRuntimeException {
Args.check(tableName);
try ( Connection connection = getNewConnection() ) {
return new DynamicExpressionBuilder(connection, parserRef.get()).buildDeleteOne(tableName);
} catch (SQLException e) {
throw new SQLRuntimeException(e);
}
}
public static QueryExpression deleteWith(String tableName, String whereClause)
throws SQLRuntimeException {
Args.check(tableName);
Args.check(whereClause);
try ( Connection connection = getNewConnection() ) {
return new DynamicExpressionBuilder(connection, parserRef.get()).buildDelete(tableName, whereClause);
} catch (SQLException e) {
throw new SQLRuntimeException(e);
}
}
public static String limit() {
return " LIMIT {__LIMIT__}";
}
public static String limitAndOffset() {
return " LIMIT {__LIMIT__}, OFFSET {__OFFSET__}";
}
private static Connection getNewConnection() {
try {
return (Connection) getNewConnection.invoke(null, null);
} catch (IllegalAccessException | InvocationTargetException e) {
throw new SUMOException(e);
}
}
}
|
UTF-8
|
Java
| 5,429
|
java
|
Expressions.java
|
Java
|
[] | null |
[] |
package zyake.libs.sumo.expressions;
import zyake.libs.sumo.QueryExpression;
import zyake.libs.sumo.SQL;
import zyake.libs.sumo.SQLRuntimeException;
import zyake.libs.sumo.SUMOException;
import zyake.libs.sumo.unsafe.DisastrousResourceManager;
import zyake.libs.sumo.util.Args;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.concurrent.atomic.AtomicReference;
/**
* An object that generates SQL expressions.
*/
public final class Expressions {
private final static Method getNewConnection;
private final static AtomicReference<ExpressionParser> parserRef = new AtomicReference<>(new NamedExpressionParser());
static {
try {
getNewConnection = DisastrousResourceManager.class.getDeclaredMethod("getNewConnectionYouMustntCallItDirectly");
getNewConnection.setAccessible(true);
} catch (NoSuchMethodException e) {
throw new SUMOException(e);
}
}
private Expressions() {
}
public static void setParserRef(ExpressionParser parser) {
Args.check(parser);
parserRef.set(parser);
}
public static QueryExpression query(String exp, SQL.RowMapper mapper) {
Args.check(exp);
Args.check(mapper);
return parserRef.get().parse(exp, mapper);
}
public static QueryExpression update(String exp) {
Args.check(exp);
return parserRef.get().parse(exp, null);
}
public static QueryExpression updateOne(String tableName) throws SQLRuntimeException {
Args.check(tableName);
try ( Connection connection = getNewConnection() ) {
return new DynamicExpressionBuilder(connection, parserRef.get()).buildUpdateOne(tableName);
} catch (SQLException e) {
throw new SQLRuntimeException(e);
}
}
public static QueryExpression updateWith(String tableName, String whereClause) throws SQLRuntimeException {
Args.check(tableName);
Args.check(whereClause);
try ( Connection connection = getNewConnection() ) {
return new DynamicExpressionBuilder(connection, parserRef.get()).buildUpdate(tableName, whereClause);
} catch (SQLException e) {
throw new SQLRuntimeException(e);
}
}
public static QueryExpression insertOne(String tableName) throws SQLRuntimeException {
Args.check(tableName);
try ( Connection connection = getNewConnection() ) {
return new DynamicExpressionBuilder(connection, parserRef.get()).buildInsertOne(tableName);
} catch (SQLException e) {
throw new SQLRuntimeException(e);
}
}
public static QueryExpression insertWithoutPK(String tableName) throws SQLRuntimeException {
Args.check(tableName);
try ( Connection connection = getNewConnection() ) {
return new DynamicExpressionBuilder(connection, parserRef.get()).buildInsertWithoutPK(tableName);
} catch (SQLException e) {
throw new SQLRuntimeException(e);
}
}
public static QueryExpression selectOne(String tableName, SQL.RowMapper mapper)
throws SQLRuntimeException {
Args.check(tableName);
Args.check(mapper);
try ( Connection connection = getNewConnection() ) {
return new DynamicExpressionBuilder(connection, parserRef.get()).buildSelectOne(tableName, mapper);
} catch (SQLException e) {
throw new SQLRuntimeException(e);
}
}
public static QueryExpression selectWith(String tableName, String whereClause, SQL.RowMapper mapper)
throws SQLRuntimeException {
Args.check(tableName);
Args.check(whereClause);
Args.check(mapper);
try ( Connection connection = getNewConnection() ) {
return new DynamicExpressionBuilder(connection, parserRef.get()).buildSelect(tableName, whereClause, mapper);
} catch (SQLException e) {
throw new SQLRuntimeException(e);
}
}
public static QueryExpression deleteOne(String tableName)
throws SQLRuntimeException {
Args.check(tableName);
try ( Connection connection = getNewConnection() ) {
return new DynamicExpressionBuilder(connection, parserRef.get()).buildDeleteOne(tableName);
} catch (SQLException e) {
throw new SQLRuntimeException(e);
}
}
public static QueryExpression deleteWith(String tableName, String whereClause)
throws SQLRuntimeException {
Args.check(tableName);
Args.check(whereClause);
try ( Connection connection = getNewConnection() ) {
return new DynamicExpressionBuilder(connection, parserRef.get()).buildDelete(tableName, whereClause);
} catch (SQLException e) {
throw new SQLRuntimeException(e);
}
}
public static String limit() {
return " LIMIT {__LIMIT__}";
}
public static String limitAndOffset() {
return " LIMIT {__LIMIT__}, OFFSET {__OFFSET__}";
}
private static Connection getNewConnection() {
try {
return (Connection) getNewConnection.invoke(null, null);
} catch (IllegalAccessException | InvocationTargetException e) {
throw new SUMOException(e);
}
}
}
| 5,429
| 0.67121
| 0.67121
| 149
| 35.436241
| 31.946331
| 124
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.543624
| false
| false
|
13
|
5a85938cb104bfd4d5eb791ca35b7f7f418cceb2
| 13,812,614,883,967
|
04bc6e0b87d69c72d65765748fffee1a45507d42
|
/Tech-Matrix.6453/NextPreviousFinal/src/FinaloGUIOSM.java
|
0ad372ea53a7c64796523dd56428a6569dd0f3ff
|
[] |
no_license
|
brhnsaify/On-Screen-Marking-System-SIH-2017-
|
https://github.com/brhnsaify/On-Screen-Marking-System-SIH-2017-
|
9bc3a0e0bf4febd24a2d3b0c6b995a71a6b8fe2c
|
ca33a7c11b819783bf5e5bc98ada1a9e2d903286
|
refs/heads/master
| 2020-03-24T18:47:17.807000
| 2018-07-30T16:17:22
| 2018-07-30T16:17:22
| 142,899,330
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package final_gui;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
/**
*
* @author USER
*/
public class FinaloGUIOSM extends javax.swing.JFrame {
/**
* Creates new form FinaloGUIOSM
*/
public FinaloGUIOSM() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
Mainpanel_for_SubTotal = new javax.swing.JPanel();
label_For_SubTotal = new javax.swing.JLabel();
TextFied_For_Obtained_Marks = new javax.swing.JTextField();
Button_For_Submt = new javax.swing.JButton();
panel_For_Sample_Answer = new javax.swing.JPanel();
Drop_Down = new javax.swing.JComboBox<>();
label_Heading_Sample_Answer = new javax.swing.JLabel();
Label_For_Sample_Answer = new javax.swing.JLabel();
Main_Panel_For_Buttons_SC = new javax.swing.JPanel();
First_Button_SC = new javax.swing.JButton();
Previous_Button_SC = new javax.swing.JButton();
Next_Button_SC = new javax.swing.JButton();
Last_Button_SC = new javax.swing.JButton();
Main_Panel_For_Buttons_SA = new javax.swing.JPanel();
First_Botton_SA = new javax.swing.JButton();
previous_Button_SA = new javax.swing.JButton();
next_Button_SA = new javax.swing.JButton();
last_Button_SA = new javax.swing.JButton();
panel_For_StuCopy_Button = new javax.swing.JPanel();
next_Copy_Button = new javax.swing.JButton();
label_For_Heading_Obtained_Marks = new javax.swing.JLabel();
jScrollPane3 = new javax.swing.JScrollPane();
Sroll_panel_For_Obt_Marks = new javax.swing.JPanel();
label_Stu_Ans_Heading = new javax.swing.JLabel();
Label_for_Student_copy = new javax.swing.JLabel();
tnc_LabelHeading = new javax.swing.JLabel();
txt_total = new javax.swing.JTextField();
NOC_label = new javax.swing.JLabel();
txt_checked = new javax.swing.JTextField();
Noc_remaining_Label = new javax.swing.JLabel();
txt_left = new javax.swing.JTextField();
dd_copyno = new javax.swing.JComboBox<>();
Noc_remaining_Label1 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
Mainpanel_for_SubTotal.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
Mainpanel_for_SubTotal.setName("Panel_for_overall_Subtotal"); // NOI18N
label_For_SubTotal.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
label_For_SubTotal.setText("Sub Total : ");
label_For_SubTotal.setName("label_contaning_heading_\"Sub_total\""); // NOI18N
TextFied_For_Obtained_Marks.setEditable(false);
TextFied_For_Obtained_Marks.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
TextFied_For_Obtained_Marks.setName("non_editable_Text_Field_For_Obtained_marks"); // NOI18N
Button_For_Submt.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
Button_For_Submt.setText("SUBMIT");
Button_For_Submt.setName("Submit_button"); // NOI18N
javax.swing.GroupLayout Mainpanel_for_SubTotalLayout = new javax.swing.GroupLayout(Mainpanel_for_SubTotal);
Mainpanel_for_SubTotal.setLayout(Mainpanel_for_SubTotalLayout);
Mainpanel_for_SubTotalLayout.setHorizontalGroup(
Mainpanel_for_SubTotalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(Mainpanel_for_SubTotalLayout.createSequentialGroup()
.addContainerGap()
.addComponent(label_For_SubTotal)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(TextFied_For_Obtained_Marks, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(90, 90, 90)
.addComponent(Button_For_Submt)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
Mainpanel_for_SubTotalLayout.setVerticalGroup(
Mainpanel_for_SubTotalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, Mainpanel_for_SubTotalLayout.createSequentialGroup()
.addContainerGap()
.addGroup(Mainpanel_for_SubTotalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(label_For_SubTotal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(Mainpanel_for_SubTotalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(TextFied_For_Obtained_Marks, javax.swing.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE)
.addComponent(Button_For_Submt)))
.addContainerGap())
);
panel_For_Sample_Answer.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
panel_For_Sample_Answer.setName("Main_panel_for_sample_answer"); // NOI18N
Drop_Down.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28" }));
Drop_Down.setName("Drop_down"); // NOI18N
label_Heading_Sample_Answer.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
label_Heading_Sample_Answer.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
label_Heading_Sample_Answer.setText("SAMPLE ANSWER");
label_Heading_Sample_Answer.setName("Label_For_heading_SampleAnswer"); // NOI18N
Label_For_Sample_Answer.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
javax.swing.GroupLayout panel_For_Sample_AnswerLayout = new javax.swing.GroupLayout(panel_For_Sample_Answer);
panel_For_Sample_Answer.setLayout(panel_For_Sample_AnswerLayout);
panel_For_Sample_AnswerLayout.setHorizontalGroup(
panel_For_Sample_AnswerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panel_For_Sample_AnswerLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panel_For_Sample_AnswerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Label_For_Sample_Answer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(panel_For_Sample_AnswerLayout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(Drop_Down, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(label_Heading_Sample_Answer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
panel_For_Sample_AnswerLayout.setVerticalGroup(
panel_For_Sample_AnswerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panel_For_Sample_AnswerLayout.createSequentialGroup()
.addComponent(label_Heading_Sample_Answer, javax.swing.GroupLayout.DEFAULT_SIZE, 35, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(Drop_Down, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(Label_For_Sample_Answer, javax.swing.GroupLayout.PREFERRED_SIZE, 273, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
Main_Panel_For_Buttons_SC.setName("panel containing buttons for student copy"); // NOI18N
First_Button_SC.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
First_Button_SC.setText("First");
First_Button_SC.setName("First button"); // NOI18N
Previous_Button_SC.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
Previous_Button_SC.setText("Previous");
Next_Button_SC.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
Next_Button_SC.setText("Next");
Next_Button_SC.setName("Next Button"); // NOI18N
Last_Button_SC.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
Last_Button_SC.setText("Last");
Last_Button_SC.setName("Last button"); // NOI18N
javax.swing.GroupLayout Main_Panel_For_Buttons_SCLayout = new javax.swing.GroupLayout(Main_Panel_For_Buttons_SC);
Main_Panel_For_Buttons_SC.setLayout(Main_Panel_For_Buttons_SCLayout);
Main_Panel_For_Buttons_SCLayout.setHorizontalGroup(
Main_Panel_For_Buttons_SCLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(Main_Panel_For_Buttons_SCLayout.createSequentialGroup()
.addContainerGap()
.addComponent(First_Button_SC, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(29, 29, 29)
.addComponent(Previous_Button_SC, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(32, 32, 32)
.addComponent(Next_Button_SC, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(47, 47, 47)
.addComponent(Last_Button_SC, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
Main_Panel_For_Buttons_SCLayout.setVerticalGroup(
Main_Panel_For_Buttons_SCLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(Main_Panel_For_Buttons_SCLayout.createSequentialGroup()
.addContainerGap()
.addGroup(Main_Panel_For_Buttons_SCLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Last_Button_SC, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Next_Button_SC, javax.swing.GroupLayout.DEFAULT_SIZE, 74, Short.MAX_VALUE)
.addComponent(First_Button_SC, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Previous_Button_SC, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
Main_Panel_For_Buttons_SA.setName("Panel_for_Buttons_For_Sample_Answer"); // NOI18N
First_Botton_SA.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
First_Botton_SA.setText("First");
First_Botton_SA.setName("First_button"); // NOI18N
previous_Button_SA.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
previous_Button_SA.setText("Previous");
previous_Button_SA.setName("Previous_button"); // NOI18N
next_Button_SA.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
next_Button_SA.setText("Next");
next_Button_SA.setName("Next_button"); // NOI18N
last_Button_SA.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
last_Button_SA.setText("Last");
last_Button_SA.setName("Last_button"); // NOI18N
javax.swing.GroupLayout Main_Panel_For_Buttons_SALayout = new javax.swing.GroupLayout(Main_Panel_For_Buttons_SA);
Main_Panel_For_Buttons_SA.setLayout(Main_Panel_For_Buttons_SALayout);
Main_Panel_For_Buttons_SALayout.setHorizontalGroup(
Main_Panel_For_Buttons_SALayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, Main_Panel_For_Buttons_SALayout.createSequentialGroup()
.addGap(0, 24, Short.MAX_VALUE)
.addComponent(First_Botton_SA, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(previous_Button_SA, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(next_Button_SA, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(last_Button_SA, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE))
);
Main_Panel_For_Buttons_SALayout.setVerticalGroup(
Main_Panel_For_Buttons_SALayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(Main_Panel_For_Buttons_SALayout.createSequentialGroup()
.addContainerGap()
.addGroup(Main_Panel_For_Buttons_SALayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE, false)
.addComponent(last_Button_SA, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(next_Button_SA, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(previous_Button_SA, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(First_Botton_SA, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
panel_For_StuCopy_Button.setName("Button For Submit and Next Copy"); // NOI18N
next_Copy_Button.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
next_Copy_Button.setText("NEXT COPY");
next_Copy_Button.setName("Next Copy Button"); // NOI18N
javax.swing.GroupLayout panel_For_StuCopy_ButtonLayout = new javax.swing.GroupLayout(panel_For_StuCopy_Button);
panel_For_StuCopy_Button.setLayout(panel_For_StuCopy_ButtonLayout);
panel_For_StuCopy_ButtonLayout.setHorizontalGroup(
panel_For_StuCopy_ButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panel_For_StuCopy_ButtonLayout.createSequentialGroup()
.addGap(52, 52, 52)
.addComponent(next_Copy_Button, javax.swing.GroupLayout.PREFERRED_SIZE, 346, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(53, Short.MAX_VALUE))
);
panel_For_StuCopy_ButtonLayout.setVerticalGroup(
panel_For_StuCopy_ButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panel_For_StuCopy_ButtonLayout.createSequentialGroup()
.addContainerGap()
.addComponent(next_Copy_Button, javax.swing.GroupLayout.DEFAULT_SIZE, 74, Short.MAX_VALUE)
.addContainerGap())
);
label_For_Heading_Obtained_Marks.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
label_For_Heading_Obtained_Marks.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
label_For_Heading_Obtained_Marks.setText("OBTAINED MARKS");
label_For_Heading_Obtained_Marks.setName("label_for_heading_obtained_marks"); // NOI18N
jScrollPane3.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
Sroll_panel_For_Obt_Marks.setName("scroll_panel_for_obtained_marks"); // NOI18N
javax.swing.GroupLayout Sroll_panel_For_Obt_MarksLayout = new javax.swing.GroupLayout(Sroll_panel_For_Obt_Marks);
Sroll_panel_For_Obt_Marks.setLayout(Sroll_panel_For_Obt_MarksLayout);
Sroll_panel_For_Obt_MarksLayout.setHorizontalGroup(
Sroll_panel_For_Obt_MarksLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
Sroll_panel_For_Obt_MarksLayout.setVerticalGroup(
Sroll_panel_For_Obt_MarksLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 587, Short.MAX_VALUE)
);
jScrollPane3.setViewportView(Sroll_panel_For_Obt_Marks);
label_Stu_Ans_Heading.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
label_Stu_Ans_Heading.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
label_Stu_Ans_Heading.setText("STUDENT ANSWER SHEET");
label_Stu_Ans_Heading.setName("label_for_heading_\"Stydent_answer_Sheet\""); // NOI18N
Label_for_Student_copy.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
tnc_LabelHeading.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
tnc_LabelHeading.setText("Total Number of Copy:");
txt_total.setEditable(false);
txt_total.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
NOC_label.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
NOC_label.setText("Number of Copy Checked:");
txt_checked.setEditable(false);
txt_checked.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
Noc_remaining_Label.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
Noc_remaining_Label.setText("Number of copy Remaining:");
txt_left.setEditable(false);
dd_copyno.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
Noc_remaining_Label1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
Noc_remaining_Label1.setText("Copy No.");
jButton1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jButton1.setText("LOAD");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGap(26, 26, 26)
.addComponent(Main_Panel_For_Buttons_SC, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(Main_Panel_For_Buttons_SA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(panel_For_StuCopy_Button, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(label_Stu_Ans_Heading, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Label_for_Student_copy, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(tnc_LabelHeading, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(txt_total, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(45, 45, 45)
.addComponent(NOC_label)
.addGap(18, 18, 18)
.addComponent(txt_checked, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(44, 44, 44)
.addComponent(Noc_remaining_Label, javax.swing.GroupLayout.PREFERRED_SIZE, 241, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txt_left, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(173, 173, 173)
.addComponent(Noc_remaining_Label1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(dd_copyno, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jButton1))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(62, 62, 62)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Mainpanel_for_SubTotal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane3)))
.addGroup(layout.createSequentialGroup()
.addGap(63, 63, 63)
.addComponent(panel_For_Sample_Answer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(label_For_Heading_Obtained_Marks, javax.swing.GroupLayout.PREFERRED_SIZE, 540, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(label_For_Heading_Obtained_Marks, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 317, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(Mainpanel_for_SubTotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(28, 28, 28)
.addComponent(panel_For_Sample_Answer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(tnc_LabelHeading, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txt_total, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(NOC_label, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txt_checked, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Noc_remaining_Label, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(dd_copyno, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txt_left, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Noc_remaining_Label1, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(label_Stu_Ans_Heading, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(Label_for_Student_copy, javax.swing.GroupLayout.PREFERRED_SIZE, 647, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Main_Panel_For_Buttons_SA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Main_Panel_For_Buttons_SC, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addGap(114, 114, 114)
.addComponent(panel_For_StuCopy_Button, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(286, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
//LOAD BUTTON EVENT
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","root");
Statement stmt1=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
}
}//GEN-LAST:event_jButton1ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FinaloGUIOSM.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FinaloGUIOSM.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FinaloGUIOSM.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FinaloGUIOSM.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FinaloGUIOSM().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton Button_For_Submt;
private javax.swing.JComboBox<String> Drop_Down;
private javax.swing.JButton First_Botton_SA;
private javax.swing.JButton First_Button_SC;
private javax.swing.JLabel Label_For_Sample_Answer;
private javax.swing.JLabel Label_for_Student_copy;
private javax.swing.JButton Last_Button_SC;
private javax.swing.JPanel Main_Panel_For_Buttons_SA;
private javax.swing.JPanel Main_Panel_For_Buttons_SC;
private javax.swing.JPanel Mainpanel_for_SubTotal;
private javax.swing.JLabel NOC_label;
private javax.swing.JButton Next_Button_SC;
private javax.swing.JLabel Noc_remaining_Label;
private javax.swing.JLabel Noc_remaining_Label1;
private javax.swing.JButton Previous_Button_SC;
private javax.swing.JPanel Sroll_panel_For_Obt_Marks;
private javax.swing.JTextField TextFied_For_Obtained_Marks;
private javax.swing.JComboBox<String> dd_copyno;
private javax.swing.JButton jButton1;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JLabel label_For_Heading_Obtained_Marks;
private javax.swing.JLabel label_For_SubTotal;
private javax.swing.JLabel label_Heading_Sample_Answer;
private javax.swing.JLabel label_Stu_Ans_Heading;
private javax.swing.JButton last_Button_SA;
private javax.swing.JButton next_Button_SA;
private javax.swing.JButton next_Copy_Button;
private javax.swing.JPanel panel_For_Sample_Answer;
private javax.swing.JPanel panel_For_StuCopy_Button;
private javax.swing.JButton previous_Button_SA;
private javax.swing.JLabel tnc_LabelHeading;
private javax.swing.JTextField txt_checked;
private javax.swing.JTextField txt_left;
private javax.swing.JTextField txt_total;
// End of variables declaration//GEN-END:variables
}
|
UTF-8
|
Java
| 32,781
|
java
|
FinaloGUIOSM.java
|
Java
|
[
{
"context": "Set;\nimport java.sql.Statement;\n\n/**\n *\n * @author USER\n */\npublic class FinaloGUIOSM extends javax.swing",
"end": 341,
"score": 0.9913662075996399,
"start": 337,
"tag": "USERNAME",
"value": "USER"
}
] | 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 final_gui;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
/**
*
* @author USER
*/
public class FinaloGUIOSM extends javax.swing.JFrame {
/**
* Creates new form FinaloGUIOSM
*/
public FinaloGUIOSM() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
Mainpanel_for_SubTotal = new javax.swing.JPanel();
label_For_SubTotal = new javax.swing.JLabel();
TextFied_For_Obtained_Marks = new javax.swing.JTextField();
Button_For_Submt = new javax.swing.JButton();
panel_For_Sample_Answer = new javax.swing.JPanel();
Drop_Down = new javax.swing.JComboBox<>();
label_Heading_Sample_Answer = new javax.swing.JLabel();
Label_For_Sample_Answer = new javax.swing.JLabel();
Main_Panel_For_Buttons_SC = new javax.swing.JPanel();
First_Button_SC = new javax.swing.JButton();
Previous_Button_SC = new javax.swing.JButton();
Next_Button_SC = new javax.swing.JButton();
Last_Button_SC = new javax.swing.JButton();
Main_Panel_For_Buttons_SA = new javax.swing.JPanel();
First_Botton_SA = new javax.swing.JButton();
previous_Button_SA = new javax.swing.JButton();
next_Button_SA = new javax.swing.JButton();
last_Button_SA = new javax.swing.JButton();
panel_For_StuCopy_Button = new javax.swing.JPanel();
next_Copy_Button = new javax.swing.JButton();
label_For_Heading_Obtained_Marks = new javax.swing.JLabel();
jScrollPane3 = new javax.swing.JScrollPane();
Sroll_panel_For_Obt_Marks = new javax.swing.JPanel();
label_Stu_Ans_Heading = new javax.swing.JLabel();
Label_for_Student_copy = new javax.swing.JLabel();
tnc_LabelHeading = new javax.swing.JLabel();
txt_total = new javax.swing.JTextField();
NOC_label = new javax.swing.JLabel();
txt_checked = new javax.swing.JTextField();
Noc_remaining_Label = new javax.swing.JLabel();
txt_left = new javax.swing.JTextField();
dd_copyno = new javax.swing.JComboBox<>();
Noc_remaining_Label1 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
Mainpanel_for_SubTotal.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
Mainpanel_for_SubTotal.setName("Panel_for_overall_Subtotal"); // NOI18N
label_For_SubTotal.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
label_For_SubTotal.setText("Sub Total : ");
label_For_SubTotal.setName("label_contaning_heading_\"Sub_total\""); // NOI18N
TextFied_For_Obtained_Marks.setEditable(false);
TextFied_For_Obtained_Marks.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
TextFied_For_Obtained_Marks.setName("non_editable_Text_Field_For_Obtained_marks"); // NOI18N
Button_For_Submt.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
Button_For_Submt.setText("SUBMIT");
Button_For_Submt.setName("Submit_button"); // NOI18N
javax.swing.GroupLayout Mainpanel_for_SubTotalLayout = new javax.swing.GroupLayout(Mainpanel_for_SubTotal);
Mainpanel_for_SubTotal.setLayout(Mainpanel_for_SubTotalLayout);
Mainpanel_for_SubTotalLayout.setHorizontalGroup(
Mainpanel_for_SubTotalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(Mainpanel_for_SubTotalLayout.createSequentialGroup()
.addContainerGap()
.addComponent(label_For_SubTotal)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(TextFied_For_Obtained_Marks, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(90, 90, 90)
.addComponent(Button_For_Submt)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
Mainpanel_for_SubTotalLayout.setVerticalGroup(
Mainpanel_for_SubTotalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, Mainpanel_for_SubTotalLayout.createSequentialGroup()
.addContainerGap()
.addGroup(Mainpanel_for_SubTotalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(label_For_SubTotal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(Mainpanel_for_SubTotalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(TextFied_For_Obtained_Marks, javax.swing.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE)
.addComponent(Button_For_Submt)))
.addContainerGap())
);
panel_For_Sample_Answer.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
panel_For_Sample_Answer.setName("Main_panel_for_sample_answer"); // NOI18N
Drop_Down.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28" }));
Drop_Down.setName("Drop_down"); // NOI18N
label_Heading_Sample_Answer.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
label_Heading_Sample_Answer.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
label_Heading_Sample_Answer.setText("SAMPLE ANSWER");
label_Heading_Sample_Answer.setName("Label_For_heading_SampleAnswer"); // NOI18N
Label_For_Sample_Answer.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
javax.swing.GroupLayout panel_For_Sample_AnswerLayout = new javax.swing.GroupLayout(panel_For_Sample_Answer);
panel_For_Sample_Answer.setLayout(panel_For_Sample_AnswerLayout);
panel_For_Sample_AnswerLayout.setHorizontalGroup(
panel_For_Sample_AnswerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panel_For_Sample_AnswerLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panel_For_Sample_AnswerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Label_For_Sample_Answer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(panel_For_Sample_AnswerLayout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(Drop_Down, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(label_Heading_Sample_Answer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
panel_For_Sample_AnswerLayout.setVerticalGroup(
panel_For_Sample_AnswerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panel_For_Sample_AnswerLayout.createSequentialGroup()
.addComponent(label_Heading_Sample_Answer, javax.swing.GroupLayout.DEFAULT_SIZE, 35, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(Drop_Down, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(Label_For_Sample_Answer, javax.swing.GroupLayout.PREFERRED_SIZE, 273, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
Main_Panel_For_Buttons_SC.setName("panel containing buttons for student copy"); // NOI18N
First_Button_SC.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
First_Button_SC.setText("First");
First_Button_SC.setName("First button"); // NOI18N
Previous_Button_SC.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
Previous_Button_SC.setText("Previous");
Next_Button_SC.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
Next_Button_SC.setText("Next");
Next_Button_SC.setName("Next Button"); // NOI18N
Last_Button_SC.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
Last_Button_SC.setText("Last");
Last_Button_SC.setName("Last button"); // NOI18N
javax.swing.GroupLayout Main_Panel_For_Buttons_SCLayout = new javax.swing.GroupLayout(Main_Panel_For_Buttons_SC);
Main_Panel_For_Buttons_SC.setLayout(Main_Panel_For_Buttons_SCLayout);
Main_Panel_For_Buttons_SCLayout.setHorizontalGroup(
Main_Panel_For_Buttons_SCLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(Main_Panel_For_Buttons_SCLayout.createSequentialGroup()
.addContainerGap()
.addComponent(First_Button_SC, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(29, 29, 29)
.addComponent(Previous_Button_SC, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(32, 32, 32)
.addComponent(Next_Button_SC, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(47, 47, 47)
.addComponent(Last_Button_SC, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
Main_Panel_For_Buttons_SCLayout.setVerticalGroup(
Main_Panel_For_Buttons_SCLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(Main_Panel_For_Buttons_SCLayout.createSequentialGroup()
.addContainerGap()
.addGroup(Main_Panel_For_Buttons_SCLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Last_Button_SC, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Next_Button_SC, javax.swing.GroupLayout.DEFAULT_SIZE, 74, Short.MAX_VALUE)
.addComponent(First_Button_SC, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Previous_Button_SC, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
Main_Panel_For_Buttons_SA.setName("Panel_for_Buttons_For_Sample_Answer"); // NOI18N
First_Botton_SA.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
First_Botton_SA.setText("First");
First_Botton_SA.setName("First_button"); // NOI18N
previous_Button_SA.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
previous_Button_SA.setText("Previous");
previous_Button_SA.setName("Previous_button"); // NOI18N
next_Button_SA.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
next_Button_SA.setText("Next");
next_Button_SA.setName("Next_button"); // NOI18N
last_Button_SA.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
last_Button_SA.setText("Last");
last_Button_SA.setName("Last_button"); // NOI18N
javax.swing.GroupLayout Main_Panel_For_Buttons_SALayout = new javax.swing.GroupLayout(Main_Panel_For_Buttons_SA);
Main_Panel_For_Buttons_SA.setLayout(Main_Panel_For_Buttons_SALayout);
Main_Panel_For_Buttons_SALayout.setHorizontalGroup(
Main_Panel_For_Buttons_SALayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, Main_Panel_For_Buttons_SALayout.createSequentialGroup()
.addGap(0, 24, Short.MAX_VALUE)
.addComponent(First_Botton_SA, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(previous_Button_SA, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(next_Button_SA, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(last_Button_SA, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE))
);
Main_Panel_For_Buttons_SALayout.setVerticalGroup(
Main_Panel_For_Buttons_SALayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(Main_Panel_For_Buttons_SALayout.createSequentialGroup()
.addContainerGap()
.addGroup(Main_Panel_For_Buttons_SALayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE, false)
.addComponent(last_Button_SA, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(next_Button_SA, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(previous_Button_SA, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(First_Botton_SA, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
panel_For_StuCopy_Button.setName("Button For Submit and Next Copy"); // NOI18N
next_Copy_Button.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
next_Copy_Button.setText("NEXT COPY");
next_Copy_Button.setName("Next Copy Button"); // NOI18N
javax.swing.GroupLayout panel_For_StuCopy_ButtonLayout = new javax.swing.GroupLayout(panel_For_StuCopy_Button);
panel_For_StuCopy_Button.setLayout(panel_For_StuCopy_ButtonLayout);
panel_For_StuCopy_ButtonLayout.setHorizontalGroup(
panel_For_StuCopy_ButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panel_For_StuCopy_ButtonLayout.createSequentialGroup()
.addGap(52, 52, 52)
.addComponent(next_Copy_Button, javax.swing.GroupLayout.PREFERRED_SIZE, 346, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(53, Short.MAX_VALUE))
);
panel_For_StuCopy_ButtonLayout.setVerticalGroup(
panel_For_StuCopy_ButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panel_For_StuCopy_ButtonLayout.createSequentialGroup()
.addContainerGap()
.addComponent(next_Copy_Button, javax.swing.GroupLayout.DEFAULT_SIZE, 74, Short.MAX_VALUE)
.addContainerGap())
);
label_For_Heading_Obtained_Marks.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
label_For_Heading_Obtained_Marks.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
label_For_Heading_Obtained_Marks.setText("OBTAINED MARKS");
label_For_Heading_Obtained_Marks.setName("label_for_heading_obtained_marks"); // NOI18N
jScrollPane3.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
Sroll_panel_For_Obt_Marks.setName("scroll_panel_for_obtained_marks"); // NOI18N
javax.swing.GroupLayout Sroll_panel_For_Obt_MarksLayout = new javax.swing.GroupLayout(Sroll_panel_For_Obt_Marks);
Sroll_panel_For_Obt_Marks.setLayout(Sroll_panel_For_Obt_MarksLayout);
Sroll_panel_For_Obt_MarksLayout.setHorizontalGroup(
Sroll_panel_For_Obt_MarksLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
Sroll_panel_For_Obt_MarksLayout.setVerticalGroup(
Sroll_panel_For_Obt_MarksLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 587, Short.MAX_VALUE)
);
jScrollPane3.setViewportView(Sroll_panel_For_Obt_Marks);
label_Stu_Ans_Heading.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
label_Stu_Ans_Heading.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
label_Stu_Ans_Heading.setText("STUDENT ANSWER SHEET");
label_Stu_Ans_Heading.setName("label_for_heading_\"Stydent_answer_Sheet\""); // NOI18N
Label_for_Student_copy.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
tnc_LabelHeading.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
tnc_LabelHeading.setText("Total Number of Copy:");
txt_total.setEditable(false);
txt_total.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
NOC_label.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
NOC_label.setText("Number of Copy Checked:");
txt_checked.setEditable(false);
txt_checked.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
Noc_remaining_Label.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
Noc_remaining_Label.setText("Number of copy Remaining:");
txt_left.setEditable(false);
dd_copyno.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
Noc_remaining_Label1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
Noc_remaining_Label1.setText("Copy No.");
jButton1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jButton1.setText("LOAD");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGap(26, 26, 26)
.addComponent(Main_Panel_For_Buttons_SC, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(Main_Panel_For_Buttons_SA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(panel_For_StuCopy_Button, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(label_Stu_Ans_Heading, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Label_for_Student_copy, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(tnc_LabelHeading, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(txt_total, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(45, 45, 45)
.addComponent(NOC_label)
.addGap(18, 18, 18)
.addComponent(txt_checked, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(44, 44, 44)
.addComponent(Noc_remaining_Label, javax.swing.GroupLayout.PREFERRED_SIZE, 241, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txt_left, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(173, 173, 173)
.addComponent(Noc_remaining_Label1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(dd_copyno, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jButton1))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(62, 62, 62)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Mainpanel_for_SubTotal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane3)))
.addGroup(layout.createSequentialGroup()
.addGap(63, 63, 63)
.addComponent(panel_For_Sample_Answer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(label_For_Heading_Obtained_Marks, javax.swing.GroupLayout.PREFERRED_SIZE, 540, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(label_For_Heading_Obtained_Marks, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 317, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(Mainpanel_for_SubTotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(28, 28, 28)
.addComponent(panel_For_Sample_Answer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(tnc_LabelHeading, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txt_total, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(NOC_label, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txt_checked, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Noc_remaining_Label, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(dd_copyno, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txt_left, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Noc_remaining_Label1, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(label_Stu_Ans_Heading, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(Label_for_Student_copy, javax.swing.GroupLayout.PREFERRED_SIZE, 647, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Main_Panel_For_Buttons_SA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Main_Panel_For_Buttons_SC, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addGap(114, 114, 114)
.addComponent(panel_For_StuCopy_Button, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(286, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
//LOAD BUTTON EVENT
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","root");
Statement stmt1=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
}
}//GEN-LAST:event_jButton1ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FinaloGUIOSM.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FinaloGUIOSM.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FinaloGUIOSM.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FinaloGUIOSM.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FinaloGUIOSM().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton Button_For_Submt;
private javax.swing.JComboBox<String> Drop_Down;
private javax.swing.JButton First_Botton_SA;
private javax.swing.JButton First_Button_SC;
private javax.swing.JLabel Label_For_Sample_Answer;
private javax.swing.JLabel Label_for_Student_copy;
private javax.swing.JButton Last_Button_SC;
private javax.swing.JPanel Main_Panel_For_Buttons_SA;
private javax.swing.JPanel Main_Panel_For_Buttons_SC;
private javax.swing.JPanel Mainpanel_for_SubTotal;
private javax.swing.JLabel NOC_label;
private javax.swing.JButton Next_Button_SC;
private javax.swing.JLabel Noc_remaining_Label;
private javax.swing.JLabel Noc_remaining_Label1;
private javax.swing.JButton Previous_Button_SC;
private javax.swing.JPanel Sroll_panel_For_Obt_Marks;
private javax.swing.JTextField TextFied_For_Obtained_Marks;
private javax.swing.JComboBox<String> dd_copyno;
private javax.swing.JButton jButton1;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JLabel label_For_Heading_Obtained_Marks;
private javax.swing.JLabel label_For_SubTotal;
private javax.swing.JLabel label_Heading_Sample_Answer;
private javax.swing.JLabel label_Stu_Ans_Heading;
private javax.swing.JButton last_Button_SA;
private javax.swing.JButton next_Button_SA;
private javax.swing.JButton next_Copy_Button;
private javax.swing.JPanel panel_For_Sample_Answer;
private javax.swing.JPanel panel_For_StuCopy_Button;
private javax.swing.JButton previous_Button_SA;
private javax.swing.JLabel tnc_LabelHeading;
private javax.swing.JTextField txt_checked;
private javax.swing.JTextField txt_left;
private javax.swing.JTextField txt_total;
// End of variables declaration//GEN-END:variables
}
| 32,781
| 0.657942
| 0.643208
| 502
| 64.300797
| 45.984875
| 243
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.063745
| false
| false
|
13
|
271e80e202653557b80650b37f991de7579f787b
| 8,177,617,757,492
|
8fdb442e76ae03bb824dda6c8b34fdcfed51b09b
|
/src/main/java/Spring/boot/Activity3/Controller/UserController.java
|
fede641920d0d445b05afec8d77d29160475a2d0
|
[] |
no_license
|
ngocngo12a/Spring
|
https://github.com/ngocngo12a/Spring
|
31211ee6bb6f53a3a8eec300c8a8e85301337494
|
4ab114b494790c42b47efe469961b8b27ccbc1c9
|
refs/heads/master
| 2023-01-31T19:15:22.246000
| 2020-12-16T10:05:53
| 2020-12-16T10:05:53
| 321,607,315
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package Spring.boot.Activity3.Controller;
import Spring.boot.Activity3.Object.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class UserController {
@GetMapping (value = "/user")
public User getUser(){
User user = new User();
user.setName("Ngoc");
user.setEmail("ngocngo12a@gmail.com");
return user;
}
}
|
UTF-8
|
Java
| 454
|
java
|
UserController.java
|
Java
|
[
{
"context": " User user = new User();\n user.setName(\"Ngoc\");\n user.setEmail(\"ngocngo12a@gmail.com\");",
"end": 373,
"score": 0.9107755422592163,
"start": 369,
"tag": "USERNAME",
"value": "Ngoc"
},
{
"context": " user.setName(\"Ngoc\");\n user.setEmail(\"ngocngo12a@gmail.com\");\n return user;\n }\n}\n",
"end": 420,
"score": 0.9999225735664368,
"start": 400,
"tag": "EMAIL",
"value": "ngocngo12a@gmail.com"
}
] | null |
[] |
package Spring.boot.Activity3.Controller;
import Spring.boot.Activity3.Object.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class UserController {
@GetMapping (value = "/user")
public User getUser(){
User user = new User();
user.setName("Ngoc");
user.setEmail("<EMAIL>");
return user;
}
}
| 441
| 0.709251
| 0.700441
| 16
| 27.375
| 19.032455
| 62
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.5
| false
| false
|
13
|
675779dec6ee9c90f7c8610617c4bb479e5daf41
| 26,826,365,790,451
|
a36a4ef8c722344476fead4f6d4b9a55557f3463
|
/Practical_exam_Aditi_Gupta_WFS5/dao/ProductDao.java
|
50c83d49c32df59dc80695e108ed8979fa2ccadc
|
[] |
no_license
|
Aditigupta0704/Test1
|
https://github.com/Aditigupta0704/Test1
|
96bd329bc8a0e307b7c2d14d1d67fa2ef471a2aa
|
bcd8e154df130c844c12319dc676a21e0daa4b3e
|
refs/heads/master
| 2022-12-21T05:18:21.753000
| 2020-09-24T12:29:33
| 2020-09-24T12:29:33
| 298,272,240
| 0
| 0
| null | true
| 2020-09-24T12:29:50
| 2020-09-24T12:29:49
| 2020-09-24T11:43:11
| 2020-09-24T12:29:30
| 0
| 0
| 0
| 0
| null | false
| false
|
package com.hsbc.dao;
/**
* Data Access Layer comprising of ProductDao class to access the data source.In our case we access the TreeSet
*/
import java.util.TreeSet;
import com.hsbc.models.Apparel;
import com.hsbc.models.Electronics;
import com.hsbc.models.FoodItems;
public class ProductDao implements ProductIntfDao {
TreeSet<FoodItems> foodSet = new TreeSet<>();
TreeSet<Apparel> apparel = new TreeSet<>();
TreeSet<Electronics> electronic = new TreeSet<>();
@Override
public void addFood(FoodItems food) {
// TODO Auto-generated method stub
foodSet.add(food);
}
@Override
public void deleteFood(FoodItems food) throws NoProductFoundException {
// TODO Auto-generated method stub
int k = 0;
for (FoodItems f : foodSet) {
if (f == food)
foodSet.remove(food);
}
if (k == 0)
throw new NoProductFoundException("No such Product Available");
}
@Override
public void showFood() {
// TODO Auto-generated method stub
for (int i = 0; i < 2; i++)
System.out.println(foodSet);
}
@Override
public void addApparel(Apparel apparel) {
// TODO Auto-generated method stub
apparel.add(apparel);
}
@Override
public void deleteApparel(Apparel apparel) {
// TODO Auto-generated method stub
int k = 0;
for (Apparel a : apparel) {
if (a == apparel)
foodSet.remove(a);
}
if (k == 0)
throw new NoProductFoundException("No such Product Available");
}
@Override
public void showApparel() {
// TODO Auto-generated method stub
for (int i = 0; i < 2; i++)
System.out.println(apparel);
}
@Override
public void addElectronic(Electronics electronic1) {
// TODO Auto-generated method stub
electronic.add(electronic1);
}
@Override
public void deleteElectronic(Electronics electronic1) {
// TODO Auto-generated method stub
int k = 0;
for (Electronics e : electronic) {
if (e == electronic1)
electronic.remove(e);
}
if (k == 0)
throw new NoProductFoundException("No such Product Available");
}
}
@Override
public void showElectronic() {
// TODO Auto-generated method stub
for (int i = 0; i < 2; i++)
System.out.println(electronic);
}
}
|
UTF-8
|
Java
| 2,139
|
java
|
ProductDao.java
|
Java
|
[] | null |
[] |
package com.hsbc.dao;
/**
* Data Access Layer comprising of ProductDao class to access the data source.In our case we access the TreeSet
*/
import java.util.TreeSet;
import com.hsbc.models.Apparel;
import com.hsbc.models.Electronics;
import com.hsbc.models.FoodItems;
public class ProductDao implements ProductIntfDao {
TreeSet<FoodItems> foodSet = new TreeSet<>();
TreeSet<Apparel> apparel = new TreeSet<>();
TreeSet<Electronics> electronic = new TreeSet<>();
@Override
public void addFood(FoodItems food) {
// TODO Auto-generated method stub
foodSet.add(food);
}
@Override
public void deleteFood(FoodItems food) throws NoProductFoundException {
// TODO Auto-generated method stub
int k = 0;
for (FoodItems f : foodSet) {
if (f == food)
foodSet.remove(food);
}
if (k == 0)
throw new NoProductFoundException("No such Product Available");
}
@Override
public void showFood() {
// TODO Auto-generated method stub
for (int i = 0; i < 2; i++)
System.out.println(foodSet);
}
@Override
public void addApparel(Apparel apparel) {
// TODO Auto-generated method stub
apparel.add(apparel);
}
@Override
public void deleteApparel(Apparel apparel) {
// TODO Auto-generated method stub
int k = 0;
for (Apparel a : apparel) {
if (a == apparel)
foodSet.remove(a);
}
if (k == 0)
throw new NoProductFoundException("No such Product Available");
}
@Override
public void showApparel() {
// TODO Auto-generated method stub
for (int i = 0; i < 2; i++)
System.out.println(apparel);
}
@Override
public void addElectronic(Electronics electronic1) {
// TODO Auto-generated method stub
electronic.add(electronic1);
}
@Override
public void deleteElectronic(Electronics electronic1) {
// TODO Auto-generated method stub
int k = 0;
for (Electronics e : electronic) {
if (e == electronic1)
electronic.remove(e);
}
if (k == 0)
throw new NoProductFoundException("No such Product Available");
}
}
@Override
public void showElectronic() {
// TODO Auto-generated method stub
for (int i = 0; i < 2; i++)
System.out.println(electronic);
}
}
| 2,139
| 0.69238
| 0.6849
| 94
| 21.75532
| 20.71575
| 111
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.617021
| false
| false
|
13
|
af8c4a5449ed133bb08993844a8e0c7e589896c3
| 8,400,956,049,530
|
f66880ef225ac916487317ccf64e8aa6bc085712
|
/PresentationStruts2/src/java/thienvn/beans/ShowMissionDetail.java
|
2899af333df1c927b2a4d44f5d62ebdf17fd41d2
|
[] |
no_license
|
ThienVNSE63146/Present-Struts-2
|
https://github.com/ThienVNSE63146/Present-Struts-2
|
e0f73ad515a76cff3653b97b3e41be440933af76
|
06ae110d74348f1a41ae09db27439f34e3885798
|
refs/heads/master
| 2020-04-11T12:56:25.190000
| 2018-12-16T03:40:55
| 2018-12-16T03:40:55
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package thienvn.beans;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;
import thienvn.dao.MissionDAO;
import thienvn.dto.MissionDetailDTO;
/**
*
* @author thien
*/
public class ShowMissionDetail {
private String ID;
ArrayList<MissionDetailDTO>list;
List<String>username;
List<String>username2;
public List<String> getUsername() {
return username;
}
public void setUsername(List<String> username) {
this.username = username;
}
public final String SUCCESS="success";
public String getID() {
return ID;
}
public void setID(String ID) {
this.ID = ID;
}
public ArrayList<MissionDetailDTO> getList() {
return list;
}
public void setList(ArrayList<MissionDetailDTO> list) {
this.list = list;
}
public ShowMissionDetail() {
}
public String execute() throws Exception {
MissionDAO dao=new MissionDAO();
list=dao.getMissionDetail(ID);
username=dao.loadCombobox();
username2=dao.loadCombobox2(list);
HttpServletRequest request=ServletActionContext.getRequest();
request.setAttribute("COMBOBOX", username);
request.setAttribute("COMBOBOX2", username2);
return SUCCESS;
}
}
|
UTF-8
|
Java
| 1,610
|
java
|
ShowMissionDetail.java
|
Java
|
[
{
"context": "t thienvn.dto.MissionDetailDTO;\n\n/**\n *\n * @author thien\n */\npublic class ShowMissionDetail {\n private ",
"end": 494,
"score": 0.9982174634933472,
"start": 489,
"tag": "USERNAME",
"value": "thien"
}
] | 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 thienvn.beans;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;
import thienvn.dao.MissionDAO;
import thienvn.dto.MissionDetailDTO;
/**
*
* @author thien
*/
public class ShowMissionDetail {
private String ID;
ArrayList<MissionDetailDTO>list;
List<String>username;
List<String>username2;
public List<String> getUsername() {
return username;
}
public void setUsername(List<String> username) {
this.username = username;
}
public final String SUCCESS="success";
public String getID() {
return ID;
}
public void setID(String ID) {
this.ID = ID;
}
public ArrayList<MissionDetailDTO> getList() {
return list;
}
public void setList(ArrayList<MissionDetailDTO> list) {
this.list = list;
}
public ShowMissionDetail() {
}
public String execute() throws Exception {
MissionDAO dao=new MissionDAO();
list=dao.getMissionDetail(ID);
username=dao.loadCombobox();
username2=dao.loadCombobox2(list);
HttpServletRequest request=ServletActionContext.getRequest();
request.setAttribute("COMBOBOX", username);
request.setAttribute("COMBOBOX2", username2);
return SUCCESS;
}
}
| 1,610
| 0.675776
| 0.67205
| 69
| 22.333334
| 19.836042
| 79
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.478261
| false
| false
|
13
|
ccaaa0034ef271753bb059c2910594a57e4e390f
| 26,800,595,948,624
|
b745bce17192e6bdc6a866eb410e658aa6ee8dbc
|
/02task01books/src/main/java/com/ilyabuglakov/task0201books/dal/repository/PublicationRepository.java
|
2b08764b93487f8088687fbf79676e658a5a3762
|
[] |
no_license
|
Sintexer/IlyaBuglakov
|
https://github.com/Sintexer/IlyaBuglakov
|
676981aebfb9a659cd31962d40c6ff73820b8705
|
daed7dd789ee2923f33432b3f264cd477a24f3da
|
refs/heads/master
| 2023-03-01T23:34:33.403000
| 2021-02-09T11:28:09
| 2021-02-09T11:28:09
| 296,237,346
| 0
| 1
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ilyabuglakov.task0201books.dal.repository;
import com.ilyabuglakov.task0201books.dal.dao.BookListDao;
import com.ilyabuglakov.task0201books.dal.dao.GenericDao;
import com.ilyabuglakov.task0201books.dal.dao.MagazineListDAO;
import com.ilyabuglakov.task0201books.dal.specification.Specification;
import com.ilyabuglakov.task0201books.dal.specification.book.BookSpecification;
import com.ilyabuglakov.task0201books.dal.specification.magazine.MagazineSpecification;
import com.ilyabuglakov.task0201books.exception.DaoAddException;
import com.ilyabuglakov.task0201books.exception.DaoRemoveException;
import com.ilyabuglakov.task0201books.exception.DaoWrongTypeException;
import com.ilyabuglakov.task0201books.model.book.Book;
import com.ilyabuglakov.task0201books.model.magazine.Magazine;
import com.ilyabuglakov.task0201books.model.publication.Publication;
import com.ilyabuglakov.task0201books.service.IdGenerator;
import com.ilyabuglakov.task0201books.service.observer.Notifier;
import com.ilyabuglakov.task0201books.service.observer.PubliationEventListener;
import com.ilyabuglakov.task0201books.service.observer.PublicationYearObserver;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
public class PublicationRepository implements Notifier {
private static PublicationRepository instance = new PublicationRepository();
private Map<Class<? extends Publication>, GenericDao<? extends Publication>> daosMap = new HashMap<>();
private List<PubliationEventListener> eventListeners = new ArrayList<>();
private PublicationRepository() {
daosMap.put(Book.class, new BookListDao());
daosMap.put(Magazine.class, new MagazineListDAO());
addEventListener(new PublicationYearObserver());
}
public static PublicationRepository getInstance() {
return instance;
}
public long add(Publication publication) throws DaoAddException {
long id = IdGenerator.getInstance().next();
publication.setId(id);
daosMap.get(publication.getClass()).add(publication);
notifyAllAdd(publication);
return id;
}
public Optional<? extends Publication> get(long id) {
return daosMap.values().stream()
.map(GenericDao::getAll)
.flatMap(l -> l.stream())
.filter(publ -> publ.getId() == id)
.findFirst();
}
public void remove(Publication publication) throws DaoRemoveException {
daosMap.get(publication.getClass()).remove(publication);
}
public boolean remove(long id) throws DaoRemoveException {
Optional<? extends Publication> p = get(id);
if (p.isPresent()) {
Publication old = p.get();
daosMap.get(old.getClass()).remove(p.get());
notifyAllRemove(old);
return true;
}
return false;
}
public void update(long id, Publication publication) throws DaoWrongTypeException {
Optional<? extends Publication> p = get(id);
if (p.isPresent()) {
Publication old = p.get();
int index = daosMap.get(old.getClass()).indexOf(old);
daosMap.get(old.getClass()).set(index, p.get());
notifyAllUpdate(old, publication);
}
}
public List<Publication> getAll() {
return daosMap.values().stream()
.map(GenericDao::getAll)
.flatMap(Collection::stream)
.collect(Collectors.toList());
}
public List<Publication> getAllSorted() {
return daosMap.values().stream()
.map(GenericDao::getAll)
.filter(Objects::nonNull)
.flatMap(Collection::stream)
.sorted()
.collect(Collectors.toList());
}
public List<Publication> getAllSorted(Comparator<Publication> comparator) {
return daosMap.values().stream()
.map(GenericDao::getAll)
.filter(Objects::nonNull)
.flatMap(Collection::stream)
.sorted(comparator)
.collect(Collectors.toList());
}
public Optional<Book> find(BookSpecification specification) {
return ((BookListDao) daosMap.get(Book.class)).findByCriteria(specification);
}
public Optional<Magazine> find(MagazineSpecification specification) {
return ((MagazineListDAO) daosMap.get(Magazine.class)).findByCriteria(specification);
}
public List<Publication> findAll(Specification<? super Publication> specification) {
return daosMap.values().stream()
.flatMap(list -> list.getAll().stream())
.filter(specification::isSatisfiedBy)
.collect(Collectors.toList());
}
public List<Book> findAll(BookSpecification specification) {
return ((BookListDao) daosMap.get(Book.class)).findAllByCriteria(specification);
}
public List<Magazine> findAll(MagazineSpecification specification) {
return ((MagazineListDAO) daosMap.get(Magazine.class)).findAllByCriteria(specification);
}
public void sortBooks(Comparator<? super Book> comparator) {
((BookListDao) daosMap.get(Book.class)).sortBy(comparator);
}
public void sortMagazines(Comparator<? super Magazine> comparator) {
((MagazineListDAO) daosMap.get(Magazine.class)).sortBy(comparator);
}
public void sort(Comparator<Publication> comparator) {
daosMap.values().forEach(dao -> dao.sortBy(comparator));
}
public void clear() {
for (Class<? extends Publication> key : daosMap.keySet()) {
daosMap.get(key).clear();
}
}
@Override
public void addEventListener(PubliationEventListener eventListener) {
eventListeners.add(eventListener);
}
@Override
public void removeEventListener(PubliationEventListener eventListener) {
eventListeners.remove(eventListener);
}
@Override
public void notifyAllAdd(Publication publication) {
eventListeners.forEach(evntLst -> evntLst.publicationAdded(publication));
}
@Override
public void notifyAllRemove(Publication publication) {
eventListeners.forEach(evntLst -> evntLst.publicationRemoved(publication));
}
@Override
public void notifyAllUpdate(Publication old, Publication updated) {
eventListeners.forEach(evntLst -> evntLst.publicationUpdated(old, updated));
}
}
|
UTF-8
|
Java
| 6,644
|
java
|
PublicationRepository.java
|
Java
|
[] | null |
[] |
package com.ilyabuglakov.task0201books.dal.repository;
import com.ilyabuglakov.task0201books.dal.dao.BookListDao;
import com.ilyabuglakov.task0201books.dal.dao.GenericDao;
import com.ilyabuglakov.task0201books.dal.dao.MagazineListDAO;
import com.ilyabuglakov.task0201books.dal.specification.Specification;
import com.ilyabuglakov.task0201books.dal.specification.book.BookSpecification;
import com.ilyabuglakov.task0201books.dal.specification.magazine.MagazineSpecification;
import com.ilyabuglakov.task0201books.exception.DaoAddException;
import com.ilyabuglakov.task0201books.exception.DaoRemoveException;
import com.ilyabuglakov.task0201books.exception.DaoWrongTypeException;
import com.ilyabuglakov.task0201books.model.book.Book;
import com.ilyabuglakov.task0201books.model.magazine.Magazine;
import com.ilyabuglakov.task0201books.model.publication.Publication;
import com.ilyabuglakov.task0201books.service.IdGenerator;
import com.ilyabuglakov.task0201books.service.observer.Notifier;
import com.ilyabuglakov.task0201books.service.observer.PubliationEventListener;
import com.ilyabuglakov.task0201books.service.observer.PublicationYearObserver;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
public class PublicationRepository implements Notifier {
private static PublicationRepository instance = new PublicationRepository();
private Map<Class<? extends Publication>, GenericDao<? extends Publication>> daosMap = new HashMap<>();
private List<PubliationEventListener> eventListeners = new ArrayList<>();
private PublicationRepository() {
daosMap.put(Book.class, new BookListDao());
daosMap.put(Magazine.class, new MagazineListDAO());
addEventListener(new PublicationYearObserver());
}
public static PublicationRepository getInstance() {
return instance;
}
public long add(Publication publication) throws DaoAddException {
long id = IdGenerator.getInstance().next();
publication.setId(id);
daosMap.get(publication.getClass()).add(publication);
notifyAllAdd(publication);
return id;
}
public Optional<? extends Publication> get(long id) {
return daosMap.values().stream()
.map(GenericDao::getAll)
.flatMap(l -> l.stream())
.filter(publ -> publ.getId() == id)
.findFirst();
}
public void remove(Publication publication) throws DaoRemoveException {
daosMap.get(publication.getClass()).remove(publication);
}
public boolean remove(long id) throws DaoRemoveException {
Optional<? extends Publication> p = get(id);
if (p.isPresent()) {
Publication old = p.get();
daosMap.get(old.getClass()).remove(p.get());
notifyAllRemove(old);
return true;
}
return false;
}
public void update(long id, Publication publication) throws DaoWrongTypeException {
Optional<? extends Publication> p = get(id);
if (p.isPresent()) {
Publication old = p.get();
int index = daosMap.get(old.getClass()).indexOf(old);
daosMap.get(old.getClass()).set(index, p.get());
notifyAllUpdate(old, publication);
}
}
public List<Publication> getAll() {
return daosMap.values().stream()
.map(GenericDao::getAll)
.flatMap(Collection::stream)
.collect(Collectors.toList());
}
public List<Publication> getAllSorted() {
return daosMap.values().stream()
.map(GenericDao::getAll)
.filter(Objects::nonNull)
.flatMap(Collection::stream)
.sorted()
.collect(Collectors.toList());
}
public List<Publication> getAllSorted(Comparator<Publication> comparator) {
return daosMap.values().stream()
.map(GenericDao::getAll)
.filter(Objects::nonNull)
.flatMap(Collection::stream)
.sorted(comparator)
.collect(Collectors.toList());
}
public Optional<Book> find(BookSpecification specification) {
return ((BookListDao) daosMap.get(Book.class)).findByCriteria(specification);
}
public Optional<Magazine> find(MagazineSpecification specification) {
return ((MagazineListDAO) daosMap.get(Magazine.class)).findByCriteria(specification);
}
public List<Publication> findAll(Specification<? super Publication> specification) {
return daosMap.values().stream()
.flatMap(list -> list.getAll().stream())
.filter(specification::isSatisfiedBy)
.collect(Collectors.toList());
}
public List<Book> findAll(BookSpecification specification) {
return ((BookListDao) daosMap.get(Book.class)).findAllByCriteria(specification);
}
public List<Magazine> findAll(MagazineSpecification specification) {
return ((MagazineListDAO) daosMap.get(Magazine.class)).findAllByCriteria(specification);
}
public void sortBooks(Comparator<? super Book> comparator) {
((BookListDao) daosMap.get(Book.class)).sortBy(comparator);
}
public void sortMagazines(Comparator<? super Magazine> comparator) {
((MagazineListDAO) daosMap.get(Magazine.class)).sortBy(comparator);
}
public void sort(Comparator<Publication> comparator) {
daosMap.values().forEach(dao -> dao.sortBy(comparator));
}
public void clear() {
for (Class<? extends Publication> key : daosMap.keySet()) {
daosMap.get(key).clear();
}
}
@Override
public void addEventListener(PubliationEventListener eventListener) {
eventListeners.add(eventListener);
}
@Override
public void removeEventListener(PubliationEventListener eventListener) {
eventListeners.remove(eventListener);
}
@Override
public void notifyAllAdd(Publication publication) {
eventListeners.forEach(evntLst -> evntLst.publicationAdded(publication));
}
@Override
public void notifyAllRemove(Publication publication) {
eventListeners.forEach(evntLst -> evntLst.publicationRemoved(publication));
}
@Override
public void notifyAllUpdate(Publication old, Publication updated) {
eventListeners.forEach(evntLst -> evntLst.publicationUpdated(old, updated));
}
}
| 6,644
| 0.687387
| 0.677152
| 178
| 36.320225
| 28.879715
| 107
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.426966
| false
| false
|
13
|
50c9c0d44d5b9406d6a4d01c8a59f669cc2aeaaf
| 11,020,886,123,365
|
342766353ef0e98441068bbfef1c35fe41218244
|
/src/edu/uwm/cs552/TrackRental.java
|
60577d2951b9cbf439098651dba1b26a7a35f62a
|
[] |
no_license
|
adfuhr/homework7
|
https://github.com/adfuhr/homework7
|
fed43315ee28eef64fcc0c6fc0109f7bcc65add9
|
de8dd85e29d7193a5524225e125f3222bbc8ff45
|
refs/heads/master
| 2017-12-22T04:17:09.306000
| 2012-12-15T19:06:03
| 2012-12-15T19:06:03
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package edu.uwm.cs552;
public interface TrackRental {
/**
* How much does it cost to travel on another
* players rails between two points, across a given barrier.
* @param t1 first terrain
* @param b barrier being crossed, may be null
* @param t2 second terrain
* @return standardized track usage fee
*/
public double cost(Terrain t1, Barrier b, Terrain t2);
}
|
UTF-8
|
Java
| 378
|
java
|
TrackRental.java
|
Java
|
[] | null |
[] |
package edu.uwm.cs552;
public interface TrackRental {
/**
* How much does it cost to travel on another
* players rails between two points, across a given barrier.
* @param t1 first terrain
* @param b barrier being crossed, may be null
* @param t2 second terrain
* @return standardized track usage fee
*/
public double cost(Terrain t1, Barrier b, Terrain t2);
}
| 378
| 0.716931
| 0.698413
| 13
| 28.076923
| 20.291952
| 61
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.153846
| false
| false
|
13
|
4e94e95c0faede6cd19f6f3582204f2d8cdd91a4
| 14,680,198,258,052
|
d6615375daaabd6529f94e68ba62dcb49f678a64
|
/src/com/java/ds/Stack.java
|
389b8b1a73935cfb5163028e2290b31376951e68
|
[] |
no_license
|
Apps16/DataStructures
|
https://github.com/Apps16/DataStructures
|
23d104a4661097b47cc701edcf0beed774cce072
|
3168c46d66885289f25157f6b50b339f4d9fa855
|
refs/heads/master
| 2019-04-19T04:56:17.911000
| 2018-04-11T16:25:11
| 2018-04-11T16:25:11
| 93,259,622
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.java.ds;
import java.util.Scanner;
/**
* Last in First out
*/
public class Stack {
private int arrayStack[], sizeOfStack, numberOfElementsInStack, topOfStack;
private void initStack(int n) {
sizeOfStack = n;
numberOfElementsInStack = 0;
arrayStack = new int[n];
topOfStack = -1;
}
/**
* Check if stack is empty
*/
private boolean isStackEmpty() {
return topOfStack == -1;
}
/**
* Check if stack is full
*/
private boolean isStackFull() {
return topOfStack == (sizeOfStack - 1);
}
/**
* Return number of elements on Stack
*/
private int getNumberOfElementsInStack() {
return numberOfElementsInStack;
}
/**
* Return element on top of Stack
*/
private int getElementOnTopOfStack() {
if (isStackEmpty()) {
throw new IndexOutOfBoundsException("Underflow - The Stack has no elements in it!");
}
return arrayStack[topOfStack];
}
/**
* Push an element to Stack
*/
private void pushToStack(int n) {
if (isStackFull()) {
throw new IndexOutOfBoundsException("Overflow - The Stack is full!");
}
arrayStack[++topOfStack] = n;
numberOfElementsInStack++;
}
/**
* Pop an element from Stack
*/
private int popFromStack() {
if (isStackEmpty()) {
throw new IndexOutOfBoundsException("Underflow - The Stack has no elements in it!");
}
numberOfElementsInStack--;
return arrayStack[topOfStack--];
}
/**
* Display the contents of Stack
*/
private void displayElementsOfStack() {
if (numberOfElementsInStack == 0) {
System.out.println("Stack is empty!");
} else {
for (int i = topOfStack; i >= 0; i--) {
System.out.print(arrayStack[i] + " ");
}
System.out.println();
}
}
@SuppressWarnings("resource")
public void performStackOperations() {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the size of the Stack : ");
int sizeOfStack = scanner.nextInt();
Stack arrStack = new Stack();
arrStack.initStack(sizeOfStack);
char ch;
do {
System.out.println("Select which operation you want to perform on Stack : ");
System.out.println("\n Operations");
System.out.println("1. Push to Stack");
System.out.println("2. Pop from Stack");
System.out.println("3. Display contents of stack");
System.out.println("4. Check if stack is empty");
System.out.println("5. Check if stack is full");
System.out.println("6. Number of elements on stack");
int choice = scanner.nextInt();
switch (choice) {
case 1:
try {
System.out.println("Enter the element to push to stack");
arrStack.pushToStack(scanner.nextInt());
} catch (IndexOutOfBoundsException e) {
System.out.println(e.getMessage());
}
break;
case 2:
try {
arrStack.popFromStack();
} catch (IndexOutOfBoundsException e) {
System.out.println(e.getMessage());
}
break;
case 3:
try {
arrStack.displayElementsOfStack();
} catch (IndexOutOfBoundsException e) {
System.out.println(e.getMessage());
}
break;
case 4:
if (arrStack.isStackEmpty())
System.out.println("Stack is empty");
else
System.out.println("Stack is not empty");
break;
case 5:
if (arrStack.isStackFull())
System.out.println("Stack is full");
else
System.out.println("Stack is not full");
break;
case 6:
System.out.println("Number of elements in Stack : " + arrStack.getNumberOfElementsInStack());
default:
System.out.println("Wrong option");
break;
}
System.out.println("Do you want to continue? - (Enter Y or y)");
ch = scanner.next().charAt(0);
} while (ch == 'Y' || ch == 'y');
System.out.println("End of Stack Operations \n");
}
}
|
UTF-8
|
Java
| 4,838
|
java
|
Stack.java
|
Java
|
[] | null |
[] |
package com.java.ds;
import java.util.Scanner;
/**
* Last in First out
*/
public class Stack {
private int arrayStack[], sizeOfStack, numberOfElementsInStack, topOfStack;
private void initStack(int n) {
sizeOfStack = n;
numberOfElementsInStack = 0;
arrayStack = new int[n];
topOfStack = -1;
}
/**
* Check if stack is empty
*/
private boolean isStackEmpty() {
return topOfStack == -1;
}
/**
* Check if stack is full
*/
private boolean isStackFull() {
return topOfStack == (sizeOfStack - 1);
}
/**
* Return number of elements on Stack
*/
private int getNumberOfElementsInStack() {
return numberOfElementsInStack;
}
/**
* Return element on top of Stack
*/
private int getElementOnTopOfStack() {
if (isStackEmpty()) {
throw new IndexOutOfBoundsException("Underflow - The Stack has no elements in it!");
}
return arrayStack[topOfStack];
}
/**
* Push an element to Stack
*/
private void pushToStack(int n) {
if (isStackFull()) {
throw new IndexOutOfBoundsException("Overflow - The Stack is full!");
}
arrayStack[++topOfStack] = n;
numberOfElementsInStack++;
}
/**
* Pop an element from Stack
*/
private int popFromStack() {
if (isStackEmpty()) {
throw new IndexOutOfBoundsException("Underflow - The Stack has no elements in it!");
}
numberOfElementsInStack--;
return arrayStack[topOfStack--];
}
/**
* Display the contents of Stack
*/
private void displayElementsOfStack() {
if (numberOfElementsInStack == 0) {
System.out.println("Stack is empty!");
} else {
for (int i = topOfStack; i >= 0; i--) {
System.out.print(arrayStack[i] + " ");
}
System.out.println();
}
}
@SuppressWarnings("resource")
public void performStackOperations() {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the size of the Stack : ");
int sizeOfStack = scanner.nextInt();
Stack arrStack = new Stack();
arrStack.initStack(sizeOfStack);
char ch;
do {
System.out.println("Select which operation you want to perform on Stack : ");
System.out.println("\n Operations");
System.out.println("1. Push to Stack");
System.out.println("2. Pop from Stack");
System.out.println("3. Display contents of stack");
System.out.println("4. Check if stack is empty");
System.out.println("5. Check if stack is full");
System.out.println("6. Number of elements on stack");
int choice = scanner.nextInt();
switch (choice) {
case 1:
try {
System.out.println("Enter the element to push to stack");
arrStack.pushToStack(scanner.nextInt());
} catch (IndexOutOfBoundsException e) {
System.out.println(e.getMessage());
}
break;
case 2:
try {
arrStack.popFromStack();
} catch (IndexOutOfBoundsException e) {
System.out.println(e.getMessage());
}
break;
case 3:
try {
arrStack.displayElementsOfStack();
} catch (IndexOutOfBoundsException e) {
System.out.println(e.getMessage());
}
break;
case 4:
if (arrStack.isStackEmpty())
System.out.println("Stack is empty");
else
System.out.println("Stack is not empty");
break;
case 5:
if (arrStack.isStackFull())
System.out.println("Stack is full");
else
System.out.println("Stack is not full");
break;
case 6:
System.out.println("Number of elements in Stack : " + arrStack.getNumberOfElementsInStack());
default:
System.out.println("Wrong option");
break;
}
System.out.println("Do you want to continue? - (Enter Y or y)");
ch = scanner.next().charAt(0);
} while (ch == 'Y' || ch == 'y');
System.out.println("End of Stack Operations \n");
}
}
| 4,838
| 0.49876
| 0.494833
| 165
| 28.327272
| 24.198463
| 113
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.4
| false
| false
|
13
|
4931933439f6b3aea13ee73ee1cb9a80137e00e6
| 8,211,977,495,896
|
7e1f8deb819e748535c9b2e3befec9eed453db92
|
/src/main/java/com/dw/util/LocalUtils.java
|
1f4e935445cc9d20411ede81fb7052dd4e1320ba
|
[] |
no_license
|
thefuckworld/zk-client
|
https://github.com/thefuckworld/zk-client
|
b2556dba952b631c5445395ab3ed3f8fa8d4ddf8
|
4eb75d28acd3b09ebe8a08f71869ff25cd9686b9
|
refs/heads/master
| 2021-01-12T04:04:47.668000
| 2016-12-28T02:14:52
| 2016-12-28T02:14:52
| 77,495,464
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.dw.util;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Description: 本地资源工具类
* @author caohui
*/
public final class LocalUtils {
private static final Logger LOGGER = LoggerFactory.getLogger(LocalUtils.class);
private LocalUtils() {}
private static String LOCAL_IP = null;
/**
* Description: 获取本机IP地址 此方法为重量级的方法,不要频繁调用
* All Rights Reserved.
*
* @return
* @return String
* @version 1.0 2016年11月10日 上午1:17:17 created by caohui(1343965426@qq.com)
*/
public static String getLocalIp() {
if(LOCAL_IP != null) {
return LOCAL_IP;
}
// 根据网卡取本机配置的IP
try {
Enumeration<NetworkInterface> netInterfaces = NetworkInterface.getNetworkInterfaces();
String ip = null;
a: while(netInterfaces.hasMoreElements()) {
NetworkInterface netInterface = netInterfaces.nextElement();
Enumeration<InetAddress> ips = netInterface.getInetAddresses();
while(ips.hasMoreElements()) {
InetAddress ipObject = ips.nextElement();
if(ipObject.isSiteLocalAddress()) {
ip = ipObject.getHostAddress();
break a;
}
}
}
LOCAL_IP = ip;
return ip;
} catch (SocketException e) {
LOGGER.error("", e);
}
return null;
}
}
|
UTF-8
|
Java
| 1,434
|
java
|
LocalUtils.java
|
Java
|
[
{
"context": "erFactory;\n\n/**\n * Description: 本地资源工具类\n * @author caohui\n */\npublic final class LocalUtils {\n\n\tprivate sta",
"end": 252,
"score": 0.99949049949646,
"start": 246,
"tag": "USERNAME",
"value": "caohui"
},
{
"context": "\n\t * @version 1.0 2016年11月10日 上午1:17:17 created by caohui(1343965426@qq.com)\n\t */\n\tpublic static String get",
"end": 607,
"score": 0.9994221925735474,
"start": 601,
"tag": "USERNAME",
"value": "caohui"
},
{
"context": "rsion 1.0 2016年11月10日 上午1:17:17 created by caohui(1343965426@qq.com)\n\t */\n\tpublic static String getLocalIp() {\n\t\tif(L",
"end": 625,
"score": 0.963111937046051,
"start": 608,
"tag": "EMAIL",
"value": "1343965426@qq.com"
}
] | null |
[] |
package com.dw.util;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Description: 本地资源工具类
* @author caohui
*/
public final class LocalUtils {
private static final Logger LOGGER = LoggerFactory.getLogger(LocalUtils.class);
private LocalUtils() {}
private static String LOCAL_IP = null;
/**
* Description: 获取本机IP地址 此方法为重量级的方法,不要频繁调用
* All Rights Reserved.
*
* @return
* @return String
* @version 1.0 2016年11月10日 上午1:17:17 created by caohui(<EMAIL>)
*/
public static String getLocalIp() {
if(LOCAL_IP != null) {
return LOCAL_IP;
}
// 根据网卡取本机配置的IP
try {
Enumeration<NetworkInterface> netInterfaces = NetworkInterface.getNetworkInterfaces();
String ip = null;
a: while(netInterfaces.hasMoreElements()) {
NetworkInterface netInterface = netInterfaces.nextElement();
Enumeration<InetAddress> ips = netInterface.getInetAddresses();
while(ips.hasMoreElements()) {
InetAddress ipObject = ips.nextElement();
if(ipObject.isSiteLocalAddress()) {
ip = ipObject.getHostAddress();
break a;
}
}
}
LOCAL_IP = ip;
return ip;
} catch (SocketException e) {
LOGGER.error("", e);
}
return null;
}
}
| 1,424
| 0.696429
| 0.676339
| 58
| 22.172413
| 21.283098
| 89
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 2.086207
| false
| false
|
13
|
ca5fd0e969d6ea1dced1e53456fbd4b2c7c2e1cb
| 10,651,518,920,908
|
642474e0cfa01591400b520fe19f14491c85de4f
|
/app/src/main/java/com/artenesnogueira/popularmovies/models/MovieBitmap.java
|
cb7d491d4736013e983713153c2fc85737e9b750
|
[
"MIT"
] |
permissive
|
Artenes/popular-movies
|
https://github.com/Artenes/popular-movies
|
6cbf3aa7d96b970191bc524894b411432a58cddb
|
67ca1bf153fdba4bc9d972223686092d5f260ca7
|
refs/heads/master
| 2021-07-21T16:30:38.424000
| 2018-10-27T20:43:13
| 2018-10-27T20:43:13
| 131,708,993
| 3
| 0
| null | false
| 2018-05-05T17:31:19
| 2018-05-01T12:10:32
| 2018-05-01T12:11:04
| 2018-05-05T17:31:19
| 168
| 0
| 0
| 0
|
Java
| false
| null |
package com.artenesnogueira.popularmovies.models;
import android.graphics.Bitmap;
public class MovieBitmap {
private final String movieId;
private final String url;
private final int type;
private final Bitmap bitmap;
public MovieBitmap(String movieId, String url, int type, Bitmap bitmap) {
this.movieId = movieId;
this.url = url;
this.type = type;
this.bitmap = bitmap;
}
public String getMovieId() {
return movieId;
}
public String getUrl() {
return url;
}
public int getType() {
return type;
}
public Bitmap getBitmap() {
return bitmap;
}
}
|
UTF-8
|
Java
| 674
|
java
|
MovieBitmap.java
|
Java
|
[
{
"context": "package com.artenesnogueira.popularmovies.models;\n\nimport android.graphics.Bi",
"end": 27,
"score": 0.9177356362342834,
"start": 12,
"tag": "USERNAME",
"value": "artenesnogueira"
}
] | null |
[] |
package com.artenesnogueira.popularmovies.models;
import android.graphics.Bitmap;
public class MovieBitmap {
private final String movieId;
private final String url;
private final int type;
private final Bitmap bitmap;
public MovieBitmap(String movieId, String url, int type, Bitmap bitmap) {
this.movieId = movieId;
this.url = url;
this.type = type;
this.bitmap = bitmap;
}
public String getMovieId() {
return movieId;
}
public String getUrl() {
return url;
}
public int getType() {
return type;
}
public Bitmap getBitmap() {
return bitmap;
}
}
| 674
| 0.618694
| 0.618694
| 35
| 18.257143
| 17.142
| 77
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.485714
| false
| false
|
13
|
75fdd0a07cfe2432756a527e90dcea67df1bf052
| 9,792,525,465,724
|
59f12f8c2c21e73a31a0dd789a5fa7f4a1a62bad
|
/DatabaseTester/src/main/java/pl/jowko/database/sf/hibernate/entities/ProfessionsEntity.java
|
a2478e23261b5c0d3102e53ee9218608ef5ff275
|
[] |
no_license
|
jowko/JavaSandbox
|
https://github.com/jowko/JavaSandbox
|
d7e9376ecbc95b4a63d0f4e3caea66011f2bcbf4
|
f83ad74b3bee926e69e28f55ebf65a2da56a872d
|
refs/heads/master
| 2020-03-02T16:09:02.908000
| 2017-12-12T21:10:56
| 2017-12-12T21:10:56
| 102,640,895
| 0
| 0
| null | false
| 2019-09-15T07:21:13
| 2017-09-06T17:56:30
| 2017-09-06T17:59:11
| 2019-09-15T07:21:13
| 259
| 0
| 0
| 5
|
Java
| false
| false
|
package pl.jowko.database.sf.hibernate.entities;
import lombok.ToString;
import javax.persistence.*;
/**
* Created by Piotr on 2017-12-12.
*/
@Entity
@ToString
@Table(name = "PROFESSIONS", schema = "SF")
public class ProfessionsEntity {
private long professionId;
private String name;
private String description;
private Long salaryMin;
private Long salaryMax;
private Long rowVersion;
@Id
@Column(name = "PROFESSION_ID")
public long getProfessionId() {
return professionId;
}
public void setProfessionId(long professionId) {
this.professionId = professionId;
}
@Basic
@Column(name = "NAME")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Basic
@Column(name = "DESCRIPTION")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Basic
@Column(name = "SALARY_MIN")
public Long getSalaryMin() {
return salaryMin;
}
public void setSalaryMin(Long salaryMin) {
this.salaryMin = salaryMin;
}
@Basic
@Column(name = "SALARY_MAX")
public Long getSalaryMax() {
return salaryMax;
}
public void setSalaryMax(Long salaryMax) {
this.salaryMax = salaryMax;
}
@Basic
@Column(name = "ROW_VERSION")
public Long getRowVersion() {
return rowVersion;
}
public void setRowVersion(Long rowVersion) {
this.rowVersion = rowVersion;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ProfessionsEntity that = (ProfessionsEntity) o;
if (professionId != that.professionId) return false;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (description != null ? !description.equals(that.description) : that.description != null) return false;
if (salaryMin != null ? !salaryMin.equals(that.salaryMin) : that.salaryMin != null) return false;
if (salaryMax != null ? !salaryMax.equals(that.salaryMax) : that.salaryMax != null) return false;
if (rowVersion != null ? !rowVersion.equals(that.rowVersion) : that.rowVersion != null) return false;
return true;
}
@Override
public int hashCode() {
int result = (int) (professionId ^ (professionId >>> 32));
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (salaryMin != null ? salaryMin.hashCode() : 0);
result = 31 * result + (salaryMax != null ? salaryMax.hashCode() : 0);
result = 31 * result + (rowVersion != null ? rowVersion.hashCode() : 0);
return result;
}
}
|
UTF-8
|
Java
| 2,684
|
java
|
ProfessionsEntity.java
|
Java
|
[
{
"context": "g;\n\nimport javax.persistence.*;\n\n/**\n * Created by Piotr on 2017-12-12.\n */\n@Entity\n@ToString\n@Table(name ",
"end": 127,
"score": 0.9976745247840881,
"start": 122,
"tag": "NAME",
"value": "Piotr"
}
] | null |
[] |
package pl.jowko.database.sf.hibernate.entities;
import lombok.ToString;
import javax.persistence.*;
/**
* Created by Piotr on 2017-12-12.
*/
@Entity
@ToString
@Table(name = "PROFESSIONS", schema = "SF")
public class ProfessionsEntity {
private long professionId;
private String name;
private String description;
private Long salaryMin;
private Long salaryMax;
private Long rowVersion;
@Id
@Column(name = "PROFESSION_ID")
public long getProfessionId() {
return professionId;
}
public void setProfessionId(long professionId) {
this.professionId = professionId;
}
@Basic
@Column(name = "NAME")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Basic
@Column(name = "DESCRIPTION")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Basic
@Column(name = "SALARY_MIN")
public Long getSalaryMin() {
return salaryMin;
}
public void setSalaryMin(Long salaryMin) {
this.salaryMin = salaryMin;
}
@Basic
@Column(name = "SALARY_MAX")
public Long getSalaryMax() {
return salaryMax;
}
public void setSalaryMax(Long salaryMax) {
this.salaryMax = salaryMax;
}
@Basic
@Column(name = "ROW_VERSION")
public Long getRowVersion() {
return rowVersion;
}
public void setRowVersion(Long rowVersion) {
this.rowVersion = rowVersion;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ProfessionsEntity that = (ProfessionsEntity) o;
if (professionId != that.professionId) return false;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (description != null ? !description.equals(that.description) : that.description != null) return false;
if (salaryMin != null ? !salaryMin.equals(that.salaryMin) : that.salaryMin != null) return false;
if (salaryMax != null ? !salaryMax.equals(that.salaryMax) : that.salaryMax != null) return false;
if (rowVersion != null ? !rowVersion.equals(that.rowVersion) : that.rowVersion != null) return false;
return true;
}
@Override
public int hashCode() {
int result = (int) (professionId ^ (professionId >>> 32));
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (salaryMin != null ? salaryMin.hashCode() : 0);
result = 31 * result + (salaryMax != null ? salaryMax.hashCode() : 0);
result = 31 * result + (rowVersion != null ? rowVersion.hashCode() : 0);
return result;
}
}
| 2,684
| 0.685917
| 0.676602
| 108
| 23.851852
| 25.312057
| 107
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.546296
| false
| false
|
13
|
8b0c833a89e37bb109aebba18d11baf6179876ee
| 34,849,364,645,181
|
89e347064122d7ca33d9efd80e415d70458c15d5
|
/src/main/java/org/young/sso/sdk/autoprop/WeixinProperties.java
|
07a22014cab6996ea0da694f09e596b7669a1c73
|
[] |
no_license
|
shersfy/sso-sdk
|
https://github.com/shersfy/sso-sdk
|
18a71e1e519de7d9b44c8fe3cdaf0729e70c761b
|
9a4475356068ac9656814bd148267370f9a40aa6
|
refs/heads/master
| 2022-06-23T10:12:54.512000
| 2020-08-14T09:37:31
| 2020-08-14T09:37:31
| 249,894,914
| 1
| 0
| null | false
| 2022-06-17T03:05:39
| 2020-03-25T05:30:49
| 2020-08-14T09:37:44
| 2022-06-17T03:05:38
| 166
| 1
| 0
| 4
|
Java
| false
| false
|
package org.young.sso.sdk.autoprop;
import java.net.URLEncoder;
import java.text.MessageFormat;
/**
* 微信扫码登录配置
* @author Young
* @date 2020-08-12
*/
public class WeixinProperties {
/**
* 服务商的corpid
*/
private String corpid;
/**
* 服务商的secret,在服务商管理后台可见
*/
private String providerSecret;
/**
* 扫码登录地址
*/
private String loginUri = "https://open.work.weixin.qq.com/wwopen/sso/3rd_qrConnect?appid={0}&redirect_uri={1}";
public String getCorpid() {
return corpid;
}
public void setCorpid(String corpid) {
this.corpid = corpid;
}
public String getProviderSecret() {
return providerSecret;
}
public void setProviderSecret(String providerSecret) {
this.providerSecret = providerSecret;
}
public void setLoginUri(String loginUri) {
this.loginUri = loginUri;
}
public String getLoginUri() {
return loginUri;
}
public String getLoginUri(String callback) {
try {
callback = URLEncoder.encode(callback, "UTF-8");
} catch (Exception e) {
}
return MessageFormat.format(this.loginUri, this.corpid, callback);
}
}
|
UTF-8
|
Java
| 1,140
|
java
|
WeixinProperties.java
|
Java
|
[
{
"context": "va.text.MessageFormat;\n\n/**\n * 微信扫码登录配置\n * @author Young\n * @date 2020-08-12\n */\npublic class WeixinProper",
"end": 130,
"score": 0.9819775819778442,
"start": 125,
"tag": "USERNAME",
"value": "Young"
}
] | null |
[] |
package org.young.sso.sdk.autoprop;
import java.net.URLEncoder;
import java.text.MessageFormat;
/**
* 微信扫码登录配置
* @author Young
* @date 2020-08-12
*/
public class WeixinProperties {
/**
* 服务商的corpid
*/
private String corpid;
/**
* 服务商的secret,在服务商管理后台可见
*/
private String providerSecret;
/**
* 扫码登录地址
*/
private String loginUri = "https://open.work.weixin.qq.com/wwopen/sso/3rd_qrConnect?appid={0}&redirect_uri={1}";
public String getCorpid() {
return corpid;
}
public void setCorpid(String corpid) {
this.corpid = corpid;
}
public String getProviderSecret() {
return providerSecret;
}
public void setProviderSecret(String providerSecret) {
this.providerSecret = providerSecret;
}
public void setLoginUri(String loginUri) {
this.loginUri = loginUri;
}
public String getLoginUri() {
return loginUri;
}
public String getLoginUri(String callback) {
try {
callback = URLEncoder.encode(callback, "UTF-8");
} catch (Exception e) {
}
return MessageFormat.format(this.loginUri, this.corpid, callback);
}
}
| 1,140
| 0.697393
| 0.68622
| 60
| 16.9
| 20.836426
| 113
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.2
| false
| false
|
13
|
6c7edae0e3c595ec6cb8be8bb0494cee15d47046
| 18,373,870,100,645
|
4736f6bb5565d291c31f9181cde238eda0bb0f18
|
/MyExamples/Ejb/Ejb/one-to-many/EntityBeanCMR/emp/EmployeeHome.java
|
2500039416d2827336c7623527f12e13bd586e23
|
[] |
no_license
|
mrshravan/my.examples
|
https://github.com/mrshravan/my.examples
|
7e15575c6903d3851b65a037ba5b2739fe9b4173
|
20f7acbc028c7e8c51e83af32118b5758f9137a6
|
refs/heads/master
| 2021-01-19T08:42:57.225000
| 2014-11-30T21:02:42
| 2014-11-30T21:02:42
| 11,610,407
| 2
| 1
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package emp;
import javax.ejb.*;
import java.util.*;
public interface EmployeeHome extends javax.ejb.EJBLocalHome
{
public Employee create(String name,float sal) throws CreateException;
public Employee findByPrimaryKey(Integer pk) throws FinderException;
}
|
UTF-8
|
Java
| 265
|
java
|
EmployeeHome.java
|
Java
|
[] | null |
[] |
package emp;
import javax.ejb.*;
import java.util.*;
public interface EmployeeHome extends javax.ejb.EJBLocalHome
{
public Employee create(String name,float sal) throws CreateException;
public Employee findByPrimaryKey(Integer pk) throws FinderException;
}
| 265
| 0.796226
| 0.796226
| 9
| 28.555555
| 29.139935
| 73
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.666667
| false
| false
|
13
|
fa4bd6de215530a5c643ef2efad79723ac6e238e
| 34,041,910,800,753
|
224cbc420428c373bd3d96c9525df5da4df1d5a2
|
/src/com/javarush/test/level08/lesson11/home06/Solution.java
|
00ba9cd87d0c7aed6d42ee372f3e905e333781e5
|
[] |
no_license
|
DenisS2/JavaRushHomeWork
|
https://github.com/DenisS2/JavaRushHomeWork
|
94b3e8c7ab1a05f3d2bbcd556a8075097edc9203
|
dc3ddc79a19469c7e616058cc853f0373ac946f7
|
refs/heads/master
| 2017-12-20T13:33:28.371000
| 2017-11-14T22:36:56
| 2017-11-14T22:37:01
| 76,677,011
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.javarush.test.level08.lesson11.home06;
/* Вся семья в сборе
1. Создай класс Human с полями имя (String), пол (boolean), возраст (int), дети (ArrayList<Human>).
2. Создай объекты и заполни их так, чтобы получилось: два дедушки, две бабушки, отец, мать, трое детей.
3. Вывести все объекты Human на экран.
*/
import java.util.ArrayList;
public class Solution
{
public static void main(String[] args)
{
ArrayList<Human> childrenList = new ArrayList<Human>();
ArrayList<Human> motherList =new ArrayList<Human>();
ArrayList<Human> fatherList = new ArrayList<Human>();
ArrayList<Human> clear =new ArrayList<Human>();
Human grandfather1= new Human("Ivan", true,88, fatherList);
Human grandfather2= new Human("Petr", true,90, fatherList);
Human grandmother1= new Human("Ira", false,80, motherList);
Human grandmother2= new Human("Masha", false,81, motherList);
Human father= new Human("Dima", true,35, childrenList);
Human mother= new Human("Olesy", false,30, childrenList);
Human children1= new Human("Sveta", false,10, clear);
Human children2= new Human("Andrey", true,2, clear);
Human children3= new Human("Anna", false,5, clear);
childrenList.add(children1);
childrenList.add(children2);
childrenList.add(children3);
motherList.add(mother);
fatherList.add(father);
System.out.println(grandfather1);
System.out.println(grandfather2);
System.out.println(grandmother1);
System.out.println(grandmother2);
System.out.println(father);
System.out.println(mother);
System.out.println(children1);
System.out.println(children2);
System.out.println(children3);
}
public static class Human
{
String name;
boolean sex;
int age;
ArrayList<Human> children;
public Human(String name, boolean sex, int age, ArrayList<Human> children)
{
this.name=name;
this.sex=sex;
this.age=age;
this.children =children;
}
public Human(String name, boolean sex, int age)
{
this.name=name;
this.sex=sex;
this.age=age;
}
public String toString()
{
String text = "";
text += "Имя: " + this.name;
text += ", пол: " + (this.sex ? "мужской" : "женский");
text += ", возраст: " + this.age;
int childCount = this.children.size();
if (childCount > 0)
{
text += ", дети: "+this.children.get(0).name;
for (int i = 1; i < childCount; i++)
{
Human child = this.children.get(i);
text += ", "+child.name;
}
}
return text;
}
}
}
|
UTF-8
|
Java
| 3,102
|
java
|
Solution.java
|
Java
|
[
{
"context": "uman>();\n\n\n Human grandfather1= new Human(\"Ivan\", true,88, fatherList);\n Human grandfather",
"end": 710,
"score": 0.9997542500495911,
"start": 706,
"tag": "NAME",
"value": "Ivan"
},
{
"context": "therList);\n Human grandfather2= new Human(\"Petr\", true,90, fatherList);\n Human grandmother",
"end": 778,
"score": 0.9997695684432983,
"start": 774,
"tag": "NAME",
"value": "Petr"
},
{
"context": "therList);\n Human grandmother1= new Human(\"Ira\", false,80, motherList);\n Human grandmothe",
"end": 845,
"score": 0.9996941685676575,
"start": 842,
"tag": "NAME",
"value": "Ira"
},
{
"context": "therList);\n Human grandmother2= new Human(\"Masha\", false,81, motherList);\n Human father= ne",
"end": 915,
"score": 0.9997811317443848,
"start": 910,
"tag": "NAME",
"value": "Masha"
},
{
"context": "81, motherList);\n Human father= new Human(\"Dima\", true,35, childrenList);\n Human mother= n",
"end": 978,
"score": 0.9996947050094604,
"start": 974,
"tag": "NAME",
"value": "Dima"
},
{
"context": ", childrenList);\n Human mother= new Human(\"Olesy\", false,30, childrenList);\n Human children",
"end": 1043,
"score": 0.9996979236602783,
"start": 1038,
"tag": "NAME",
"value": "Olesy"
},
{
"context": "hildrenList);\n Human children1= new Human(\"Sveta\", false,10, clear);\n Human children2= new ",
"end": 1112,
"score": 0.9996637105941772,
"start": 1107,
"tag": "NAME",
"value": "Sveta"
},
{
"context": "e,10, clear);\n Human children2= new Human(\"Andrey\", true,2, clear);\n Human children3= new Hu",
"end": 1175,
"score": 0.9996210336685181,
"start": 1169,
"tag": "NAME",
"value": "Andrey"
},
{
"context": "ue,2, clear);\n Human children3= new Human(\"Anna\", false,5, clear);\n childrenList.add(child",
"end": 1234,
"score": 0.9997363686561584,
"start": 1230,
"tag": "NAME",
"value": "Anna"
}
] | null |
[] |
package com.javarush.test.level08.lesson11.home06;
/* Вся семья в сборе
1. Создай класс Human с полями имя (String), пол (boolean), возраст (int), дети (ArrayList<Human>).
2. Создай объекты и заполни их так, чтобы получилось: два дедушки, две бабушки, отец, мать, трое детей.
3. Вывести все объекты Human на экран.
*/
import java.util.ArrayList;
public class Solution
{
public static void main(String[] args)
{
ArrayList<Human> childrenList = new ArrayList<Human>();
ArrayList<Human> motherList =new ArrayList<Human>();
ArrayList<Human> fatherList = new ArrayList<Human>();
ArrayList<Human> clear =new ArrayList<Human>();
Human grandfather1= new Human("Ivan", true,88, fatherList);
Human grandfather2= new Human("Petr", true,90, fatherList);
Human grandmother1= new Human("Ira", false,80, motherList);
Human grandmother2= new Human("Masha", false,81, motherList);
Human father= new Human("Dima", true,35, childrenList);
Human mother= new Human("Olesy", false,30, childrenList);
Human children1= new Human("Sveta", false,10, clear);
Human children2= new Human("Andrey", true,2, clear);
Human children3= new Human("Anna", false,5, clear);
childrenList.add(children1);
childrenList.add(children2);
childrenList.add(children3);
motherList.add(mother);
fatherList.add(father);
System.out.println(grandfather1);
System.out.println(grandfather2);
System.out.println(grandmother1);
System.out.println(grandmother2);
System.out.println(father);
System.out.println(mother);
System.out.println(children1);
System.out.println(children2);
System.out.println(children3);
}
public static class Human
{
String name;
boolean sex;
int age;
ArrayList<Human> children;
public Human(String name, boolean sex, int age, ArrayList<Human> children)
{
this.name=name;
this.sex=sex;
this.age=age;
this.children =children;
}
public Human(String name, boolean sex, int age)
{
this.name=name;
this.sex=sex;
this.age=age;
}
public String toString()
{
String text = "";
text += "Имя: " + this.name;
text += ", пол: " + (this.sex ? "мужской" : "женский");
text += ", возраст: " + this.age;
int childCount = this.children.size();
if (childCount > 0)
{
text += ", дети: "+this.children.get(0).name;
for (int i = 1; i < childCount; i++)
{
Human child = this.children.get(i);
text += ", "+child.name;
}
}
return text;
}
}
}
| 3,102
| 0.57226
| 0.556849
| 95
| 29.736841
| 24.825798
| 103
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| false
| false
|
13
|
5d0f043598558a783925329d5f844f446ee83fcc
| 16,836,271,867,737
|
4a8568f70e25c45ee81ef286864657b87e6977dd
|
/Exercicios/src/org/lista/lista3/ParOuImapar.java
|
d8e072e969b58405cf32d6f814e1c8c2ccac4870
|
[] |
no_license
|
ViniciusROReis07/Aulas-de-FPOO
|
https://github.com/ViniciusROReis07/Aulas-de-FPOO
|
06aaf81622684933efafa3a8c0585827eca077eb
|
a60d636694ba44f3376a11b120d8013cb11614af
|
refs/heads/master
| 2022-02-04T08:00:57.908000
| 2022-01-29T03:06:41
| 2022-01-29T03:06:41
| 239,762,500
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.lista.lista3;
import java.util.InputMismatchException;
import java.util.Scanner;
public class ParOuImapar {
public static void main(String[] args) {
Scanner ler=new Scanner(System.in);
try {
System.out.print("Informe o valor: ");
double valor=ler.nextDouble();
if(valor%2==0) {
System.out.println("Este numero e par");
}else {
System.out.println("Este numero e impar");
}
}catch(InputMismatchException erro) {
System.out.println("Informe apenas numeros");
}catch(Exception erro) {
System.out.println("Erro nao indendificado");
}
ler.close();
}
}
|
UTF-8
|
Java
| 614
|
java
|
ParOuImapar.java
|
Java
|
[] | null |
[] |
package org.lista.lista3;
import java.util.InputMismatchException;
import java.util.Scanner;
public class ParOuImapar {
public static void main(String[] args) {
Scanner ler=new Scanner(System.in);
try {
System.out.print("Informe o valor: ");
double valor=ler.nextDouble();
if(valor%2==0) {
System.out.println("Este numero e par");
}else {
System.out.println("Este numero e impar");
}
}catch(InputMismatchException erro) {
System.out.println("Informe apenas numeros");
}catch(Exception erro) {
System.out.println("Erro nao indendificado");
}
ler.close();
}
}
| 614
| 0.677524
| 0.672638
| 28
| 20.928572
| 17.618839
| 48
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 2.178571
| false
| false
|
13
|
86cca78651c40cf857cd73fa5a9d8fee38b6e587
| 18,786,187,012,026
|
54359ba64aa9607badcbb5849cca9af86dc78c48
|
/mylogin1.java
|
78bfcc9c9b131638d5316c348bf21902a42741a4
|
[] |
no_license
|
narayani11wanve/signupform
|
https://github.com/narayani11wanve/signupform
|
6e9dfff4882ad7e75d606331cf040bc185225d45
|
bea6ea686631aa8355872c4b0f4a0eaced3cc623
|
refs/heads/main
| 2023-04-19T17:18:30.296000
| 2021-05-19T08:40:04
| 2021-05-19T08:40:04
| 368,799,671
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package cybercafe;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.regex.Pattern;
import javax.swing.JOptionPane;
public class mylogin1 extends javax.swing.JFrame {
public mylogin1() {
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jPanel5 = new javax.swing.JPanel();
jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
jLabel17 = new javax.swing.JLabel();
jLabel18 = new javax.swing.JLabel();
jPanel4 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
txt_password = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
txt_username = new javax.swing.JTextField();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
t1 = new javax.swing.JLabel();
txt_email = new javax.swing.JTextField();
jPanel2.setBackground(new java.awt.Color(255, 255, 255));
jLabel1.setText("jLabel1");
jLabel2.setBackground(new java.awt.Color(255, 51, 102));
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel2.setText(" Welcome Back");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 486, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(178, 178, 178)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(208, 208, 208)
.addComponent(jLabel3)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 215, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel3)
.addContainerGap(395, Short.MAX_VALUE))
);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(111, 88, -1, -1));
jPanel5.setBackground(new java.awt.Color(204, 0, 102));
jLabel11.setText("jLabel11");
jLabel12.setFont(new java.awt.Font("Sakkal Majalla", 0, 40)); // NOI18N
jLabel12.setForeground(new java.awt.Color(255, 255, 255));
jLabel12.setText("UNIQUE");
jLabel13.setFont(new java.awt.Font("Vivaldi", 1, 40)); // NOI18N
jLabel13.setForeground(new java.awt.Color(255, 255, 255));
jLabel13.setText(" Login");
jLabel14.setFont(new java.awt.Font("Segoe UI Semilight", 0, 24)); // NOI18N
jLabel14.setForeground(new java.awt.Color(255, 255, 255));
jLabel14.setText("Developer");
jLabel15.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel15.setForeground(new java.awt.Color(255, 255, 255));
jLabel16.setFont(new java.awt.Font("Times New Roman", 1, 40)); // NOI18N
jLabel16.setForeground(new java.awt.Color(255, 255, 255));
jLabel16.setText(" Here");
jLabel17.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
jLabel17.setForeground(new java.awt.Color(255, 255, 255));
jLabel17.setText("Welcome");
jLabel18.setIcon(new javax.swing.ImageIcon("C:\\Users\\narayani anil wanve\\Downloads\\images (9).jpg")); // NOI18N
jLabel18.setText("jLabel18");
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(90, 90, 90))
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(23, 23, 23)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(69, 69, 69)
.addComponent(jLabel17)
.addGap(366, 366, 366)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(31, 31, 31))))
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(32, 32, 32)
.addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 306, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(51, 51, 51)
.addComponent(jLabel15)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel13)
.addComponent(jLabel16))
.addGap(270, 270, 270))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
.addComponent(jLabel18)
.addGap(48, 48, 48)))
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jLabel11)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(61, 61, 61)
.addComponent(jLabel12))
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(115, 115, 115)
.addComponent(jLabel14))))
.addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(270, Short.MAX_VALUE))
);
getContentPane().add(jPanel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 410, 810));
jPanel4.setBackground(new java.awt.Color(255, 255, 255));
jPanel4.setForeground(new java.awt.Color(255, 255, 255));
jLabel5.setBackground(new java.awt.Color(255, 0, 51));
jLabel5.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
jLabel5.setForeground(new java.awt.Color(255, 0, 51));
jLabel5.setText("Welcome");
jLabel6.setFont(new java.awt.Font("Segoe UI", 1, 20)); // NOI18N
jLabel6.setText("Password:");
jLabel7.setFont(new java.awt.Font("Segoe UI Semilight", 1, 18)); // NOI18N
jLabel7.setText("Sign in to continue");
txt_password.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
txt_password.setForeground(new java.awt.Color(153, 153, 153));
txt_password.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(0, 0, 0)));
txt_password.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txt_passwordActionPerformed(evt);
}
});
jLabel8.setFont(new java.awt.Font("Segoe UI", 1, 20)); // NOI18N
jLabel8.setText("Username:");
txt_username.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
txt_username.setForeground(new java.awt.Color(153, 153, 153));
txt_username.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(0, 0, 0)));
txt_username.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txt_usernameActionPerformed(evt);
}
});
jLabel9.setFont(new java.awt.Font("Segoe UI Semilight", 1, 20)); // NOI18N
jLabel9.setText("New user?");
jLabel10.setFont(new java.awt.Font("Segoe UI Semilight", 1, 20)); // NOI18N
jLabel10.setText("Signup");
jLabel10.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel10MouseClicked(evt);
}
});
jLabel4.setIcon(new javax.swing.ImageIcon("C:\\Users\\narayani anil wanve\\Downloads\\images (9).jpg")); // NOI18N
jLabel4.setText("jLabel4");
jButton1.setBackground(new java.awt.Color(255, 255, 255));
jButton1.setFont(new java.awt.Font("Segoe UI Semilight", 1, 24)); // NOI18N
jButton1.setForeground(new java.awt.Color(255, 51, 51));
jButton1.setText("LOGIN");
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton1MouseClicked(evt);
}
});
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
t1.setFont(new java.awt.Font("Segoe UI", 1, 20)); // NOI18N
t1.setText("EMAIL:");
txt_email.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
txt_email.setForeground(new java.awt.Color(153, 153, 153));
txt_email.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(0, 0, 0)));
txt_email.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txt_emailActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
.addGap(0, 113, Short.MAX_VALUE)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 192, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(138, 138, 138))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 315, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(62, 62, 62))))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(28, 28, 28))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(29, 29, 29)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txt_username, javax.swing.GroupLayout.PREFERRED_SIZE, 202, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txt_email, javax.swing.GroupLayout.PREFERRED_SIZE, 202, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(t1, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txt_password, javax.swing.GroupLayout.PREFERRED_SIZE, 202, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(178, 178, 178)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(45, 45, 45)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 174, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel5)
.addGap(48, 48, 48)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(38, 38, 38)
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txt_username, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(t1, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(txt_email, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(26, 26, 26)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(31, 31, 31)
.addComponent(txt_password, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(61, 61, 61))
);
getContentPane().add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 0, 490, 810));
setSize(new java.awt.Dimension(917, 853));
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void txt_passwordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txt_passwordActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txt_passwordActionPerformed
private void txt_usernameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txt_usernameActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txt_usernameActionPerformed
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
}//GEN-LAST:event_jButton1MouseClicked
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
String emailRegex = "^[a-zA-Z0-9_+&*-]+(?:\\."+
"[a-zA-Z0-9_+&-]+)@" +
"(?:[a-zA-Z0-9-]+\\.)+[a-z" +
"A-Z]{2,7}$";
Pattern pat = Pattern.compile(emailRegex);
String email=t1.getText();
if (pat.matcher(email).matches())
{
System.out.println("valid mail id");
}
else
{
System.out.println("Invalid mail id");
}
try{
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/cyber_cafe","root","");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from login");
String uid;
String pid;
int uidc=0;
uid=txt_username.getText();
pid=txt_password.getText();
while(rs.next())
{
if(uid.equals(rs.getString(1)) && pid.equals(rs.getString(2)))
{
uidc=1;
break;
}
}
if(uidc==1)
{
JOptionPane.showConfirmDialog(null,"login successfully");
new homepage().setVisible(true);
}
else
{
JOptionPane.showConfirmDialog(null,"invalid user");
}
}
catch(SQLException we)
{
System.out.println(we);
}
}//GEN-LAST:event_jButton1ActionPerformed
private void jLabel10MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel10MouseClicked
new signup().setVisible(true);
}//GEN-LAST:event_jLabel10MouseClicked
private void txt_emailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txt_emailActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txt_emailActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(mylogin1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(mylogin1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(mylogin1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(mylogin1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new mylogin1().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JLabel t1;
private javax.swing.JTextField txt_email;
private javax.swing.JTextField txt_password;
private javax.swing.JTextField txt_username;
// End of variables declaration//GEN-END:variables
}
|
UTF-8
|
Java
| 24,711
|
java
|
mylogin1.java
|
Java
|
[
{
"context": "1\");\n\n jLabel12.setFont(new java.awt.Font(\"Sakkal Majalla\", 0, 40)); // NOI18N\n jLabel12.setForegrou",
"end": 4404,
"score": 0.9996991157531738,
"start": 4390,
"tag": "NAME",
"value": "Sakkal Majalla"
},
{
"context": "l18.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\narayani anil wanve\\\\Downloads\\\\images (9).jpg\")); // NOI18N\n ",
"end": 5481,
"score": 0.9894004464149475,
"start": 5462,
"tag": "NAME",
"value": "narayani anil wanve"
},
{
"context": "el4.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\narayani anil wanve\\\\Downloads\\\\images (9).jpg\")); // NOI18N\n ",
"end": 12441,
"score": 0.9996572732925415,
"start": 12422,
"tag": "NAME",
"value": "narayani anil wanve"
},
{
"context": "_password;\n private javax.swing.JTextField txt_username;\n // End of variables declaration//GEN-END:var",
"end": 24652,
"score": 0.688984751701355,
"start": 24644,
"tag": "USERNAME",
"value": "username"
}
] | null |
[] |
package cybercafe;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.regex.Pattern;
import javax.swing.JOptionPane;
public class mylogin1 extends javax.swing.JFrame {
public mylogin1() {
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jPanel5 = new javax.swing.JPanel();
jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
jLabel17 = new javax.swing.JLabel();
jLabel18 = new javax.swing.JLabel();
jPanel4 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
txt_password = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
txt_username = new javax.swing.JTextField();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
t1 = new javax.swing.JLabel();
txt_email = new javax.swing.JTextField();
jPanel2.setBackground(new java.awt.Color(255, 255, 255));
jLabel1.setText("jLabel1");
jLabel2.setBackground(new java.awt.Color(255, 51, 102));
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel2.setText(" Welcome Back");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 486, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(178, 178, 178)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(208, 208, 208)
.addComponent(jLabel3)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 215, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel3)
.addContainerGap(395, Short.MAX_VALUE))
);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(111, 88, -1, -1));
jPanel5.setBackground(new java.awt.Color(204, 0, 102));
jLabel11.setText("jLabel11");
jLabel12.setFont(new java.awt.Font("<NAME>", 0, 40)); // NOI18N
jLabel12.setForeground(new java.awt.Color(255, 255, 255));
jLabel12.setText("UNIQUE");
jLabel13.setFont(new java.awt.Font("Vivaldi", 1, 40)); // NOI18N
jLabel13.setForeground(new java.awt.Color(255, 255, 255));
jLabel13.setText(" Login");
jLabel14.setFont(new java.awt.Font("Segoe UI Semilight", 0, 24)); // NOI18N
jLabel14.setForeground(new java.awt.Color(255, 255, 255));
jLabel14.setText("Developer");
jLabel15.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel15.setForeground(new java.awt.Color(255, 255, 255));
jLabel16.setFont(new java.awt.Font("Times New Roman", 1, 40)); // NOI18N
jLabel16.setForeground(new java.awt.Color(255, 255, 255));
jLabel16.setText(" Here");
jLabel17.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
jLabel17.setForeground(new java.awt.Color(255, 255, 255));
jLabel17.setText("Welcome");
jLabel18.setIcon(new javax.swing.ImageIcon("C:\\Users\\<NAME>\\Downloads\\images (9).jpg")); // NOI18N
jLabel18.setText("jLabel18");
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(90, 90, 90))
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(23, 23, 23)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(69, 69, 69)
.addComponent(jLabel17)
.addGap(366, 366, 366)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(31, 31, 31))))
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(32, 32, 32)
.addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 306, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(51, 51, 51)
.addComponent(jLabel15)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel13)
.addComponent(jLabel16))
.addGap(270, 270, 270))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
.addComponent(jLabel18)
.addGap(48, 48, 48)))
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jLabel11)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(61, 61, 61)
.addComponent(jLabel12))
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(115, 115, 115)
.addComponent(jLabel14))))
.addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(270, Short.MAX_VALUE))
);
getContentPane().add(jPanel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 410, 810));
jPanel4.setBackground(new java.awt.Color(255, 255, 255));
jPanel4.setForeground(new java.awt.Color(255, 255, 255));
jLabel5.setBackground(new java.awt.Color(255, 0, 51));
jLabel5.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
jLabel5.setForeground(new java.awt.Color(255, 0, 51));
jLabel5.setText("Welcome");
jLabel6.setFont(new java.awt.Font("Segoe UI", 1, 20)); // NOI18N
jLabel6.setText("Password:");
jLabel7.setFont(new java.awt.Font("Segoe UI Semilight", 1, 18)); // NOI18N
jLabel7.setText("Sign in to continue");
txt_password.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
txt_password.setForeground(new java.awt.Color(153, 153, 153));
txt_password.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(0, 0, 0)));
txt_password.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txt_passwordActionPerformed(evt);
}
});
jLabel8.setFont(new java.awt.Font("Segoe UI", 1, 20)); // NOI18N
jLabel8.setText("Username:");
txt_username.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
txt_username.setForeground(new java.awt.Color(153, 153, 153));
txt_username.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(0, 0, 0)));
txt_username.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txt_usernameActionPerformed(evt);
}
});
jLabel9.setFont(new java.awt.Font("Segoe UI Semilight", 1, 20)); // NOI18N
jLabel9.setText("New user?");
jLabel10.setFont(new java.awt.Font("Segoe UI Semilight", 1, 20)); // NOI18N
jLabel10.setText("Signup");
jLabel10.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel10MouseClicked(evt);
}
});
jLabel4.setIcon(new javax.swing.ImageIcon("C:\\Users\\<NAME>\\Downloads\\images (9).jpg")); // NOI18N
jLabel4.setText("jLabel4");
jButton1.setBackground(new java.awt.Color(255, 255, 255));
jButton1.setFont(new java.awt.Font("Segoe UI Semilight", 1, 24)); // NOI18N
jButton1.setForeground(new java.awt.Color(255, 51, 51));
jButton1.setText("LOGIN");
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton1MouseClicked(evt);
}
});
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
t1.setFont(new java.awt.Font("Segoe UI", 1, 20)); // NOI18N
t1.setText("EMAIL:");
txt_email.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
txt_email.setForeground(new java.awt.Color(153, 153, 153));
txt_email.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(0, 0, 0)));
txt_email.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txt_emailActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
.addGap(0, 113, Short.MAX_VALUE)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 192, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(138, 138, 138))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 315, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(62, 62, 62))))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(28, 28, 28))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(29, 29, 29)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txt_username, javax.swing.GroupLayout.PREFERRED_SIZE, 202, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txt_email, javax.swing.GroupLayout.PREFERRED_SIZE, 202, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(t1, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txt_password, javax.swing.GroupLayout.PREFERRED_SIZE, 202, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(178, 178, 178)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(45, 45, 45)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 174, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel5)
.addGap(48, 48, 48)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(38, 38, 38)
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txt_username, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(t1, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(txt_email, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(26, 26, 26)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(31, 31, 31)
.addComponent(txt_password, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(61, 61, 61))
);
getContentPane().add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 0, 490, 810));
setSize(new java.awt.Dimension(917, 853));
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void txt_passwordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txt_passwordActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txt_passwordActionPerformed
private void txt_usernameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txt_usernameActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txt_usernameActionPerformed
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
}//GEN-LAST:event_jButton1MouseClicked
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
String emailRegex = "^[a-zA-Z0-9_+&*-]+(?:\\."+
"[a-zA-Z0-9_+&-]+)@" +
"(?:[a-zA-Z0-9-]+\\.)+[a-z" +
"A-Z]{2,7}$";
Pattern pat = Pattern.compile(emailRegex);
String email=t1.getText();
if (pat.matcher(email).matches())
{
System.out.println("valid mail id");
}
else
{
System.out.println("Invalid mail id");
}
try{
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/cyber_cafe","root","");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from login");
String uid;
String pid;
int uidc=0;
uid=txt_username.getText();
pid=txt_password.getText();
while(rs.next())
{
if(uid.equals(rs.getString(1)) && pid.equals(rs.getString(2)))
{
uidc=1;
break;
}
}
if(uidc==1)
{
JOptionPane.showConfirmDialog(null,"login successfully");
new homepage().setVisible(true);
}
else
{
JOptionPane.showConfirmDialog(null,"invalid user");
}
}
catch(SQLException we)
{
System.out.println(we);
}
}//GEN-LAST:event_jButton1ActionPerformed
private void jLabel10MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel10MouseClicked
new signup().setVisible(true);
}//GEN-LAST:event_jLabel10MouseClicked
private void txt_emailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txt_emailActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txt_emailActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(mylogin1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(mylogin1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(mylogin1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(mylogin1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new mylogin1().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JLabel t1;
private javax.swing.JTextField txt_email;
private javax.swing.JTextField txt_password;
private javax.swing.JTextField txt_username;
// End of variables declaration//GEN-END:variables
}
| 24,677
| 0.639189
| 0.602282
| 475
| 51.023159
| 37.7752
| 155
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.035789
| false
| false
|
13
|
72a14b6e61a70f1598d517bc241a2b4891c79e8c
| 23,587,960,434,736
|
1f3c9ffac38fc23ff9cdda92df23c1ac26489fab
|
/jms-responder-indlistener/src/main/java/org/apache/activemq/recipes/ResponderExample.java
|
4b44a7d2d85ba6fd95d1bbc72efba2357fd75dc0
|
[] |
no_license
|
BBK-PiJ-2015-10/ActiveMQBook
|
https://github.com/BBK-PiJ-2015-10/ActiveMQBook
|
31b79d9df838020dc25ede2a8523acbbfa7e005c
|
dca7b4507cc1aa187c584e959468c31233ac4c70
|
refs/heads/master
| 2020-03-28T09:24:54.494000
| 2018-09-09T14:48:25
| 2018-09-09T14:48:25
| 148,034,978
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.apache.activemq.recipes;
import java.util.concurrent.TimeUnit;
import javax.jms.Connection;
import javax.jms.Session;
import javax.jms.MessageConsumer;
import javax.jms.Destination;
import javax.jms.JMSException;
import org.apache.activemq.ActiveMQConnectionFactory;
public class ResponderExample {
private final String connectionUri = "tcp://localhost:61616";
private ActiveMQConnectionFactory connectionFactory;
private Connection connection;
private Session session;
private Destination destination;
private MessageConsumer requestConsumer;
public void before() throws JMSException{
connectionFactory= new ActiveMQConnectionFactory(connectionUri);
connection = connectionFactory.createConnection();
connection.start();
session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
destination = session.createQueue("REQUEST.QUEUE");
requestConsumer = session.createConsumer(destination);
requestConsumer.setMessageListener(new ResponderListener(session,session.createProducer(null)));
}
public void after() throws JMSException {
if (connection !=null){
connection.close();
}
}
public void run() throws InterruptedException {
TimeUnit.MINUTES.sleep(3);
}
public static void main(String[] args) {
ResponderExample example = new ResponderExample();
System.out.println("\n\n\n");
System.out.println("Starting second responder now");
try {
example.before();
example.run();
example.after();
} catch (Exception e){
System.out.println("Caught an exception during the example: " +e.getMessage());
}
System.out.println("Finished running the Responder II example");
System.out.println("\n\n\n");
}
}
|
UTF-8
|
Java
| 1,882
|
java
|
ResponderExample.java
|
Java
|
[] | null |
[] |
package org.apache.activemq.recipes;
import java.util.concurrent.TimeUnit;
import javax.jms.Connection;
import javax.jms.Session;
import javax.jms.MessageConsumer;
import javax.jms.Destination;
import javax.jms.JMSException;
import org.apache.activemq.ActiveMQConnectionFactory;
public class ResponderExample {
private final String connectionUri = "tcp://localhost:61616";
private ActiveMQConnectionFactory connectionFactory;
private Connection connection;
private Session session;
private Destination destination;
private MessageConsumer requestConsumer;
public void before() throws JMSException{
connectionFactory= new ActiveMQConnectionFactory(connectionUri);
connection = connectionFactory.createConnection();
connection.start();
session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
destination = session.createQueue("REQUEST.QUEUE");
requestConsumer = session.createConsumer(destination);
requestConsumer.setMessageListener(new ResponderListener(session,session.createProducer(null)));
}
public void after() throws JMSException {
if (connection !=null){
connection.close();
}
}
public void run() throws InterruptedException {
TimeUnit.MINUTES.sleep(3);
}
public static void main(String[] args) {
ResponderExample example = new ResponderExample();
System.out.println("\n\n\n");
System.out.println("Starting second responder now");
try {
example.before();
example.run();
example.after();
} catch (Exception e){
System.out.println("Caught an exception during the example: " +e.getMessage());
}
System.out.println("Finished running the Responder II example");
System.out.println("\n\n\n");
}
}
| 1,882
| 0.688098
| 0.68491
| 59
| 30.898306
| 25.507523
| 104
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.576271
| false
| false
|
13
|
6a65f602f69231f93324e627dade63f05768c9c7
| 31,129,923,007,913
|
3c178b1dbb44237afe8d435336a265a73f4d66ea
|
/com/google/wireless/gdata/serializer/GDataSerializer.java
|
971d6243a7e6ee939e301344a5ee2de08e961178
|
[] |
no_license
|
AndroidSDKSources/android-sdk-sources-for-api-level-5
|
https://github.com/AndroidSDKSources/android-sdk-sources-for-api-level-5
|
b7806884853389ff288b3adbdaf28f14893549a0
|
baef9e37c1298f278f4fc212b9910810bf262a0b
|
refs/heads/master
| 2021-01-15T15:05:15.383000
| 2015-06-13T15:27:01
| 2015-06-13T15:27:01
| 37,376,449
| 3
| 2
| null | null | null | null | null | null | null | null | null | null | null | null | null |
// Copyright 2007 The Android Open Source Project
package com.google.wireless.gdata.serializer;
import com.google.wireless.gdata.parser.ParseException;
import java.io.IOException;
import java.io.OutputStream;
/**
* Interface for serializing GData entries.
*/
public interface GDataSerializer {
// TODO: I hope the three formats does not bite us. Each serializer has
// to pay attention to what "mode" it is in when serializing.
/**
* Serialize all data in the entry. Used for debugging.
*/
public static final int FORMAT_FULL = 0;
/**
* Serialize only the data necessary for creating a new entry.
*/
public static final int FORMAT_CREATE = 1;
/**
* Serialize only the data necessary for updating an existing entry.
*/
public static final int FORMAT_UPDATE = 2;
/**
* Returns the Content-Type for this serialization format.
* @return The Content-Type for this serialization format.
*/
String getContentType();
/**
* Serializes a GData entry to the provided {@link OutputStream}, using the
* specified serialization format.
*
* @see #FORMAT_FULL
* @see #FORMAT_CREATE
* @see #FORMAT_UPDATE
*
* @param out The {@link OutputStream} to which the entry should be
* serialized.
* @param format The format of the serialized output.
* @throws IOException Thrown if there is an issue writing the serialized
* entry to the provided {@link OutputStream}.
* @throws ParseException Thrown if the entry cannot be serialized.
*/
void serialize(OutputStream out, int format)
throws IOException, ParseException;
}
|
UTF-8
|
Java
| 1,701
|
java
|
GDataSerializer.java
|
Java
|
[] | null |
[] |
// Copyright 2007 The Android Open Source Project
package com.google.wireless.gdata.serializer;
import com.google.wireless.gdata.parser.ParseException;
import java.io.IOException;
import java.io.OutputStream;
/**
* Interface for serializing GData entries.
*/
public interface GDataSerializer {
// TODO: I hope the three formats does not bite us. Each serializer has
// to pay attention to what "mode" it is in when serializing.
/**
* Serialize all data in the entry. Used for debugging.
*/
public static final int FORMAT_FULL = 0;
/**
* Serialize only the data necessary for creating a new entry.
*/
public static final int FORMAT_CREATE = 1;
/**
* Serialize only the data necessary for updating an existing entry.
*/
public static final int FORMAT_UPDATE = 2;
/**
* Returns the Content-Type for this serialization format.
* @return The Content-Type for this serialization format.
*/
String getContentType();
/**
* Serializes a GData entry to the provided {@link OutputStream}, using the
* specified serialization format.
*
* @see #FORMAT_FULL
* @see #FORMAT_CREATE
* @see #FORMAT_UPDATE
*
* @param out The {@link OutputStream} to which the entry should be
* serialized.
* @param format The format of the serialized output.
* @throws IOException Thrown if there is an issue writing the serialized
* entry to the provided {@link OutputStream}.
* @throws ParseException Thrown if the entry cannot be serialized.
*/
void serialize(OutputStream out, int format)
throws IOException, ParseException;
}
| 1,701
| 0.669606
| 0.665491
| 56
| 29.375
| 26.13397
| 79
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.214286
| false
| false
|
13
|
112c15ffa6a48aefd366cd5c96517cc37f1ecf16
| 35,897,336,682,966
|
1b678de657e8f26c9624e0c28ddfc6bd34283b32
|
/wxProject/src/main/java/com/sczh/systemmanage/mapper/UserMapper.java
|
03609041fa543b73c77f7a0175523ca076879549
|
[] |
no_license
|
brighthkb/ssmBasicframe
|
https://github.com/brighthkb/ssmBasicframe
|
bacefd0fc6e995742376d54396f1d742fc1e22d0
|
111bb31c15a26bc6cf710ea7e87dc41b3001a5b8
|
refs/heads/master
| 2020-03-25T13:31:17.408000
| 2018-08-07T06:53:06
| 2018-08-07T06:53:06
| 143,830,141
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.sczh.systemmanage.mapper;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository;
import com.sczh.systemmanage.model.User;
@Repository
public interface UserMapper{
/**
* 分页查询用户信息
*/
public List<User> findUserByPage(Map<String,Object> mapQuery);
/**
* 查询用户总条数
*/
public int count(Map<String,Object> mapQuery);
/**
* 查看用户信息
*/
public User viewUser(User user);
/**
* 判断是否存在用户信息
*/
public int isExist(User user);
/**
* 根据相关条件查询相关用户列表数据
* @param mapQuery
* @return
*/
public List<User> findUserBy(Map<String,Object> mapQuery);
/**
* 新增用户信息
*/
public int insert(User user);
/**
* 修改用户信息
*/
public int update(User user);
/**
* 删除用户信息
*/
public int delete(User user);
/**
* 新增用户与角色的关联
*/
public int insertRel(Map<String,Object> mapQuery);
/**
* 删除用户与角色的关联
*/
public int deleteRel(User user);
}
|
UTF-8
|
Java
| 1,100
|
java
|
UserMapper.java
|
Java
|
[] | null |
[] |
package com.sczh.systemmanage.mapper;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository;
import com.sczh.systemmanage.model.User;
@Repository
public interface UserMapper{
/**
* 分页查询用户信息
*/
public List<User> findUserByPage(Map<String,Object> mapQuery);
/**
* 查询用户总条数
*/
public int count(Map<String,Object> mapQuery);
/**
* 查看用户信息
*/
public User viewUser(User user);
/**
* 判断是否存在用户信息
*/
public int isExist(User user);
/**
* 根据相关条件查询相关用户列表数据
* @param mapQuery
* @return
*/
public List<User> findUserBy(Map<String,Object> mapQuery);
/**
* 新增用户信息
*/
public int insert(User user);
/**
* 修改用户信息
*/
public int update(User user);
/**
* 删除用户信息
*/
public int delete(User user);
/**
* 新增用户与角色的关联
*/
public int insertRel(Map<String,Object> mapQuery);
/**
* 删除用户与角色的关联
*/
public int deleteRel(User user);
}
| 1,100
| 0.650538
| 0.650538
| 63
| 13.761905
| 15.947049
| 63
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.095238
| false
| false
|
13
|
4de521e9c4b31140a0134e632467d60cdca6612e
| 36,790,689,868,598
|
b7d900ab037014eb65f638793c40b62778be7ef9
|
/src/com/mypakage/ElseIf01.java
|
91bfe60e426d35a610f073367c84ef93b5e476ac
|
[] |
no_license
|
Hussein1364/JavaClass
|
https://github.com/Hussein1364/JavaClass
|
84f3750d974401425018e62bd4690e2d3c61f8c4
|
0475f62d11b4d7e7ae22a4027c97693f9b8fc33e
|
refs/heads/main
| 2023-03-22T22:19:15.954000
| 2021-03-21T17:41:37
| 2021-03-21T17:41:37
| 346,564,785
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mypakage;
import java.util.Scanner;
public class ElseIf01 {
public static void main(String[] args) {
// TODO Auto-generated method stu
Scanner user=new Scanner(System.in);
System.out.println("enter a number");
int day=user.nextInt();
if(day==1) {
System.out.println("Monday");
}else if(day==2) {
System.out.println("Tuseday");
}else if(day==3) {
System.out.println("Wedensday");
}else if(day==4) {
System.out.println("Thersday");
}else if(day==5) {
System.out.println("Friday");
}else if(day==6) {
System.out.println("Saturday");
}else if(day==7) {
System.out.println("Sunday");
}else {
System.out.println("Invalid Input");
}
}
}
|
UTF-8
|
Java
| 708
|
java
|
ElseIf01.java
|
Java
|
[] | null |
[] |
package com.mypakage;
import java.util.Scanner;
public class ElseIf01 {
public static void main(String[] args) {
// TODO Auto-generated method stu
Scanner user=new Scanner(System.in);
System.out.println("enter a number");
int day=user.nextInt();
if(day==1) {
System.out.println("Monday");
}else if(day==2) {
System.out.println("Tuseday");
}else if(day==3) {
System.out.println("Wedensday");
}else if(day==4) {
System.out.println("Thersday");
}else if(day==5) {
System.out.println("Friday");
}else if(day==6) {
System.out.println("Saturday");
}else if(day==7) {
System.out.println("Sunday");
}else {
System.out.println("Invalid Input");
}
}
}
| 708
| 0.632768
| 0.620057
| 36
| 18.666666
| 14.466436
| 41
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.944444
| false
| false
|
13
|
6bd90ec6c9c0ee0c8f150104b3af804617755fd3
| 18,030,272,776,305
|
4f11d02b1807c4d7163fb11ef8b75993c56b33de
|
/common-toolkit/src/test/java/common/toolkit/java/entity/ConnectionTest.java
|
b803c500617b4530964ed4c9a961c3058363ca75
|
[
"Apache-2.0"
] |
permissive
|
lishuai2016/taokeeper-1
|
https://github.com/lishuai2016/taokeeper-1
|
dd564bb01c50338ae78b2340ee1c015b29c9b1ad
|
f9ba39bbd55db9ebcf80317f188e772326961a16
|
refs/heads/master
| 2017-11-30T22:15:59.943000
| 2016-08-14T09:10:33
| 2016-08-14T09:10:33
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package common.toolkit.java.entity;
import static org.junit.Assert.assertTrue;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import common.toolkit.java.entity.io.Connection;
/**
* @author 银时 yinshi.nc@taobao.com
*/
public class ConnectionTest {
@Test
public void test() {
Map< Connection, Connection > test = new HashMap< Connection, Connection >();
Connection conn1 = new Connection( "1.1.2.1", "1fd863sd5sfh3456" );
Connection conn3 = new Connection( "1.1.2.3", "3fd863sd5sfh3456" );
test.put( conn1, conn3 );
test.put( new Connection( "1.1.2.2", "1fd863sd5gh3456" ), new Connection( "1.1.2.2", "2fd863sd5gh3456" ) );
test.put( conn3, conn1 );
test.put( new Connection( "1.1.2.4", "1fd863sd5gh3456" ), new Connection( "1.1.2.4", "4fd863sd5gh3456" ) );
test.put( new Connection( "1.1.2.5", "1fd863sd5gh3456" ), new Connection( "1.1.2.5", "5fd863sd5gh3456" ) );
Connection conn2 = new Connection( "1.1.2.3", "3fd863sd5sfh3456" );
assertTrue( conn2.equals( conn3 ) );
assertTrue( test.containsKey( conn1 ) );
assertTrue( test.containsValue( conn1 ) );
}
}
|
UTF-8
|
Java
| 1,131
|
java
|
ConnectionTest.java
|
Java
|
[
{
"context": "oolkit.java.entity.io.Connection;\n\n/**\n * @author 银时 yinshi.nc@taobao.com\n */\npublic class ConnectionT",
"end": 221,
"score": 0.999729335308075,
"start": 219,
"tag": "NAME",
"value": "银时"
},
{
"context": "lkit.java.entity.io.Connection;\n\n/**\n * @author 银时 yinshi.nc@taobao.com\n */\npublic class ConnectionTest {\n\n\t@Test\n\tpublic",
"end": 242,
"score": 0.9998942017555237,
"start": 222,
"tag": "EMAIL",
"value": "yinshi.nc@taobao.com"
}
] | null |
[] |
package common.toolkit.java.entity;
import static org.junit.Assert.assertTrue;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import common.toolkit.java.entity.io.Connection;
/**
* @author 银时 <EMAIL>
*/
public class ConnectionTest {
@Test
public void test() {
Map< Connection, Connection > test = new HashMap< Connection, Connection >();
Connection conn1 = new Connection( "1.1.2.1", "1fd863sd5sfh3456" );
Connection conn3 = new Connection( "1.1.2.3", "3fd863sd5sfh3456" );
test.put( conn1, conn3 );
test.put( new Connection( "1.1.2.2", "1fd863sd5gh3456" ), new Connection( "1.1.2.2", "2fd863sd5gh3456" ) );
test.put( conn3, conn1 );
test.put( new Connection( "1.1.2.4", "1fd863sd5gh3456" ), new Connection( "1.1.2.4", "4fd863sd5gh3456" ) );
test.put( new Connection( "1.1.2.5", "1fd863sd5gh3456" ), new Connection( "1.1.2.5", "5fd863sd5gh3456" ) );
Connection conn2 = new Connection( "1.1.2.3", "3fd863sd5sfh3456" );
assertTrue( conn2.equals( conn3 ) );
assertTrue( test.containsKey( conn1 ) );
assertTrue( test.containsValue( conn1 ) );
}
}
| 1,118
| 0.680568
| 0.566992
| 37
| 29.459459
| 33.053268
| 109
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.756757
| false
| false
|
2
|
ee8c41e6cf5157189cc23854013977fc15f35680
| 13,950,053,786,879
|
342c4b39e5f8a74d45476bc71a7a07e8d4cc36f5
|
/week2/ReflectionTest.java
|
036492821cd2e1315677b404bdcf16d79dc3bea9
|
[] |
no_license
|
NomaHwang/Netease
|
https://github.com/NomaHwang/Netease
|
f1ec455925ebcd4cdcf97c2e45bcf6e976e0ab94
|
557b7da136fb3e234a33dd0c63a45916fc52119d
|
refs/heads/master
| 2020-06-22T04:43:02.418000
| 2017-01-25T07:46:23
| 2017-01-25T07:46:23
| 74,757,184
| 0
| 0
| null | false
| 2016-12-05T02:45:47
| 2016-11-25T12:35:01
| 2016-11-25T12:35:01
| 2016-12-05T02:45:47
| 0
| 0
| 0
| 0
| null | null | null |
import java.util.*;
import java.lang.reflect.*;
public class ReflectionTest {
public static void printConstructors(Class cl){
Constructor[] constructors = cl.getConstructors();
for(Constructor con : constructors){
int mod = con.getModifiers();
String modifier = Modifier.toString(mod);
if(modifier.length() > 0){
System.out.print(" " + modifier + " ");
}
System.out.print(con.getName() + "(");
Class[] paras = con.getParameterTypes();
int n = paras.length;
for(int i = 0; i < n; ++i){
if(i > 0){
System.out.print(" ,");
}
System.out.print(paras[i].getName());
}
System.out.println(");");
}
}
public static void printMethods(Class cl){
System.out.println();
Method[] methods = cl.getDeclaredMethods();
for(Method method : methods){
int mod = method.getModifiers();
String modifier = Modifier.toString(mod);
if(modifier.length() > 0){
System.out.print(" " + modifier + " ");
}
Class returns = method.getReturnType();
System.out.print(returns.getName() + " ");
System.out.print(method.getName() + "(");
Class[] paras = method.getParameterTypes();
int n = paras.length;
for(int i = 0; i < n; ++i){
if(i > 0){
System.out.print(", ");
}
System.out.print(paras[i].getName());
}
System.out.println(");");
}
}
public static void printFields(Class cl){
Field[] fields = cl.getDeclaredFields();
System.out.println();
for(Field field : fields){
Class type = field.getType();
String name = field.getName();
String modifiers = Modifier.toString(type.getModifiers());
if(modifiers.length() > 0){
System.out.print(" " + modifiers + " ");
}
System.out.println(type.getName() + " " + name + ";");
}
}
public static void main(String[] args){
Scanner in = new Scanner(System.in);
String name = in.next();
try{
Class cl = Class.forName(name);
Class supercl = cl.getSuperclass();
int mod = cl.getModifiers();
String modifier = Modifier.toString(mod);
if(modifier.length() > 0)
System.out.print(modifier + " ");
System.out.print(name);
if(supercl != null && supercl != Object.class){
System.out.print(" extends " + supercl.getName() + "\n");
}
System.out.println("{");
printConstructors(cl);
printMethods(cl);
printFields(cl);
System.out.println("}");
}
catch(Exception e){
e.printStackTrace();
}
}
}
|
UTF-8
|
Java
| 2,604
|
java
|
ReflectionTest.java
|
Java
|
[] | null |
[] |
import java.util.*;
import java.lang.reflect.*;
public class ReflectionTest {
public static void printConstructors(Class cl){
Constructor[] constructors = cl.getConstructors();
for(Constructor con : constructors){
int mod = con.getModifiers();
String modifier = Modifier.toString(mod);
if(modifier.length() > 0){
System.out.print(" " + modifier + " ");
}
System.out.print(con.getName() + "(");
Class[] paras = con.getParameterTypes();
int n = paras.length;
for(int i = 0; i < n; ++i){
if(i > 0){
System.out.print(" ,");
}
System.out.print(paras[i].getName());
}
System.out.println(");");
}
}
public static void printMethods(Class cl){
System.out.println();
Method[] methods = cl.getDeclaredMethods();
for(Method method : methods){
int mod = method.getModifiers();
String modifier = Modifier.toString(mod);
if(modifier.length() > 0){
System.out.print(" " + modifier + " ");
}
Class returns = method.getReturnType();
System.out.print(returns.getName() + " ");
System.out.print(method.getName() + "(");
Class[] paras = method.getParameterTypes();
int n = paras.length;
for(int i = 0; i < n; ++i){
if(i > 0){
System.out.print(", ");
}
System.out.print(paras[i].getName());
}
System.out.println(");");
}
}
public static void printFields(Class cl){
Field[] fields = cl.getDeclaredFields();
System.out.println();
for(Field field : fields){
Class type = field.getType();
String name = field.getName();
String modifiers = Modifier.toString(type.getModifiers());
if(modifiers.length() > 0){
System.out.print(" " + modifiers + " ");
}
System.out.println(type.getName() + " " + name + ";");
}
}
public static void main(String[] args){
Scanner in = new Scanner(System.in);
String name = in.next();
try{
Class cl = Class.forName(name);
Class supercl = cl.getSuperclass();
int mod = cl.getModifiers();
String modifier = Modifier.toString(mod);
if(modifier.length() > 0)
System.out.print(modifier + " ");
System.out.print(name);
if(supercl != null && supercl != Object.class){
System.out.print(" extends " + supercl.getName() + "\n");
}
System.out.println("{");
printConstructors(cl);
printMethods(cl);
printFields(cl);
System.out.println("}");
}
catch(Exception e){
e.printStackTrace();
}
}
}
| 2,604
| 0.569892
| 0.56682
| 108
| 22.111111
| 17.758322
| 61
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 3.157408
| false
| false
|
2
|
32f742783457576f4b72d80db37c25ab025df93a
| 13,950,053,783,503
|
d9b6d769f849061deae2d0bce8bdd05f740475e6
|
/RecommenderSystem/app/nlp/ArticleClassification.java
|
c53dc435b00a54e82ad0adf1d026f5dad3da40c2
|
[
"Apache-2.0"
] |
permissive
|
Alex-CHUN-YU/Recommender-System
|
https://github.com/Alex-CHUN-YU/Recommender-System
|
aa38554420854539e685caefce98e76d2540c375
|
90a5c5d4ae56ce462177f2e3f29c231fef6d2b1a
|
refs/heads/master
| 2022-12-09T12:40:15.234000
| 2019-08-22T08:47:52
| 2019-08-22T08:47:52
| 171,094,741
| 0
| 0
| null | false
| 2022-12-08T06:03:18
| 2019-02-17T07:37:51
| 2020-01-17T12:38:13
| 2022-12-08T06:03:17
| 95,871
| 0
| 0
| 7
|
Python
| false
| false
|
package nlp;
import ckip.CKIPParserClient;
import ckip.ParserUtil;
import ckip.Term;
import constant_field.DatabaseConstant;
import constant_field.FileName;
import constant_field.ModuleConstant;
import constant_field.NERDictionaryConstant;
import database.MysqlDatabaseController;
import dictionary.ReadRoleDictionary;
import generictree.Node;
import generictree.Tree;
import read_write_file.ReadFileController;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
/**
* Articles Classification.
* @version 1.0 2018年10月28日
* @author Alex
*
*/
public class ArticleClassification {
/**
* Relationship.
*/
private ReadFileController kinship, love, friendship, teacherStudentRelationship, businessRelationship;
/**
* Constructor.
*/
public ArticleClassification() throws IOException {
// 將 Rule 寫入
ReadRoleDictionary readThematicRolePOSPairDictionary = new ReadRoleDictionary();
readThematicRolePOSPairDictionary.setRoleDictionary();
// Read Relation Dictionary(E-HowNet).
kinship = new ReadFileController(FileName.RELATION + FileName.KINSHIP);
love = new ReadFileController(FileName.RELATION + FileName.ROMANTIC_RELATIONSHIP);
friendship = new ReadFileController(FileName.RELATION + FileName.FRIENDSHIP);
teacherStudentRelationship = new ReadFileController(FileName.RELATION + FileName.TEACHER_STUDENT_RELATIONSHIP);
businessRelationship = new ReadFileController(FileName.RELATION + FileName.BUSINESS_RELATIONSHIP);
System.out.println(kinship.getLineList());
System.out.println(love.getLineList());
System.out.println(friendship.getLineList());
System.out.println(teacherStudentRelationship.getLineList());
System.out.println(businessRelationship.getLineList());
}
/**
* Using Title Classification.
*/
public void titleClassification() {
MysqlDatabaseController mysqlDatabaseController = new MysqlDatabaseController();
String titleParser = "";
String contentParser = "";
for (int id = 10; id <=10; id++) {
ResultSet articleResult = mysqlDatabaseController.execSelect(
DatabaseConstant.TITLE_PARSER_RESULT + "," + DatabaseConstant.CONTENT_PARSER_RESULT,
DatabaseConstant.ARTICLES_PARSER, DatabaseConstant.ID + "=" + id);
try {
if (articleResult.next()) {
titleParser = articleResult.getString(DatabaseConstant.TITLE_PARSER_RESULT);
contentParser = articleResult.getString(DatabaseConstant.CONTENT_PARSER_RESULT);
}
} catch (SQLException s) {
s.getErrorCode();
}
Tree<Term> rootNode;
System.out.println(titleParser);
rootNode = ParserUtil.taggedTextToTermTree(titleParser);
relationshipCandidate = new HashMap<>();
findRelationship(rootNode.getRoot());
for (String relationship : relationshipCandidate.keySet()) {
System.out.println(relationship + ":" + relationshipCandidate.get(relationship));
}
// for (CKIPParserClient.Triple<String, String, String> relation : candidateWordList) {
// System.out.println(relation.getSegmentWord() + ":" + relation.getTagging() + ":" + relation.getThematicRole());
// }
System.out.println(contentParser + "\n");
String[] parsers = contentParser.split("@");
for (String parser : parsers) {
try {
NERCandidateWordList = new ArrayList<>();
System.out.println(parser);
eventPresence = false;
rootNode = ParserUtil.taggedTextToTermTree(parser);
findNERCandidate(rootNode.getRoot());
for (CKIPParserClient.Triple r : NERCandidateWordList) {
System.out.println(r.getSegmentWord() + ":" + r.getTagging() + ":" + r.getThematicRole());
}
System.out.println("*********************************");
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
private HashMap<String, Integer> relationshipCandidate;
/**
* Through E-HowNet Find Relationship.
* @param rootNode root
*/
private void findRelationship(Node<Term> rootNode) {
if (rootNode.getChildren().size() != 0) {
for (int i = 0; i < rootNode.getChildren().size(); i++) {
findRelationship(rootNode.getChildAt(i));
}
} else {
String relationship = rootNode.getData().getText();
// Pre Processing
relationship = relationship.replaceAll("\\)|\\+", "");
System.out.println(relationship);
// kinship=1, love=2, friendship=3, teacher_student_relationship=4, business_relationship=5
for (String k : kinship.getLineList()) {
if (relationship.equals(k)) {
relationshipCandidate.put(k, ModuleConstant.KINSHIP);
}
}
for (String l : love.getLineList()) {
if (relationship.equals(l)) {
relationshipCandidate.put(l, ModuleConstant.LOVE);
}
}
for (String f : friendship.getLineList()) {
if (relationship.equals(f)) {
relationshipCandidate.put(f, ModuleConstant.FRIENDSHIP);
}
}
for (String t : teacherStudentRelationship.getLineList()) {
if (relationship.equals(t)) {
relationshipCandidate.put(t, ModuleConstant.TEACHER_STUDENT_RELATIONSHIP);
}
}
for (String b : businessRelationship.getLineList()) {
if (relationship.equals(b)) {
relationshipCandidate.put(b, ModuleConstant.BUSINESS_RELATIONSHIP);
}
}
}
}
private ArrayList<CKIPParserClient.Triple<String, String, String>> NERCandidateWordList;
private boolean eventPresence;
/**
* Find Person or Object.
* @param rootNode root
*/
private void findNERCandidate(Node<Term> rootNode) {
if (rootNode.getChildren().size() != 0) {
for (int i = 0; i < rootNode.getChildren().size(); i++) {
findNERCandidate(rootNode.getChildAt(i));
}
} else {
boolean entityPresence = false;
// Pre Processing
String entity = rootNode.getData().getText();
entity = entity.replaceAll("\\)|\\+|-|#", "");
if (!entity.equals("")) {
System.out.println(entity);
Iterator postEventIterator = NERDictionaryConstant.COMPLEX_EVENT_RULE_SET.iterator();
Iterator personObjectIterator = NERDictionaryConstant.PERSON_OBJECT_RULE_SET.iterator();
Iterator locationIterator = NERDictionaryConstant.LOCATION_RULE_SET.iterator();
Iterator timeIterator = NERDictionaryConstant.TIME_RULE_SET.iterator();
Iterator eventIterator = NERDictionaryConstant.EVENT_RULE_SET.iterator();
Iterator preEventIterator = NERDictionaryConstant.COMPLEX_EVENT_RULE_SET.iterator();
Iterator stateIterator = NERDictionaryConstant.STATE_RULE_SET.iterator();
// Complex Event Post Rule
while (postEventIterator.hasNext() && eventPresence) {
String testSet = (String) postEventIterator.next();
String segmentWord = NERCandidateWordList.get(NERCandidateWordList.size() - 1).getSegmentWord();
String tagging = NERCandidateWordList.get(NERCandidateWordList.size() - 1).getTagging();
String thematicRole = NERCandidateWordList.get(NERCandidateWordList.size() - 1).getThematicRole();
String[] testList = testSet.split("\\+");
if ((thematicRole + ":" + tagging).equals(testList[0])) {
if ((rootNode.getData().getThematicRole() + ":"
+ rootNode.getData().getPos()).equals(testList[1])) {
CKIPParserClient.Triple<String, String, String> r;
r = new CKIPParserClient.Triple<>(segmentWord + entity,
tagging + rootNode.getData().getPos(),
thematicRole + rootNode.getData().getThematicRole());
NERCandidateWordList.set(NERCandidateWordList.size() - 1, r);
entityPresence = true;
eventPresence = false;
System.out.println("hi7");
}
}
} // while (NERDictionaryConstant.iterator.hasNext())
// Person and Object Rule
while (personObjectIterator.hasNext() && !entityPresence) {
String testSet = (String) personObjectIterator.next();
if ((rootNode.getData().getThematicRole() + ":"
+ rootNode.getData().getPos()).equals(testSet)) {
CKIPParserClient.Triple<String, String, String> r;
r = new CKIPParserClient.Triple<>(entity, rootNode.getData().getPos(), rootNode.getData().getThematicRole());
if (eventPresence && NERCandidateWordList.get(NERCandidateWordList.size() - 1).getThematicRole().equals("negation")) {
NERCandidateWordList.set(NERCandidateWordList.size() - 1, r);
} else {
NERCandidateWordList.add(r);
}
entityPresence = true;
eventPresence = false;
System.out.println("hi1");
}
} // while (NERDictionaryConstant.iterator.hasNext())
// Location Rule
while (locationIterator.hasNext() && !entityPresence) {
String testSet = (String) locationIterator.next();
if ((rootNode.getData().getThematicRole() + ":"
+ rootNode.getData().getPos()).equals(testSet)) {
CKIPParserClient.Triple<String, String, String> r;
r = new CKIPParserClient.Triple<>(entity, rootNode.getData().getPos(), rootNode.getData().getThematicRole());
if (eventPresence && NERCandidateWordList.get(NERCandidateWordList.size() - 1).getThematicRole().equals("negation")) {
NERCandidateWordList.set(NERCandidateWordList.size() - 1, r);
} else {
NERCandidateWordList.add(r);
}
entityPresence = true;
eventPresence = false;
System.out.println("hi2");
}
} // while (NERDictionaryConstant.iterator.hasNext())
// Time Rule
while (timeIterator.hasNext() && !entityPresence) {
String testSet = (String) timeIterator.next();
if ((rootNode.getData().getThematicRole() + ":"
+ rootNode.getData().getPos()).equals(testSet)) {
CKIPParserClient.Triple<String, String, String> r;
r = new CKIPParserClient.Triple<>(entity, rootNode.getData().getPos(), rootNode.getData().getThematicRole());
if (eventPresence && NERCandidateWordList.get(NERCandidateWordList.size() - 1).getThematicRole().equals("negation")) {
NERCandidateWordList.set(NERCandidateWordList.size() - 1, r);
} else {
NERCandidateWordList.add(r);
}
entityPresence = true;
eventPresence = false;
System.out.println("hi3");
}
} // while (NERDictionaryConstant.iterator.hasNext())
// Event Rule
while (eventIterator.hasNext() && !entityPresence) {
String testSet = (String) eventIterator.next();
if ((rootNode.getData().getThematicRole() + ":"
+ rootNode.getData().getPos()).equals(testSet)) {
CKIPParserClient.Triple<String, String, String> r;
r = new CKIPParserClient.Triple<>(entity, rootNode.getData().getPos(), rootNode.getData().getThematicRole());
if (eventPresence && NERCandidateWordList.get(NERCandidateWordList.size() - 1).getThematicRole().equals("negation")) {
NERCandidateWordList.set(NERCandidateWordList.size() - 1, r);
} else {
NERCandidateWordList.add(r);
}
entityPresence = true;
eventPresence = false;
System.out.println("hi4");
}
} // while (NERDictionaryConstant.iterator.hasNext())
// Complex Event Pre Rule
while (preEventIterator.hasNext() && !entityPresence) {
String testSet = (String) preEventIterator.next();
if ((rootNode.getData().getThematicRole() + ":"
+ rootNode.getData().getPos()).equals(testSet.split("\\+")[0])) {
CKIPParserClient.Triple<String, String, String> r;
r = new CKIPParserClient.Triple<>(entity, rootNode.getData().getPos(), rootNode.getData().getThematicRole());
if (eventPresence && NERCandidateWordList.get(NERCandidateWordList.size() - 1).getThematicRole().equals("negation")) {
NERCandidateWordList.set(NERCandidateWordList.size() - 1, r);
} else {
NERCandidateWordList.add(r);
}
entityPresence = true;
eventPresence = true;
System.out.println("hi5");
}
} // while (NERDictionaryConstant.iterator.hasNext())
// State Rule
while (stateIterator.hasNext() && !entityPresence) {
String testSet = (String) stateIterator.next();
if ((rootNode.getData().getThematicRole() + ":"
+ rootNode.getData().getPos()).equals(testSet)) {
CKIPParserClient.Triple<String, String, String> r;
r = new CKIPParserClient.Triple<>(entity, rootNode.getData().getPos(), rootNode.getData().getThematicRole());
if (eventPresence && NERCandidateWordList.get(NERCandidateWordList.size() - 1).getThematicRole().equals("negation")) {
NERCandidateWordList.set(NERCandidateWordList.size() - 1, r);
} else {
NERCandidateWordList.add(r);
}
entityPresence = true;
eventPresence = false;
System.out.println("hi6");
}
} // while (NERDictionaryConstant.iterator.hasNext())
}
}
}
}
|
UTF-8
|
Java
| 15,946
|
java
|
ArticleClassification.java
|
Java
|
[
{
"context": "sification.\n * @version 1.0 2018年10月28日\n * @author Alex\n *\n */\npublic class ArticleClassification {\n /",
"end": 657,
"score": 0.999470055103302,
"start": 653,
"tag": "NAME",
"value": "Alex"
}
] | null |
[] |
package nlp;
import ckip.CKIPParserClient;
import ckip.ParserUtil;
import ckip.Term;
import constant_field.DatabaseConstant;
import constant_field.FileName;
import constant_field.ModuleConstant;
import constant_field.NERDictionaryConstant;
import database.MysqlDatabaseController;
import dictionary.ReadRoleDictionary;
import generictree.Node;
import generictree.Tree;
import read_write_file.ReadFileController;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
/**
* Articles Classification.
* @version 1.0 2018年10月28日
* @author Alex
*
*/
public class ArticleClassification {
/**
* Relationship.
*/
private ReadFileController kinship, love, friendship, teacherStudentRelationship, businessRelationship;
/**
* Constructor.
*/
public ArticleClassification() throws IOException {
// 將 Rule 寫入
ReadRoleDictionary readThematicRolePOSPairDictionary = new ReadRoleDictionary();
readThematicRolePOSPairDictionary.setRoleDictionary();
// Read Relation Dictionary(E-HowNet).
kinship = new ReadFileController(FileName.RELATION + FileName.KINSHIP);
love = new ReadFileController(FileName.RELATION + FileName.ROMANTIC_RELATIONSHIP);
friendship = new ReadFileController(FileName.RELATION + FileName.FRIENDSHIP);
teacherStudentRelationship = new ReadFileController(FileName.RELATION + FileName.TEACHER_STUDENT_RELATIONSHIP);
businessRelationship = new ReadFileController(FileName.RELATION + FileName.BUSINESS_RELATIONSHIP);
System.out.println(kinship.getLineList());
System.out.println(love.getLineList());
System.out.println(friendship.getLineList());
System.out.println(teacherStudentRelationship.getLineList());
System.out.println(businessRelationship.getLineList());
}
/**
* Using Title Classification.
*/
public void titleClassification() {
MysqlDatabaseController mysqlDatabaseController = new MysqlDatabaseController();
String titleParser = "";
String contentParser = "";
for (int id = 10; id <=10; id++) {
ResultSet articleResult = mysqlDatabaseController.execSelect(
DatabaseConstant.TITLE_PARSER_RESULT + "," + DatabaseConstant.CONTENT_PARSER_RESULT,
DatabaseConstant.ARTICLES_PARSER, DatabaseConstant.ID + "=" + id);
try {
if (articleResult.next()) {
titleParser = articleResult.getString(DatabaseConstant.TITLE_PARSER_RESULT);
contentParser = articleResult.getString(DatabaseConstant.CONTENT_PARSER_RESULT);
}
} catch (SQLException s) {
s.getErrorCode();
}
Tree<Term> rootNode;
System.out.println(titleParser);
rootNode = ParserUtil.taggedTextToTermTree(titleParser);
relationshipCandidate = new HashMap<>();
findRelationship(rootNode.getRoot());
for (String relationship : relationshipCandidate.keySet()) {
System.out.println(relationship + ":" + relationshipCandidate.get(relationship));
}
// for (CKIPParserClient.Triple<String, String, String> relation : candidateWordList) {
// System.out.println(relation.getSegmentWord() + ":" + relation.getTagging() + ":" + relation.getThematicRole());
// }
System.out.println(contentParser + "\n");
String[] parsers = contentParser.split("@");
for (String parser : parsers) {
try {
NERCandidateWordList = new ArrayList<>();
System.out.println(parser);
eventPresence = false;
rootNode = ParserUtil.taggedTextToTermTree(parser);
findNERCandidate(rootNode.getRoot());
for (CKIPParserClient.Triple r : NERCandidateWordList) {
System.out.println(r.getSegmentWord() + ":" + r.getTagging() + ":" + r.getThematicRole());
}
System.out.println("*********************************");
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
private HashMap<String, Integer> relationshipCandidate;
/**
* Through E-HowNet Find Relationship.
* @param rootNode root
*/
private void findRelationship(Node<Term> rootNode) {
if (rootNode.getChildren().size() != 0) {
for (int i = 0; i < rootNode.getChildren().size(); i++) {
findRelationship(rootNode.getChildAt(i));
}
} else {
String relationship = rootNode.getData().getText();
// Pre Processing
relationship = relationship.replaceAll("\\)|\\+", "");
System.out.println(relationship);
// kinship=1, love=2, friendship=3, teacher_student_relationship=4, business_relationship=5
for (String k : kinship.getLineList()) {
if (relationship.equals(k)) {
relationshipCandidate.put(k, ModuleConstant.KINSHIP);
}
}
for (String l : love.getLineList()) {
if (relationship.equals(l)) {
relationshipCandidate.put(l, ModuleConstant.LOVE);
}
}
for (String f : friendship.getLineList()) {
if (relationship.equals(f)) {
relationshipCandidate.put(f, ModuleConstant.FRIENDSHIP);
}
}
for (String t : teacherStudentRelationship.getLineList()) {
if (relationship.equals(t)) {
relationshipCandidate.put(t, ModuleConstant.TEACHER_STUDENT_RELATIONSHIP);
}
}
for (String b : businessRelationship.getLineList()) {
if (relationship.equals(b)) {
relationshipCandidate.put(b, ModuleConstant.BUSINESS_RELATIONSHIP);
}
}
}
}
private ArrayList<CKIPParserClient.Triple<String, String, String>> NERCandidateWordList;
private boolean eventPresence;
/**
* Find Person or Object.
* @param rootNode root
*/
private void findNERCandidate(Node<Term> rootNode) {
if (rootNode.getChildren().size() != 0) {
for (int i = 0; i < rootNode.getChildren().size(); i++) {
findNERCandidate(rootNode.getChildAt(i));
}
} else {
boolean entityPresence = false;
// Pre Processing
String entity = rootNode.getData().getText();
entity = entity.replaceAll("\\)|\\+|-|#", "");
if (!entity.equals("")) {
System.out.println(entity);
Iterator postEventIterator = NERDictionaryConstant.COMPLEX_EVENT_RULE_SET.iterator();
Iterator personObjectIterator = NERDictionaryConstant.PERSON_OBJECT_RULE_SET.iterator();
Iterator locationIterator = NERDictionaryConstant.LOCATION_RULE_SET.iterator();
Iterator timeIterator = NERDictionaryConstant.TIME_RULE_SET.iterator();
Iterator eventIterator = NERDictionaryConstant.EVENT_RULE_SET.iterator();
Iterator preEventIterator = NERDictionaryConstant.COMPLEX_EVENT_RULE_SET.iterator();
Iterator stateIterator = NERDictionaryConstant.STATE_RULE_SET.iterator();
// Complex Event Post Rule
while (postEventIterator.hasNext() && eventPresence) {
String testSet = (String) postEventIterator.next();
String segmentWord = NERCandidateWordList.get(NERCandidateWordList.size() - 1).getSegmentWord();
String tagging = NERCandidateWordList.get(NERCandidateWordList.size() - 1).getTagging();
String thematicRole = NERCandidateWordList.get(NERCandidateWordList.size() - 1).getThematicRole();
String[] testList = testSet.split("\\+");
if ((thematicRole + ":" + tagging).equals(testList[0])) {
if ((rootNode.getData().getThematicRole() + ":"
+ rootNode.getData().getPos()).equals(testList[1])) {
CKIPParserClient.Triple<String, String, String> r;
r = new CKIPParserClient.Triple<>(segmentWord + entity,
tagging + rootNode.getData().getPos(),
thematicRole + rootNode.getData().getThematicRole());
NERCandidateWordList.set(NERCandidateWordList.size() - 1, r);
entityPresence = true;
eventPresence = false;
System.out.println("hi7");
}
}
} // while (NERDictionaryConstant.iterator.hasNext())
// Person and Object Rule
while (personObjectIterator.hasNext() && !entityPresence) {
String testSet = (String) personObjectIterator.next();
if ((rootNode.getData().getThematicRole() + ":"
+ rootNode.getData().getPos()).equals(testSet)) {
CKIPParserClient.Triple<String, String, String> r;
r = new CKIPParserClient.Triple<>(entity, rootNode.getData().getPos(), rootNode.getData().getThematicRole());
if (eventPresence && NERCandidateWordList.get(NERCandidateWordList.size() - 1).getThematicRole().equals("negation")) {
NERCandidateWordList.set(NERCandidateWordList.size() - 1, r);
} else {
NERCandidateWordList.add(r);
}
entityPresence = true;
eventPresence = false;
System.out.println("hi1");
}
} // while (NERDictionaryConstant.iterator.hasNext())
// Location Rule
while (locationIterator.hasNext() && !entityPresence) {
String testSet = (String) locationIterator.next();
if ((rootNode.getData().getThematicRole() + ":"
+ rootNode.getData().getPos()).equals(testSet)) {
CKIPParserClient.Triple<String, String, String> r;
r = new CKIPParserClient.Triple<>(entity, rootNode.getData().getPos(), rootNode.getData().getThematicRole());
if (eventPresence && NERCandidateWordList.get(NERCandidateWordList.size() - 1).getThematicRole().equals("negation")) {
NERCandidateWordList.set(NERCandidateWordList.size() - 1, r);
} else {
NERCandidateWordList.add(r);
}
entityPresence = true;
eventPresence = false;
System.out.println("hi2");
}
} // while (NERDictionaryConstant.iterator.hasNext())
// Time Rule
while (timeIterator.hasNext() && !entityPresence) {
String testSet = (String) timeIterator.next();
if ((rootNode.getData().getThematicRole() + ":"
+ rootNode.getData().getPos()).equals(testSet)) {
CKIPParserClient.Triple<String, String, String> r;
r = new CKIPParserClient.Triple<>(entity, rootNode.getData().getPos(), rootNode.getData().getThematicRole());
if (eventPresence && NERCandidateWordList.get(NERCandidateWordList.size() - 1).getThematicRole().equals("negation")) {
NERCandidateWordList.set(NERCandidateWordList.size() - 1, r);
} else {
NERCandidateWordList.add(r);
}
entityPresence = true;
eventPresence = false;
System.out.println("hi3");
}
} // while (NERDictionaryConstant.iterator.hasNext())
// Event Rule
while (eventIterator.hasNext() && !entityPresence) {
String testSet = (String) eventIterator.next();
if ((rootNode.getData().getThematicRole() + ":"
+ rootNode.getData().getPos()).equals(testSet)) {
CKIPParserClient.Triple<String, String, String> r;
r = new CKIPParserClient.Triple<>(entity, rootNode.getData().getPos(), rootNode.getData().getThematicRole());
if (eventPresence && NERCandidateWordList.get(NERCandidateWordList.size() - 1).getThematicRole().equals("negation")) {
NERCandidateWordList.set(NERCandidateWordList.size() - 1, r);
} else {
NERCandidateWordList.add(r);
}
entityPresence = true;
eventPresence = false;
System.out.println("hi4");
}
} // while (NERDictionaryConstant.iterator.hasNext())
// Complex Event Pre Rule
while (preEventIterator.hasNext() && !entityPresence) {
String testSet = (String) preEventIterator.next();
if ((rootNode.getData().getThematicRole() + ":"
+ rootNode.getData().getPos()).equals(testSet.split("\\+")[0])) {
CKIPParserClient.Triple<String, String, String> r;
r = new CKIPParserClient.Triple<>(entity, rootNode.getData().getPos(), rootNode.getData().getThematicRole());
if (eventPresence && NERCandidateWordList.get(NERCandidateWordList.size() - 1).getThematicRole().equals("negation")) {
NERCandidateWordList.set(NERCandidateWordList.size() - 1, r);
} else {
NERCandidateWordList.add(r);
}
entityPresence = true;
eventPresence = true;
System.out.println("hi5");
}
} // while (NERDictionaryConstant.iterator.hasNext())
// State Rule
while (stateIterator.hasNext() && !entityPresence) {
String testSet = (String) stateIterator.next();
if ((rootNode.getData().getThematicRole() + ":"
+ rootNode.getData().getPos()).equals(testSet)) {
CKIPParserClient.Triple<String, String, String> r;
r = new CKIPParserClient.Triple<>(entity, rootNode.getData().getPos(), rootNode.getData().getThematicRole());
if (eventPresence && NERCandidateWordList.get(NERCandidateWordList.size() - 1).getThematicRole().equals("negation")) {
NERCandidateWordList.set(NERCandidateWordList.size() - 1, r);
} else {
NERCandidateWordList.add(r);
}
entityPresence = true;
eventPresence = false;
System.out.println("hi6");
}
} // while (NERDictionaryConstant.iterator.hasNext())
}
}
}
}
| 15,946
| 0.545814
| 0.542739
| 301
| 51.936878
| 33.360699
| 142
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.687708
| false
| false
|
2
|
01eb4626c48c519c2f3356a35d74690ddb74b6ef
| 19,808,389,230,341
|
279f30adbc967c844d73b32562fa7b5b0b818f05
|
/CN Lab/9/MULTIUSER/Server.java
|
6cc4e47971ce132df902c97e8d6c1dc54c90ff28
|
[] |
no_license
|
sayali-s/TE-Ass
|
https://github.com/sayali-s/TE-Ass
|
91a714b45aa64634ac0f949516478e16b5b6a583
|
b1f20c980bd6cc3c1e43a600ee87bfb5ed4fc3a7
|
refs/heads/master
| 2023-02-08T16:45:28.303000
| 2021-01-02T10:55:56
| 2021-01-02T10:55:56
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.io.*;
import java.net.*;
class ClientThread implements Runnable{
DataInputStream in;
DataOutputStream out;
Socket s;
Thread t;
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
public ClientThread(Socket s) {
this.s=s;
try {
in=new DataInputStream(s.getInputStream());
out=new DataOutputStream(s.getOutputStream());
t=new Thread(this);
t.setName(in.readUTF());
System.out.println("\n"+t.getName()+" joined Chat....");
t.start();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public void run() {
String str="",str2="sd";
try {
while(!str2.equalsIgnoreCase("end"))
{
str=in.readUTF();
System.out.println(t.getName()+" says: "+str);
System.out.print("Enter Your Message to "+t.getName()+" : ");
str2=read.readLine();
out.writeUTF(str2);
out.flush();
}
in.close();
out.close();
s.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public class Server {
public static void main(String[] args) throws IOException {
ServerSocket ss = new ServerSocket(8033);
System.out.println("Server is created");
while(true)
new ClientThread(ss.accept());
}
}
|
UTF-8
|
Java
| 1,334
|
java
|
Server.java
|
Java
|
[] | null |
[] |
import java.io.*;
import java.net.*;
class ClientThread implements Runnable{
DataInputStream in;
DataOutputStream out;
Socket s;
Thread t;
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
public ClientThread(Socket s) {
this.s=s;
try {
in=new DataInputStream(s.getInputStream());
out=new DataOutputStream(s.getOutputStream());
t=new Thread(this);
t.setName(in.readUTF());
System.out.println("\n"+t.getName()+" joined Chat....");
t.start();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public void run() {
String str="",str2="sd";
try {
while(!str2.equalsIgnoreCase("end"))
{
str=in.readUTF();
System.out.println(t.getName()+" says: "+str);
System.out.print("Enter Your Message to "+t.getName()+" : ");
str2=read.readLine();
out.writeUTF(str2);
out.flush();
}
in.close();
out.close();
s.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public class Server {
public static void main(String[] args) throws IOException {
ServerSocket ss = new ServerSocket(8033);
System.out.println("Server is created");
while(true)
new ClientThread(ss.accept());
}
}
| 1,334
| 0.631184
| 0.625187
| 67
| 18.910448
| 18.426725
| 76
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 2.61194
| false
| false
|
2
|
e0f2cbc85c62725cd596fdc7cdcfee21056e3f62
| 19,808,389,234,384
|
273aca1038ea54a819503c966eac3cf24315279c
|
/WEB-INF/classes/action/MypagePwCheckAction.java
|
319015118cf192a46707bf89010430faaac67d4d
|
[
"MIT"
] |
permissive
|
jieunpark247/Sharepot
|
https://github.com/jieunpark247/Sharepot
|
ea5b068f1f1d21253d59e55229cbbbafeb848fc4
|
21b9aed814aa542aff4385dd3742d91b9238cf09
|
refs/heads/master
| 2021-08-03T01:06:38.452000
| 2021-07-30T13:38:58
| 2021-07-30T13:38:58
| 175,533,032
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package action;
import java.io.PrintWriter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.json.simple.JSONObject;
import board.CommandAction;
import dao.mypageDAO;
import dto.Member;
public class MypagePwCheckAction implements CommandAction{
@Override
public String requestPro(HttpServletRequest request, HttpServletResponse response) throws Throwable {
HttpSession session = request.getSession();
int member_id = Integer.parseInt((String) session.getAttribute("idKey"));
String user_pass = request.getParameter("user_pass");
mypageDAO dao = new mypageDAO();
String real_pass = dao.getPwd(member_id);
String result = "";
if(user_pass.equals(real_pass)) {
JSONObject jsonobj = new JSONObject();
jsonobj.put("check", "yes");
PrintWriter out = response.getWriter();
out.println(jsonobj);
out.flush();
out.close();
}else {
JSONObject jsonobj = new JSONObject();
jsonobj.put("check", "no");
PrintWriter out = response.getWriter();
out.println(jsonobj);
out.flush();
out.close();
}
/*
* request.setAttribute("mem", mem);
request.setAttribute("phone1", mem.getTel().substring(3,7));
request.setAttribute("phone2", mem.getTel().substring(7,11));
* */
return result;
}
}
|
UTF-8
|
Java
| 1,360
|
java
|
MypagePwCheckAction.java
|
Java
|
[] | null |
[] |
package action;
import java.io.PrintWriter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.json.simple.JSONObject;
import board.CommandAction;
import dao.mypageDAO;
import dto.Member;
public class MypagePwCheckAction implements CommandAction{
@Override
public String requestPro(HttpServletRequest request, HttpServletResponse response) throws Throwable {
HttpSession session = request.getSession();
int member_id = Integer.parseInt((String) session.getAttribute("idKey"));
String user_pass = request.getParameter("user_pass");
mypageDAO dao = new mypageDAO();
String real_pass = dao.getPwd(member_id);
String result = "";
if(user_pass.equals(real_pass)) {
JSONObject jsonobj = new JSONObject();
jsonobj.put("check", "yes");
PrintWriter out = response.getWriter();
out.println(jsonobj);
out.flush();
out.close();
}else {
JSONObject jsonobj = new JSONObject();
jsonobj.put("check", "no");
PrintWriter out = response.getWriter();
out.println(jsonobj);
out.flush();
out.close();
}
/*
* request.setAttribute("mem", mem);
request.setAttribute("phone1", mem.getTel().substring(3,7));
request.setAttribute("phone2", mem.getTel().substring(7,11));
* */
return result;
}
}
| 1,360
| 0.708824
| 0.703676
| 55
| 23.727272
| 22.702387
| 102
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 2.236364
| false
| false
|
2
|
be46181be5d9fe4c1f9c440e4e0380886215b42e
| 27,230,092,677,776
|
c97a393b73d00b0cc78003964e2faffe9bce2933
|
/src/main/java/com/atguigu/gmall/user/controller/UserManageController.java
|
968486d1694a64782ca1215403f7e1dbeca3723d
|
[] |
no_license
|
hewenlong1234/gmall-user-manage
|
https://github.com/hewenlong1234/gmall-user-manage
|
deab1481aa8ad7908f2f8be616e914bbf8261400
|
540b05a267653097cb003aff6552c02512857876
|
refs/heads/master
| 2020-05-17T22:52:24.200000
| 2019-04-29T06:45:18
| 2019-04-29T06:45:18
| 184,015,031
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.atguigu.gmall.user.controller;
import com.atguigu.gmall.user.bean.UserInfo;
import com.atguigu.gmall.user.service.UserManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
@Controller
public class UserManageController {
@Autowired
private UserManageService userManageService;
@RequestMapping("findAll")
@ResponseBody
public List<UserInfo> findAll(){
return userManageService.getUserInfoListAll();
}
@RequestMapping("add")
@ResponseBody
public void add(){
UserInfo userInfo = new UserInfo();
userInfo.setLoginName("liuqian");
userInfo.setPasswd("789456");
userInfo.setName("liuqian123");
userInfo.setNickName("LIUQIAN");
userInfo.setPhoneNum("8976");
userInfo.setEmail("liuqian@qq.com");
userInfo.setHeadImg("4");
userInfo.setUserLevel("4");
userManageService.addUser(userInfo);
}
@RequestMapping("update")
@ResponseBody
public void update(){
UserInfo userInfo = new UserInfo();
userInfo.setId("4");
userInfo.setLoginName("dashabi");
userManageService.updateUser(userInfo);
}
@RequestMapping("update1")
@ResponseBody
public void update1(String name){
UserInfo userInfo = new UserInfo();
userInfo.setNickName("haojiubujian");
userManageService.updateUserByName(name,userInfo);
}
@RequestMapping("delete")
@ResponseBody
public void delete(){
UserInfo userInfo = new UserInfo();
userInfo.setId("6");
userManageService.deleteUser(userInfo);
}
}
|
UTF-8
|
Java
| 1,958
|
java
|
UserManageController.java
|
Java
|
[
{
"context": " = new UserInfo();\n userInfo.setLoginName(\"liuqian\");\n userInfo.setPasswd(\"789456\");\n ",
"end": 937,
"score": 0.9995205998420715,
"start": 930,
"tag": "USERNAME",
"value": "liuqian"
},
{
"context": "LoginName(\"liuqian\");\n userInfo.setPasswd(\"789456\");\n userInfo.setName(\"liuqian123\");\n ",
"end": 975,
"score": 0.9993478655815125,
"start": 969,
"tag": "PASSWORD",
"value": "789456"
},
{
"context": "fo.setPasswd(\"789456\");\n userInfo.setName(\"liuqian123\");\n userInfo.setNickName(\"LIUQIAN\");\n ",
"end": 1015,
"score": 0.9974333643913269,
"start": 1005,
"tag": "USERNAME",
"value": "liuqian123"
},
{
"context": "Name(\"liuqian123\");\n userInfo.setNickName(\"LIUQIAN\");\n userInfo.setPhoneNum(\"8976\");\n ",
"end": 1056,
"score": 0.9977569580078125,
"start": 1049,
"tag": "USERNAME",
"value": "LIUQIAN"
},
{
"context": "o.setPhoneNum(\"8976\");\n userInfo.setEmail(\"liuqian@qq.com\");\n userInfo.setHeadImg(\"4\");\n user",
"end": 1139,
"score": 0.999900758266449,
"start": 1125,
"tag": "EMAIL",
"value": "liuqian@qq.com"
},
{
"context": "erInfo.setId(\"4\");\n userInfo.setLoginName(\"dashabi\");\n userManageService.updateUser(userInfo)",
"end": 1451,
"score": 0.9995183348655701,
"start": 1444,
"tag": "USERNAME",
"value": "dashabi"
},
{
"context": " = new UserInfo();\n\n userInfo.setNickName(\"haojiubujian\");\n userManageService.updateUserByName(nam",
"end": 1684,
"score": 0.9992551803588867,
"start": 1672,
"tag": "USERNAME",
"value": "haojiubujian"
}
] | null |
[] |
package com.atguigu.gmall.user.controller;
import com.atguigu.gmall.user.bean.UserInfo;
import com.atguigu.gmall.user.service.UserManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
@Controller
public class UserManageController {
@Autowired
private UserManageService userManageService;
@RequestMapping("findAll")
@ResponseBody
public List<UserInfo> findAll(){
return userManageService.getUserInfoListAll();
}
@RequestMapping("add")
@ResponseBody
public void add(){
UserInfo userInfo = new UserInfo();
userInfo.setLoginName("liuqian");
userInfo.setPasswd("<PASSWORD>");
userInfo.setName("liuqian123");
userInfo.setNickName("LIUQIAN");
userInfo.setPhoneNum("8976");
userInfo.setEmail("<EMAIL>");
userInfo.setHeadImg("4");
userInfo.setUserLevel("4");
userManageService.addUser(userInfo);
}
@RequestMapping("update")
@ResponseBody
public void update(){
UserInfo userInfo = new UserInfo();
userInfo.setId("4");
userInfo.setLoginName("dashabi");
userManageService.updateUser(userInfo);
}
@RequestMapping("update1")
@ResponseBody
public void update1(String name){
UserInfo userInfo = new UserInfo();
userInfo.setNickName("haojiubujian");
userManageService.updateUserByName(name,userInfo);
}
@RequestMapping("delete")
@ResponseBody
public void delete(){
UserInfo userInfo = new UserInfo();
userInfo.setId("6");
userManageService.deleteUser(userInfo);
}
}
| 1,955
| 0.700204
| 0.6905
| 67
| 28.223881
| 19.487326
| 62
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.492537
| false
| false
|
2
|
0d391549e77dd0053be3b9be16e6458b8aa963de
| 25,177,098,293,772
|
0929a223e5c95c0aa98e1c84f80b67a101672adf
|
/src/main/java/MongoStorage.java
|
f33fc28f838e2126236819c2d52ded90de4bf9ca
|
[] |
no_license
|
arccassin/mongo_shops_and_goods
|
https://github.com/arccassin/mongo_shops_and_goods
|
1531672d71ec629fa291cab006ca1ed3b00aded7
|
d29b0a4ecb8143bff9f2de18a654ccd87b40f763
|
refs/heads/master
| 2021-01-16T11:22:48.231000
| 2020-02-29T16:09:45
| 2020-02-29T16:09:45
| 243,100,607
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
import com.mongodb.MongoClient;
import com.mongodb.MongoConfigurationException;
import com.mongodb.ServerAddress;
import com.mongodb.client.FindIterable;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoCursor;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.model.Facet;
import com.mongodb.client.model.Updates;
import org.bson.Document;
import org.bson.conversions.Bson;
import java.io.Closeable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;
import org.bson.json.JsonWriterSettings;
import static com.mongodb.client.model.Accumulators.*;
import static com.mongodb.client.model.Aggregates.*;
import static com.mongodb.client.model.Filters.*;
import static com.mongodb.client.model.Projections.*;
import static com.mongodb.client.model.Sorts.descending;
import static java.util.Arrays.asList;
/**
* Created by User on 17 Февр., 2020
*/
public class MongoStorage implements Closeable {
// Объект для работы с Mongo
private MongoClient mongoClient;
private MongoDatabase mongoDatabase;
// Объект для работы с коллекцией магазинов
private MongoCollection<Document> shopsCollection;
// Объект для работы с коллекцией товаров
private MongoCollection<Document> goodsCollection;
private static Consumer<Document> printDocuments() {
return doc -> System.out.println(doc.toJson(JsonWriterSettings.builder().indent(true).build()));
}
void init() {
ServerAddress serverAddress = new ServerAddress("127.0.0.1", 27017);
try {
mongoClient = new MongoClient(serverAddress);
mongoDatabase = mongoClient.getDatabase("local");
} catch (MongoConfigurationException Exc) {
System.out.println("Не удалось подключиться к Mongo");
System.out.println(Exc.getMessage());
}
shopsCollection = mongoDatabase.getCollection("shops");
goodsCollection = mongoDatabase.getCollection("goods");
// Удалим
shopsCollection.drop();
goodsCollection.drop();
}
boolean addShop(String name) {
Bson filter = eq("name", name);
Document shop = shopsCollection.find(filter).first();
if (shop != null) {
return false;
}
shop = new Document()
.append("name", name)
.append("goods_in_store", asList());
shopsCollection.insertOne(shop);
return true;
}
boolean addGood(String name, int price) {
Bson filter = eq("name", name);
Document good = goodsCollection.find(filter).first();
if (good != null) {
return false;
}
good = new Document()
.append("name", name)
.append("price", price);
goodsCollection.insertOne(good);
return true;
}
boolean addGood2Shop(String goodName, String shopName) {
Bson filter = eq("name", goodName);
Document good = goodsCollection.find(filter).first();
if (good == null) {
return false;
}
filter = eq("name", shopName);
Bson updateGoods = Updates.addToSet("goods_in_store", goodName);
Document shop = shopsCollection.findOneAndUpdate(filter, updateGoods);
return true;
}
//все по магазинам
private void getAllStaticFacet() {
Bson lookup = lookup("goods", "goods_in_store", "name", "fromGood");
Bson unwind = unwind("$fromGood");
Bson sort = sort(descending("fromGood.price"));
Bson group = group("$name",
sum("count", 1L),
avg("averagePrice", "$fromGood.price"),
last("minPriceGood", "$fromGood"),
first("maxPriceGood", "$fromGood"));
Bson match = match(lt("fromGood.price", 100L));
Bson matchGroup = group("$name", sum("matchCount", 1L));
Bson faset1 = facet(
new Facet("shopInfo", lookup, unwind, sort, group),
new Facet("under100", lookup, unwind, match, matchGroup)
);
List<Document> allResults = shopsCollection.aggregate(Arrays.asList(faset1)).into(new ArrayList<>());
Document res = allResults.get(0);
ArrayList<Document> shopInfoDoc = (ArrayList<Document>) res.get("shopInfo");
ArrayList<Document> under100Doc = (ArrayList<Document>) res.get("under100");
StringBuilder builder = new StringBuilder();
shopInfoDoc.forEach(doc -> {
String shopName = (String) doc.get("_id");
builder.append("\n\nМагазин \"");
builder.append(shopName);
builder.append("\"");
builder.append("\n— Общее количество товаров: ");
builder.append(doc.get("count"));
builder.append("\n— Средяя цена товара: ");
builder.append(doc.get("averagePrice"));
Document good = (Document) doc.get("minPriceGood");
if (good != null) {
builder.append("\n— Самый дешевый товар: ");
builder.append(good.get("name"));
builder.append(" - ");
builder.append(good.get("price"));
}
good = (Document) doc.get("maxPriceGood");
if (good != null) {
builder.append("\n— Самый дорогой товар: ");
builder.append(good.get("name"));
builder.append(" - ");
builder.append(good.get("price"));
}
for (int i = under100Doc.size() - 1; i >= 0; i--) {
Document shopDoc = under100Doc.get(i);
String currentShopName = (String) shopDoc.get("_id");
if (shopName.equals(currentShopName)) {
builder.append("\n— Количество товаров, дешевле 100 рублей: ");
builder.append(shopDoc.get("matchCount"));
under100Doc.remove(i);
break;
}
}
});
System.out.println(builder.toString());
}
// Общее количество товаров по каждому магазину
private void getGoodCountOfStore() {
Bson unwind = unwind("$goods_in_store");
Bson group = group("$name", sum("count", 1L));
Bson project = project(fields(excludeId(), include("name", "count"), computed("name", "$_id")));
List<Document> results = shopsCollection.aggregate(Arrays.asList(unwind, group, project)).into(new ArrayList<>());
results.forEach(doc -> System.out.printf("Магазин: \"%s\". Количество товаров: %s\n", doc.get("name"), doc.get("count")));
}
//Средняя цена товара по каждому магазину
private void getGoodAvgOfStore() {
Bson lookup = lookup("goods", "goods_in_store", "name", "fromGood");
Bson unwind = unwind("$fromGood");
Bson group = group("$name", avg("averagePrice", "$fromGood.price"));
List<Document> results = shopsCollection.aggregate(Arrays.asList(lookup, unwind, group)).into(new ArrayList<>());
results.forEach(doc -> System.out.printf("Магазин: \"%s\". Средняя цена: %s\n", doc.get("_id"), doc.get("averagePrice")));
}
//Самый дешевый и дорогой товар в каждом магазине
private void getGoodMaxOfStore() {
Bson lookup = lookup("goods", "goods_in_store", "name", "fromGood");
Bson unwind = unwind("$fromGood");
Bson sort = sort(descending("fromGood.price"));
Bson group1 = group("$name", last("min", "$fromGood"));
Bson group2 = group("$name", first("max", "$fromGood"));
List<Document> results = shopsCollection.aggregate(Arrays.asList(lookup, unwind, sort, group1)).into(new ArrayList<>());
results.forEach(doc -> {
Document last = (Document) doc.get("min");
if (last != null) {
String goodName = (String) last.get("name");
System.out.printf("Магазин: \"%s\". Самый дешевый товар: %s\n", doc.get("_id"), goodName);
}
});
results = shopsCollection.aggregate(Arrays.asList(lookup, unwind, sort, group2)).into(new ArrayList<>());
results.forEach(doc -> {
Document last = (Document) doc.get("max");
if (last != null) {
String goodName = (String) last.get("name");
System.out.printf("Магазин: \"%s\". Самый дорогой товар: %s\n", doc.get("_id"), goodName);
}
});
}
//Количество товаров дешевле 100 рублей
private void getGoodsLess100OfStore() {
Bson lookup = lookup("goods", "goods_in_store", "name", "fromGood");
Bson unwind = unwind("$fromGood");
Bson match = match(lt("fromGood.price", 100L));
Bson group = group("$name", sum("matchCount", 1L));
List<Document> results = shopsCollection.aggregate(Arrays.asList(lookup, unwind, match, group)).into(new ArrayList<>());
results.forEach(doc -> System.out.printf("Магазин: \"%s\". Количество товаров дешевле 100 рублей: %s\n", doc.get("_id"), doc.get("matchCount")));
}
void getStatistic() {
getAllStaticFacet();
}
public void close() {
mongoClient.close();
}
}
|
UTF-8
|
Java
| 9,745
|
java
|
MongoStorage.java
|
Java
|
[
{
"context": " ServerAddress serverAddress = new ServerAddress(\"127.0.0.1\", 27017);\n try {\n mongoClient =",
"end": 1575,
"score": 0.9537948966026306,
"start": 1566,
"tag": "IP_ADDRESS",
"value": "127.0.0.1"
}
] | null |
[] |
import com.mongodb.MongoClient;
import com.mongodb.MongoConfigurationException;
import com.mongodb.ServerAddress;
import com.mongodb.client.FindIterable;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoCursor;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.model.Facet;
import com.mongodb.client.model.Updates;
import org.bson.Document;
import org.bson.conversions.Bson;
import java.io.Closeable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;
import org.bson.json.JsonWriterSettings;
import static com.mongodb.client.model.Accumulators.*;
import static com.mongodb.client.model.Aggregates.*;
import static com.mongodb.client.model.Filters.*;
import static com.mongodb.client.model.Projections.*;
import static com.mongodb.client.model.Sorts.descending;
import static java.util.Arrays.asList;
/**
* Created by User on 17 Февр., 2020
*/
public class MongoStorage implements Closeable {
// Объект для работы с Mongo
private MongoClient mongoClient;
private MongoDatabase mongoDatabase;
// Объект для работы с коллекцией магазинов
private MongoCollection<Document> shopsCollection;
// Объект для работы с коллекцией товаров
private MongoCollection<Document> goodsCollection;
private static Consumer<Document> printDocuments() {
return doc -> System.out.println(doc.toJson(JsonWriterSettings.builder().indent(true).build()));
}
void init() {
ServerAddress serverAddress = new ServerAddress("127.0.0.1", 27017);
try {
mongoClient = new MongoClient(serverAddress);
mongoDatabase = mongoClient.getDatabase("local");
} catch (MongoConfigurationException Exc) {
System.out.println("Не удалось подключиться к Mongo");
System.out.println(Exc.getMessage());
}
shopsCollection = mongoDatabase.getCollection("shops");
goodsCollection = mongoDatabase.getCollection("goods");
// Удалим
shopsCollection.drop();
goodsCollection.drop();
}
boolean addShop(String name) {
Bson filter = eq("name", name);
Document shop = shopsCollection.find(filter).first();
if (shop != null) {
return false;
}
shop = new Document()
.append("name", name)
.append("goods_in_store", asList());
shopsCollection.insertOne(shop);
return true;
}
boolean addGood(String name, int price) {
Bson filter = eq("name", name);
Document good = goodsCollection.find(filter).first();
if (good != null) {
return false;
}
good = new Document()
.append("name", name)
.append("price", price);
goodsCollection.insertOne(good);
return true;
}
boolean addGood2Shop(String goodName, String shopName) {
Bson filter = eq("name", goodName);
Document good = goodsCollection.find(filter).first();
if (good == null) {
return false;
}
filter = eq("name", shopName);
Bson updateGoods = Updates.addToSet("goods_in_store", goodName);
Document shop = shopsCollection.findOneAndUpdate(filter, updateGoods);
return true;
}
//все по магазинам
private void getAllStaticFacet() {
Bson lookup = lookup("goods", "goods_in_store", "name", "fromGood");
Bson unwind = unwind("$fromGood");
Bson sort = sort(descending("fromGood.price"));
Bson group = group("$name",
sum("count", 1L),
avg("averagePrice", "$fromGood.price"),
last("minPriceGood", "$fromGood"),
first("maxPriceGood", "$fromGood"));
Bson match = match(lt("fromGood.price", 100L));
Bson matchGroup = group("$name", sum("matchCount", 1L));
Bson faset1 = facet(
new Facet("shopInfo", lookup, unwind, sort, group),
new Facet("under100", lookup, unwind, match, matchGroup)
);
List<Document> allResults = shopsCollection.aggregate(Arrays.asList(faset1)).into(new ArrayList<>());
Document res = allResults.get(0);
ArrayList<Document> shopInfoDoc = (ArrayList<Document>) res.get("shopInfo");
ArrayList<Document> under100Doc = (ArrayList<Document>) res.get("under100");
StringBuilder builder = new StringBuilder();
shopInfoDoc.forEach(doc -> {
String shopName = (String) doc.get("_id");
builder.append("\n\nМагазин \"");
builder.append(shopName);
builder.append("\"");
builder.append("\n— Общее количество товаров: ");
builder.append(doc.get("count"));
builder.append("\n— Средяя цена товара: ");
builder.append(doc.get("averagePrice"));
Document good = (Document) doc.get("minPriceGood");
if (good != null) {
builder.append("\n— Самый дешевый товар: ");
builder.append(good.get("name"));
builder.append(" - ");
builder.append(good.get("price"));
}
good = (Document) doc.get("maxPriceGood");
if (good != null) {
builder.append("\n— Самый дорогой товар: ");
builder.append(good.get("name"));
builder.append(" - ");
builder.append(good.get("price"));
}
for (int i = under100Doc.size() - 1; i >= 0; i--) {
Document shopDoc = under100Doc.get(i);
String currentShopName = (String) shopDoc.get("_id");
if (shopName.equals(currentShopName)) {
builder.append("\n— Количество товаров, дешевле 100 рублей: ");
builder.append(shopDoc.get("matchCount"));
under100Doc.remove(i);
break;
}
}
});
System.out.println(builder.toString());
}
// Общее количество товаров по каждому магазину
private void getGoodCountOfStore() {
Bson unwind = unwind("$goods_in_store");
Bson group = group("$name", sum("count", 1L));
Bson project = project(fields(excludeId(), include("name", "count"), computed("name", "$_id")));
List<Document> results = shopsCollection.aggregate(Arrays.asList(unwind, group, project)).into(new ArrayList<>());
results.forEach(doc -> System.out.printf("Магазин: \"%s\". Количество товаров: %s\n", doc.get("name"), doc.get("count")));
}
//Средняя цена товара по каждому магазину
private void getGoodAvgOfStore() {
Bson lookup = lookup("goods", "goods_in_store", "name", "fromGood");
Bson unwind = unwind("$fromGood");
Bson group = group("$name", avg("averagePrice", "$fromGood.price"));
List<Document> results = shopsCollection.aggregate(Arrays.asList(lookup, unwind, group)).into(new ArrayList<>());
results.forEach(doc -> System.out.printf("Магазин: \"%s\". Средняя цена: %s\n", doc.get("_id"), doc.get("averagePrice")));
}
//Самый дешевый и дорогой товар в каждом магазине
private void getGoodMaxOfStore() {
Bson lookup = lookup("goods", "goods_in_store", "name", "fromGood");
Bson unwind = unwind("$fromGood");
Bson sort = sort(descending("fromGood.price"));
Bson group1 = group("$name", last("min", "$fromGood"));
Bson group2 = group("$name", first("max", "$fromGood"));
List<Document> results = shopsCollection.aggregate(Arrays.asList(lookup, unwind, sort, group1)).into(new ArrayList<>());
results.forEach(doc -> {
Document last = (Document) doc.get("min");
if (last != null) {
String goodName = (String) last.get("name");
System.out.printf("Магазин: \"%s\". Самый дешевый товар: %s\n", doc.get("_id"), goodName);
}
});
results = shopsCollection.aggregate(Arrays.asList(lookup, unwind, sort, group2)).into(new ArrayList<>());
results.forEach(doc -> {
Document last = (Document) doc.get("max");
if (last != null) {
String goodName = (String) last.get("name");
System.out.printf("Магазин: \"%s\". Самый дорогой товар: %s\n", doc.get("_id"), goodName);
}
});
}
//Количество товаров дешевле 100 рублей
private void getGoodsLess100OfStore() {
Bson lookup = lookup("goods", "goods_in_store", "name", "fromGood");
Bson unwind = unwind("$fromGood");
Bson match = match(lt("fromGood.price", 100L));
Bson group = group("$name", sum("matchCount", 1L));
List<Document> results = shopsCollection.aggregate(Arrays.asList(lookup, unwind, match, group)).into(new ArrayList<>());
results.forEach(doc -> System.out.printf("Магазин: \"%s\". Количество товаров дешевле 100 рублей: %s\n", doc.get("_id"), doc.get("matchCount")));
}
void getStatistic() {
getAllStaticFacet();
}
public void close() {
mongoClient.close();
}
}
| 9,745
| 0.599501
| 0.592239
| 233
| 38.596565
| 30.03875
| 153
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.918455
| false
| false
|
2
|
5397b8414b4a2eee05b382b01a9b439952729aea
| 25,297,357,436,690
|
0f86c3ef25a57d2928ad2991c157efeac38f53e5
|
/app/src/main/java/capcat/app/web/Test2.java
|
e0b3dc2451c3e0a7ae85fa2f6c2d8bd6757bd851
|
[] |
no_license
|
reserford/capcat
|
https://github.com/reserford/capcat
|
7d5855b47c4548d6fbe2a59e244f55414ef0cb20
|
4197ddcdb858215e3483252af24971063fc6f11f
|
refs/heads/master
| 2016-08-03T18:25:20.368000
| 2013-07-09T14:40:55
| 2013-07-09T14:40:55
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package capcat.app.web;
import capcat.app.annotation.TestApp;
import capcat.vertx.ServerService;
import capcat.vertx.annotation.Action;
import capcat.vertx.annotation.Controller;
import capcat.vertx.annotation.Route;
import capcat.vertx.Context;
/**
* Created with IntelliJ IDEA.
* User: repnikov
* Date: 04.07.13
* Time: 18:31
* To change this template use File | Settings | File Templates.
*/
@TestApp
@Controller(route =
@Route(pattern = "/test/c")
)
public class Test2 implements ServerService {
@Action(routes = {
@Route(pattern = "/a1/:name")
})
public static void action1(Context ctx) {
String name = ctx.request().params().get("name");
ctx.response().end("Hello, " + name);
}
@Action(name = "test - 2", routes = {
@Route(pattern = "/a2/:name")
})
public static void action2(Context ctx) {
String name = ctx.request().params().get("name");
ctx.response().end("Bye, " + name);
}
}
|
UTF-8
|
Java
| 986
|
java
|
Test2.java
|
Java
|
[
{
"context": "text;\n\n/**\n * Created with IntelliJ IDEA.\n * User: repnikov\n * Date: 04.07.13\n * Time: 18:31\n * To change thi",
"end": 300,
"score": 0.9993529915809631,
"start": 292,
"tag": "USERNAME",
"value": "repnikov"
}
] | null |
[] |
package capcat.app.web;
import capcat.app.annotation.TestApp;
import capcat.vertx.ServerService;
import capcat.vertx.annotation.Action;
import capcat.vertx.annotation.Controller;
import capcat.vertx.annotation.Route;
import capcat.vertx.Context;
/**
* Created with IntelliJ IDEA.
* User: repnikov
* Date: 04.07.13
* Time: 18:31
* To change this template use File | Settings | File Templates.
*/
@TestApp
@Controller(route =
@Route(pattern = "/test/c")
)
public class Test2 implements ServerService {
@Action(routes = {
@Route(pattern = "/a1/:name")
})
public static void action1(Context ctx) {
String name = ctx.request().params().get("name");
ctx.response().end("Hello, " + name);
}
@Action(name = "test - 2", routes = {
@Route(pattern = "/a2/:name")
})
public static void action2(Context ctx) {
String name = ctx.request().params().get("name");
ctx.response().end("Bye, " + name);
}
}
| 986
| 0.639959
| 0.623732
| 39
| 24.282051
| 19.201962
| 64
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.410256
| false
| false
|
2
|
501efb542fa8ab7f2f7a3701d7fbe03ec89a190b
| 32,521,492,382,708
|
e982763f854867f8f85bf6cdb156830110628b7c
|
/app/src/main/java/com/nikita/firststep/activity/activity/adapter/ShopsAdapter.java
|
913670581ac756142599cb2a2801c21042729334
|
[] |
no_license
|
NikiZ97/SimpleCityGuide
|
https://github.com/NikiZ97/SimpleCityGuide
|
e748646eb5a32c3bd0afaeb91589cea788437a04
|
e8df4999297998b1688d480434f18d137517d465
|
refs/heads/master
| 2020-12-31T00:52:52.209000
| 2017-03-13T18:36:47
| 2017-03-13T18:36:47
| 80,543,068
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.nikita.firststep.activity.activity.adapter;
import android.content.Context;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.nikita.firststep.activity.activity.other.YaroslavlObject;
import java.util.ArrayList;
import java.util.List;
import nikita.myappfirststep.R;
/**
* Created by nikita on 14.11.16.
*/
public class ShopsAdapter extends RecyclerView.Adapter<ShopsAdapter.MyViewHolder> {
private Context mContext;
private List<YaroslavlObject> yaroslavlObjectList;
public ShopsAdapter(Context mContext, List<YaroslavlObject> yaroslavlObjectList) {
this.mContext = mContext;
this.yaroslavlObjectList = yaroslavlObjectList;
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.shop_card, parent, false);
return new MyViewHolder(view);
}
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
YaroslavlObject yaroslavlObject = yaroslavlObjectList.get(position);
holder.title.setText(yaroslavlObject.getName());
holder.distance.setText(yaroslavlObject.getDistance() + " км");
Glide.with(mContext).load(yaroslavlObject.getImage()).into(holder.image);
}
@Override
public int getItemCount() {
return yaroslavlObjectList.size();
}
class MyViewHolder extends RecyclerView.ViewHolder {
TextView title, distance;
ImageView image;
CardView cardView;
MyViewHolder(View itemView) {
super(itemView);
title = (TextView) itemView.findViewById(R.id.title);
distance = (TextView) itemView.findViewById(R.id.distance);
image = (ImageView) itemView.findViewById(R.id.thumbnail);
cardView = (CardView) itemView.findViewById(R.id.card_view);
}
}
/**
* This method adds founded elements into list
* @param newList - list that contains elements which were founded by searchview
*/
public void setFilter(ArrayList<YaroslavlObject> newList) {
yaroslavlObjectList = new ArrayList<>();
yaroslavlObjectList.addAll(newList);
notifyDataSetChanged();
}
}
|
UTF-8
|
Java
| 2,520
|
java
|
ShopsAdapter.java
|
Java
|
[
{
"context": "import nikita.myappfirststep.R;\n\n/**\n * Created by nikita on 14.11.16.\n */\npublic class ShopsAdapter extend",
"end": 550,
"score": 0.9994535446166992,
"start": 544,
"tag": "USERNAME",
"value": "nikita"
}
] | null |
[] |
package com.nikita.firststep.activity.activity.adapter;
import android.content.Context;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.nikita.firststep.activity.activity.other.YaroslavlObject;
import java.util.ArrayList;
import java.util.List;
import nikita.myappfirststep.R;
/**
* Created by nikita on 14.11.16.
*/
public class ShopsAdapter extends RecyclerView.Adapter<ShopsAdapter.MyViewHolder> {
private Context mContext;
private List<YaroslavlObject> yaroslavlObjectList;
public ShopsAdapter(Context mContext, List<YaroslavlObject> yaroslavlObjectList) {
this.mContext = mContext;
this.yaroslavlObjectList = yaroslavlObjectList;
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.shop_card, parent, false);
return new MyViewHolder(view);
}
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
YaroslavlObject yaroslavlObject = yaroslavlObjectList.get(position);
holder.title.setText(yaroslavlObject.getName());
holder.distance.setText(yaroslavlObject.getDistance() + " км");
Glide.with(mContext).load(yaroslavlObject.getImage()).into(holder.image);
}
@Override
public int getItemCount() {
return yaroslavlObjectList.size();
}
class MyViewHolder extends RecyclerView.ViewHolder {
TextView title, distance;
ImageView image;
CardView cardView;
MyViewHolder(View itemView) {
super(itemView);
title = (TextView) itemView.findViewById(R.id.title);
distance = (TextView) itemView.findViewById(R.id.distance);
image = (ImageView) itemView.findViewById(R.id.thumbnail);
cardView = (CardView) itemView.findViewById(R.id.card_view);
}
}
/**
* This method adds founded elements into list
* @param newList - list that contains elements which were founded by searchview
*/
public void setFilter(ArrayList<YaroslavlObject> newList) {
yaroslavlObjectList = new ArrayList<>();
yaroslavlObjectList.addAll(newList);
notifyDataSetChanged();
}
}
| 2,520
| 0.708102
| 0.704925
| 77
| 31.701298
| 26.790707
| 86
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.545455
| false
| false
|
2
|
56ff0e19c84e1ca108047f4f7f8cd472dad2f57e
| 4,930,622,468,504
|
38369a523fa0866e1a5ceee3fea184e31e856505
|
/src/expression/TokenEvaluatable.java
|
1d230a5de08a170b13386640e65e14f904606260
|
[] |
no_license
|
garethgeorge/ApCompSci_Calculator
|
https://github.com/garethgeorge/ApCompSci_Calculator
|
cb3e01e3cbe3d9f0f35b1e81b5ed6d5bcc299927
|
0843e1ee4f420a8467773e1a886eff4bc1ceccb8
|
refs/heads/master
| 2016-09-06T06:24:03.820000
| 2014-12-01T16:13:43
| 2014-12-01T16:13:47
| 27,358,342
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package expression;
public interface TokenEvaluatable {
public TokenValue eval(ExpressionEvaluator eval);
}
|
UTF-8
|
Java
| 110
|
java
|
TokenEvaluatable.java
|
Java
|
[] | null |
[] |
package expression;
public interface TokenEvaluatable {
public TokenValue eval(ExpressionEvaluator eval);
}
| 110
| 0.827273
| 0.827273
| 5
| 21
| 19.401031
| 50
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.6
| false
| false
|
2
|
7a8a51297cf0e334d3b19f2ccd649d0addfbe3b3
| 6,176,162,984,863
|
6be39fc2c882d0b9269f1530e0650fd3717df493
|
/weixin反编译/sources/com/tencent/mm/plugin/appbrand/appusage/r.java
|
d3abbcd090635e5aaa1f4ac4f10d8047bd84406a
|
[] |
no_license
|
sir-deng/res
|
https://github.com/sir-deng/res
|
f1819af90b366e8326bf23d1b2f1074dfe33848f
|
3cf9b044e1f4744350e5e89648d27247c9dc9877
|
refs/heads/master
| 2022-06-11T21:54:36.725000
| 2020-05-07T06:03:23
| 2020-05-07T06:03:23
| 155,177,067
| 5
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.tencent.mm.plugin.appbrand.appusage;
import com.tencent.mm.ad.a;
import com.tencent.mm.ad.b;
import com.tencent.mm.protocal.c.ajh;
import com.tencent.mm.protocal.c.aji;
class r extends a<aji> {
r(int i, int i2, int i3, int i4) {
b.a aVar = new b.a();
com.tencent.mm.bp.a ajh = new ajh();
ajh.aAk = i;
ajh.condition = i2;
ajh.wxA = i3;
ajh.wxB = i4;
aVar.hnT = ajh;
aVar.hnU = new aji();
aVar.uri = "/cgi-bin/mmbiz-bin/wxaapp/getwxausagerecord";
this.gLB = aVar.Kf();
}
}
|
UTF-8
|
Java
| 573
|
java
|
r.java
|
Java
|
[] | null |
[] |
package com.tencent.mm.plugin.appbrand.appusage;
import com.tencent.mm.ad.a;
import com.tencent.mm.ad.b;
import com.tencent.mm.protocal.c.ajh;
import com.tencent.mm.protocal.c.aji;
class r extends a<aji> {
r(int i, int i2, int i3, int i4) {
b.a aVar = new b.a();
com.tencent.mm.bp.a ajh = new ajh();
ajh.aAk = i;
ajh.condition = i2;
ajh.wxA = i3;
ajh.wxB = i4;
aVar.hnT = ajh;
aVar.hnU = new aji();
aVar.uri = "/cgi-bin/mmbiz-bin/wxaapp/getwxausagerecord";
this.gLB = aVar.Kf();
}
}
| 573
| 0.579407
| 0.568935
| 21
| 26.285715
| 15.826869
| 65
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.857143
| false
| false
|
2
|
fdfd565ee2d9c9a07d9a7c83ccc8810185eed919
| 10,127,532,910,869
|
2b438c607ca0b2ee575eec4752cc7c5c7792f4cc
|
/swing-jdbc-two-tier-app/src/main/java/com/cherkashyn/vitalii/indirector/workers/service/exception/RepeatInsertException.java
|
cf9d0d9d389d48b4b59542ee762a2d969d15294d
|
[] |
no_license
|
cherkavi/java-code-example
|
https://github.com/cherkavi/java-code-example
|
a94a4c5eebd6fb20274dc4852c13e7e8779a7570
|
9c640b7a64e64290df0b4a6820747a7c6b87ae6d
|
refs/heads/master
| 2023-02-08T09:03:37.056000
| 2023-02-06T15:18:21
| 2023-02-06T15:18:21
| 197,267,286
| 0
| 4
| null | false
| 2022-12-15T23:57:37
| 2019-07-16T21:01:20
| 2022-01-12T10:51:15
| 2022-12-15T23:57:33
| 5,454
| 0
| 4
| 60
|
Java
| false
| false
|
package com.cherkashyn.vitalii.indirector.workers.service.exception;
public class RepeatInsertException extends ServiceException{
private static final long serialVersionUID = 1L;
public RepeatInsertException() {
super();
}
public RepeatInsertException(String message, Throwable cause,
boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
public RepeatInsertException(String message, Throwable cause) {
super(message, cause);
}
public RepeatInsertException(String message) {
super(message);
}
public RepeatInsertException(Throwable cause) {
super(cause);
}
}
|
UTF-8
|
Java
| 657
|
java
|
RepeatInsertException.java
|
Java
|
[] | null |
[] |
package com.cherkashyn.vitalii.indirector.workers.service.exception;
public class RepeatInsertException extends ServiceException{
private static final long serialVersionUID = 1L;
public RepeatInsertException() {
super();
}
public RepeatInsertException(String message, Throwable cause,
boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
public RepeatInsertException(String message, Throwable cause) {
super(message, cause);
}
public RepeatInsertException(String message) {
super(message);
}
public RepeatInsertException(Throwable cause) {
super(cause);
}
}
| 657
| 0.785388
| 0.783866
| 27
| 23.333334
| 25.91153
| 68
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.444444
| false
| false
|
2
|
587efa00175ae5ed2f93ead18d28250f98eac5eb
| 23,716,809,461,200
|
87b99b5ee2dd5b7c3200b9e544aeb03226f179be
|
/src/join/WaitAndNotify/Customer.java
|
96c1fedfe95259b3c682c8266c1bedc6c978604c
|
[] |
no_license
|
cendi2005/thread
|
https://github.com/cendi2005/thread
|
ba23f14db98b1a99529425ae1fa0009f0297cd6c
|
8630ece2d234eef7c7c61cc827821301f106d71c
|
refs/heads/master
| 2021-01-20T08:30:49.071000
| 2018-02-13T13:53:19
| 2018-02-13T13:53:19
| 90,157,387
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package join.WaitAndNotify;
import java.util.concurrent.TimeUnit;
public class Customer implements Runnable{
//对象监视器
private Object monitor;
public Customer(Object monitor)
{
this.monitor = monitor;
}
// synchronized (obj) {
// * while (<condition does not hold>)
// * obj.wait();
// * ... // Perform action appropriate to condition
// * }
//
public void getValue()
{
try
{
synchronized (monitor)
{
// Thread.sleep(1000);
TimeUnit.SECONDS.sleep(1);
//如果灭有产品,就等待
if (ValueObject.value.equals(""))
monitor.wait();
System.out.println(Thread.currentThread().getName()+"Get的值是:" + ValueObject.value);
ValueObject.value = "";
// lock.notify();
monitor.notifyAll();
}
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
@Override
public void run() {
while (true){
// this.getValue();
synchronized (monitor)
{
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
//如果灭有产品,就等待
if (ValueObject.value.equals(""))
try {
monitor.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName()+"Get的值是:" + ValueObject.value);
ValueObject.value = "";
// lock.notify();
monitor.notifyAll();
}
}
}
}
|
UTF-8
|
Java
| 1,948
|
java
|
Customer.java
|
Java
|
[] | null |
[] |
package join.WaitAndNotify;
import java.util.concurrent.TimeUnit;
public class Customer implements Runnable{
//对象监视器
private Object monitor;
public Customer(Object monitor)
{
this.monitor = monitor;
}
// synchronized (obj) {
// * while (<condition does not hold>)
// * obj.wait();
// * ... // Perform action appropriate to condition
// * }
//
public void getValue()
{
try
{
synchronized (monitor)
{
// Thread.sleep(1000);
TimeUnit.SECONDS.sleep(1);
//如果灭有产品,就等待
if (ValueObject.value.equals(""))
monitor.wait();
System.out.println(Thread.currentThread().getName()+"Get的值是:" + ValueObject.value);
ValueObject.value = "";
// lock.notify();
monitor.notifyAll();
}
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
@Override
public void run() {
while (true){
// this.getValue();
synchronized (monitor)
{
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
//如果灭有产品,就等待
if (ValueObject.value.equals(""))
try {
monitor.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName()+"Get的值是:" + ValueObject.value);
ValueObject.value = "";
// lock.notify();
monitor.notifyAll();
}
}
}
}
| 1,948
| 0.445802
| 0.442614
| 78
| 23.128204
| 20.867321
| 99
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.307692
| false
| false
|
2
|
88845155a2df26fc59eaf205532ec356b427a214
| 28,570,122,463,409
|
e7209e2319882043d53f93fd577bcfb6406c61ec
|
/src/main/java/problems/graphs/LC1222QueensThatCanAttackTheKing.java
|
5bea03e47c74f1bd06f22eed84ed1612413ad85c
|
[] |
no_license
|
contacttoakhil/DataStructures
|
https://github.com/contacttoakhil/DataStructures
|
7b4f09bfe2ce5d2bb50ee3ad90b9eaf982573bb5
|
5ef935397a0371b182e14848d086bb2b7ed6415f
|
refs/heads/master
| 2021-05-13T22:00:37.593000
| 2020-09-11T05:03:26
| 2020-09-11T05:03:26
| 116,477,524
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package main.java.problems.graphs;
import java.util.*;
/***
* On an 8x8 chessboard, there can be multiple Black Queens and one White King.
*
* Given an array of integer coordinates queens that represents the positions of the Black Queens, and a pair of coordinates king that represent the position of the White King,
* return the coordinates of all the queens (in any order) that can attack the King.
*
* Input: queens = [[0,1],[1,0],[4,0],[0,4],[3,3],[2,4]], king = [0,0]
* Output: [[0,1],[1,0],[3,3]]
* Explanation:
* The queen at [0,1] can attack the king cause they're in the same row.
* The queen at [1,0] can attack the king cause they're in the same column.
* The queen at [3,3] can attack the king cause they're in the same diagnal.
* The queen at [0,4] can't attack the king cause it's blocked by the queen at [0,1].
* The queen at [4,0] can't attack the king cause it's blocked by the queen at [1,0].
* The queen at [2,4] can't attack the king cause it's not in the same row/column/diagnal as the king.
*/
public class LC1222QueensThatCanAttackTheKing {
public static String COLON = ":";
public List<List<Integer>> queensAttacktheKing(int[][] queens, int[] king) {
List<List<Integer>> result = new ArrayList<>();
Set<String> qset = new HashSet<>();
for(int[] qpos:queens)
qset.add(qpos[0] + COLON + qpos[1]);
int[][] directions = {{0,1},{0,-1},{1,0},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}};
for(int[] dir : directions) {
for(int k = 1; k <= 8; k++){
int xpos = king[0] + dir[0] * k;
int ypos = king[1] + dir[1] * k;
if (qset.contains(xpos + COLON + ypos)){
result.add(Arrays.asList(xpos,ypos));
break;
}
}
}
return result;
}
public static void main(String[] args) {
LC1222QueensThatCanAttackTheKing queensThatCanAttackTheKing = new LC1222QueensThatCanAttackTheKing();
List<List<Integer>> result = queensThatCanAttackTheKing.queensAttacktheKing(new int[][]{{0,1},{1,0},{4,0},{0,4},{3,3},{2,4}}, new int[]{0,0});
System.out.println(result); // [[0, 1], [1, 0], [3, 3]]
}
}
|
UTF-8
|
Java
| 2,235
|
java
|
LC1222QueensThatCanAttackTheKing.java
|
Java
|
[] | null |
[] |
package main.java.problems.graphs;
import java.util.*;
/***
* On an 8x8 chessboard, there can be multiple Black Queens and one White King.
*
* Given an array of integer coordinates queens that represents the positions of the Black Queens, and a pair of coordinates king that represent the position of the White King,
* return the coordinates of all the queens (in any order) that can attack the King.
*
* Input: queens = [[0,1],[1,0],[4,0],[0,4],[3,3],[2,4]], king = [0,0]
* Output: [[0,1],[1,0],[3,3]]
* Explanation:
* The queen at [0,1] can attack the king cause they're in the same row.
* The queen at [1,0] can attack the king cause they're in the same column.
* The queen at [3,3] can attack the king cause they're in the same diagnal.
* The queen at [0,4] can't attack the king cause it's blocked by the queen at [0,1].
* The queen at [4,0] can't attack the king cause it's blocked by the queen at [1,0].
* The queen at [2,4] can't attack the king cause it's not in the same row/column/diagnal as the king.
*/
public class LC1222QueensThatCanAttackTheKing {
public static String COLON = ":";
public List<List<Integer>> queensAttacktheKing(int[][] queens, int[] king) {
List<List<Integer>> result = new ArrayList<>();
Set<String> qset = new HashSet<>();
for(int[] qpos:queens)
qset.add(qpos[0] + COLON + qpos[1]);
int[][] directions = {{0,1},{0,-1},{1,0},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}};
for(int[] dir : directions) {
for(int k = 1; k <= 8; k++){
int xpos = king[0] + dir[0] * k;
int ypos = king[1] + dir[1] * k;
if (qset.contains(xpos + COLON + ypos)){
result.add(Arrays.asList(xpos,ypos));
break;
}
}
}
return result;
}
public static void main(String[] args) {
LC1222QueensThatCanAttackTheKing queensThatCanAttackTheKing = new LC1222QueensThatCanAttackTheKing();
List<List<Integer>> result = queensThatCanAttackTheKing.queensAttacktheKing(new int[][]{{0,1},{1,0},{4,0},{0,4},{3,3},{2,4}}, new int[]{0,0});
System.out.println(result); // [[0, 1], [1, 0], [3, 3]]
}
}
| 2,235
| 0.598658
| 0.5566
| 47
| 46.553192
| 39.331547
| 176
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.723404
| false
| false
|
2
|
cdb5d57822b3ec17f37aef69088fe418307a8308
| 33,646,773,808,339
|
28963c1d69a611687e9fa98f13b1ee1d2738c34b
|
/app/src/main/java/com/example/torey/projectlogin/view/fragment/ProfileFragment.java
|
b9fd11f332e948d94bce72e565b5bd265b4b2909
|
[] |
no_license
|
somsriwatchara/ProjectLogin
|
https://github.com/somsriwatchara/ProjectLogin
|
6c1d919ffb98ee6b7f9ad9e63bff30bb0a2b813a
|
bd2257c0790117d012d8ed693a99f6bb36c07121
|
refs/heads/master
| 2021-01-20T07:01:56.812000
| 2017-09-17T11:41:43
| 2017-09-17T11:41:43
| 101,526,859
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.torey.projectlogin.view.fragment;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.torey.projectlogin.R;
import com.example.torey.projectlogin.Utilities;
import com.example.torey.projectlogin.model.GenericStatus;
import com.example.torey.projectlogin.model.Login;
import com.example.torey.projectlogin.model.UserDetail;
import com.example.torey.projectlogin.model.UserDetailList;
import com.example.torey.projectlogin.service.LoginService;
import com.example.torey.projectlogin.view.Activity.HeroListActivity;
import com.example.torey.projectlogin.view.Activity.MainActivity;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import static com.example.torey.projectlogin.Constants.LOGIN_URL;
public class ProfileFragment extends BaseFragment {
private UserDetail userDetail;
@BindView(R.id.output_member_facebook)
TextView textViewFacebook;
@BindView(R.id.output_member_id)
TextView textViewID;
@BindView(R.id.output_member_ig)
TextView textViewIG;
@BindView(R.id.output_member_line)
TextView textViewLine;
@BindView(R.id.output_member_name)
TextView textViewName;
@BindView(R.id.output_member_page)
TextView textViewPage;
@BindView(R.id.output_member_province)
TextView textViewProvince;
@BindView(R.id.output_member_tel)
TextView textViewTel;
@BindView(R.id.image_profile)
ImageView imageViewProfile;
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.update_name)
EditText editTextUpDateName;
@BindView(R.id.update_facebook)
EditText editTextUpDateFacebook;
@BindView(R.id.update_ig)
EditText editTextUpDateIG;
@BindView(R.id.update_line)
EditText editTextUpDateLine;
@BindView(R.id.update_page)
EditText editTextUpDatePage;
@BindView(R.id.update_province)
EditText editTextUpDateProvince;
@BindView(R.id.update_tel)
EditText editTextUpDateTel;
@BindView(R.id.button_edit_update)
Button buttonEditUpDate;
@BindView(R.id.button_edit_ok)
Button buttonEditOk;
@BindView(R.id.button_edit_cancel)
Button buttonEditCancel;
@BindView(R.id.button_log_out)
Button buttonLogOut;
public static ProfileFragment newInstance(UserDetail userDetail) {
ProfileFragment fragment = new ProfileFragment();
Bundle data = new Bundle();
data.putParcelable("USER_DETAIL", userDetail);
fragment.setArguments(data);
return fragment;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_profile, container, false);
ButterKnife.bind(this, view);
toolbar.setClickable(true);
buttonEditOk.setVisibility(View.GONE);
buttonEditCancel.setVisibility(View.GONE);
editTextUpDateFacebook.setVisibility(View.GONE);
editTextUpDateName.setVisibility(View.GONE);
editTextUpDateIG.setVisibility(View.GONE);
editTextUpDateLine.setVisibility(View.GONE);
editTextUpDatePage.setVisibility(View.GONE);
editTextUpDateProvince.setVisibility(View.GONE);
editTextUpDateTel.setVisibility(View.GONE);
userDetail = getArguments().getParcelable("USER_DETAIL");
SharedPreferences sp = getActivity().getSharedPreferences("userDetail", getContext().MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
editor.putString("User", String.valueOf(userDetail));
editor.commit();
if (userDetail != null) {
textViewName.setText(userDetail.getMember_name());
textViewID.setText(userDetail.getMember_id());
textViewIG.setText(userDetail.getMember_ig());
textViewFacebook.setText(userDetail.getMember_facebook());
textViewLine.setText(userDetail.getMember_line());
textViewTel.setText(userDetail.getMember_tel());
textViewPage.setText(userDetail.getMember_page());
textViewProvince.setText(userDetail.getMember_province());
Utilities.setLoadImages(getContext(), userDetail.getMember_img(), imageViewProfile);
}
return view;
}
@OnClick(R.id.button_edit_cancel)
void onClickCancel() {
buttonEditOk.setVisibility(View.GONE);
buttonEditCancel.setVisibility(View.GONE);
editTextUpDateFacebook.setVisibility(View.GONE);
editTextUpDateName.setVisibility(View.GONE);
editTextUpDateIG.setVisibility(View.GONE);
editTextUpDateLine.setVisibility(View.GONE);
editTextUpDatePage.setVisibility(View.GONE);
editTextUpDateProvince.setVisibility(View.GONE);
editTextUpDateTel.setVisibility(View.GONE);
textViewProvince.setVisibility(View.VISIBLE);
textViewPage.setVisibility(View.VISIBLE);
textViewTel.setVisibility(View.VISIBLE);
textViewLine.setVisibility(View.VISIBLE);
textViewFacebook.setVisibility(View.VISIBLE);
textViewIG.setVisibility(View.VISIBLE);
textViewName.setVisibility(View.VISIBLE);
buttonEditUpDate.setVisibility(View.VISIBLE);
buttonLogOut.setVisibility(View.VISIBLE);
}
@OnClick(R.id.button_log_out)
void onClickLogOut() {
final AlertDialog.Builder ab = new AlertDialog.Builder(getContext());
ab.setMessage("Confirm to Log Out ? ");
ab.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
// TODO Auto-generated method stub
Intent intent = new Intent(getContext(), MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_CLEAR_TASK |
Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
});
ab.setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
dialog.cancel();
}
});
ab.show();
}
@OnClick(R.id.image_btn_back_tool)
void onClickBack() {
if(getActivity() != null){
getActivity().finish();
}
}
@OnClick(R.id.button_edit_ok)
void onClickEditOk() {
final String updateIG = editTextUpDateIG.getText().toString();
final String updateFacebook = editTextUpDateFacebook.getText().toString();
final String updateName = editTextUpDateName.getText().toString();
final String updateLine = editTextUpDateLine.getText().toString();
final String updatePage = editTextUpDatePage.getText().toString();
final String updateProvince = editTextUpDateProvince.getText().toString();
final String updateTel = editTextUpDateTel.getText().toString();
if (userDetail != null && !updateName.equals("") && editTextUpDateName.getText().length() > 0) {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(LOGIN_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
LoginService loginService = retrofit.create(LoginService.class);
Call<UserDetailList> call = loginService.editMemberName(userDetail.getMember_id(),
updateName, updateFacebook, updateIG, updateLine, updatePage, updateProvince, updateTel);
final ProgressDialog progressDialog;
progressDialog = new ProgressDialog(getContext());
progressDialog.setMessage(" loading....");
showDialog();
call.enqueue(new Callback<UserDetailList>() {
@Override
public void onResponse(Call<UserDetailList> call, Response<UserDetailList> response) {
if (response.body().getStatus_code() == 1000) {
List<UserDetail> userDetails = response.body().getElements();
textViewName.setText(userDetails.get(0).getMember_name());
textViewIG.setText(userDetails.get(0).getMember_ig());
textViewFacebook.setText(userDetails.get(0).getMember_facebook());
textViewLine.setText(userDetails.get(0).getMember_line());
textViewTel.setText(userDetails.get(0).getMember_tel());
textViewPage.setText(userDetails.get(0).getMember_page());
textViewProvince.setText(userDetails.get(0).getMember_province());
Toast.makeText(getContext(), "Successful...", Toast.LENGTH_LONG).show();
buttonEditOk.setVisibility(View.GONE);
editTextUpDateFacebook.setVisibility(View.GONE);
editTextUpDateName.setVisibility(View.GONE);
editTextUpDateIG.setVisibility(View.GONE);
editTextUpDateLine.setVisibility(View.GONE);
editTextUpDatePage.setVisibility(View.GONE);
editTextUpDateProvince.setVisibility(View.GONE);
editTextUpDateTel.setVisibility(View.GONE);
buttonEditUpDate.setVisibility(View.VISIBLE);
buttonEditCancel.setVisibility(View.GONE);
buttonLogOut.setVisibility(View.VISIBLE);
textViewProvince.setVisibility(View.VISIBLE);
textViewPage.setVisibility(View.VISIBLE);
textViewTel.setVisibility(View.VISIBLE);
textViewLine.setVisibility(View.VISIBLE);
textViewFacebook.setVisibility(View.VISIBLE);
textViewIG.setVisibility(View.VISIBLE);
textViewName.setVisibility(View.VISIBLE);
hideDialog();
} else {
Toast.makeText(getContext(), response.body().getStatus_description(), Toast.LENGTH_LONG).show();
hideDialog();
}
}
@Override
public void onFailure(Call<UserDetailList> call, Throwable t) {
Toast.makeText(getContext(), t.getMessage(), Toast.LENGTH_LONG).show();
}
});
}
}
@OnClick(R.id.button_edit_update)
void onClickEdit() {
buttonEditOk.setVisibility(View.VISIBLE);
editTextUpDateFacebook.setVisibility(View.VISIBLE);
editTextUpDateName.setVisibility(View.VISIBLE);
editTextUpDateIG.setVisibility(View.VISIBLE);
editTextUpDateLine.setVisibility(View.VISIBLE);
editTextUpDatePage.setVisibility(View.VISIBLE);
editTextUpDateProvince.setVisibility(View.VISIBLE);
editTextUpDateTel.setVisibility(View.VISIBLE);
buttonEditCancel.setVisibility(View.VISIBLE);
buttonEditUpDate.setVisibility(View.GONE);
buttonLogOut.setVisibility(View.GONE);
textViewProvince.setVisibility(View.GONE);
textViewPage.setVisibility(View.GONE);
textViewTel.setVisibility(View.GONE);
textViewLine.setVisibility(View.GONE);
textViewFacebook.setVisibility(View.GONE);
textViewIG.setVisibility(View.GONE);
textViewName.setVisibility(View.GONE);
if (userDetail != null) {
editTextUpDateName.setText(textViewName.getText());
editTextUpDateIG.setText(textViewIG.getText());
editTextUpDateFacebook.setText(textViewFacebook.getText());
editTextUpDateLine.setText(textViewLine.getText());
editTextUpDateTel.setText(textViewTel.getText());
editTextUpDatePage.setText(textViewPage.getText());
editTextUpDateProvince.setText(textViewProvince.getText());
}
}
}
|
UTF-8
|
Java
| 12,794
|
java
|
ProfileFragment.java
|
Java
|
[] | null |
[] |
package com.example.torey.projectlogin.view.fragment;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.torey.projectlogin.R;
import com.example.torey.projectlogin.Utilities;
import com.example.torey.projectlogin.model.GenericStatus;
import com.example.torey.projectlogin.model.Login;
import com.example.torey.projectlogin.model.UserDetail;
import com.example.torey.projectlogin.model.UserDetailList;
import com.example.torey.projectlogin.service.LoginService;
import com.example.torey.projectlogin.view.Activity.HeroListActivity;
import com.example.torey.projectlogin.view.Activity.MainActivity;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import static com.example.torey.projectlogin.Constants.LOGIN_URL;
public class ProfileFragment extends BaseFragment {
private UserDetail userDetail;
@BindView(R.id.output_member_facebook)
TextView textViewFacebook;
@BindView(R.id.output_member_id)
TextView textViewID;
@BindView(R.id.output_member_ig)
TextView textViewIG;
@BindView(R.id.output_member_line)
TextView textViewLine;
@BindView(R.id.output_member_name)
TextView textViewName;
@BindView(R.id.output_member_page)
TextView textViewPage;
@BindView(R.id.output_member_province)
TextView textViewProvince;
@BindView(R.id.output_member_tel)
TextView textViewTel;
@BindView(R.id.image_profile)
ImageView imageViewProfile;
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.update_name)
EditText editTextUpDateName;
@BindView(R.id.update_facebook)
EditText editTextUpDateFacebook;
@BindView(R.id.update_ig)
EditText editTextUpDateIG;
@BindView(R.id.update_line)
EditText editTextUpDateLine;
@BindView(R.id.update_page)
EditText editTextUpDatePage;
@BindView(R.id.update_province)
EditText editTextUpDateProvince;
@BindView(R.id.update_tel)
EditText editTextUpDateTel;
@BindView(R.id.button_edit_update)
Button buttonEditUpDate;
@BindView(R.id.button_edit_ok)
Button buttonEditOk;
@BindView(R.id.button_edit_cancel)
Button buttonEditCancel;
@BindView(R.id.button_log_out)
Button buttonLogOut;
public static ProfileFragment newInstance(UserDetail userDetail) {
ProfileFragment fragment = new ProfileFragment();
Bundle data = new Bundle();
data.putParcelable("USER_DETAIL", userDetail);
fragment.setArguments(data);
return fragment;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_profile, container, false);
ButterKnife.bind(this, view);
toolbar.setClickable(true);
buttonEditOk.setVisibility(View.GONE);
buttonEditCancel.setVisibility(View.GONE);
editTextUpDateFacebook.setVisibility(View.GONE);
editTextUpDateName.setVisibility(View.GONE);
editTextUpDateIG.setVisibility(View.GONE);
editTextUpDateLine.setVisibility(View.GONE);
editTextUpDatePage.setVisibility(View.GONE);
editTextUpDateProvince.setVisibility(View.GONE);
editTextUpDateTel.setVisibility(View.GONE);
userDetail = getArguments().getParcelable("USER_DETAIL");
SharedPreferences sp = getActivity().getSharedPreferences("userDetail", getContext().MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
editor.putString("User", String.valueOf(userDetail));
editor.commit();
if (userDetail != null) {
textViewName.setText(userDetail.getMember_name());
textViewID.setText(userDetail.getMember_id());
textViewIG.setText(userDetail.getMember_ig());
textViewFacebook.setText(userDetail.getMember_facebook());
textViewLine.setText(userDetail.getMember_line());
textViewTel.setText(userDetail.getMember_tel());
textViewPage.setText(userDetail.getMember_page());
textViewProvince.setText(userDetail.getMember_province());
Utilities.setLoadImages(getContext(), userDetail.getMember_img(), imageViewProfile);
}
return view;
}
@OnClick(R.id.button_edit_cancel)
void onClickCancel() {
buttonEditOk.setVisibility(View.GONE);
buttonEditCancel.setVisibility(View.GONE);
editTextUpDateFacebook.setVisibility(View.GONE);
editTextUpDateName.setVisibility(View.GONE);
editTextUpDateIG.setVisibility(View.GONE);
editTextUpDateLine.setVisibility(View.GONE);
editTextUpDatePage.setVisibility(View.GONE);
editTextUpDateProvince.setVisibility(View.GONE);
editTextUpDateTel.setVisibility(View.GONE);
textViewProvince.setVisibility(View.VISIBLE);
textViewPage.setVisibility(View.VISIBLE);
textViewTel.setVisibility(View.VISIBLE);
textViewLine.setVisibility(View.VISIBLE);
textViewFacebook.setVisibility(View.VISIBLE);
textViewIG.setVisibility(View.VISIBLE);
textViewName.setVisibility(View.VISIBLE);
buttonEditUpDate.setVisibility(View.VISIBLE);
buttonLogOut.setVisibility(View.VISIBLE);
}
@OnClick(R.id.button_log_out)
void onClickLogOut() {
final AlertDialog.Builder ab = new AlertDialog.Builder(getContext());
ab.setMessage("Confirm to Log Out ? ");
ab.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
// TODO Auto-generated method stub
Intent intent = new Intent(getContext(), MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_CLEAR_TASK |
Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
});
ab.setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
dialog.cancel();
}
});
ab.show();
}
@OnClick(R.id.image_btn_back_tool)
void onClickBack() {
if(getActivity() != null){
getActivity().finish();
}
}
@OnClick(R.id.button_edit_ok)
void onClickEditOk() {
final String updateIG = editTextUpDateIG.getText().toString();
final String updateFacebook = editTextUpDateFacebook.getText().toString();
final String updateName = editTextUpDateName.getText().toString();
final String updateLine = editTextUpDateLine.getText().toString();
final String updatePage = editTextUpDatePage.getText().toString();
final String updateProvince = editTextUpDateProvince.getText().toString();
final String updateTel = editTextUpDateTel.getText().toString();
if (userDetail != null && !updateName.equals("") && editTextUpDateName.getText().length() > 0) {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(LOGIN_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
LoginService loginService = retrofit.create(LoginService.class);
Call<UserDetailList> call = loginService.editMemberName(userDetail.getMember_id(),
updateName, updateFacebook, updateIG, updateLine, updatePage, updateProvince, updateTel);
final ProgressDialog progressDialog;
progressDialog = new ProgressDialog(getContext());
progressDialog.setMessage(" loading....");
showDialog();
call.enqueue(new Callback<UserDetailList>() {
@Override
public void onResponse(Call<UserDetailList> call, Response<UserDetailList> response) {
if (response.body().getStatus_code() == 1000) {
List<UserDetail> userDetails = response.body().getElements();
textViewName.setText(userDetails.get(0).getMember_name());
textViewIG.setText(userDetails.get(0).getMember_ig());
textViewFacebook.setText(userDetails.get(0).getMember_facebook());
textViewLine.setText(userDetails.get(0).getMember_line());
textViewTel.setText(userDetails.get(0).getMember_tel());
textViewPage.setText(userDetails.get(0).getMember_page());
textViewProvince.setText(userDetails.get(0).getMember_province());
Toast.makeText(getContext(), "Successful...", Toast.LENGTH_LONG).show();
buttonEditOk.setVisibility(View.GONE);
editTextUpDateFacebook.setVisibility(View.GONE);
editTextUpDateName.setVisibility(View.GONE);
editTextUpDateIG.setVisibility(View.GONE);
editTextUpDateLine.setVisibility(View.GONE);
editTextUpDatePage.setVisibility(View.GONE);
editTextUpDateProvince.setVisibility(View.GONE);
editTextUpDateTel.setVisibility(View.GONE);
buttonEditUpDate.setVisibility(View.VISIBLE);
buttonEditCancel.setVisibility(View.GONE);
buttonLogOut.setVisibility(View.VISIBLE);
textViewProvince.setVisibility(View.VISIBLE);
textViewPage.setVisibility(View.VISIBLE);
textViewTel.setVisibility(View.VISIBLE);
textViewLine.setVisibility(View.VISIBLE);
textViewFacebook.setVisibility(View.VISIBLE);
textViewIG.setVisibility(View.VISIBLE);
textViewName.setVisibility(View.VISIBLE);
hideDialog();
} else {
Toast.makeText(getContext(), response.body().getStatus_description(), Toast.LENGTH_LONG).show();
hideDialog();
}
}
@Override
public void onFailure(Call<UserDetailList> call, Throwable t) {
Toast.makeText(getContext(), t.getMessage(), Toast.LENGTH_LONG).show();
}
});
}
}
@OnClick(R.id.button_edit_update)
void onClickEdit() {
buttonEditOk.setVisibility(View.VISIBLE);
editTextUpDateFacebook.setVisibility(View.VISIBLE);
editTextUpDateName.setVisibility(View.VISIBLE);
editTextUpDateIG.setVisibility(View.VISIBLE);
editTextUpDateLine.setVisibility(View.VISIBLE);
editTextUpDatePage.setVisibility(View.VISIBLE);
editTextUpDateProvince.setVisibility(View.VISIBLE);
editTextUpDateTel.setVisibility(View.VISIBLE);
buttonEditCancel.setVisibility(View.VISIBLE);
buttonEditUpDate.setVisibility(View.GONE);
buttonLogOut.setVisibility(View.GONE);
textViewProvince.setVisibility(View.GONE);
textViewPage.setVisibility(View.GONE);
textViewTel.setVisibility(View.GONE);
textViewLine.setVisibility(View.GONE);
textViewFacebook.setVisibility(View.GONE);
textViewIG.setVisibility(View.GONE);
textViewName.setVisibility(View.GONE);
if (userDetail != null) {
editTextUpDateName.setText(textViewName.getText());
editTextUpDateIG.setText(textViewIG.getText());
editTextUpDateFacebook.setText(textViewFacebook.getText());
editTextUpDateLine.setText(textViewLine.getText());
editTextUpDateTel.setText(textViewTel.getText());
editTextUpDatePage.setText(textViewPage.getText());
editTextUpDateProvince.setText(textViewProvince.getText());
}
}
}
| 12,794
| 0.663514
| 0.661795
| 295
| 42.369492
| 25.379742
| 120
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.749153
| false
| false
|
2
|
26e6ba4507efabdf6c58f679e0a1e4e39754e5fa
| 32,487,132,650,011
|
9e7da7d1c6530f62097b04d576eb1c090757cb12
|
/app/src/main/java/com/sh/lynn/hz/lehe/base/PreferencesManager.java
|
ed7442a997afd375a2ba780352abdc41a3d3bf14
|
[] |
no_license
|
Huangzhe/LeHe
|
https://github.com/Huangzhe/LeHe
|
5211f5ffd442acb8e13b8716c249e3e79efb857f
|
3785573bc472b272b89a530b903d79ee4ad44956
|
refs/heads/master
| 2021-01-24T09:27:06.447000
| 2018-12-26T15:46:09
| 2018-12-26T15:46:09
| 69,441,366
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.sh.lynn.hz.lehe.base;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
/**
* Created by wanglj on 16/7/4.
*/
public class PreferencesManager {
private SharedPreferences sharedPreferences;
public PreferencesManager(Application application){
sharedPreferences = application.getSharedPreferences(Constant.SP_NAME, Context.MODE_PRIVATE);
}
public void saveJokerIndex(int index,int total){
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putInt(Constant.JOKER_INDEX,index);
editor.putInt(Constant.JOKER_TOTAL,total);
editor.commit();
}
public void saveJoyImageIndex(int index,int total){
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putInt(Constant.JOY_IMAGE_INDEX,index);
editor.putInt(Constant.JOY_IMAGE_TOTAL,total);
editor.commit();
}
public void saveJoyGIFIndex(int index,int total){
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putInt(Constant.JOY_GIF_INDEX,index);
editor.putInt(Constant.JOY_GIF_TOTAL,total);
editor.commit();
}
public int getCurJoyImageIndex(){
return sharedPreferences.getInt(Constant.JOY_IMAGE_INDEX,1);
}
public int getJoyImageTotal(){
return sharedPreferences.getInt(Constant.JOY_IMAGE_TOTAL,200);
}
public int getCurJoyGIFIndex(){
return sharedPreferences.getInt(Constant.JOY_GIF_INDEX,1);
}
public int getJoyGIFTotal(){
return sharedPreferences.getInt(Constant.JOY_GIF_TOTAL,200);
}
public int getCurJokerIndex(){
return sharedPreferences.getInt(Constant.JOKER_INDEX,1);
}
public int getJokerTotal(){
return sharedPreferences.getInt(Constant.JOKER_TOTAL,200);
}
}
|
UTF-8
|
Java
| 1,878
|
java
|
PreferencesManager.java
|
Java
|
[
{
"context": "roid.content.SharedPreferences;\n\n/**\n * Created by wanglj on 16/7/4.\n */\n\npublic class PreferencesManager {",
"end": 166,
"score": 0.9996413588523865,
"start": 160,
"tag": "USERNAME",
"value": "wanglj"
}
] | null |
[] |
package com.sh.lynn.hz.lehe.base;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
/**
* Created by wanglj on 16/7/4.
*/
public class PreferencesManager {
private SharedPreferences sharedPreferences;
public PreferencesManager(Application application){
sharedPreferences = application.getSharedPreferences(Constant.SP_NAME, Context.MODE_PRIVATE);
}
public void saveJokerIndex(int index,int total){
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putInt(Constant.JOKER_INDEX,index);
editor.putInt(Constant.JOKER_TOTAL,total);
editor.commit();
}
public void saveJoyImageIndex(int index,int total){
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putInt(Constant.JOY_IMAGE_INDEX,index);
editor.putInt(Constant.JOY_IMAGE_TOTAL,total);
editor.commit();
}
public void saveJoyGIFIndex(int index,int total){
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putInt(Constant.JOY_GIF_INDEX,index);
editor.putInt(Constant.JOY_GIF_TOTAL,total);
editor.commit();
}
public int getCurJoyImageIndex(){
return sharedPreferences.getInt(Constant.JOY_IMAGE_INDEX,1);
}
public int getJoyImageTotal(){
return sharedPreferences.getInt(Constant.JOY_IMAGE_TOTAL,200);
}
public int getCurJoyGIFIndex(){
return sharedPreferences.getInt(Constant.JOY_GIF_INDEX,1);
}
public int getJoyGIFTotal(){
return sharedPreferences.getInt(Constant.JOY_GIF_TOTAL,200);
}
public int getCurJokerIndex(){
return sharedPreferences.getInt(Constant.JOKER_INDEX,1);
}
public int getJokerTotal(){
return sharedPreferences.getInt(Constant.JOKER_TOTAL,200);
}
}
| 1,878
| 0.699148
| 0.690628
| 66
| 27.454546
| 26.633415
| 102
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.606061
| false
| false
|
2
|
6c3ce0962e3e9e8169394cdae169c44ea9b17a66
| 17,600,775,981,811
|
1fd0842613e96ef5a8abfd30af914bf16c701cf8
|
/ch.eugster.colibri.client.ui/src/ch/eugster/colibri/client/ui/views/ShowProviderErrorListDialog.java
|
ca4b11a801d1c86b74a858d838b53ad5735de97e
|
[] |
no_license
|
ceugster/colibrits2
|
https://github.com/ceugster/colibrits2
|
db840ab2a72468feb09ad5869951c839349c6046
|
1417ac922694c27ba28f03910a36f31ce917f141
|
refs/heads/master
| 2022-04-27T05:35:17.628000
| 2017-01-20T08:21:54
| 2017-01-20T08:21:54
| 259,859,302
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package ch.eugster.colibri.client.ui.views;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import ch.eugster.colibri.persistence.model.Salespoint;
import ch.eugster.colibri.persistence.service.PersistenceService;
public class ShowProviderErrorListDialog extends MessageDialog
{
private TableViewer viewer;
public ShowProviderErrorListDialog(Shell parentShell, String dialogTitle,
Image dialogTitleImage, String dialogMessage, int dialogImageType,
String[] dialogButtonLabels, int defaultIndex, PersistenceService persistenceService, Salespoint salespoint)
{
super(parentShell, dialogTitle, dialogTitleImage, dialogMessage,
dialogImageType, dialogButtonLabels, defaultIndex);
}
@Override
protected Control createCustomArea(Composite parent)
{
parent.setLayout(new GridLayout());
final Table table = new Table(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
table.setHeaderVisible(true);
table.setLayoutData(new GridData(GridData.FILL_BOTH));
this.viewer = new TableViewer(table);
this.viewer.setContentProvider(new ArrayContentProvider());
TableViewerColumn viewerColumn = new TableViewerColumn(this.viewer, SWT.NONE);
viewerColumn.getColumn().setText("Code");
return table;
}
}
|
UTF-8
|
Java
| 1,741
|
java
|
ShowProviderErrorListDialog.java
|
Java
|
[] | null |
[] |
package ch.eugster.colibri.client.ui.views;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import ch.eugster.colibri.persistence.model.Salespoint;
import ch.eugster.colibri.persistence.service.PersistenceService;
public class ShowProviderErrorListDialog extends MessageDialog
{
private TableViewer viewer;
public ShowProviderErrorListDialog(Shell parentShell, String dialogTitle,
Image dialogTitleImage, String dialogMessage, int dialogImageType,
String[] dialogButtonLabels, int defaultIndex, PersistenceService persistenceService, Salespoint salespoint)
{
super(parentShell, dialogTitle, dialogTitleImage, dialogMessage,
dialogImageType, dialogButtonLabels, defaultIndex);
}
@Override
protected Control createCustomArea(Composite parent)
{
parent.setLayout(new GridLayout());
final Table table = new Table(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
table.setHeaderVisible(true);
table.setLayoutData(new GridData(GridData.FILL_BOTH));
this.viewer = new TableViewer(table);
this.viewer.setContentProvider(new ArrayContentProvider());
TableViewerColumn viewerColumn = new TableViewerColumn(this.viewer, SWT.NONE);
viewerColumn.getColumn().setText("Code");
return table;
}
}
| 1,741
| 0.78633
| 0.78633
| 48
| 34.270832
| 27.966303
| 112
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.75
| false
| false
|
2
|
746b6eebd6f39fdee3b72118e3c1f532c124695f
| 15,977,278,342,712
|
6f672fb72caedccb841ee23f53e32aceeaf1895e
|
/domioz-source/src/com/dominos/android/sdk/core/models/json/CouponDaysDeserializer.java
|
349d1f57206d6034b88be919aa44fba8c3821892
|
[] |
no_license
|
cha63506/CompSecurity
|
https://github.com/cha63506/CompSecurity
|
5c69743f660b9899146ed3cf21eceabe3d5f4280
|
eee7e74f4088b9c02dd711c061fc04fb1e4e2654
|
refs/heads/master
| 2018-03-23T04:15:18.480000
| 2015-12-19T01:29:58
| 2015-12-19T01:29:58
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.dominos.android.sdk.core.models.json;
import com.dominos.android.sdk.core.models.coupon.Day;
import com.google.b.t;
import com.google.b.u;
import com.google.b.v;
import com.google.b.w;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class CouponDaysDeserializer
implements v
{
public CouponDaysDeserializer()
{
}
public volatile Object deserialize(w w1, Type type, u u)
{
return deserialize(w1, type, u);
}
public Day[] deserialize(w w1, Type type, u u)
{
if (w1 instanceof t)
{
type = new ArrayList();
for (w1 = w1.i().iterator(); w1.hasNext(); type.add(new Day(((w)w1.next()).c()))) { }
return (Day[])type.toArray(new Day[type.size()]);
} else
{
return (new Day[] {
new Day(w1.c())
});
}
}
}
|
UTF-8
|
Java
| 1,118
|
java
|
CouponDaysDeserializer.java
|
Java
|
[
{
"context": "// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.\n// Jad home page: http://www.geocities.com/kpdus",
"end": 61,
"score": 0.9996484518051147,
"start": 45,
"tag": "NAME",
"value": "Pavel Kouznetsov"
}
] | null |
[] |
// Decompiled by Jad v1.5.8e. Copyright 2001 <NAME>.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.dominos.android.sdk.core.models.json;
import com.dominos.android.sdk.core.models.coupon.Day;
import com.google.b.t;
import com.google.b.u;
import com.google.b.v;
import com.google.b.w;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class CouponDaysDeserializer
implements v
{
public CouponDaysDeserializer()
{
}
public volatile Object deserialize(w w1, Type type, u u)
{
return deserialize(w1, type, u);
}
public Day[] deserialize(w w1, Type type, u u)
{
if (w1 instanceof t)
{
type = new ArrayList();
for (w1 = w1.i().iterator(); w1.hasNext(); type.add(new Day(((w)w1.next()).c()))) { }
return (Day[])type.toArray(new Day[type.size()]);
} else
{
return (new Day[] {
new Day(w1.c())
});
}
}
}
| 1,108
| 0.610912
| 0.596601
| 44
| 24.40909
| 22.313183
| 97
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.5
| false
| false
|
2
|
448297c7ecdfce97265581504db712f7bb6ca269
| 27,693,949,126,382
|
9b6bf594bf2a7437bf8fdd6e5b0598bf4f5c6068
|
/jem-common/src/main/java/net/kodeninja/util/logging/LoggerHook.java
|
4450976cd484e057fb1f9cfd1ade82711e6367ee
|
[] |
no_license
|
pjjw/jems
|
https://github.com/pjjw/jems
|
8f6d55894c532c453f3aa947ecdb564d6c62c135
|
e32bd2088cfc8111799e62e2144d0b793130b91a
|
refs/heads/master
| 2021-01-10T06:16:06.209000
| 2007-09-27T05:25:39
| 2007-09-27T05:25:39
| 54,480,375
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package net.kodeninja.util.logging;
import net.kodeninja.util.KNModule;
/**
* Class that defines a simple logger that messages can be sent to.
* @author Charles Ikeson
*
*/
public interface LoggerHook extends KNModule {
/**
* Requests the passed logger line be added to the logger
*
* @param LogText
* The line of text to add.
*/
public void addLog(String LogText);
}
|
UTF-8
|
Java
| 415
|
java
|
LoggerHook.java
|
Java
|
[
{
"context": "e logger that messages can be sent to.\r\n * @author Charles Ikeson\r\n *\r\n */\r\npublic interface LoggerHook extends KNM",
"end": 177,
"score": 0.9998668432235718,
"start": 163,
"tag": "NAME",
"value": "Charles Ikeson"
}
] | null |
[] |
package net.kodeninja.util.logging;
import net.kodeninja.util.KNModule;
/**
* Class that defines a simple logger that messages can be sent to.
* @author <NAME>
*
*/
public interface LoggerHook extends KNModule {
/**
* Requests the passed logger line be added to the logger
*
* @param LogText
* The line of text to add.
*/
public void addLog(String LogText);
}
| 407
| 0.662651
| 0.662651
| 18
| 21.055555
| 21.433287
| 67
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.555556
| false
| false
|
2
|
c1b9cb453f0e2319ee130cd78cb6750ae65ac036
| 18,580,028,539,094
|
141b713cc406159d3c9c26d55d615add887bb4c6
|
/src/com/sugarya/pattern/behavioral/strategy/behavior/MuteQuack.java
|
8ec16a523724f7d1f6287000ab34ad4975d55918
|
[
"Apache-2.0"
] |
permissive
|
Sugarya/DesignPatternCollector
|
https://github.com/Sugarya/DesignPatternCollector
|
2a4f282c7db0f75bc7b8002c212ef6396331b513
|
f996c02255c422f22077aa866e8f5f99cfad3aad
|
refs/heads/master
| 2021-05-06T03:46:09.273000
| 2020-05-18T12:41:59
| 2020-05-18T12:41:59
| 114,884,953
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.sugarya.pattern.behavioral.strategy.behavior;
import com.sugarya.utils.Out;
public class MuteQuack implements QuackBehavior {
@Override
public void quack() {
Out.print("nothing quack");
}
}
|
UTF-8
|
Java
| 226
|
java
|
MuteQuack.java
|
Java
|
[] | null |
[] |
package com.sugarya.pattern.behavioral.strategy.behavior;
import com.sugarya.utils.Out;
public class MuteQuack implements QuackBehavior {
@Override
public void quack() {
Out.print("nothing quack");
}
}
| 226
| 0.707965
| 0.707965
| 12
| 17.833334
| 19.831932
| 57
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.25
| false
| false
|
2
|
bddb685676e90c6a7623638ef3666b1489c96400
| 27,745,488,801,404
|
e0291f49c4d42490dc381192ed78bd8257dfb4b5
|
/src/com/mmdb/rest/mapping/PerfDbMappingRest.java
|
e9da312e59149ec4c3a845b2d106ac8016ce8741
|
[] |
no_license
|
balplbalpl/mmdb
|
https://github.com/balplbalpl/mmdb
|
872db1cc359da9b75e54e61035d5f88b35d1b9eb
|
d8cce4dd7fe28fad6885ccfe4aac0f16ec84bc84
|
refs/heads/master
| 2021-04-26T16:44:02.230000
| 2015-10-08T03:39:28
| 2015-10-08T03:39:28
| 43,859,655
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mmdb.rest.mapping;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.restlet.ext.json.JsonRepresentation;
import org.restlet.representation.Representation;
import org.springframework.context.ApplicationContext;
import com.mmdb.core.exception.MException;
import com.mmdb.core.log.Log;
import com.mmdb.core.log.LogFactory;
import com.mmdb.core.utils.SpringContextUtil;
import com.mmdb.model.database.bean.DataSourcePool;
import com.mmdb.model.mapping.PerfToDbMapping;
import com.mmdb.model.task.Task;
import com.mmdb.rest.BaseRest;
import com.mmdb.ruleEngine.Tool;
import com.mmdb.service.db.IDataSourceService;
import com.mmdb.service.mapping.IPerfDbMapService;
import com.mmdb.service.task.ITaskService;
/**
* DB数据集映射性能数据Rest
*
* @author yuhao.guan
* @version 1.0 2015-7-19
*/
public class PerfDbMappingRest extends BaseRest{
private Log log = LogFactory.getLogger("PerfDbMappingRest");
private IPerfDbMapService perfDbMapService;
private IDataSourceService dataSourceService;
private ITaskService taskService;
@Override
public void ioc(ApplicationContext context) {
perfDbMapService = (IPerfDbMapService) SpringContextUtil
.getApplicationContext().getBean("perfDbMapService");
dataSourceService = (IDataSourceService)SpringContextUtil
.getApplicationContext().getBean("dataSourceService");
taskService = (ITaskService)SpringContextUtil
.getApplicationContext().getBean("taskService");
}
@Override
public Representation getHandler() throws Exception{
String param1 = getValue("param1");
if (param1 == null || "".equals(param1)) {
return getAll();
}else if ("owner".equals(param1)) {
String param2 = getValue("param2");
return getByUser(param2);
} else {
//获取指定ID的映射
return getById(param1);
}
}
@Override
public Representation postHandler(Representation entity) throws Exception {
String param1 = getValue("param1");
if ("import".equals(param1)) {
//return new JsonRepresentation(importData(entity));
}
JSONObject params = parseEntity(entity);
if ("run".equals(param1)) {
return run(params); //运行一次
}else if("preview".equals(param1)){
//预览映射结果
return previewPerfToDbMapping(params);
}else{
//保存映射
return savePerfToDbMapping(params);
}
}
@Override
public Representation putHandler(Representation entity) throws Exception {
JSONObject params = parseEntity(entity);
return editPerfToDbMapping(params);
}
@Override
public Representation delHandler(Representation entity) throws Exception{
String param1 = getValue("param1");
return deleteById(param1);
}
/**
* 添加映射
*
* @param data
* @return
*/
private Representation savePerfToDbMapping(JSONObject data) throws Exception{
JSONObject ret = new JSONObject();
//判断映射名称是否已经存在
List<PerfToDbMapping> mappingList =
perfDbMapService.getByName(data.getString("ruleName"));
if(mappingList.size()>0){
log.eLog("映射名称已经存在");
throw new MException("映射名称已经存在");
}
PerfToDbMapping mapping = new PerfToDbMapping();
try {
//映射名称
mapping.setName(data.getString("ruleName"));
//是否激活,默认为激活
mapping.setActive("1"); //预留变量,暂时未使用
mapping.setDataSourceId(data.getString("dataSourceId"));
//映射条件
JSONObject ciCondJson = new JSONObject();
ciCondJson.put("perfValuesInCi", data.get("perfValuesInCi"));
ciCondJson.put("perf2CiLink", data.get("perf2CiLink"));
ciCondJson.put("ciValues", data.get("ciValues"));
mapping.setCiConditionJson(ciCondJson);
JSONObject kpiCondJson = new JSONObject();
kpiCondJson.put("perfValuesInKpi", data.get("perfValuesInKpi"));
kpiCondJson.put("perf2KpiLink", data.get("perf2KpiLink"));
kpiCondJson.put("kpiValues", data.get("kpiValues"));
mapping.setKpiConditionJson(kpiCondJson);
//页面中%替换为了@@@此处转回为%
String filed = data.getString("fieldMap");
JSONObject fieldMap = JSONObject.fromObject(filed.replace("@@@", "%"));
mapping.setFieldMap(fieldMap);
JSONObject customFieldsMap = data.getJSONObject("customFieldsMap");
mapping.setCustomFieldsMap(customFieldsMap);
String valExp = (data.containsKey("valExp") ? data.getString("valExp"):"").trim();
if(valExp.length()>0){
if(Tool.checkPerfValExp(valExp)){
mapping.setValExp(valExp);
}else{
mapping.setValExp("");
}
}else{
mapping.setValExp("");
}
if(data.containsKey("ciHex")){
mapping.setCiHex(data.getString("ciHex"));
}
if(data.containsKey("kpiHex")){
mapping.setKpiHex(data.getString("kpiHex"));
}
//创建者
String userName = getUsername();
mapping.setOwner(userName);
if(data.containsKey("isAddSync")){
mapping.setIsAddSync(data.getString("isAddSync"));
}
//保存映射
perfDbMapService.save(mapping);
ret.put("message", "保存映射[" + mapping.getName() + "]成功");
} catch (Exception e) {
//log.eLog(e);
//ret.put("message", "保存映射失败");
//getResponse().setStatus(new Status(600));
throw e;
}
return new JsonRepresentation(ret.toString());
}
/**
* 修改映射
*
* @param data
* @return
*/
private Representation editPerfToDbMapping(JSONObject data) throws Exception{
JSONObject ret = new JSONObject();
try {
String ruleId = data.getString("id");
//获取到要更新的
PerfToDbMapping mapping = perfDbMapService.getMappingById(ruleId);
//映射数据集ID
mapping.setDataSourceId(data.getString("dataSourceId"));
//映射条件
JSONObject ciCondJson = new JSONObject();
ciCondJson.put("perfValuesInCi", data.get("perfValuesInCi"));
ciCondJson.put("perf2CiLink", data.get("perf2CiLink"));
ciCondJson.put("ciValues", data.get("ciValues"));
mapping.setCiConditionJson(ciCondJson);
JSONObject kpiCondJson = new JSONObject();
kpiCondJson.put("perfValuesInKpi", data.get("perfValuesInKpi"));
kpiCondJson.put("perf2KpiLink", data.get("perf2KpiLink"));
kpiCondJson.put("kpiValues", data.get("kpiValues"));
mapping.setKpiConditionJson(kpiCondJson);
//页面中%替换为了@@@此处转回为%
String filed = data.getString("fieldMap");
JSONObject fieldMap = JSONObject.fromObject(filed.replace("@@@", "%"));
mapping.setFieldMap(fieldMap);
JSONObject customFieldsMap = data.getJSONObject("customFieldsMap");
mapping.setCustomFieldsMap(customFieldsMap);
String valExp = (data.containsKey("valExp") ? data.getString("valExp"):"").trim();
if(valExp.length()>0){
if(Tool.checkPerfValExp(valExp)){
mapping.setValExp(valExp);
}else{
mapping.setValExp("");
}
}else{
mapping.setValExp("");
}
if(data.containsKey("ciHex")){
mapping.setCiHex(data.getString("ciHex"));
}
if(data.containsKey("kpiHex")){
mapping.setKpiHex(data.getString("kpiHex"));
}
if(data.containsKey("isAddSync")){
mapping.setIsAddSync(data.getString("isAddSync"));
}
//修改映射
perfDbMapService.update(mapping);
ret.put("message", "修改映射[" + mapping.getName() + "]成功");
} catch (Exception e) {
//log.eLog(e);
//ret.put("message", "修改映射失败");
//getResponse().setStatus(new Status(600));
throw e;
}
return new JsonRepresentation(ret.toString());
}
/**
* 预览映射
*
* @param data
* @return
*/
private Representation previewPerfToDbMapping(JSONObject data) throws Exception{
JSONObject ret = new JSONObject();
PerfToDbMapping mapping = new PerfToDbMapping();
try {
//映射名称
mapping.setName(data.getString("ruleName"));
//是否激活,默认为激活
mapping.setActive("1"); //预留变量,暂时未使用
mapping.setDataSourceId(data.getString("dataSourceId"));
//映射条件
JSONObject ciCondJson = new JSONObject();
ciCondJson.put("perfValuesInCi", data.get("perfValuesInCi"));
ciCondJson.put("perf2CiLink", data.get("perf2CiLink"));
ciCondJson.put("ciValues", data.get("ciValues"));
mapping.setCiConditionJson(ciCondJson);
JSONObject kpiCondJson = new JSONObject();
kpiCondJson.put("perfValuesInKpi", data.get("perfValuesInKpi"));
kpiCondJson.put("perf2KpiLink", data.get("perf2KpiLink"));
kpiCondJson.put("kpiValues", data.get("kpiValues"));
mapping.setKpiConditionJson(kpiCondJson);
//获取到所有的数据集配置列表
Map<String, DataSourcePool> dpMap = getDataSourcePoolMap();
//获取到映射对应的数据集配置
mapping.setDataSource(dpMap.get(mapping.getDataSourceId()));
//页面中%替换为了@@@此处转回为%
String filed = data.getString("fieldMap");
JSONObject fieldMap = JSONObject.fromObject(filed.replace("@@@", "%"));
mapping.setFieldMap(fieldMap);
JSONObject customFieldsMap = data.getJSONObject("customFieldsMap");
mapping.setCustomFieldsMap(customFieldsMap);
String valExp = (data.containsKey("valExp") ? data.getString("valExp"):"").trim();
if(valExp.length()>0){
if(Tool.checkPerfValExp(valExp)){
mapping.setValExp(valExp);
}else{
mapping.setValExp("");
}
}else{
mapping.setValExp("");
}
if(data.containsKey("ciHex")){
mapping.setCiHex(data.getString("ciHex"));
}
if(data.containsKey("kpiHex")){
mapping.setKpiHex(data.getString("kpiHex"));
}
if(data.containsKey("isAddSync")){
mapping.setIsAddSync(data.getString("isAddSync"));
}
//保存映射
Map<String, List<?>> retMap = perfDbMapService.preView(mapping);
List<?> matchedList = retMap.get("matchedList");
List<?> matchedSourceList = retMap.get("matchedSourceList");
List<?> unMatchedList = retMap.get("unMatchedList");
ret.put("matchedList", matchedList);
ret.put("unMatchedList", unMatchedList);
ret.put("matchedSourceList", matchedSourceList);
//ret.put("message", "预览映射[" + mapping.getName() + "]成功");
} catch (Exception e) {
//log.eLog(e);
//ret.put("message", "预览映射失败");
//getResponse().setStatus(new Status(600));
throw e;
}
return new JsonRepresentation(ret.toString());
}
/**
* 删除映射
*
* @param data{id:ruleId}
* @return
*/
private Representation deleteById(String id) throws Exception{
JSONObject ret = new JSONObject();
try {
PerfToDbMapping mapping = perfDbMapService.getMappingById(id);
String userName = this.getUsername();
//是否为管理员用户
boolean isAdmin = this.isAdmin();
//非管理员用户不能删除其他用户的映射信息
if(!isAdmin){
String owner = mapping.getOwner();
if(!owner.equals(userName)){
throw new MException("没有权限删除其他用户的映射规则!");
}
}
List<String> tasks = taskService.getTaskNamesByMapId(id);
if(tasks.size()>0){
//ret.put("message", "删除失败,有任务正在使用此映射!");
//getResponse().setStatus(new Status(600));
throw new MException("删除失败,有任务正在使用此映射!");
}else{
perfDbMapService.deleteById(id);
ret.put("message", "删除映射成功");
}
} catch (Exception e) {
//log.eLog(e);
//ret.put("message", "删除映射失败!");
//getResponse().setStatus(new Status(600));
throw e;
}
return new JsonRepresentation(ret.toString());
}
/**
* 返回一个json格式的映射列表
*
* @return Representation
* @throws Exception
*/
private Representation getAll() throws Exception{
JSONObject ret = new JSONObject();
try {
List<PerfToDbMapping> mappingList = perfDbMapService.getAll();
JSONArray list = new JSONArray();
//获取到所有的数据集列表
Map<String, DataSourcePool> dpMap = getDataSourcePoolMap();
//获取所有的任务列表
List<Task> ts = taskService.getAll();
for (PerfToDbMapping mapping : mappingList) {
//获取到映射对应的数据集配置
mapping.setDataSource(dpMap.get(mapping.getDataSourceId()));
List<String> retList = new ArrayList<String>();
//循环任务列表,找出使用此映射的任务
for (Task t : ts) {
List<String> mapIds = t.getPerfDbMapIds();
if (mapIds.contains(mapping.getId())) {
String name = t.getName();
if (!retList.contains(name))
retList.add(name);
}
}
if(retList.size()>0){
mapping.setTaskNames(retList.toString());
}
Map<String, Object> ruleMap = mapping.toMap();
list.add(ruleMap);
}
ret.put("data", list);
ret.put("message", "获取全部映射成功");
} catch (Exception e) {
//log.eLog(e);
//ret.put("message", "获取全部映射失败");
//getResponse().setStatus(new Status(600));
throw e;
}
return new JsonRepresentation(ret.toString());
}
/**
* 获取到某个用户的所有映射规则
*
* @param username
* @return
* @throws Exception
*/
private Representation getByUser(String username) throws Exception{
JSONObject ret = new JSONObject();
try {
List<PerfToDbMapping> mappingList = perfDbMapService.getByOwner(username);
JSONArray list = new JSONArray();
//获取到所有的数据集列表
Map<String, DataSourcePool> dpMap = getDataSourcePoolMap();
//获取所有的任务列表
List<Task> ts = taskService.getAll();
for (PerfToDbMapping mapping : mappingList) {
//获取到映射对应的数据集配置
mapping.setDataSource(dpMap.get(mapping.getDataSourceId()));
List<String> retList = new ArrayList<String>();
//循环任务列表,找出使用此映射的任务
for (Task t : ts) {
List<String> mapIds = t.getPerfDbMapIds();
if (mapIds.contains(mapping.getId())) {
String name = t.getName();
if (!retList.contains(name))
retList.add(name);
}
}
if(retList.size()>0){
mapping.setTaskNames(retList.toString());
}
Map<String, Object> ruleMap = mapping.toMap();
list.add(ruleMap);
}
ret.put("data", list);
ret.put("message", "获取全部映射成功");
} catch (Exception e) {
//log.eLog(e);
//ret.put("message", "获取全部映射失败");
//getResponse().setStatus(new Status(600));
throw e;
}
return new JsonRepresentation(ret.toString());
}
/**
* 通过唯一id获取映射
*
* @param id
* @return
* @throws Exception
*/
private Representation getById(String id) throws Exception{
JSONObject ret = new JSONObject();
try {
PerfToDbMapping mapping = perfDbMapService.getMappingById(id);
if (mapping != null) {
//获取到所有的数据集列表
Map<String, DataSourcePool> dpMap = getDataSourcePoolMap();
//获取到映射对应的数据集配置
mapping.setDataSource(dpMap.get(mapping.getDataSourceId()));
Map<String, Object> asMap = mapping.toMap();
/* if(mapping.getCiHex() != null && !"".equals(mapping.getCiHex())){
String ciHex = HexString.decode(mapping.getCiHex());
JSONArray cis = JSONArray.fromObject(ciHex);
asMap.put("ciName", cis.getString(1));
asMap.put("ciCategoryName", cis.getString(0));
}
if(mapping.getKpiHex() != null && !"".equals(mapping.getKpiHex())){
String kpiHex = HexString.decode(mapping.getKpiHex());
JSONArray kpis = JSONArray.fromObject(kpiHex);
asMap.put("kpiName", kpis.getString(1));
asMap.put("kpiCategoryName", kpis.getString(0));
}*/
ret.put("data", asMap);
ret.put("message", "获取映射[" + mapping.getName() + "]成功");
} else {
//ret.put("message", "获取映射失败");
//getResponse().setStatus(new Status(600));
throw new MException("获取映射失败");
}
} catch (Exception e) {
//log.eLog(e);
//ret.put("message", "获取映射失败");
//getResponse().setStatus(new Status(600));
throw e;
}
return new JsonRepresentation(ret.toString());
}
/**
* 执行一次映射规则
*
* @param perf2DbObj
* @return
* @throws Exception
*/
private JsonRepresentation run(JSONObject cdMap) throws Exception{
JSONObject ret = new JSONObject();
try {
log.dLog("立即执行内部映射");
String id = "";
if(cdMap.containsKey("id")){
id = cdMap.getString("id");
}
if (id == null || id.equals("")) {
throw new Exception("映射ID不能为空");
}
PerfToDbMapping mapping = perfDbMapService.getMappingById(id);
if (mapping == null) {
throw new Exception("映射不存在");
}
Map<String, DataSourcePool> dpMap = getDataSourcePoolMap();
mapping.setDataSource(dpMap.get(mapping.getDataSourceId()));
Map<String, Integer> rm = perfDbMapService.runNow(mapping);
ret.put("message", "性能数据同步完成,共同步(" + rm.get("send") + ")条性能数据");
} catch (Exception e) {
//log.eLog(e);
//ret.put("message", e.getMessage());
//getResponse().setStatus(new Status(600));
throw e;
}
return new JsonRepresentation(ret.toString());
}
/**
* 获取到所有的数据库配置
*
* @return Map
* @throws Exception
*/
private Map<String, DataSourcePool> getDataSourcePoolMap() throws Exception{
List<DataSourcePool> dps = dataSourceService.getAll();
Map<String, DataSourcePool> dpMap = new HashMap<String, DataSourcePool>();
for(DataSourcePool dp:dps){
dpMap.put(dp.getId(), dp);
}
return dpMap;
}
}
|
UTF-8
|
Java
| 17,589
|
java
|
PerfDbMappingRest.java
|
Java
|
[
{
"context": "askService;\n\n/**\n * DB数据集映射性能数据Rest\n * \n * @author yuhao.guan\n * @version 1.0 2015-7-19\n */\npublic class PerfDb",
"end": 890,
"score": 0.9993240833282471,
"start": 880,
"tag": "NAME",
"value": "yuhao.guan"
},
{
"context": "ing(\"kpiHex\"));\n\t\t\t}\n\t\t\t//创建者\n\t\t\tString userName = getUsername();\n\t\t\tmapping.setOwner(userName);\n\t\t\tif(data.cont",
"end": 4707,
"score": 0.9648194313049316,
"start": 4696,
"tag": "USERNAME",
"value": "getUsername"
}
] | null |
[] |
package com.mmdb.rest.mapping;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.restlet.ext.json.JsonRepresentation;
import org.restlet.representation.Representation;
import org.springframework.context.ApplicationContext;
import com.mmdb.core.exception.MException;
import com.mmdb.core.log.Log;
import com.mmdb.core.log.LogFactory;
import com.mmdb.core.utils.SpringContextUtil;
import com.mmdb.model.database.bean.DataSourcePool;
import com.mmdb.model.mapping.PerfToDbMapping;
import com.mmdb.model.task.Task;
import com.mmdb.rest.BaseRest;
import com.mmdb.ruleEngine.Tool;
import com.mmdb.service.db.IDataSourceService;
import com.mmdb.service.mapping.IPerfDbMapService;
import com.mmdb.service.task.ITaskService;
/**
* DB数据集映射性能数据Rest
*
* @author yuhao.guan
* @version 1.0 2015-7-19
*/
public class PerfDbMappingRest extends BaseRest{
private Log log = LogFactory.getLogger("PerfDbMappingRest");
private IPerfDbMapService perfDbMapService;
private IDataSourceService dataSourceService;
private ITaskService taskService;
@Override
public void ioc(ApplicationContext context) {
perfDbMapService = (IPerfDbMapService) SpringContextUtil
.getApplicationContext().getBean("perfDbMapService");
dataSourceService = (IDataSourceService)SpringContextUtil
.getApplicationContext().getBean("dataSourceService");
taskService = (ITaskService)SpringContextUtil
.getApplicationContext().getBean("taskService");
}
@Override
public Representation getHandler() throws Exception{
String param1 = getValue("param1");
if (param1 == null || "".equals(param1)) {
return getAll();
}else if ("owner".equals(param1)) {
String param2 = getValue("param2");
return getByUser(param2);
} else {
//获取指定ID的映射
return getById(param1);
}
}
@Override
public Representation postHandler(Representation entity) throws Exception {
String param1 = getValue("param1");
if ("import".equals(param1)) {
//return new JsonRepresentation(importData(entity));
}
JSONObject params = parseEntity(entity);
if ("run".equals(param1)) {
return run(params); //运行一次
}else if("preview".equals(param1)){
//预览映射结果
return previewPerfToDbMapping(params);
}else{
//保存映射
return savePerfToDbMapping(params);
}
}
@Override
public Representation putHandler(Representation entity) throws Exception {
JSONObject params = parseEntity(entity);
return editPerfToDbMapping(params);
}
@Override
public Representation delHandler(Representation entity) throws Exception{
String param1 = getValue("param1");
return deleteById(param1);
}
/**
* 添加映射
*
* @param data
* @return
*/
private Representation savePerfToDbMapping(JSONObject data) throws Exception{
JSONObject ret = new JSONObject();
//判断映射名称是否已经存在
List<PerfToDbMapping> mappingList =
perfDbMapService.getByName(data.getString("ruleName"));
if(mappingList.size()>0){
log.eLog("映射名称已经存在");
throw new MException("映射名称已经存在");
}
PerfToDbMapping mapping = new PerfToDbMapping();
try {
//映射名称
mapping.setName(data.getString("ruleName"));
//是否激活,默认为激活
mapping.setActive("1"); //预留变量,暂时未使用
mapping.setDataSourceId(data.getString("dataSourceId"));
//映射条件
JSONObject ciCondJson = new JSONObject();
ciCondJson.put("perfValuesInCi", data.get("perfValuesInCi"));
ciCondJson.put("perf2CiLink", data.get("perf2CiLink"));
ciCondJson.put("ciValues", data.get("ciValues"));
mapping.setCiConditionJson(ciCondJson);
JSONObject kpiCondJson = new JSONObject();
kpiCondJson.put("perfValuesInKpi", data.get("perfValuesInKpi"));
kpiCondJson.put("perf2KpiLink", data.get("perf2KpiLink"));
kpiCondJson.put("kpiValues", data.get("kpiValues"));
mapping.setKpiConditionJson(kpiCondJson);
//页面中%替换为了@@@此处转回为%
String filed = data.getString("fieldMap");
JSONObject fieldMap = JSONObject.fromObject(filed.replace("@@@", "%"));
mapping.setFieldMap(fieldMap);
JSONObject customFieldsMap = data.getJSONObject("customFieldsMap");
mapping.setCustomFieldsMap(customFieldsMap);
String valExp = (data.containsKey("valExp") ? data.getString("valExp"):"").trim();
if(valExp.length()>0){
if(Tool.checkPerfValExp(valExp)){
mapping.setValExp(valExp);
}else{
mapping.setValExp("");
}
}else{
mapping.setValExp("");
}
if(data.containsKey("ciHex")){
mapping.setCiHex(data.getString("ciHex"));
}
if(data.containsKey("kpiHex")){
mapping.setKpiHex(data.getString("kpiHex"));
}
//创建者
String userName = getUsername();
mapping.setOwner(userName);
if(data.containsKey("isAddSync")){
mapping.setIsAddSync(data.getString("isAddSync"));
}
//保存映射
perfDbMapService.save(mapping);
ret.put("message", "保存映射[" + mapping.getName() + "]成功");
} catch (Exception e) {
//log.eLog(e);
//ret.put("message", "保存映射失败");
//getResponse().setStatus(new Status(600));
throw e;
}
return new JsonRepresentation(ret.toString());
}
/**
* 修改映射
*
* @param data
* @return
*/
private Representation editPerfToDbMapping(JSONObject data) throws Exception{
JSONObject ret = new JSONObject();
try {
String ruleId = data.getString("id");
//获取到要更新的
PerfToDbMapping mapping = perfDbMapService.getMappingById(ruleId);
//映射数据集ID
mapping.setDataSourceId(data.getString("dataSourceId"));
//映射条件
JSONObject ciCondJson = new JSONObject();
ciCondJson.put("perfValuesInCi", data.get("perfValuesInCi"));
ciCondJson.put("perf2CiLink", data.get("perf2CiLink"));
ciCondJson.put("ciValues", data.get("ciValues"));
mapping.setCiConditionJson(ciCondJson);
JSONObject kpiCondJson = new JSONObject();
kpiCondJson.put("perfValuesInKpi", data.get("perfValuesInKpi"));
kpiCondJson.put("perf2KpiLink", data.get("perf2KpiLink"));
kpiCondJson.put("kpiValues", data.get("kpiValues"));
mapping.setKpiConditionJson(kpiCondJson);
//页面中%替换为了@@@此处转回为%
String filed = data.getString("fieldMap");
JSONObject fieldMap = JSONObject.fromObject(filed.replace("@@@", "%"));
mapping.setFieldMap(fieldMap);
JSONObject customFieldsMap = data.getJSONObject("customFieldsMap");
mapping.setCustomFieldsMap(customFieldsMap);
String valExp = (data.containsKey("valExp") ? data.getString("valExp"):"").trim();
if(valExp.length()>0){
if(Tool.checkPerfValExp(valExp)){
mapping.setValExp(valExp);
}else{
mapping.setValExp("");
}
}else{
mapping.setValExp("");
}
if(data.containsKey("ciHex")){
mapping.setCiHex(data.getString("ciHex"));
}
if(data.containsKey("kpiHex")){
mapping.setKpiHex(data.getString("kpiHex"));
}
if(data.containsKey("isAddSync")){
mapping.setIsAddSync(data.getString("isAddSync"));
}
//修改映射
perfDbMapService.update(mapping);
ret.put("message", "修改映射[" + mapping.getName() + "]成功");
} catch (Exception e) {
//log.eLog(e);
//ret.put("message", "修改映射失败");
//getResponse().setStatus(new Status(600));
throw e;
}
return new JsonRepresentation(ret.toString());
}
/**
* 预览映射
*
* @param data
* @return
*/
private Representation previewPerfToDbMapping(JSONObject data) throws Exception{
JSONObject ret = new JSONObject();
PerfToDbMapping mapping = new PerfToDbMapping();
try {
//映射名称
mapping.setName(data.getString("ruleName"));
//是否激活,默认为激活
mapping.setActive("1"); //预留变量,暂时未使用
mapping.setDataSourceId(data.getString("dataSourceId"));
//映射条件
JSONObject ciCondJson = new JSONObject();
ciCondJson.put("perfValuesInCi", data.get("perfValuesInCi"));
ciCondJson.put("perf2CiLink", data.get("perf2CiLink"));
ciCondJson.put("ciValues", data.get("ciValues"));
mapping.setCiConditionJson(ciCondJson);
JSONObject kpiCondJson = new JSONObject();
kpiCondJson.put("perfValuesInKpi", data.get("perfValuesInKpi"));
kpiCondJson.put("perf2KpiLink", data.get("perf2KpiLink"));
kpiCondJson.put("kpiValues", data.get("kpiValues"));
mapping.setKpiConditionJson(kpiCondJson);
//获取到所有的数据集配置列表
Map<String, DataSourcePool> dpMap = getDataSourcePoolMap();
//获取到映射对应的数据集配置
mapping.setDataSource(dpMap.get(mapping.getDataSourceId()));
//页面中%替换为了@@@此处转回为%
String filed = data.getString("fieldMap");
JSONObject fieldMap = JSONObject.fromObject(filed.replace("@@@", "%"));
mapping.setFieldMap(fieldMap);
JSONObject customFieldsMap = data.getJSONObject("customFieldsMap");
mapping.setCustomFieldsMap(customFieldsMap);
String valExp = (data.containsKey("valExp") ? data.getString("valExp"):"").trim();
if(valExp.length()>0){
if(Tool.checkPerfValExp(valExp)){
mapping.setValExp(valExp);
}else{
mapping.setValExp("");
}
}else{
mapping.setValExp("");
}
if(data.containsKey("ciHex")){
mapping.setCiHex(data.getString("ciHex"));
}
if(data.containsKey("kpiHex")){
mapping.setKpiHex(data.getString("kpiHex"));
}
if(data.containsKey("isAddSync")){
mapping.setIsAddSync(data.getString("isAddSync"));
}
//保存映射
Map<String, List<?>> retMap = perfDbMapService.preView(mapping);
List<?> matchedList = retMap.get("matchedList");
List<?> matchedSourceList = retMap.get("matchedSourceList");
List<?> unMatchedList = retMap.get("unMatchedList");
ret.put("matchedList", matchedList);
ret.put("unMatchedList", unMatchedList);
ret.put("matchedSourceList", matchedSourceList);
//ret.put("message", "预览映射[" + mapping.getName() + "]成功");
} catch (Exception e) {
//log.eLog(e);
//ret.put("message", "预览映射失败");
//getResponse().setStatus(new Status(600));
throw e;
}
return new JsonRepresentation(ret.toString());
}
/**
* 删除映射
*
* @param data{id:ruleId}
* @return
*/
private Representation deleteById(String id) throws Exception{
JSONObject ret = new JSONObject();
try {
PerfToDbMapping mapping = perfDbMapService.getMappingById(id);
String userName = this.getUsername();
//是否为管理员用户
boolean isAdmin = this.isAdmin();
//非管理员用户不能删除其他用户的映射信息
if(!isAdmin){
String owner = mapping.getOwner();
if(!owner.equals(userName)){
throw new MException("没有权限删除其他用户的映射规则!");
}
}
List<String> tasks = taskService.getTaskNamesByMapId(id);
if(tasks.size()>0){
//ret.put("message", "删除失败,有任务正在使用此映射!");
//getResponse().setStatus(new Status(600));
throw new MException("删除失败,有任务正在使用此映射!");
}else{
perfDbMapService.deleteById(id);
ret.put("message", "删除映射成功");
}
} catch (Exception e) {
//log.eLog(e);
//ret.put("message", "删除映射失败!");
//getResponse().setStatus(new Status(600));
throw e;
}
return new JsonRepresentation(ret.toString());
}
/**
* 返回一个json格式的映射列表
*
* @return Representation
* @throws Exception
*/
private Representation getAll() throws Exception{
JSONObject ret = new JSONObject();
try {
List<PerfToDbMapping> mappingList = perfDbMapService.getAll();
JSONArray list = new JSONArray();
//获取到所有的数据集列表
Map<String, DataSourcePool> dpMap = getDataSourcePoolMap();
//获取所有的任务列表
List<Task> ts = taskService.getAll();
for (PerfToDbMapping mapping : mappingList) {
//获取到映射对应的数据集配置
mapping.setDataSource(dpMap.get(mapping.getDataSourceId()));
List<String> retList = new ArrayList<String>();
//循环任务列表,找出使用此映射的任务
for (Task t : ts) {
List<String> mapIds = t.getPerfDbMapIds();
if (mapIds.contains(mapping.getId())) {
String name = t.getName();
if (!retList.contains(name))
retList.add(name);
}
}
if(retList.size()>0){
mapping.setTaskNames(retList.toString());
}
Map<String, Object> ruleMap = mapping.toMap();
list.add(ruleMap);
}
ret.put("data", list);
ret.put("message", "获取全部映射成功");
} catch (Exception e) {
//log.eLog(e);
//ret.put("message", "获取全部映射失败");
//getResponse().setStatus(new Status(600));
throw e;
}
return new JsonRepresentation(ret.toString());
}
/**
* 获取到某个用户的所有映射规则
*
* @param username
* @return
* @throws Exception
*/
private Representation getByUser(String username) throws Exception{
JSONObject ret = new JSONObject();
try {
List<PerfToDbMapping> mappingList = perfDbMapService.getByOwner(username);
JSONArray list = new JSONArray();
//获取到所有的数据集列表
Map<String, DataSourcePool> dpMap = getDataSourcePoolMap();
//获取所有的任务列表
List<Task> ts = taskService.getAll();
for (PerfToDbMapping mapping : mappingList) {
//获取到映射对应的数据集配置
mapping.setDataSource(dpMap.get(mapping.getDataSourceId()));
List<String> retList = new ArrayList<String>();
//循环任务列表,找出使用此映射的任务
for (Task t : ts) {
List<String> mapIds = t.getPerfDbMapIds();
if (mapIds.contains(mapping.getId())) {
String name = t.getName();
if (!retList.contains(name))
retList.add(name);
}
}
if(retList.size()>0){
mapping.setTaskNames(retList.toString());
}
Map<String, Object> ruleMap = mapping.toMap();
list.add(ruleMap);
}
ret.put("data", list);
ret.put("message", "获取全部映射成功");
} catch (Exception e) {
//log.eLog(e);
//ret.put("message", "获取全部映射失败");
//getResponse().setStatus(new Status(600));
throw e;
}
return new JsonRepresentation(ret.toString());
}
/**
* 通过唯一id获取映射
*
* @param id
* @return
* @throws Exception
*/
private Representation getById(String id) throws Exception{
JSONObject ret = new JSONObject();
try {
PerfToDbMapping mapping = perfDbMapService.getMappingById(id);
if (mapping != null) {
//获取到所有的数据集列表
Map<String, DataSourcePool> dpMap = getDataSourcePoolMap();
//获取到映射对应的数据集配置
mapping.setDataSource(dpMap.get(mapping.getDataSourceId()));
Map<String, Object> asMap = mapping.toMap();
/* if(mapping.getCiHex() != null && !"".equals(mapping.getCiHex())){
String ciHex = HexString.decode(mapping.getCiHex());
JSONArray cis = JSONArray.fromObject(ciHex);
asMap.put("ciName", cis.getString(1));
asMap.put("ciCategoryName", cis.getString(0));
}
if(mapping.getKpiHex() != null && !"".equals(mapping.getKpiHex())){
String kpiHex = HexString.decode(mapping.getKpiHex());
JSONArray kpis = JSONArray.fromObject(kpiHex);
asMap.put("kpiName", kpis.getString(1));
asMap.put("kpiCategoryName", kpis.getString(0));
}*/
ret.put("data", asMap);
ret.put("message", "获取映射[" + mapping.getName() + "]成功");
} else {
//ret.put("message", "获取映射失败");
//getResponse().setStatus(new Status(600));
throw new MException("获取映射失败");
}
} catch (Exception e) {
//log.eLog(e);
//ret.put("message", "获取映射失败");
//getResponse().setStatus(new Status(600));
throw e;
}
return new JsonRepresentation(ret.toString());
}
/**
* 执行一次映射规则
*
* @param perf2DbObj
* @return
* @throws Exception
*/
private JsonRepresentation run(JSONObject cdMap) throws Exception{
JSONObject ret = new JSONObject();
try {
log.dLog("立即执行内部映射");
String id = "";
if(cdMap.containsKey("id")){
id = cdMap.getString("id");
}
if (id == null || id.equals("")) {
throw new Exception("映射ID不能为空");
}
PerfToDbMapping mapping = perfDbMapService.getMappingById(id);
if (mapping == null) {
throw new Exception("映射不存在");
}
Map<String, DataSourcePool> dpMap = getDataSourcePoolMap();
mapping.setDataSource(dpMap.get(mapping.getDataSourceId()));
Map<String, Integer> rm = perfDbMapService.runNow(mapping);
ret.put("message", "性能数据同步完成,共同步(" + rm.get("send") + ")条性能数据");
} catch (Exception e) {
//log.eLog(e);
//ret.put("message", e.getMessage());
//getResponse().setStatus(new Status(600));
throw e;
}
return new JsonRepresentation(ret.toString());
}
/**
* 获取到所有的数据库配置
*
* @return Map
* @throws Exception
*/
private Map<String, DataSourcePool> getDataSourcePoolMap() throws Exception{
List<DataSourcePool> dps = dataSourceService.getAll();
Map<String, DataSourcePool> dpMap = new HashMap<String, DataSourcePool>();
for(DataSourcePool dp:dps){
dpMap.put(dp.getId(), dp);
}
return dpMap;
}
}
| 17,589
| 0.674403
| 0.669395
| 579
| 27.278065
| 22.051449
| 85
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 3.072539
| false
| false
|
2
|
7c70537b45f3195674119370da221892fe1975a1
| 1,451,698,979,236
|
5975d61e9c1972d705dccf7df0d8ec2055a75c43
|
/app/src/main/java/petras/bukelis/balticamadeusandroidtask/ui/fragments/PostListFragment.java
|
f187fc677d83a37dc0b59a2e97e68fe2e0883a9e
|
[] |
no_license
|
PetrasBukelis/BalticAmadeusAndroidTask
|
https://github.com/PetrasBukelis/BalticAmadeusAndroidTask
|
86e87786b8330a6a9655e68c0a4042f6aa074706
|
dcbdc1fa9c151b57f43d15f22e23119c51da790f
|
refs/heads/master
| 2023-03-21T06:07:15.565000
| 2021-03-12T18:52:58
| 2021-03-12T18:52:58
| 343,836,346
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package petras.bukelis.balticamadeusandroidtask.ui.fragments;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import androidx.navigation.Navigation;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import java.util.ArrayList;
import java.util.List;
import petras.bukelis.balticamadeusandroidtask.R;
import petras.bukelis.balticamadeusandroidtask.entities.Post;
import petras.bukelis.balticamadeusandroidtask.network.services.RetroFitResponseListener;
import petras.bukelis.balticamadeusandroidtask.ui.adapter.PostAdapter;
import petras.bukelis.balticamadeusandroidtask.viewmodels.PostViewModel;
public class PostListFragment extends Fragment {
private PostViewModel postViewModel;
private RecyclerView mRecyclerView;
private PostAdapter mPostAdapter;
private List<Post> tempPostList;
private SwipeRefreshLayout refreshView;
private boolean cicleFinished = false;
public PostListFragment(){
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_post_list,container,false);
mRecyclerView = view.findViewById(R.id.recycler_view_posts);
refreshView = view.findViewById(R.id.refreshView);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
return view;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
postViewModel = new ViewModelProvider(this).get(PostViewModel.class);
loadDataFromApi();
}
private static class PostListener implements PostAdapter.PostAdapterListener {
@Override
public void onPostSelected(Post post, View view) {
Navigation.findNavController(view).navigate(
PostListFragmentDirections.actionPostListFragmentToPostDetailFragment(post));
}
}
private void clearRecyclerView()
{
List<Post> tempPostemptylist = new ArrayList<Post>();
tempPostemptylist.clear();
mPostAdapter = new PostAdapter(tempPostemptylist, new PostListener());
mRecyclerView.setAdapter(mPostAdapter);
}
private void imitateDelayRefresh()
{
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
loadDataFromApi();
Toast.makeText(getContext(), "Information refreshed!", Toast.LENGTH_SHORT).show();
}
}, 3000);
}
public void showAlertDialog(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setTitle("AlertDialog");
builder.setMessage("Network connection failed, please check your internet connectivity and try again...");
// add the buttons with listeners
builder.setPositiveButton("Retry", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(getContext(), "Retrying data loading...", Toast.LENGTH_SHORT).show();
loadDataFromApi();
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Toast.makeText(getContext(), "Data loading was canceled...", Toast.LENGTH_SHORT).show();
// Did not know what exactly to do here, as in task there was no action specified after canceling.
// I would think there still should be a way for user to try again, so cancel button should not be an option
// that way the it would reduce elements on screen and show user clear path of action.
}
});
// create and show the alert dialog
AlertDialog dialog = builder.create();
dialog.show();
}
private void loadDataFromApi()
{
cicleFinished = false;
postViewModel.loadPosts(new RetroFitResponseListener() {
@Override
public void onSuccess() {
Toast.makeText(getContext(), "Data Loaded successfully", Toast.LENGTH_SHORT).show();
refreshView.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
clearRecyclerView();
// I imitate delay of refresh, just to show that its working.
imitateDelayRefresh();
}
});
postViewModel.getAllPosts().observe(getViewLifecycleOwner(), new Observer<List<Post>>() {
@Override
public void onChanged(List<Post> posts) {
refreshView.setRefreshing(true);
tempPostList = posts;
mPostAdapter = new PostAdapter(posts, new PostListener());
mRecyclerView.setAdapter(mPostAdapter);
refreshView.setRefreshing(false);
}
});
postViewModel.getPostListObserver().observe(getViewLifecycleOwner(), new Observer<List<Post>>() {
@Override
public void onChanged(List<Post> posts) {
refreshView.setRefreshing(true);
try {
if(!cicleFinished) {
for (Post post : posts) {
if (post != null && tempPostList != null) {
if (!tempPostList.contains(post)) {
postViewModel.insert(new Post(post.getUserId(), post.getTitle(), post.getBody()));
}
}
}
cicleFinished = true;
}
} catch (Exception e) {
e.printStackTrace();
}
refreshView.setRefreshing(false);
}
});
}
@Override
public void onFailure() {
showAlertDialog(getView());
Toast.makeText(getContext(), "Data Loading failed", Toast.LENGTH_SHORT).show();
}
});
}
}
|
UTF-8
|
Java
| 7,115
|
java
|
PostListFragment.java
|
Java
|
[] | null |
[] |
package petras.bukelis.balticamadeusandroidtask.ui.fragments;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import androidx.navigation.Navigation;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import java.util.ArrayList;
import java.util.List;
import petras.bukelis.balticamadeusandroidtask.R;
import petras.bukelis.balticamadeusandroidtask.entities.Post;
import petras.bukelis.balticamadeusandroidtask.network.services.RetroFitResponseListener;
import petras.bukelis.balticamadeusandroidtask.ui.adapter.PostAdapter;
import petras.bukelis.balticamadeusandroidtask.viewmodels.PostViewModel;
public class PostListFragment extends Fragment {
private PostViewModel postViewModel;
private RecyclerView mRecyclerView;
private PostAdapter mPostAdapter;
private List<Post> tempPostList;
private SwipeRefreshLayout refreshView;
private boolean cicleFinished = false;
public PostListFragment(){
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_post_list,container,false);
mRecyclerView = view.findViewById(R.id.recycler_view_posts);
refreshView = view.findViewById(R.id.refreshView);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
return view;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
postViewModel = new ViewModelProvider(this).get(PostViewModel.class);
loadDataFromApi();
}
private static class PostListener implements PostAdapter.PostAdapterListener {
@Override
public void onPostSelected(Post post, View view) {
Navigation.findNavController(view).navigate(
PostListFragmentDirections.actionPostListFragmentToPostDetailFragment(post));
}
}
private void clearRecyclerView()
{
List<Post> tempPostemptylist = new ArrayList<Post>();
tempPostemptylist.clear();
mPostAdapter = new PostAdapter(tempPostemptylist, new PostListener());
mRecyclerView.setAdapter(mPostAdapter);
}
private void imitateDelayRefresh()
{
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
loadDataFromApi();
Toast.makeText(getContext(), "Information refreshed!", Toast.LENGTH_SHORT).show();
}
}, 3000);
}
public void showAlertDialog(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setTitle("AlertDialog");
builder.setMessage("Network connection failed, please check your internet connectivity and try again...");
// add the buttons with listeners
builder.setPositiveButton("Retry", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(getContext(), "Retrying data loading...", Toast.LENGTH_SHORT).show();
loadDataFromApi();
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Toast.makeText(getContext(), "Data loading was canceled...", Toast.LENGTH_SHORT).show();
// Did not know what exactly to do here, as in task there was no action specified after canceling.
// I would think there still should be a way for user to try again, so cancel button should not be an option
// that way the it would reduce elements on screen and show user clear path of action.
}
});
// create and show the alert dialog
AlertDialog dialog = builder.create();
dialog.show();
}
private void loadDataFromApi()
{
cicleFinished = false;
postViewModel.loadPosts(new RetroFitResponseListener() {
@Override
public void onSuccess() {
Toast.makeText(getContext(), "Data Loaded successfully", Toast.LENGTH_SHORT).show();
refreshView.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
clearRecyclerView();
// I imitate delay of refresh, just to show that its working.
imitateDelayRefresh();
}
});
postViewModel.getAllPosts().observe(getViewLifecycleOwner(), new Observer<List<Post>>() {
@Override
public void onChanged(List<Post> posts) {
refreshView.setRefreshing(true);
tempPostList = posts;
mPostAdapter = new PostAdapter(posts, new PostListener());
mRecyclerView.setAdapter(mPostAdapter);
refreshView.setRefreshing(false);
}
});
postViewModel.getPostListObserver().observe(getViewLifecycleOwner(), new Observer<List<Post>>() {
@Override
public void onChanged(List<Post> posts) {
refreshView.setRefreshing(true);
try {
if(!cicleFinished) {
for (Post post : posts) {
if (post != null && tempPostList != null) {
if (!tempPostList.contains(post)) {
postViewModel.insert(new Post(post.getUserId(), post.getTitle(), post.getBody()));
}
}
}
cicleFinished = true;
}
} catch (Exception e) {
e.printStackTrace();
}
refreshView.setRefreshing(false);
}
});
}
@Override
public void onFailure() {
showAlertDialog(getView());
Toast.makeText(getContext(), "Data Loading failed", Toast.LENGTH_SHORT).show();
}
});
}
}
| 7,115
| 0.603373
| 0.602811
| 174
| 39.896553
| 30.781221
| 126
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.614943
| false
| false
|
2
|
e1dca0709039f8ba98cefe5d31a23af9c40cb7dc
| 1,451,698,981,074
|
c641a4f1dc2302c4ff472c52d4f68d3b590a52a2
|
/boj/simulation/BOJ_14890.java
|
82b8c80d227080a3455f79e26bce52b54c9902dd
|
[] |
no_license
|
jinnyy/algorithm
|
https://github.com/jinnyy/algorithm
|
8d722e9b5ae386745a473b2cc812c410a750e996
|
9df269359e9a8118e3fbb71258017ad2ac635dd9
|
refs/heads/master
| 2020-03-24T22:44:17.598000
| 2020-03-15T07:03:32
| 2020-03-15T07:03:32
| 143,100,464
| 2
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* [백준][14890] 경사로
* 14116 KB 92 ms
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
static int N, L;
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine(), " ");
N = Integer.parseInt(st.nextToken());
L = Integer.parseInt(st.nextToken());
int[][] map = new int[N][N];
for(int i=0; i<N; i++) {
st = new StringTokenizer(br.readLine(), " ");
for(int j=0; j<N; j++) {
map[i][j] = Integer.parseInt(st.nextToken());
}
}
br.close();
// 검사
int cnt = 0;
for(int i=0; i<N; i++) {
if(checkRow(map, i)) cnt++;
if(checkCol(map, i)) cnt++;
}
System.out.println(cnt);
}
private static boolean checkRow(int[][] map, int row) {
int length = 1;
int dir = 0;
for(int x=1; x<N; x++) {
int diff = map[row][x] - map[row][x-1];
if(diff == 0) {
length++;
} else if(diff == 1) {
if(dir == -1 && length < 2*L) return false;
else if(length < L) return false;
length = 1;
dir = diff;
} else if(diff == -1) {
if(dir == -1 && length < L)
return false;
length = 1;
dir = diff;
} else
return false;
}
if(dir == -1 && length < L) return false;
return true;
}
private static boolean checkCol(int[][] map, int col) {
int length = 1;
int dir = 0;
for(int y=1; y<N; y++) {
int diff = map[y][col] - map[y-1][col];
if(diff == 0) {
length++;
} else if(diff == 1) {
if(dir == -1 && length < 2*L) return false;
else if(length < L) return false;
length = 1;
dir = diff;
} else if(diff == -1) {
if(dir == -1 && length < L)
return false;
length = 1;
dir = diff;
} else
return false;
}
if(dir == -1 && length < L) return false;
return true;
}
}
|
UTF-8
|
Java
| 1,922
|
java
|
BOJ_14890.java
|
Java
|
[] | null |
[] |
/*
* [백준][14890] 경사로
* 14116 KB 92 ms
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
static int N, L;
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine(), " ");
N = Integer.parseInt(st.nextToken());
L = Integer.parseInt(st.nextToken());
int[][] map = new int[N][N];
for(int i=0; i<N; i++) {
st = new StringTokenizer(br.readLine(), " ");
for(int j=0; j<N; j++) {
map[i][j] = Integer.parseInt(st.nextToken());
}
}
br.close();
// 검사
int cnt = 0;
for(int i=0; i<N; i++) {
if(checkRow(map, i)) cnt++;
if(checkCol(map, i)) cnt++;
}
System.out.println(cnt);
}
private static boolean checkRow(int[][] map, int row) {
int length = 1;
int dir = 0;
for(int x=1; x<N; x++) {
int diff = map[row][x] - map[row][x-1];
if(diff == 0) {
length++;
} else if(diff == 1) {
if(dir == -1 && length < 2*L) return false;
else if(length < L) return false;
length = 1;
dir = diff;
} else if(diff == -1) {
if(dir == -1 && length < L)
return false;
length = 1;
dir = diff;
} else
return false;
}
if(dir == -1 && length < L) return false;
return true;
}
private static boolean checkCol(int[][] map, int col) {
int length = 1;
int dir = 0;
for(int y=1; y<N; y++) {
int diff = map[y][col] - map[y-1][col];
if(diff == 0) {
length++;
} else if(diff == 1) {
if(dir == -1 && length < 2*L) return false;
else if(length < L) return false;
length = 1;
dir = diff;
} else if(diff == -1) {
if(dir == -1 && length < L)
return false;
length = 1;
dir = diff;
} else
return false;
}
if(dir == -1 && length < L) return false;
return true;
}
}
| 1,922
| 0.557128
| 0.535115
| 83
| 21.987951
| 16.624481
| 75
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 3.060241
| false
| false
|
2
|
34721b8d28ae93c10a172820344debc13a412596
| 1,451,698,977,903
|
6d40a559ca0f874ae7ac922a19b5aaac8dec2e93
|
/src/main/java/ch/uzh/seal/BLogDiff/model/tracking/TrackingEntry.java
|
3d2f63bc39bc2a13eaf0b79e458eadee5ebbe4ec
|
[] |
no_license
|
noahch/blogdiff
|
https://github.com/noahch/blogdiff
|
a4cfcd07fd308c9dedeafd7d3e5be0df7e1094b9
|
c19e9bf5824935ddd607c5cf2b93c4de215036f0
|
refs/heads/master
| 2022-11-28T15:08:42.672000
| 2019-07-30T15:54:20
| 2019-07-30T15:54:20
| 184,011,057
| 0
| 0
| null | false
| 2022-11-16T11:48:42
| 2019-04-29T06:16:37
| 2019-07-30T15:54:29
| 2022-11-16T11:48:39
| 132
| 0
| 0
| 3
|
Java
| false
| false
|
package ch.uzh.seal.BLogDiff.model.tracking;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.util.Date;
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
@Table(name = "tracking")
public class TrackingEntry {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private Date timestamp;
private String userId;
private String repository;
private String jobId1;
private String jobId2;
private int timeSpent;
private boolean additions;
private boolean deletions;
private boolean updates;
private boolean moves;
private boolean highlight;
private boolean wrap;
private boolean differenceOnly;
private boolean symmetricNodes;
private boolean hideNodes;
private boolean heartbeat;
}
|
UTF-8
|
Java
| 973
|
java
|
TrackingEntry.java
|
Java
|
[] | null |
[] |
package ch.uzh.seal.BLogDiff.model.tracking;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.util.Date;
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
@Table(name = "tracking")
public class TrackingEntry {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private Date timestamp;
private String userId;
private String repository;
private String jobId1;
private String jobId2;
private int timeSpent;
private boolean additions;
private boolean deletions;
private boolean updates;
private boolean moves;
private boolean highlight;
private boolean wrap;
private boolean differenceOnly;
private boolean symmetricNodes;
private boolean hideNodes;
private boolean heartbeat;
}
| 973
| 0.757451
| 0.755396
| 47
| 19.702127
| 15.951942
| 61
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.510638
| false
| false
|
2
|
fcc2902b87d10c13ef6f57ef6dcf51fe66442f47
| 26,465,588,494,417
|
2b6e70470567692d2e32a8b109be355c9a7bdb00
|
/colormipsearch-api/src/main/java/org/janelia/colormipsearch/dto/LMPPPNeuronMetadata.java
|
5d2f9cb66064fb37a8c6eccd83ebc5bd68957b96
|
[
"BSD-3-Clause"
] |
permissive
|
JaneliaSciComp/colormipsearch
|
https://github.com/JaneliaSciComp/colormipsearch
|
3896c7f6546fa7e3f74f475e4b3a71df974092d9
|
d630475bade9f2050307f75ed20c114c4f073796
|
refs/heads/main
| 2023-07-20T14:33:46.790000
| 2023-07-13T21:13:50
| 2023-07-13T21:13:50
| 98,349,943
| 0
| 0
|
BSD-3-Clause
| false
| 2023-07-07T18:46:33
| 2017-07-25T21:05:18
| 2022-05-27T18:20:37
| 2023-07-07T18:46:32
| 3,635
| 0
| 0
| 1
|
Java
| false
| false
|
package org.janelia.colormipsearch.dto;
import javax.validation.GroupSequence;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* The default group validation for PPP target images is different because PPP targets will not have a MIP ID.
*/
@GroupSequence({LMPPPNeuronMetadata.class, MissingSomeRequiredAttrs.class})
public class LMPPPNeuronMetadata extends LMNeuronMetadata {
private String sampleId;
public LMPPPNeuronMetadata() {
}
public LMPPPNeuronMetadata(LMNeuronMetadata source) {
this();
copyFrom(source);
}
@JsonIgnore
@Override
public String getMipId() {
return super.getMipId();
}
@JsonProperty("id")
public String getSampleId() {
return sampleId;
}
public void setSampleId(String sampleId) {
this.sampleId = sampleId;
}
}
|
UTF-8
|
Java
| 903
|
java
|
LMPPPNeuronMetadata.java
|
Java
|
[] | null |
[] |
package org.janelia.colormipsearch.dto;
import javax.validation.GroupSequence;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* The default group validation for PPP target images is different because PPP targets will not have a MIP ID.
*/
@GroupSequence({LMPPPNeuronMetadata.class, MissingSomeRequiredAttrs.class})
public class LMPPPNeuronMetadata extends LMNeuronMetadata {
private String sampleId;
public LMPPPNeuronMetadata() {
}
public LMPPPNeuronMetadata(LMNeuronMetadata source) {
this();
copyFrom(source);
}
@JsonIgnore
@Override
public String getMipId() {
return super.getMipId();
}
@JsonProperty("id")
public String getSampleId() {
return sampleId;
}
public void setSampleId(String sampleId) {
this.sampleId = sampleId;
}
}
| 903
| 0.709856
| 0.709856
| 38
| 22.763159
| 25.0215
| 110
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.289474
| false
| false
|
2
|
7de205d2e9432c3f4ea77dee3f72af5c9f08fc52
| 17,282,948,437,118
|
4316788a62e1dc720ecb52a1100e8ae008dcc709
|
/src/zadaci_15_08_2015/MySplit.java
|
5e7f87d7b75b9e5c44cc74f9e6adc523aa96da62
|
[] |
no_license
|
OgnjenMisic/BILD-IT-Zadaci
|
https://github.com/OgnjenMisic/BILD-IT-Zadaci
|
e096b1a4dcd8cacf73632e3746cdcb2b5d227531
|
5d7c658158a0a505a87a1ff8237fd4eaa7a9f348
|
refs/heads/master
| 2016-09-05T14:09:16.831000
| 2015-09-22T18:01:41
| 2015-09-22T18:01:41
| 39,387,295
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package zadaci_15_08_2015;
import java.util.ArrayList;
import java.util.List;
/**
* @author Ognjen Mišić Zadatak 4 - The split method in the String class returns
* an array of strings consisting of the substrings split by the
* delimiters. However, the delimiters are not returned. Implement the
* following new method that returns an array of strings consisting of
* the substrings split by the matching delimiters, including the
* matching delimiters.
*
*/
public class MySplit {
public static void main(String[] args) {
// TODO Auto-generated method stub
String str = "test1,.test2,test3.test4";
String[] split = split(str,".");
for(String s: split) {
System.out.println(s);
}
}
public static String[] split(String s, String regex) {
// arraylist holding the values
List<String> listOfStrings = new ArrayList<String>();
// temporary string
String temp = "";
// counter of matching attempts
int counter;
for (int i = 0; i < s.length(); i++) {
// reset the counter every time
counter = 0;
for (int j = 0; j < regex.length(); j++) {
//if theres a match add the temp, reset and break
if (s.charAt(i) == regex.charAt(j)) {
listOfStrings.add(temp);
listOfStrings.add(regex);
temp = "";
break;
} else {
counter++;
}
// keep concatenating the temp string value untill the counter
if (counter == regex.length()) {
temp += s.charAt(i);
}
}
}
listOfStrings.add(temp);
String[] stringArray = new String[listOfStrings.size()];
for (int i = 0; i < stringArray.length; i++) {
stringArray[i] = listOfStrings.get(i);
}
return stringArray;
}
}
|
WINDOWS-1250
|
Java
| 1,776
|
java
|
MySplit.java
|
Java
|
[
{
"context": "ayList;\r\nimport java.util.List;\r\n\r\n/**\r\n * @author Ognjen Mišić Zadatak 4 - The split method in the String class returns\r",
"end": 121,
"score": 0.9998388290405273,
"start": 101,
"tag": "NAME",
"value": "Ognjen Mišić Zadatak"
}
] | null |
[] |
package zadaci_15_08_2015;
import java.util.ArrayList;
import java.util.List;
/**
* @author <NAME> 4 - The split method in the String class returns
* an array of strings consisting of the substrings split by the
* delimiters. However, the delimiters are not returned. Implement the
* following new method that returns an array of strings consisting of
* the substrings split by the matching delimiters, including the
* matching delimiters.
*
*/
public class MySplit {
public static void main(String[] args) {
// TODO Auto-generated method stub
String str = "test1,.test2,test3.test4";
String[] split = split(str,".");
for(String s: split) {
System.out.println(s);
}
}
public static String[] split(String s, String regex) {
// arraylist holding the values
List<String> listOfStrings = new ArrayList<String>();
// temporary string
String temp = "";
// counter of matching attempts
int counter;
for (int i = 0; i < s.length(); i++) {
// reset the counter every time
counter = 0;
for (int j = 0; j < regex.length(); j++) {
//if theres a match add the temp, reset and break
if (s.charAt(i) == regex.charAt(j)) {
listOfStrings.add(temp);
listOfStrings.add(regex);
temp = "";
break;
} else {
counter++;
}
// keep concatenating the temp string value untill the counter
if (counter == regex.length()) {
temp += s.charAt(i);
}
}
}
listOfStrings.add(temp);
String[] stringArray = new String[listOfStrings.size()];
for (int i = 0; i < stringArray.length; i++) {
stringArray[i] = listOfStrings.get(i);
}
return stringArray;
}
}
| 1,760
| 0.614431
| 0.604848
| 64
| 25.71875
| 22.792864
| 80
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 2.453125
| false
| false
|
2
|
36e582a2551cb53644e230ff46c1da394a721bc7
| 26,259,430,063,993
|
76bb61e3f064f2cdc7c3a5e3afb307ed7df6ee37
|
/src/com/lbins/hmjs/module/RecordVO.java
|
644e76bd5933859b02057ed2bfa028840a2d0e4d
|
[] |
no_license
|
eryiyi/HuiminjishiApp
|
https://github.com/eryiyi/HuiminjishiApp
|
699f19c726384117e8372926e4597a3380e6675d
|
99c3c51c841b7bdb0001ac07ad291e649ddf9508
|
refs/heads/master
| 2021-01-20T03:54:40.268000
| 2017-09-18T03:58:16
| 2017-09-18T03:58:16
| 101,373,392
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.lbins.hmjs.module;
/**
* Created by Administrator on 2017/8/30 0030.
*/
public class RecordVO {
private String record_id;
private String empid;
private String record_type;
private String record_cont;
private String record_pic;
private String record_video;
private String record_use;
private String record_dateline;
private String mobile;
private String nickname;
private String cover;
private int commentNum;
private int favourNum;
public int getCommentNum() {
return commentNum;
}
public void setCommentNum(int commentNum) {
this.commentNum = commentNum;
}
public int getFavourNum() {
return favourNum;
}
public void setFavourNum(int favourNum) {
this.favourNum = favourNum;
}
public String getRecord_id() {
return record_id;
}
public void setRecord_id(String record_id) {
this.record_id = record_id;
}
public String getEmpid() {
return empid;
}
public void setEmpid(String empid) {
this.empid = empid;
}
public String getRecord_type() {
return record_type;
}
public void setRecord_type(String record_type) {
this.record_type = record_type;
}
public String getRecord_cont() {
return record_cont;
}
public void setRecord_cont(String record_cont) {
this.record_cont = record_cont;
}
public String getRecord_pic() {
return record_pic;
}
public void setRecord_pic(String record_pic) {
this.record_pic = record_pic;
}
public String getRecord_video() {
return record_video;
}
public void setRecord_video(String record_video) {
this.record_video = record_video;
}
public String getRecord_use() {
return record_use;
}
public void setRecord_use(String record_use) {
this.record_use = record_use;
}
public String getRecord_dateline() {
return record_dateline;
}
public void setRecord_dateline(String record_dateline) {
this.record_dateline = record_dateline;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getCover() {
return cover;
}
public void setCover(String cover) {
this.cover = cover;
}
}
|
UTF-8
|
Java
| 2,596
|
java
|
RecordVO.java
|
Java
|
[
{
"context": "package com.lbins.hmjs.module;\n\n\n/**\n * Created by Administrator on 2017/8/30 0030.\n */\npublic class RecordVO {\n ",
"end": 64,
"score": 0.43582838773727417,
"start": 51,
"tag": "USERNAME",
"value": "Administrator"
}
] | null |
[] |
package com.lbins.hmjs.module;
/**
* Created by Administrator on 2017/8/30 0030.
*/
public class RecordVO {
private String record_id;
private String empid;
private String record_type;
private String record_cont;
private String record_pic;
private String record_video;
private String record_use;
private String record_dateline;
private String mobile;
private String nickname;
private String cover;
private int commentNum;
private int favourNum;
public int getCommentNum() {
return commentNum;
}
public void setCommentNum(int commentNum) {
this.commentNum = commentNum;
}
public int getFavourNum() {
return favourNum;
}
public void setFavourNum(int favourNum) {
this.favourNum = favourNum;
}
public String getRecord_id() {
return record_id;
}
public void setRecord_id(String record_id) {
this.record_id = record_id;
}
public String getEmpid() {
return empid;
}
public void setEmpid(String empid) {
this.empid = empid;
}
public String getRecord_type() {
return record_type;
}
public void setRecord_type(String record_type) {
this.record_type = record_type;
}
public String getRecord_cont() {
return record_cont;
}
public void setRecord_cont(String record_cont) {
this.record_cont = record_cont;
}
public String getRecord_pic() {
return record_pic;
}
public void setRecord_pic(String record_pic) {
this.record_pic = record_pic;
}
public String getRecord_video() {
return record_video;
}
public void setRecord_video(String record_video) {
this.record_video = record_video;
}
public String getRecord_use() {
return record_use;
}
public void setRecord_use(String record_use) {
this.record_use = record_use;
}
public String getRecord_dateline() {
return record_dateline;
}
public void setRecord_dateline(String record_dateline) {
this.record_dateline = record_dateline;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getCover() {
return cover;
}
public void setCover(String cover) {
this.cover = cover;
}
}
| 2,596
| 0.616333
| 0.612096
| 127
| 19.440945
| 17.294418
| 60
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.314961
| false
| false
|
2
|
58041fec703a9824ada385384273adca42c0529b
| 17,532,056,535,573
|
96edfe942a1ba4635898ac30d7a28e413f3432ad
|
/colplus-dao/src/main/java/org/col/db/PgConfig.java
|
8017f91914a9a2add0463fc5a4aed17b17ed1b06
|
[
"Apache-2.0"
] |
permissive
|
Sp2000/colplus-backend
|
https://github.com/Sp2000/colplus-backend
|
9f735d8180dee4eb251f36420eee37170b21ffb5
|
20bbe3e98c3d3445988e9e1c884a18852f9a5a65
|
refs/heads/master
| 2018-10-12T13:18:13.506000
| 2018-10-10T03:21:04
| 2018-10-10T03:21:04
| 103,390,084
| 1
| 1
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.col.db;
import java.net.URI;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Objects;
import javax.validation.constraints.Min;
import com.google.common.base.MoreObjects;
import com.google.common.base.Strings;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.apache.ibatis.jdbc.ScriptRunner;
/**
* A configuration for the postgres database connection pool as used by the mybatis layer.
*/
@SuppressWarnings("PublicField")
public class PgConfig extends PgDbConfig {
public static final String SCHEMA_FILE = "org/col/db/dbschema.sql";
public static final String DATA_FILE = "org/col/db/data.sql";
public static final String GBIF_DATASETS_FILE = "org/col/db/gbif.sql";
public static final URI COL_DATASETS_URI = URI.create("https://raw.githubusercontent.com/Sp2000/colplus-repo/master/datasets.sql");
/**
* Use null or an absolute file path starting with / to indicate an embedded postgres server
* If a path is given it is used to cache the postgres server installation, but not its data.
*/
public String host;
public int port = 5432;
@Min(1)
public int maximumPoolSize = 8;
/**
* The minimum number of idle connections that the pool tries to maintain.
* If the idle connections dip below this value, the pool will make a best effort to add additional connections quickly and efficiently.
* However, for maximum performance and responsiveness to spike demands, it is recommended to set this value not too low.
* Beware that postgres statically allocates the work_mem for each session which can eat up memory a lot.
*/
@Min(0)
public int minimumIdle = 1;
/**
* This property controls the maximum amount of time in milliseconds that a connection is allowed to sit idle in the pool.
* A connection will never be retired as idle before this timeout.
* A value of 0 means that idle connections are never removed from the pool.
*/
@Min(0)
public int idleTimeout = min(1);
/**
* This property controls the maximum lifetime of a connection in the pool.
* When a connection reaches this timeout it will be retired from the pool.
* An in-use connection will never be retired, only when it is closed will it then be removed.
* A value of 0 indicates no maximum lifetime (infinite lifetime), subject of course to the idleTimeout setting.
*/
@Min(0)
public int maxLifetime = min(15);
/**
* Postgres property lock_timeout:
* Abort any statement that takes more than the specified number of milliseconds,
* starting from the time the command arrives at the server from the client.
* A value of zero (the default) turns this off.
*/
@Min(0)
public int lockTimeout = 0;
/**
* Postgres property idle_in_transaction_session_timeout:
* Terminate any session with an open transaction that has been idle for longer than the specified duration in milliseconds.
* This allows any locks held by that session to be released and the connection slot to be reused;
* it also allows tuples visible only to this transaction to be vacuumed.
*
* The default value of 0 disables this feature.
*/
@Min(0)
public int idleInTransactionSessionTimeout = 0;
/**
* The postgres work_mem session setting in MB that should be used for each connection.
* A value of zero or below does not set anything and thus uses the global postgres settings
*/
public int workMem = 0;
@Min(1000)
public int connectionTimeout = sec(5);
/**
* @return true if an embedded database should be used
*/
public boolean embedded() {
return host == null || host.startsWith("/");
}
/**
* @return converted minutes in milliseconds
*/
private static int min(int minutes) {
return minutes * 60000;
}
/**
* @return converted seconds in milliseconds
*/
private static int sec(int seconds) {
return seconds * 1000;
}
/**
* @return a new simple postgres jdbc connection
*/
public Connection connect() throws SQLException {
return connect(this);
}
/**
* @return a new simple postgres jdbc connection to the given db on this pg server
*/
public Connection connect(PgDbConfig db) throws SQLException {
return DriverManager.getConnection(jdbcUrl(db), Strings.emptyToNull(db.user), Strings.emptyToNull(db.password));
}
private String jdbcUrl(PgDbConfig db) {
return "jdbc:postgresql://" + host + ":" + port + "/" + db.database;
}
/**
* @return a new hikari connection pool for the configured db
*/
public HikariDataSource pool() {
return new HikariDataSource(hikariConfig());
}
public HikariConfig hikariConfig() {
HikariConfig hikari = new HikariConfig();
hikari.setJdbcUrl(jdbcUrl(this));
//hikari.setDataSourceClassName("org.postgresql.ds.PGSimpleDataSource");
hikari.setUsername(user);
hikari.setPassword(password);
hikari.setConnectionTimeout(connectionTimeout);
hikari.setMaximumPoolSize(maximumPoolSize);
hikari.setMinimumIdle(minimumIdle);
hikari.setIdleTimeout(idleTimeout);
hikari.setMaxLifetime(maxLifetime);
// connection settings
StringBuilder sb = new StringBuilder();
if (workMem > 0) {
sb.append("SET work_mem='" + workMem + "MB';");
}
if (lockTimeout > 0) {
sb.append("SET lock_timeout TO " + lockTimeout + ";");
}
if (idleInTransactionSessionTimeout > 0) {
sb.append("SET idle_in_transaction_session_timeout TO " + idleInTransactionSessionTimeout + ";");
}
if (sb.length()>0) {
hikari.setConnectionInitSql(sb.toString());
}
return hikari;
}
public static ScriptRunner scriptRunner(Connection con) {
ScriptRunner runner = new ScriptRunner(con);
// needed to honor the $$ escapes in pg functions
runner.setSendFullScript(true);
runner.setStopOnError(true);
runner.setLogWriter(null);
return runner;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("host", host)
.add("database", database)
.add("user", user)
.add("password", password)
.add("connectionTimeout", connectionTimeout)
.add("maximumPoolSize", maximumPoolSize)
.add("minimumIdle", minimumIdle)
.add("idleTimeout", idleTimeout)
.add("maxLifetime", maxLifetime)
.add("lockTimeout", lockTimeout)
.add("idleInTransactionSessionTimeout", idleInTransactionSessionTimeout)
.add("workMem", workMem)
.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PgConfig pgConfig = (PgConfig) o;
return port == pgConfig.port &&
maximumPoolSize == pgConfig.maximumPoolSize &&
minimumIdle == pgConfig.minimumIdle &&
idleTimeout == pgConfig.idleTimeout &&
maxLifetime == pgConfig.maxLifetime &&
lockTimeout == pgConfig.lockTimeout &&
idleInTransactionSessionTimeout == pgConfig.idleInTransactionSessionTimeout &&
workMem == pgConfig.workMem &&
connectionTimeout == pgConfig.connectionTimeout &&
Objects.equals(host, pgConfig.host) &&
Objects.equals(database, pgConfig.database) &&
Objects.equals(user, pgConfig.user) &&
Objects.equals(password, pgConfig.password);
}
@Override
public int hashCode() {
return Objects.hash(host, port, database, user, password, maximumPoolSize, minimumIdle, idleTimeout, maxLifetime, lockTimeout, idleInTransactionSessionTimeout, workMem, connectionTimeout);
}
}
|
UTF-8
|
Java
| 7,674
|
java
|
PgConfig.java
|
Java
|
[
{
"context": "I = URI.create(\"https://raw.githubusercontent.com/Sp2000/colplus-repo/master/datasets.sql\");\n\n /**\n * U",
"end": 887,
"score": 0.9993097186088562,
"start": 881,
"tag": "USERNAME",
"value": "Sp2000"
},
{
"context": "l.ds.PGSimpleDataSource\");\n hikari.setUsername(user);\n hikari.setPassword(password);\n hikari.se",
"end": 4915,
"score": 0.9274941682815552,
"start": 4911,
"tag": "USERNAME",
"value": "user"
},
{
"context": " hikari.setUsername(user);\n hikari.setPassword(password);\n hikari.setConnectionTimeout(connectionTimeo",
"end": 4949,
"score": 0.9987523555755615,
"start": 4941,
"tag": "PASSWORD",
"value": "password"
},
{
"context": " .add(\"user\", user)\n .add(\"password\", password)\n .add(\"connectionTimeout\", connectionTime",
"end": 6177,
"score": 0.9420748353004456,
"start": 6169,
"tag": "PASSWORD",
"value": "password"
}
] | null |
[] |
package org.col.db;
import java.net.URI;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Objects;
import javax.validation.constraints.Min;
import com.google.common.base.MoreObjects;
import com.google.common.base.Strings;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.apache.ibatis.jdbc.ScriptRunner;
/**
* A configuration for the postgres database connection pool as used by the mybatis layer.
*/
@SuppressWarnings("PublicField")
public class PgConfig extends PgDbConfig {
public static final String SCHEMA_FILE = "org/col/db/dbschema.sql";
public static final String DATA_FILE = "org/col/db/data.sql";
public static final String GBIF_DATASETS_FILE = "org/col/db/gbif.sql";
public static final URI COL_DATASETS_URI = URI.create("https://raw.githubusercontent.com/Sp2000/colplus-repo/master/datasets.sql");
/**
* Use null or an absolute file path starting with / to indicate an embedded postgres server
* If a path is given it is used to cache the postgres server installation, but not its data.
*/
public String host;
public int port = 5432;
@Min(1)
public int maximumPoolSize = 8;
/**
* The minimum number of idle connections that the pool tries to maintain.
* If the idle connections dip below this value, the pool will make a best effort to add additional connections quickly and efficiently.
* However, for maximum performance and responsiveness to spike demands, it is recommended to set this value not too low.
* Beware that postgres statically allocates the work_mem for each session which can eat up memory a lot.
*/
@Min(0)
public int minimumIdle = 1;
/**
* This property controls the maximum amount of time in milliseconds that a connection is allowed to sit idle in the pool.
* A connection will never be retired as idle before this timeout.
* A value of 0 means that idle connections are never removed from the pool.
*/
@Min(0)
public int idleTimeout = min(1);
/**
* This property controls the maximum lifetime of a connection in the pool.
* When a connection reaches this timeout it will be retired from the pool.
* An in-use connection will never be retired, only when it is closed will it then be removed.
* A value of 0 indicates no maximum lifetime (infinite lifetime), subject of course to the idleTimeout setting.
*/
@Min(0)
public int maxLifetime = min(15);
/**
* Postgres property lock_timeout:
* Abort any statement that takes more than the specified number of milliseconds,
* starting from the time the command arrives at the server from the client.
* A value of zero (the default) turns this off.
*/
@Min(0)
public int lockTimeout = 0;
/**
* Postgres property idle_in_transaction_session_timeout:
* Terminate any session with an open transaction that has been idle for longer than the specified duration in milliseconds.
* This allows any locks held by that session to be released and the connection slot to be reused;
* it also allows tuples visible only to this transaction to be vacuumed.
*
* The default value of 0 disables this feature.
*/
@Min(0)
public int idleInTransactionSessionTimeout = 0;
/**
* The postgres work_mem session setting in MB that should be used for each connection.
* A value of zero or below does not set anything and thus uses the global postgres settings
*/
public int workMem = 0;
@Min(1000)
public int connectionTimeout = sec(5);
/**
* @return true if an embedded database should be used
*/
public boolean embedded() {
return host == null || host.startsWith("/");
}
/**
* @return converted minutes in milliseconds
*/
private static int min(int minutes) {
return minutes * 60000;
}
/**
* @return converted seconds in milliseconds
*/
private static int sec(int seconds) {
return seconds * 1000;
}
/**
* @return a new simple postgres jdbc connection
*/
public Connection connect() throws SQLException {
return connect(this);
}
/**
* @return a new simple postgres jdbc connection to the given db on this pg server
*/
public Connection connect(PgDbConfig db) throws SQLException {
return DriverManager.getConnection(jdbcUrl(db), Strings.emptyToNull(db.user), Strings.emptyToNull(db.password));
}
private String jdbcUrl(PgDbConfig db) {
return "jdbc:postgresql://" + host + ":" + port + "/" + db.database;
}
/**
* @return a new hikari connection pool for the configured db
*/
public HikariDataSource pool() {
return new HikariDataSource(hikariConfig());
}
public HikariConfig hikariConfig() {
HikariConfig hikari = new HikariConfig();
hikari.setJdbcUrl(jdbcUrl(this));
//hikari.setDataSourceClassName("org.postgresql.ds.PGSimpleDataSource");
hikari.setUsername(user);
hikari.setPassword(<PASSWORD>);
hikari.setConnectionTimeout(connectionTimeout);
hikari.setMaximumPoolSize(maximumPoolSize);
hikari.setMinimumIdle(minimumIdle);
hikari.setIdleTimeout(idleTimeout);
hikari.setMaxLifetime(maxLifetime);
// connection settings
StringBuilder sb = new StringBuilder();
if (workMem > 0) {
sb.append("SET work_mem='" + workMem + "MB';");
}
if (lockTimeout > 0) {
sb.append("SET lock_timeout TO " + lockTimeout + ";");
}
if (idleInTransactionSessionTimeout > 0) {
sb.append("SET idle_in_transaction_session_timeout TO " + idleInTransactionSessionTimeout + ";");
}
if (sb.length()>0) {
hikari.setConnectionInitSql(sb.toString());
}
return hikari;
}
public static ScriptRunner scriptRunner(Connection con) {
ScriptRunner runner = new ScriptRunner(con);
// needed to honor the $$ escapes in pg functions
runner.setSendFullScript(true);
runner.setStopOnError(true);
runner.setLogWriter(null);
return runner;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("host", host)
.add("database", database)
.add("user", user)
.add("password", <PASSWORD>)
.add("connectionTimeout", connectionTimeout)
.add("maximumPoolSize", maximumPoolSize)
.add("minimumIdle", minimumIdle)
.add("idleTimeout", idleTimeout)
.add("maxLifetime", maxLifetime)
.add("lockTimeout", lockTimeout)
.add("idleInTransactionSessionTimeout", idleInTransactionSessionTimeout)
.add("workMem", workMem)
.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PgConfig pgConfig = (PgConfig) o;
return port == pgConfig.port &&
maximumPoolSize == pgConfig.maximumPoolSize &&
minimumIdle == pgConfig.minimumIdle &&
idleTimeout == pgConfig.idleTimeout &&
maxLifetime == pgConfig.maxLifetime &&
lockTimeout == pgConfig.lockTimeout &&
idleInTransactionSessionTimeout == pgConfig.idleInTransactionSessionTimeout &&
workMem == pgConfig.workMem &&
connectionTimeout == pgConfig.connectionTimeout &&
Objects.equals(host, pgConfig.host) &&
Objects.equals(database, pgConfig.database) &&
Objects.equals(user, pgConfig.user) &&
Objects.equals(password, pgConfig.password);
}
@Override
public int hashCode() {
return Objects.hash(host, port, database, user, password, maximumPoolSize, minimumIdle, idleTimeout, maxLifetime, lockTimeout, idleInTransactionSessionTimeout, workMem, connectionTimeout);
}
}
| 7,678
| 0.700808
| 0.695205
| 217
| 34.364056
| 33.109249
| 192
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.483871
| false
| false
|
2
|
477bacd62affb560f5f0eb0434128c4cc00793e2
| 14,336,600,851,019
|
5548b7d8ca04c8dc9126160c3c76da5e6480c3a3
|
/HelloWeekend/HelloWeekend.java
|
cc63bb6c7ebae660cb38875202df8b94504a56d2
|
[] |
no_license
|
weekend27/Java-Classroom
|
https://github.com/weekend27/Java-Classroom
|
0b6eeff89e8bcac9f7451226331c13591f7f747a
|
66e4b1ba0a8fceb2d367f22fc4da19362ce58159
|
refs/heads/master
| 2021-01-10T01:36:27.101000
| 2015-12-02T09:32:53
| 2015-12-02T09:32:53
| 47,115,155
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
//My first java program
public class HelloWeekend{
public static void main(String[] args){
System.out.println("Hello, Weekend!!!");
}
}
|
UTF-8
|
Java
| 145
|
java
|
HelloWeekend.java
|
Java
|
[] | null |
[] |
//My first java program
public class HelloWeekend{
public static void main(String[] args){
System.out.println("Hello, Weekend!!!");
}
}
| 145
| 0.682759
| 0.682759
| 7
| 19.714285
| 17.367575
| 44
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.285714
| false
| false
|
2
|
6c1e5118b5575be98c33c9cc933ab9776b8dea17
| 6,554,120,163,130
|
45aa9cffe4939da6a02f6778139d470ae9f6335e
|
/hangman/src/Model/HangmanWord.java
|
d47a9b1ecfb104d878a3ba1399c05b2b9e25f330
|
[] |
no_license
|
papamamadoii/Internship
|
https://github.com/papamamadoii/Internship
|
68f1d24c3311d22cd256710d3b352d100b6bad4c
|
b77ebddf9cddba1d8975a67640216c704a9e9411
|
refs/heads/master
| 2020-04-20T08:08:28.296000
| 2019-01-29T08:13:10
| 2019-01-29T08:13:10
| 168,730,585
| 0
| 0
| null | true
| 2019-02-01T16:55:41
| 2019-02-01T16:55:41
| 2019-01-29T08:13:19
| 2019-01-29T08:13:18
| 201
| 0
| 0
| 0
| null | false
| null |
package Model;
import java.util.ArrayList;
import java.util.List;
/**
* Hangman game model.
* @author narisa singngam
*/
public class HangmanWord {
private static HangmanWord instance;
private List<String> words;
private List<String> hint;
private int score;
private int sizetime;
private int countWrongAns;
private HangmanWord(){
words = new ArrayList<>();
hint = new ArrayList<>();
score = 0;
sizetime = 0;
countWrongAns = 5;
}
/** Get instance of GameModel.*/
public static HangmanWord getInstance(){
if (instance == null) {
instance = new HangmanWord();
}
return instance;
}
/** Get list of word from the file.*/
public List<String> getWords(){
return words;
}
/** Get list of hint from the file.*/
public List<String> getHint(){
return hint;
}
/** Get number of score.*/
public int getScore(){
return score;
}
/**Get size for entering letter.*/
public int getSizeTime(){
return sizetime;
}
/**Get the number of wrong answer.*/
public int getCountWrongAnswer(){
return countWrongAns;
}
public void setScore(int newscore){
score = newscore;
}
public void setSize(int updateSize){
sizetime = updateSize;
}
public void setCountWrongAnswer(int updateAns){
countWrongAns = updateAns;
}
}
|
UTF-8
|
Java
| 1,277
|
java
|
HangmanWord.java
|
Java
|
[
{
"context": ".util.List;\n\n/**\n * Hangman game model.\n * @author narisa singngam\n */\npublic class HangmanWord {\n\t\n\tprivate static ",
"end": 121,
"score": 0.9997889399528503,
"start": 106,
"tag": "NAME",
"value": "narisa singngam"
}
] | null |
[] |
package Model;
import java.util.ArrayList;
import java.util.List;
/**
* Hangman game model.
* @author <NAME>
*/
public class HangmanWord {
private static HangmanWord instance;
private List<String> words;
private List<String> hint;
private int score;
private int sizetime;
private int countWrongAns;
private HangmanWord(){
words = new ArrayList<>();
hint = new ArrayList<>();
score = 0;
sizetime = 0;
countWrongAns = 5;
}
/** Get instance of GameModel.*/
public static HangmanWord getInstance(){
if (instance == null) {
instance = new HangmanWord();
}
return instance;
}
/** Get list of word from the file.*/
public List<String> getWords(){
return words;
}
/** Get list of hint from the file.*/
public List<String> getHint(){
return hint;
}
/** Get number of score.*/
public int getScore(){
return score;
}
/**Get size for entering letter.*/
public int getSizeTime(){
return sizetime;
}
/**Get the number of wrong answer.*/
public int getCountWrongAnswer(){
return countWrongAns;
}
public void setScore(int newscore){
score = newscore;
}
public void setSize(int updateSize){
sizetime = updateSize;
}
public void setCountWrongAnswer(int updateAns){
countWrongAns = updateAns;
}
}
| 1,268
| 0.682067
| 0.679718
| 69
| 17.507246
| 13.728868
| 48
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.434783
| false
| false
|
2
|
b06411107a227b6f618e20044e7a4f04d3c3e90c
| 4,226,247,860,824
|
b389664c7c20ea9ea9bbfd450fb80684af470bdc
|
/Basics/Mainclass.java
|
e0ab3854408174813601452fadc5ea5272c4e1b0
|
[] |
no_license
|
karthikrajan961/Corejava
|
https://github.com/karthikrajan961/Corejava
|
f8eccae52cf6bd7f898f69eec6b2148938301fe1
|
4e88e157890130f601971faedf3a2aba9c43b188
|
refs/heads/master
| 2020-03-19T04:29:41.680000
| 2018-06-16T08:13:08
| 2018-06-16T08:13:08
| 135,834,806
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
public class Mainclass{
public static void main(String[] args){
Calculator calc= new Calculator();
int k=calc.sum(10,5);
int l=calc.diff(10,5);
int m=Calculator.div(10,5);
int n=Calculator.prod(10,5);
System.out.println("Sum ="+k);
System.out.println("DIfference ="+l);
System.out.println("Dividend ="+m);
System.out.println("Product ="+n);
}
}
|
UTF-8
|
Java
| 378
|
java
|
Mainclass.java
|
Java
|
[] | null |
[] |
public class Mainclass{
public static void main(String[] args){
Calculator calc= new Calculator();
int k=calc.sum(10,5);
int l=calc.diff(10,5);
int m=Calculator.div(10,5);
int n=Calculator.prod(10,5);
System.out.println("Sum ="+k);
System.out.println("DIfference ="+l);
System.out.println("Dividend ="+m);
System.out.println("Product ="+n);
}
}
| 378
| 0.642857
| 0.611111
| 13
| 28.153847
| 12.720946
| 41
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.615385
| false
| false
|
2
|
c8f4a10cd7f6bb0cfce68e4d44ac8ad315c91fca
| 4,226,247,861,285
|
9d09424f7f79f0ee84ef54e6eb5e2e3802f9d1ef
|
/src/dados/Dados.java
|
5b6d5e49d86cc42bf6ef45200a65925419ec0e29
|
[] |
no_license
|
edin01/TesteBack
|
https://github.com/edin01/TesteBack
|
7918c4df72fe01f310b0093be974e20dd4597250
|
60ddbecd293ee41f18afdccbfa7121de1469bc94
|
refs/heads/master
| 2020-03-24T21:22:57.230000
| 2018-07-31T15:27:03
| 2018-07-31T15:27:03
| 143,029,107
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package dados;
public class Dados {
int id_customer;
long cpf_cnpj;
String nm_customer;
String is_active;
double vl_total;
public int getId_customer() {
return id_customer;
}
public void setId_customer(int id_customer) {
this.id_customer = id_customer;
}
public long getCpf_cnpj() {
return cpf_cnpj;
}
public void setCpf_cnpj(long cpf_cnpj) {
this.cpf_cnpj = cpf_cnpj;
}
public String getNm_customer() {
return nm_customer;
}
public void setNm_customer(String nm_customer) {
this.nm_customer = nm_customer;
}
public String getIs_active() {
return is_active;
}
public void setIs_active(String is_active) {
this.is_active = is_active;
}
public double getVl_total() {
return vl_total;
}
public void setVl_total(double vl_total) {
this.vl_total = vl_total;
}
}
|
UTF-8
|
Java
| 809
|
java
|
Dados.java
|
Java
|
[] | null |
[] |
package dados;
public class Dados {
int id_customer;
long cpf_cnpj;
String nm_customer;
String is_active;
double vl_total;
public int getId_customer() {
return id_customer;
}
public void setId_customer(int id_customer) {
this.id_customer = id_customer;
}
public long getCpf_cnpj() {
return cpf_cnpj;
}
public void setCpf_cnpj(long cpf_cnpj) {
this.cpf_cnpj = cpf_cnpj;
}
public String getNm_customer() {
return nm_customer;
}
public void setNm_customer(String nm_customer) {
this.nm_customer = nm_customer;
}
public String getIs_active() {
return is_active;
}
public void setIs_active(String is_active) {
this.is_active = is_active;
}
public double getVl_total() {
return vl_total;
}
public void setVl_total(double vl_total) {
this.vl_total = vl_total;
}
}
| 809
| 0.688504
| 0.688504
| 43
| 17.813953
| 14.937475
| 49
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.465116
| false
| false
|
2
|
c384330b93905041cd8bf6e759055a6277a5e168
| 15,857,019,275,998
|
90eaab309c308dcc1eaba04efc2756c7e5914240
|
/src/main/java/ru/klaw/moex/types/response124/ResponseData.java
|
22cf42ef2ff2f8fa8bdfbf3111e6eb8cb6fe2446
|
[] |
no_license
|
Klawru/MoexApiSwagger
|
https://github.com/Klawru/MoexApiSwagger
|
c0abc785809bdb57b85ec3b2de2dd82b0f0bdf6f
|
cee92fea1a1636d595225f904df0e0f9d6083bc2
|
refs/heads/master
| 2022-12-25T06:41:49.733000
| 2020-10-08T19:47:34
| 2020-10-08T19:47:34
| 302,420,799
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package ru.klaw.moex.types.response124;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.micronaut.core.annotation.Introspected;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Introspected
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonPropertyOrder({
"group.filters", "indicator.filters", "currency.filters"
})
public class ResponseData {
@JsonProperty("group.filters")
List<GroupFilters> groupFilters;
@JsonProperty("indicator.filters")
List<IndicatorFilters> indicatorFilters;
@JsonProperty("currency.filters")
List<CurrencyFilters> currencyFilters;
}
|
UTF-8
|
Java
| 764
|
java
|
ResponseData.java
|
Java
|
[] | null |
[] |
package ru.klaw.moex.types.response124;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.micronaut.core.annotation.Introspected;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Introspected
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonPropertyOrder({
"group.filters", "indicator.filters", "currency.filters"
})
public class ResponseData {
@JsonProperty("group.filters")
List<GroupFilters> groupFilters;
@JsonProperty("indicator.filters")
List<IndicatorFilters> indicatorFilters;
@JsonProperty("currency.filters")
List<CurrencyFilters> currencyFilters;
}
| 764
| 0.791885
| 0.787958
| 29
| 25.344828
| 18.612705
| 64
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.482759
| false
| false
|
2
|
723d83513cbac7e066b2aa6e98262ba8ae11d6c9
| 22,153,441,326,147
|
3b10c69616461742cedb97a02f9d1939280e2ac3
|
/app/src/main/java/com/kaha/bletools/bluetooth/utils/bluetooth/SortByRssi.java
|
86139b91900c32502ed9c4e2b25a0e200c6640ba
|
[
"Apache-2.0"
] |
permissive
|
DragonCaat/BleTools
|
https://github.com/DragonCaat/BleTools
|
08731a37914f9b23a8f123660ac0cd7a7dddbe27
|
f7acd5bcf51e400ec984837c28a347641f420a73
|
refs/heads/master
| 2022-02-26T13:09:07.231000
| 2019-08-28T06:10:47
| 2019-08-28T06:10:47
| 161,438,922
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.kaha.bletools.bluetooth.utils.bluetooth;
import com.inuker.bluetooth.library.search.SearchResult;
import com.kaha.bletools.bluetooth.entity.BluetoothEntity;
import java.util.Comparator;
/**
* @author : Darcy
* @package com.kaha.bletools.bluetooth.utils.bluetooth
* @Date 2018-11-13 14:02
* @Description 根据信号强弱排序
*/
public class SortByRssi implements Comparator {
public int compare(Object o1, Object o2) {
SearchResult s1 = (SearchResult) o1;
SearchResult s2 = (SearchResult) o2;
if (s1.rssi < s2.rssi)
return 1;
if (s1.rssi == s2.rssi)
return 0;
return -1;
}
}
|
UTF-8
|
Java
| 671
|
java
|
SortByRssi.java
|
Java
|
[
{
"context": "y;\n\nimport java.util.Comparator;\n\n/**\n * @author : Darcy\n * @package com.kaha.bletools.bluetooth.utils.blu",
"end": 223,
"score": 0.9613103866577148,
"start": 218,
"tag": "USERNAME",
"value": "Darcy"
}
] | null |
[] |
package com.kaha.bletools.bluetooth.utils.bluetooth;
import com.inuker.bluetooth.library.search.SearchResult;
import com.kaha.bletools.bluetooth.entity.BluetoothEntity;
import java.util.Comparator;
/**
* @author : Darcy
* @package com.kaha.bletools.bluetooth.utils.bluetooth
* @Date 2018-11-13 14:02
* @Description 根据信号强弱排序
*/
public class SortByRssi implements Comparator {
public int compare(Object o1, Object o2) {
SearchResult s1 = (SearchResult) o1;
SearchResult s2 = (SearchResult) o2;
if (s1.rssi < s2.rssi)
return 1;
if (s1.rssi == s2.rssi)
return 0;
return -1;
}
}
| 671
| 0.668702
| 0.630534
| 25
| 25.200001
| 19.969978
| 58
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.4
| false
| false
|
2
|
24e91035aa409525b1f7d20c35c3d976ef41ec97
| 27,075,473,859,024
|
b6297a9dec5a554d9e02b69683788d26a52cb4b3
|
/teamcity-slack-integration-server/src/main/java/com/enlivenhq/teamcity/SlackWrapperBuilder.java
|
cbbc77c00f2c20baae230fe7903c684a22be3002
|
[
"MIT"
] |
permissive
|
avonderluft/teamcity-slack
|
https://github.com/avonderluft/teamcity-slack
|
1d118690361335c0522ad2fde7d6d1b19ca8e323
|
a615c3867b5f39a1616cd04bdbefbdb661789af7
|
refs/heads/master
| 2021-01-15T10:45:49.521000
| 2016-04-28T23:31:07
| 2016-05-17T11:54:30
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.enlivenhq.teamcity;
import com.enlivenhq.slack.PullRequestInfo;
import com.enlivenhq.slack.SlackWrapper;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
public class SlackWrapperBuilder {
private static final Logger log = Logger.getLogger(SlackNotificator.class);
public static List<SlackWrapper> getSlackWrappers(String configuredChannelOfTheUser,
PullRequestInfo pr, String urlKey,
String slackBotName, String teamcityServerUrl,
List<String> additionalChannels){
List<String> channels = pr.getChannels();
if(StringUtils.isNotEmpty(configuredChannelOfTheUser)) {
channels.add(0, configuredChannelOfTheUser);
}
if(additionalChannels != null){
channels.addAll(additionalChannels);
}
channels = new ArrayList<String>(new LinkedHashSet<String>(channels));// remove duplicate channels
List<SlackWrapper> ret = new ArrayList<SlackWrapper>(channels.size());
for(String channel : channels) {
if (slackConfigurationIsInvalid(channel, slackBotName, urlKey)) {
log.error("Could not send Slack notification. The Slack channel, username, or URL was null. " +
"Double check your Notification settings");
}else{
ret.add(constructSlackWrapper(channel, slackBotName, urlKey, pr.Url, teamcityServerUrl));
}
}
return ret;
}
private static boolean slackConfigurationIsInvalid(String channel, String username, String url) {
return channel == null || username == null || url == null;
}
private static SlackWrapper constructSlackWrapper(String channel, String username, String url, String pullReqUrl,
String teamcityServerUrl) {
SlackWrapper slackWrapper = new SlackWrapper();
slackWrapper.setChannel(channel);
slackWrapper.setUsername(username);
slackWrapper.setSlackUrl(url);
slackWrapper.setPullRequestUrl(pullReqUrl);
slackWrapper.setServerUrl(teamcityServerUrl);
return slackWrapper;
}
}
|
UTF-8
|
Java
| 2,406
|
java
|
SlackWrapperBuilder.java
|
Java
|
[
{
"context": "hannel(channel);\n slackWrapper.setUsername(username);\n slackWrapper.setSlackUrl(url);\n ",
"end": 2220,
"score": 0.9984281063079834,
"start": 2212,
"tag": "USERNAME",
"value": "username"
}
] | null |
[] |
package com.enlivenhq.teamcity;
import com.enlivenhq.slack.PullRequestInfo;
import com.enlivenhq.slack.SlackWrapper;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
public class SlackWrapperBuilder {
private static final Logger log = Logger.getLogger(SlackNotificator.class);
public static List<SlackWrapper> getSlackWrappers(String configuredChannelOfTheUser,
PullRequestInfo pr, String urlKey,
String slackBotName, String teamcityServerUrl,
List<String> additionalChannels){
List<String> channels = pr.getChannels();
if(StringUtils.isNotEmpty(configuredChannelOfTheUser)) {
channels.add(0, configuredChannelOfTheUser);
}
if(additionalChannels != null){
channels.addAll(additionalChannels);
}
channels = new ArrayList<String>(new LinkedHashSet<String>(channels));// remove duplicate channels
List<SlackWrapper> ret = new ArrayList<SlackWrapper>(channels.size());
for(String channel : channels) {
if (slackConfigurationIsInvalid(channel, slackBotName, urlKey)) {
log.error("Could not send Slack notification. The Slack channel, username, or URL was null. " +
"Double check your Notification settings");
}else{
ret.add(constructSlackWrapper(channel, slackBotName, urlKey, pr.Url, teamcityServerUrl));
}
}
return ret;
}
private static boolean slackConfigurationIsInvalid(String channel, String username, String url) {
return channel == null || username == null || url == null;
}
private static SlackWrapper constructSlackWrapper(String channel, String username, String url, String pullReqUrl,
String teamcityServerUrl) {
SlackWrapper slackWrapper = new SlackWrapper();
slackWrapper.setChannel(channel);
slackWrapper.setUsername(username);
slackWrapper.setSlackUrl(url);
slackWrapper.setPullRequestUrl(pullReqUrl);
slackWrapper.setServerUrl(teamcityServerUrl);
return slackWrapper;
}
}
| 2,406
| 0.640482
| 0.639651
| 55
| 42.745453
| 34.553894
| 117
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.890909
| false
| false
|
2
|
fbbcebdd81ba3ce4224fa9232552646472f6889a
| 28,140,625,745,290
|
43c012a9cdea1df74ddeaf16f7850ccaaedf0782
|
/BCH/library/api/fermat-bch-api/src/main/java/com/bitdubai/fermat_bch_api/layer/definition/event_manager/events/IncomingAssetOnBlockchainWaitingTransferenceRedeemPointEvent.java
|
9ff52abaabc5cf2f18940b90f7dc8eb98bcc99f2
|
[
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] |
permissive
|
franklinmarcano1970/fermat
|
https://github.com/franklinmarcano1970/fermat
|
ef08d8c46740ac80ebeec96eca85936ce36d3ee8
|
c5239a0d4c97414881c9baf152243e6311c9afd5
|
refs/heads/develop
| 2020-04-07T04:12:39.745000
| 2016-05-23T21:20:37
| 2016-05-23T21:20:37
| 52,887,265
| 1
| 22
| null | true
| 2016-08-23T12:58:03
| 2016-03-01T15:26:55
| 2016-03-01T18:56:58
| 2016-08-23T12:58:03
| 558,233
| 1
| 5
| 0
|
Java
| null | null |
package com.bitdubai.fermat_bch_api.layer.definition.event_manager.events;
import com.bitdubai.fermat_bch_api.layer.definition.event_manager.enums.EventType;
/**
* Created by rodrigo on 11/19/15.
*/
public class IncomingAssetOnBlockchainWaitingTransferenceRedeemPointEvent extends AbstractFermatCryptoEvent {
public IncomingAssetOnBlockchainWaitingTransferenceRedeemPointEvent() {
super(EventType.INCOMING_ASSET_ON_BLOCKCHAIN_WAITING_TRANSFERENCE_REDEEM_POINT);
}
}
|
UTF-8
|
Java
| 487
|
java
|
IncomingAssetOnBlockchainWaitingTransferenceRedeemPointEvent.java
|
Java
|
[
{
"context": ".event_manager.enums.EventType;\n\n/**\n * Created by rodrigo on 11/19/15.\n */\npublic class IncomingAssetOnBloc",
"end": 186,
"score": 0.9994853734970093,
"start": 179,
"tag": "USERNAME",
"value": "rodrigo"
}
] | null |
[] |
package com.bitdubai.fermat_bch_api.layer.definition.event_manager.events;
import com.bitdubai.fermat_bch_api.layer.definition.event_manager.enums.EventType;
/**
* Created by rodrigo on 11/19/15.
*/
public class IncomingAssetOnBlockchainWaitingTransferenceRedeemPointEvent extends AbstractFermatCryptoEvent {
public IncomingAssetOnBlockchainWaitingTransferenceRedeemPointEvent() {
super(EventType.INCOMING_ASSET_ON_BLOCKCHAIN_WAITING_TRANSFERENCE_REDEEM_POINT);
}
}
| 487
| 0.811088
| 0.798768
| 13
| 36.46154
| 40.541744
| 109
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.230769
| false
| false
|
2
|
3cb9cc0236d1f3738000bdd0e10cdb095047175e
| 8,366,596,346,480
|
6baf1fe00541560788e78de5244ae17a7a2b375a
|
/hollywood/com.oculus.bugreportservice-BugReportService/sources/sun/util/calendar/CalendarSystem.java
|
5b1f432f349af491017121b43459517b76aa6a30
|
[] |
no_license
|
phwd/quest-tracker
|
https://github.com/phwd/quest-tracker
|
286e605644fc05f00f4904e51f73d77444a78003
|
3d46fbb467ba11bee5827f7cae7dfeabeb1fd2ba
|
refs/heads/main
| 2023-03-29T20:33:10.959000
| 2021-04-10T22:14:11
| 2021-04-10T22:14:11
| 357,185,040
| 4
| 2
| null | true
| 2021-04-12T12:28:09
| 2021-04-12T12:28:08
| 2021-04-10T22:15:44
| 2021-04-10T22:15:39
| 116,441
| 0
| 0
| 0
| null | false
| false
|
package sun.util.calendar;
import java.util.HashMap;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
public abstract class CalendarSystem {
private static final Gregorian GREGORIAN_INSTANCE = new Gregorian();
private static final ConcurrentMap calendars = new ConcurrentHashMap();
private static final Map names = new HashMap();
public abstract CalendarDate newCalendarDate();
public abstract CalendarDate newCalendarDate(TimeZone timeZone);
public abstract boolean normalize(CalendarDate calendarDate);
static {
names.put("gregorian", Gregorian.class);
names.put("japanese", LocalGregorianCalendar.class);
names.put("julian", JulianCalendar.class);
}
public static Gregorian getGregorianCalendar() {
return GREGORIAN_INSTANCE;
}
public static CalendarSystem forName(String str) {
CalendarSystem calendarSystem;
if ("gregorian".equals(str)) {
return GREGORIAN_INSTANCE;
}
CalendarSystem calendarSystem2 = (CalendarSystem) calendars.get(str);
if (calendarSystem2 != null) {
return calendarSystem2;
}
Class cls = (Class) names.get(str);
if (cls == null) {
return null;
}
if (cls.isAssignableFrom(LocalGregorianCalendar.class)) {
calendarSystem = LocalGregorianCalendar.getLocalGregorianCalendar(str);
} else {
try {
calendarSystem = (CalendarSystem) cls.newInstance();
} catch (Exception e) {
throw new InternalError(e);
}
}
if (calendarSystem == null) {
return null;
}
CalendarSystem calendarSystem3 = (CalendarSystem) calendars.putIfAbsent(str, calendarSystem);
return calendarSystem3 == null ? calendarSystem : calendarSystem3;
}
/* JADX WARNING: Code restructure failed: missing block: B:10:0x0017, code lost:
if (r1 != null) goto L_0x0019;
*/
/* JADX WARNING: Code restructure failed: missing block: B:12:?, code lost:
r1.close();
*/
/* JADX WARNING: Code restructure failed: missing block: B:13:0x001d, code lost:
r1 = move-exception;
*/
/* JADX WARNING: Code restructure failed: missing block: B:14:0x001e, code lost:
r0.addSuppressed(r1);
*/
/* JADX WARNING: Code restructure failed: missing block: B:15:0x0021, code lost:
throw r2;
*/
/* JADX WARNING: Code restructure failed: missing block: B:9:0x0016, code lost:
r2 = move-exception;
*/
/* Code decompiled incorrectly, please refer to instructions dump. */
public static java.util.Properties getCalendarProperties() {
/*
java.util.Properties r0 = new java.util.Properties
r0.<init>()
java.lang.String r1 = "calendars.properties"
java.io.InputStream r1 = java.lang.ClassLoader.getSystemResourceAsStream(r1)
r0.load(r1) // Catch:{ all -> 0x0014 }
if (r1 == 0) goto L_0x0013
r1.close()
L_0x0013:
return r0
L_0x0014:
r0 = move-exception
throw r0 // Catch:{ all -> 0x0016 }
L_0x0016:
r2 = move-exception
if (r1 == 0) goto L_0x0021
r1.close() // Catch:{ all -> 0x001d }
goto L_0x0021
L_0x001d:
r1 = move-exception
r0.addSuppressed(r1)
L_0x0021:
throw r2
*/
throw new UnsupportedOperationException("Method not decompiled: sun.util.calendar.CalendarSystem.getCalendarProperties():java.util.Properties");
}
}
|
UTF-8
|
Java
| 3,789
|
java
|
CalendarSystem.java
|
Java
|
[] | null |
[] |
package sun.util.calendar;
import java.util.HashMap;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
public abstract class CalendarSystem {
private static final Gregorian GREGORIAN_INSTANCE = new Gregorian();
private static final ConcurrentMap calendars = new ConcurrentHashMap();
private static final Map names = new HashMap();
public abstract CalendarDate newCalendarDate();
public abstract CalendarDate newCalendarDate(TimeZone timeZone);
public abstract boolean normalize(CalendarDate calendarDate);
static {
names.put("gregorian", Gregorian.class);
names.put("japanese", LocalGregorianCalendar.class);
names.put("julian", JulianCalendar.class);
}
public static Gregorian getGregorianCalendar() {
return GREGORIAN_INSTANCE;
}
public static CalendarSystem forName(String str) {
CalendarSystem calendarSystem;
if ("gregorian".equals(str)) {
return GREGORIAN_INSTANCE;
}
CalendarSystem calendarSystem2 = (CalendarSystem) calendars.get(str);
if (calendarSystem2 != null) {
return calendarSystem2;
}
Class cls = (Class) names.get(str);
if (cls == null) {
return null;
}
if (cls.isAssignableFrom(LocalGregorianCalendar.class)) {
calendarSystem = LocalGregorianCalendar.getLocalGregorianCalendar(str);
} else {
try {
calendarSystem = (CalendarSystem) cls.newInstance();
} catch (Exception e) {
throw new InternalError(e);
}
}
if (calendarSystem == null) {
return null;
}
CalendarSystem calendarSystem3 = (CalendarSystem) calendars.putIfAbsent(str, calendarSystem);
return calendarSystem3 == null ? calendarSystem : calendarSystem3;
}
/* JADX WARNING: Code restructure failed: missing block: B:10:0x0017, code lost:
if (r1 != null) goto L_0x0019;
*/
/* JADX WARNING: Code restructure failed: missing block: B:12:?, code lost:
r1.close();
*/
/* JADX WARNING: Code restructure failed: missing block: B:13:0x001d, code lost:
r1 = move-exception;
*/
/* JADX WARNING: Code restructure failed: missing block: B:14:0x001e, code lost:
r0.addSuppressed(r1);
*/
/* JADX WARNING: Code restructure failed: missing block: B:15:0x0021, code lost:
throw r2;
*/
/* JADX WARNING: Code restructure failed: missing block: B:9:0x0016, code lost:
r2 = move-exception;
*/
/* Code decompiled incorrectly, please refer to instructions dump. */
public static java.util.Properties getCalendarProperties() {
/*
java.util.Properties r0 = new java.util.Properties
r0.<init>()
java.lang.String r1 = "calendars.properties"
java.io.InputStream r1 = java.lang.ClassLoader.getSystemResourceAsStream(r1)
r0.load(r1) // Catch:{ all -> 0x0014 }
if (r1 == 0) goto L_0x0013
r1.close()
L_0x0013:
return r0
L_0x0014:
r0 = move-exception
throw r0 // Catch:{ all -> 0x0016 }
L_0x0016:
r2 = move-exception
if (r1 == 0) goto L_0x0021
r1.close() // Catch:{ all -> 0x001d }
goto L_0x0021
L_0x001d:
r1 = move-exception
r0.addSuppressed(r1)
L_0x0021:
throw r2
*/
throw new UnsupportedOperationException("Method not decompiled: sun.util.calendar.CalendarSystem.getCalendarProperties():java.util.Properties");
}
}
| 3,789
| 0.61573
| 0.582476
| 105
| 35.085712
| 28.452839
| 152
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.438095
| false
| false
|
2
|
f57a2a53709a7411a22d737de914cc6024a805b7
| 29,446,295,815,034
|
13eb884a50d69783cfaa45c9cb4f845c3b649618
|
/pricegsm-webapp/src/main/java/com/pricegsm/config/Constants.java
|
a3b570870892400904df5ae75ec04523e7aca398
|
[] |
no_license
|
privalove/pricegsm
|
https://github.com/privalove/pricegsm
|
221bf3be4926c73e6b4893d6229a40e7eec7f817
|
87a15d3b6dbd5a071c9194a0a4332889b2e762e3
|
refs/heads/master
| 2021-01-12T21:43:41.375000
| 2017-03-16T16:07:47
| 2017-03-16T16:07:47
| 15,478,086
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.pricegsm.config;
public final class Constants {
public static final String ASSETS_VERSION = "assetsVersion";
}
|
UTF-8
|
Java
| 130
|
java
|
Constants.java
|
Java
|
[] | null |
[] |
package com.pricegsm.config;
public final class Constants {
public static final String ASSETS_VERSION = "assetsVersion";
}
| 130
| 0.753846
| 0.753846
| 7
| 17.571428
| 22.739878
| 64
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.285714
| false
| false
|
2
|
6552ff1a947c9b32c804925cfee0e51867b1b548
| 10,471,130,270,674
|
39a79fea79171e941b199b27fdbf1bf234640429
|
/gfycat-core/src/main/java/com/gfycat/core/creation/pojo/CreatedGfycat.java
|
196c821241fd569d75acd949eadeec8be243f4a8
|
[
"Apache-2.0"
] |
permissive
|
Cyberheavenskeet/gfycat-android-sdk
|
https://github.com/Cyberheavenskeet/gfycat-android-sdk
|
191ad2973d8c64089c50b20ab9d4320e8b846302
|
5590fcbc4066327e33c1b59ec47baebaa5e56ed7
|
refs/heads/master
| 2023-04-15T23:41:00.356000
| 2019-03-30T21:53:34
| 2019-03-30T21:53:34
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Copyright (c) 2015-present, Gfycat, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.gfycat.core.creation.pojo;
/**
* Created by dekalo on 11.12.15.
*/
public class CreatedGfycat {
private boolean isOk;
private String gfyname;
private String secret;
public CreatedGfycat() {
}
public CreatedGfycat(String gfyname, String secret, boolean isOk) {
this.gfyname = gfyname;
this.secret = secret;
this.isOk = isOk;
}
public String getGfyname() {
return gfyname;
}
public String getSecret() {
return secret;
}
@Override
public String toString() {
return "CreatedGfycat{" +
"isOk=" + isOk +
", gfyname='" + gfyname + '\'' +
", secret='" + secret + '\'' +
'}';
}
}
|
UTF-8
|
Java
| 1,392
|
java
|
CreatedGfycat.java
|
Java
|
[
{
"context": "com.gfycat.core.creation.pojo;\n\n\n/**\n * Created by dekalo on 11.12.15.\n */\npublic class CreatedGfycat {\n\n ",
"end": 696,
"score": 0.9996833801269531,
"start": 690,
"tag": "USERNAME",
"value": "dekalo"
}
] | null |
[] |
/*
* Copyright (c) 2015-present, Gfycat, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.gfycat.core.creation.pojo;
/**
* Created by dekalo on 11.12.15.
*/
public class CreatedGfycat {
private boolean isOk;
private String gfyname;
private String secret;
public CreatedGfycat() {
}
public CreatedGfycat(String gfyname, String secret, boolean isOk) {
this.gfyname = gfyname;
this.secret = secret;
this.isOk = isOk;
}
public String getGfyname() {
return gfyname;
}
public String getSecret() {
return secret;
}
@Override
public String toString() {
return "CreatedGfycat{" +
"isOk=" + isOk +
", gfyname='" + gfyname + '\'' +
", secret='" + secret + '\'' +
'}';
}
}
| 1,392
| 0.623563
| 0.613506
| 54
| 24.777779
| 23.514902
| 75
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.388889
| false
| false
|
2
|
1050dbef923c665791138734868cd15d5e89fd33
| 6,691,559,081,151
|
e755b86308c1ddd2a98a235be6349f0dc47ed6b5
|
/web-server/sharecommon/src/main/java/com/xuanwu/msggate/common/cache/engine/MsgFrameTag.java
|
373b8427f61c0d12dd52c2a5fb2eaf11e06384dc
|
[] |
no_license
|
druidJane/Druid3.0.3
|
https://github.com/druidJane/Druid3.0.3
|
37466528b9d0356c0ccb4a933a047e522af431f4
|
595d831ed8c81d142d4c7a82de3f953859ddc8fc
|
refs/heads/master
| 2021-05-08T07:33:21.202000
| 2017-11-09T10:36:50
| 2017-11-09T10:36:51
| 106,767,170
| 0
| 1
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.xuanwu.msggate.common.cache.engine;
import com.xuanwu.msggate.common.sbi.entity.MsgContent.MsgType;
import com.xuanwu.msggate.common.util.DateUtil;
import org.apache.commons.codec.binary.Hex;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
/**
* @Description 信息帧表标记类,用于分表
* @author <a href="mailto:liushuaiying@139130.net">Shuaiying.Liu</a>
* @Data 2013-9-18
* @Version 1.0.0
*/
public class MsgFrameTag {
public static final int MAX_DAYS = 366;
private int dateByteLen = 4;
private int curIdx = 0;
private byte[] bitTags;
private Date scanBeginTime;
private Date prevAccessTime;
private MsgType msgType;
private SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
private SimpleDateFormat sdfMd = new SimpleDateFormat("MMdd");
private byte[] prevBitTags;
public MsgFrameTag(MsgType msgType, String frameTags, Date lastAccessTime) throws Exception {
this.msgType = msgType;
bitTags = Hex.decodeHex(frameTags.toCharArray());
prevBitTags = Arrays.copyOf(bitTags, bitTags.length);
byte[] dateBytes = new byte[dateByteLen];
System.arraycopy(bitTags, 0, dateBytes, 0, dateByteLen);
//first run
if(dateBytes[0] == 0 && dateBytes[1] == 0
&& dateBytes[2] == 0 && dateBytes[3] == 0){
this.prevAccessTime = lastAccessTime;
} else {
this.prevAccessTime = sdf.parse(Hex.encodeHexString(dateBytes));
}
updateLastAccessTime(lastAccessTime);
}
private void updateNotSkipDays(Date lastAccessTime){
int scanDays = getDays(lastAccessTime, prevAccessTime);
scanDays += 1;
int idx = this.curIdx;
setNotSkip(idx);
for(int i = 1; i < scanDays; i++){
idx = getPrevIdx(idx);
setNotSkip(idx);
}
}
public void updateLastAccessTime(Date lastAccessTime) throws Exception {
prevBitTags = Arrays.copyOf(bitTags, bitTags.length);//keep as previous bit tags
byte[] dateBytes = Hex.decodeHex(sdf.format(lastAccessTime).toCharArray());
System.arraycopy(dateBytes, 0, bitTags, 0, dateByteLen);
Calendar cal = Calendar.getInstance();
cal.setTime(lastAccessTime);
cal.set(Calendar.YEAR, 2012);
this.scanBeginTime = cal.getTime();
cal.set(2012, 0, 1);
Date firstDay = cal.getTime();
this.curIdx = getDays(scanBeginTime, firstDay);
updateNotSkipDays(lastAccessTime);
this.prevAccessTime = lastAccessTime;
}
public boolean isSkip(int idx){
int tagIdx = idx / 8 + dateByteLen;
int bitIdx = idx % 8;
return (bitTags[tagIdx] & (0x80 >> bitIdx)) == 0;
}
public void setSkip(int idx){
if(idx == curIdx)
return;
int tagIdx = idx / 8 + dateByteLen;
int bitIdx = idx % 8;
bitTags[tagIdx] = (byte)(bitTags[tagIdx] & ~(0x80 >> bitIdx));
}
public void setNotSkip(int idx){
int tagIdx = idx / 8 + dateByteLen;
int bitIdx = idx % 8;
bitTags[tagIdx] = (byte)(bitTags[tagIdx] | (0x80 >> bitIdx));
}
public int getPrevIdx(int curIdx){
int idx = curIdx - 1;
if(idx < 0){
idx = MAX_DAYS + idx;
}
return idx;
}
private int getDays(Date from, Date to){
Calendar cal = Calendar.getInstance();
cal.setTime(from);
cal.set(Calendar.YEAR, 2012);
Date _from = cal.getTime();
cal.setTime(to);
cal.set(Calendar.YEAR, 2012);
Date _to = cal.getTime();
return (int)(DateUtil.fixTime(_from.getTime()) / DateUtil.MILLIS_PER_DAY
- DateUtil.fixTime(_to.getTime()) / DateUtil.MILLIS_PER_DAY);
}
public int getCurIdx() {
return curIdx;
}
public Date getScanBeginDate() {
return scanBeginTime;
}
public boolean isChanged() {
return !Arrays.equals(prevBitTags, bitTags);
}
public String forLog(){
StringBuilder sb = new StringBuilder();
sb.append(msgType).append(": ");
Calendar cal = Calendar.getInstance();
cal.set(2012, 0, 1);
for(int i = 0; i < MAX_DAYS; i++){
if(isSkip(i)){
cal.add(Calendar.DAY_OF_MONTH, 1);
continue;
}
sb.append(sdfMd.format(cal.getTime())).append(",");
cal.add(Calendar.DAY_OF_MONTH, 1);
}
return sb.toString();
}
public String serialize(){
return Hex.encodeHexString(bitTags);
}
}
|
UTF-8
|
Java
| 4,076
|
java
|
MsgFrameTag.java
|
Java
|
[
{
"context": "scription 信息帧表标记类,用于分表\n * @author <a href=\"mailto:liushuaiying@139130.net\">Shuaiying.Liu</a>\n * @Data 2013-9-18\n * @Version",
"end": 401,
"score": 0.9998985528945923,
"start": 378,
"tag": "EMAIL",
"value": "liushuaiying@139130.net"
},
{
"context": " @author <a href=\"mailto:liushuaiying@139130.net\">Shuaiying.Liu</a>\n * @Data 2013-9-18\n * @Version 1.0.0\n */\npubl",
"end": 416,
"score": 0.9997949004173279,
"start": 403,
"tag": "NAME",
"value": "Shuaiying.Liu"
}
] | null |
[] |
package com.xuanwu.msggate.common.cache.engine;
import com.xuanwu.msggate.common.sbi.entity.MsgContent.MsgType;
import com.xuanwu.msggate.common.util.DateUtil;
import org.apache.commons.codec.binary.Hex;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
/**
* @Description 信息帧表标记类,用于分表
* @author <a href="mailto:<EMAIL>">Shuaiying.Liu</a>
* @Data 2013-9-18
* @Version 1.0.0
*/
public class MsgFrameTag {
public static final int MAX_DAYS = 366;
private int dateByteLen = 4;
private int curIdx = 0;
private byte[] bitTags;
private Date scanBeginTime;
private Date prevAccessTime;
private MsgType msgType;
private SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
private SimpleDateFormat sdfMd = new SimpleDateFormat("MMdd");
private byte[] prevBitTags;
public MsgFrameTag(MsgType msgType, String frameTags, Date lastAccessTime) throws Exception {
this.msgType = msgType;
bitTags = Hex.decodeHex(frameTags.toCharArray());
prevBitTags = Arrays.copyOf(bitTags, bitTags.length);
byte[] dateBytes = new byte[dateByteLen];
System.arraycopy(bitTags, 0, dateBytes, 0, dateByteLen);
//first run
if(dateBytes[0] == 0 && dateBytes[1] == 0
&& dateBytes[2] == 0 && dateBytes[3] == 0){
this.prevAccessTime = lastAccessTime;
} else {
this.prevAccessTime = sdf.parse(Hex.encodeHexString(dateBytes));
}
updateLastAccessTime(lastAccessTime);
}
private void updateNotSkipDays(Date lastAccessTime){
int scanDays = getDays(lastAccessTime, prevAccessTime);
scanDays += 1;
int idx = this.curIdx;
setNotSkip(idx);
for(int i = 1; i < scanDays; i++){
idx = getPrevIdx(idx);
setNotSkip(idx);
}
}
public void updateLastAccessTime(Date lastAccessTime) throws Exception {
prevBitTags = Arrays.copyOf(bitTags, bitTags.length);//keep as previous bit tags
byte[] dateBytes = Hex.decodeHex(sdf.format(lastAccessTime).toCharArray());
System.arraycopy(dateBytes, 0, bitTags, 0, dateByteLen);
Calendar cal = Calendar.getInstance();
cal.setTime(lastAccessTime);
cal.set(Calendar.YEAR, 2012);
this.scanBeginTime = cal.getTime();
cal.set(2012, 0, 1);
Date firstDay = cal.getTime();
this.curIdx = getDays(scanBeginTime, firstDay);
updateNotSkipDays(lastAccessTime);
this.prevAccessTime = lastAccessTime;
}
public boolean isSkip(int idx){
int tagIdx = idx / 8 + dateByteLen;
int bitIdx = idx % 8;
return (bitTags[tagIdx] & (0x80 >> bitIdx)) == 0;
}
public void setSkip(int idx){
if(idx == curIdx)
return;
int tagIdx = idx / 8 + dateByteLen;
int bitIdx = idx % 8;
bitTags[tagIdx] = (byte)(bitTags[tagIdx] & ~(0x80 >> bitIdx));
}
public void setNotSkip(int idx){
int tagIdx = idx / 8 + dateByteLen;
int bitIdx = idx % 8;
bitTags[tagIdx] = (byte)(bitTags[tagIdx] | (0x80 >> bitIdx));
}
public int getPrevIdx(int curIdx){
int idx = curIdx - 1;
if(idx < 0){
idx = MAX_DAYS + idx;
}
return idx;
}
private int getDays(Date from, Date to){
Calendar cal = Calendar.getInstance();
cal.setTime(from);
cal.set(Calendar.YEAR, 2012);
Date _from = cal.getTime();
cal.setTime(to);
cal.set(Calendar.YEAR, 2012);
Date _to = cal.getTime();
return (int)(DateUtil.fixTime(_from.getTime()) / DateUtil.MILLIS_PER_DAY
- DateUtil.fixTime(_to.getTime()) / DateUtil.MILLIS_PER_DAY);
}
public int getCurIdx() {
return curIdx;
}
public Date getScanBeginDate() {
return scanBeginTime;
}
public boolean isChanged() {
return !Arrays.equals(prevBitTags, bitTags);
}
public String forLog(){
StringBuilder sb = new StringBuilder();
sb.append(msgType).append(": ");
Calendar cal = Calendar.getInstance();
cal.set(2012, 0, 1);
for(int i = 0; i < MAX_DAYS; i++){
if(isSkip(i)){
cal.add(Calendar.DAY_OF_MONTH, 1);
continue;
}
sb.append(sdfMd.format(cal.getTime())).append(",");
cal.add(Calendar.DAY_OF_MONTH, 1);
}
return sb.toString();
}
public String serialize(){
return Hex.encodeHexString(bitTags);
}
}
| 4,060
| 0.693978
| 0.674235
| 146
| 26.753426
| 21.286873
| 94
| true
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 2.239726
| false
| false
|
2
|
08b712fed7598400bda4acf25f215ffee6ca4360
| 9,706,626,102,915
|
f0a5b3059cabc54e00fcd8626ccaf52d16d3939f
|
/src/com/company/lesson4/Breaks.java
|
50aeae9ab86b6f7c764828a4a3bf58639197cf50
|
[] |
no_license
|
sotik11/hillel
|
https://github.com/sotik11/hillel
|
ee086ff666ecf2b04c2a94a36b6c118a71d47111
|
030c8c8925ce64aa05a70538e554f0a7299ba185
|
refs/heads/main
| 2023-06-30T00:04:40.402000
| 2021-07-25T12:32:25
| 2021-07-25T12:32:25
| 379,238,176
| 0
| 0
| null | true
| 2021-06-22T11:01:52
| 2021-06-22T11:01:51
| 2021-06-22T10:54:52
| 2021-06-20T08:38:36
| 12
| 0
| 0
| 0
| null | false
| false
|
package com.company.lesson4;
public class Breaks {
public static void main(String[] args) {
test4();
}
static void test4() {
for (int i = 0; i < 10; i++) {
if (i == 8) {
continue;
}
System.out.println(i + 1);
}
System.out.println("Finish");
}
static void test() {
int i = 0;
while (true) {
i++;
System.out.println(i);
if (i == 10) {
return;
}
}
}
static void test1_1() {
for (int i = 0; i < 10; i++) {
System.out.println(i + 1);
}
}
static void test1() {
for (int i = 0; i < 10; i++) {
if (i == 8) {
return;
}
System.out.println(i + 1);
}
System.out.println("Finish");
}
static void test2() {
for (int i = 0; i < 10; i++) {
if (i == 8) {
break;
}
System.out.println(i + 1);
}
System.out.println("Finish");
}
static void test3() {
loop1: for (;;) {
while (true) {
break loop1;
}
}
}
}
|
UTF-8
|
Java
| 1,257
|
java
|
Breaks.java
|
Java
|
[] | null |
[] |
package com.company.lesson4;
public class Breaks {
public static void main(String[] args) {
test4();
}
static void test4() {
for (int i = 0; i < 10; i++) {
if (i == 8) {
continue;
}
System.out.println(i + 1);
}
System.out.println("Finish");
}
static void test() {
int i = 0;
while (true) {
i++;
System.out.println(i);
if (i == 10) {
return;
}
}
}
static void test1_1() {
for (int i = 0; i < 10; i++) {
System.out.println(i + 1);
}
}
static void test1() {
for (int i = 0; i < 10; i++) {
if (i == 8) {
return;
}
System.out.println(i + 1);
}
System.out.println("Finish");
}
static void test2() {
for (int i = 0; i < 10; i++) {
if (i == 8) {
break;
}
System.out.println(i + 1);
}
System.out.println("Finish");
}
static void test3() {
loop1: for (;;) {
while (true) {
break loop1;
}
}
}
}
| 1,257
| 0.360382
| 0.334924
| 64
| 18.640625
| 13.212645
| 44
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.421875
| false
| false
|
2
|
c08c8981297799bfa612b5b646b5cd5f998f3684
| 23,201,413,336,500
|
0f73e9b7ec95a533a1affada16904c4a87846f2c
|
/Gomoku/src/gomoku/Ustawienia.java
|
b37ddd130dc19f2c1046cfb016c9e59f56c2b1ff
|
[] |
no_license
|
Manoxz/JavaZadania
|
https://github.com/Manoxz/JavaZadania
|
ff05fd6ffde60463973be4a870f71906f01b89d5
|
8a0b4faa839bd63d9f64c221a018b0738034aebe
|
refs/heads/master
| 2022-03-15T11:29:38.929000
| 2013-06-05T12:49:25
| 2013-06-05T12:49:25
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package gomoku;
import java.awt.Color;
/**
*
* @author kayne
*/
class Ustawienia {
private boolean oznaczenie_pól = true;
private boolean skreślenie_pól = true;
private boolean gracz_zaczyna = false;
private boolean zablokowana_plansza = false;
private Color kolor_gracza = Color.red;
private Color kolor_komputera = Color.black;
private Color kolor_pól = Color.black;
private Color kolor_oznaczenia_pól = Color.black;
/**
* Zwraca wartość ustawienia dla Oznaczenia Pól.
* @return prawda lub fałsz
*/
public boolean isOznaczeniePól() {
return oznaczenie_pól;
}
/**
* Zwraca wartość ustawienia dla Skreślenie Pól.
* @return prawda lub fałsz
*/
public boolean isSkreśleniePól() {
return skreślenie_pól;
}
/**
* Zwraca wartość ustawienia dla kto zaczyna grę.
* @return prawda lub fałsz
*/
public boolean isGraczZaczyna() {
return gracz_zaczyna;
}
/**
* Sprawdza, czy plansza jest zablokowana.
* @return prawda jeśli zablokowana, fałsz jeśli zablokowana
*/
public boolean isZablokowanaPlansza() {
return zablokowana_plansza;
}
/**
* Zwraca wartość ustawienia dla koloru gracza.
* @return kolor dla JChooseColor
*/
public Color getKolorGracza() {
return kolor_gracza;
}
/**
* Zwraca wartość ustawienia dla koloru komputera.
* @return kolor dla JChooseColor
*/
public Color getKolorKomputera() {
return kolor_komputera;
}
/**
* Zwraca wartość ustawienia dla koloru pól.
* @return kolor dla JChooseColor
*/
public Color getKolorPól() {
return kolor_pól;
}
/**
* Zwraca wartość ustawienia dla koloru oznaczenia pól.
* @return kolor dla JChooserColor
*/
public Color getKolorOznaczeniaPól() {
return kolor_oznaczenia_pól;
}
/**
* Ustawia oznaczenie pól
* @param opcja prawda dla tak, fałsz dla nie
*/
public void setOznaczeniePól(boolean opcja) {
oznaczenie_pól = opcja;
}
/**
* Ustawia skreślenia pól
* @param opcja prawda dla tak, fałsz dla nie
*/
public void setSkreśleniePól(boolean opcja) {
skreślenie_pól = opcja;
}
/**
* Ustawia kto zaczyna grę
* @param opcja prawda dla gracz, fałsz dla komputera
*/
public void setGraczZaczyna(boolean opcja) {
gracz_zaczyna = opcja;
}
public void setZablokowanaPlansza(boolean opcja) {
zablokowana_plansza = opcja;
}
/**
* Ustawia kolor gracza
* @param kolor kolor z JChooseColor
*/
public void setKolorGracza(Color kolor) {
kolor_gracza = kolor;
}
/**
* Ustawia kolor komputera
* @param kolor kolor z JChooseColor
*/
public void setKolorKomputera(Color kolor) {
kolor_komputera = kolor;
}
/**
* Ustawia kolor pól
* @param kolor kolor z JChooseColor
*/
public void setKolorPól(Color kolor) {
kolor_pól = kolor;
}
/**
* Ustawia kolor oznaczenia pól.
* @param kolor kolor z JChooseColor
*/
public void setKolorOznaczeniaPól(Color kolor) {
kolor_oznaczenia_pól = kolor;
}
}
|
UTF-8
|
Java
| 3,511
|
java
|
Ustawienia.java
|
Java
|
[
{
"context": "gomoku;\n\nimport java.awt.Color;\n\n/**\n *\n * @author kayne\n */\nclass Ustawienia {\n\n private boolean oznac",
"end": 164,
"score": 0.9984655976295471,
"start": 159,
"tag": "USERNAME",
"value": "kayne"
}
] | null |
[] |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package gomoku;
import java.awt.Color;
/**
*
* @author kayne
*/
class Ustawienia {
private boolean oznaczenie_pól = true;
private boolean skreślenie_pól = true;
private boolean gracz_zaczyna = false;
private boolean zablokowana_plansza = false;
private Color kolor_gracza = Color.red;
private Color kolor_komputera = Color.black;
private Color kolor_pól = Color.black;
private Color kolor_oznaczenia_pól = Color.black;
/**
* Zwraca wartość ustawienia dla Oznaczenia Pól.
* @return prawda lub fałsz
*/
public boolean isOznaczeniePól() {
return oznaczenie_pól;
}
/**
* Zwraca wartość ustawienia dla Skreślenie Pól.
* @return prawda lub fałsz
*/
public boolean isSkreśleniePól() {
return skreślenie_pól;
}
/**
* Zwraca wartość ustawienia dla kto zaczyna grę.
* @return prawda lub fałsz
*/
public boolean isGraczZaczyna() {
return gracz_zaczyna;
}
/**
* Sprawdza, czy plansza jest zablokowana.
* @return prawda jeśli zablokowana, fałsz jeśli zablokowana
*/
public boolean isZablokowanaPlansza() {
return zablokowana_plansza;
}
/**
* Zwraca wartość ustawienia dla koloru gracza.
* @return kolor dla JChooseColor
*/
public Color getKolorGracza() {
return kolor_gracza;
}
/**
* Zwraca wartość ustawienia dla koloru komputera.
* @return kolor dla JChooseColor
*/
public Color getKolorKomputera() {
return kolor_komputera;
}
/**
* Zwraca wartość ustawienia dla koloru pól.
* @return kolor dla JChooseColor
*/
public Color getKolorPól() {
return kolor_pól;
}
/**
* Zwraca wartość ustawienia dla koloru oznaczenia pól.
* @return kolor dla JChooserColor
*/
public Color getKolorOznaczeniaPól() {
return kolor_oznaczenia_pól;
}
/**
* Ustawia oznaczenie pól
* @param opcja prawda dla tak, fałsz dla nie
*/
public void setOznaczeniePól(boolean opcja) {
oznaczenie_pól = opcja;
}
/**
* Ustawia skreślenia pól
* @param opcja prawda dla tak, fałsz dla nie
*/
public void setSkreśleniePól(boolean opcja) {
skreślenie_pól = opcja;
}
/**
* Ustawia kto zaczyna grę
* @param opcja prawda dla gracz, fałsz dla komputera
*/
public void setGraczZaczyna(boolean opcja) {
gracz_zaczyna = opcja;
}
public void setZablokowanaPlansza(boolean opcja) {
zablokowana_plansza = opcja;
}
/**
* Ustawia kolor gracza
* @param kolor kolor z JChooseColor
*/
public void setKolorGracza(Color kolor) {
kolor_gracza = kolor;
}
/**
* Ustawia kolor komputera
* @param kolor kolor z JChooseColor
*/
public void setKolorKomputera(Color kolor) {
kolor_komputera = kolor;
}
/**
* Ustawia kolor pól
* @param kolor kolor z JChooseColor
*/
public void setKolorPól(Color kolor) {
kolor_pól = kolor;
}
/**
* Ustawia kolor oznaczenia pól.
* @param kolor kolor z JChooseColor
*/
public void setKolorOznaczeniaPól(Color kolor) {
kolor_oznaczenia_pól = kolor;
}
}
| 3,511
| 0.60794
| 0.60794
| 146
| 22.636986
| 18.464287
| 64
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.226027
| false
| false
|
2
|
d40cb9a65099fca62ccbbc550ae1dd8a2e648fdb
| 23,201,413,336,884
|
c0d288a00c4c9b2f4a783e57c8df9530d425b9f5
|
/src/main/java/net/canang/cca/core/model/impl/CaConsumerImpl.java
|
f72f108c22c7a3a269a73949f0415cc86767db81
|
[] |
no_license
|
rafizanbaharum/CCA
|
https://github.com/rafizanbaharum/CCA
|
9093965d0dd6221b8f64acf84f806ba2adaa49a2
|
31e7cbea77ed4ecabce098fa428b3c29045ba30a
|
refs/heads/master
| 2020-05-20T13:53:17.251000
| 2013-06-05T02:10:24
| 2013-06-05T02:10:24
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package net.canang.cca.core.model.impl;
import net.canang.cca.core.model.CaAccount;
import net.canang.cca.core.model.CaChequebook;
import net.canang.cca.core.model.CaConsumer;
import net.canang.cca.core.model.CaConsumerType;
import javax.persistence.*;
/**
* @author rafizan.baharum
* @since 5/24/13
*/
@Entity(name = "CaConsumer")
@Table(name = "CA_CONSUMER")
@Inheritance(strategy = InheritanceType.JOINED)
public class CaConsumerImpl implements CaConsumer {
@Id
@Column(name = "ID", nullable = false)
@GeneratedValue(generator = "SEQ_CA_CONSUMER")
@SequenceGenerator(name = "SEQ_CA_CONSUMER", sequenceName = "SEQ_CA_CONSUMER", allocationSize = 1)
private Long id;
@Column(name = "CODE")
private String code;
@Column(name = "NAME")
private String name;
@Column(name = "DESCRIPTION")
private String description;
@Column(name = "ALIAS")
private String alias;
@Column(name = "PHONE1")
private String phone1;
@Column(name = "PHONE2")
private String phone2;
@Column(name = "EMAIL1")
private String email1;
@Column(name = "EMAIL2")
private String email2;
@Column(name = "ADDRESS1")
private String address1;
@Column(name = "ADDRESS2")
private String address2;
@Column(name = "ADDRESS3")
private String address3;
@Column(name = "CONSUMER_TYPE")
private CaConsumerType consumerType;
// @ManyToOne(targetEntity = CaChequebookImpl.class, fetch = FetchType.LAZY)
// @JoinColumn(name = "CHEQUEBOOK_ID")
// private CaChequebook chequebook;
// @ManyToOne(targetEntity = CaAccountImpl.class, fetch = FetchType.LAZY)
// @JoinColumn(name = "INVENTORY_ACCOUNT_ID")
// private CaAccount inventoryAccount;
// @ManyToOne(targetEntity = CaAccountImpl.class, fetch = FetchType.LAZY)
// @JoinColumn(name = "RECEIVABLE_ACCOUNT_ID")
// private CaAccount receivableAccount;
// @ManyToOne(targetEntity = CaAccountImpl.class, fetch = FetchType.LAZY)
// @JoinColumn(name = "SALES_ACCOUNT_ID")
// private CaAccount salesAccount;
// @ManyToOne(targetEntity = CaAccountImpl.class, fetch = FetchType.LAZY)
// @JoinColumn(name = "CASH_ACCOUNT_ID")
// private CaAccount cashAccount;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone1() {
return phone1;
}
public void setPhone1(String phone1) {
this.phone1 = phone1;
}
public String getPhone2() {
return phone2;
}
public void setPhone2(String phone2) {
this.phone2 = phone2;
}
public String getEmail1() {
return email1;
}
public void setEmail1(String email1) {
this.email1 = email1;
}
public String getEmail2() {
return email2;
}
public void setEmail2(String email2) {
this.email2 = email2;
}
public String getAddress1() {
return address1;
}
public void setAddress1(String address1) {
this.address1 = address1;
}
public String getAddress2() {
return address2;
}
public void setAddress2(String address2) {
this.address2 = address2;
}
public String getAddress3() {
return address3;
}
public void setAddress3(String address3) {
this.address3 = address3;
}
public CaConsumerType getConsumerType() {
return consumerType;
}
public void setConsumerType(CaConsumerType consumerType) {
this.consumerType = consumerType;
}
// public CaChequebook getChequebook() {
// return chequebook;
// }
//
// public void setChequebook(CaChequebook chequebook) {
// this.chequebook = chequebook;
// }
//
// public CaAccount getInventoryAccount() {
// return inventoryAccount;
// }
//
// public void setInventoryAccount(CaAccount inventoryAccount) {
// this.inventoryAccount = inventoryAccount;
// }
//
// public CaAccount getReceivableAccount() {
// return receivableAccount;
// }
//
// public void setReceivableAccount(CaAccount receivableAccount) {
// this.receivableAccount = receivableAccount;
// }
//
// public CaAccount getSalesAccount() {
// return salesAccount;
// }
//
// public void setSalesAccount(CaAccount salesAccount) {
// this.salesAccount = salesAccount;
// }
//
// public CaAccount getCashAccount() {
// return cashAccount;
// }
//
// public void setCashAccount(CaAccount cashAccount) {
// this.cashAccount = cashAccount;
// }
}
|
UTF-8
|
Java
| 5,183
|
java
|
CaConsumerImpl.java
|
Java
|
[
{
"context": "Type;\n\nimport javax.persistence.*;\n\n/**\n * @author rafizan.baharum\n * @since 5/24/13\n */\n@Entity(name = \"CaConsumer\"",
"end": 286,
"score": 0.9986643195152283,
"start": 271,
"tag": "NAME",
"value": "rafizan.baharum"
}
] | null |
[] |
package net.canang.cca.core.model.impl;
import net.canang.cca.core.model.CaAccount;
import net.canang.cca.core.model.CaChequebook;
import net.canang.cca.core.model.CaConsumer;
import net.canang.cca.core.model.CaConsumerType;
import javax.persistence.*;
/**
* @author rafizan.baharum
* @since 5/24/13
*/
@Entity(name = "CaConsumer")
@Table(name = "CA_CONSUMER")
@Inheritance(strategy = InheritanceType.JOINED)
public class CaConsumerImpl implements CaConsumer {
@Id
@Column(name = "ID", nullable = false)
@GeneratedValue(generator = "SEQ_CA_CONSUMER")
@SequenceGenerator(name = "SEQ_CA_CONSUMER", sequenceName = "SEQ_CA_CONSUMER", allocationSize = 1)
private Long id;
@Column(name = "CODE")
private String code;
@Column(name = "NAME")
private String name;
@Column(name = "DESCRIPTION")
private String description;
@Column(name = "ALIAS")
private String alias;
@Column(name = "PHONE1")
private String phone1;
@Column(name = "PHONE2")
private String phone2;
@Column(name = "EMAIL1")
private String email1;
@Column(name = "EMAIL2")
private String email2;
@Column(name = "ADDRESS1")
private String address1;
@Column(name = "ADDRESS2")
private String address2;
@Column(name = "ADDRESS3")
private String address3;
@Column(name = "CONSUMER_TYPE")
private CaConsumerType consumerType;
// @ManyToOne(targetEntity = CaChequebookImpl.class, fetch = FetchType.LAZY)
// @JoinColumn(name = "CHEQUEBOOK_ID")
// private CaChequebook chequebook;
// @ManyToOne(targetEntity = CaAccountImpl.class, fetch = FetchType.LAZY)
// @JoinColumn(name = "INVENTORY_ACCOUNT_ID")
// private CaAccount inventoryAccount;
// @ManyToOne(targetEntity = CaAccountImpl.class, fetch = FetchType.LAZY)
// @JoinColumn(name = "RECEIVABLE_ACCOUNT_ID")
// private CaAccount receivableAccount;
// @ManyToOne(targetEntity = CaAccountImpl.class, fetch = FetchType.LAZY)
// @JoinColumn(name = "SALES_ACCOUNT_ID")
// private CaAccount salesAccount;
// @ManyToOne(targetEntity = CaAccountImpl.class, fetch = FetchType.LAZY)
// @JoinColumn(name = "CASH_ACCOUNT_ID")
// private CaAccount cashAccount;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone1() {
return phone1;
}
public void setPhone1(String phone1) {
this.phone1 = phone1;
}
public String getPhone2() {
return phone2;
}
public void setPhone2(String phone2) {
this.phone2 = phone2;
}
public String getEmail1() {
return email1;
}
public void setEmail1(String email1) {
this.email1 = email1;
}
public String getEmail2() {
return email2;
}
public void setEmail2(String email2) {
this.email2 = email2;
}
public String getAddress1() {
return address1;
}
public void setAddress1(String address1) {
this.address1 = address1;
}
public String getAddress2() {
return address2;
}
public void setAddress2(String address2) {
this.address2 = address2;
}
public String getAddress3() {
return address3;
}
public void setAddress3(String address3) {
this.address3 = address3;
}
public CaConsumerType getConsumerType() {
return consumerType;
}
public void setConsumerType(CaConsumerType consumerType) {
this.consumerType = consumerType;
}
// public CaChequebook getChequebook() {
// return chequebook;
// }
//
// public void setChequebook(CaChequebook chequebook) {
// this.chequebook = chequebook;
// }
//
// public CaAccount getInventoryAccount() {
// return inventoryAccount;
// }
//
// public void setInventoryAccount(CaAccount inventoryAccount) {
// this.inventoryAccount = inventoryAccount;
// }
//
// public CaAccount getReceivableAccount() {
// return receivableAccount;
// }
//
// public void setReceivableAccount(CaAccount receivableAccount) {
// this.receivableAccount = receivableAccount;
// }
//
// public CaAccount getSalesAccount() {
// return salesAccount;
// }
//
// public void setSalesAccount(CaAccount salesAccount) {
// this.salesAccount = salesAccount;
// }
//
// public CaAccount getCashAccount() {
// return cashAccount;
// }
//
// public void setCashAccount(CaAccount cashAccount) {
// this.cashAccount = cashAccount;
// }
}
| 5,183
| 0.636311
| 0.624349
| 226
| 21.933628
| 20.449377
| 102
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.300885
| false
| false
|
2
|
b27fc1b03bfcd8cd214f767ed552290005c59ecb
| 13,211,319,443,995
|
2c26ebd51d37b86bbf18aa2098be1a6781dffb87
|
/src/main/java/info/masterfrog/pixelcat/engine/logic/gameobject/element/feature/FeatureImpl.java
|
f0a9b207cdf890752a39147019c46b7ee89f111f
|
[] |
no_license
|
rpmurray/pixelcat-engine
|
https://github.com/rpmurray/pixelcat-engine
|
c10288d799b5dd17d0cd66d766ac7e40081da9d9
|
b24aa57bb20f8b1aab7197c68243def6ae95f3d0
|
refs/heads/master
| 2020-05-30T03:46:35.618000
| 2016-11-19T21:18:34
| 2016-11-19T21:18:34
| 27,014,241
| 0
| 0
| null | false
| 2016-10-07T21:33:32
| 2014-11-22T22:11:58
| 2016-06-28T17:02:02
| 2016-10-07T21:33:31
| 11,969
| 1
| 0
| 10
|
Java
| null | null |
package info.masterfrog.pixelcat.engine.logic.gameobject.element.feature;
abstract public class FeatureImpl implements Feature {
}
|
UTF-8
|
Java
| 132
|
java
|
FeatureImpl.java
|
Java
|
[] | null |
[] |
package info.masterfrog.pixelcat.engine.logic.gameobject.element.feature;
abstract public class FeatureImpl implements Feature {
}
| 132
| 0.840909
| 0.840909
| 4
| 32
| 32.210247
| 73
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.25
| false
| false
|
2
|
eb7e3e53332e8717ccfdb21887c98c7c95bd1d4c
| 13,898,514,217,134
|
a119b99ea02c7e218d06bd893faae086abac00a0
|
/src/main/java/com/xhtutor/tutor/dao/TutorGradeMapper.java
|
2251a3412a43e6d4c2f4143d87996626a9299c5a
|
[] |
no_license
|
sinocyc/xiaohejj
|
https://github.com/sinocyc/xiaohejj
|
66e15767c96fb7b15d99b2dbc42d2c540e9b43ef
|
fbc4f374d72d8136948b63324416d7835a20d674
|
refs/heads/master
| 2021-01-24T08:30:20
| 2018-03-21T16:02:00
| 2018-03-21T16:02:00
| 122,980,502
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.xhtutor.tutor.dao;
import com.xhtutor.tutor.bean.TutorGradeExample;
import com.xhtutor.tutor.bean.TutorGradeKey;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface TutorGradeMapper {
long countByExample(TutorGradeExample example);
int deleteByExample(TutorGradeExample example);
int deleteByPrimaryKey(TutorGradeKey key);
int insert(TutorGradeKey record);
int insertSelective(TutorGradeKey record);
List<TutorGradeKey> selectByExample(TutorGradeExample example);
int updateByExampleSelective(@Param("record") TutorGradeKey record, @Param("example") TutorGradeExample example);
int updateByExample(@Param("record") TutorGradeKey record, @Param("example") TutorGradeExample example);
}
|
UTF-8
|
Java
| 769
|
java
|
TutorGradeMapper.java
|
Java
|
[] | null |
[] |
package com.xhtutor.tutor.dao;
import com.xhtutor.tutor.bean.TutorGradeExample;
import com.xhtutor.tutor.bean.TutorGradeKey;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface TutorGradeMapper {
long countByExample(TutorGradeExample example);
int deleteByExample(TutorGradeExample example);
int deleteByPrimaryKey(TutorGradeKey key);
int insert(TutorGradeKey record);
int insertSelective(TutorGradeKey record);
List<TutorGradeKey> selectByExample(TutorGradeExample example);
int updateByExampleSelective(@Param("record") TutorGradeKey record, @Param("example") TutorGradeExample example);
int updateByExample(@Param("record") TutorGradeKey record, @Param("example") TutorGradeExample example);
}
| 769
| 0.793238
| 0.793238
| 24
| 31.083334
| 33.01252
| 117
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.625
| false
| false
|
2
|
2b2fa6740e5c35144d33643457905500b0f1f95e
| 3,401,614,131,862
|
e4d39846f670544299d0d1929063ec2a2aca09b5
|
/src/main/java/pxb/android/arsc/ConfigDetail.java
|
70da44aaf9bf6f054dd0e60f8c417a3e3d4ccf50
|
[
"Apache-2.0"
] |
permissive
|
iCodeIN/axml
|
https://github.com/iCodeIN/axml
|
da3234e62f6c50b63f26db05f4da41c839d46061
|
46e5e7f356d9792606d9691a73bfad70094b4f0b
|
refs/heads/master
| 2023-08-26T01:07:37.289000
| 2021-10-29T14:42:56
| 2021-10-29T14:42:56
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package pxb.android.arsc;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class ConfigDetail {
public final static byte SDK_BASE = 1;
public final static byte SDK_BASE_1_1 = 2;
public final static byte SDK_CUPCAKE = 3;
public final static byte SDK_DONUT = 4;
public final static byte SDK_ECLAIR = 5;
public final static byte SDK_ECLAIR_0_1 = 6;
public final static byte SDK_ECLAIR_MR1 = 7;
public final static byte SDK_FROYO = 8;
public final static byte SDK_GINGERBREAD = 9;
public final static byte SDK_GINGERBREAD_MR1 = 10;
public final static byte SDK_HONEYCOMB = 11;
public final static byte SDK_HONEYCOMB_MR1 = 12;
public final static byte SDK_HONEYCOMB_MR2 = 13;
public final static byte SDK_ICE_CREAM_SANDWICH = 14;
public final static byte SDK_ICE_CREAM_SANDWICH_MR1 = 15;
public final static byte SDK_JELLY_BEAN = 16;
public final static byte SDK_JELLY_BEAN_MR1 = 17;
public final static byte SDK_JELLY_BEAN_MR2 = 18;
public final static byte SDK_KITKAT = 19;
public final static byte SDK_LOLLIPOP = 21;
public int mcc;
public int mnc;
public String language;
public String country;
public ORIENTATION orientation;
public TOUCHSCREEN touchscreen;
public DENSITY density;
public KEYBOARD keyboard;
public NAVIGATION navigation;
public int screenWidth; // 0 for any
public int screenHeight; // 0 for any
public int sdkVersion;
public SCREENSIZE screensize;
public SCREENLONG screenlong;
public LAYOUTDIR layoutdir;
public UI_MODE_TYPE uiModeType;
public UI_MODE_NIGHT uiModeNight;
public int smallestScreenWidthDp;
public int screenWidthDp;
public int screenHeightDp;
public byte[] extra;
public KEYSHIDDEN keyshidden;
public NAVHIDDEN navhidden;
public ConfigDetail(byte[] data) {
init(ByteBuffer.wrap(data).order(ByteOrder.LITTLE_ENDIAN));
}
public ConfigDetail() {
language = "any";
country = "any";
orientation = ORIENTATION.ANY;
touchscreen = TOUCHSCREEN.ANY;
density = DENSITY.DEFAULT;
keyboard = KEYBOARD.ANY;
navigation = NAVIGATION.ANY;
keyshidden = KEYSHIDDEN.ANY;
navhidden = NAVHIDDEN.ANY;
screensize = SCREENSIZE.ANY;
screenlong = SCREENLONG.ANY;
layoutdir = LAYOUTDIR.ANY;
uiModeType = UI_MODE_TYPE.ANY;
uiModeNight = UI_MODE_NIGHT.ANY;
}
public byte[] toId() {
int size = 36; //default size;
if (extra != null) {
size += extra.length;
}
ByteBuffer out = ByteBuffer.allocate(size).order(ByteOrder.LITTLE_ENDIAN);
out.putInt(size).putShort((short) mcc).putShort((short) mnc);
if (this.language.equals("any")) {
out.put((byte) 0).put((byte) 0);
} else {
out.put((byte) this.language.charAt(0)).put((byte) this.language.charAt(1));
}
if (this.country.equals("any")) {
out.put((byte) 0).put((byte) 0);
} else {
out.put((byte) this.country.charAt(0)).put((byte) this.country.charAt(1));
}
out.put((byte) orientation.ordinal()).put((byte) touchscreen.ordinal()).putShort((short) density.value);
out.put((byte) keyboard.ordinal()).put((byte) navigation.ordinal())
.put((byte) (keyshidden.ordinal() & (navhidden.ordinal() << 2))).put((byte) 0);
out.putShort((short) screenWidth).putShort((short) screenHeight);
out.putShort((short) sdkVersion).putShort((short) 0);
out.put((byte) (screensize.ordinal() & (screenlong.ordinal() << 4) & (layoutdir.ordinal() << 6)));
out.put((byte) (uiModeType.ordinal() & (uiModeNight.ordinal() << 4)));
out.putShort((short) smallestScreenWidthDp);
out.putShort((short) screenWidthDp).putShort((short) screenHeightDp);
if (extra != null) {
out.put(extra);
}
return out.array();
}
public String toString() {
StringBuilder ret = new StringBuilder();
if (mcc != 0) {
ret.append("-mcc").append(String.format("%03d", mcc));
}
if (mnc != 0) {
ret.append("-mnc");
if (mnc > 0 && mnc < 10) {
ret.append(String.format("%02d", mnc));
} else {
ret.append(String.format("%03d", mnc));
}
}
if (!language.equals("any")) {
ret.append('-').append(language);
}
if (!country.equals("any")) {
ret.append("-r").append(country);
}
switch (layoutdir) {
case RTL:
ret.append("-ldrtl");
break;
case LTR:
ret.append("-ldltr");
break;
}
if (smallestScreenWidthDp != 0) {
ret.append("-sw").append(smallestScreenWidthDp).append("dp");
}
if (screenWidthDp != 0) {
ret.append("-w").append(screenWidthDp).append("dp");
}
if (screenHeightDp != 0) {
ret.append("-h").append(screenHeightDp).append("dp");
}
switch (screensize) {
case SMALL:
ret.append("-small");
break;
case NORMAL:
ret.append("-normal");
break;
case LARGE:
ret.append("-large");
break;
case XLARGE:
ret.append("-xlarge");
break;
}
switch (screenlong) {
case YES:
ret.append("-long");
break;
case NO:
ret.append("-notlong");
break;
}
switch (orientation) {
case PORT:
ret.append("-port");
break;
case LAND:
ret.append("-land");
break;
case SQUARE:
ret.append("-square");
break;
}
switch (uiModeType) {
case CAR:
ret.append("-car");
break;
case DESK:
ret.append("-desk");
break;
case TELEVISION:
ret.append("-television");
break;
case SMALLUI:
ret.append("-smallui");
break;
case MEDIUMUI:
ret.append("-mediumui");
break;
case LARGEUI:
ret.append("-largeui");
break;
case HUGEUI:
ret.append("-hugeui");
break;
case APPLIANCE:
ret.append("-appliance");
break;
case WATCH:
ret.append("-watch");
break;
}
switch (uiModeNight) {
case YES:
ret.append("-night");
break;
case NO:
ret.append("-notnight");
break;
}
switch (density) {
case DEFAULT:
break;
case LOW:
ret.append("-ldpi");
break;
case MEDIUM:
ret.append("-mdpi");
break;
case HIGH:
ret.append("-hdpi");
break;
case TV:
ret.append("-tvdpi");
break;
case XHIGH:
ret.append("-xhdpi");
break;
case XXHIGH:
ret.append("-xxhdpi");
break;
case XXXHIGH:
ret.append("-xxxhdpi");
break;
case ANY:
ret.append("-anydpi");
break;
case NONE:
ret.append("-nodpi");
break;
default:
ret.append('-').append(density).append("dpi");
}
switch (touchscreen) {
case NOTOUCH:
ret.append("-notouch");
break;
case STYLUS:
ret.append("-stylus");
break;
case FINGER:
ret.append("-finger");
break;
}
switch (keyshidden) {
case NO:
ret.append("-keysexposed");
break;
case YES:
ret.append("-keyshidden");
break;
case SOFT:
ret.append("-keyssoft");
break;
}
switch (keyboard) {
case NOKEYS:
ret.append("-nokeys");
break;
case QWERTY:
ret.append("-qwerty");
break;
case _12KEY:
ret.append("-12key");
break;
}
switch (navhidden) {
case NO:
ret.append("-navexposed");
break;
case YES:
ret.append("-navhidden");
break;
}
switch (navigation) {
case NONAV:
ret.append("-nonav");
break;
case DPAD:
ret.append("-dpad");
break;
case TRACKBALL:
ret.append("-trackball");
break;
case WHEEL:
ret.append("-wheel");
break;
}
if (screenWidth != 0 && screenHeight != 0) {
if (screenWidth > screenHeight) {
ret.append(String.format("-%dx%d", screenWidth, screenHeight));
} else {
ret.append(String.format("-%dx%d", screenHeight, screenWidth));
}
}
if (sdkVersion > getNaturalSdkVersionRequirement()) {
ret.append("-v").append(sdkVersion);
}
return ret.toString();
}
private short getNaturalSdkVersionRequirement() {
if (density == DENSITY.ANY) {
return SDK_LOLLIPOP;
}
if (smallestScreenWidthDp != 0 || screenWidthDp != 0 || screenHeightDp != 0) {
return SDK_HONEYCOMB_MR2;
}
if (uiModeNight != UI_MODE_NIGHT.ANY || uiModeType != UI_MODE_TYPE.ANY) {
return SDK_FROYO;
}
if ((screensize != SCREENSIZE.ANY || screenlong != SCREENLONG.ANY) || density != DENSITY.DEFAULT) {
return SDK_DONUT;
}
return 0;
}
private void init(ByteBuffer in) {
int size = in.getInt();
if (size < 28) {
throw new RuntimeException();
}
mcc = 0xFFFF & in.getShort();
mnc = 0xFFFF & in.getShort();
char[] language = new char[]{(char) in.get(), (char) in.get()};
if (language[0] == 0 && language[1] == 0) {
this.language = "any";
} else {
this.language = new String(language);
}
char[] country = new char[]{(char) in.get(), (char) in.get()};
if (country[0] == 0 && country[1] == 0) {
this.country = "any";
} else {
this.country = new String(country);
}
orientation = ORIENTATION.values()[0xFF & in.get()];
touchscreen = TOUCHSCREEN.values()[0xFF & in.get()];
density = DENSITY.from(0xFFFF & in.getShort());
keyboard = KEYBOARD.values()[0xFF & in.get()];
navigation = NAVIGATION.values()[0xFF & in.get()];
byte inputFlags = in.get();
byte inputPad0 = in.get();
keyshidden = KEYSHIDDEN.values()[inputFlags & 0x0003];
navhidden = NAVHIDDEN.values()[(inputFlags >> 2) & 0x0003];
screenWidth = 0xFFFF & in.getShort();
screenHeight = 0xFFFF & in.getShort();
sdkVersion = 0xFFFF & in.getShort();
in.getShort(); //minorVersion
int screenLayout;
int uiMode;
screenLayout = 0xFF & in.get();
uiMode = 0xFF & in.get();
smallestScreenWidthDp = 0xFFFF & in.getShort();
screensize = SCREENSIZE.values()[screenLayout & 0x000f];
screenlong = SCREENLONG.values()[(screenLayout >> 4) & 0x0003];
layoutdir = LAYOUTDIR.values()[(screenLayout >> 6) & 0x000C];
uiModeType = UI_MODE_TYPE.values()[uiMode & 0x0F];
uiModeNight = UI_MODE_NIGHT.values()[(uiMode >> 4) & 0x03];
screenWidthDp = in.getShort();
screenHeightDp = in.getShort();
if (in.position() < size) {
extra = new byte[size - in.position()];
in.get(extra);
}
}
public enum ORIENTATION {
ANY, PORT, LAND, SQUARE;
}
public enum TOUCHSCREEN {
ANY, NOTOUCH, STYLUS, FINGER;
}
public enum DENSITY {
DEFAULT(0), LOW(120), MEDIUM(160), TV(213),
HIGH(240), XHIGH(320), XXHIGH(480), XXXHIGH(640), ANY(0xFFFe), NONE(0xFFFF);
int value;
DENSITY(int v) {
this.value = v;
}
static DENSITY from(int v) {
switch (v) {
case 0:
return DEFAULT;
case 120:
return LOW;
case 160:
return MEDIUM;
case 213:
return TV;
case 240:
return HIGH;
case 320:
return XHIGH;
case 480:
return XXHIGH;
case 640:
return XXXHIGH;
case 0xFFFe:
return ANY;
case 0xFFFF:
return NONE;
default:
throw new IllegalArgumentException();
}
}
}
public enum KEYBOARD {
ANY, NOKEYS, QWERTY, _12KEY;
}
public enum NAVIGATION {
ANY, NONAV, DPAD, TRACKBALL, WHEEL;
}
public enum KEYSHIDDEN {
ANY, NO, YES, SOFT;
}
public enum NAVHIDDEN {
ANY, NO, YES
}
public enum SCREENSIZE {
ANY, SMALL, NORMAL, LARGE, XLARGE;
}
public enum SCREENLONG {
ANY, NO, YES;
}
public enum LAYOUTDIR {
ANY, LTR, RTL;
}
public enum UI_MODE_TYPE {
ANY, NORMAL, DESK, CAR, TELEVISION, APPLIANCE, WATCH,
T07, T08, T09, T0a, T0b,
// miui
SMALLUI, MEDIUMUI, LARGEUI, HUGEUI
// end - miui
;
}
public enum UI_MODE_NIGHT {
ANY, NO, YES;
}
}
|
UTF-8
|
Java
| 14,605
|
java
|
ConfigDetail.java
|
Java
|
[] | null |
[] |
package pxb.android.arsc;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class ConfigDetail {
public final static byte SDK_BASE = 1;
public final static byte SDK_BASE_1_1 = 2;
public final static byte SDK_CUPCAKE = 3;
public final static byte SDK_DONUT = 4;
public final static byte SDK_ECLAIR = 5;
public final static byte SDK_ECLAIR_0_1 = 6;
public final static byte SDK_ECLAIR_MR1 = 7;
public final static byte SDK_FROYO = 8;
public final static byte SDK_GINGERBREAD = 9;
public final static byte SDK_GINGERBREAD_MR1 = 10;
public final static byte SDK_HONEYCOMB = 11;
public final static byte SDK_HONEYCOMB_MR1 = 12;
public final static byte SDK_HONEYCOMB_MR2 = 13;
public final static byte SDK_ICE_CREAM_SANDWICH = 14;
public final static byte SDK_ICE_CREAM_SANDWICH_MR1 = 15;
public final static byte SDK_JELLY_BEAN = 16;
public final static byte SDK_JELLY_BEAN_MR1 = 17;
public final static byte SDK_JELLY_BEAN_MR2 = 18;
public final static byte SDK_KITKAT = 19;
public final static byte SDK_LOLLIPOP = 21;
public int mcc;
public int mnc;
public String language;
public String country;
public ORIENTATION orientation;
public TOUCHSCREEN touchscreen;
public DENSITY density;
public KEYBOARD keyboard;
public NAVIGATION navigation;
public int screenWidth; // 0 for any
public int screenHeight; // 0 for any
public int sdkVersion;
public SCREENSIZE screensize;
public SCREENLONG screenlong;
public LAYOUTDIR layoutdir;
public UI_MODE_TYPE uiModeType;
public UI_MODE_NIGHT uiModeNight;
public int smallestScreenWidthDp;
public int screenWidthDp;
public int screenHeightDp;
public byte[] extra;
public KEYSHIDDEN keyshidden;
public NAVHIDDEN navhidden;
public ConfigDetail(byte[] data) {
init(ByteBuffer.wrap(data).order(ByteOrder.LITTLE_ENDIAN));
}
public ConfigDetail() {
language = "any";
country = "any";
orientation = ORIENTATION.ANY;
touchscreen = TOUCHSCREEN.ANY;
density = DENSITY.DEFAULT;
keyboard = KEYBOARD.ANY;
navigation = NAVIGATION.ANY;
keyshidden = KEYSHIDDEN.ANY;
navhidden = NAVHIDDEN.ANY;
screensize = SCREENSIZE.ANY;
screenlong = SCREENLONG.ANY;
layoutdir = LAYOUTDIR.ANY;
uiModeType = UI_MODE_TYPE.ANY;
uiModeNight = UI_MODE_NIGHT.ANY;
}
public byte[] toId() {
int size = 36; //default size;
if (extra != null) {
size += extra.length;
}
ByteBuffer out = ByteBuffer.allocate(size).order(ByteOrder.LITTLE_ENDIAN);
out.putInt(size).putShort((short) mcc).putShort((short) mnc);
if (this.language.equals("any")) {
out.put((byte) 0).put((byte) 0);
} else {
out.put((byte) this.language.charAt(0)).put((byte) this.language.charAt(1));
}
if (this.country.equals("any")) {
out.put((byte) 0).put((byte) 0);
} else {
out.put((byte) this.country.charAt(0)).put((byte) this.country.charAt(1));
}
out.put((byte) orientation.ordinal()).put((byte) touchscreen.ordinal()).putShort((short) density.value);
out.put((byte) keyboard.ordinal()).put((byte) navigation.ordinal())
.put((byte) (keyshidden.ordinal() & (navhidden.ordinal() << 2))).put((byte) 0);
out.putShort((short) screenWidth).putShort((short) screenHeight);
out.putShort((short) sdkVersion).putShort((short) 0);
out.put((byte) (screensize.ordinal() & (screenlong.ordinal() << 4) & (layoutdir.ordinal() << 6)));
out.put((byte) (uiModeType.ordinal() & (uiModeNight.ordinal() << 4)));
out.putShort((short) smallestScreenWidthDp);
out.putShort((short) screenWidthDp).putShort((short) screenHeightDp);
if (extra != null) {
out.put(extra);
}
return out.array();
}
public String toString() {
StringBuilder ret = new StringBuilder();
if (mcc != 0) {
ret.append("-mcc").append(String.format("%03d", mcc));
}
if (mnc != 0) {
ret.append("-mnc");
if (mnc > 0 && mnc < 10) {
ret.append(String.format("%02d", mnc));
} else {
ret.append(String.format("%03d", mnc));
}
}
if (!language.equals("any")) {
ret.append('-').append(language);
}
if (!country.equals("any")) {
ret.append("-r").append(country);
}
switch (layoutdir) {
case RTL:
ret.append("-ldrtl");
break;
case LTR:
ret.append("-ldltr");
break;
}
if (smallestScreenWidthDp != 0) {
ret.append("-sw").append(smallestScreenWidthDp).append("dp");
}
if (screenWidthDp != 0) {
ret.append("-w").append(screenWidthDp).append("dp");
}
if (screenHeightDp != 0) {
ret.append("-h").append(screenHeightDp).append("dp");
}
switch (screensize) {
case SMALL:
ret.append("-small");
break;
case NORMAL:
ret.append("-normal");
break;
case LARGE:
ret.append("-large");
break;
case XLARGE:
ret.append("-xlarge");
break;
}
switch (screenlong) {
case YES:
ret.append("-long");
break;
case NO:
ret.append("-notlong");
break;
}
switch (orientation) {
case PORT:
ret.append("-port");
break;
case LAND:
ret.append("-land");
break;
case SQUARE:
ret.append("-square");
break;
}
switch (uiModeType) {
case CAR:
ret.append("-car");
break;
case DESK:
ret.append("-desk");
break;
case TELEVISION:
ret.append("-television");
break;
case SMALLUI:
ret.append("-smallui");
break;
case MEDIUMUI:
ret.append("-mediumui");
break;
case LARGEUI:
ret.append("-largeui");
break;
case HUGEUI:
ret.append("-hugeui");
break;
case APPLIANCE:
ret.append("-appliance");
break;
case WATCH:
ret.append("-watch");
break;
}
switch (uiModeNight) {
case YES:
ret.append("-night");
break;
case NO:
ret.append("-notnight");
break;
}
switch (density) {
case DEFAULT:
break;
case LOW:
ret.append("-ldpi");
break;
case MEDIUM:
ret.append("-mdpi");
break;
case HIGH:
ret.append("-hdpi");
break;
case TV:
ret.append("-tvdpi");
break;
case XHIGH:
ret.append("-xhdpi");
break;
case XXHIGH:
ret.append("-xxhdpi");
break;
case XXXHIGH:
ret.append("-xxxhdpi");
break;
case ANY:
ret.append("-anydpi");
break;
case NONE:
ret.append("-nodpi");
break;
default:
ret.append('-').append(density).append("dpi");
}
switch (touchscreen) {
case NOTOUCH:
ret.append("-notouch");
break;
case STYLUS:
ret.append("-stylus");
break;
case FINGER:
ret.append("-finger");
break;
}
switch (keyshidden) {
case NO:
ret.append("-keysexposed");
break;
case YES:
ret.append("-keyshidden");
break;
case SOFT:
ret.append("-keyssoft");
break;
}
switch (keyboard) {
case NOKEYS:
ret.append("-nokeys");
break;
case QWERTY:
ret.append("-qwerty");
break;
case _12KEY:
ret.append("-12key");
break;
}
switch (navhidden) {
case NO:
ret.append("-navexposed");
break;
case YES:
ret.append("-navhidden");
break;
}
switch (navigation) {
case NONAV:
ret.append("-nonav");
break;
case DPAD:
ret.append("-dpad");
break;
case TRACKBALL:
ret.append("-trackball");
break;
case WHEEL:
ret.append("-wheel");
break;
}
if (screenWidth != 0 && screenHeight != 0) {
if (screenWidth > screenHeight) {
ret.append(String.format("-%dx%d", screenWidth, screenHeight));
} else {
ret.append(String.format("-%dx%d", screenHeight, screenWidth));
}
}
if (sdkVersion > getNaturalSdkVersionRequirement()) {
ret.append("-v").append(sdkVersion);
}
return ret.toString();
}
private short getNaturalSdkVersionRequirement() {
if (density == DENSITY.ANY) {
return SDK_LOLLIPOP;
}
if (smallestScreenWidthDp != 0 || screenWidthDp != 0 || screenHeightDp != 0) {
return SDK_HONEYCOMB_MR2;
}
if (uiModeNight != UI_MODE_NIGHT.ANY || uiModeType != UI_MODE_TYPE.ANY) {
return SDK_FROYO;
}
if ((screensize != SCREENSIZE.ANY || screenlong != SCREENLONG.ANY) || density != DENSITY.DEFAULT) {
return SDK_DONUT;
}
return 0;
}
private void init(ByteBuffer in) {
int size = in.getInt();
if (size < 28) {
throw new RuntimeException();
}
mcc = 0xFFFF & in.getShort();
mnc = 0xFFFF & in.getShort();
char[] language = new char[]{(char) in.get(), (char) in.get()};
if (language[0] == 0 && language[1] == 0) {
this.language = "any";
} else {
this.language = new String(language);
}
char[] country = new char[]{(char) in.get(), (char) in.get()};
if (country[0] == 0 && country[1] == 0) {
this.country = "any";
} else {
this.country = new String(country);
}
orientation = ORIENTATION.values()[0xFF & in.get()];
touchscreen = TOUCHSCREEN.values()[0xFF & in.get()];
density = DENSITY.from(0xFFFF & in.getShort());
keyboard = KEYBOARD.values()[0xFF & in.get()];
navigation = NAVIGATION.values()[0xFF & in.get()];
byte inputFlags = in.get();
byte inputPad0 = in.get();
keyshidden = KEYSHIDDEN.values()[inputFlags & 0x0003];
navhidden = NAVHIDDEN.values()[(inputFlags >> 2) & 0x0003];
screenWidth = 0xFFFF & in.getShort();
screenHeight = 0xFFFF & in.getShort();
sdkVersion = 0xFFFF & in.getShort();
in.getShort(); //minorVersion
int screenLayout;
int uiMode;
screenLayout = 0xFF & in.get();
uiMode = 0xFF & in.get();
smallestScreenWidthDp = 0xFFFF & in.getShort();
screensize = SCREENSIZE.values()[screenLayout & 0x000f];
screenlong = SCREENLONG.values()[(screenLayout >> 4) & 0x0003];
layoutdir = LAYOUTDIR.values()[(screenLayout >> 6) & 0x000C];
uiModeType = UI_MODE_TYPE.values()[uiMode & 0x0F];
uiModeNight = UI_MODE_NIGHT.values()[(uiMode >> 4) & 0x03];
screenWidthDp = in.getShort();
screenHeightDp = in.getShort();
if (in.position() < size) {
extra = new byte[size - in.position()];
in.get(extra);
}
}
public enum ORIENTATION {
ANY, PORT, LAND, SQUARE;
}
public enum TOUCHSCREEN {
ANY, NOTOUCH, STYLUS, FINGER;
}
public enum DENSITY {
DEFAULT(0), LOW(120), MEDIUM(160), TV(213),
HIGH(240), XHIGH(320), XXHIGH(480), XXXHIGH(640), ANY(0xFFFe), NONE(0xFFFF);
int value;
DENSITY(int v) {
this.value = v;
}
static DENSITY from(int v) {
switch (v) {
case 0:
return DEFAULT;
case 120:
return LOW;
case 160:
return MEDIUM;
case 213:
return TV;
case 240:
return HIGH;
case 320:
return XHIGH;
case 480:
return XXHIGH;
case 640:
return XXXHIGH;
case 0xFFFe:
return ANY;
case 0xFFFF:
return NONE;
default:
throw new IllegalArgumentException();
}
}
}
public enum KEYBOARD {
ANY, NOKEYS, QWERTY, _12KEY;
}
public enum NAVIGATION {
ANY, NONAV, DPAD, TRACKBALL, WHEEL;
}
public enum KEYSHIDDEN {
ANY, NO, YES, SOFT;
}
public enum NAVHIDDEN {
ANY, NO, YES
}
public enum SCREENSIZE {
ANY, SMALL, NORMAL, LARGE, XLARGE;
}
public enum SCREENLONG {
ANY, NO, YES;
}
public enum LAYOUTDIR {
ANY, LTR, RTL;
}
public enum UI_MODE_TYPE {
ANY, NORMAL, DESK, CAR, TELEVISION, APPLIANCE, WATCH,
T07, T08, T09, T0a, T0b,
// miui
SMALLUI, MEDIUMUI, LARGEUI, HUGEUI
// end - miui
;
}
public enum UI_MODE_NIGHT {
ANY, NO, YES;
}
}
| 14,605
| 0.486135
| 0.472509
| 478
| 29.554394
| 19.219177
| 112
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.679916
| false
| false
|
2
|
6786715083ef5939e11285040dd50b160b6d065c
| 33,260,226,775,070
|
64807dfa5e2cd728fec1136f12263659addda60e
|
/src/main/java/io/miret/etienne/hourglass/controllers/Events.java
|
09da90994cfa79ffa9a0db012b14db3b9fc32d30
|
[
"MIT"
] |
permissive
|
EtienneMiret/hourglass
|
https://github.com/EtienneMiret/hourglass
|
980e3e0b4a0674b7bfc00f08a20cc1d67b8e05c7
|
5db819aae67f016af57cdf7cbf6098e25c1760c9
|
refs/heads/master
| 2022-07-16T19:36:03.515000
| 2022-06-27T06:18:52
| 2022-06-27T06:18:52
| 210,938,302
| 0
| 0
|
MIT
| false
| 2022-06-27T06:18:53
| 2019-09-25T20:50:58
| 2022-06-25T08:28:03
| 2022-06-27T06:18:52
| 648
| 0
| 0
| 0
|
TypeScript
| false
| false
|
package io.miret.etienne.hourglass.controllers;
import com.google.common.collect.Sets;
import io.miret.etienne.hourglass.data.auth.AuthenticatedUser;
import io.miret.etienne.hourglass.data.core.BaseAction;
import io.miret.etienne.hourglass.data.core.Event;
import io.miret.etienne.hourglass.data.core.ScaleRule;
import io.miret.etienne.hourglass.data.mongo.EventAction;
import io.miret.etienne.hourglass.data.mongo.EventCreation;
import io.miret.etienne.hourglass.data.mongo.EventEdition;
import io.miret.etienne.hourglass.data.mongo.ScaleRuleAction;
import io.miret.etienne.hourglass.data.rest.Form;
import io.miret.etienne.hourglass.repositories.EventActionRepository;
import io.miret.etienne.hourglass.repositories.ScaleRuleActionRepository;
import io.miret.etienne.hourglass.services.ActionComposer;
import lombok.AllArgsConstructor;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
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.RestController;
import org.springframework.web.server.ResponseStatusException;
import java.time.Clock;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import static java.util.stream.Collectors.collectingAndThen;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.toSet;
import static lombok.AccessLevel.PRIVATE;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
import static org.springframework.http.HttpStatus.NOT_FOUND;
@RestController
@RequestMapping ("/events")
@AllArgsConstructor (access = PRIVATE)
public class Events {
private final Clock clock;
private final EventActionRepository repository;
private final ScaleRuleActionRepository scaleRuleActionRepository;
private final ActionComposer composer;
@GetMapping
public Set<Event> find (@RequestParam (required = false) UUID userId) {
Collection<EventAction> actions;
if (userId == null) {
actions = repository.findAll ();
} else {
Set<UUID> potentialIds = repository.findByUserIdsContaining (userId)
.stream ()
.map (EventAction::getEventId)
.collect (toSet ());
actions = repository.findByEventIdIn (potentialIds);
}
Set <Event> events = actions.stream ()
.collect (groupingBy (EventAction::getEventId))
.values ()
.stream ()
.map (composer::compose)
.collect (toSet ());
return addPoints (events);
}
@PostMapping
public Event create (
@RequestBody Form<Event> form,
@AuthenticationPrincipal AuthenticatedUser user
) {
validateCreation (form);
BaseAction ba = new BaseAction (clock, form.getComment (), user);
EventCreation creation = new EventCreation (ba, form.getObject ());
repository.save (creation);
return addPoints (composer.compose (Set.of (creation)));
}
@PatchMapping ("/{id}")
public Event update (
@PathVariable UUID id,
@RequestBody Form<Event> form,
@AuthenticationPrincipal AuthenticatedUser user
) {
Set<EventAction> actions = repository.findByEventId (id);
if (actions.isEmpty ()) {
throw new ResponseStatusException (NOT_FOUND);
}
validateUpdate (form);
BaseAction ba = new BaseAction (clock, form.getComment (), user);
EventEdition edition = new EventEdition (ba, form.getObject ().withId (id));
repository.save (edition);
return addPoints (composer.compose (Sets.union (actions, Set.of (edition))));
}
@GetMapping ("/{id}")
public Event get (@PathVariable UUID id) {
Set<EventAction> actions = repository.findByEventId (id);
if (actions.isEmpty ()) {
throw new ResponseStatusException (NOT_FOUND);
}
return addPoints (composer.compose (actions));
}
private Set<Event> addPoints (Collection<Event> events) {
Set<UUID> scaleRuleIds = events.stream ()
.map (Event::getScaleRuleId)
.collect (toSet ());
Map<UUID, Integer> points = scaleRuleActionRepository.findByScaleRuleIdIn (scaleRuleIds)
.stream ()
.collect (groupingBy (
ScaleRuleAction::getScaleRuleId,
collectingAndThen (toSet (), actions -> composer.compose (actions).getPoints ())
));
return events.stream ()
.map (e -> e.withPoints (points.get (e.getScaleRuleId ())))
.collect (toSet ());
}
private Event addPoints (Event event) {
Set<ScaleRuleAction> actions = scaleRuleActionRepository.findByScaleRuleId (event.getScaleRuleId ());
ScaleRule rule = composer.compose (actions);
return event.withPoints (rule.getPoints ());
}
private void validateCreation (Form<Event> form) {
if (form == null || form.getObject () == null) {
throw new ResponseStatusException (BAD_REQUEST, "Nothing to create.");
}
var event = form.getObject ();
if (event.getDate () == null
|| event.getName () == null
|| event.getName ().isBlank ()
|| event.getScaleRuleId () == null
|| event.getUserIds () == null) {
throw new ResponseStatusException (BAD_REQUEST, "Missing mandatory field.");
}
var scaleRuleId = event.getScaleRuleId ();
var ruleActions = scaleRuleActionRepository.findByScaleRuleId (scaleRuleId);
if (ruleActions.isEmpty ()) {
throw new ResponseStatusException (BAD_REQUEST, "No such rule: " + scaleRuleId);
}
}
private void validateUpdate (Form<Event> form) {
if (form == null || form.getObject () == null) {
throw new ResponseStatusException (BAD_REQUEST, "No update to apply.");
}
var event = form.getObject ();
if (event.getScaleRuleId () != null) {
var scaleRuleId = event.getScaleRuleId ();
var ruleActions = scaleRuleActionRepository.findByScaleRuleId (scaleRuleId);
if (ruleActions.isEmpty ()) {
throw new ResponseStatusException (BAD_REQUEST, "No such rule: " + scaleRuleId);
}
}
if (event.getName () != null) {
if (event.getName ().isBlank ()) {
throw new ResponseStatusException (BAD_REQUEST, "Missing name.");
}
}
}
}
|
UTF-8
|
Java
| 6,524
|
java
|
Events.java
|
Java
|
[] | null |
[] |
package io.miret.etienne.hourglass.controllers;
import com.google.common.collect.Sets;
import io.miret.etienne.hourglass.data.auth.AuthenticatedUser;
import io.miret.etienne.hourglass.data.core.BaseAction;
import io.miret.etienne.hourglass.data.core.Event;
import io.miret.etienne.hourglass.data.core.ScaleRule;
import io.miret.etienne.hourglass.data.mongo.EventAction;
import io.miret.etienne.hourglass.data.mongo.EventCreation;
import io.miret.etienne.hourglass.data.mongo.EventEdition;
import io.miret.etienne.hourglass.data.mongo.ScaleRuleAction;
import io.miret.etienne.hourglass.data.rest.Form;
import io.miret.etienne.hourglass.repositories.EventActionRepository;
import io.miret.etienne.hourglass.repositories.ScaleRuleActionRepository;
import io.miret.etienne.hourglass.services.ActionComposer;
import lombok.AllArgsConstructor;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
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.RestController;
import org.springframework.web.server.ResponseStatusException;
import java.time.Clock;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import static java.util.stream.Collectors.collectingAndThen;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.toSet;
import static lombok.AccessLevel.PRIVATE;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
import static org.springframework.http.HttpStatus.NOT_FOUND;
@RestController
@RequestMapping ("/events")
@AllArgsConstructor (access = PRIVATE)
public class Events {
private final Clock clock;
private final EventActionRepository repository;
private final ScaleRuleActionRepository scaleRuleActionRepository;
private final ActionComposer composer;
@GetMapping
public Set<Event> find (@RequestParam (required = false) UUID userId) {
Collection<EventAction> actions;
if (userId == null) {
actions = repository.findAll ();
} else {
Set<UUID> potentialIds = repository.findByUserIdsContaining (userId)
.stream ()
.map (EventAction::getEventId)
.collect (toSet ());
actions = repository.findByEventIdIn (potentialIds);
}
Set <Event> events = actions.stream ()
.collect (groupingBy (EventAction::getEventId))
.values ()
.stream ()
.map (composer::compose)
.collect (toSet ());
return addPoints (events);
}
@PostMapping
public Event create (
@RequestBody Form<Event> form,
@AuthenticationPrincipal AuthenticatedUser user
) {
validateCreation (form);
BaseAction ba = new BaseAction (clock, form.getComment (), user);
EventCreation creation = new EventCreation (ba, form.getObject ());
repository.save (creation);
return addPoints (composer.compose (Set.of (creation)));
}
@PatchMapping ("/{id}")
public Event update (
@PathVariable UUID id,
@RequestBody Form<Event> form,
@AuthenticationPrincipal AuthenticatedUser user
) {
Set<EventAction> actions = repository.findByEventId (id);
if (actions.isEmpty ()) {
throw new ResponseStatusException (NOT_FOUND);
}
validateUpdate (form);
BaseAction ba = new BaseAction (clock, form.getComment (), user);
EventEdition edition = new EventEdition (ba, form.getObject ().withId (id));
repository.save (edition);
return addPoints (composer.compose (Sets.union (actions, Set.of (edition))));
}
@GetMapping ("/{id}")
public Event get (@PathVariable UUID id) {
Set<EventAction> actions = repository.findByEventId (id);
if (actions.isEmpty ()) {
throw new ResponseStatusException (NOT_FOUND);
}
return addPoints (composer.compose (actions));
}
private Set<Event> addPoints (Collection<Event> events) {
Set<UUID> scaleRuleIds = events.stream ()
.map (Event::getScaleRuleId)
.collect (toSet ());
Map<UUID, Integer> points = scaleRuleActionRepository.findByScaleRuleIdIn (scaleRuleIds)
.stream ()
.collect (groupingBy (
ScaleRuleAction::getScaleRuleId,
collectingAndThen (toSet (), actions -> composer.compose (actions).getPoints ())
));
return events.stream ()
.map (e -> e.withPoints (points.get (e.getScaleRuleId ())))
.collect (toSet ());
}
private Event addPoints (Event event) {
Set<ScaleRuleAction> actions = scaleRuleActionRepository.findByScaleRuleId (event.getScaleRuleId ());
ScaleRule rule = composer.compose (actions);
return event.withPoints (rule.getPoints ());
}
private void validateCreation (Form<Event> form) {
if (form == null || form.getObject () == null) {
throw new ResponseStatusException (BAD_REQUEST, "Nothing to create.");
}
var event = form.getObject ();
if (event.getDate () == null
|| event.getName () == null
|| event.getName ().isBlank ()
|| event.getScaleRuleId () == null
|| event.getUserIds () == null) {
throw new ResponseStatusException (BAD_REQUEST, "Missing mandatory field.");
}
var scaleRuleId = event.getScaleRuleId ();
var ruleActions = scaleRuleActionRepository.findByScaleRuleId (scaleRuleId);
if (ruleActions.isEmpty ()) {
throw new ResponseStatusException (BAD_REQUEST, "No such rule: " + scaleRuleId);
}
}
private void validateUpdate (Form<Event> form) {
if (form == null || form.getObject () == null) {
throw new ResponseStatusException (BAD_REQUEST, "No update to apply.");
}
var event = form.getObject ();
if (event.getScaleRuleId () != null) {
var scaleRuleId = event.getScaleRuleId ();
var ruleActions = scaleRuleActionRepository.findByScaleRuleId (scaleRuleId);
if (ruleActions.isEmpty ()) {
throw new ResponseStatusException (BAD_REQUEST, "No such rule: " + scaleRuleId);
}
}
if (event.getName () != null) {
if (event.getName ().isBlank ()) {
throw new ResponseStatusException (BAD_REQUEST, "Missing name.");
}
}
}
}
| 6,524
| 0.71214
| 0.71214
| 181
| 35.044197
| 26.203796
| 105
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.607735
| false
| false
|
2
|
ba840bce617bda14b94fa7dacae2a477100f62ca
| 15,942,918,656,266
|
5845a87181dc36eee51c939c5b6a8b85d97331c4
|
/src/com/yondervision/mi/common/ERRCODE.java
|
fd8b866691999f734dbfdd054dd9a6fe99136cf8
|
[] |
no_license
|
yupomang/YBMAPLAST
|
https://github.com/yupomang/YBMAPLAST
|
96cc4b5a617adc9e102fb8eda108a68e01487403
|
ad4678c7a3e5cf0a7f63094a0f8326a424f4b428
|
refs/heads/master
| 2023-03-29T20:05:50.201000
| 2021-03-30T03:23:53
| 2021-03-30T03:23:53
| 352,857,282
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* 工程名称:YBMAP
* 包名: com.yondervision.mi.common
* 文件名: ERRCODE.java
* 创建日期:2013-10-15
*/
package com.yondervision.mi.common;
import com.yondervision.mi.common.log.LoggerUtil;
/**
* 错误码定义类
* ERROR、LOG、DEBUG为输出日志使用的错误码
* APP_ALERT、WEB_ALERT为抛出异常时使用的错误码
* 抛出的异常由filer统一处理,发送到客户端
* @author LinXiaolong
*
*/
public class ERRCODE {
/**
* 错误日志码
* 对应mi009
* @author LinXiaolong
*
*/
public static enum ERROR{
/*
* 错误码定义
* 以7、8、9开头
*/
/** 系统异常:{0} **/
SYS("999999"),
/** 登录异常:{0}**/
LOGIN_EXC("999998"),
/** 通讯发送失败:{0} **/
CONNECT_SEND_ERROR("900001"),
/** 通讯错误:{0} **/
CONNECT_ERROR("900002"),
/** 账户未实名认证 **/
AUTHFLAG_ERROR("999995"),
/** 账户认证 {0}**/
AUTH_ERROR("999996"),
/** 账户未绑定 **/
BINDFLAG_ERROR("999997"),
/** 表【{0}】条件【{1}】无数据 **/
NO_DATA("800001"),
/** 表【{0}】取得主键失败 **/
NULL_KEY("800002"),
/** 更新失败!表【{0}】、主键【{1}】无对应数据 **/
UPDATE_NO_DATA("800003"),
/** 未找到符合条件的【{0}】数据 */
ERRCODE_LOG_800004("800004"),
/** 缺少参数【{0}】**/
PARAMS_NULL("700001"),
/** 此记录【{0}】已存在,不能进行维护操作。**/
ADD_CHECK("700002"),
/** 删除记录【{0}】失败。**/
DEL_CHECK("700003"),
/** 此【{0}】记录已注销,不能进行维护操作,需“激活”。**/
VALIDFLG_CHECK("700004"),
/** 此记录【{0}】已处于“有效”状态。**/
VALIDFLG_CHECK_TRUE("700005"),
/** 此【{0}】记录【{1}】,不能进行【{2}】,请确认后提交。**/
VALIDFLG_AUTH_CHECK("700006"),
/** 此行数据编辑过,且整行为空,请删除 **/
IMPORT_ROW_NULL("710001"),
/** 此行数据[{0}]为空 **/
IMPORT_ROW_COL_NULL("710002"),
/** 此行数据[{0}]超长。数据长度[{1}],最大长度[{2}] **/
IMPORT_ROW_COL_TOO_LONG("710003"),
/** 此行数据[{0}]不可换行 **/
IMPORT_ROW_COL_CONT_CHANGE_LINE("710004"),
/** 此行数据[{0]没有对应的注册用户 **/
IMPORT_ROW_COL_HAS_NO_USER("710005"),
/** 此行数据列数为[{0}],要求列数为[{1}] **/
IMPORT_ROW_LENGTH_INCORRECT("710006"),
;
/*
* 内部数据
*/
private final char[] value;
/**
* 取得错误码
*/
public String getValue() {
return new String(value);
}
/**
* 取得错误信息
* @param params 此错误码对应的参数
* @return 错误信息
*/
public String getLogText(String...params) {
return LoggerUtil.getLogText(new String(value), params);
}
ERROR(String value) {
this.value = value.toCharArray();
}
}
/**
* 业务日志码
* 对应mi009
* @author LinXiaolong
*
*/
public static enum LOG{
/*
* 业务日志码定义
* 以4、5、6开头
*/
/** 【{0}】 **/
SELF_LOG("400000"),
/** 【{0}】业务处理开始 **/
START_BUSIN("400001"),
/** 【{0}】业务处理结束 **/
END_BUSIN("400002"),
/** 已接收到返回信息:{0} **/
REV_INFO("400003"),
;
/*
* 内部数据
*/
private final char[] value;
/**
* 取得错误码
*/
public String getValue() {
return new String(value);
}
/**
* 取得错误信息
* @param params 此错误码对应的参数
* @return 错误信息
*/
public String getLogText(String...params) {
return LoggerUtil.getLogText(new String(value), params);
}
LOG(String value) {
this.value = value.toCharArray();
}
}
/**
* 调试日志码
* 对应mi009
* @author LinXiaolong
*
*/
public static enum DEBUG{
/*
* 调试日志码定义
* 以0开头
*/
/**请求参数为:{0}*/
SHOW_PARAM("000001"),
/**返回结果为:{0}*/
SHOW_RESULT("000009"),
;
/*
* 内部数据
*/
private final char[] value;
/**
* 取得错误码
*/
public String getValue() {
return new String(value);
}
/**
* 取得错误信息
* @param params 此错误码对应的参数
* @return 错误信息
*/
public String getLogText(String...params) {
return LoggerUtil.getLogText(new String(value), params);
}
DEBUG(String value) {
this.value = value.toCharArray();
}
}
/**
* 手机提示信息码
* 对应mi010
* @author LinXiaolong
*
*/
public static enum APP_ALERT{
/*
* 调试日志码定义
* 以1开头
*/
/** 系统错误 **/
SYS("199999"), //系统异常
/** 请输入【{0}】 **/
PARAMS_NULL("100001"),
/** APP用户未登录 **/
APP_NO_LOGIN("100002"),
/** APP输入参数【{0}】不正确 */
APP_DATA_ERROR("100003"),
/** 未找到符合条件的【{0}】数据 **/
NO_DATA("180001"),
/** 用户注册失败【{0}】 **/
APP_ZC("100004"),
/**预约失败**/
APP_YY("100005")
;
/*
* 内部数据
*/
private final char[] value;
/**
* 取得错误码
*/
public String getValue() {
return new String(value);
}
APP_ALERT(String value) {
this.value = value.toCharArray();
}
}
/**
* web请求提示信息码(公共部分web页面提示信息码,以29开头)
* 对应mi010
* @author LinXiaolong
*
*/
public static enum WEB_ALERT{
/*
* 调试日志码定义
* 以2开头
*/
/** 系统错误[{0}],请联系系统管理员 **/
SYS("299999"), //系统异常
/** 请输入【{0}】 **/
PARAMS_NULL("200001"),
/** 参数【{0}】超过最大长度[{1}] **/
PARAMS_TOO_LONG("200002"),
/** 上传文件格式为[{0}]不正确,要求上传格式为[{1}] */
PARAMS_FILE_TYPE("200003"),
/** 此记录{0}已存在,请确认后再提交。 */
ADD_CHECK("200004"),
/** 删除记录【{0}】失败。 */
DEL_CHECK("200005"),
/** 更新0条!表【{0}】无对应数据。 */
UPD_CHECK("200006"),
/** 更新记录失败:【{0}】 */
UPD_ERROR("200007"),
/** 删除0条!表【{0}】无对应数据。 */
DEL_NO_DATA("200008"),
/** 新增数据错误:【{0}】 */
DATA_CHECK_INSERT("200009"),
/** 导入的批量数据文件有误,详情:{0} */
IMPORT_FILE_ERR("210001"),
/** 要删除的业务咨询项目包含[{0}]个业务咨询子项、[{1}]个公共条件项目,请先删除业务咨询子项和公共条件项目。 **/
MI301_COUNT_DELETE("260001"),
/** 要删除的业务咨询子项包含[{0}]个业务咨询向导步骤,请先删除业务咨询向导步骤。 **/
MI302_COUNT_DELETE("260002"),
/** 要删除的公共条件项目包含[{0}]个公共条件分组,请先删除公共条件分组。 **/
MI303_COUNT_DELETE("260003"),
/** 要删除的公共条件分组包含[{0}]个公共条件内容,请先删除公共条件内容。 **/
MI304_COUNT_DELETE("260004"),
/** 要删除的公共条件内容被[{0}]个公共条件组合使用,请先删除对应公共条件组合的业务咨询内容。 **/
MI305_COUNT_DELETE("260005"),
/** 要删除的业务咨询向导步骤包含[{0}]个业务咨询向导内容,请先删除业务咨询向导内容。 **/
MI306_COUNT_DELETE("260006"),
/** 每个业务咨询项目下最多添加8个公共条件项目 **/
MI303_CONSULTITEM_THAN_MAX("260007"),
/** 中心[{0}]未录入客服电话,请在中心基本信息中录入客服电话! **/
NEED_CUSTSVCTEL("270001"),
/** 未找到符合条件的【{0}】数据 **/
NO_DATA("280001"),
// 公共部分web页面提示信息码,以29开头
/** {0} **/
SELF_ERR("290001"),
/** 此【{0}】记录已注销,请“激活”后,再进行其他操作。**/
VALIDFLG_CHECK("290002"),
/** 当前【{0}】内容中包含已【{1}】记录,不能进行【{2}】,请重新选择!**/
VALIDFLG_LIST_CHECK("290003"),
/**【{0}】输入不合法,请确认后再提交 **/
VALUE_ERR("299996"),
/**操作业务日志表,系统异常【{0}】,请联系系统管理员 **/
BUZ_LOG_SYS("299997"), //业务日志特有,系统异常,
/** 登录超时,请重新登录 **/
LOGIN_TIMEOUT("299998"),
/** 请求验证失败 **/
LOGIN_MD5_CHECK("299995"),
/** 请求信息包头不正确 **/
LOGIN_HEAD_CHECK("299994"),
/** 用户登录错误【{0}】 **/
LOGIN_NO_USER("299993"),
/** {0} **/
LOGIN_ERROR_PARA("299992"),
;
/*
* 内部方法
*/
private final char[] value;
/**
* 取得错误码
*/
public String getValue() {
return new String(value);
}
WEB_ALERT(String value) {
this.value = value.toCharArray();
}
}
/*
public static void main(String[] args) {
//取错误码方法
System.out.println(ERRCODE.ERROR.SYS.getValue());
}*/
}
|
UTF-8
|
Java
| 10,386
|
java
|
ERRCODE.java
|
Java
|
[
{
"context": "T为抛出异常时使用的错误码\n * 抛出的异常由filer统一处理,发送到客户端\n * @author LinXiaolong\n *\n */\npublic class ERRCODE {\n\t/**\n\t * 错误日志码\n\t * ",
"end": 324,
"score": 0.9783495664596558,
"start": 313,
"tag": "USERNAME",
"value": "LinXiaolong"
},
{
"context": "s ERRCODE {\n\t/**\n\t * 错误日志码\n\t * 对应mi009\n\t * @author LinXiaolong\n\t *\n\t */\n public static enum ERROR{\n \t/*\n ",
"end": 405,
"score": 0.8737757802009583,
"start": 394,
"tag": "USERNAME",
"value": "LinXiaolong"
},
{
"context": " }\n \n /**\n\t * 业务日志码\n\t * 对应mi009\n\t * @author LinXiaolong\n\t *\n\t */\n public static enum LOG{\n \t/*\n ",
"end": 2651,
"score": 0.9965997934341431,
"start": 2640,
"tag": "NAME",
"value": "LinXiaolong"
},
{
"context": " }\n \n /**\n\t * 调试日志码\n\t * 对应mi009\n\t * @author LinXiaolong\n\t *\n\t */\n public static enum DEBUG{\n \t/*\n ",
"end": 3563,
"score": 0.9914196729660034,
"start": 3552,
"tag": "NAME",
"value": "LinXiaolong"
},
{
"context": "}\n \n /**\n\t * 手机提示信息码\n\t * 对应mi010\n\t * @author LinXiaolong\n\t *\n\t */\n public static enum APP_ALERT{\n \t/",
"end": 4364,
"score": 0.9933483004570007,
"start": 4353,
"tag": "NAME",
"value": "LinXiaolong"
},
{
"context": "示信息码(公共部分web页面提示信息码,以29开头)\n\t * 对应mi010\n\t * @author LinXiaolong\n\t *\n\t */\n public static enum WEB_ALERT{\n \t/",
"end": 5245,
"score": 0.9990949630737305,
"start": 5234,
"tag": "NAME",
"value": "LinXiaolong"
}
] | null |
[] |
/**
* 工程名称:YBMAP
* 包名: com.yondervision.mi.common
* 文件名: ERRCODE.java
* 创建日期:2013-10-15
*/
package com.yondervision.mi.common;
import com.yondervision.mi.common.log.LoggerUtil;
/**
* 错误码定义类
* ERROR、LOG、DEBUG为输出日志使用的错误码
* APP_ALERT、WEB_ALERT为抛出异常时使用的错误码
* 抛出的异常由filer统一处理,发送到客户端
* @author LinXiaolong
*
*/
public class ERRCODE {
/**
* 错误日志码
* 对应mi009
* @author LinXiaolong
*
*/
public static enum ERROR{
/*
* 错误码定义
* 以7、8、9开头
*/
/** 系统异常:{0} **/
SYS("999999"),
/** 登录异常:{0}**/
LOGIN_EXC("999998"),
/** 通讯发送失败:{0} **/
CONNECT_SEND_ERROR("900001"),
/** 通讯错误:{0} **/
CONNECT_ERROR("900002"),
/** 账户未实名认证 **/
AUTHFLAG_ERROR("999995"),
/** 账户认证 {0}**/
AUTH_ERROR("999996"),
/** 账户未绑定 **/
BINDFLAG_ERROR("999997"),
/** 表【{0}】条件【{1}】无数据 **/
NO_DATA("800001"),
/** 表【{0}】取得主键失败 **/
NULL_KEY("800002"),
/** 更新失败!表【{0}】、主键【{1}】无对应数据 **/
UPDATE_NO_DATA("800003"),
/** 未找到符合条件的【{0}】数据 */
ERRCODE_LOG_800004("800004"),
/** 缺少参数【{0}】**/
PARAMS_NULL("700001"),
/** 此记录【{0}】已存在,不能进行维护操作。**/
ADD_CHECK("700002"),
/** 删除记录【{0}】失败。**/
DEL_CHECK("700003"),
/** 此【{0}】记录已注销,不能进行维护操作,需“激活”。**/
VALIDFLG_CHECK("700004"),
/** 此记录【{0}】已处于“有效”状态。**/
VALIDFLG_CHECK_TRUE("700005"),
/** 此【{0}】记录【{1}】,不能进行【{2}】,请确认后提交。**/
VALIDFLG_AUTH_CHECK("700006"),
/** 此行数据编辑过,且整行为空,请删除 **/
IMPORT_ROW_NULL("710001"),
/** 此行数据[{0}]为空 **/
IMPORT_ROW_COL_NULL("710002"),
/** 此行数据[{0}]超长。数据长度[{1}],最大长度[{2}] **/
IMPORT_ROW_COL_TOO_LONG("710003"),
/** 此行数据[{0}]不可换行 **/
IMPORT_ROW_COL_CONT_CHANGE_LINE("710004"),
/** 此行数据[{0]没有对应的注册用户 **/
IMPORT_ROW_COL_HAS_NO_USER("710005"),
/** 此行数据列数为[{0}],要求列数为[{1}] **/
IMPORT_ROW_LENGTH_INCORRECT("710006"),
;
/*
* 内部数据
*/
private final char[] value;
/**
* 取得错误码
*/
public String getValue() {
return new String(value);
}
/**
* 取得错误信息
* @param params 此错误码对应的参数
* @return 错误信息
*/
public String getLogText(String...params) {
return LoggerUtil.getLogText(new String(value), params);
}
ERROR(String value) {
this.value = value.toCharArray();
}
}
/**
* 业务日志码
* 对应mi009
* @author LinXiaolong
*
*/
public static enum LOG{
/*
* 业务日志码定义
* 以4、5、6开头
*/
/** 【{0}】 **/
SELF_LOG("400000"),
/** 【{0}】业务处理开始 **/
START_BUSIN("400001"),
/** 【{0}】业务处理结束 **/
END_BUSIN("400002"),
/** 已接收到返回信息:{0} **/
REV_INFO("400003"),
;
/*
* 内部数据
*/
private final char[] value;
/**
* 取得错误码
*/
public String getValue() {
return new String(value);
}
/**
* 取得错误信息
* @param params 此错误码对应的参数
* @return 错误信息
*/
public String getLogText(String...params) {
return LoggerUtil.getLogText(new String(value), params);
}
LOG(String value) {
this.value = value.toCharArray();
}
}
/**
* 调试日志码
* 对应mi009
* @author LinXiaolong
*
*/
public static enum DEBUG{
/*
* 调试日志码定义
* 以0开头
*/
/**请求参数为:{0}*/
SHOW_PARAM("000001"),
/**返回结果为:{0}*/
SHOW_RESULT("000009"),
;
/*
* 内部数据
*/
private final char[] value;
/**
* 取得错误码
*/
public String getValue() {
return new String(value);
}
/**
* 取得错误信息
* @param params 此错误码对应的参数
* @return 错误信息
*/
public String getLogText(String...params) {
return LoggerUtil.getLogText(new String(value), params);
}
DEBUG(String value) {
this.value = value.toCharArray();
}
}
/**
* 手机提示信息码
* 对应mi010
* @author LinXiaolong
*
*/
public static enum APP_ALERT{
/*
* 调试日志码定义
* 以1开头
*/
/** 系统错误 **/
SYS("199999"), //系统异常
/** 请输入【{0}】 **/
PARAMS_NULL("100001"),
/** APP用户未登录 **/
APP_NO_LOGIN("100002"),
/** APP输入参数【{0}】不正确 */
APP_DATA_ERROR("100003"),
/** 未找到符合条件的【{0}】数据 **/
NO_DATA("180001"),
/** 用户注册失败【{0}】 **/
APP_ZC("100004"),
/**预约失败**/
APP_YY("100005")
;
/*
* 内部数据
*/
private final char[] value;
/**
* 取得错误码
*/
public String getValue() {
return new String(value);
}
APP_ALERT(String value) {
this.value = value.toCharArray();
}
}
/**
* web请求提示信息码(公共部分web页面提示信息码,以29开头)
* 对应mi010
* @author LinXiaolong
*
*/
public static enum WEB_ALERT{
/*
* 调试日志码定义
* 以2开头
*/
/** 系统错误[{0}],请联系系统管理员 **/
SYS("299999"), //系统异常
/** 请输入【{0}】 **/
PARAMS_NULL("200001"),
/** 参数【{0}】超过最大长度[{1}] **/
PARAMS_TOO_LONG("200002"),
/** 上传文件格式为[{0}]不正确,要求上传格式为[{1}] */
PARAMS_FILE_TYPE("200003"),
/** 此记录{0}已存在,请确认后再提交。 */
ADD_CHECK("200004"),
/** 删除记录【{0}】失败。 */
DEL_CHECK("200005"),
/** 更新0条!表【{0}】无对应数据。 */
UPD_CHECK("200006"),
/** 更新记录失败:【{0}】 */
UPD_ERROR("200007"),
/** 删除0条!表【{0}】无对应数据。 */
DEL_NO_DATA("200008"),
/** 新增数据错误:【{0}】 */
DATA_CHECK_INSERT("200009"),
/** 导入的批量数据文件有误,详情:{0} */
IMPORT_FILE_ERR("210001"),
/** 要删除的业务咨询项目包含[{0}]个业务咨询子项、[{1}]个公共条件项目,请先删除业务咨询子项和公共条件项目。 **/
MI301_COUNT_DELETE("260001"),
/** 要删除的业务咨询子项包含[{0}]个业务咨询向导步骤,请先删除业务咨询向导步骤。 **/
MI302_COUNT_DELETE("260002"),
/** 要删除的公共条件项目包含[{0}]个公共条件分组,请先删除公共条件分组。 **/
MI303_COUNT_DELETE("260003"),
/** 要删除的公共条件分组包含[{0}]个公共条件内容,请先删除公共条件内容。 **/
MI304_COUNT_DELETE("260004"),
/** 要删除的公共条件内容被[{0}]个公共条件组合使用,请先删除对应公共条件组合的业务咨询内容。 **/
MI305_COUNT_DELETE("260005"),
/** 要删除的业务咨询向导步骤包含[{0}]个业务咨询向导内容,请先删除业务咨询向导内容。 **/
MI306_COUNT_DELETE("260006"),
/** 每个业务咨询项目下最多添加8个公共条件项目 **/
MI303_CONSULTITEM_THAN_MAX("260007"),
/** 中心[{0}]未录入客服电话,请在中心基本信息中录入客服电话! **/
NEED_CUSTSVCTEL("270001"),
/** 未找到符合条件的【{0}】数据 **/
NO_DATA("280001"),
// 公共部分web页面提示信息码,以29开头
/** {0} **/
SELF_ERR("290001"),
/** 此【{0}】记录已注销,请“激活”后,再进行其他操作。**/
VALIDFLG_CHECK("290002"),
/** 当前【{0}】内容中包含已【{1}】记录,不能进行【{2}】,请重新选择!**/
VALIDFLG_LIST_CHECK("290003"),
/**【{0}】输入不合法,请确认后再提交 **/
VALUE_ERR("299996"),
/**操作业务日志表,系统异常【{0}】,请联系系统管理员 **/
BUZ_LOG_SYS("299997"), //业务日志特有,系统异常,
/** 登录超时,请重新登录 **/
LOGIN_TIMEOUT("299998"),
/** 请求验证失败 **/
LOGIN_MD5_CHECK("299995"),
/** 请求信息包头不正确 **/
LOGIN_HEAD_CHECK("299994"),
/** 用户登录错误【{0}】 **/
LOGIN_NO_USER("299993"),
/** {0} **/
LOGIN_ERROR_PARA("299992"),
;
/*
* 内部方法
*/
private final char[] value;
/**
* 取得错误码
*/
public String getValue() {
return new String(value);
}
WEB_ALERT(String value) {
this.value = value.toCharArray();
}
}
/*
public static void main(String[] args) {
//取错误码方法
System.out.println(ERRCODE.ERROR.SYS.getValue());
}*/
}
| 10,386
| 0.446286
| 0.38011
| 333
| 23.096096
| 14.447681
| 72
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.489489
| false
| false
|
2
|
3e89a33225b1f10a93a962e5628991ed774f8e8c
| 3,143,916,071,102
|
69befc68c692811b352e3b6dfa58ab705393abf9
|
/app/src/main/java/com/example/shivam/xyzreader/data/XYZColumns.java
|
191de4cc757fadeaf87b22f6ce83978b9f70bc46
|
[] |
no_license
|
shivamraspro/Make-Your-App-Material
|
https://github.com/shivamraspro/Make-Your-App-Material
|
41605005367b594f1076a26e7287a0eaacea2840
|
e2f156188f8b6080926873f51f200ecd31ff4d9d
|
refs/heads/master
| 2021-06-08T09:06:17.072000
| 2016-11-25T10:57:32
| 2016-11-25T10:57:32
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.shivam.xyzreader.data;
import net.simonvt.schematic.annotation.DataType;
import net.simonvt.schematic.annotation.DefaultValue;
import net.simonvt.schematic.annotation.NotNull;
import net.simonvt.schematic.annotation.PrimaryKey;
/**
* Created by shivam on 15/11/16.
*/
public class XYZColumns {
/** Type: INTEGER PRIMARY KEY AUTOINCREMENT */
@DataType(DataType.Type.INTEGER)
@PrimaryKey
public static final String _ID = "_id";
/** Type: TEXT */
@DataType(DataType.Type.TEXT)
public static final String SERVER_ID = "server_id";
/** Type: TEXT NOT NULL */
@DataType(DataType.Type.TEXT)
@NotNull
public static final String TITLE = "title";
/** Type: TEXT NOT NULL */
@DataType(DataType.Type.TEXT)
@NotNull
public static final String AUTHOR = "author";
/** Type: TEXT NOT NULL */
@DataType(DataType.Type.TEXT)
@NotNull
public static final String BODY = "body";
/** Type: TEXT NOT NULL */
@DataType(DataType.Type.TEXT)
@NotNull
public static final String THUMB_URL = "thumb";
/** Type: TEXT NOT NULL */
@DataType(DataType.Type.TEXT)
@NotNull
public static final String PHOTO_URL = "photo";
/** Type: REAL NOT NULL DEFAULT 1.5 */
@DataType(DataType.Type.REAL)
@NotNull
@DefaultValue("1.5")
public static final String ASPECT_RATIO = "aspect_ratio";
/** Type: TEXT NOT NULL DEFAULT 0 */
@DataType(DataType.Type.TEXT)
@NotNull
@DefaultValue("0")
public static final String PUBLISHED_DATE = "published_date";
}
|
UTF-8
|
Java
| 1,583
|
java
|
XYZColumns.java
|
Java
|
[
{
"context": "chematic.annotation.PrimaryKey;\n\n/**\n * Created by shivam on 15/11/16.\n */\n\npublic class XYZColumns {\n\n ",
"end": 274,
"score": 0.9996156692504883,
"start": 268,
"tag": "USERNAME",
"value": "shivam"
}
] | null |
[] |
package com.example.shivam.xyzreader.data;
import net.simonvt.schematic.annotation.DataType;
import net.simonvt.schematic.annotation.DefaultValue;
import net.simonvt.schematic.annotation.NotNull;
import net.simonvt.schematic.annotation.PrimaryKey;
/**
* Created by shivam on 15/11/16.
*/
public class XYZColumns {
/** Type: INTEGER PRIMARY KEY AUTOINCREMENT */
@DataType(DataType.Type.INTEGER)
@PrimaryKey
public static final String _ID = "_id";
/** Type: TEXT */
@DataType(DataType.Type.TEXT)
public static final String SERVER_ID = "server_id";
/** Type: TEXT NOT NULL */
@DataType(DataType.Type.TEXT)
@NotNull
public static final String TITLE = "title";
/** Type: TEXT NOT NULL */
@DataType(DataType.Type.TEXT)
@NotNull
public static final String AUTHOR = "author";
/** Type: TEXT NOT NULL */
@DataType(DataType.Type.TEXT)
@NotNull
public static final String BODY = "body";
/** Type: TEXT NOT NULL */
@DataType(DataType.Type.TEXT)
@NotNull
public static final String THUMB_URL = "thumb";
/** Type: TEXT NOT NULL */
@DataType(DataType.Type.TEXT)
@NotNull
public static final String PHOTO_URL = "photo";
/** Type: REAL NOT NULL DEFAULT 1.5 */
@DataType(DataType.Type.REAL)
@NotNull
@DefaultValue("1.5")
public static final String ASPECT_RATIO = "aspect_ratio";
/** Type: TEXT NOT NULL DEFAULT 0 */
@DataType(DataType.Type.TEXT)
@NotNull
@DefaultValue("0")
public static final String PUBLISHED_DATE = "published_date";
}
| 1,583
| 0.66772
| 0.660139
| 60
| 25.383333
| 19.457726
| 65
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.233333
| false
| false
|
2
|
716e5662cc7d5b46239b226116bf6275eead1689
| 21,603,685,553,175
|
81679aef7b49573bcb481fbb9919b5bbf3e62bcf
|
/src/main/java/parking/management/dao/TicketDao.java
|
eb2c80f17743b2f8fc1171817a56b7c4c5228c71
|
[] |
no_license
|
nilambb/ParkingManagementSpringBoot
|
https://github.com/nilambb/ParkingManagementSpringBoot
|
9effb741e058ff915a60741f72cda8889d81be52
|
1090dcaaf35229ea8e723e049f42b6c83bf6713d
|
refs/heads/master
| 2020-03-29T21:44:12.039000
| 2018-09-27T09:16:47
| 2018-09-27T09:16:47
| 150,384,292
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package parking.management.dao;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import parking.management.exception.InvalidParking;
import parking.management.exception.InvalidTicket;
import parking.management.model.Ticket;
@Repository
@Qualifier("ticketDao")
public class TicketDao {
private static final Logger logger = LogManager.getLogger(TicketDao.class);
@Autowired
JdbcTemplate jdbcTemplate;
public Ticket createTicket(int vehicleId, int parkingSpotId) throws InvalidParking {
String query = "insert into ticket(id,vehicle_id, parking_spot_id, arrival_time, departure_time) "
+ "values (next value FOR ticket_id_seq, ?,?,?,?)";
logger.info("inserting tickets - ParkingSpot = " + parkingSpotId + " and vehicleId = " + vehicleId);
int ticketCount = jdbcTemplate.update(query, vehicleId, parkingSpotId, new Date(), null);
if (ticketCount > 0) {
return getTicket(vehicleId, parkingSpotId);
} else {
throw new InvalidParking("Sorry can not create ticket....");
}
}
public Ticket getTicket(int vehicleId, int parkingSpotId) {
List<Ticket> tickets = new ArrayList<Ticket>();
String query = "select * from ticket where vehicle_id = ? and parking_spot_id = ? and departure_time is null";
List<Map<String, Object>> rows = jdbcTemplate.queryForList(query, vehicleId, parkingSpotId);
for (Map<?, ?> row : rows) {
Ticket ticket = new Ticket();
ticket.setId((Integer) (row.get("id")));
ticket.setVehicleId((Integer) row.get("vehicle_id"));
ticket.setParkingSpotId((Integer) row.get("parking_spot_id"));
ticket.setArrivalTime((Date) row.get("arrival_time"));
ticket.setDepartureTime((Date) row.get("departure_time"));
tickets.add(ticket);
}
return tickets.get(0);
}
public Ticket getTicket(int ticketId) {
Ticket ticket = null;
List<Ticket> tickets = new ArrayList<Ticket>();
String query = "select * from ticket where id = ?";
List<Map<String, Object>> rows = jdbcTemplate.queryForList(query, ticketId);
for (Map<?, ?> row : rows) {
ticket = new Ticket();
ticket.setId((Integer) (row.get("id")));
ticket.setVehicleId((Integer) row.get("vehicle_id"));
ticket.setParkingSpotId((Integer) row.get("parking_spot_id"));
ticket.setArrivalTime((Date) row.get("arrival_time"));
ticket.setDepartureTime((Date) row.get("departure_time"));
tickets.add(ticket);
}
return tickets.get(0);
}
public boolean isTicketExists(Ticket ticket) {
int ticketCount = 0;
String query = "select count(*) from ticket where id = ? and vehicle_id = ? and parking_spot_id = ? and departure_time is null";
Number number = jdbcTemplate.queryForObject(query,
new Object[] { ticket.getId(), ticket.getVehicleId(), ticket.getParkingSpotId() }, Number.class);
ticketCount = (number != null ? number.intValue() : 0);
if (ticketCount > 0) {
return true;
} else {
return false;
}
}
public void deleteTicket(Ticket ticket) throws InvalidTicket {
int count = jdbcTemplate.update("delete from ticket where ticket_id = ?", ticket.getId());
if (count > 0) {
throw new InvalidTicket("Invalid ticket can not delete the ticktet " + ticket.toString());
}
}
public boolean isValidTicket(int ticketId) {
int ticketCount = 0;
String query = "select count(*) from ticket t, vehicle v, parking_spot ps where "
+ " t.vehicle_id = v.id and t.parking_spot_id = ps.id and t.id = ? and "
+ " ps.occupied = ? and t.departure_time is null and v.departure_time is null";
Number number = jdbcTemplate.queryForObject(query, new Object[] { ticketId, "Y" }, Number.class);
ticketCount = (number != null ? number.intValue() : 0);
if (ticketCount > 0) {
return true;
} else {
return false;
}
}
public void deallocateTicket(Ticket ticket) {
jdbcTemplate.update("update ticket set departure_time = CURRENT TIMESTAMP where id = ?", ticket.getId());
}
public void cleanUp() {
jdbcTemplate.update("delete from ticket where departure_time is not null ");
}
}
|
UTF-8
|
Java
| 4,335
|
java
|
TicketDao.java
|
Java
|
[] | null |
[] |
package parking.management.dao;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import parking.management.exception.InvalidParking;
import parking.management.exception.InvalidTicket;
import parking.management.model.Ticket;
@Repository
@Qualifier("ticketDao")
public class TicketDao {
private static final Logger logger = LogManager.getLogger(TicketDao.class);
@Autowired
JdbcTemplate jdbcTemplate;
public Ticket createTicket(int vehicleId, int parkingSpotId) throws InvalidParking {
String query = "insert into ticket(id,vehicle_id, parking_spot_id, arrival_time, departure_time) "
+ "values (next value FOR ticket_id_seq, ?,?,?,?)";
logger.info("inserting tickets - ParkingSpot = " + parkingSpotId + " and vehicleId = " + vehicleId);
int ticketCount = jdbcTemplate.update(query, vehicleId, parkingSpotId, new Date(), null);
if (ticketCount > 0) {
return getTicket(vehicleId, parkingSpotId);
} else {
throw new InvalidParking("Sorry can not create ticket....");
}
}
public Ticket getTicket(int vehicleId, int parkingSpotId) {
List<Ticket> tickets = new ArrayList<Ticket>();
String query = "select * from ticket where vehicle_id = ? and parking_spot_id = ? and departure_time is null";
List<Map<String, Object>> rows = jdbcTemplate.queryForList(query, vehicleId, parkingSpotId);
for (Map<?, ?> row : rows) {
Ticket ticket = new Ticket();
ticket.setId((Integer) (row.get("id")));
ticket.setVehicleId((Integer) row.get("vehicle_id"));
ticket.setParkingSpotId((Integer) row.get("parking_spot_id"));
ticket.setArrivalTime((Date) row.get("arrival_time"));
ticket.setDepartureTime((Date) row.get("departure_time"));
tickets.add(ticket);
}
return tickets.get(0);
}
public Ticket getTicket(int ticketId) {
Ticket ticket = null;
List<Ticket> tickets = new ArrayList<Ticket>();
String query = "select * from ticket where id = ?";
List<Map<String, Object>> rows = jdbcTemplate.queryForList(query, ticketId);
for (Map<?, ?> row : rows) {
ticket = new Ticket();
ticket.setId((Integer) (row.get("id")));
ticket.setVehicleId((Integer) row.get("vehicle_id"));
ticket.setParkingSpotId((Integer) row.get("parking_spot_id"));
ticket.setArrivalTime((Date) row.get("arrival_time"));
ticket.setDepartureTime((Date) row.get("departure_time"));
tickets.add(ticket);
}
return tickets.get(0);
}
public boolean isTicketExists(Ticket ticket) {
int ticketCount = 0;
String query = "select count(*) from ticket where id = ? and vehicle_id = ? and parking_spot_id = ? and departure_time is null";
Number number = jdbcTemplate.queryForObject(query,
new Object[] { ticket.getId(), ticket.getVehicleId(), ticket.getParkingSpotId() }, Number.class);
ticketCount = (number != null ? number.intValue() : 0);
if (ticketCount > 0) {
return true;
} else {
return false;
}
}
public void deleteTicket(Ticket ticket) throws InvalidTicket {
int count = jdbcTemplate.update("delete from ticket where ticket_id = ?", ticket.getId());
if (count > 0) {
throw new InvalidTicket("Invalid ticket can not delete the ticktet " + ticket.toString());
}
}
public boolean isValidTicket(int ticketId) {
int ticketCount = 0;
String query = "select count(*) from ticket t, vehicle v, parking_spot ps where "
+ " t.vehicle_id = v.id and t.parking_spot_id = ps.id and t.id = ? and "
+ " ps.occupied = ? and t.departure_time is null and v.departure_time is null";
Number number = jdbcTemplate.queryForObject(query, new Object[] { ticketId, "Y" }, Number.class);
ticketCount = (number != null ? number.intValue() : 0);
if (ticketCount > 0) {
return true;
} else {
return false;
}
}
public void deallocateTicket(Ticket ticket) {
jdbcTemplate.update("update ticket set departure_time = CURRENT TIMESTAMP where id = ?", ticket.getId());
}
public void cleanUp() {
jdbcTemplate.update("delete from ticket where departure_time is not null ");
}
}
| 4,335
| 0.710727
| 0.707958
| 123
| 34.243904
| 32.369648
| 130
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 2.186992
| false
| false
|
2
|
92da7e80732f49b35932a009a06c1553136e1fe1
| 10,840,497,457,658
|
561ec8e2456d24e367b47b4145f71e108bda41d8
|
/Teoria_1/src/tema5_1_ArraysUnidimensionales/Comparison.java
|
1aff06825bd0120e5cf9c159023790323a3bfd20
|
[] |
no_license
|
fer9822/Boletines
|
https://github.com/fer9822/Boletines
|
a1c02c2ac95221e1109c9de234418a403b19b248
|
a83279bcb0883f35f9fc95689ce5b90b6ec2beda
|
refs/heads/master
| 2020-09-22T21:16:22.672000
| 2019-12-02T08:29:26
| 2019-12-02T08:29:26
| 225,322,624
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package tema5_1_ArraysUnidimensionales;
import java.util.Arrays;
public class Comparison {
public static void main(String[] args) {
int array1[];
int array2[]={3,4,5,6,7,8};
int array3[]={3,4,5,6,7,8};
array1=array2;
System.out.println(array1==array2);//true porque apuntan al mismo array
System.out.println(array2==array3);//false porque no apuntan al mismo array
System.out.println(array1.equals(array2));//true porque apuntan al mismo array
System.out.println(array2.equals(array3));//false porque no apuntan al mismo array
System.out.println(Arrays.equals(array1, array2));//true porque el contenido es el mismo ya que apuntan al mismo array
System.out.println(Arrays.equals(array2, array3));//true porque el contenido es el mismo
}
}
|
UTF-8
|
Java
| 771
|
java
|
Comparison.java
|
Java
|
[] | null |
[] |
package tema5_1_ArraysUnidimensionales;
import java.util.Arrays;
public class Comparison {
public static void main(String[] args) {
int array1[];
int array2[]={3,4,5,6,7,8};
int array3[]={3,4,5,6,7,8};
array1=array2;
System.out.println(array1==array2);//true porque apuntan al mismo array
System.out.println(array2==array3);//false porque no apuntan al mismo array
System.out.println(array1.equals(array2));//true porque apuntan al mismo array
System.out.println(array2.equals(array3));//false porque no apuntan al mismo array
System.out.println(Arrays.equals(array1, array2));//true porque el contenido es el mismo ya que apuntan al mismo array
System.out.println(Arrays.equals(array2, array3));//true porque el contenido es el mismo
}
}
| 771
| 0.735409
| 0.695201
| 22
| 34.045456
| 36.088879
| 120
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 2.272727
| false
| false
|
2
|
4ea70809b012fc73eaafd4bcb9861b5d954a8f92
| 19,988,777,853,682
|
b1df488f2a22df3f608186417b21642b6756f66b
|
/app/src/main/java/com/gitschwifty/cs2340/gatech/space_trader/View/SolarSystemActivity.java
|
fec41944769b070904778fc5fb732931e2481d56
|
[] |
no_license
|
hritiksapra/Space-Trader
|
https://github.com/hritiksapra/Space-Trader
|
3295c1c884d92a66490704998e3279c4c37fbb38
|
8256fbdd0534b6574716df669f7875c5ccd52f75
|
refs/heads/master
| 2020-06-24T01:00:48.491000
| 2019-08-25T23:33:56
| 2019-08-25T23:33:56
| 198,802,139
| 0
| 0
| null | true
| 2019-07-25T09:36:18
| 2019-07-25T09:36:18
| 2019-07-25T09:36:08
| 2019-04-23T00:57:55
| 18,580
| 0
| 0
| 0
| null | false
| false
|
package com.gitschwifty.cs2340.gatech.space_trader.View;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.gitschwifty.cs2340.gatech.space_trader.Model.CurrentPlanet;
import com.gitschwifty.cs2340.gatech.space_trader.Model.SolarSystem;
import com.gitschwifty.cs2340.gatech.space_trader.R;
import com.gitschwifty.cs2340.gatech.space_trader.ViewModel.MyAdapter;
import java.util.List;
public class SolarSystemActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_solar_system);
// for (int i = 0; i < 10; i ++) {
// TextView et = null;
// switch (i) {
// case 0: et = (TextView) findViewById(R.id.p1); break;
// case 1: et = (TextView) findViewById(R.id.p2); break;
// case 2: et = (TextView) findViewById(R.id.p3); break;
// case 3: et = (TextView) findViewById(R.id.p4); break;
// case 4: et = (TextView) findViewById(R.id.p5); break;
// case 5: et = (TextView) findViewById(R.id.p6); break;
// case 6: et = (TextView) findViewById(R.id.p7); break;
// case 7: et = (TextView) findViewById(R.id.p8); break;
// case 8: et = (TextView) findViewById(R.id.p9); break;
// case 9: et = (TextView) findViewById(R.id.p10); break;
// }
// et.setText(ss[i].toString());
// }
RecyclerView rv = (RecyclerView)findViewById(R.id.rv);
rv.setHasFixedSize(true);
LinearLayoutManager llm = new LinearLayoutManager(this);
rv.setLayoutManager(llm);
RecyclerView.Adapter mAdapter = new MyAdapter(LoginActivity.getNewPlayer().currShip.findAccessibleSystems());
rv.setAdapter(mAdapter);
}
public Context getCont() {
return this;
}
public void back(View v) {
startActivity(new Intent(SolarSystemActivity.this, CurrentPlanetActivity.class));
finishAndRemoveTask();
}
public void makeToast(String message) {
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
}
}
|
UTF-8
|
Java
| 2,549
|
java
|
SolarSystemActivity.java
|
Java
|
[] | null |
[] |
package com.gitschwifty.cs2340.gatech.space_trader.View;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.gitschwifty.cs2340.gatech.space_trader.Model.CurrentPlanet;
import com.gitschwifty.cs2340.gatech.space_trader.Model.SolarSystem;
import com.gitschwifty.cs2340.gatech.space_trader.R;
import com.gitschwifty.cs2340.gatech.space_trader.ViewModel.MyAdapter;
import java.util.List;
public class SolarSystemActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_solar_system);
// for (int i = 0; i < 10; i ++) {
// TextView et = null;
// switch (i) {
// case 0: et = (TextView) findViewById(R.id.p1); break;
// case 1: et = (TextView) findViewById(R.id.p2); break;
// case 2: et = (TextView) findViewById(R.id.p3); break;
// case 3: et = (TextView) findViewById(R.id.p4); break;
// case 4: et = (TextView) findViewById(R.id.p5); break;
// case 5: et = (TextView) findViewById(R.id.p6); break;
// case 6: et = (TextView) findViewById(R.id.p7); break;
// case 7: et = (TextView) findViewById(R.id.p8); break;
// case 8: et = (TextView) findViewById(R.id.p9); break;
// case 9: et = (TextView) findViewById(R.id.p10); break;
// }
// et.setText(ss[i].toString());
// }
RecyclerView rv = (RecyclerView)findViewById(R.id.rv);
rv.setHasFixedSize(true);
LinearLayoutManager llm = new LinearLayoutManager(this);
rv.setLayoutManager(llm);
RecyclerView.Adapter mAdapter = new MyAdapter(LoginActivity.getNewPlayer().currShip.findAccessibleSystems());
rv.setAdapter(mAdapter);
}
public Context getCont() {
return this;
}
public void back(View v) {
startActivity(new Intent(SolarSystemActivity.this, CurrentPlanetActivity.class));
finishAndRemoveTask();
}
public void makeToast(String message) {
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
}
}
| 2,549
| 0.657513
| 0.639074
| 63
| 39.460316
| 27.101118
| 117
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.888889
| false
| false
|
2
|
fae2a07d5eb6793f07f5ec814255e18daf8dc6e5
| 32,117,765,447,044
|
31382a1bde9e1ecb44524c884bc5cad2550001ee
|
/com.crimore.server/HotelBookingServer.java
|
a6712bce983d3a3cdf9b114e1d95016281248343
|
[] |
no_license
|
kuerrymau/HotelBookingServer
|
https://github.com/kuerrymau/HotelBookingServer
|
a0e94b1814ad5d20896587504539072be311e8ed
|
faa25910fbf64fdd91d86260320e6044864bcae9
|
refs/heads/master
| 2016-09-05T12:26:02.985000
| 2015-09-17T19:39:46
| 2015-09-17T19:39:46
| 42,677,559
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
import org.apache.thrift.server.TServer;
import org.apache.thrift.server.TServer.Args;
import org.apache.thrift.server.TSimpleServer;
import org.apache.thrift.server.TThreadPoolServer;
import org.apache.thrift.transport.TSSLTransportFactory;
import org.apache.thrift.transport.TServerSocket;
import org.apache.thrift.transport.TServerTransport;
import org.apache.thrift.transport.TSSLTransportFactory.TSSLTransportParameters;
import java.util.HashMap;
public class HotelBookingServer {
public static BookingManagerHandler handler;
public static BookingManager.Processor processor;
public static void main(String[] args) {
try {
handler = new BookingManagerHandler();
processor = new BookingManager.Processor(handler);
Runnable secure = new Runnable() {
public void run() {
secure(processor);
}
};
new Thread(simple).start();
new Thread(secure).start();
} catch (Exception x) {
x.printStackTrace();
}
}
public static void secure(BookingManager.Processor processor) {
try {
TSSLTransportParameters params = new TSSLTransportParameters();
params.setKeyStore("C:\\_store for crimore\\tools\\lib\\debug.keystore", "thrift", null, null);
TServerTransport tServerTransport = TSSLTransportFactory.getServerSocket(9091, 0, null, params);
TServer tServer = new TSimpleServer(new Args(tServerTransport).processor(processor));
System.out.println("Starting the secure server...");
tServer.serve();
} catch (Exception e) {
e.printStackTrace();
}
}
}
|
UTF-8
|
Java
| 1,737
|
java
|
HotelBookingServer.java
|
Java
|
[] | null |
[] |
import org.apache.thrift.server.TServer;
import org.apache.thrift.server.TServer.Args;
import org.apache.thrift.server.TSimpleServer;
import org.apache.thrift.server.TThreadPoolServer;
import org.apache.thrift.transport.TSSLTransportFactory;
import org.apache.thrift.transport.TServerSocket;
import org.apache.thrift.transport.TServerTransport;
import org.apache.thrift.transport.TSSLTransportFactory.TSSLTransportParameters;
import java.util.HashMap;
public class HotelBookingServer {
public static BookingManagerHandler handler;
public static BookingManager.Processor processor;
public static void main(String[] args) {
try {
handler = new BookingManagerHandler();
processor = new BookingManager.Processor(handler);
Runnable secure = new Runnable() {
public void run() {
secure(processor);
}
};
new Thread(simple).start();
new Thread(secure).start();
} catch (Exception x) {
x.printStackTrace();
}
}
public static void secure(BookingManager.Processor processor) {
try {
TSSLTransportParameters params = new TSSLTransportParameters();
params.setKeyStore("C:\\_store for crimore\\tools\\lib\\debug.keystore", "thrift", null, null);
TServerTransport tServerTransport = TSSLTransportFactory.getServerSocket(9091, 0, null, params);
TServer tServer = new TSimpleServer(new Args(tServerTransport).processor(processor));
System.out.println("Starting the secure server...");
tServer.serve();
} catch (Exception e) {
e.printStackTrace();
}
}
}
| 1,737
| 0.660334
| 0.657455
| 50
| 33.759998
| 28.757998
| 108
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.62
| false
| false
|
2
|
66db7981a1cc225c23342b51382a9652b453594f
| 26,121,991,157,573
|
f6f834eb681701c2b5ca8ab6498845e9f950e2c6
|
/org.javabip.spec.examples/src/main/java/org/javabip/spec/Feeder.java
|
83b51f6e5b1b4e38c672295a81afa6067e98bd98
|
[] |
no_license
|
sbliudze/javabip-core
|
https://github.com/sbliudze/javabip-core
|
4a3298a64a2e517b4b05b1e438296515a830fa85
|
f29ee5a3f37f8be32754b08eb0e605c5cc211986
|
refs/heads/master
| 2023-04-26T20:43:40.717000
| 2023-04-15T21:24:03
| 2023-04-15T21:24:03
| 76,493,830
| 6
| 5
| null | false
| 2023-04-15T21:24:05
| 2016-12-14T20:20:33
| 2022-09-07T16:09:33
| 2023-04-15T21:24:03
| 2,944
| 5
| 6
| 4
|
Java
| false
| false
|
/*
* Copyright 2012-2016 École polytechnique fédérale de Lausanne (EPFL), Switzerland
* Copyright 2012-2016 Crossing-Tech SA, Switzerland
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Author: Simon Bliudze, Anastasia Mavridou, Radoslaw Szymanek and Alina Zolotukhina
*/
package org.javabip.spec;
import org.javabip.annotations.*;
import org.javabip.api.PortType;
import org.javabip.api.DataOut.AccessType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Ports({ @Port(name = "giveY", type = PortType.enforceable), @Port(name = "giveZ", type = PortType.enforceable),
@Port(name = "returnY", type = PortType.enforceable), @Port(name = "returnZ", type = PortType.enforceable) })
@ComponentType(initial = "zero", name = "org.bip.spec.Feeder")
public class Feeder {
Logger logger = LoggerFactory.getLogger(Feeder.class);
private int memoryY = 200;
private int memoryZ = 300;
public int noOfTransitions = 0;
@Transition(name = "giveY", source = "zero", target = "oneY")
public void changeY() {
logger.debug("Transition Y has been performed");
noOfTransitions++;
}
@Transition(name = "returnY", source = "oneY", target = "zero")
public void returnY() {
logger.debug("Transition from oneY to zero has been performed");
noOfTransitions++;
}
@Transition(name = "giveZ", source = "zero", target = "oneZ")
public void changeZ() {
logger.debug("Transition Z has been performed");
noOfTransitions++;
}
@Transition(name = "returnZ", source = "oneZ", target = "zero")
public void returnZ() {
logger.debug("Transition from oneZ to zero has been performed");
noOfTransitions++;
}
@Data(name = "memoryY", accessTypePort = AccessType.allowed, ports = { "giveY" })
public int memoryY() {
return memoryY;
}
@Data(name = "memoryZ", accessTypePort = AccessType.allowed, ports = { "giveZ" })
public int memoryZ() {
return memoryZ;
}
}
|
UTF-8
|
Java
| 2,401
|
java
|
Feeder.java
|
Java
|
[
{
"context": "nd\n * limitations under the License.\n *\n * Author: Simon Bliudze, Anastasia Mavridou, Radoslaw Szymanek and Alina ",
"end": 728,
"score": 0.9998576045036316,
"start": 715,
"tag": "NAME",
"value": "Simon Bliudze"
},
{
"context": "ns under the License.\n *\n * Author: Simon Bliudze, Anastasia Mavridou, Radoslaw Szymanek and Alina Zolotukhina\n */\npack",
"end": 748,
"score": 0.9998612999916077,
"start": 730,
"tag": "NAME",
"value": "Anastasia Mavridou"
},
{
"context": ".\n *\n * Author: Simon Bliudze, Anastasia Mavridou, Radoslaw Szymanek and Alina Zolotukhina\n */\npackage org.javabip.spe",
"end": 767,
"score": 0.9998631477355957,
"start": 750,
"tag": "NAME",
"value": "Radoslaw Szymanek"
},
{
"context": "Bliudze, Anastasia Mavridou, Radoslaw Szymanek and Alina Zolotukhina\n */\npackage org.javabip.spec;\n\nimport org.javabip",
"end": 789,
"score": 0.9998735785484314,
"start": 772,
"tag": "NAME",
"value": "Alina Zolotukhina"
}
] | null |
[] |
/*
* Copyright 2012-2016 École polytechnique fédérale de Lausanne (EPFL), Switzerland
* Copyright 2012-2016 Crossing-Tech SA, Switzerland
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Author: <NAME>, <NAME>, <NAME> and <NAME>
*/
package org.javabip.spec;
import org.javabip.annotations.*;
import org.javabip.api.PortType;
import org.javabip.api.DataOut.AccessType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Ports({ @Port(name = "giveY", type = PortType.enforceable), @Port(name = "giveZ", type = PortType.enforceable),
@Port(name = "returnY", type = PortType.enforceable), @Port(name = "returnZ", type = PortType.enforceable) })
@ComponentType(initial = "zero", name = "org.bip.spec.Feeder")
public class Feeder {
Logger logger = LoggerFactory.getLogger(Feeder.class);
private int memoryY = 200;
private int memoryZ = 300;
public int noOfTransitions = 0;
@Transition(name = "giveY", source = "zero", target = "oneY")
public void changeY() {
logger.debug("Transition Y has been performed");
noOfTransitions++;
}
@Transition(name = "returnY", source = "oneY", target = "zero")
public void returnY() {
logger.debug("Transition from oneY to zero has been performed");
noOfTransitions++;
}
@Transition(name = "giveZ", source = "zero", target = "oneZ")
public void changeZ() {
logger.debug("Transition Z has been performed");
noOfTransitions++;
}
@Transition(name = "returnZ", source = "oneZ", target = "zero")
public void returnZ() {
logger.debug("Transition from oneZ to zero has been performed");
noOfTransitions++;
}
@Data(name = "memoryY", accessTypePort = AccessType.allowed, ports = { "giveY" })
public int memoryY() {
return memoryY;
}
@Data(name = "memoryZ", accessTypePort = AccessType.allowed, ports = { "giveZ" })
public int memoryZ() {
return memoryZ;
}
}
| 2,360
| 0.714762
| 0.702669
| 71
| 32.774647
| 30.033876
| 112
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.309859
| false
| false
|
2
|
a0fa00dd34c5ba51094a6ee41f688f467a412bd3
| 23,192,823,402,080
|
a7389e877a76dbb7c2880b366615de9b8168d9a5
|
/leetcode/src/main/java/array/L_229_majorNum.java
|
db9325e52dddc731f9a919526465f665a778eadd
|
[] |
no_license
|
Carmon-Lee/gadget
|
https://github.com/Carmon-Lee/gadget
|
9161fd7d6b70e1b603f3ac96433368f213f9312e
|
6af0be669f9eff449169f948f83029ea9bd461b5
|
refs/heads/master
| 2023-08-29T05:44:23.884000
| 2021-11-06T09:46:12
| 2021-11-06T09:46:12
| 298,931,546
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* frxs Inc. 湖南兴盛优选电子商务有限公司.
* Copyright (c) 2017-2019. All Rights Reserved.
*/
package array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @author liguang
* @version L_229_majorNum.java, v 0.1 2020年10月17日 16:32
*
* 给定一个大小为n的数组,找出其中所有出现超过⌊ n/3 ⌋次的元素。
*
* 进阶:尝试设计时间复杂度为 O(n)、空间复杂度为 O(1)的算法解决此问题。
*
*
*
* 示例1:
*
* 输入:[3,2,3]
* 输出:[3]
* 示例 2:
*
* 输入:nums = [1]
* 输出:[1]
* 示例 3:
*
* 输入:[1,1,1,3,3,2,2,2]
* 输出:[1,2]
*
* 来源:力扣(LeetCode)
* 链接:https://leetcode-cn.com/problems/majority-element-ii
* 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
*/
public class L_229_majorNum {
public List<Integer> majorityElement(int[] nums) {
Arrays.sort(nums);
List<Integer> res = new ArrayList<>();
int oneThird = nums.length / 3;
int prevIdx = 0;
for (int i = 1; i < nums.length; i++) {
if (nums[i] != nums[prevIdx]) {
if (i - prevIdx > oneThird) {
res.add(nums[prevIdx]);
}
prevIdx = i;
}
}
if (nums.length - prevIdx > oneThird) {
res.add(nums[prevIdx]);
}
return res;
}
public static void main(String[] args) {
// System.out.println(new L_229_majorNum().majorityElement(new int[]{1,1,1,2,2,2,3}));;
System.out.println(new L_229_majorNum().majorityElement(new int[]{3,2,3}));;
}
}
|
UTF-8
|
Java
| 1,723
|
java
|
L_229_majorNum.java
|
Java
|
[
{
"context": "til.Arrays;\nimport java.util.List;\n\n/**\n * @author liguang\n * @version L_229_majorNum.java, v 0.1 2020年10月17",
"end": 201,
"score": 0.9994140267372131,
"start": 194,
"tag": "USERNAME",
"value": "liguang"
}
] | null |
[] |
/*
* frxs Inc. 湖南兴盛优选电子商务有限公司.
* Copyright (c) 2017-2019. All Rights Reserved.
*/
package array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @author liguang
* @version L_229_majorNum.java, v 0.1 2020年10月17日 16:32
*
* 给定一个大小为n的数组,找出其中所有出现超过⌊ n/3 ⌋次的元素。
*
* 进阶:尝试设计时间复杂度为 O(n)、空间复杂度为 O(1)的算法解决此问题。
*
*
*
* 示例1:
*
* 输入:[3,2,3]
* 输出:[3]
* 示例 2:
*
* 输入:nums = [1]
* 输出:[1]
* 示例 3:
*
* 输入:[1,1,1,3,3,2,2,2]
* 输出:[1,2]
*
* 来源:力扣(LeetCode)
* 链接:https://leetcode-cn.com/problems/majority-element-ii
* 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
*/
public class L_229_majorNum {
public List<Integer> majorityElement(int[] nums) {
Arrays.sort(nums);
List<Integer> res = new ArrayList<>();
int oneThird = nums.length / 3;
int prevIdx = 0;
for (int i = 1; i < nums.length; i++) {
if (nums[i] != nums[prevIdx]) {
if (i - prevIdx > oneThird) {
res.add(nums[prevIdx]);
}
prevIdx = i;
}
}
if (nums.length - prevIdx > oneThird) {
res.add(nums[prevIdx]);
}
return res;
}
public static void main(String[] args) {
// System.out.println(new L_229_majorNum().majorityElement(new int[]{1,1,1,2,2,2,3}));;
System.out.println(new L_229_majorNum().majorityElement(new int[]{3,2,3}));;
}
}
| 1,723
| 0.545708
| 0.498255
| 65
| 21.061539
| 21.152834
| 94
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.569231
| false
| false
|
2
|
9efdb6ac6578e7fcbd836db5fc3263324b9310f5
| 24,747,601,603,202
|
58638dffc7e91681734c3daac2d478d72565a9b4
|
/train_4.java
|
d44ef31d9af358aec217494319769054af0abbac
|
[] |
no_license
|
zhd19950423/Train
|
https://github.com/zhd19950423/Train
|
6ded1f8c8624c9657dfbee6bda5a50bad88a5ddd
|
394866f900bd89b761d1c154ce098265e48e8b8c
|
refs/heads/master
| 2021-04-06T05:38:33.035000
| 2018-09-15T04:22:32
| 2018-09-15T04:22:32
| 124,630,155
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package offer_train;
/*
* 输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。
* 假设输入的前序遍历和中序遍历的结果中都不含重复的数字。
* 例如输入前序遍历序列{1,2,4,7,3,5,6,8}和中序遍历序列{4,7,2,1,5,3,8,6},则重建二叉树并返回。
*/
public class train_4 {
public train_4() {
// TODO Auto-generated constructor stub
}
public TreeNode reConstructBinaryTree(int [] pre,int [] in) {
TreeNode root = new TreeNode(pre[0]);
this.findChild(root, pre, in);
TreeNode result = root;
return result;
}
public void findChild(TreeNode root, int [] pre,int [] in) {
System.out.println("findChild");
int index = 0;
for(int i = 0; i < in.length; i++) {
if (pre[0] == in[i]) {
index = i;
break;
}
}
int[] leftpre = null;
int[] leftin = null;
int[] rightpre = null;
int[] rightin = null;
if(index > 0) {
TreeNode leftchild = new TreeNode(pre[1]);
root.left = leftchild;
leftpre = this.getsub(pre, 1, index + 1);
System.out.println("findChild");
leftin = this.getsub(in, 0, index);
findChild(leftchild, leftpre, leftin);
}
if(index < in.length - 1) {
TreeNode rightchild = new TreeNode(pre[index + 1]);
root.right = rightchild;
rightpre = this.getsub(pre, index + 1, pre.length);
rightin = this.getsub(in, index + 1, in.length);
findChild(rightchild, rightpre, rightin);
}
}
public int[] getsub(int[] A,int start, int end) {
int[] sub = new int[end - start];
for (int i = start, j = 0; i < end; i++,j++) {
sub[j] = A[i];
}
return sub;
}
public static void main(String[] args) {
int[] pre = {1,2,3,4,5,6,7};
int[] in = {3,2,4,1,6,5,7};
train_4 train = new train_4();
TreeNode result = train.reConstructBinaryTree(pre, in);
System.out.println(result.left.right.val);
}
}
|
UTF-8
|
Java
| 1,881
|
java
|
train_4.java
|
Java
|
[] | null |
[] |
package offer_train;
/*
* 输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。
* 假设输入的前序遍历和中序遍历的结果中都不含重复的数字。
* 例如输入前序遍历序列{1,2,4,7,3,5,6,8}和中序遍历序列{4,7,2,1,5,3,8,6},则重建二叉树并返回。
*/
public class train_4 {
public train_4() {
// TODO Auto-generated constructor stub
}
public TreeNode reConstructBinaryTree(int [] pre,int [] in) {
TreeNode root = new TreeNode(pre[0]);
this.findChild(root, pre, in);
TreeNode result = root;
return result;
}
public void findChild(TreeNode root, int [] pre,int [] in) {
System.out.println("findChild");
int index = 0;
for(int i = 0; i < in.length; i++) {
if (pre[0] == in[i]) {
index = i;
break;
}
}
int[] leftpre = null;
int[] leftin = null;
int[] rightpre = null;
int[] rightin = null;
if(index > 0) {
TreeNode leftchild = new TreeNode(pre[1]);
root.left = leftchild;
leftpre = this.getsub(pre, 1, index + 1);
System.out.println("findChild");
leftin = this.getsub(in, 0, index);
findChild(leftchild, leftpre, leftin);
}
if(index < in.length - 1) {
TreeNode rightchild = new TreeNode(pre[index + 1]);
root.right = rightchild;
rightpre = this.getsub(pre, index + 1, pre.length);
rightin = this.getsub(in, index + 1, in.length);
findChild(rightchild, rightpre, rightin);
}
}
public int[] getsub(int[] A,int start, int end) {
int[] sub = new int[end - start];
for (int i = start, j = 0; i < end; i++,j++) {
sub[j] = A[i];
}
return sub;
}
public static void main(String[] args) {
int[] pre = {1,2,3,4,5,6,7};
int[] in = {3,2,4,1,6,5,7};
train_4 train = new train_4();
TreeNode result = train.reConstructBinaryTree(pre, in);
System.out.println(result.left.right.val);
}
}
| 1,881
| 0.61296
| 0.584939
| 65
| 25.353846
| 18.334021
| 65
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 3.169231
| false
| false
|
2
|
0eb732911e7dd795f32a3ac51fcd8b6e8ee13dbf
| 13,142,599,962,603
|
7f09e73c6bfd02fc2d43a4f52095d0c7691e133b
|
/src/Exercise7.java
|
a921a68596f8826ca9bf82362f01046139d743d3
|
[] |
no_license
|
RasaAbra/JavaProjects
|
https://github.com/RasaAbra/JavaProjects
|
48d363c4c8ad34aed48538d78cf9dba65e83e3fd
|
49e0d246748c38ea2ef04a9b4463f8a99d4ce4c9
|
refs/heads/master
| 2022-11-11T05:44:47.768000
| 2020-06-27T06:32:33
| 2020-06-27T06:32:33
| 275,311,596
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
public class Exercise7 {
public static void main(String args[])
{String text = "This is Java!";
int length = text.length();
System.out.println(length);
}
}
|
UTF-8
|
Java
| 178
|
java
|
Exercise7.java
|
Java
|
[] | null |
[] |
public class Exercise7 {
public static void main(String args[])
{String text = "This is Java!";
int length = text.length();
System.out.println(length);
}
}
| 178
| 0.623595
| 0.617977
| 7
| 24.428572
| 14.450479
| 42
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.428571
| false
| false
|
2
|
dbdd80c13e38bdbd32ddfe0af80023a81e84a04a
| 6,055,903,912,881
|
fd8cbd1e18f60f8ec40ddcf29a56fc81d03e1d2b
|
/app/src/main/java/org/jboard/jboard/login/LoginView.java
|
b849d667cb2a8932832f1777f9395c6844c37ecc
|
[] |
no_license
|
rightmonkey/jboard-android
|
https://github.com/rightmonkey/jboard-android
|
0ead25be903cc8c3c0da097acab21f129db26a85
|
786f52abe3bf57c3d3ee6aa102020994eb4ff94f
|
refs/heads/master
| 2018-03-07T16:39:29.215000
| 2017-02-22T00:11:16
| 2017-02-22T00:11:16
| 64,579,172
| 0
| 0
| null | false
| 2016-08-13T04:41:18
| 2016-07-31T05:51:53
| 2016-07-31T05:53:28
| 2016-08-13T03:06:57
| 186
| 0
| 0
| 1
|
Java
| null | null |
package org.jboard.jboard.login;
/**
* Created by ezcurdia on 8/27/16.
*/
public interface LoginView {
void setToken(String token);
void showProgress();
void hideProgress();
void showFailureMessage();
void navigateToMain();
void navigateToRegister();
}
|
UTF-8
|
Java
| 280
|
java
|
LoginView.java
|
Java
|
[
{
"context": "ackage org.jboard.jboard.login;\n\n/**\n * Created by ezcurdia on 8/27/16.\n */\npublic interface LoginView {\n ",
"end": 60,
"score": 0.9995952248573303,
"start": 52,
"tag": "USERNAME",
"value": "ezcurdia"
}
] | null |
[] |
package org.jboard.jboard.login;
/**
* Created by ezcurdia on 8/27/16.
*/
public interface LoginView {
void setToken(String token);
void showProgress();
void hideProgress();
void showFailureMessage();
void navigateToMain();
void navigateToRegister();
}
| 280
| 0.685714
| 0.667857
| 13
| 20.538462
| 12.863875
| 34
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.538462
| false
| false
|
2
|
8a03aa3a114488021830dfa1fcc855f7015d0d4e
| 3,023,656,984,674
|
df7e7aad37d1bc4db3261d4d8e88e741baf7c69a
|
/src/main/java/frankdevhub/inkstone/upload/google/drive/ftp/adapter/model/SQLCache.java
|
a685e955ee36d993d3eece40d698eb92b4132eeb
|
[
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] |
permissive
|
00mjk/inkstone-webnovel-upload
|
https://github.com/00mjk/inkstone-webnovel-upload
|
8b8b71728a6b25e0658aabde57957eab122a19f1
|
9996127438e88f0a464af745ebe54fd8443c21f5
|
refs/heads/master
| 2023-02-13T04:47:16.315000
| 2019-08-04T15:28:08
| 2019-08-04T15:28:08
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package nyoibo.inkstone.upload.google.drive.ftp.adapter.model;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.dao.IncorrectResultSizeDataAccessException;
import org.springframework.jdbc.core.ArgumentPreparedStatementSetter;
import org.springframework.jdbc.core.ConnectionCallback;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementSetter;
import org.springframework.jdbc.core.RowMapper;
/**
* <p>Title:SQLCache.java</p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2019</p>
* <p>Company: www.frankdevhub.site</p>
* <p>github: https://github.com/frankdevhub</p>
* @author frankdevhub
* @date:2019-04-23 16:32
*/
public class SQLCache implements Cache {
private static final Log LOGGER = LogFactory.getLog(SQLCache.class);
private static final String TABLE_FILES = "files";
private static final String TABLE_CHILDS = "childs";
private static final String TABLE_PARAMETERS = "parameters";
private final RowMapper<GFile> rowMapper;
private final RowMapper<String> parentIdMapper = (rs, rowNum) -> rs.getString("parentId");
private final JdbcTemplate jdbcTemplate;
private final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock();
private final Lock r = rwl.readLock();
private final Lock w = rwl.writeLock();
private final AtomicLong childId = new AtomicLong(System.currentTimeMillis());
public SQLCache(String driverClassName, String jdbcUrl) {
LOGGER.info("JDBC Driver: '" + driverClassName + "'...");
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(driverClassName);
dataSource.setUrl(jdbcUrl);
// dataSource.setMaxActive(1);
dataSource.setMaxWait(60000);
jdbcTemplate = new JdbcTemplate(dataSource);
rowMapper = (rs, rowNum) -> {
GFile ret = new GFile(null);
ret.setId(rs.getString("id"));
ret.setName(rs.getString("filename"));
ret.setRevision(rs.getString("revision"));
ret.setDirectory(rs.getBoolean("isDirectory"));
ret.setSize(rs.getLong("size"));
ret.setLastModified(rs.getLong("lastModified"));
ret.setMimeType(rs.getString("mimeType"));
ret.setMd5Checksum(rs.getString("md5Checksum"));
ret.setExists(true);
return ret;
};
Integer ret = null;
try {
ret = jdbcTemplate.queryForObject("SELECT value FROM " + TABLE_PARAMETERS + " where id='revision'",
Integer.class);
LOGGER.info("Database found");
} catch (DataAccessException e) {
List<String> queries = new ArrayList<>();
queries.add("create table " + TABLE_FILES + " (id character varying(100), revision character varying(100), "
+ "filename character varying(100) not null, isDirectory boolean, size bigint, lastModified bigint, mimeType character varying(100), "
+ "md5Checksum character varying(100), primary key (id))");
queries.add("create table " + TABLE_CHILDS
+ " (id bigint primary key, childId character varying(100) references " + TABLE_FILES
+ "(id), parentId character varying(100) references " + TABLE_FILES
+ "(id), unique (childId, parentId))");
queries.add("create table " + TABLE_PARAMETERS
+ " (id character varying(100), value character varying(100), primary key (id))");
queries.add("create index idx_filename on " + TABLE_FILES + " (filename)");
queries.add("insert into " + TABLE_PARAMETERS + " (id,value) values('revision',null)");
jdbcTemplate.batchUpdate(queries.toArray(new String[0]));
LOGGER.info("Database created");
}
}
@Override
public GFile getFile(String id) {
r.lock();
try {
LOGGER.trace("getFile(" + id + ")");
return jdbcTemplate.queryForObject("select * from " + TABLE_FILES + " where id=?", new Object[] { id },
rowMapper);
} catch (EmptyResultDataAccessException ex) {
return null;
} finally {
r.unlock();
}
}
public int addOrUpdateFile(GFile file) {
List<String> queries = new ArrayList<>();
List<Object[]> args = new ArrayList<>();
GFile cachedFile = getFile(file.getId());
if (cachedFile == null) {
queries.add("insert into " + TABLE_FILES
+ " (id,revision,filename,isDirectory,size,lastModified,mimeType,md5checksum)"
+ " values(?,?,?,?,?,?,?,?)");
args.add(new Object[] { file.getId(), file.getRevision(), file.getName(), file.isDirectory(),
file.getSize(), file.getLastModified(), file.getMimeType(), file.getMd5Checksum() });
} else {
queries.add("update " + TABLE_FILES
+ " set revision=?,filename=?,isDirectory=?,size=?,lastModified=?,mimeType=?,md5checksum=?"
+ " where id=?");
args.add(new Object[] { file.getRevision(), file.getName(), file.isDirectory(), file.getSize(),
file.getLastModified(), file.getMimeType(), file.getMd5Checksum(), file.getId() });
}
updateParents(file, queries, args);
return executeInTransaction(queries, args);
}
public void updateChilds(GFile file, List<GFile> childs) {
List<String> queries = new ArrayList<>();
List<Object[]> args = new ArrayList<>();
queries.add("delete from " + TABLE_CHILDS + " where parentId=?");
args.add(new Object[] { file.getId() });
queries.add("update " + TABLE_FILES
+ " set revision=?,filename=?,isDirectory=?,size=?,lastModified=?,mimeType=?,md5checksum=? where id=?");
args.add(new Object[] { file.getRevision(), file.getName(), file.isDirectory(), file.getSize(),
file.getLastModified(), file.getMimeType(), file.getMd5Checksum(), file.getId() });
for (GFile child : childs) {
GFile cachedChild = getFile(child.getId());
if (cachedChild == null) {
queries.add("insert into " + TABLE_FILES
+ " (id,revision,filename,isDirectory,size,lastModified,mimeType,md5checksum)"
+ " values(?,?,?,?,?,?,?,?)");
args.add(new Object[] { child.getId(), child.getRevision(), child.getName(), child.isDirectory(),
child.getSize(), child.getLastModified(), child.getMimeType(), child.getMd5Checksum() });
} else {
queries.add("update " + TABLE_FILES
+ " set revision=?,filename=?,isDirectory=?,size=?,lastModified=?,mimeType=?,md5checksum=?"
+ " where id=?");
args.add(new Object[] { child.getRevision(), child.getName(), child.isDirectory(), child.getSize(),
child.getLastModified(), child.getMimeType(), child.getMd5Checksum(), child.getId() });
}
queries.add("insert into " + TABLE_CHILDS + " (id,childId,parentId) values(?,?,?)");
args.add(new Object[] { childId.getAndIncrement(), child.getId(), file.getId() });
}
executeInTransaction(queries, args);
}
private void updateParents(GFile file, List<String> queries, List<Object[]> args) {
queries.add("delete from " + TABLE_CHILDS + " where childId=?");
args.add(new Object[] { file.getId() });
for (String parent : file.getParents()) {
queries.add("insert into " + TABLE_CHILDS + " (id,childId,parentId) values(?,?,?)");
args.add(new Object[] { childId.getAndIncrement(), file.getId(), parent });
}
}
private int executeInTransaction(final List<String> queries, final List<Object[]> args) {
return jdbcTemplate.execute((ConnectionCallback<Integer>) connection -> {
w.lock();
try {
connection.setAutoCommit(false);
int ret = 0;
for (int i = 0; i < queries.size(); i++) {
if (args == null || args.get(i) == null) {
ret += connection.createStatement().executeUpdate(queries.get(i));
} else {
PreparedStatement ps = connection.prepareStatement(queries.get(i));
PreparedStatementSetter psSetter = new ArgumentPreparedStatementSetter(args.get(i));
psSetter.setValues(ps);
ret += ps.executeUpdate();
}
}
connection.commit();
return ret;
} catch (Exception ex) {
LOGGER.error("Error executing transaction. " + ex.getMessage());
/*
* for (int i = 0; i < queries.size(); i++) {
* LOG.error("Query '" + queries.get(i) + "' " + (args != null
* && i < args.size() ? " args:" + Arrays.toString(args.get(i))
* : "") + "' "); }
*/
throw new RuntimeException(ex);
} finally {
try {
connection.setAutoCommit(true);
} catch (SQLException e) {
throw new RuntimeException(e);
}
w.unlock();
}
});
}
@Override
public List<GFile> getFiles(String parentId) {
System.out.println();
r.lock();
try {
return jdbcTemplate.query(
"select " + TABLE_FILES + ".* from " + TABLE_FILES + "," + TABLE_CHILDS + " where " + TABLE_CHILDS
+ ".childId=" + TABLE_FILES + ".id and " + TABLE_CHILDS + ".parentId=?",
new Object[] { parentId }, rowMapper);
} finally {
r.unlock();
}
}
public List<String> getAllFoldersWithoutRevision() {
r.lock();
try {
return jdbcTemplate.queryForList(
"select id from " + TABLE_FILES + " where isDirectory=1 and revision is null", String.class);
} finally {
r.unlock();
}
}
@Override
public GFile getFileByName(String parentId, String filename) throws IncorrectResultSizeDataAccessException {
r.lock();
try {
return jdbcTemplate.queryForObject("select " + TABLE_FILES + ".* from " + TABLE_CHILDS + "," + TABLE_FILES
+ " where " + TABLE_CHILDS + ".childId=" + TABLE_FILES + ".id and " + TABLE_CHILDS
+ ".parentId=? and " + TABLE_FILES + ".filename=?", new Object[] { parentId, filename }, rowMapper);
} catch (EmptyResultDataAccessException ex) {
return null;
} finally {
r.unlock();
}
}
public int deleteFile(String id) {
List<String> queries = new ArrayList<>();
List<Object[]> args = new ArrayList<>();
queries.add("delete from " + TABLE_CHILDS + " where parentId=?");
queries.add("delete from " + TABLE_CHILDS + " where childId=?");
queries.add("delete from " + TABLE_FILES + " where id=?");
args.add(new Object[] { id });
args.add(new Object[] { id });
args.add(new Object[] { id });
return executeInTransaction(queries, args);
}
public String getRevision() {
r.lock();
try {
return jdbcTemplate.queryForObject("select value from " + TABLE_PARAMETERS + " where id='revision'",
String.class);
} finally {
r.unlock();
}
}
public void updateRevision(String revision) {
jdbcTemplate.update("update " + TABLE_PARAMETERS + " set value=? where id='revision'", revision);
}
public Set<String> getParents(String fileId) {
r.lock();
try {
return new HashSet<>(jdbcTemplate.query("select parentId from " + TABLE_CHILDS + " where childId=?",
new Object[] { fileId }, parentIdMapper));
} catch (EmptyResultDataAccessException ex) {
return null;
} finally {
r.unlock();
}
}
}
|
UTF-8
|
Java
| 11,018
|
java
|
SQLCache.java
|
Java
|
[
{
"context": "kdevhub.site</p>\n * <p>github: https://github.com/frankdevhub</p> \n * @author frankdevhub \n * @date:2019-04-",
"end": 1171,
"score": 0.9995647072792053,
"start": 1160,
"tag": "USERNAME",
"value": "frankdevhub"
},
{
"context": "b: https://github.com/frankdevhub</p> \n * @author frankdevhub \n * @date:2019-04-23 16:32\n */\n\npublic class SQ",
"end": 1200,
"score": 0.9988407492637634,
"start": 1189,
"tag": "USERNAME",
"value": "frankdevhub"
}
] | null |
[] |
package nyoibo.inkstone.upload.google.drive.ftp.adapter.model;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.dao.IncorrectResultSizeDataAccessException;
import org.springframework.jdbc.core.ArgumentPreparedStatementSetter;
import org.springframework.jdbc.core.ConnectionCallback;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementSetter;
import org.springframework.jdbc.core.RowMapper;
/**
* <p>Title:SQLCache.java</p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2019</p>
* <p>Company: www.frankdevhub.site</p>
* <p>github: https://github.com/frankdevhub</p>
* @author frankdevhub
* @date:2019-04-23 16:32
*/
public class SQLCache implements Cache {
private static final Log LOGGER = LogFactory.getLog(SQLCache.class);
private static final String TABLE_FILES = "files";
private static final String TABLE_CHILDS = "childs";
private static final String TABLE_PARAMETERS = "parameters";
private final RowMapper<GFile> rowMapper;
private final RowMapper<String> parentIdMapper = (rs, rowNum) -> rs.getString("parentId");
private final JdbcTemplate jdbcTemplate;
private final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock();
private final Lock r = rwl.readLock();
private final Lock w = rwl.writeLock();
private final AtomicLong childId = new AtomicLong(System.currentTimeMillis());
public SQLCache(String driverClassName, String jdbcUrl) {
LOGGER.info("JDBC Driver: '" + driverClassName + "'...");
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(driverClassName);
dataSource.setUrl(jdbcUrl);
// dataSource.setMaxActive(1);
dataSource.setMaxWait(60000);
jdbcTemplate = new JdbcTemplate(dataSource);
rowMapper = (rs, rowNum) -> {
GFile ret = new GFile(null);
ret.setId(rs.getString("id"));
ret.setName(rs.getString("filename"));
ret.setRevision(rs.getString("revision"));
ret.setDirectory(rs.getBoolean("isDirectory"));
ret.setSize(rs.getLong("size"));
ret.setLastModified(rs.getLong("lastModified"));
ret.setMimeType(rs.getString("mimeType"));
ret.setMd5Checksum(rs.getString("md5Checksum"));
ret.setExists(true);
return ret;
};
Integer ret = null;
try {
ret = jdbcTemplate.queryForObject("SELECT value FROM " + TABLE_PARAMETERS + " where id='revision'",
Integer.class);
LOGGER.info("Database found");
} catch (DataAccessException e) {
List<String> queries = new ArrayList<>();
queries.add("create table " + TABLE_FILES + " (id character varying(100), revision character varying(100), "
+ "filename character varying(100) not null, isDirectory boolean, size bigint, lastModified bigint, mimeType character varying(100), "
+ "md5Checksum character varying(100), primary key (id))");
queries.add("create table " + TABLE_CHILDS
+ " (id bigint primary key, childId character varying(100) references " + TABLE_FILES
+ "(id), parentId character varying(100) references " + TABLE_FILES
+ "(id), unique (childId, parentId))");
queries.add("create table " + TABLE_PARAMETERS
+ " (id character varying(100), value character varying(100), primary key (id))");
queries.add("create index idx_filename on " + TABLE_FILES + " (filename)");
queries.add("insert into " + TABLE_PARAMETERS + " (id,value) values('revision',null)");
jdbcTemplate.batchUpdate(queries.toArray(new String[0]));
LOGGER.info("Database created");
}
}
@Override
public GFile getFile(String id) {
r.lock();
try {
LOGGER.trace("getFile(" + id + ")");
return jdbcTemplate.queryForObject("select * from " + TABLE_FILES + " where id=?", new Object[] { id },
rowMapper);
} catch (EmptyResultDataAccessException ex) {
return null;
} finally {
r.unlock();
}
}
public int addOrUpdateFile(GFile file) {
List<String> queries = new ArrayList<>();
List<Object[]> args = new ArrayList<>();
GFile cachedFile = getFile(file.getId());
if (cachedFile == null) {
queries.add("insert into " + TABLE_FILES
+ " (id,revision,filename,isDirectory,size,lastModified,mimeType,md5checksum)"
+ " values(?,?,?,?,?,?,?,?)");
args.add(new Object[] { file.getId(), file.getRevision(), file.getName(), file.isDirectory(),
file.getSize(), file.getLastModified(), file.getMimeType(), file.getMd5Checksum() });
} else {
queries.add("update " + TABLE_FILES
+ " set revision=?,filename=?,isDirectory=?,size=?,lastModified=?,mimeType=?,md5checksum=?"
+ " where id=?");
args.add(new Object[] { file.getRevision(), file.getName(), file.isDirectory(), file.getSize(),
file.getLastModified(), file.getMimeType(), file.getMd5Checksum(), file.getId() });
}
updateParents(file, queries, args);
return executeInTransaction(queries, args);
}
public void updateChilds(GFile file, List<GFile> childs) {
List<String> queries = new ArrayList<>();
List<Object[]> args = new ArrayList<>();
queries.add("delete from " + TABLE_CHILDS + " where parentId=?");
args.add(new Object[] { file.getId() });
queries.add("update " + TABLE_FILES
+ " set revision=?,filename=?,isDirectory=?,size=?,lastModified=?,mimeType=?,md5checksum=? where id=?");
args.add(new Object[] { file.getRevision(), file.getName(), file.isDirectory(), file.getSize(),
file.getLastModified(), file.getMimeType(), file.getMd5Checksum(), file.getId() });
for (GFile child : childs) {
GFile cachedChild = getFile(child.getId());
if (cachedChild == null) {
queries.add("insert into " + TABLE_FILES
+ " (id,revision,filename,isDirectory,size,lastModified,mimeType,md5checksum)"
+ " values(?,?,?,?,?,?,?,?)");
args.add(new Object[] { child.getId(), child.getRevision(), child.getName(), child.isDirectory(),
child.getSize(), child.getLastModified(), child.getMimeType(), child.getMd5Checksum() });
} else {
queries.add("update " + TABLE_FILES
+ " set revision=?,filename=?,isDirectory=?,size=?,lastModified=?,mimeType=?,md5checksum=?"
+ " where id=?");
args.add(new Object[] { child.getRevision(), child.getName(), child.isDirectory(), child.getSize(),
child.getLastModified(), child.getMimeType(), child.getMd5Checksum(), child.getId() });
}
queries.add("insert into " + TABLE_CHILDS + " (id,childId,parentId) values(?,?,?)");
args.add(new Object[] { childId.getAndIncrement(), child.getId(), file.getId() });
}
executeInTransaction(queries, args);
}
private void updateParents(GFile file, List<String> queries, List<Object[]> args) {
queries.add("delete from " + TABLE_CHILDS + " where childId=?");
args.add(new Object[] { file.getId() });
for (String parent : file.getParents()) {
queries.add("insert into " + TABLE_CHILDS + " (id,childId,parentId) values(?,?,?)");
args.add(new Object[] { childId.getAndIncrement(), file.getId(), parent });
}
}
private int executeInTransaction(final List<String> queries, final List<Object[]> args) {
return jdbcTemplate.execute((ConnectionCallback<Integer>) connection -> {
w.lock();
try {
connection.setAutoCommit(false);
int ret = 0;
for (int i = 0; i < queries.size(); i++) {
if (args == null || args.get(i) == null) {
ret += connection.createStatement().executeUpdate(queries.get(i));
} else {
PreparedStatement ps = connection.prepareStatement(queries.get(i));
PreparedStatementSetter psSetter = new ArgumentPreparedStatementSetter(args.get(i));
psSetter.setValues(ps);
ret += ps.executeUpdate();
}
}
connection.commit();
return ret;
} catch (Exception ex) {
LOGGER.error("Error executing transaction. " + ex.getMessage());
/*
* for (int i = 0; i < queries.size(); i++) {
* LOG.error("Query '" + queries.get(i) + "' " + (args != null
* && i < args.size() ? " args:" + Arrays.toString(args.get(i))
* : "") + "' "); }
*/
throw new RuntimeException(ex);
} finally {
try {
connection.setAutoCommit(true);
} catch (SQLException e) {
throw new RuntimeException(e);
}
w.unlock();
}
});
}
@Override
public List<GFile> getFiles(String parentId) {
System.out.println();
r.lock();
try {
return jdbcTemplate.query(
"select " + TABLE_FILES + ".* from " + TABLE_FILES + "," + TABLE_CHILDS + " where " + TABLE_CHILDS
+ ".childId=" + TABLE_FILES + ".id and " + TABLE_CHILDS + ".parentId=?",
new Object[] { parentId }, rowMapper);
} finally {
r.unlock();
}
}
public List<String> getAllFoldersWithoutRevision() {
r.lock();
try {
return jdbcTemplate.queryForList(
"select id from " + TABLE_FILES + " where isDirectory=1 and revision is null", String.class);
} finally {
r.unlock();
}
}
@Override
public GFile getFileByName(String parentId, String filename) throws IncorrectResultSizeDataAccessException {
r.lock();
try {
return jdbcTemplate.queryForObject("select " + TABLE_FILES + ".* from " + TABLE_CHILDS + "," + TABLE_FILES
+ " where " + TABLE_CHILDS + ".childId=" + TABLE_FILES + ".id and " + TABLE_CHILDS
+ ".parentId=? and " + TABLE_FILES + ".filename=?", new Object[] { parentId, filename }, rowMapper);
} catch (EmptyResultDataAccessException ex) {
return null;
} finally {
r.unlock();
}
}
public int deleteFile(String id) {
List<String> queries = new ArrayList<>();
List<Object[]> args = new ArrayList<>();
queries.add("delete from " + TABLE_CHILDS + " where parentId=?");
queries.add("delete from " + TABLE_CHILDS + " where childId=?");
queries.add("delete from " + TABLE_FILES + " where id=?");
args.add(new Object[] { id });
args.add(new Object[] { id });
args.add(new Object[] { id });
return executeInTransaction(queries, args);
}
public String getRevision() {
r.lock();
try {
return jdbcTemplate.queryForObject("select value from " + TABLE_PARAMETERS + " where id='revision'",
String.class);
} finally {
r.unlock();
}
}
public void updateRevision(String revision) {
jdbcTemplate.update("update " + TABLE_PARAMETERS + " set value=? where id='revision'", revision);
}
public Set<String> getParents(String fileId) {
r.lock();
try {
return new HashSet<>(jdbcTemplate.query("select parentId from " + TABLE_CHILDS + " where childId=?",
new Object[] { fileId }, parentIdMapper));
} catch (EmptyResultDataAccessException ex) {
return null;
} finally {
r.unlock();
}
}
}
| 11,018
| 0.673806
| 0.667726
| 301
| 35.604652
| 31.475452
| 139
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 3.093023
| false
| false
|
2
|
0690000162cd76b0883967dd8ef5aba274e11b04
| 30,047,591,243,260
|
d7f7d67fa9c72b5110acc275c04fbe941e6c1143
|
/src/Main.java
|
65546d3f1e2b4b05022252a2157ce18de584e66f
|
[
"MIT"
] |
permissive
|
Krylovsentry/MVCSpring
|
https://github.com/Krylovsentry/MVCSpring
|
8633e2c2178bfa1d75e1cc58f7bc4829389bcb7b
|
86664ae77fdf9dcf1276009ab496c6e583650e77
|
refs/heads/master
| 2021-05-04T10:11:15.212000
| 2016-03-28T16:19:16
| 2016-03-28T16:19:16
| 54,835,516
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
import data.DAO;
import data.Purchase;
import data.PurchaseDAO;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
import java.util.List;
/**
* Created by Антон on 27.03.2016.
*/
public class Main {
public static void main(String[] args) {
ApplicationContext context = new GenericXmlApplicationContext("spring-config.xml");
DAO purchaseDAO = (PurchaseDAO)context.getBean("purchaseDAO");
List<Purchase> purchaseList = purchaseDAO.findAll();
for (Purchase purchase : purchaseList){
System.out.println(purchase);
}
}
}
|
UTF-8
|
Java
| 675
|
java
|
Main.java
|
Java
|
[
{
"context": "ontext;\n\nimport java.util.List;\n\n/**\n * Created by Антон on 27.03.2016.\n */\npublic class Main {\n\n\n publ",
"end": 240,
"score": 0.9995250105857849,
"start": 235,
"tag": "NAME",
"value": "Антон"
}
] | null |
[] |
import data.DAO;
import data.Purchase;
import data.PurchaseDAO;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
import java.util.List;
/**
* Created by Антон on 27.03.2016.
*/
public class Main {
public static void main(String[] args) {
ApplicationContext context = new GenericXmlApplicationContext("spring-config.xml");
DAO purchaseDAO = (PurchaseDAO)context.getBean("purchaseDAO");
List<Purchase> purchaseList = purchaseDAO.findAll();
for (Purchase purchase : purchaseList){
System.out.println(purchase);
}
}
}
| 675
| 0.704478
| 0.692537
| 34
| 18.705883
| 25.557926
| 91
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.294118
| false
| false
|
2
|
8cbf75c47649ee5b7d14a6e7e2d2eca4f16456ba
| 27,341,761,850,811
|
549f6443a3574b27c051883270164ca7f640d811
|
/src/structuremode/composite/CompositeEquipment.java
|
f3dd6ed8bfb5eba01bdab8e3cb6e54518fd9a569
|
[] |
no_license
|
hashman8433/23DesignMode
|
https://github.com/hashman8433/23DesignMode
|
7bf0064910cb8290318148d1d2405bc904119873
|
2130625e1e6f3b5c9d40bf548edeadb87abb3a0e
|
refs/heads/master
| 2018-11-20T20:25:07.467000
| 2018-09-03T22:55:30
| 2018-09-03T22:55:30
| 103,291,002
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package structuremode.composite;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
public abstract class CompositeEquipment extends Equipment {
private int i = 0;
private List equipments = new ArrayList();
public CompositeEquipment(String name) { super(name); }
public boolean add(Equipment equipment) {
equipments.add(equipment);
return true;
}
@Override
public double netPrice() {
double netPrice = 0;
Iterator iter = equipments.iterator();
while (iter.hasNext()) {
netPrice += ((Equipment)iter.next()).netPrice();
}
return netPrice;
}
@Override
public double discountPrice() {
double discountPrice = 0;
Iterator iter = equipments.iterator();
while (iter.hasNext()) {
discountPrice += ((Equipment)iter.next()).discountPrice();
}
return discountPrice;
}
public Iterator iter () {
return equipments.iterator();
}
public boolean hasNext() {
return i < equipments.size();
}
public Object next() {
if (hasNext()) {
return equipments.get(i++);
} else {
throw new NoSuchElementException();
}
}
}
|
UTF-8
|
Java
| 1,218
|
java
|
CompositeEquipment.java
|
Java
|
[] | null |
[] |
package structuremode.composite;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
public abstract class CompositeEquipment extends Equipment {
private int i = 0;
private List equipments = new ArrayList();
public CompositeEquipment(String name) { super(name); }
public boolean add(Equipment equipment) {
equipments.add(equipment);
return true;
}
@Override
public double netPrice() {
double netPrice = 0;
Iterator iter = equipments.iterator();
while (iter.hasNext()) {
netPrice += ((Equipment)iter.next()).netPrice();
}
return netPrice;
}
@Override
public double discountPrice() {
double discountPrice = 0;
Iterator iter = equipments.iterator();
while (iter.hasNext()) {
discountPrice += ((Equipment)iter.next()).discountPrice();
}
return discountPrice;
}
public Iterator iter () {
return equipments.iterator();
}
public boolean hasNext() {
return i < equipments.size();
}
public Object next() {
if (hasNext()) {
return equipments.get(i++);
} else {
throw new NoSuchElementException();
}
}
}
| 1,218
| 0.651888
| 0.649425
| 62
| 17.645161
| 17.271173
| 61
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.629032
| false
| false
|
2
|
63e2e80213ada43c5956d6bee01fac359b17aa99
| 30,958,124,281,029
|
4ed6d4ba77fc8b7602c42b8d081a49a9a98e9eba
|
/src/ua/itea/homework9Pudge/Pudge.java
|
b1e5a78140ec7f9e1e43464df3a510d43f3dbeff
|
[] |
no_license
|
VitaliyVoron/Lessons
|
https://github.com/VitaliyVoron/Lessons
|
42d67af6b3461a13543d33222a182f575b510a4d
|
1429542f9130c78301b21f31875437c65ebde469
|
refs/heads/master
| 2021-01-22T09:54:19.473000
| 2017-01-19T08:15:16
| 2017-01-19T08:15:16
| 81,976,397
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package ua.itea.homework9Pudge;
public class Pudge {
private int intelligence;
private int agility;
private int strength;
private Item[] items = new Item[2];
private int health;
private int strike;
Pudge() {
intelligence = 20;
agility = 20;
strength = 20;
health = 100;
calculateStrike();
}
Pudge(int intelligence, int agility, int strength) {
this.intelligence = intelligence;
this.agility = agility;
this.strength = strength;
health = 100;
calculateStrike();
}
public void addItem(Item item) {
for (int i = 0; i < items.length; i++) {
if (items[i] == null) {
items[i] = item;
intelligence += item.getIntelligence();
agility += item.getAgility();
strength += item.getStrength();
calculateStrike();
break;
} else {
System.out.println("Itams is full");
}
}
}
public Item giveItem(int index) {
if (items[index] != null) {
Item temp = items[index];
intelligence -= items[index].getIntelligence();
agility -= items[index].getAgility();
strength -= items[index].getStrength();
items[index] = null;
calculateStrike();
return temp;
} else {
return null;
}
}
public void removeItem(int index) {
if (items[index] != null) {
intelligence -= items[index].getIntelligence();
agility -= items[index].getAgility();
strength -= items[index].getStrength();
items[index] = null;
calculateStrike();
} else {
System.out.println("This item empty");
}
}
public void tookStrike(int strike) {
if (strike > health) {
health = 0;
} else {
health -= strike;
}
}
void calculateStrike() {
strike = (intelligence / 3) + (agility / 2) + strength;
}
public int getStrike() {
return strike;
}
public int getHealth() {
return health;
}
String getInfo() {
String str = "health - " + health + " strike - " + strike;
for (int i = 0; i < items.length; i++) {
str += "\nItem " + i + ": " + (items[i] != null ? items[i].getName() : null) + ";";
}
return str;
}
}
|
UTF-8
|
Java
| 2,108
|
java
|
Pudge.java
|
Java
|
[] | null |
[] |
package ua.itea.homework9Pudge;
public class Pudge {
private int intelligence;
private int agility;
private int strength;
private Item[] items = new Item[2];
private int health;
private int strike;
Pudge() {
intelligence = 20;
agility = 20;
strength = 20;
health = 100;
calculateStrike();
}
Pudge(int intelligence, int agility, int strength) {
this.intelligence = intelligence;
this.agility = agility;
this.strength = strength;
health = 100;
calculateStrike();
}
public void addItem(Item item) {
for (int i = 0; i < items.length; i++) {
if (items[i] == null) {
items[i] = item;
intelligence += item.getIntelligence();
agility += item.getAgility();
strength += item.getStrength();
calculateStrike();
break;
} else {
System.out.println("Itams is full");
}
}
}
public Item giveItem(int index) {
if (items[index] != null) {
Item temp = items[index];
intelligence -= items[index].getIntelligence();
agility -= items[index].getAgility();
strength -= items[index].getStrength();
items[index] = null;
calculateStrike();
return temp;
} else {
return null;
}
}
public void removeItem(int index) {
if (items[index] != null) {
intelligence -= items[index].getIntelligence();
agility -= items[index].getAgility();
strength -= items[index].getStrength();
items[index] = null;
calculateStrike();
} else {
System.out.println("This item empty");
}
}
public void tookStrike(int strike) {
if (strike > health) {
health = 0;
} else {
health -= strike;
}
}
void calculateStrike() {
strike = (intelligence / 3) + (agility / 2) + strength;
}
public int getStrike() {
return strike;
}
public int getHealth() {
return health;
}
String getInfo() {
String str = "health - " + health + " strike - " + strike;
for (int i = 0; i < items.length; i++) {
str += "\nItem " + i + ": " + (items[i] != null ? items[i].getName() : null) + ";";
}
return str;
}
}
| 2,108
| 0.588235
| 0.579222
| 99
| 19.292929
| 17.059168
| 86
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 2.252525
| false
| false
|
2
|
5756f1894748da3b8e87cd387c340010ffe5e867
| 17,600,776,024,020
|
c654fe0c3cc14ff3fa6a99bebb4bf1ce99d6e332
|
/src/main/java/sep3tier2/tier2/models/user/UserShortVersionWithMessage.java
|
9be7bbdc793bfb2fa95b42f8f71e964399cf2edf
|
[] |
no_license
|
florinaToldea/SEP3_Spring
|
https://github.com/florinaToldea/SEP3_Spring
|
691e2a3be71b2f193345bbd760f4018c7ecbccbf
|
38242377987ba033f4fdfb8b886b4a946df805a5
|
refs/heads/master
| 2023-02-01T06:20:45.517000
| 2020-12-15T19:23:44
| 2020-12-15T19:23:44
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package sep3tier2.tier2.models.user;
import sep3tier2.tier2.models.chat.Message;
/**
* A class for representing the short version of a user with the last message he/she sent to a given user
* @version 1.0
* @author Group1
*/
public class UserShortVersionWithMessage extends UserShortVersion
{
private Message message;
public Message getMessage() {
return message;
}
}
|
UTF-8
|
Java
| 395
|
java
|
UserShortVersionWithMessage.java
|
Java
|
[
{
"context": "he sent to a given user\n * @version 1.0\n * @author Group1\n */\npublic class UserShortVersionWithMessage exte",
"end": 226,
"score": 0.9996290802955627,
"start": 220,
"tag": "USERNAME",
"value": "Group1"
}
] | null |
[] |
package sep3tier2.tier2.models.user;
import sep3tier2.tier2.models.chat.Message;
/**
* A class for representing the short version of a user with the last message he/she sent to a given user
* @version 1.0
* @author Group1
*/
public class UserShortVersionWithMessage extends UserShortVersion
{
private Message message;
public Message getMessage() {
return message;
}
}
| 395
| 0.731646
| 0.708861
| 17
| 22.235294
| 27.601213
| 105
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.235294
| false
| false
|
2
|
94d1255b06e4556712798ddb4d51486093c2165f
| 28,535,762,775,417
|
34898f50dba5a6d822179641220e6fab1ba76264
|
/we-web-parent/dlws-we-game/src/main/java/com/xiaoka/game/admin/pkrecord/form/SignInSqlForm.java
|
81e7976b499a9293bec21adce87dc54c84206879
|
[] |
no_license
|
zhilien-tech/zhiliren-we
|
https://github.com/zhilien-tech/zhiliren-we
|
c54fbf774a79d57ddaa2302634d8f116b8002ce3
|
2df7ed63a530c8546d9d901ff13a980d2df42ba7
|
refs/heads/dev
| 2020-07-05T20:23:23.643000
| 2017-12-09T09:02:34
| 2017-12-09T09:02:34
| 73,982,139
| 0
| 7
| null | false
| 2017-12-09T09:02:35
| 2016-11-17T02:29:54
| 2016-11-17T02:45:05
| 2017-12-09T09:02:35
| 72,344
| 0
| 2
| 0
|
JavaScript
| false
| null |
package com.xiaoka.game.admin.pkrecord.form;
import java.sql.Timestamp;
import lombok.Data;
import org.nutz.dao.Cnd;
import org.nutz.dao.SqlManager;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import com.uxuexi.core.common.util.Util;
import com.uxuexi.core.db.dao.IDbDao;
import com.uxuexi.core.web.form.ISqlForm;
import com.xiaoka.game.common.util.DateUtil;
@Data
public class SignInSqlForm implements ISqlForm {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* 游戏ID
*/
private Long gameId;
/**
* 创建日期结束时间
*/
private Timestamp createTimeEnd ;
@Override
public Sql createPagerSql(IDbDao dbDao, SqlManager sqlManager) {
Sql sql = Sqls.create(sqlManager.get("sign_in_record_list"));
sql.setCondition(cnd());
return sql ;
}
@Override
public Sql createCountSql(IDbDao dbDao, SqlManager sqlManager) {
Sql sql = Sqls.create(sqlManager.get("sign_in_list_count"));
sql.setCondition(cnd());
return sql;
}
private Cnd cnd() {
Cnd cnd = Cnd.limit();
if (!Util.isEmpty(gameId))
cnd.and("si.gameId", "=",gameId);
// cnd.asc("c.sort") ;
// cnd.desc("c.id") ;
return cnd;
}
}
|
UTF-8
|
Java
| 1,233
|
java
|
SignInSqlForm.java
|
Java
|
[] | null |
[] |
package com.xiaoka.game.admin.pkrecord.form;
import java.sql.Timestamp;
import lombok.Data;
import org.nutz.dao.Cnd;
import org.nutz.dao.SqlManager;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import com.uxuexi.core.common.util.Util;
import com.uxuexi.core.db.dao.IDbDao;
import com.uxuexi.core.web.form.ISqlForm;
import com.xiaoka.game.common.util.DateUtil;
@Data
public class SignInSqlForm implements ISqlForm {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* 游戏ID
*/
private Long gameId;
/**
* 创建日期结束时间
*/
private Timestamp createTimeEnd ;
@Override
public Sql createPagerSql(IDbDao dbDao, SqlManager sqlManager) {
Sql sql = Sqls.create(sqlManager.get("sign_in_record_list"));
sql.setCondition(cnd());
return sql ;
}
@Override
public Sql createCountSql(IDbDao dbDao, SqlManager sqlManager) {
Sql sql = Sqls.create(sqlManager.get("sign_in_list_count"));
sql.setCondition(cnd());
return sql;
}
private Cnd cnd() {
Cnd cnd = Cnd.limit();
if (!Util.isEmpty(gameId))
cnd.and("si.gameId", "=",gameId);
// cnd.asc("c.sort") ;
// cnd.desc("c.id") ;
return cnd;
}
}
| 1,233
| 0.661995
| 0.661171
| 58
| 18.913794
| 19.023836
| 65
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.327586
| false
| false
|
2
|
9a3e71aea82c831238f6434363cb2c7305af95a2
| 29,772,713,314,098
|
b79da38c9c956667bf7fe115fb299906044dd782
|
/src/br/com/sao/facade/ProntuarioSolicitarOpiniaoPrePesquisar.java
|
10d94490cc83886ebe82d55e6b2c6c6e2dba162f
|
[] |
no_license
|
adirlima/sao-web
|
https://github.com/adirlima/sao-web
|
2bb4904bf145be93f8fcbbc191d99886aea9a022
|
8ce1aea166ce4fd65d3be34f9c81ef3744959aa1
|
refs/heads/master
| 2020-05-27T09:34:20.851000
| 2019-07-28T18:59:43
| 2019-07-28T18:59:43
| 188,566,728
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
// Decompiled using: fernflower
// Took: 8ms
package br.com.sao.facade;
import br.com.extreme.exfw.exception.WarningException;
import br.com.extreme.exfw.exception.application.ApplicationException;
import br.com.extreme.exfw.exception.enviroment.EnviromentException;
import br.com.extreme.exfw.facade.FacadePesquisarAB;
import br.com.extreme.exfw.util.types.ApplicationTypes.FiltroProntuarioSolicitacaoECG;
import br.com.sao.model.Especialidade;
import br.com.sao.model.Paciente;
import br.com.sao.model.Questionario;
import br.com.sao.model.Solicitacao;
public final class ProntuarioSolicitarOpiniaoPrePesquisar extends FacadePesquisarAB {
public void execute() throws EnviromentException, ApplicationException, WarningException {
this.getRequest().setAttribute("seqPaciente", this.getRequest().getSession().getAttribute("seqPaciente"));
if (this.getRequest().getSession().getAttribute("flagEcgInserir") != null && this.getRequest().getSession().getAttribute("flagEcgInserir").equals("yes")) {
this.getRequest().getSession().removeAttribute("flagEcgInserir");
Solicitacao solic = new Solicitacao();
solic.setCodTipoSolicitacao((new Integer(FiltroProntuarioSolicitacaoECG.TIPOSOLICITACAO.getCodigo())).toString());
this.getRequest().setAttribute("Solicitacao", solic);
Especialidade esp = new Especialidade();
esp.setSeqEspecialidade(FiltroProntuarioSolicitacaoECG.ESPECIALIDADE.getCodigo());
this.getRequest().setAttribute("colEspecialidades", Especialidade.obterTodosComQuestionario());
this.getRequest().setAttribute("Especialidade", esp);
this.getRequest().setAttribute("colQuestionarios", Questionario.obterPorEspecialidade(esp));
Questionario ques = new Questionario();
ques.setSeqQuestionario(FiltroProntuarioSolicitacaoECG.QUESTIONARIO.getCodigo());
this.getRequest().setAttribute("Questionario", ques);
this.getRequest().getSession().setAttribute("flagEcgInserir", "yes");
this.getRequest().setAttribute("ExOid", this.getRequest().getSession().getAttribute("seqPaciente"));
this.getRequest().setAttribute("seqPaciente", this.getRequest().getSession().getAttribute("seqPaciente"));
} else {
this.getRequest().setAttribute("colEspecialidades", Especialidade.obterTodosComQuestionario());
this.getRequest().setAttribute("seqPaciente", this.getRequest().getParameter("seqPaciente"));
ProntuarioPreAlterar.verificaAcaoGrupoPacienteConsultor(this.getRequest());
int seqPacienteObito = new Integer(this.getRequest().getParameter("seqPaciente"));
System.out.println("seqPacienteObito");
System.out.println(seqPacienteObito);
Paciente paciente = (Paciente)this.getSession().get(Paciente.class, new Integer(seqPacienteObito));
if (paciente.getDtcObito() != null) {
this.getRequest().setAttribute("controleObitoPaciente", "true");
}
}
}
protected void posExecute() throws EnviromentException, ApplicationException, WarningException {
ProntuarioPreAlterar.verificaAcaoGrupoPacienteConsultor(this.getRequest());
}
}
|
UTF-8
|
Java
| 3,187
|
java
|
ProntuarioSolicitarOpiniaoPrePesquisar.java
|
Java
|
[] | null |
[] |
// Decompiled using: fernflower
// Took: 8ms
package br.com.sao.facade;
import br.com.extreme.exfw.exception.WarningException;
import br.com.extreme.exfw.exception.application.ApplicationException;
import br.com.extreme.exfw.exception.enviroment.EnviromentException;
import br.com.extreme.exfw.facade.FacadePesquisarAB;
import br.com.extreme.exfw.util.types.ApplicationTypes.FiltroProntuarioSolicitacaoECG;
import br.com.sao.model.Especialidade;
import br.com.sao.model.Paciente;
import br.com.sao.model.Questionario;
import br.com.sao.model.Solicitacao;
public final class ProntuarioSolicitarOpiniaoPrePesquisar extends FacadePesquisarAB {
public void execute() throws EnviromentException, ApplicationException, WarningException {
this.getRequest().setAttribute("seqPaciente", this.getRequest().getSession().getAttribute("seqPaciente"));
if (this.getRequest().getSession().getAttribute("flagEcgInserir") != null && this.getRequest().getSession().getAttribute("flagEcgInserir").equals("yes")) {
this.getRequest().getSession().removeAttribute("flagEcgInserir");
Solicitacao solic = new Solicitacao();
solic.setCodTipoSolicitacao((new Integer(FiltroProntuarioSolicitacaoECG.TIPOSOLICITACAO.getCodigo())).toString());
this.getRequest().setAttribute("Solicitacao", solic);
Especialidade esp = new Especialidade();
esp.setSeqEspecialidade(FiltroProntuarioSolicitacaoECG.ESPECIALIDADE.getCodigo());
this.getRequest().setAttribute("colEspecialidades", Especialidade.obterTodosComQuestionario());
this.getRequest().setAttribute("Especialidade", esp);
this.getRequest().setAttribute("colQuestionarios", Questionario.obterPorEspecialidade(esp));
Questionario ques = new Questionario();
ques.setSeqQuestionario(FiltroProntuarioSolicitacaoECG.QUESTIONARIO.getCodigo());
this.getRequest().setAttribute("Questionario", ques);
this.getRequest().getSession().setAttribute("flagEcgInserir", "yes");
this.getRequest().setAttribute("ExOid", this.getRequest().getSession().getAttribute("seqPaciente"));
this.getRequest().setAttribute("seqPaciente", this.getRequest().getSession().getAttribute("seqPaciente"));
} else {
this.getRequest().setAttribute("colEspecialidades", Especialidade.obterTodosComQuestionario());
this.getRequest().setAttribute("seqPaciente", this.getRequest().getParameter("seqPaciente"));
ProntuarioPreAlterar.verificaAcaoGrupoPacienteConsultor(this.getRequest());
int seqPacienteObito = new Integer(this.getRequest().getParameter("seqPaciente"));
System.out.println("seqPacienteObito");
System.out.println(seqPacienteObito);
Paciente paciente = (Paciente)this.getSession().get(Paciente.class, new Integer(seqPacienteObito));
if (paciente.getDtcObito() != null) {
this.getRequest().setAttribute("controleObitoPaciente", "true");
}
}
}
protected void posExecute() throws EnviromentException, ApplicationException, WarningException {
ProntuarioPreAlterar.verificaAcaoGrupoPacienteConsultor(this.getRequest());
}
}
| 3,187
| 0.745215
| 0.744901
| 53
| 59.132076
| 39.680344
| 161
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.981132
| false
| false
|
2
|
27181c72d78976806f828caf02c8d1aef14bba45
| 17,179,869,237,837
|
0f6bd66294349e5080aa4adad9edaf0aa4c6b2f3
|
/social-media-aggregator-backend/src/main/java/com/olamas/socialmedia/aggregator/twitter/TwitterFilter.java
|
10594cdc3f43264856e72236ab968e7bf8b81795
|
[] |
no_license
|
olamas/social-media-aggregator
|
https://github.com/olamas/social-media-aggregator
|
d05f9366a055b49ba331eaccb5a3ad2fe47429fd
|
1bc97eed7414814b9a39eb8894169e848b1cd8e8
|
refs/heads/master
| 2020-03-14T04:47:13.404000
| 2018-05-21T16:50:29
| 2018-05-21T16:50:29
| 131,449,543
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.olamas.socialmedia.aggregator.twitter;
import java.io.Serializable;
public class TwitterFilter implements Serializable{
private String userName;
private String filterText;
private String fromUser;
private boolean validFilter;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getFilterText() {
return filterText;
}
public void setFilterText(String filterText) {
this.filterText = filterText;
}
public String getFromUser() {
return fromUser;
}
public void setFromUser(String fromUser) {
this.fromUser = fromUser;
}
public boolean isValidFilter() {
return validFilter;
}
public void setValidFilter(boolean validFilter) {
this.validFilter = validFilter;
}
}
|
UTF-8
|
Java
| 909
|
java
|
TwitterFilter.java
|
Java
|
[
{
"context": "\n\n public String getUserName() {\n return userName;\n }\n\n public void setUserName(String userNa",
"end": 318,
"score": 0.5896118879318237,
"start": 310,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "serName(String userName) {\n this.userName = userName;\n }\n\n public String getFilterText() {\n ",
"end": 406,
"score": 0.5903948545455933,
"start": 398,
"tag": "USERNAME",
"value": "userName"
}
] | null |
[] |
package com.olamas.socialmedia.aggregator.twitter;
import java.io.Serializable;
public class TwitterFilter implements Serializable{
private String userName;
private String filterText;
private String fromUser;
private boolean validFilter;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getFilterText() {
return filterText;
}
public void setFilterText(String filterText) {
this.filterText = filterText;
}
public String getFromUser() {
return fromUser;
}
public void setFromUser(String fromUser) {
this.fromUser = fromUser;
}
public boolean isValidFilter() {
return validFilter;
}
public void setValidFilter(boolean validFilter) {
this.validFilter = validFilter;
}
}
| 909
| 0.663366
| 0.663366
| 46
| 18.76087
| 18.209152
| 53
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.304348
| false
| false
|
2
|
4a486ab42c468e38f3f114c81b2eafdc816109bc
| 20,383,914,850,995
|
1fbab9b07002e72e020a153a48e3e0263d8da567
|
/src/main/java/ru/geekbrains/java/oop/at/Robot.java
|
5ab11124fcc5e049ee360ea1b210182cfd9c1585
|
[] |
no_license
|
actusfidei/java-oop-at
|
https://github.com/actusfidei/java-oop-at
|
b2dbe29bd94de83486387c459e2d3c62e3e0a049
|
9213aa5e5f11c5ae9a2e01f56c7308715d4be87f
|
refs/heads/master
| 2022-11-24T17:32:08.947000
| 2020-07-14T19:01:12
| 2020-07-14T19:01:12
| 279,648,845
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package ru.geekbrains.java.oop.at;
public class Robot implements Participant {
private String name;
private final Integer maxHeight;
private final Integer maxLength;
private boolean isOut;
public Robot() {
this.maxHeight = 15;
this.maxLength = 15000;
this.name = "T-1000 model 3";
}
@Override
public boolean run(Integer a) {
if (a <= maxLength) {
System.out.println(name + " легко пробежал " + a + " метровый трек");
return true;
}
System.out.println(name + " не преодолел " + a + " метровый трек");
System.out.println(name + "выбывает из состязания" + "\n");
isOut = true;
return false;
}
@Override
public boolean jump(Integer a) {
if (a <= maxHeight) {
System.out.println(name + " перепрыгнул " + a + " метровую стену");
return true;
}
System.out.println(name + " не перепрыгнул " + a + " метровую стену");
System.out.println(name + " выбывает из состязания" + "\n");
isOut = true;
return false;
}
@Override
public boolean isOut() {
return isOut;
}
}
|
UTF-8
|
Java
| 1,334
|
java
|
Robot.java
|
Java
|
[] | null |
[] |
package ru.geekbrains.java.oop.at;
public class Robot implements Participant {
private String name;
private final Integer maxHeight;
private final Integer maxLength;
private boolean isOut;
public Robot() {
this.maxHeight = 15;
this.maxLength = 15000;
this.name = "T-1000 model 3";
}
@Override
public boolean run(Integer a) {
if (a <= maxLength) {
System.out.println(name + " легко пробежал " + a + " метровый трек");
return true;
}
System.out.println(name + " не преодолел " + a + " метровый трек");
System.out.println(name + "выбывает из состязания" + "\n");
isOut = true;
return false;
}
@Override
public boolean jump(Integer a) {
if (a <= maxHeight) {
System.out.println(name + " перепрыгнул " + a + " метровую стену");
return true;
}
System.out.println(name + " не перепрыгнул " + a + " метровую стену");
System.out.println(name + " выбывает из состязания" + "\n");
isOut = true;
return false;
}
@Override
public boolean isOut() {
return isOut;
}
}
| 1,334
| 0.560201
| 0.550167
| 46
| 25.02174
| 22.984388
| 81
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.456522
| false
| false
|
2
|
54c3fceaff97159e7829022036094b64d9c6f88a
| 4,535,485,518,043
|
e2df72879713e2f21c871da9c8b4592c59fa23f4
|
/src/main/java/sda/controller/SendEmail.java
|
c9947c2795f0181bd844b48486db32d52678a6c5
|
[] |
no_license
|
bwegrzanowski/bankapp
|
https://github.com/bwegrzanowski/bankapp
|
baf6fa27e4e0be08520d741e636a317573d76ff6
|
ede403406290db7a43a65351551a05da174daf1e
|
refs/heads/master
| 2020-03-21T06:04:22.075000
| 2018-10-03T15:24:49
| 2018-10-03T15:24:49
| 138,197,174
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package sda.controller;
import sda.model.MailAndPassword;
import sda.model.SendMail;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Properties;
@WebServlet(name = "SendEmail")
public class SendEmail extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String token = (String) request.getAttribute("token");
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String to = request.getParameter("email");
String subject = "Account activation";
// test mail account and password (created on exercise purposes) hidden in another class MailAndPassword
MailAndPassword mailAndPassword = new MailAndPassword();
String user = mailAndPassword.getMailAccount();
String pass = mailAndPassword.getMailPassword();
SendMail.send(to,subject, user, pass, token);
out.println("Mail send successfully");
response.sendRedirect("activationMailSent.jsp");
}
}
|
UTF-8
|
Java
| 1,620
|
java
|
SendEmail.java
|
Java
|
[] | null |
[] |
package sda.controller;
import sda.model.MailAndPassword;
import sda.model.SendMail;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Properties;
@WebServlet(name = "SendEmail")
public class SendEmail extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String token = (String) request.getAttribute("token");
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String to = request.getParameter("email");
String subject = "Account activation";
// test mail account and password (created on exercise purposes) hidden in another class MailAndPassword
MailAndPassword mailAndPassword = new MailAndPassword();
String user = mailAndPassword.getMailAccount();
String pass = mailAndPassword.getMailPassword();
SendMail.send(to,subject, user, pass, token);
out.println("Mail send successfully");
response.sendRedirect("activationMailSent.jsp");
}
}
| 1,620
| 0.759259
| 0.758642
| 45
| 34.977779
| 23.904894
| 111
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.822222
| false
| false
|
2
|
bc68e0c293cfd7e85a7fdb087d6ab696ab9f9c83
| 12,592,844,182,250
|
b8fa9e55bebe8fd4327af1f48b0dbe9c0028a2b1
|
/2011-11-08/NetBeans/FestoMPS/FestoMPS[old]/src/FestoMPS3D/TestingStation3D.java
|
4c493c096e9062bfc40316973bc15ad63a3e15d9
|
[] |
no_license
|
amolofos/FestoMpsOld
|
https://github.com/amolofos/FestoMpsOld
|
c25cf3597295143c0ba4a03e8351937da75cfc6e
|
5a065527c956bacb65e0b60f819e899f7c27c4b7
|
refs/heads/master
| 2021-01-25T03:54:15.943000
| 2013-07-15T20:30:44
| 2013-07-15T20:30:44
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package FestoMPS3D;
import javax.media.j3d.*;
import javax.vecmath.*;
public class TestingStation3D extends Station3D {
public TestingStation3D() {
}
protected BranchGroup createStructure( ) {
Elevator3D eU = new Elevator3D();
stationBGRoot.addChild( eU.createSceneGraph() );
return stationBGRoot;
}
public void animateStation3D( String move ) {
switch( move ) {
case "RemoveRejectedWorkpiece":
System.out.println( "Station3D : RemoveRejectedWorkpiece" );
break;
default:
break;
}
}
}
|
UTF-8
|
Java
| 688
|
java
|
TestingStation3D.java
|
Java
|
[] | null |
[] |
package FestoMPS3D;
import javax.media.j3d.*;
import javax.vecmath.*;
public class TestingStation3D extends Station3D {
public TestingStation3D() {
}
protected BranchGroup createStructure( ) {
Elevator3D eU = new Elevator3D();
stationBGRoot.addChild( eU.createSceneGraph() );
return stationBGRoot;
}
public void animateStation3D( String move ) {
switch( move ) {
case "RemoveRejectedWorkpiece":
System.out.println( "Station3D : RemoveRejectedWorkpiece" );
break;
default:
break;
}
}
}
| 688
| 0.545058
| 0.531977
| 32
| 20.5
| 19.132759
| 76
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.28125
| false
| false
|
2
|
72a704c008d187b77cc13e4fd7b2b31742826beb
| 2,267,742,770,452
|
f69f042e09068234b1d1a37cfd7033e4db8ec6ee
|
/src/main/java/com/FangBianMian/serviceImpl/BulletinServiceImpl.java
|
d3b78ddf9225fedf97b2eb3539a42211ef2928d0
|
[] |
no_license
|
justinytsoft/ssm
|
https://github.com/justinytsoft/ssm
|
ab80be7deea7dfd608da91554b1742f6349ff1af
|
c8f68967063be3171e5826bb36fbc80e03fe91d1
|
refs/heads/master
| 2021-01-17T02:25:44.362000
| 2017-03-03T15:37:15
| 2017-03-03T15:37:15
| 55,117,027
| 8
| 5
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.FangBianMian.serviceImpl;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.FangBianMian.dao.IBulletinDao;
import com.FangBianMian.domain.Bulletin;
import com.FangBianMian.service.IBulletinService;
@Service
public class BulletinServiceImpl implements IBulletinService {
@Autowired
private IBulletinDao bulletinDao;
@Override
public Bulletin queryBulletinById(Integer id) {
return bulletinDao.queryBulletinById(id);
}
@Override
public void saveBulletin(Bulletin b) {
if(b.getId()!=null){
bulletinDao.updateBulletin(b);
}else{
bulletinDao.insertBulletin(b);
}
}
@Override
public List<Bulletin> queryBulletins(Map<String, Object> param) {
return bulletinDao.queryBulletins(param);
}
@Override
public int queryBulletinsTotal(Map<String, Object> param) {
return bulletinDao.queryBulletinsTotal(param);
}
@Override
public void deleteBulletinById(Integer id) {
bulletinDao.deleteBulletinById(id);
}
}
|
UTF-8
|
Java
| 1,116
|
java
|
BulletinServiceImpl.java
|
Java
|
[] | null |
[] |
package com.FangBianMian.serviceImpl;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.FangBianMian.dao.IBulletinDao;
import com.FangBianMian.domain.Bulletin;
import com.FangBianMian.service.IBulletinService;
@Service
public class BulletinServiceImpl implements IBulletinService {
@Autowired
private IBulletinDao bulletinDao;
@Override
public Bulletin queryBulletinById(Integer id) {
return bulletinDao.queryBulletinById(id);
}
@Override
public void saveBulletin(Bulletin b) {
if(b.getId()!=null){
bulletinDao.updateBulletin(b);
}else{
bulletinDao.insertBulletin(b);
}
}
@Override
public List<Bulletin> queryBulletins(Map<String, Object> param) {
return bulletinDao.queryBulletins(param);
}
@Override
public int queryBulletinsTotal(Map<String, Object> param) {
return bulletinDao.queryBulletinsTotal(param);
}
@Override
public void deleteBulletinById(Integer id) {
bulletinDao.deleteBulletinById(id);
}
}
| 1,116
| 0.753584
| 0.753584
| 47
| 21.74468
| 21.303749
| 66
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.148936
| false
| false
|
2
|
a38e3b016989459e8d0e3cba3137854f5547aef9
| 31,653,908,984,067
|
21ade2b61b2211ea7bc028fb8f485ef213b570b9
|
/app/src/main/java/com/tnstc/buspass/Fragment/MstMonthWiseFragment.java
|
912ce7c5ab73e0b0235b7ea8434064a2a537f780
|
[] |
no_license
|
Silambu1903/TNTSC-BusPass
|
https://github.com/Silambu1903/TNTSC-BusPass
|
963db308786f0159d0d3c8ca700d7a6ba1f18410
|
cf85deac64d190b5c8a22322e33918241c96d9a3
|
refs/heads/master
| 2023-05-12T19:56:12.901000
| 2021-06-05T03:26:38
| 2021-06-05T03:26:38
| 348,061,742
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.tnstc.buspass.Fragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.pdf.PdfDocument;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.text.format.DateFormat;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.view.ActionMode;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.res.ResourcesCompat;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.tnstc.buspass.Activity.BaseActivity;
import com.tnstc.buspass.Adapter.MstMonthWiseAdapter;
import com.tnstc.buspass.Database.DAOs.MstDao;
import com.tnstc.buspass.Database.DAOs.MstOpeningDao;
import com.tnstc.buspass.Database.DAOs.PassDao;
import com.tnstc.buspass.Database.Entity.DutyEntity;
import com.tnstc.buspass.Database.Entity.MstEntity;
import com.tnstc.buspass.Database.Entity.MstOpeningClosing;
import com.tnstc.buspass.Database.Entity.SctOpeningClosing;
import com.tnstc.buspass.Database.TnstcBusPassDB;
import com.tnstc.buspass.Others.ApplicationClass;
import com.tnstc.buspass.R;
import com.tnstc.buspass.callback.ItemClickListener;
import com.tnstc.buspass.databinding.MstMonthwiseBinding;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.LinkedHashSet;
import java.util.List;
import static com.tnstc.buspass.Others.ApplicationClass.PINTER_FILE_NAME;
public class MstMonthWiseFragment extends Fragment implements AdapterView.OnItemClickListener, ItemClickListener {
MstMonthwiseBinding mBinding;
TnstcBusPassDB db;
MstDao dao;
MstOpeningDao daoOpenClose;
Context mContext;
ApplicationClass mAppClass;
private SharedPreferences preferences;
List<String> getYear;
List<String> getMonth;
MstMonthWiseAdapter mAdapter;
List<MstOpeningClosing> mstOpeningClosings;
String month;
String year;
String currentMonth;
String currentYear;
BaseActivity mActivity;
int startYPosition;
PdfDocument mPDFDocument;
PdfDocument.Page mPDFPage;
Paint mPaint;
int mStartXPosition = 10;
int mEndXPosition;
boolean mMultiSelect = false;
private ActionMode mActionMode;
int balOpen200, balClose200, TotalBalCard200, balCard200, maxMonthOpenCard200,
balOpen240, balClose240, TotalBalCard240, balCard240, maxMonthOpenCard240,
balOpen280, balClose280, TotalBalCard280, balCard280, maxMonthOpenCard280,
balOpen320, balClose320, TotalBalCard320, balCard320, maxMonthOpenCard320,
balOpen360, balClose360, TotalBalCard360, balCard360, maxMonthOpenCard360,
balOpen400, balClose400, TotalBalCard400, balCard400, maxMonthOpenCard400,
balOpen440, balClose440, TotalBalCard440, balCard440, maxMonthOpenCard440,
balOpen480, balClose480, TotalBalCard480, balCard480, maxMonthOpenCard480,
balOpen520, balClose520, TotalBalCard520, balCard520, maxMonthOpenCard520,
balOpen560, balClose560, TotalBalCard560, balCard560, maxMonthOpenCard560,
balOpen600, balClose600, TotalBalCard600, balCard600, maxMonthOpenCard600,
balOpen640, balClose640, TotalBalCard640, balCard640, maxMonthOpenCard640,
balOpen680, balClose680, TotalBalCard680, balCard680, maxMonthOpenCard680,
balOpen720, balClose720, TotalBalCard720, balCard720, maxMonthOpenCard720,
balOpen760, balClose760, TotalBalCard760, balCard760, maxMonthOpenCard760;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
mBinding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.mst_monthwise, container, false);
return mBinding.getRoot();
}
@Override
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.users_menu, menu);
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == R.id.action_download) {
if (!(mstOpeningClosings == null)) {
excelWorkBookWrite();
} else {
mAppClass.showSnackBar(getContext(), "Please Select the Month and Year");
}
} else if (item.getItemId() == R.id.action_open) {
Intent intent = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath()
+ File.separator + "TNSTC BUS PASS DETAILS" + File.separator);
intent.setDataAndType(uri, "*/*");
startActivity(Intent.createChooser(intent, "TNSTC BUS PASS DETAILS"));
} else if (item.getItemId() == R.id.action_print) {
createPDF();
} else {
BaseActivity activity = (BaseActivity) getActivity();
activity.onSupportNavigateUp();
}
return true;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setRetainInstance(true);
setHasOptionsMenu(true);
View windowDecorView = requireActivity().getWindow().getDecorView();
windowDecorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
mContext = getContext();
preferences = PreferenceManager.getDefaultSharedPreferences(getContext());
mAppClass = (ApplicationClass) getActivity().getApplicationContext();
mActivity = (BaseActivity) getActivity();
db = TnstcBusPassDB.getDatabase(mContext);
dao = db.mstDao();
daoOpenClose = db.OpeningDao();
if (!daoOpenClose.getMonthWiseMst("April", "2021").isEmpty()) {
getMstEntry();
mstOpeningClosings = new ArrayList<>();
Calendar cal = Calendar.getInstance();
mBinding.monthListMst.setText(new SimpleDateFormat("MMMM").format(cal.getTime()) + "");
mBinding.yearListMst.setText((Calendar.getInstance().get(Calendar.YEAR)) + "");
year = mBinding.yearListMst.getText().toString();
month = mBinding.monthListMst.getText().toString();
mstOpeningClosings = daoOpenClose.getMonthWiseMst(month, year);
mAdapter = new MstMonthWiseAdapter(mstOpeningClosings, this);
mBinding.recyclerMstMonth.setLayoutManager(new LinearLayoutManager(getContext()));
mBinding.recyclerMstMonth.setAdapter(mAdapter);
} else {
getMstEntry();
}
AdapterForMonthYear();
mBinding.monthListMst.setOnItemClickListener(this);
mBinding.yearListMst.setOnItemClickListener(this);
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
private void createPDF() {
if (mstOpeningClosings.size() <= 0) {
return;
}
int itemPerPage = 10;
List<List<MstOpeningClosing>> printablePages = splitIntoParts(mstOpeningClosings, itemPerPage);
mPDFDocument = new PdfDocument();
mPaint = new Paint();
Canvas pdfPage;
for (int i = 0; i < printablePages.size(); i++) {
pdfPage = startPage(i + 1);
List<MstOpeningClosing> entities = printablePages.get(i);
for (int j = 0; j < entities.size(); j++) {
pdfPage.drawText(String.valueOf(entities.get(j).getMstCard()), 18, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstKey()), 34, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstOpening()), 50, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstClosing()), 66, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstTotal()), 95, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstOpenMax()), 122, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstCloseMax()), 148, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(i).getMstTotalCard()), 175, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstTotalAmount()), 196, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstBalOpen()), 215, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstBalClose()), 238, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstBalCard()), 260, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstBalTotalCard()), 280, startYPosition, mPaint);
pdfPage.drawLine(mStartXPosition, startYPosition + 3, mEndXPosition + 3, startYPosition + 3, mPaint);
startYPosition += 15;
}
endPage(pdfPage);
}
File mypath = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), PINTER_FILE_NAME);
try {
mPDFDocument.writeTo(new FileOutputStream(mypath));
mActivity.printDocument();
} catch (IOException e) {
e.printStackTrace();
}
mPDFDocument.close();
}
public List<List<MstOpeningClosing>> splitIntoParts(List<MstOpeningClosing> Entities, int itemsPerList) {
List<List<MstOpeningClosing>> splittedList = new ArrayList<>();
for (int i = 0; i < Entities.size(); i += itemsPerList) {
splittedList.add(Entities.subList(i, Math.min(Entities.size(), i + itemsPerList)));
}
return splittedList;
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
Canvas startPage(int pageNo) {
PdfDocument.PageInfo pageInfo = new PdfDocument.PageInfo.Builder(297, 210, pageNo).create();
mPDFPage = mPDFDocument.startPage(pageInfo);
Canvas canvas = mPDFPage.getCanvas();
Typeface currentTypeFace = mPaint.getTypeface();
Typeface bold = Typeface.create(currentTypeFace, Typeface.BOLD);
Typeface typeface = ResourcesCompat.getFont(getContext(), R.font.google_font);
mPaint.setTypeface(typeface);
mPaint.setTypeface(bold);
mPaint.setColor(Color.BLACK);
mPaint.setTextSize(12.f);
mPaint.setTextAlign(Paint.Align.CENTER);
canvas.drawText("TNSTC AMBUR DEPOT", pageInfo.getPageWidth() / 2, 10, mPaint);
mPaint.setTextSize(8.f);
mPaint.setTextAlign(Paint.Align.CENTER);
mPaint.setColor(Color.BLACK);
canvas.drawText("MST BUS PASS DETAILS -- " + currentMonth + " " + currentYear, pageInfo.getPageWidth() / 2, 20, mPaint);
mPaint.setTextAlign(Paint.Align.CENTER);
mPaint.setTextAlign(Paint.Align.CENTER);
mPaint.setTextSize(3.0f);
mPaint.setColor(Color.BLACK);
mEndXPosition = pageInfo.getPageWidth() - 10;
startYPosition = 60;
canvas.drawText("START BAL INVENTORY", 70, 35, mPaint);
canvas.drawText("SCALES DETAILS", 160, 35, mPaint);
canvas.drawText("BALANCE DETAILS", 250, 35, mPaint);
canvas.drawText("CARD", 18, 45, mPaint);
canvas.drawText("KEY", 33, 45, mPaint);
canvas.drawText("OPEN", 48, 45, mPaint);
canvas.drawText("CLOSE", 67, 45, mPaint);
canvas.drawText("TOTAL", 93, 45, mPaint);
canvas.drawText("OPEN", 122, 45, mPaint);
canvas.drawText("CLOSE", 148, 45, mPaint);
canvas.drawText("TOTAL", 175, 45, mPaint);
canvas.drawText("AMOUNT", 196, 45, mPaint);
canvas.drawText("OPEN", 215, 45, mPaint);
canvas.drawText("CLOSE", 238, 45, mPaint);
canvas.drawText("BALANCE", 260, 45, mPaint);
canvas.drawText("TOTAL", 280, 45, mPaint);
return canvas;
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
void endPage(Canvas page) {
int endPos = startYPosition - 12;
page.drawLine(mStartXPosition, 30, mEndXPosition + 3, 30, mPaint);
page.drawLine(mStartXPosition, 40, mEndXPosition + 3, 40, mPaint);
page.drawLine(mStartXPosition, 50, mEndXPosition + 3, 50, mPaint);
page.drawLine(10, 30, 10, endPos, mPaint);
page.drawLine(25, 40, 25, endPos, mPaint);
page.drawLine(40, 40, 40, endPos, mPaint);
page.drawLine(58, 40, 58, endPos, mPaint);
page.drawLine(80, 40, 80, endPos, mPaint);
page.drawLine(110, 30, 110, endPos, mPaint);
page.drawLine(135, 40, 135, endPos, mPaint);
page.drawLine(160, 40, 160, endPos, mPaint);
page.drawLine(185, 40, 185, endPos, mPaint);
page.drawLine(205, 30, 205, endPos, mPaint);
page.drawLine(225, 40, 225, endPos, mPaint);
page.drawLine(250, 40, 250, endPos, mPaint);
page.drawLine(270, 40, 270, endPos, mPaint);
page.drawLine(290, 30, 290, endPos, mPaint);
mPDFDocument.finishPage(mPDFPage);
}
private void excelWorkBookWrite() {
currentMonth = String.valueOf(DateFormat.format("MMMM", new Date()));
currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet SecondSheet = workbook.createSheet("Mst" + month);
SecondSheet.setFitToPage(true);
HSSFRow row = SecondSheet.createRow(0);
HSSFCell cell1 = row.createCell(0);
SecondSheet.setColumnWidth(0, 25 * 60);
HSSFCell cell2 = row.createCell(1);
SecondSheet.setColumnWidth(1, 25 * 60);
HSSFCell cell3 = row.createCell(2);
SecondSheet.setColumnWidth(2, 25 * 70);
HSSFCell cell4 = row.createCell(3);
SecondSheet.setColumnWidth(3, 25 * 100);
HSSFCell cell5 = row.createCell(4);
SecondSheet.setColumnWidth(4, 25 * 100);
HSSFCell cell6 = row.createCell(5);
SecondSheet.setColumnWidth(5, 25 * 216);
HSSFCell cell7 = row.createCell(6);
SecondSheet.setColumnWidth(6, 25 * 100);
HSSFCell cell8 = row.createCell(7);
SecondSheet.setColumnWidth(7, 25 * 100);
HSSFCell cell9 = row.createCell(8);
SecondSheet.setColumnWidth(8, 25 * 100);
HSSFCell cell10 = row.createCell(9);
SecondSheet.setColumnWidth(9, 25 * 100);
HSSFCell cell11 = row.createCell(10);
SecondSheet.setColumnWidth(10, 25 * 100);
HSSFCell cell12 = row.createCell(11);
SecondSheet.setColumnWidth(11, 25 * 130);
HSSFCell cell13 = row.createCell(12);
SecondSheet.setColumnWidth(12, 25 * 130);
cell1.setCellValue(new HSSFRichTextString("CARD"));
cell2.setCellValue(new HSSFRichTextString("KEY"));
cell3.setCellValue(new HSSFRichTextString("OPENING NO"));
cell4.setCellValue(new HSSFRichTextString("CLOSING NO"));
cell5.setCellValue(new HSSFRichTextString("TOTAL CARD"));
cell6.setCellValue(new HSSFRichTextString("OPENING NO"));
cell7.setCellValue(new HSSFRichTextString("CLOSING NO"));
cell8.setCellValue(new HSSFRichTextString("TOTAL CARD"));
cell9.setCellValue(new HSSFRichTextString("SCALES AMOUNT"));
cell10.setCellValue(new HSSFRichTextString("OPENING NO"));
cell11.setCellValue(new HSSFRichTextString("CLOSING NO"));
cell12.setCellValue(new HSSFRichTextString("BALANCE CARD"));
cell13.setCellValue(new HSSFRichTextString("TOTAL CARD"));
for (int i = 0; i < mstOpeningClosings.size(); i++) {
HSSFRow rowA = SecondSheet.createRow(i + 1);
rowA.createCell(0).setCellValue(mstOpeningClosings.get(i).getMstCard());
rowA.createCell(1).setCellValue(mstOpeningClosings.get(i).getMstKey());
rowA.createCell(2).setCellValue(mstOpeningClosings.get(i).getMstOpening());
rowA.createCell(3).setCellValue(mstOpeningClosings.get(i).getMstClosing());
rowA.createCell(4).setCellValue(mstOpeningClosings.get(i).getMstTotal());
rowA.createCell(5).setCellValue(mstOpeningClosings.get(i).getMstOpenMax());
rowA.createCell(6).setCellValue(mstOpeningClosings.get(i).getMstCloseMax());
rowA.createCell(7).setCellValue(mstOpeningClosings.get(i).getMstTotalCard());
rowA.createCell(8).setCellValue(mstOpeningClosings.get(i).getMstTotalAmount());
rowA.createCell(9).setCellValue(mstOpeningClosings.get(i).getMstBalOpen());
rowA.createCell(10).setCellValue(mstOpeningClosings.get(i).getMstBalClose());
rowA.createCell(11).setCellValue(mstOpeningClosings.get(i).getMstBalCard());
rowA.createCell(12).setCellValue(mstOpeningClosings.get(i).getMstBalTotalCard());
}
FileOutputStream fos = null;
try {
File file;
File folder = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/TNSTC BUS PASS DETAILS");
if (!folder.mkdirs()) {
folder.mkdirs();
}
file = new File(folder + File.separator, "TNSTCMst" + month + year + ".xls");
fos = new FileOutputStream(file);
workbook.write(fos);
mAppClass.showSnackBar(getContext(), "Excel Sheet Download Successfully");
} catch (IOException e) {
e.printStackTrace();
Toast.makeText(mContext, "" + e, Toast.LENGTH_SHORT).show();
Log.e("TAG", "excelWorkBookWrite: " + e);
} finally {
if (fos != null) {
try {
fos.flush();
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
private void AdapterForMonthYear() {
getMonth = new ArrayList<>();
getYear = new ArrayList<>();
getYear = daoOpenClose.mstGetYear();
getMonth = daoOpenClose.mstGetMonth();
LinkedHashSet<String> monthSet = new LinkedHashSet<>();
monthSet.addAll(getMonth);
getMonth.clear();
getMonth.addAll(monthSet);
LinkedHashSet<String> yearSet = new LinkedHashSet<>();
yearSet.addAll(getYear);
getYear.clear();
getYear.addAll(yearSet);
ArrayAdapter yearList = new ArrayAdapter(getContext(), android.R.layout.simple_spinner_dropdown_item, getYear);
mBinding.yearListMst.setAdapter(yearList);
ArrayAdapter monthList = new ArrayAdapter(getContext(), android.R.layout.simple_spinner_dropdown_item, getMonth);
mBinding.monthListMst.setAdapter(monthList);
}
private void getMstEntry() {
//card200
String monthMst = String.valueOf(DateFormat.format("MMMM", new Date()));
String yearMst = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
int maxOpen200 = dao.mstMonthOpen200(monthMst, 200);
int maxClose200 = dao.mstMonthClose200(monthMst, 200);
int maxTotalCard = dao.mstMonthTotalCard200(monthMst, 200);
int maxTotalSales = dao.mstMonthTotalAmount200(monthMst, 200);
if (dao.mstMonthOpen200(monthMst, 200) != 0) {
balOpen200 = dao.mstMonthCloseMax200(monthMst, 200) + 1;
balClose200 = daoOpenClose.mstMonthBalClose200(monthMst, 200);
maxMonthOpenCard200 = dao.mstMonthCloseMax200(monthMst, 200);
balCard200 = daoOpenClose.mstMonthBalClose200(monthMst, 200) - maxMonthOpenCard200;
TotalBalCard200 = dao.mstMonthTotalCard200(monthMst, 200) + balCard200;
}
//card240
int maxOpen240 = dao.mstMonthOpen200(monthMst, 240);
int maxClose240 = dao.mstMonthClose200(monthMst, 240);
int maxTotalCard240 = dao.mstMonthTotalCard200(monthMst, 240);
int maxTotalSales240 = dao.mstMonthTotalAmount200(monthMst, 240);
if (dao.mstMonthOpen200(monthMst, 240) != 0) {
balOpen240 = dao.mstMonthCloseMax200(monthMst, 240) + 1;
balClose240 = daoOpenClose.mstMonthBalClose200(monthMst, 240);
maxMonthOpenCard240 = dao.mstMonthCloseMax200(monthMst, 240);
balCard240 = daoOpenClose.mstMonthBalClose200(monthMst, 240) - maxMonthOpenCard240;
TotalBalCard240 = dao.mstMonthTotalCard200(monthMst, 240) + balCard240;
}
//card280
int maxOpen280 = dao.mstMonthOpen200(monthMst, 280);
int maxClose280 = dao.mstMonthClose200(monthMst, 280);
int maxTotalCard280 = dao.mstMonthTotalCard200(monthMst, 280);
int maxTotalSales280 = dao.mstMonthTotalAmount200(monthMst, 280);
if (dao.mstMonthOpen200(monthMst, 280) != 0) {
balOpen280 = dao.mstMonthCloseMax200(monthMst, 280) + 1;
balClose280 = daoOpenClose.mstMonthBalClose200(monthMst, 280);
maxMonthOpenCard280 = dao.mstMonthCloseMax200(monthMst, 280);
balCard280 = daoOpenClose.mstMonthBalClose200(monthMst, 280) - maxMonthOpenCard280;
TotalBalCard280 = dao.mstMonthTotalCard200(monthMst, 280) + balCard280;
}
//card320
int maxOpen320 = dao.mstMonthOpen200(monthMst, 320);
int maxClose320 = dao.mstMonthClose200(monthMst, 320);
int maxTotalCard320 = dao.mstMonthTotalCard200(monthMst, 320);
int maxTotalSales320 = dao.mstMonthTotalAmount200(monthMst, 320);
if (dao.mstMonthOpen200(monthMst, 320) != 0) {
balOpen320 = dao.mstMonthCloseMax200(monthMst, 320) + 1;
balClose320 = daoOpenClose.mstMonthBalClose200(monthMst, 320);
maxMonthOpenCard320 = dao.mstMonthCloseMax200(monthMst, 320);
balCard320 = daoOpenClose.mstMonthBalClose200(monthMst, 320) - maxMonthOpenCard320;
TotalBalCard320 = dao.mstMonthTotalCard200(monthMst, 320) + balCard320;
}
//card360
int maxOpen360 = dao.mstMonthOpen200(monthMst, 360);
int maxClose360 = dao.mstMonthClose200(monthMst, 360);
int maxTotalCard360 = dao.mstMonthTotalCard200(monthMst, 360);
int maxTotalSales360 = dao.mstMonthTotalAmount200(monthMst, 360);
if (dao.mstMonthOpen200(monthMst, 360) != 0) {
balOpen360 = dao.mstMonthCloseMax200(monthMst, 360) + 1;
balClose360 = daoOpenClose.mstMonthBalClose200(monthMst, 360);
maxMonthOpenCard360 = dao.mstMonthCloseMax200(monthMst, 360);
balCard360 = daoOpenClose.mstMonthBalClose200(monthMst, 360) - maxMonthOpenCard360;
TotalBalCard360 = dao.mstMonthTotalCard200(monthMst, 360) + balCard360;
}
//card400
int maxOpen400 = dao.mstMonthOpen200(monthMst, 400);
int maxClose400 = dao.mstMonthClose200(monthMst, 400);
int maxTotalCard400 = dao.mstMonthTotalCard200(monthMst, 400);
int maxTotalSales400 = dao.mstMonthTotalAmount200(monthMst, 400);
if (dao.mstMonthOpen200(monthMst, 400) != 0) {
balOpen400 = dao.mstMonthCloseMax200(monthMst, 400) + 1;
balClose400 = daoOpenClose.mstMonthBalClose200(monthMst, 400);
maxMonthOpenCard400 = dao.mstMonthCloseMax200(monthMst, 400);
balCard400 = daoOpenClose.mstMonthBalClose200(monthMst, 400) - maxMonthOpenCard400;
TotalBalCard400 = dao.mstMonthTotalCard200(monthMst, 400) + balCard400;
}
//card440
int maxOpen440 = dao.mstMonthOpen200(monthMst, 440);
int maxClose440 = dao.mstMonthClose200(monthMst, 440);
int maxTotalCard440 = dao.mstMonthTotalCard200(monthMst, 440);
int maxTotalSales440 = dao.mstMonthTotalAmount200(monthMst, 440);
if (dao.mstMonthOpen200(monthMst, 440) != 0) {
balOpen440 = dao.mstMonthCloseMax200(monthMst, 440) + 1;
balClose440 = daoOpenClose.mstMonthBalClose200(monthMst, 440);
maxMonthOpenCard440 = dao.mstMonthCloseMax200(monthMst, 440);
balCard440 = daoOpenClose.mstMonthBalClose200(monthMst, 440) - maxMonthOpenCard440;
TotalBalCard440 = dao.mstMonthTotalCard200(monthMst, 440) + balCard440;
}
//card480
int maxOpen480 = dao.mstMonthOpen200(monthMst, 480);
int maxClose480 = dao.mstMonthClose200(monthMst, 480);
int maxTotalCard480 = dao.mstMonthTotalCard200(monthMst, 480);
int maxTotalSales480 = dao.mstMonthTotalAmount200(monthMst, 480);
if (dao.mstMonthOpen200(monthMst, 480) != 0) {
balOpen480 = dao.mstMonthCloseMax200(monthMst, 480) + 1;
balClose480 = daoOpenClose.mstMonthBalClose200(monthMst, 480);
maxMonthOpenCard480 = dao.mstMonthCloseMax200(monthMst, 480);
balCard480 = daoOpenClose.mstMonthBalClose200(monthMst, 480) - maxMonthOpenCard480;
TotalBalCard480 = dao.mstMonthTotalCard200(monthMst, 480) + balCard480;
}
//card520
int maxOpen520 = dao.mstMonthOpen200(monthMst, 520);
int maxClose520 = dao.mstMonthClose200(monthMst, 520);
int maxTotalCard520 = dao.mstMonthTotalCard200(monthMst, 520);
int maxTotalSales520 = dao.mstMonthTotalAmount200(monthMst, 520);
if (dao.mstMonthOpen200(monthMst, 520) != 0) {
balOpen520 = dao.mstMonthCloseMax200(monthMst, 520) + 1;
balClose520 = daoOpenClose.mstMonthBalClose200(monthMst, 520);
maxMonthOpenCard520 = dao.mstMonthCloseMax200(monthMst, 520);
balCard520 = daoOpenClose.mstMonthBalClose200(monthMst, 520) - maxMonthOpenCard520;
TotalBalCard520 = dao.mstMonthTotalCard200(monthMst, 520) + balCard520;
}
//card560
int maxOpen560 = dao.mstMonthOpen200(monthMst, 560);
int maxClose560 = dao.mstMonthClose200(monthMst, 560);
int maxTotalCard560 = dao.mstMonthTotalCard200(monthMst, 560);
int maxTotalSales560 = dao.mstMonthTotalAmount200(monthMst, 560);
if (dao.mstMonthOpen200(monthMst, 560) != 0) {
balOpen560 = dao.mstMonthCloseMax200(monthMst, 560) + 1;
balClose560 = daoOpenClose.mstMonthBalClose200(monthMst, 560);
maxMonthOpenCard560 = dao.mstMonthCloseMax200(monthMst, 560);
balCard560 = daoOpenClose.mstMonthBalClose200(monthMst, 560) - maxMonthOpenCard560;
TotalBalCard560 = dao.mstMonthTotalCard200(monthMst, 560) + balCard560;
}
//card600
int maxOpen600 = dao.mstMonthOpen200(monthMst, 600);
int maxClose600 = dao.mstMonthClose200(monthMst, 600);
int maxTotalCard600 = dao.mstMonthTotalCard200(monthMst, 600);
int maxTotalSales600 = dao.mstMonthTotalAmount200(monthMst, 600);
if (dao.mstMonthOpen200(monthMst, 600) != 0) {
balOpen600 = dao.mstMonthCloseMax200(monthMst, 600) + 1;
balClose600 = daoOpenClose.mstMonthBalClose200(monthMst, 600);
maxMonthOpenCard600 = dao.mstMonthCloseMax200(monthMst, 600);
balCard600 = daoOpenClose.mstMonthBalClose200(monthMst, 600) - maxMonthOpenCard600;
TotalBalCard600 = dao.mstMonthTotalCard200(monthMst, 600) + balCard600;
}
//card640
int maxOpen640 = dao.mstMonthOpen200(monthMst, 640);
int maxClose640 = dao.mstMonthClose200(monthMst, 640);
int maxTotalCard640 = dao.mstMonthTotalCard200(monthMst, 640);
int maxTotalSales640 = dao.mstMonthTotalAmount200(monthMst, 640);
if (dao.mstMonthOpen200(monthMst, 640) != 0) {
balOpen640 = dao.mstMonthCloseMax200(monthMst, 640) + 1;
balClose640 = daoOpenClose.mstMonthBalClose200(monthMst, 640);
maxMonthOpenCard640 = dao.mstMonthCloseMax200(monthMst, 640);
balCard640 = daoOpenClose.mstMonthBalClose200(monthMst, 640) - maxMonthOpenCard640;
TotalBalCard640 = dao.mstMonthTotalCard200(monthMst, 600) + balCard640;
}
//Card680
int maxOpen680 = dao.mstMonthOpen200(monthMst, 680);
int maxClose680 = dao.mstMonthClose200(monthMst, 680);
int maxTotalCard680 = dao.mstMonthTotalCard200(monthMst, 680);
int maxTotalSales680 = dao.mstMonthTotalAmount200(monthMst, 680);
if (dao.mstMonthOpen200(monthMst, 680) != 0) {
balOpen680 = dao.mstMonthCloseMax200(monthMst, 680) + 1;
balClose680 = daoOpenClose.mstMonthBalClose200(monthMst, 680);
maxMonthOpenCard680 = dao.mstMonthCloseMax200(monthMst, 680);
balCard680 = daoOpenClose.mstMonthBalClose200(monthMst, 680) - maxMonthOpenCard680;
TotalBalCard680 = dao.mstMonthTotalCard200(monthMst, 680) + balCard680;
}
//Card720
int maxOpen720 = dao.mstMonthOpen200(monthMst, 720);
int maxClose720 = dao.mstMonthClose200(monthMst, 720);
int maxTotalCard720 = dao.mstMonthTotalCard200(monthMst, 720);
int maxTotalSales720 = dao.mstMonthTotalAmount200(monthMst, 720);
if (dao.mstMonthOpen200(monthMst, 720) != 0) {
balOpen720 = dao.mstMonthCloseMax200(monthMst, 720) + 1;
balClose720 = daoOpenClose.mstMonthBalClose200(monthMst, 720);
maxMonthOpenCard720 = dao.mstMonthCloseMax200(monthMst, 720);
balCard720 = daoOpenClose.mstMonthBalClose200(monthMst, 720) - maxMonthOpenCard720;
TotalBalCard720 = dao.mstMonthTotalCard200(monthMst, 720) + balCard720;
}
//Caard760
int maxOpen760 = dao.mstMonthOpen200(monthMst, 760);
int maxClose760 = dao.mstMonthClose200(monthMst, 760);
int maxTotalCard760 = dao.mstMonthTotalCard200(monthMst, 760);
int maxTotalSales760 = dao.mstMonthTotalAmount200(monthMst, 760);
if (dao.mstMonthOpen200(monthMst, 760) != 0) {
balOpen760 = dao.mstMonthCloseMax200(monthMst, 760) + 1;
balClose760 = daoOpenClose.mstMonthBalClose200(monthMst, 760);
maxMonthOpenCard760 = dao.mstMonthCloseMax200(monthMst, 760);
balCard760 = daoOpenClose.mstMonthBalClose200(monthMst, 760) - maxMonthOpenCard760;
TotalBalCard760 = dao.mstMonthTotalCard200(monthMst, 760) + balCard760;
}
MstOpeningClosing MstOpeningClosing200 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 200),
daoOpenClose.mstOpening(monthMst, 200), daoOpenClose.mstClosing(monthMst, 200),
daoOpenClose.mstCard(monthMst, 200), daoOpenClose.mstSpare(monthMst, 200), daoOpenClose.mstKey(monthMst, 200),
daoOpenClose.mstTotal(monthMst, 200), monthMst, yearMst, maxOpen200, maxClose200,
maxTotalCard, maxTotalSales, balOpen200, balClose200, balCard200, TotalBalCard200);
MstOpeningClosing MstOpeningClosing240 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 240),
daoOpenClose.mstOpening(monthMst, 240), daoOpenClose.mstClosing(monthMst, 240),
daoOpenClose.mstCard(monthMst, 240), daoOpenClose.mstSpare(monthMst, 240), daoOpenClose.mstKey(monthMst, 240),
daoOpenClose.mstTotal(monthMst, 240), monthMst, yearMst, maxOpen240, maxClose240,
maxTotalCard240, maxTotalSales240, balOpen240, balClose240, balCard240, TotalBalCard240);
MstOpeningClosing MstOpeningClosing280 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 280),
daoOpenClose.mstOpening(monthMst, 280), daoOpenClose.mstClosing(monthMst, 280),
daoOpenClose.mstCard(monthMst, 280), daoOpenClose.mstSpare(monthMst, 280), daoOpenClose.mstKey(monthMst, 280),
daoOpenClose.mstTotal(monthMst, 280), monthMst, yearMst, maxOpen280, maxClose280,
maxTotalCard280, maxTotalSales280, balOpen280, balClose280, balCard280, TotalBalCard280);
MstOpeningClosing MstOpeningClosing320 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 320),
daoOpenClose.mstOpening(monthMst, 320), daoOpenClose.mstClosing(monthMst, 320),
daoOpenClose.mstCard(monthMst, 320), daoOpenClose.mstSpare(monthMst, 320), daoOpenClose.mstKey(monthMst, 320),
daoOpenClose.mstTotal(monthMst, 320), monthMst, yearMst, maxOpen320, maxClose320,
maxTotalCard320, maxTotalSales320, balOpen320, balClose320, balCard320, TotalBalCard320);
MstOpeningClosing MstOpeningClosing360 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 360),
daoOpenClose.mstOpening(monthMst, 360), daoOpenClose.mstClosing(monthMst, 360),
daoOpenClose.mstCard(monthMst, 360), daoOpenClose.mstSpare(monthMst, 360), daoOpenClose.mstKey(monthMst, 360),
daoOpenClose.mstTotal(monthMst, 360), monthMst, yearMst, maxOpen360, maxClose360,
maxTotalCard360, maxTotalSales360, balOpen360, balClose360, balCard360, TotalBalCard360);
MstOpeningClosing MstOpeningClosing400 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 400),
daoOpenClose.mstOpening(monthMst, 400), daoOpenClose.mstClosing(monthMst, 400),
daoOpenClose.mstCard(monthMst, 400), daoOpenClose.mstSpare(monthMst, 400), daoOpenClose.mstKey(monthMst, 400),
daoOpenClose.mstTotal(monthMst, 400), monthMst, yearMst, maxOpen400, maxClose400,
maxTotalCard400, maxTotalSales400, balOpen400, balClose400, balCard400, TotalBalCard400);
MstOpeningClosing MstOpeningClosing440 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 440),
daoOpenClose.mstOpening(monthMst, 440), daoOpenClose.mstClosing(monthMst, 440),
daoOpenClose.mstCard(monthMst, 440), daoOpenClose.mstSpare(monthMst, 440), daoOpenClose.mstKey(monthMst, 440),
daoOpenClose.mstTotal(monthMst, 440), monthMst, yearMst, maxOpen440, maxClose440,
maxTotalCard440, maxTotalSales440, balOpen440, balClose440, balCard440, TotalBalCard440);
MstOpeningClosing MstOpeningClosing480 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 480),
daoOpenClose.mstOpening(monthMst, 480), daoOpenClose.mstClosing(monthMst, 480),
daoOpenClose.mstCard(monthMst, 480), daoOpenClose.mstSpare(monthMst, 480), daoOpenClose.mstKey(monthMst, 480),
daoOpenClose.mstTotal(monthMst, 480), monthMst, yearMst, maxOpen480, maxClose480,
maxTotalCard480, maxTotalSales480, balOpen480, balClose480, balCard480, TotalBalCard480);
MstOpeningClosing MstOpeningClosing520 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 480),
daoOpenClose.mstOpening(monthMst, 520), daoOpenClose.mstClosing(monthMst, 520),
daoOpenClose.mstCard(monthMst, 520), daoOpenClose.mstSpare(monthMst, 520), daoOpenClose.mstKey(monthMst, 520),
daoOpenClose.mstTotal(monthMst, 520), monthMst, yearMst, maxOpen520, maxClose520,
maxTotalCard520, maxTotalSales520, balOpen520, balClose520, balCard520, TotalBalCard520);
MstOpeningClosing MstOpeningClosing560 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 560),
daoOpenClose.mstOpening(monthMst, 560), daoOpenClose.mstClosing(monthMst, 560),
daoOpenClose.mstCard(monthMst, 560), daoOpenClose.mstSpare(monthMst, 560), daoOpenClose.mstKey(monthMst, 560),
daoOpenClose.mstTotal(monthMst, 560), monthMst, yearMst, maxOpen560, maxClose560,
maxTotalCard560, maxTotalSales560, balOpen560, balClose560, balCard560, TotalBalCard560);
MstOpeningClosing MstOpeningClosing600 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 600),
daoOpenClose.mstOpening(monthMst, 600), daoOpenClose.mstClosing(monthMst, 600),
daoOpenClose.mstCard(monthMst, 600), daoOpenClose.mstSpare(monthMst, 600), daoOpenClose.mstKey(monthMst, 600),
daoOpenClose.mstTotal(monthMst, 600), monthMst, yearMst, maxOpen600, maxClose600,
maxTotalCard600, maxTotalSales600, balOpen600, balClose600, balCard600, TotalBalCard600);
MstOpeningClosing MstOpeningClosing640 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 640),
daoOpenClose.mstOpening(monthMst, 640), daoOpenClose.mstClosing(monthMst, 640),
daoOpenClose.mstCard(monthMst, 640), daoOpenClose.mstSpare(monthMst, 640), daoOpenClose.mstKey(monthMst, 640),
daoOpenClose.mstTotal(monthMst, 640), monthMst, yearMst, maxOpen640, maxClose640,
maxTotalCard640, maxTotalSales640, balOpen640, balClose640, balCard640, TotalBalCard640);
MstOpeningClosing MstOpeningClosing680 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 680),
daoOpenClose.mstOpening(monthMst, 680), daoOpenClose.mstClosing(monthMst, 680),
daoOpenClose.mstCard(monthMst, 680), daoOpenClose.mstSpare(monthMst, 680), daoOpenClose.mstKey(monthMst, 680),
daoOpenClose.mstTotal(monthMst, 680), monthMst, yearMst, maxOpen680, maxClose680,
maxTotalCard680, maxTotalSales680, balOpen680, balClose680, balCard680, TotalBalCard680);
MstOpeningClosing MstOpeningClosing720 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 720),
daoOpenClose.mstOpening(monthMst, 720), daoOpenClose.mstClosing(monthMst, 720),
daoOpenClose.mstCard(monthMst, 720), daoOpenClose.mstSpare(monthMst, 720), daoOpenClose.mstKey(monthMst, 720),
daoOpenClose.mstTotal(monthMst, 720), monthMst, yearMst, maxOpen720, maxClose720,
maxTotalCard720, maxTotalSales720, balOpen720, balClose720, balCard720, TotalBalCard720);
MstOpeningClosing MstOpeningClosing760 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 760),
daoOpenClose.mstOpening(monthMst, 760), daoOpenClose.mstClosing(monthMst, 760),
daoOpenClose.mstCard(monthMst, 760), daoOpenClose.mstSpare(monthMst, 760), daoOpenClose.mstKey(monthMst, 760),
daoOpenClose.mstTotal(monthMst, 760), monthMst, yearMst, maxOpen760, maxClose760,
maxTotalCard760, maxTotalSales760, balOpen760, balClose760, balCard760, TotalBalCard760);
List<MstOpeningClosing> MstOpeningClosingList = new ArrayList<>();
MstOpeningClosingList.add(MstOpeningClosing200);
MstOpeningClosingList.add(MstOpeningClosing240);
MstOpeningClosingList.add(MstOpeningClosing280);
MstOpeningClosingList.add(MstOpeningClosing320);
MstOpeningClosingList.add(MstOpeningClosing360);
MstOpeningClosingList.add(MstOpeningClosing400);
MstOpeningClosingList.add(MstOpeningClosing440);
MstOpeningClosingList.add(MstOpeningClosing480);
MstOpeningClosingList.add(MstOpeningClosing520);
MstOpeningClosingList.add(MstOpeningClosing560);
MstOpeningClosingList.add(MstOpeningClosing600);
MstOpeningClosingList.add(MstOpeningClosing640);
MstOpeningClosingList.add(MstOpeningClosing680);
MstOpeningClosingList.add(MstOpeningClosing720);
MstOpeningClosingList.add(MstOpeningClosing760);
updateMstMonthEntryToDb(MstOpeningClosingList);
}
public void updateMstMonthEntryToDb(List<MstOpeningClosing> entryList) {
TnstcBusPassDB db = TnstcBusPassDB.getDatabase(getContext());
MstOpeningDao dao = db.OpeningDao();
dao.insertMstMonth(entryList.toArray(new MstOpeningClosing[0]));
}
@Override
public void onDestroyView() {
super.onDestroyView();
View windowDecorView = requireActivity().getWindow().getDecorView();
windowDecorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
year = mBinding.yearListMst.getText().toString();
month = mBinding.monthListMst.getText().toString();
mstOpeningClosings = new ArrayList<>();
mstOpeningClosings = daoOpenClose.getMonthWiseMst(month, year);
mAdapter = new MstMonthWiseAdapter(mstOpeningClosings, this);
mBinding.recyclerMstMonth.setLayoutManager(new LinearLayoutManager(getContext()));
mBinding.recyclerMstMonth.setAdapter(mAdapter);
}
@Override
public void OnItemClick(View v, int pos) {
}
@Override
public void OnItemLongClick(View v, int pos, ConstraintLayout constraintLayout) {
startActionMode(pos, constraintLayout);
}
@Override
public void OnItemClickDate(View v, int adapterPosition, List<String> currentDateAndDay, ConstraintLayout constraintLayout) {
}
@Override
public void OnItemDate(int adapterPosition, List<DutyEntity> dutyEntities) {
}
public void startActionMode(int pos, ConstraintLayout constraintLayout) {
ActionMode.Callback userDelete = new ActionMode.Callback() {
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
mActionMode = mode;
mMultiSelect = true;
menu.add(R.string.delete).setIcon(R.drawable.ic_baseline_delete_24).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
return true;
}
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
mActionMode = mode;
return false;
}
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
switch (item.getTitle().toString()) {
case "Delete":
new MaterialAlertDialogBuilder(getContext()).setTitle(R.string.delete).setMessage(R.string.areYouSureWantToDelete).setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
daoOpenClose.delete(mstOpeningClosings.get(pos));
mstOpeningClosings.remove(mstOpeningClosings.get(pos));
mAdapter.notifyDataSetChanged();
}
}).setNegativeButton(R.string.no, null).show();
break;
}
return true;
}
@Override
public void onDestroyActionMode(ActionMode mode) {
mActionMode = mode;
mMultiSelect = false;
constraintLayout.setBackgroundColor(getResources().getColor(R.color.colorTransparentWhite));
mode.finish();
}
};
((AppCompatActivity) mContext).startSupportActionMode(userDelete);
}
}
|
UTF-8
|
Java
| 44,527
|
java
|
MstMonthWiseFragment.java
|
Java
|
[] | null |
[] |
package com.tnstc.buspass.Fragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.pdf.PdfDocument;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.text.format.DateFormat;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.view.ActionMode;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.res.ResourcesCompat;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.tnstc.buspass.Activity.BaseActivity;
import com.tnstc.buspass.Adapter.MstMonthWiseAdapter;
import com.tnstc.buspass.Database.DAOs.MstDao;
import com.tnstc.buspass.Database.DAOs.MstOpeningDao;
import com.tnstc.buspass.Database.DAOs.PassDao;
import com.tnstc.buspass.Database.Entity.DutyEntity;
import com.tnstc.buspass.Database.Entity.MstEntity;
import com.tnstc.buspass.Database.Entity.MstOpeningClosing;
import com.tnstc.buspass.Database.Entity.SctOpeningClosing;
import com.tnstc.buspass.Database.TnstcBusPassDB;
import com.tnstc.buspass.Others.ApplicationClass;
import com.tnstc.buspass.R;
import com.tnstc.buspass.callback.ItemClickListener;
import com.tnstc.buspass.databinding.MstMonthwiseBinding;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.LinkedHashSet;
import java.util.List;
import static com.tnstc.buspass.Others.ApplicationClass.PINTER_FILE_NAME;
public class MstMonthWiseFragment extends Fragment implements AdapterView.OnItemClickListener, ItemClickListener {
MstMonthwiseBinding mBinding;
TnstcBusPassDB db;
MstDao dao;
MstOpeningDao daoOpenClose;
Context mContext;
ApplicationClass mAppClass;
private SharedPreferences preferences;
List<String> getYear;
List<String> getMonth;
MstMonthWiseAdapter mAdapter;
List<MstOpeningClosing> mstOpeningClosings;
String month;
String year;
String currentMonth;
String currentYear;
BaseActivity mActivity;
int startYPosition;
PdfDocument mPDFDocument;
PdfDocument.Page mPDFPage;
Paint mPaint;
int mStartXPosition = 10;
int mEndXPosition;
boolean mMultiSelect = false;
private ActionMode mActionMode;
int balOpen200, balClose200, TotalBalCard200, balCard200, maxMonthOpenCard200,
balOpen240, balClose240, TotalBalCard240, balCard240, maxMonthOpenCard240,
balOpen280, balClose280, TotalBalCard280, balCard280, maxMonthOpenCard280,
balOpen320, balClose320, TotalBalCard320, balCard320, maxMonthOpenCard320,
balOpen360, balClose360, TotalBalCard360, balCard360, maxMonthOpenCard360,
balOpen400, balClose400, TotalBalCard400, balCard400, maxMonthOpenCard400,
balOpen440, balClose440, TotalBalCard440, balCard440, maxMonthOpenCard440,
balOpen480, balClose480, TotalBalCard480, balCard480, maxMonthOpenCard480,
balOpen520, balClose520, TotalBalCard520, balCard520, maxMonthOpenCard520,
balOpen560, balClose560, TotalBalCard560, balCard560, maxMonthOpenCard560,
balOpen600, balClose600, TotalBalCard600, balCard600, maxMonthOpenCard600,
balOpen640, balClose640, TotalBalCard640, balCard640, maxMonthOpenCard640,
balOpen680, balClose680, TotalBalCard680, balCard680, maxMonthOpenCard680,
balOpen720, balClose720, TotalBalCard720, balCard720, maxMonthOpenCard720,
balOpen760, balClose760, TotalBalCard760, balCard760, maxMonthOpenCard760;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
mBinding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.mst_monthwise, container, false);
return mBinding.getRoot();
}
@Override
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.users_menu, menu);
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == R.id.action_download) {
if (!(mstOpeningClosings == null)) {
excelWorkBookWrite();
} else {
mAppClass.showSnackBar(getContext(), "Please Select the Month and Year");
}
} else if (item.getItemId() == R.id.action_open) {
Intent intent = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath()
+ File.separator + "TNSTC BUS PASS DETAILS" + File.separator);
intent.setDataAndType(uri, "*/*");
startActivity(Intent.createChooser(intent, "TNSTC BUS PASS DETAILS"));
} else if (item.getItemId() == R.id.action_print) {
createPDF();
} else {
BaseActivity activity = (BaseActivity) getActivity();
activity.onSupportNavigateUp();
}
return true;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setRetainInstance(true);
setHasOptionsMenu(true);
View windowDecorView = requireActivity().getWindow().getDecorView();
windowDecorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
mContext = getContext();
preferences = PreferenceManager.getDefaultSharedPreferences(getContext());
mAppClass = (ApplicationClass) getActivity().getApplicationContext();
mActivity = (BaseActivity) getActivity();
db = TnstcBusPassDB.getDatabase(mContext);
dao = db.mstDao();
daoOpenClose = db.OpeningDao();
if (!daoOpenClose.getMonthWiseMst("April", "2021").isEmpty()) {
getMstEntry();
mstOpeningClosings = new ArrayList<>();
Calendar cal = Calendar.getInstance();
mBinding.monthListMst.setText(new SimpleDateFormat("MMMM").format(cal.getTime()) + "");
mBinding.yearListMst.setText((Calendar.getInstance().get(Calendar.YEAR)) + "");
year = mBinding.yearListMst.getText().toString();
month = mBinding.monthListMst.getText().toString();
mstOpeningClosings = daoOpenClose.getMonthWiseMst(month, year);
mAdapter = new MstMonthWiseAdapter(mstOpeningClosings, this);
mBinding.recyclerMstMonth.setLayoutManager(new LinearLayoutManager(getContext()));
mBinding.recyclerMstMonth.setAdapter(mAdapter);
} else {
getMstEntry();
}
AdapterForMonthYear();
mBinding.monthListMst.setOnItemClickListener(this);
mBinding.yearListMst.setOnItemClickListener(this);
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
private void createPDF() {
if (mstOpeningClosings.size() <= 0) {
return;
}
int itemPerPage = 10;
List<List<MstOpeningClosing>> printablePages = splitIntoParts(mstOpeningClosings, itemPerPage);
mPDFDocument = new PdfDocument();
mPaint = new Paint();
Canvas pdfPage;
for (int i = 0; i < printablePages.size(); i++) {
pdfPage = startPage(i + 1);
List<MstOpeningClosing> entities = printablePages.get(i);
for (int j = 0; j < entities.size(); j++) {
pdfPage.drawText(String.valueOf(entities.get(j).getMstCard()), 18, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstKey()), 34, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstOpening()), 50, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstClosing()), 66, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstTotal()), 95, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstOpenMax()), 122, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstCloseMax()), 148, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(i).getMstTotalCard()), 175, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstTotalAmount()), 196, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstBalOpen()), 215, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstBalClose()), 238, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstBalCard()), 260, startYPosition, mPaint);
pdfPage.drawText(String.valueOf(entities.get(j).getMstBalTotalCard()), 280, startYPosition, mPaint);
pdfPage.drawLine(mStartXPosition, startYPosition + 3, mEndXPosition + 3, startYPosition + 3, mPaint);
startYPosition += 15;
}
endPage(pdfPage);
}
File mypath = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), PINTER_FILE_NAME);
try {
mPDFDocument.writeTo(new FileOutputStream(mypath));
mActivity.printDocument();
} catch (IOException e) {
e.printStackTrace();
}
mPDFDocument.close();
}
public List<List<MstOpeningClosing>> splitIntoParts(List<MstOpeningClosing> Entities, int itemsPerList) {
List<List<MstOpeningClosing>> splittedList = new ArrayList<>();
for (int i = 0; i < Entities.size(); i += itemsPerList) {
splittedList.add(Entities.subList(i, Math.min(Entities.size(), i + itemsPerList)));
}
return splittedList;
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
Canvas startPage(int pageNo) {
PdfDocument.PageInfo pageInfo = new PdfDocument.PageInfo.Builder(297, 210, pageNo).create();
mPDFPage = mPDFDocument.startPage(pageInfo);
Canvas canvas = mPDFPage.getCanvas();
Typeface currentTypeFace = mPaint.getTypeface();
Typeface bold = Typeface.create(currentTypeFace, Typeface.BOLD);
Typeface typeface = ResourcesCompat.getFont(getContext(), R.font.google_font);
mPaint.setTypeface(typeface);
mPaint.setTypeface(bold);
mPaint.setColor(Color.BLACK);
mPaint.setTextSize(12.f);
mPaint.setTextAlign(Paint.Align.CENTER);
canvas.drawText("TNSTC AMBUR DEPOT", pageInfo.getPageWidth() / 2, 10, mPaint);
mPaint.setTextSize(8.f);
mPaint.setTextAlign(Paint.Align.CENTER);
mPaint.setColor(Color.BLACK);
canvas.drawText("MST BUS PASS DETAILS -- " + currentMonth + " " + currentYear, pageInfo.getPageWidth() / 2, 20, mPaint);
mPaint.setTextAlign(Paint.Align.CENTER);
mPaint.setTextAlign(Paint.Align.CENTER);
mPaint.setTextSize(3.0f);
mPaint.setColor(Color.BLACK);
mEndXPosition = pageInfo.getPageWidth() - 10;
startYPosition = 60;
canvas.drawText("START BAL INVENTORY", 70, 35, mPaint);
canvas.drawText("SCALES DETAILS", 160, 35, mPaint);
canvas.drawText("BALANCE DETAILS", 250, 35, mPaint);
canvas.drawText("CARD", 18, 45, mPaint);
canvas.drawText("KEY", 33, 45, mPaint);
canvas.drawText("OPEN", 48, 45, mPaint);
canvas.drawText("CLOSE", 67, 45, mPaint);
canvas.drawText("TOTAL", 93, 45, mPaint);
canvas.drawText("OPEN", 122, 45, mPaint);
canvas.drawText("CLOSE", 148, 45, mPaint);
canvas.drawText("TOTAL", 175, 45, mPaint);
canvas.drawText("AMOUNT", 196, 45, mPaint);
canvas.drawText("OPEN", 215, 45, mPaint);
canvas.drawText("CLOSE", 238, 45, mPaint);
canvas.drawText("BALANCE", 260, 45, mPaint);
canvas.drawText("TOTAL", 280, 45, mPaint);
return canvas;
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
void endPage(Canvas page) {
int endPos = startYPosition - 12;
page.drawLine(mStartXPosition, 30, mEndXPosition + 3, 30, mPaint);
page.drawLine(mStartXPosition, 40, mEndXPosition + 3, 40, mPaint);
page.drawLine(mStartXPosition, 50, mEndXPosition + 3, 50, mPaint);
page.drawLine(10, 30, 10, endPos, mPaint);
page.drawLine(25, 40, 25, endPos, mPaint);
page.drawLine(40, 40, 40, endPos, mPaint);
page.drawLine(58, 40, 58, endPos, mPaint);
page.drawLine(80, 40, 80, endPos, mPaint);
page.drawLine(110, 30, 110, endPos, mPaint);
page.drawLine(135, 40, 135, endPos, mPaint);
page.drawLine(160, 40, 160, endPos, mPaint);
page.drawLine(185, 40, 185, endPos, mPaint);
page.drawLine(205, 30, 205, endPos, mPaint);
page.drawLine(225, 40, 225, endPos, mPaint);
page.drawLine(250, 40, 250, endPos, mPaint);
page.drawLine(270, 40, 270, endPos, mPaint);
page.drawLine(290, 30, 290, endPos, mPaint);
mPDFDocument.finishPage(mPDFPage);
}
private void excelWorkBookWrite() {
currentMonth = String.valueOf(DateFormat.format("MMMM", new Date()));
currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet SecondSheet = workbook.createSheet("Mst" + month);
SecondSheet.setFitToPage(true);
HSSFRow row = SecondSheet.createRow(0);
HSSFCell cell1 = row.createCell(0);
SecondSheet.setColumnWidth(0, 25 * 60);
HSSFCell cell2 = row.createCell(1);
SecondSheet.setColumnWidth(1, 25 * 60);
HSSFCell cell3 = row.createCell(2);
SecondSheet.setColumnWidth(2, 25 * 70);
HSSFCell cell4 = row.createCell(3);
SecondSheet.setColumnWidth(3, 25 * 100);
HSSFCell cell5 = row.createCell(4);
SecondSheet.setColumnWidth(4, 25 * 100);
HSSFCell cell6 = row.createCell(5);
SecondSheet.setColumnWidth(5, 25 * 216);
HSSFCell cell7 = row.createCell(6);
SecondSheet.setColumnWidth(6, 25 * 100);
HSSFCell cell8 = row.createCell(7);
SecondSheet.setColumnWidth(7, 25 * 100);
HSSFCell cell9 = row.createCell(8);
SecondSheet.setColumnWidth(8, 25 * 100);
HSSFCell cell10 = row.createCell(9);
SecondSheet.setColumnWidth(9, 25 * 100);
HSSFCell cell11 = row.createCell(10);
SecondSheet.setColumnWidth(10, 25 * 100);
HSSFCell cell12 = row.createCell(11);
SecondSheet.setColumnWidth(11, 25 * 130);
HSSFCell cell13 = row.createCell(12);
SecondSheet.setColumnWidth(12, 25 * 130);
cell1.setCellValue(new HSSFRichTextString("CARD"));
cell2.setCellValue(new HSSFRichTextString("KEY"));
cell3.setCellValue(new HSSFRichTextString("OPENING NO"));
cell4.setCellValue(new HSSFRichTextString("CLOSING NO"));
cell5.setCellValue(new HSSFRichTextString("TOTAL CARD"));
cell6.setCellValue(new HSSFRichTextString("OPENING NO"));
cell7.setCellValue(new HSSFRichTextString("CLOSING NO"));
cell8.setCellValue(new HSSFRichTextString("TOTAL CARD"));
cell9.setCellValue(new HSSFRichTextString("SCALES AMOUNT"));
cell10.setCellValue(new HSSFRichTextString("OPENING NO"));
cell11.setCellValue(new HSSFRichTextString("CLOSING NO"));
cell12.setCellValue(new HSSFRichTextString("BALANCE CARD"));
cell13.setCellValue(new HSSFRichTextString("TOTAL CARD"));
for (int i = 0; i < mstOpeningClosings.size(); i++) {
HSSFRow rowA = SecondSheet.createRow(i + 1);
rowA.createCell(0).setCellValue(mstOpeningClosings.get(i).getMstCard());
rowA.createCell(1).setCellValue(mstOpeningClosings.get(i).getMstKey());
rowA.createCell(2).setCellValue(mstOpeningClosings.get(i).getMstOpening());
rowA.createCell(3).setCellValue(mstOpeningClosings.get(i).getMstClosing());
rowA.createCell(4).setCellValue(mstOpeningClosings.get(i).getMstTotal());
rowA.createCell(5).setCellValue(mstOpeningClosings.get(i).getMstOpenMax());
rowA.createCell(6).setCellValue(mstOpeningClosings.get(i).getMstCloseMax());
rowA.createCell(7).setCellValue(mstOpeningClosings.get(i).getMstTotalCard());
rowA.createCell(8).setCellValue(mstOpeningClosings.get(i).getMstTotalAmount());
rowA.createCell(9).setCellValue(mstOpeningClosings.get(i).getMstBalOpen());
rowA.createCell(10).setCellValue(mstOpeningClosings.get(i).getMstBalClose());
rowA.createCell(11).setCellValue(mstOpeningClosings.get(i).getMstBalCard());
rowA.createCell(12).setCellValue(mstOpeningClosings.get(i).getMstBalTotalCard());
}
FileOutputStream fos = null;
try {
File file;
File folder = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/TNSTC BUS PASS DETAILS");
if (!folder.mkdirs()) {
folder.mkdirs();
}
file = new File(folder + File.separator, "TNSTCMst" + month + year + ".xls");
fos = new FileOutputStream(file);
workbook.write(fos);
mAppClass.showSnackBar(getContext(), "Excel Sheet Download Successfully");
} catch (IOException e) {
e.printStackTrace();
Toast.makeText(mContext, "" + e, Toast.LENGTH_SHORT).show();
Log.e("TAG", "excelWorkBookWrite: " + e);
} finally {
if (fos != null) {
try {
fos.flush();
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
private void AdapterForMonthYear() {
getMonth = new ArrayList<>();
getYear = new ArrayList<>();
getYear = daoOpenClose.mstGetYear();
getMonth = daoOpenClose.mstGetMonth();
LinkedHashSet<String> monthSet = new LinkedHashSet<>();
monthSet.addAll(getMonth);
getMonth.clear();
getMonth.addAll(monthSet);
LinkedHashSet<String> yearSet = new LinkedHashSet<>();
yearSet.addAll(getYear);
getYear.clear();
getYear.addAll(yearSet);
ArrayAdapter yearList = new ArrayAdapter(getContext(), android.R.layout.simple_spinner_dropdown_item, getYear);
mBinding.yearListMst.setAdapter(yearList);
ArrayAdapter monthList = new ArrayAdapter(getContext(), android.R.layout.simple_spinner_dropdown_item, getMonth);
mBinding.monthListMst.setAdapter(monthList);
}
private void getMstEntry() {
//card200
String monthMst = String.valueOf(DateFormat.format("MMMM", new Date()));
String yearMst = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
int maxOpen200 = dao.mstMonthOpen200(monthMst, 200);
int maxClose200 = dao.mstMonthClose200(monthMst, 200);
int maxTotalCard = dao.mstMonthTotalCard200(monthMst, 200);
int maxTotalSales = dao.mstMonthTotalAmount200(monthMst, 200);
if (dao.mstMonthOpen200(monthMst, 200) != 0) {
balOpen200 = dao.mstMonthCloseMax200(monthMst, 200) + 1;
balClose200 = daoOpenClose.mstMonthBalClose200(monthMst, 200);
maxMonthOpenCard200 = dao.mstMonthCloseMax200(monthMst, 200);
balCard200 = daoOpenClose.mstMonthBalClose200(monthMst, 200) - maxMonthOpenCard200;
TotalBalCard200 = dao.mstMonthTotalCard200(monthMst, 200) + balCard200;
}
//card240
int maxOpen240 = dao.mstMonthOpen200(monthMst, 240);
int maxClose240 = dao.mstMonthClose200(monthMst, 240);
int maxTotalCard240 = dao.mstMonthTotalCard200(monthMst, 240);
int maxTotalSales240 = dao.mstMonthTotalAmount200(monthMst, 240);
if (dao.mstMonthOpen200(monthMst, 240) != 0) {
balOpen240 = dao.mstMonthCloseMax200(monthMst, 240) + 1;
balClose240 = daoOpenClose.mstMonthBalClose200(monthMst, 240);
maxMonthOpenCard240 = dao.mstMonthCloseMax200(monthMst, 240);
balCard240 = daoOpenClose.mstMonthBalClose200(monthMst, 240) - maxMonthOpenCard240;
TotalBalCard240 = dao.mstMonthTotalCard200(monthMst, 240) + balCard240;
}
//card280
int maxOpen280 = dao.mstMonthOpen200(monthMst, 280);
int maxClose280 = dao.mstMonthClose200(monthMst, 280);
int maxTotalCard280 = dao.mstMonthTotalCard200(monthMst, 280);
int maxTotalSales280 = dao.mstMonthTotalAmount200(monthMst, 280);
if (dao.mstMonthOpen200(monthMst, 280) != 0) {
balOpen280 = dao.mstMonthCloseMax200(monthMst, 280) + 1;
balClose280 = daoOpenClose.mstMonthBalClose200(monthMst, 280);
maxMonthOpenCard280 = dao.mstMonthCloseMax200(monthMst, 280);
balCard280 = daoOpenClose.mstMonthBalClose200(monthMst, 280) - maxMonthOpenCard280;
TotalBalCard280 = dao.mstMonthTotalCard200(monthMst, 280) + balCard280;
}
//card320
int maxOpen320 = dao.mstMonthOpen200(monthMst, 320);
int maxClose320 = dao.mstMonthClose200(monthMst, 320);
int maxTotalCard320 = dao.mstMonthTotalCard200(monthMst, 320);
int maxTotalSales320 = dao.mstMonthTotalAmount200(monthMst, 320);
if (dao.mstMonthOpen200(monthMst, 320) != 0) {
balOpen320 = dao.mstMonthCloseMax200(monthMst, 320) + 1;
balClose320 = daoOpenClose.mstMonthBalClose200(monthMst, 320);
maxMonthOpenCard320 = dao.mstMonthCloseMax200(monthMst, 320);
balCard320 = daoOpenClose.mstMonthBalClose200(monthMst, 320) - maxMonthOpenCard320;
TotalBalCard320 = dao.mstMonthTotalCard200(monthMst, 320) + balCard320;
}
//card360
int maxOpen360 = dao.mstMonthOpen200(monthMst, 360);
int maxClose360 = dao.mstMonthClose200(monthMst, 360);
int maxTotalCard360 = dao.mstMonthTotalCard200(monthMst, 360);
int maxTotalSales360 = dao.mstMonthTotalAmount200(monthMst, 360);
if (dao.mstMonthOpen200(monthMst, 360) != 0) {
balOpen360 = dao.mstMonthCloseMax200(monthMst, 360) + 1;
balClose360 = daoOpenClose.mstMonthBalClose200(monthMst, 360);
maxMonthOpenCard360 = dao.mstMonthCloseMax200(monthMst, 360);
balCard360 = daoOpenClose.mstMonthBalClose200(monthMst, 360) - maxMonthOpenCard360;
TotalBalCard360 = dao.mstMonthTotalCard200(monthMst, 360) + balCard360;
}
//card400
int maxOpen400 = dao.mstMonthOpen200(monthMst, 400);
int maxClose400 = dao.mstMonthClose200(monthMst, 400);
int maxTotalCard400 = dao.mstMonthTotalCard200(monthMst, 400);
int maxTotalSales400 = dao.mstMonthTotalAmount200(monthMst, 400);
if (dao.mstMonthOpen200(monthMst, 400) != 0) {
balOpen400 = dao.mstMonthCloseMax200(monthMst, 400) + 1;
balClose400 = daoOpenClose.mstMonthBalClose200(monthMst, 400);
maxMonthOpenCard400 = dao.mstMonthCloseMax200(monthMst, 400);
balCard400 = daoOpenClose.mstMonthBalClose200(monthMst, 400) - maxMonthOpenCard400;
TotalBalCard400 = dao.mstMonthTotalCard200(monthMst, 400) + balCard400;
}
//card440
int maxOpen440 = dao.mstMonthOpen200(monthMst, 440);
int maxClose440 = dao.mstMonthClose200(monthMst, 440);
int maxTotalCard440 = dao.mstMonthTotalCard200(monthMst, 440);
int maxTotalSales440 = dao.mstMonthTotalAmount200(monthMst, 440);
if (dao.mstMonthOpen200(monthMst, 440) != 0) {
balOpen440 = dao.mstMonthCloseMax200(monthMst, 440) + 1;
balClose440 = daoOpenClose.mstMonthBalClose200(monthMst, 440);
maxMonthOpenCard440 = dao.mstMonthCloseMax200(monthMst, 440);
balCard440 = daoOpenClose.mstMonthBalClose200(monthMst, 440) - maxMonthOpenCard440;
TotalBalCard440 = dao.mstMonthTotalCard200(monthMst, 440) + balCard440;
}
//card480
int maxOpen480 = dao.mstMonthOpen200(monthMst, 480);
int maxClose480 = dao.mstMonthClose200(monthMst, 480);
int maxTotalCard480 = dao.mstMonthTotalCard200(monthMst, 480);
int maxTotalSales480 = dao.mstMonthTotalAmount200(monthMst, 480);
if (dao.mstMonthOpen200(monthMst, 480) != 0) {
balOpen480 = dao.mstMonthCloseMax200(monthMst, 480) + 1;
balClose480 = daoOpenClose.mstMonthBalClose200(monthMst, 480);
maxMonthOpenCard480 = dao.mstMonthCloseMax200(monthMst, 480);
balCard480 = daoOpenClose.mstMonthBalClose200(monthMst, 480) - maxMonthOpenCard480;
TotalBalCard480 = dao.mstMonthTotalCard200(monthMst, 480) + balCard480;
}
//card520
int maxOpen520 = dao.mstMonthOpen200(monthMst, 520);
int maxClose520 = dao.mstMonthClose200(monthMst, 520);
int maxTotalCard520 = dao.mstMonthTotalCard200(monthMst, 520);
int maxTotalSales520 = dao.mstMonthTotalAmount200(monthMst, 520);
if (dao.mstMonthOpen200(monthMst, 520) != 0) {
balOpen520 = dao.mstMonthCloseMax200(monthMst, 520) + 1;
balClose520 = daoOpenClose.mstMonthBalClose200(monthMst, 520);
maxMonthOpenCard520 = dao.mstMonthCloseMax200(monthMst, 520);
balCard520 = daoOpenClose.mstMonthBalClose200(monthMst, 520) - maxMonthOpenCard520;
TotalBalCard520 = dao.mstMonthTotalCard200(monthMst, 520) + balCard520;
}
//card560
int maxOpen560 = dao.mstMonthOpen200(monthMst, 560);
int maxClose560 = dao.mstMonthClose200(monthMst, 560);
int maxTotalCard560 = dao.mstMonthTotalCard200(monthMst, 560);
int maxTotalSales560 = dao.mstMonthTotalAmount200(monthMst, 560);
if (dao.mstMonthOpen200(monthMst, 560) != 0) {
balOpen560 = dao.mstMonthCloseMax200(monthMst, 560) + 1;
balClose560 = daoOpenClose.mstMonthBalClose200(monthMst, 560);
maxMonthOpenCard560 = dao.mstMonthCloseMax200(monthMst, 560);
balCard560 = daoOpenClose.mstMonthBalClose200(monthMst, 560) - maxMonthOpenCard560;
TotalBalCard560 = dao.mstMonthTotalCard200(monthMst, 560) + balCard560;
}
//card600
int maxOpen600 = dao.mstMonthOpen200(monthMst, 600);
int maxClose600 = dao.mstMonthClose200(monthMst, 600);
int maxTotalCard600 = dao.mstMonthTotalCard200(monthMst, 600);
int maxTotalSales600 = dao.mstMonthTotalAmount200(monthMst, 600);
if (dao.mstMonthOpen200(monthMst, 600) != 0) {
balOpen600 = dao.mstMonthCloseMax200(monthMst, 600) + 1;
balClose600 = daoOpenClose.mstMonthBalClose200(monthMst, 600);
maxMonthOpenCard600 = dao.mstMonthCloseMax200(monthMst, 600);
balCard600 = daoOpenClose.mstMonthBalClose200(monthMst, 600) - maxMonthOpenCard600;
TotalBalCard600 = dao.mstMonthTotalCard200(monthMst, 600) + balCard600;
}
//card640
int maxOpen640 = dao.mstMonthOpen200(monthMst, 640);
int maxClose640 = dao.mstMonthClose200(monthMst, 640);
int maxTotalCard640 = dao.mstMonthTotalCard200(monthMst, 640);
int maxTotalSales640 = dao.mstMonthTotalAmount200(monthMst, 640);
if (dao.mstMonthOpen200(monthMst, 640) != 0) {
balOpen640 = dao.mstMonthCloseMax200(monthMst, 640) + 1;
balClose640 = daoOpenClose.mstMonthBalClose200(monthMst, 640);
maxMonthOpenCard640 = dao.mstMonthCloseMax200(monthMst, 640);
balCard640 = daoOpenClose.mstMonthBalClose200(monthMst, 640) - maxMonthOpenCard640;
TotalBalCard640 = dao.mstMonthTotalCard200(monthMst, 600) + balCard640;
}
//Card680
int maxOpen680 = dao.mstMonthOpen200(monthMst, 680);
int maxClose680 = dao.mstMonthClose200(monthMst, 680);
int maxTotalCard680 = dao.mstMonthTotalCard200(monthMst, 680);
int maxTotalSales680 = dao.mstMonthTotalAmount200(monthMst, 680);
if (dao.mstMonthOpen200(monthMst, 680) != 0) {
balOpen680 = dao.mstMonthCloseMax200(monthMst, 680) + 1;
balClose680 = daoOpenClose.mstMonthBalClose200(monthMst, 680);
maxMonthOpenCard680 = dao.mstMonthCloseMax200(monthMst, 680);
balCard680 = daoOpenClose.mstMonthBalClose200(monthMst, 680) - maxMonthOpenCard680;
TotalBalCard680 = dao.mstMonthTotalCard200(monthMst, 680) + balCard680;
}
//Card720
int maxOpen720 = dao.mstMonthOpen200(monthMst, 720);
int maxClose720 = dao.mstMonthClose200(monthMst, 720);
int maxTotalCard720 = dao.mstMonthTotalCard200(monthMst, 720);
int maxTotalSales720 = dao.mstMonthTotalAmount200(monthMst, 720);
if (dao.mstMonthOpen200(monthMst, 720) != 0) {
balOpen720 = dao.mstMonthCloseMax200(monthMst, 720) + 1;
balClose720 = daoOpenClose.mstMonthBalClose200(monthMst, 720);
maxMonthOpenCard720 = dao.mstMonthCloseMax200(monthMst, 720);
balCard720 = daoOpenClose.mstMonthBalClose200(monthMst, 720) - maxMonthOpenCard720;
TotalBalCard720 = dao.mstMonthTotalCard200(monthMst, 720) + balCard720;
}
//Caard760
int maxOpen760 = dao.mstMonthOpen200(monthMst, 760);
int maxClose760 = dao.mstMonthClose200(monthMst, 760);
int maxTotalCard760 = dao.mstMonthTotalCard200(monthMst, 760);
int maxTotalSales760 = dao.mstMonthTotalAmount200(monthMst, 760);
if (dao.mstMonthOpen200(monthMst, 760) != 0) {
balOpen760 = dao.mstMonthCloseMax200(monthMst, 760) + 1;
balClose760 = daoOpenClose.mstMonthBalClose200(monthMst, 760);
maxMonthOpenCard760 = dao.mstMonthCloseMax200(monthMst, 760);
balCard760 = daoOpenClose.mstMonthBalClose200(monthMst, 760) - maxMonthOpenCard760;
TotalBalCard760 = dao.mstMonthTotalCard200(monthMst, 760) + balCard760;
}
MstOpeningClosing MstOpeningClosing200 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 200),
daoOpenClose.mstOpening(monthMst, 200), daoOpenClose.mstClosing(monthMst, 200),
daoOpenClose.mstCard(monthMst, 200), daoOpenClose.mstSpare(monthMst, 200), daoOpenClose.mstKey(monthMst, 200),
daoOpenClose.mstTotal(monthMst, 200), monthMst, yearMst, maxOpen200, maxClose200,
maxTotalCard, maxTotalSales, balOpen200, balClose200, balCard200, TotalBalCard200);
MstOpeningClosing MstOpeningClosing240 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 240),
daoOpenClose.mstOpening(monthMst, 240), daoOpenClose.mstClosing(monthMst, 240),
daoOpenClose.mstCard(monthMst, 240), daoOpenClose.mstSpare(monthMst, 240), daoOpenClose.mstKey(monthMst, 240),
daoOpenClose.mstTotal(monthMst, 240), monthMst, yearMst, maxOpen240, maxClose240,
maxTotalCard240, maxTotalSales240, balOpen240, balClose240, balCard240, TotalBalCard240);
MstOpeningClosing MstOpeningClosing280 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 280),
daoOpenClose.mstOpening(monthMst, 280), daoOpenClose.mstClosing(monthMst, 280),
daoOpenClose.mstCard(monthMst, 280), daoOpenClose.mstSpare(monthMst, 280), daoOpenClose.mstKey(monthMst, 280),
daoOpenClose.mstTotal(monthMst, 280), monthMst, yearMst, maxOpen280, maxClose280,
maxTotalCard280, maxTotalSales280, balOpen280, balClose280, balCard280, TotalBalCard280);
MstOpeningClosing MstOpeningClosing320 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 320),
daoOpenClose.mstOpening(monthMst, 320), daoOpenClose.mstClosing(monthMst, 320),
daoOpenClose.mstCard(monthMst, 320), daoOpenClose.mstSpare(monthMst, 320), daoOpenClose.mstKey(monthMst, 320),
daoOpenClose.mstTotal(monthMst, 320), monthMst, yearMst, maxOpen320, maxClose320,
maxTotalCard320, maxTotalSales320, balOpen320, balClose320, balCard320, TotalBalCard320);
MstOpeningClosing MstOpeningClosing360 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 360),
daoOpenClose.mstOpening(monthMst, 360), daoOpenClose.mstClosing(monthMst, 360),
daoOpenClose.mstCard(monthMst, 360), daoOpenClose.mstSpare(monthMst, 360), daoOpenClose.mstKey(monthMst, 360),
daoOpenClose.mstTotal(monthMst, 360), monthMst, yearMst, maxOpen360, maxClose360,
maxTotalCard360, maxTotalSales360, balOpen360, balClose360, balCard360, TotalBalCard360);
MstOpeningClosing MstOpeningClosing400 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 400),
daoOpenClose.mstOpening(monthMst, 400), daoOpenClose.mstClosing(monthMst, 400),
daoOpenClose.mstCard(monthMst, 400), daoOpenClose.mstSpare(monthMst, 400), daoOpenClose.mstKey(monthMst, 400),
daoOpenClose.mstTotal(monthMst, 400), monthMst, yearMst, maxOpen400, maxClose400,
maxTotalCard400, maxTotalSales400, balOpen400, balClose400, balCard400, TotalBalCard400);
MstOpeningClosing MstOpeningClosing440 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 440),
daoOpenClose.mstOpening(monthMst, 440), daoOpenClose.mstClosing(monthMst, 440),
daoOpenClose.mstCard(monthMst, 440), daoOpenClose.mstSpare(monthMst, 440), daoOpenClose.mstKey(monthMst, 440),
daoOpenClose.mstTotal(monthMst, 440), monthMst, yearMst, maxOpen440, maxClose440,
maxTotalCard440, maxTotalSales440, balOpen440, balClose440, balCard440, TotalBalCard440);
MstOpeningClosing MstOpeningClosing480 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 480),
daoOpenClose.mstOpening(monthMst, 480), daoOpenClose.mstClosing(monthMst, 480),
daoOpenClose.mstCard(monthMst, 480), daoOpenClose.mstSpare(monthMst, 480), daoOpenClose.mstKey(monthMst, 480),
daoOpenClose.mstTotal(monthMst, 480), monthMst, yearMst, maxOpen480, maxClose480,
maxTotalCard480, maxTotalSales480, balOpen480, balClose480, balCard480, TotalBalCard480);
MstOpeningClosing MstOpeningClosing520 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 480),
daoOpenClose.mstOpening(monthMst, 520), daoOpenClose.mstClosing(monthMst, 520),
daoOpenClose.mstCard(monthMst, 520), daoOpenClose.mstSpare(monthMst, 520), daoOpenClose.mstKey(monthMst, 520),
daoOpenClose.mstTotal(monthMst, 520), monthMst, yearMst, maxOpen520, maxClose520,
maxTotalCard520, maxTotalSales520, balOpen520, balClose520, balCard520, TotalBalCard520);
MstOpeningClosing MstOpeningClosing560 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 560),
daoOpenClose.mstOpening(monthMst, 560), daoOpenClose.mstClosing(monthMst, 560),
daoOpenClose.mstCard(monthMst, 560), daoOpenClose.mstSpare(monthMst, 560), daoOpenClose.mstKey(monthMst, 560),
daoOpenClose.mstTotal(monthMst, 560), monthMst, yearMst, maxOpen560, maxClose560,
maxTotalCard560, maxTotalSales560, balOpen560, balClose560, balCard560, TotalBalCard560);
MstOpeningClosing MstOpeningClosing600 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 600),
daoOpenClose.mstOpening(monthMst, 600), daoOpenClose.mstClosing(monthMst, 600),
daoOpenClose.mstCard(monthMst, 600), daoOpenClose.mstSpare(monthMst, 600), daoOpenClose.mstKey(monthMst, 600),
daoOpenClose.mstTotal(monthMst, 600), monthMst, yearMst, maxOpen600, maxClose600,
maxTotalCard600, maxTotalSales600, balOpen600, balClose600, balCard600, TotalBalCard600);
MstOpeningClosing MstOpeningClosing640 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 640),
daoOpenClose.mstOpening(monthMst, 640), daoOpenClose.mstClosing(monthMst, 640),
daoOpenClose.mstCard(monthMst, 640), daoOpenClose.mstSpare(monthMst, 640), daoOpenClose.mstKey(monthMst, 640),
daoOpenClose.mstTotal(monthMst, 640), monthMst, yearMst, maxOpen640, maxClose640,
maxTotalCard640, maxTotalSales640, balOpen640, balClose640, balCard640, TotalBalCard640);
MstOpeningClosing MstOpeningClosing680 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 680),
daoOpenClose.mstOpening(monthMst, 680), daoOpenClose.mstClosing(monthMst, 680),
daoOpenClose.mstCard(monthMst, 680), daoOpenClose.mstSpare(monthMst, 680), daoOpenClose.mstKey(monthMst, 680),
daoOpenClose.mstTotal(monthMst, 680), monthMst, yearMst, maxOpen680, maxClose680,
maxTotalCard680, maxTotalSales680, balOpen680, balClose680, balCard680, TotalBalCard680);
MstOpeningClosing MstOpeningClosing720 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 720),
daoOpenClose.mstOpening(monthMst, 720), daoOpenClose.mstClosing(monthMst, 720),
daoOpenClose.mstCard(monthMst, 720), daoOpenClose.mstSpare(monthMst, 720), daoOpenClose.mstKey(monthMst, 720),
daoOpenClose.mstTotal(monthMst, 720), monthMst, yearMst, maxOpen720, maxClose720,
maxTotalCard720, maxTotalSales720, balOpen720, balClose720, balCard720, TotalBalCard720);
MstOpeningClosing MstOpeningClosing760 = new MstOpeningClosing(daoOpenClose.mstMonthYear(monthMst, 760),
daoOpenClose.mstOpening(monthMst, 760), daoOpenClose.mstClosing(monthMst, 760),
daoOpenClose.mstCard(monthMst, 760), daoOpenClose.mstSpare(monthMst, 760), daoOpenClose.mstKey(monthMst, 760),
daoOpenClose.mstTotal(monthMst, 760), monthMst, yearMst, maxOpen760, maxClose760,
maxTotalCard760, maxTotalSales760, balOpen760, balClose760, balCard760, TotalBalCard760);
List<MstOpeningClosing> MstOpeningClosingList = new ArrayList<>();
MstOpeningClosingList.add(MstOpeningClosing200);
MstOpeningClosingList.add(MstOpeningClosing240);
MstOpeningClosingList.add(MstOpeningClosing280);
MstOpeningClosingList.add(MstOpeningClosing320);
MstOpeningClosingList.add(MstOpeningClosing360);
MstOpeningClosingList.add(MstOpeningClosing400);
MstOpeningClosingList.add(MstOpeningClosing440);
MstOpeningClosingList.add(MstOpeningClosing480);
MstOpeningClosingList.add(MstOpeningClosing520);
MstOpeningClosingList.add(MstOpeningClosing560);
MstOpeningClosingList.add(MstOpeningClosing600);
MstOpeningClosingList.add(MstOpeningClosing640);
MstOpeningClosingList.add(MstOpeningClosing680);
MstOpeningClosingList.add(MstOpeningClosing720);
MstOpeningClosingList.add(MstOpeningClosing760);
updateMstMonthEntryToDb(MstOpeningClosingList);
}
public void updateMstMonthEntryToDb(List<MstOpeningClosing> entryList) {
TnstcBusPassDB db = TnstcBusPassDB.getDatabase(getContext());
MstOpeningDao dao = db.OpeningDao();
dao.insertMstMonth(entryList.toArray(new MstOpeningClosing[0]));
}
@Override
public void onDestroyView() {
super.onDestroyView();
View windowDecorView = requireActivity().getWindow().getDecorView();
windowDecorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
year = mBinding.yearListMst.getText().toString();
month = mBinding.monthListMst.getText().toString();
mstOpeningClosings = new ArrayList<>();
mstOpeningClosings = daoOpenClose.getMonthWiseMst(month, year);
mAdapter = new MstMonthWiseAdapter(mstOpeningClosings, this);
mBinding.recyclerMstMonth.setLayoutManager(new LinearLayoutManager(getContext()));
mBinding.recyclerMstMonth.setAdapter(mAdapter);
}
@Override
public void OnItemClick(View v, int pos) {
}
@Override
public void OnItemLongClick(View v, int pos, ConstraintLayout constraintLayout) {
startActionMode(pos, constraintLayout);
}
@Override
public void OnItemClickDate(View v, int adapterPosition, List<String> currentDateAndDay, ConstraintLayout constraintLayout) {
}
@Override
public void OnItemDate(int adapterPosition, List<DutyEntity> dutyEntities) {
}
public void startActionMode(int pos, ConstraintLayout constraintLayout) {
ActionMode.Callback userDelete = new ActionMode.Callback() {
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
mActionMode = mode;
mMultiSelect = true;
menu.add(R.string.delete).setIcon(R.drawable.ic_baseline_delete_24).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
return true;
}
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
mActionMode = mode;
return false;
}
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
switch (item.getTitle().toString()) {
case "Delete":
new MaterialAlertDialogBuilder(getContext()).setTitle(R.string.delete).setMessage(R.string.areYouSureWantToDelete).setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
daoOpenClose.delete(mstOpeningClosings.get(pos));
mstOpeningClosings.remove(mstOpeningClosings.get(pos));
mAdapter.notifyDataSetChanged();
}
}).setNegativeButton(R.string.no, null).show();
break;
}
return true;
}
@Override
public void onDestroyActionMode(ActionMode mode) {
mActionMode = mode;
mMultiSelect = false;
constraintLayout.setBackgroundColor(getResources().getColor(R.color.colorTransparentWhite));
mode.finish();
}
};
((AppCompatActivity) mContext).startSupportActionMode(userDelete);
}
}
| 44,527
| 0.683787
| 0.619467
| 834
| 52.389687
| 34.410912
| 202
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.593525
| false
| false
|
2
|
f77e11f16a9d8118b9076ac048d70be906433c52
| 21,672,404,991,121
|
6e620a04ac11c51525a9cbd0cd84b44a07f04962
|
/DyV/src/CuaternarySearch.java
|
c402add9844d43f7d779a2eeabf1b1b528b94617
|
[] |
no_license
|
MiguelRamosLop/TPA-basics
|
https://github.com/MiguelRamosLop/TPA-basics
|
434ac572c538adf12f68cedb709b7dd15dfb5f26
|
f34f6de818aab8c8c8589b3e86c2ded5cc5e9ee0
|
refs/heads/master
| 2023-06-22T13:11:56.732000
| 2021-07-26T07:58:25
| 2021-07-26T07:58:25
| 381,284,632
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.Scanner;
public class CuaternarySearch {
public static void main(String[] args) throws Exception {
int[] a = {10,1,2,9,4,5,8,7}; /* inicializamos el array de eejemplo */
Scanner sc = new Scanner(System.in); /* scanner para solicitar al usuario el numero */
boolean ordenado = true; /* booleano para saber si el array esta ordenado o no */
CuaternarySearch object = new CuaternarySearch(); /* creamos un objeto de la clase para llamara nuestros métodos*/
for (int i = 0; i < a.length; i++) { /* recorremos el array para comporbar si esta ordenado o no */
if (i + 1 < a.length) { /* lo recorremos hasta que lleguemos a la ultima pos posible sin sobrepasar los límites */
if (a[ i ] > a[i + 1]) { /* si el elemento actual es mayor que el siguiente acutalizamos el booleano*/
ordenado = false;
break;
}
}
}
boolean exists = false; /* booleano para saber si el numero se encuentyra dentro del array o no*/
System.out.println();
if (ordenado == true) { /* si el array ya esta ordenado */
System.out.println("El array ya está ordenado.");
for (int j = 0; j < a.length; j++ ) { /* imprimimos el array */
System.out.print(a[j] + " ");
}
System.out.println();
System.out.println("Digite el número a encontrar en el array...");
int n = sc.nextInt(); /* obligamos al user a que digite el numero a buscar en el array para devolver la pos*/
for (int k = 0; k < a.length; k++ ) { /* vemos si el numero se encuentra dentro */
if (a[k] == n) {
exists = true;
}
}
if (exists == true) { /* si esta dentro del array llamamos al algorimto de busqueda cuaternaria*/
System.out.println("Posicion del numero dentro del array: " +cuaternarysearch_v2(a, 0, a.length-1, n));
}
if (exists == false) { /* sino se los comunicamos al user*/
System.out.println("El numero introducido no se encuentra en el array... ");
}
} if (ordenado == false) { /* si el array no esta ordenado lo ordenamos */
System.out.println("El array no está ordenado. Ordenamos el array...");
object.bubblesearch(a); /* llamamos al bubblesort para que lo ordene*/
for (int k = 0; k < a.length; k++ ) { /* imprimimos el array*/
System.out.print(a[k] + " ");
}
System.out.println();
System.out.println("Digite el número a encontrar en el array...");
int n = sc.nextInt(); /* obligamos al user a que nos digite el numero */
for (int k = 0; k < a.length; k++ ) { /* vemos si el num esta dentro del array*/
if (a[k] == n) {
exists = true;
}
}
if (exists == true) { /* si lo esta llamamos al algoritmo de busqueda cuaternaria*/
System.out.println("Posicion del numero dentro del array: " +cuaternarysearch_v2(a, 0, a.length-1, n));
}
if (exists == false) { /* si no se lo comunicamos al user*/
System.out.println("El numero introducido no se encuentra en el array... ");
}
}
}//main
void bubblesearch( int[] arr) { /* algoritmo de ordenamiento burbuja */
int l = arr.length;
for (int i = 0; i < l-1; i++) {
for (int j = 0; j < l-i-1; j++) { /* recorremos el array hasta el límite*/
if (arr[j] > arr[j+1]) { /* si el valor de la pos es mayor a la pos posterior */
change(arr,j+1,j); /* intercambiamos las posiciones */
}
}
}
}//bubblesearch
void change (int[] arr, int i, int f) { /* intercambiar los valores mediante una variable auxiliar*/
int aux = arr[i];
arr[i] = arr[f];
arr[f] = aux;
}//change
public static int cuaternarysearch_v2 (int[] arr, int i, int f, int num) {
if ( i == f) { /* caso base: solo haya un dato donde inicio sea el final*/
if (num == arr[i]) { /* si el numero es el mismo que el que guarda la pos de init devolvemos la pos*/
return i;
} else {
int error = 0;
return error;
}
} else { /* caso recursivo: partir, llamar recursivamente y combinar */
/* realizamos las particiones, dividimos el array en 4 partes con 4 cuartiles*/
int h_1 = (i + f) / 4;
int h_2 = (i + f) / 2;
int h_3 = (3 * (i + f) )/ 4;
/* realizamos las comprobaciones, si el numero esta en las misma pos que los cuartiles */
/* o en su mismo intervalo*/
if (num <= arr[h_1] ) {
/* si el valor coincide devolvemos la pos */
if (num == arr[h_1]) {
return h_1;
} else { /* si el valor no coincide llamamos de nuevo a la funcion pero dentro del intervalo*/
return cuaternarysearch_v2(arr, i, h_1, num);
}
}
if (num > arr[h_1] && num <= arr[h_2]) {
if (num == arr[h_2]) { /* si el valor coincide devolvemos la pos */
return h_2;
} else {/* si el valor no coincide llamamos de nuevo a la funcion pero dentro del intervalo*/
return cuaternarysearch_v2(arr, h_1 + 1, h_2, num);
}
}
if (num > arr[h_2] && num <= arr[h_3]) {
if (num == arr[h_3]) { /* si el valor coincide devolvemos la pos */
return h_3;
} else {/* si el valor no coincide llamamos de nuevo a la funcion pero dentro del intervalo*/
return cuaternarysearch_v2(arr, h_2 + 1, h_3, num);
}
}
if (num > arr[h_3]) {
/* si el valor no coincide llamamos de nuevo a la funcion pero dentro del intervalo*/
return cuaternarysearch_v2(arr, h_3 + 1, f, num);
} else {
int error = 0;
return error;
}
}
}
}
|
UTF-8
|
Java
| 6,448
|
java
|
CuaternarySearch.java
|
Java
|
[] | null |
[] |
import java.util.Scanner;
public class CuaternarySearch {
public static void main(String[] args) throws Exception {
int[] a = {10,1,2,9,4,5,8,7}; /* inicializamos el array de eejemplo */
Scanner sc = new Scanner(System.in); /* scanner para solicitar al usuario el numero */
boolean ordenado = true; /* booleano para saber si el array esta ordenado o no */
CuaternarySearch object = new CuaternarySearch(); /* creamos un objeto de la clase para llamara nuestros métodos*/
for (int i = 0; i < a.length; i++) { /* recorremos el array para comporbar si esta ordenado o no */
if (i + 1 < a.length) { /* lo recorremos hasta que lleguemos a la ultima pos posible sin sobrepasar los límites */
if (a[ i ] > a[i + 1]) { /* si el elemento actual es mayor que el siguiente acutalizamos el booleano*/
ordenado = false;
break;
}
}
}
boolean exists = false; /* booleano para saber si el numero se encuentyra dentro del array o no*/
System.out.println();
if (ordenado == true) { /* si el array ya esta ordenado */
System.out.println("El array ya está ordenado.");
for (int j = 0; j < a.length; j++ ) { /* imprimimos el array */
System.out.print(a[j] + " ");
}
System.out.println();
System.out.println("Digite el número a encontrar en el array...");
int n = sc.nextInt(); /* obligamos al user a que digite el numero a buscar en el array para devolver la pos*/
for (int k = 0; k < a.length; k++ ) { /* vemos si el numero se encuentra dentro */
if (a[k] == n) {
exists = true;
}
}
if (exists == true) { /* si esta dentro del array llamamos al algorimto de busqueda cuaternaria*/
System.out.println("Posicion del numero dentro del array: " +cuaternarysearch_v2(a, 0, a.length-1, n));
}
if (exists == false) { /* sino se los comunicamos al user*/
System.out.println("El numero introducido no se encuentra en el array... ");
}
} if (ordenado == false) { /* si el array no esta ordenado lo ordenamos */
System.out.println("El array no está ordenado. Ordenamos el array...");
object.bubblesearch(a); /* llamamos al bubblesort para que lo ordene*/
for (int k = 0; k < a.length; k++ ) { /* imprimimos el array*/
System.out.print(a[k] + " ");
}
System.out.println();
System.out.println("Digite el número a encontrar en el array...");
int n = sc.nextInt(); /* obligamos al user a que nos digite el numero */
for (int k = 0; k < a.length; k++ ) { /* vemos si el num esta dentro del array*/
if (a[k] == n) {
exists = true;
}
}
if (exists == true) { /* si lo esta llamamos al algoritmo de busqueda cuaternaria*/
System.out.println("Posicion del numero dentro del array: " +cuaternarysearch_v2(a, 0, a.length-1, n));
}
if (exists == false) { /* si no se lo comunicamos al user*/
System.out.println("El numero introducido no se encuentra en el array... ");
}
}
}//main
void bubblesearch( int[] arr) { /* algoritmo de ordenamiento burbuja */
int l = arr.length;
for (int i = 0; i < l-1; i++) {
for (int j = 0; j < l-i-1; j++) { /* recorremos el array hasta el límite*/
if (arr[j] > arr[j+1]) { /* si el valor de la pos es mayor a la pos posterior */
change(arr,j+1,j); /* intercambiamos las posiciones */
}
}
}
}//bubblesearch
void change (int[] arr, int i, int f) { /* intercambiar los valores mediante una variable auxiliar*/
int aux = arr[i];
arr[i] = arr[f];
arr[f] = aux;
}//change
public static int cuaternarysearch_v2 (int[] arr, int i, int f, int num) {
if ( i == f) { /* caso base: solo haya un dato donde inicio sea el final*/
if (num == arr[i]) { /* si el numero es el mismo que el que guarda la pos de init devolvemos la pos*/
return i;
} else {
int error = 0;
return error;
}
} else { /* caso recursivo: partir, llamar recursivamente y combinar */
/* realizamos las particiones, dividimos el array en 4 partes con 4 cuartiles*/
int h_1 = (i + f) / 4;
int h_2 = (i + f) / 2;
int h_3 = (3 * (i + f) )/ 4;
/* realizamos las comprobaciones, si el numero esta en las misma pos que los cuartiles */
/* o en su mismo intervalo*/
if (num <= arr[h_1] ) {
/* si el valor coincide devolvemos la pos */
if (num == arr[h_1]) {
return h_1;
} else { /* si el valor no coincide llamamos de nuevo a la funcion pero dentro del intervalo*/
return cuaternarysearch_v2(arr, i, h_1, num);
}
}
if (num > arr[h_1] && num <= arr[h_2]) {
if (num == arr[h_2]) { /* si el valor coincide devolvemos la pos */
return h_2;
} else {/* si el valor no coincide llamamos de nuevo a la funcion pero dentro del intervalo*/
return cuaternarysearch_v2(arr, h_1 + 1, h_2, num);
}
}
if (num > arr[h_2] && num <= arr[h_3]) {
if (num == arr[h_3]) { /* si el valor coincide devolvemos la pos */
return h_3;
} else {/* si el valor no coincide llamamos de nuevo a la funcion pero dentro del intervalo*/
return cuaternarysearch_v2(arr, h_2 + 1, h_3, num);
}
}
if (num > arr[h_3]) {
/* si el valor no coincide llamamos de nuevo a la funcion pero dentro del intervalo*/
return cuaternarysearch_v2(arr, h_3 + 1, f, num);
} else {
int error = 0;
return error;
}
}
}
}
| 6,448
| 0.505977
| 0.495886
| 133
| 47.421051
| 36.805771
| 126
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.714286
| false
| false
|
2
|
d361025eacb426b302d83bad5217478895aa57b7
| 16,320,875,778,349
|
4de3dab44e2c22322c3477e7ea07c8fa8e502df9
|
/app/src/main/java/com/example/uipl/googlemap/MainActivity.java
|
48c4db1b27f8f8ab4776003998ae48a859e329fa
|
[] |
no_license
|
ajayVinay/GoogleMapIntegration
|
https://github.com/ajayVinay/GoogleMapIntegration
|
2756222aabafaec0839a3f7447bc57dde18ec1b7
|
051c51b4a6c0d2ce8b95b16c78147ba94e37a816
|
refs/heads/master
| 2020-07-12T16:36:06.687000
| 2019-08-28T06:38:23
| 2019-08-28T06:38:23
| 204,864,636
| 0
| 1
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.uipl.googlemap;
import android.app.Dialog;
import android.content.Intent;
import android.nfc.Tag;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.telecom.Connection;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
public class MainActivity extends AppCompatActivity {
private static final String TAG = "MainActivity";
private static final int ERROR_DIALOG_EQUEST=9001;
private Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if(isServiceOK()) {
init();
}
}
private void init() {
button = (Button)findViewById(R.id.btnMap);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this,MapActivity.class);
startActivity(intent);
}
});
}
private Boolean isServiceOK() {
Log.d(TAG, "isServiceOK: check google service version ");
int available = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(MainActivity.this);
if (available== ConnectionResult.SUCCESS) {
// everythig is fine and user can make map request
Log.d(TAG, "isServiceOK: Google services is working");
return true;
}else if (GoogleApiAvailability.getInstance().isUserResolvableError(available))
{
//an error occured but we can handle it
Log.d(TAG, "isServiceOK: an error occured but we can fix it ");
Dialog dialog= GoogleApiAvailability.getInstance()
.getErrorDialog(MainActivity.this,available,ERROR_DIALOG_EQUEST);
dialog.show();
}else {
Toast.makeText(this,"we can't make this request",Toast.LENGTH_SHORT).show();
}
return false;
}
}
|
UTF-8
|
Java
| 2,200
|
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package com.example.uipl.googlemap;
import android.app.Dialog;
import android.content.Intent;
import android.nfc.Tag;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.telecom.Connection;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
public class MainActivity extends AppCompatActivity {
private static final String TAG = "MainActivity";
private static final int ERROR_DIALOG_EQUEST=9001;
private Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if(isServiceOK()) {
init();
}
}
private void init() {
button = (Button)findViewById(R.id.btnMap);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this,MapActivity.class);
startActivity(intent);
}
});
}
private Boolean isServiceOK() {
Log.d(TAG, "isServiceOK: check google service version ");
int available = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(MainActivity.this);
if (available== ConnectionResult.SUCCESS) {
// everythig is fine and user can make map request
Log.d(TAG, "isServiceOK: Google services is working");
return true;
}else if (GoogleApiAvailability.getInstance().isUserResolvableError(available))
{
//an error occured but we can handle it
Log.d(TAG, "isServiceOK: an error occured but we can fix it ");
Dialog dialog= GoogleApiAvailability.getInstance()
.getErrorDialog(MainActivity.this,available,ERROR_DIALOG_EQUEST);
dialog.show();
}else {
Toast.makeText(this,"we can't make this request",Toast.LENGTH_SHORT).show();
}
return false;
}
}
| 2,200
| 0.665
| 0.662727
| 59
| 36.288136
| 25.799128
| 110
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.677966
| false
| false
|
2
|
5c6b02c277de45cd6bb2dd460a563a01831795e5
| 13,219,909,339,400
|
e682fa3667adce9277ecdedb40d4d01a785b3912
|
/internal/fischer/mangf/A062518.java
|
96e76e8ecfa8aec4fa6394ee37c9c71e466ac20d
|
[
"Apache-2.0"
] |
permissive
|
gfis/joeis-lite
|
https://github.com/gfis/joeis-lite
|
859158cb8fc3608febf39ba71ab5e72360b32cb4
|
7185a0b62d54735dc3d43d8fb5be677734f99101
|
refs/heads/master
| 2023-08-31T00:23:51.216000
| 2023-08-29T21:11:31
| 2023-08-29T21:11:31
| 179,938,034
| 4
| 1
|
Apache-2.0
| false
| 2022-06-25T22:47:19
| 2019-04-07T08:35:01
| 2022-03-26T06:04:12
| 2022-06-25T22:47:18
| 8,156
| 3
| 0
| 1
|
Roff
| false
| false
|
package irvine.oeis.a062;
import irvine.math.z.Z;
import irvine.math.z.ZUtils;
import irvine.oeis.Sequence1;
/**
* A062518 Conjectural largest exponent k such that n^k does not contain all of the digits 0 through 9 (in decimal notation) or 0 if no such k exists (for example if n is a power of 10).
* @author Sean A. Irvine
*/
public class A062518 extends Sequence1 {
private static final int HEURISTIC = 100;
private long mN = 0;
private long mT = 1;
@Override
public Z next() {
if (++mN == mT) {
mT *= 10;
return Z.ZERO; // powers of 10 are 0
}
long prevMax = 0;
long k = 0;
Z nk = Z.ONE;
while (prevMax + HEURISTIC >= k) {
++k;
nk = nk.multiply(mN);
if (ZUtils.syn(nk) != 0b1111111111) {
prevMax = k;
}
}
return Z.valueOf(prevMax);
}
}
|
UTF-8
|
Java
| 834
|
java
|
A062518.java
|
Java
|
[
{
"context": "ts (for example if n is a power of 10).\n * @author Sean A. Irvine\n */\npublic class A062518 extends Sequence1 {\n\n p",
"end": 327,
"score": 0.999885082244873,
"start": 313,
"tag": "NAME",
"value": "Sean A. Irvine"
}
] | null |
[] |
package irvine.oeis.a062;
import irvine.math.z.Z;
import irvine.math.z.ZUtils;
import irvine.oeis.Sequence1;
/**
* A062518 Conjectural largest exponent k such that n^k does not contain all of the digits 0 through 9 (in decimal notation) or 0 if no such k exists (for example if n is a power of 10).
* @author <NAME>
*/
public class A062518 extends Sequence1 {
private static final int HEURISTIC = 100;
private long mN = 0;
private long mT = 1;
@Override
public Z next() {
if (++mN == mT) {
mT *= 10;
return Z.ZERO; // powers of 10 are 0
}
long prevMax = 0;
long k = 0;
Z nk = Z.ONE;
while (prevMax + HEURISTIC >= k) {
++k;
nk = nk.multiply(mN);
if (ZUtils.syn(nk) != 0b1111111111) {
prevMax = k;
}
}
return Z.valueOf(prevMax);
}
}
| 826
| 0.611511
| 0.557554
| 35
| 22.828571
| 30.980625
| 186
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.457143
| false
| false
|
2
|
e5267b7b4ffe4a6cecd55573f3b20f6d3c61e923
| 13,219,909,341,982
|
44fb513af7b4372ab3d044d016ae74383b07fcc3
|
/Food/src/switchcase/Forloop3.java
|
a31e5f3b8735382a88373c34d7456e535c2ddc96
|
[] |
no_license
|
ANWAIERJUMAI/Java-Eclipse
|
https://github.com/ANWAIERJUMAI/Java-Eclipse
|
7eb9a960f7244feb20d217c4360dc8d336c95eac
|
af817fbd382eacb38dee311c92b615aefa8188af
|
refs/heads/master
| 2020-03-27T06:55:43.108000
| 2018-08-26T03:39:40
| 2018-08-26T03:39:40
| 146,147,569
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package switchcase;
public class Forloop3 {
public static void main(String[] args) {
for (int a=5; a<=10;a++)
System.out.println("The value of a is "+a);
}
}
|
UTF-8
|
Java
| 185
|
java
|
Forloop3.java
|
Java
|
[] | null |
[] |
package switchcase;
public class Forloop3 {
public static void main(String[] args) {
for (int a=5; a<=10;a++)
System.out.println("The value of a is "+a);
}
}
| 185
| 0.583784
| 0.562162
| 11
| 14.818182
| 16.430672
| 46
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.363636
| false
| false
|
2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.