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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e7d048f91a0bf7fa1e8c8b0316d0fd7d5982e6b3 | 1,700,807,090,919 | e315c2bb2ea17cd8388a39aa0587e47cb417af0a | /src/tn/com/smartsoft/commons/xml/XmlParserManagerImp.java | bc74f7c6f865b8c14d0e9c3ea68d10eed984f537 | [] | no_license | wissem007/badges | https://github.com/wissem007/badges | 000536a40e34e20592fe6e4cb2684d93604c44c9 | 2064bd07b52141cf3cff0892e628cc62b4f94fdc | refs/heads/master | 2020-12-26T14:06:11.693000 | 2020-01-31T23:40:07 | 2020-01-31T23:40:07 | 237,530,008 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package tn.com.smartsoft.commons.xml;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.io.Writer;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.digester.Digester;
import org.apache.commons.digester.xmlrules.DigesterLoader;
import org.apache.commons.lang.StringUtils;
import tn.com.smartsoft.commons.exceptions.TechnicalException;
import tn.com.smartsoft.commons.log.Logger;
import tn.com.smartsoft.commons.utils.FileLocator;
import tn.com.smartsoft.commons.xml.binding.XmlClassBinding;
import tn.com.smartsoft.commons.xml.parser.XmlConfiguration;
import tn.com.smartsoft.commons.xml.parser.XmlElement;
import tn.com.smartsoft.commons.xml.parser.XmlParserUtils;
import tn.com.smartsoft.commons.xml.utils.XmlNodeValue;
import tn.com.smartsoft.commons.xml.utils.XmlWriterUtils;
public class XmlParserManagerImp implements Serializable, XmlParserManager {
/**
*
*/
private static final long serialVersionUID = 1L;
protected Logger logger = Logger.getLogger(XmlParserManager.class);
private Map<String, XmlClassBinding> classBindings = new HashMap<String, XmlClassBinding>(0);
private URL rules;
private String packageValue;
private FileLocator fileLocator = new FileLocator();
public String getPackageValue() {
return packageValue;
}
public void setPackageValue(String packageValue) {
this.packageValue = packageValue;
}
public XmlParserManagerImp() {
rules = fileLocator.getConfURL("tn/com/smartsoft/commons/xml/xml-mapping-rules.xml");
}
public void addClassBinding(XmlClassBinding value) {
value.setPackageValue(packageValue);
if (value.getName().indexOf(".") < 0)
value.setName(getPackageValue() + "." + value.getName());
if (StringUtils.isNotBlank(value.getExtendsClass())) {
if (value.getExtendsClass().indexOf(".") < 0)
value.setExtendsClass(getPackageValue() + "." + value.getExtendsClass());
}
classBindings.put(value.getName(), value);
}
public XmlClassBinding getClassBinding(String name) {
if (classBindings.get(name) == null)
throw new TechnicalException("no xml definition form class name :" + name);
return (XmlClassBinding) classBindings.get(name);
}
public XmlElement loadXmlRessource(String file) throws TechnicalException {
try {
logger.info("Reading mappings from resource :" + file);
XmlElement resutat = new XmlConfiguration(fileLocator.getConfURL(file));
return resutat;
} catch (Exception e) {
if (e instanceof TechnicalException) {
throw (TechnicalException) e;
}
throw new TechnicalException("error de chargement de fichie :" + file, e);
}
}
@SuppressWarnings("unchecked")
public List getListResultat(InputStream inputFile, Class resultClass) {
try {
return XmlParserUtils.getListResultat(inputFile, this, resultClass);
} catch (Exception e) {
if (e instanceof TechnicalException) {
throw (TechnicalException) e;
}
throw new TechnicalException(e);
}
}
@SuppressWarnings("unchecked")
public Map getMapResultat(InputStream inputFile, Class resultClass, String propertyKey) {
try {
return XmlParserUtils.getMapResultat(inputFile, this, resultClass, propertyKey);
} catch (Exception e) {
if (e instanceof TechnicalException) {
throw (TechnicalException) e;
}
throw new TechnicalException(e);
}
}
@SuppressWarnings("unchecked")
public Object getUniqueResultat(InputStream inputFile, Class resultClass) throws TechnicalException {
try {
return XmlParserUtils.getUniqueResultat(inputFile, this, resultClass);
} catch (Exception e) {
if (e instanceof TechnicalException) {
throw (TechnicalException) e;
}
throw new TechnicalException(e);
}
}
@SuppressWarnings("unchecked")
public List getListResultat(String file, Class resultClass) {
try {
return XmlParserUtils.getListResultat(file, this, resultClass);
} catch (Exception e) {
if (e instanceof TechnicalException) {
throw (TechnicalException) e;
}
throw new TechnicalException(e);
}
}
@SuppressWarnings("unchecked")
public Map getMapResultat(String file, Class resultClass, String propertyKey) {
try {
return XmlParserUtils.getMapResultat(file, this, resultClass, propertyKey);
} catch (Exception e) {
if (e instanceof TechnicalException) {
throw (TechnicalException) e;
}
throw new TechnicalException(e);
}
}
@SuppressWarnings("unchecked")
public Object getUniqueResultat(String file, Class resultClass) throws TechnicalException {
try {
return XmlParserUtils.getUniqueResultat(file, this, resultClass);
} catch (Exception e) {
if (e instanceof TechnicalException) {
throw (TechnicalException) e;
}
throw new TechnicalException(e);
}
}
@SuppressWarnings("unchecked")
public Object getUniqueResultat(XmlElement rootElement, Class resultClass) throws TechnicalException {
try {
return XmlParserUtils.getUniqueResultat(rootElement, this, resultClass);
} catch (Exception e) {
if (e instanceof TechnicalException) {
throw (TechnicalException) e;
}
throw new TechnicalException(e);
}
}
public void wirtBeanToXml(Writer writer, Object bean) throws IOException {
XmlNodeValue nodeValue = XmlWriterUtils.transformToXml(bean, this);
nodeValue.createNode(writer);
}
@SuppressWarnings("unchecked")
public void wirtListToXml(Writer writer, List listBean, String rootNodeName) throws IOException {
XmlNodeValue nodeValue = XmlWriterUtils.transformToXml(listBean, rootNodeName, this);
nodeValue.createNode(writer);
}
@SuppressWarnings("unchecked")
public void wirtMapToXml(Writer writer, Map listBean, String rootNodeName) throws IOException {
XmlNodeValue nodeValue = XmlWriterUtils.transformToXml(listBean, rootNodeName, this);
nodeValue.createNode(writer);
}
public void loadBindingRessource(String file) throws TechnicalException {
Digester digester = DigesterLoader.createDigester(rules);
digester.push(XmlParserManagerImp.this);
digester.addCallMethod("xml-binding-system/binding", "addBindingRessource", 1);
digester.addCallParam("xml-binding-system/binding", 0, "location");
try {
digester.parse(fileLocator.getConfStream(file));
} catch (Exception e) {
throw new TechnicalException(e);
}
}
public void addBindingRessource(String file) throws TechnicalException {
Digester digester = DigesterLoader.createDigester(rules);
digester.push(XmlParserManagerImp.this);
try {
digester.parse(fileLocator.getConfStream(file));
} catch (Exception e) {
if (e instanceof TechnicalException) {
throw (TechnicalException) e;
}
throw new TechnicalException(e);
}
}
}
| UTF-8 | Java | 6,687 | java | XmlParserManagerImp.java | Java | [] | null | [] | package tn.com.smartsoft.commons.xml;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.io.Writer;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.digester.Digester;
import org.apache.commons.digester.xmlrules.DigesterLoader;
import org.apache.commons.lang.StringUtils;
import tn.com.smartsoft.commons.exceptions.TechnicalException;
import tn.com.smartsoft.commons.log.Logger;
import tn.com.smartsoft.commons.utils.FileLocator;
import tn.com.smartsoft.commons.xml.binding.XmlClassBinding;
import tn.com.smartsoft.commons.xml.parser.XmlConfiguration;
import tn.com.smartsoft.commons.xml.parser.XmlElement;
import tn.com.smartsoft.commons.xml.parser.XmlParserUtils;
import tn.com.smartsoft.commons.xml.utils.XmlNodeValue;
import tn.com.smartsoft.commons.xml.utils.XmlWriterUtils;
public class XmlParserManagerImp implements Serializable, XmlParserManager {
/**
*
*/
private static final long serialVersionUID = 1L;
protected Logger logger = Logger.getLogger(XmlParserManager.class);
private Map<String, XmlClassBinding> classBindings = new HashMap<String, XmlClassBinding>(0);
private URL rules;
private String packageValue;
private FileLocator fileLocator = new FileLocator();
public String getPackageValue() {
return packageValue;
}
public void setPackageValue(String packageValue) {
this.packageValue = packageValue;
}
public XmlParserManagerImp() {
rules = fileLocator.getConfURL("tn/com/smartsoft/commons/xml/xml-mapping-rules.xml");
}
public void addClassBinding(XmlClassBinding value) {
value.setPackageValue(packageValue);
if (value.getName().indexOf(".") < 0)
value.setName(getPackageValue() + "." + value.getName());
if (StringUtils.isNotBlank(value.getExtendsClass())) {
if (value.getExtendsClass().indexOf(".") < 0)
value.setExtendsClass(getPackageValue() + "." + value.getExtendsClass());
}
classBindings.put(value.getName(), value);
}
public XmlClassBinding getClassBinding(String name) {
if (classBindings.get(name) == null)
throw new TechnicalException("no xml definition form class name :" + name);
return (XmlClassBinding) classBindings.get(name);
}
public XmlElement loadXmlRessource(String file) throws TechnicalException {
try {
logger.info("Reading mappings from resource :" + file);
XmlElement resutat = new XmlConfiguration(fileLocator.getConfURL(file));
return resutat;
} catch (Exception e) {
if (e instanceof TechnicalException) {
throw (TechnicalException) e;
}
throw new TechnicalException("error de chargement de fichie :" + file, e);
}
}
@SuppressWarnings("unchecked")
public List getListResultat(InputStream inputFile, Class resultClass) {
try {
return XmlParserUtils.getListResultat(inputFile, this, resultClass);
} catch (Exception e) {
if (e instanceof TechnicalException) {
throw (TechnicalException) e;
}
throw new TechnicalException(e);
}
}
@SuppressWarnings("unchecked")
public Map getMapResultat(InputStream inputFile, Class resultClass, String propertyKey) {
try {
return XmlParserUtils.getMapResultat(inputFile, this, resultClass, propertyKey);
} catch (Exception e) {
if (e instanceof TechnicalException) {
throw (TechnicalException) e;
}
throw new TechnicalException(e);
}
}
@SuppressWarnings("unchecked")
public Object getUniqueResultat(InputStream inputFile, Class resultClass) throws TechnicalException {
try {
return XmlParserUtils.getUniqueResultat(inputFile, this, resultClass);
} catch (Exception e) {
if (e instanceof TechnicalException) {
throw (TechnicalException) e;
}
throw new TechnicalException(e);
}
}
@SuppressWarnings("unchecked")
public List getListResultat(String file, Class resultClass) {
try {
return XmlParserUtils.getListResultat(file, this, resultClass);
} catch (Exception e) {
if (e instanceof TechnicalException) {
throw (TechnicalException) e;
}
throw new TechnicalException(e);
}
}
@SuppressWarnings("unchecked")
public Map getMapResultat(String file, Class resultClass, String propertyKey) {
try {
return XmlParserUtils.getMapResultat(file, this, resultClass, propertyKey);
} catch (Exception e) {
if (e instanceof TechnicalException) {
throw (TechnicalException) e;
}
throw new TechnicalException(e);
}
}
@SuppressWarnings("unchecked")
public Object getUniqueResultat(String file, Class resultClass) throws TechnicalException {
try {
return XmlParserUtils.getUniqueResultat(file, this, resultClass);
} catch (Exception e) {
if (e instanceof TechnicalException) {
throw (TechnicalException) e;
}
throw new TechnicalException(e);
}
}
@SuppressWarnings("unchecked")
public Object getUniqueResultat(XmlElement rootElement, Class resultClass) throws TechnicalException {
try {
return XmlParserUtils.getUniqueResultat(rootElement, this, resultClass);
} catch (Exception e) {
if (e instanceof TechnicalException) {
throw (TechnicalException) e;
}
throw new TechnicalException(e);
}
}
public void wirtBeanToXml(Writer writer, Object bean) throws IOException {
XmlNodeValue nodeValue = XmlWriterUtils.transformToXml(bean, this);
nodeValue.createNode(writer);
}
@SuppressWarnings("unchecked")
public void wirtListToXml(Writer writer, List listBean, String rootNodeName) throws IOException {
XmlNodeValue nodeValue = XmlWriterUtils.transformToXml(listBean, rootNodeName, this);
nodeValue.createNode(writer);
}
@SuppressWarnings("unchecked")
public void wirtMapToXml(Writer writer, Map listBean, String rootNodeName) throws IOException {
XmlNodeValue nodeValue = XmlWriterUtils.transformToXml(listBean, rootNodeName, this);
nodeValue.createNode(writer);
}
public void loadBindingRessource(String file) throws TechnicalException {
Digester digester = DigesterLoader.createDigester(rules);
digester.push(XmlParserManagerImp.this);
digester.addCallMethod("xml-binding-system/binding", "addBindingRessource", 1);
digester.addCallParam("xml-binding-system/binding", 0, "location");
try {
digester.parse(fileLocator.getConfStream(file));
} catch (Exception e) {
throw new TechnicalException(e);
}
}
public void addBindingRessource(String file) throws TechnicalException {
Digester digester = DigesterLoader.createDigester(rules);
digester.push(XmlParserManagerImp.this);
try {
digester.parse(fileLocator.getConfStream(file));
} catch (Exception e) {
if (e instanceof TechnicalException) {
throw (TechnicalException) e;
}
throw new TechnicalException(e);
}
}
}
| 6,687 | 0.75729 | 0.756393 | 206 | 31.461164 | 27.995422 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.184466 | false | false | 2 |
dc542a558e1b735ece3f0a3390062b76a39bbcf6 | 7,507,602,881,542 | cd0d228eb477db29cf78639b722625829cf970b9 | /app/src/main/java/com/example/designingfiles/MainActivity.java | 191c3ec960bc24639b0e48974a8fe0bb52fc739e | [] | no_license | pragati5355/SnapChat_DesignGUI | https://github.com/pragati5355/SnapChat_DesignGUI | 1a839996cacf5c565d3bd05db9f670bfdec27981 | f3fdb9e0b8312ee698cf759bbf9b808e4e37c918 | refs/heads/master | 2023-03-24T08:56:31.241000 | 2021-03-04T10:14:47 | 2021-03-04T10:14:47 | 344,431,540 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.designingfiles;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ListView;
public class MainActivity extends AppCompatActivity {
ListView listsnapview;
String[] Name1={"Sayali Kadam","Mansee Katke","Sahil Bhilare","Deep Bhilare","Harshali Dhage","Yugandhar Mayekar",
"Siddhi Shinde","Dinesh Choudhary","Aakanshya Jagtap","Rutuja Satav","Bhishali","Rutuja Sapkal",
"Sangram","Akash Gawade","Anup Gawade","Suraj Gawade","Akshay Gawade"};
String[] Name2={"New snap","New snap","New snap","Tap to load","New snap","New snap",
"New snap","Tap to load","New snap","Tap to load","New snap","New snap",
"New snap","Tap to load","New snap","New snap","New snap"};
String [] Name3= {"12h","6h","1w","1d","2d","2w","2w","5w","1mo","3w","3d","3d","5mo","5mo","7mo","7mo","7mo"};
String [] Name4={"10","15","10","30","50","20","6","2","0","0","0","0","0","0","0","0","0"};
int [] snapImages={R.drawable.girl1,R.drawable.girl2,R.drawable.boy1,R.drawable.boy2,R.drawable.girl3,R.drawable.boy3,
R.drawable.girl4,R.drawable.boy4,R.drawable.girl5,R.drawable.girl6,R.drawable.girl7,R.drawable.girl8,
R.drawable.boy5,R.drawable.boy6,R.drawable.boy7,R.drawable.boy8,R.drawable.boy9};
Adaptersnap adaptersnap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listsnapview = findViewById(R.id.Listviewsnap);
adaptersnap = new Adaptersnap(this,Name1,Name2,Name3,Name4,snapImages);
listsnapview.setAdapter(adaptersnap);
}
} | UTF-8 | Java | 1,760 | java | MainActivity.java | Java | [
{
"context": "\n ListView listsnapview;\n\n String[] Name1={\"Sayali Kadam\",\"Mansee Katke\",\"Sahil Bhilare\",\"Deep Bhilare\",\"H",
"end": 261,
"score": 0.9998674988746643,
"start": 249,
"tag": "NAME",
"value": "Sayali Kadam"
},
{
"context": "istsnapview;\n\n String[] Name1={\"Sayali Kadam\",\"Mansee Katke\",\"Sahil Bhilare\",\"Deep Bhilare\",\"Harshali Dhage\",",
"end": 276,
"score": 0.9998654127120972,
"start": 264,
"tag": "NAME",
"value": "Mansee Katke"
},
{
"context": " String[] Name1={\"Sayali Kadam\",\"Mansee Katke\",\"Sahil Bhilare\",\"Deep Bhilare\",\"Harshali Dhage\",\"Yugandhar Mayek",
"end": 292,
"score": 0.9998648166656494,
"start": 279,
"tag": "NAME",
"value": "Sahil Bhilare"
},
{
"context": "1={\"Sayali Kadam\",\"Mansee Katke\",\"Sahil Bhilare\",\"Deep Bhilare\",\"Harshali Dhage\",\"Yugandhar Mayekar\",\n ",
"end": 307,
"score": 0.9998598694801331,
"start": 295,
"tag": "NAME",
"value": "Deep Bhilare"
},
{
"context": "m\",\"Mansee Katke\",\"Sahil Bhilare\",\"Deep Bhilare\",\"Harshali Dhage\",\"Yugandhar Mayekar\",\n \"Siddhi Shinde\"",
"end": 324,
"score": 0.9998693466186523,
"start": 310,
"tag": "NAME",
"value": "Harshali Dhage"
},
{
"context": ",\"Sahil Bhilare\",\"Deep Bhilare\",\"Harshali Dhage\",\"Yugandhar Mayekar\",\n \"Siddhi Shinde\",\"Dinesh Choudhary\",",
"end": 344,
"score": 0.9998565316200256,
"start": 327,
"tag": "NAME",
"value": "Yugandhar Mayekar"
},
{
"context": "Harshali Dhage\",\"Yugandhar Mayekar\",\n \"Siddhi Shinde\",\"Dinesh Choudhary\",\"Aakanshya Jagtap\",\"Rutuja Sa",
"end": 373,
"score": 0.9998418092727661,
"start": 360,
"tag": "NAME",
"value": "Siddhi Shinde"
},
{
"context": "\"Yugandhar Mayekar\",\n \"Siddhi Shinde\",\"Dinesh Choudhary\",\"Aakanshya Jagtap\",\"Rutuja Satav\",\"Bhishali\",\"Ru",
"end": 392,
"score": 0.9998576045036316,
"start": 376,
"tag": "NAME",
"value": "Dinesh Choudhary"
},
{
"context": ",\n \"Siddhi Shinde\",\"Dinesh Choudhary\",\"Aakanshya Jagtap\",\"Rutuja Satav\",\"Bhishali\",\"Rutuja Sapkal\",\n ",
"end": 411,
"score": 0.9997367858886719,
"start": 395,
"tag": "NAME",
"value": "Aakanshya Jagtap"
},
{
"context": "hi Shinde\",\"Dinesh Choudhary\",\"Aakanshya Jagtap\",\"Rutuja Satav\",\"Bhishali\",\"Rutuja Sapkal\",\n \"Sangram",
"end": 426,
"score": 0.9993957877159119,
"start": 414,
"tag": "NAME",
"value": "Rutuja Satav"
},
{
"context": "esh Choudhary\",\"Aakanshya Jagtap\",\"Rutuja Satav\",\"Bhishali\",\"Rutuja Sapkal\",\n \"Sangram\",\"Akash Ga",
"end": 437,
"score": 0.9662650227546692,
"start": 429,
"tag": "NAME",
"value": "Bhishali"
},
{
"context": "ry\",\"Aakanshya Jagtap\",\"Rutuja Satav\",\"Bhishali\",\"Rutuja Sapkal\",\n \"Sangram\",\"Akash Gawade\",\"Anup Gawa",
"end": 453,
"score": 0.9970833659172058,
"start": 440,
"tag": "NAME",
"value": "Rutuja Sapkal"
},
{
"context": "a Satav\",\"Bhishali\",\"Rutuja Sapkal\",\n \"Sangram\",\"Akash Gawade\",\"Anup Gawade\",\"Suraj Gawade\",\"Aks",
"end": 476,
"score": 0.8691499829292297,
"start": 469,
"tag": "NAME",
"value": "Sangram"
},
{
"context": "Bhishali\",\"Rutuja Sapkal\",\n \"Sangram\",\"Akash Gawade\",\"Anup Gawade\",\"Suraj Gawade\",\"Akshay Gawade\"};\n\n",
"end": 491,
"score": 0.9997310638427734,
"start": 479,
"tag": "NAME",
"value": "Akash Gawade"
},
{
"context": "ja Sapkal\",\n \"Sangram\",\"Akash Gawade\",\"Anup Gawade\",\"Suraj Gawade\",\"Akshay Gawade\"};\n\n String[] N",
"end": 505,
"score": 0.9997965693473816,
"start": 494,
"tag": "NAME",
"value": "Anup Gawade"
},
{
"context": " \"Sangram\",\"Akash Gawade\",\"Anup Gawade\",\"Suraj Gawade\",\"Akshay Gawade\"};\n\n String[] Name2={\"New snap",
"end": 520,
"score": 0.9998119473457336,
"start": 508,
"tag": "NAME",
"value": "Suraj Gawade"
},
{
"context": "ram\",\"Akash Gawade\",\"Anup Gawade\",\"Suraj Gawade\",\"Akshay Gawade\"};\n\n String[] Name2={\"New snap\",\"New snap\",\"Ne",
"end": 536,
"score": 0.999670684337616,
"start": 523,
"tag": "NAME",
"value": "Akshay Gawade"
}
] | null | [] | package com.example.designingfiles;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ListView;
public class MainActivity extends AppCompatActivity {
ListView listsnapview;
String[] Name1={"<NAME>","<NAME>","<NAME>","<NAME>","<NAME>","<NAME>",
"<NAME>","<NAME>","<NAME>","<NAME>","Bhishali","<NAME>",
"Sangram","<NAME>","<NAME>","<NAME>","<NAME>"};
String[] Name2={"New snap","New snap","New snap","Tap to load","New snap","New snap",
"New snap","Tap to load","New snap","Tap to load","New snap","New snap",
"New snap","Tap to load","New snap","New snap","New snap"};
String [] Name3= {"12h","6h","1w","1d","2d","2w","2w","5w","1mo","3w","3d","3d","5mo","5mo","7mo","7mo","7mo"};
String [] Name4={"10","15","10","30","50","20","6","2","0","0","0","0","0","0","0","0","0"};
int [] snapImages={R.drawable.girl1,R.drawable.girl2,R.drawable.boy1,R.drawable.boy2,R.drawable.girl3,R.drawable.boy3,
R.drawable.girl4,R.drawable.boy4,R.drawable.girl5,R.drawable.girl6,R.drawable.girl7,R.drawable.girl8,
R.drawable.boy5,R.drawable.boy6,R.drawable.boy7,R.drawable.boy8,R.drawable.boy9};
Adaptersnap adaptersnap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listsnapview = findViewById(R.id.Listviewsnap);
adaptersnap = new Adaptersnap(this,Name1,Name2,Name3,Name4,snapImages);
listsnapview.setAdapter(adaptersnap);
}
} | 1,652 | 0.644318 | 0.606818 | 41 | 41.951218 | 42.635124 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.463415 | false | false | 2 |
5fabf85cc686f6a7a3926003dfcd28f728c9f3f1 | 28,716,151,365,464 | 95754fdf6001b3dc2143eb261dfe64502e787b73 | /src/com/gupao/factory/simple/SimpleFactoryTest.java | a445a971fba58612f44576fe6e79cebb6df18f0b | [] | no_license | git-rico/Spring-Design-Patterns | https://github.com/git-rico/Spring-Design-Patterns | 323b7be041a19d8f384657b4c51edf03a2ce6864 | e3455ac2a767927f424534bea4409c1e5e7ac09d | refs/heads/master | 2020-04-04T23:51:00.147000 | 2018-11-17T04:17:58 | 2018-11-17T04:17:58 | 156,374,291 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gupao.factory.simple;
import com.gupao.factory.Car;
/**
* @author rico
* @version 1.0
* @description:消费者
* @createtime: 2018/11/7 19:22
*/
public class SimpleFactoryTest {
public static void main(String[] args) {
Car car = new SimpleFactory().getCar("Benz");
System.out.println(car.getName());
}
}
| UTF-8 | Java | 350 | java | SimpleFactoryTest.java | Java | [
{
"context": "le;\n\nimport com.gupao.factory.Car;\n\n/**\n * @author rico\n * @version 1.0\n * @description:消费者\n * @createtim",
"end": 85,
"score": 0.9290154576301575,
"start": 81,
"tag": "NAME",
"value": "rico"
}
] | null | [] | package com.gupao.factory.simple;
import com.gupao.factory.Car;
/**
* @author rico
* @version 1.0
* @description:消费者
* @createtime: 2018/11/7 19:22
*/
public class SimpleFactoryTest {
public static void main(String[] args) {
Car car = new SimpleFactory().getCar("Benz");
System.out.println(car.getName());
}
}
| 350 | 0.645349 | 0.607558 | 19 | 17.105263 | 17.35055 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.210526 | false | false | 2 |
3646861ef183886cf4b9a984448a264911655e57 | 28,716,151,364,713 | 5844bb4458f3b9b86147df53ec6246cf3959e0b2 | /src/com/sagacity/portal/utility/FileUtil.java | 37eab7b605e7fbde329529cbda07da38340cc615 | [] | no_license | pepperdog999/sagacity_portal | https://github.com/pepperdog999/sagacity_portal | 545de7efccc6ea537b29587385aba876cf7adc4e | 2d2ae4e228cb74bf43139645cb04601bc4e31f86 | refs/heads/master | 2021-01-21T19:29:01.135000 | 2014-10-20T05:16:38 | 2014-10-20T05:16:38 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sagacity.portal.utility;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
public class FileUtil {
public static boolean deleteFile(File file){
File[] files = file.listFiles();
for(File deleteFile : files){
if(deleteFile.isDirectory()){
//如果是文件夹,则递归删除下面的文件后再删除该文件夹
if(!deleteFile(deleteFile)){
//如果失败则返回
return false;
}
} else {
if(!deleteFile.delete()){
//如果失败则返回
return false;
}
}
}
return file.delete();
}
public static File copyFile(File srcFile, File destDir, String newFileName) {
if (!srcFile.exists()) {
System.out.println("源文件不存在");
return null;
} else if (!destDir.exists()) {
System.out.println("目标目录不存在");
return null;
} else if (newFileName == null) {
newFileName = srcFile.getName().substring(0,srcFile.getName().lastIndexOf("."));
}
try {
File newfile=new File(destDir,newFileName+srcFile.getName().substring(srcFile.getName().lastIndexOf(".")));
FileChannel fcin = new FileInputStream(srcFile).getChannel();
FileChannel fcout = new FileOutputStream(newfile).getChannel();
fcin.transferTo(0, fcin.size(), fcout);
fcin.close();
fcout.close();
srcFile.delete();
return newfile;
} catch (FileNotFoundException e) {
e.printStackTrace();
return null;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
}
| UTF-8 | Java | 2,102 | java | FileUtil.java | Java | [] | null | [] | package com.sagacity.portal.utility;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
public class FileUtil {
public static boolean deleteFile(File file){
File[] files = file.listFiles();
for(File deleteFile : files){
if(deleteFile.isDirectory()){
//如果是文件夹,则递归删除下面的文件后再删除该文件夹
if(!deleteFile(deleteFile)){
//如果失败则返回
return false;
}
} else {
if(!deleteFile.delete()){
//如果失败则返回
return false;
}
}
}
return file.delete();
}
public static File copyFile(File srcFile, File destDir, String newFileName) {
if (!srcFile.exists()) {
System.out.println("源文件不存在");
return null;
} else if (!destDir.exists()) {
System.out.println("目标目录不存在");
return null;
} else if (newFileName == null) {
newFileName = srcFile.getName().substring(0,srcFile.getName().lastIndexOf("."));
}
try {
File newfile=new File(destDir,newFileName+srcFile.getName().substring(srcFile.getName().lastIndexOf(".")));
FileChannel fcin = new FileInputStream(srcFile).getChannel();
FileChannel fcout = new FileOutputStream(newfile).getChannel();
fcin.transferTo(0, fcin.size(), fcout);
fcin.close();
fcout.close();
srcFile.delete();
return newfile;
} catch (FileNotFoundException e) {
e.printStackTrace();
return null;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
}
| 2,102 | 0.517518 | 0.516517 | 57 | 34.052631 | 22.269026 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.684211 | false | false | 2 |
2839ff0a61c387af2fab20a06a2b4136d3d44498 | 30,983,894,107,452 | 347ad29dc40e8e9841a7673dab67e6888ee879c3 | /app/src/main/java/com/example/recyclerviewwithsearchview/MainActivity.java | 8d158bd16f785f9a64b0c297ed54d8c86186749b | [] | no_license | cpozos/RecyclerViewWithSearchView | https://github.com/cpozos/RecyclerViewWithSearchView | e14c699532c611b5dcde31e0717a00e31f95b751 | 7005695d5b26a244f06324ad88295fa5f4784110 | refs/heads/master | 2020-05-03T05:57:49.566000 | 2019-04-01T16:35:21 | 2019-04-01T16:35:21 | 178,462,262 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.recyclerviewwithsearchview;
import android.databinding.DataBindingUtil;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.util.SortedList;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.util.SortedListAdapterCallback;
import android.view.Menu;
import android.view.MenuItem;
import com.example.recyclerviewwithsearchview.databinding.ActivityMainBinding;
import com.example.recyclerviewwithsearchview.databinding.RecyclerviewBinding;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
public class MainActivity extends AppCompatActivity
implements SearchView.OnQueryTextListener
{
/**
* Comparador para ordenar alfabeticamente
*/
private static final Comparator<EjemploModel> ALPHABETICAL_COMPARATOR
= new Comparator<EjemploModel>() {
@Override
public int compare(EjemploModel a, EjemploModel b) {
return a.getText().compareTo(b.getText());
}
};
private EjemploAdapter mAdapter;
private List<EjemploModel> mlistaModelos;
private RecyclerView mRecyclerView;
private ActivityMainBinding mBinding;
private String[] MOVIES = new String[]{
"una", "dos", "tres"
};
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_main);
mAdapter =new EjemploAdapter(this,ALPHABETICAL_COMPARATOR);
mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
mBinding.recyclerView.setAdapter(mAdapter);
mlistaModelos = new ArrayList<>();
int id = 0;
for(String movie : MOVIES){
mlistaModelos.add(new EjemploModel(id,movie));
id++;
}
mAdapter.add(mlistaModelos);
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Infla la vista con el menú creado en recursos
getMenuInflater().inflate(R.menu.main_menu,menu);
// Obtiene el item Creado en recursos (main_menu.xml)
final MenuItem menuItem = menu.findItem(R.id.action_search);
final SearchView searchView =(SearchView) menuItem.getActionView();
// Asigna esto
searchView.setOnQueryTextListener(MainActivity.this);
return true;
}
@Override
public boolean onQueryTextSubmit(String s)
{
return false;
}
public static List<EjemploModel> filter(List<EjemploModel> listaEjemplos, String query)
{
final String lowerCaseQuery = query.toLowerCase();
final List<EjemploModel> filteredModelList = new ArrayList<>();
for (EjemploModel model : listaEjemplos) {
final String text = model.getText().toLowerCase();
final String rank = String.valueOf(model.getId());
if (text.contains(lowerCaseQuery) || rank.contains(lowerCaseQuery)) {
filteredModelList.add(model);
}
}
return filteredModelList;
}
@Override
public boolean onQueryTextChange(String query)
{
// AQUÍ SE IMPLEMENTA LA LÓGICA PARA FILTRAR
final List<EjemploModel> filteredModeList = filter(mlistaModelos,query);
mAdapter.replaceAll(filteredModeList);
mBinding.recyclerView.scrollToPosition(0);
return true;
}
}
| UTF-8 | Java | 3,627 | java | MainActivity.java | Java | [] | null | [] | package com.example.recyclerviewwithsearchview;
import android.databinding.DataBindingUtil;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.util.SortedList;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.util.SortedListAdapterCallback;
import android.view.Menu;
import android.view.MenuItem;
import com.example.recyclerviewwithsearchview.databinding.ActivityMainBinding;
import com.example.recyclerviewwithsearchview.databinding.RecyclerviewBinding;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
public class MainActivity extends AppCompatActivity
implements SearchView.OnQueryTextListener
{
/**
* Comparador para ordenar alfabeticamente
*/
private static final Comparator<EjemploModel> ALPHABETICAL_COMPARATOR
= new Comparator<EjemploModel>() {
@Override
public int compare(EjemploModel a, EjemploModel b) {
return a.getText().compareTo(b.getText());
}
};
private EjemploAdapter mAdapter;
private List<EjemploModel> mlistaModelos;
private RecyclerView mRecyclerView;
private ActivityMainBinding mBinding;
private String[] MOVIES = new String[]{
"una", "dos", "tres"
};
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_main);
mAdapter =new EjemploAdapter(this,ALPHABETICAL_COMPARATOR);
mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
mBinding.recyclerView.setAdapter(mAdapter);
mlistaModelos = new ArrayList<>();
int id = 0;
for(String movie : MOVIES){
mlistaModelos.add(new EjemploModel(id,movie));
id++;
}
mAdapter.add(mlistaModelos);
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Infla la vista con el menú creado en recursos
getMenuInflater().inflate(R.menu.main_menu,menu);
// Obtiene el item Creado en recursos (main_menu.xml)
final MenuItem menuItem = menu.findItem(R.id.action_search);
final SearchView searchView =(SearchView) menuItem.getActionView();
// Asigna esto
searchView.setOnQueryTextListener(MainActivity.this);
return true;
}
@Override
public boolean onQueryTextSubmit(String s)
{
return false;
}
public static List<EjemploModel> filter(List<EjemploModel> listaEjemplos, String query)
{
final String lowerCaseQuery = query.toLowerCase();
final List<EjemploModel> filteredModelList = new ArrayList<>();
for (EjemploModel model : listaEjemplos) {
final String text = model.getText().toLowerCase();
final String rank = String.valueOf(model.getId());
if (text.contains(lowerCaseQuery) || rank.contains(lowerCaseQuery)) {
filteredModelList.add(model);
}
}
return filteredModelList;
}
@Override
public boolean onQueryTextChange(String query)
{
// AQUÍ SE IMPLEMENTA LA LÓGICA PARA FILTRAR
final List<EjemploModel> filteredModeList = filter(mlistaModelos,query);
mAdapter.replaceAll(filteredModeList);
mBinding.recyclerView.scrollToPosition(0);
return true;
}
}
| 3,627 | 0.693709 | 0.691501 | 114 | 30.789474 | 26.017698 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.535088 | false | false | 2 |
abfbb44b75f2ddb31c0dd52a59d6144b6e263388 | 10,703,058,564,248 | 69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e | /methods/Method_19147.java | 8afdab2224237869f54d4e93a6c14fac20007090 | [] | no_license | P79N6A/icse_20_user_study | https://github.com/P79N6A/icse_20_user_study | 5b9c42c6384502fdc9588430899f257761f1f506 | 8a3676bc96059ea2c4f6d209016f5088a5628f3c | refs/heads/master | 2020-06-24T08:25:22.606000 | 2019-07-25T15:31:16 | 2019-07-25T15:31:16 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public boolean getAsyncInitRange(){
return mAsyncInitRange;
}
| UTF-8 | Java | 64 | java | Method_19147.java | Java | [] | null | [] | public boolean getAsyncInitRange(){
return mAsyncInitRange;
}
| 64 | 0.796875 | 0.796875 | 3 | 20.333334 | 14.26729 | 35 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 2 |
608883c67dd6e4ebc9ca633950830a0d1e4d1875 | 7,541,962,599,767 | 6492692995d07f5bd6185c97eaf0f001e864e438 | /src/main/java/ru/dexsys/TelegramBot/request_service/command/PrintAllUsersCommand.java | 44603f6852a7bd999fbf05d1de23a15a17ea6386 | [] | no_license | Vanadiiii/HappyBirthdayBot | https://github.com/Vanadiiii/HappyBirthdayBot | 6647d59c4402421fa023eaec6d70711601d2576a | e7d99ccf446850634652534748b91c49c9243e46 | refs/heads/master | 2022-12-26T08:16:13.777000 | 2020-10-01T13:08:15 | 2020-10-01T13:08:15 | 299,828,450 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ru.dexsys.TelegramBot.request_service.command;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.telegram.telegrambots.meta.api.methods.send.SendMessage;
import org.telegram.telegrambots.meta.api.objects.Chat;
import org.telegram.telegrambots.meta.api.objects.User;
import org.telegram.telegrambots.meta.bots.AbsSender;
import ru.dexsys.TelegramBot.model.SavedUser;
import ru.dexsys.TelegramBot.model.SavedUserService;
import java.util.stream.Collectors;
@Slf4j
@Component
public class PrintAllUsersCommand extends AbstractCommand {
public PrintAllUsersCommand(SavedUserService savedUserService) {
super(Command.PRINT, savedUserService);
}
@Override
public void execute(AbsSender absSender, User user, Chat chat, String[] arguments) {
Long chatId = chat.getId();
String text = "There are all saved users:\n" +
savedUserService.getSavedUsers()
.stream()
.map(SavedUser::toString)
.collect(Collectors.joining(",\n", "\t", ""));
SendMessage message = new SendMessage()
.setChatId(chatId)
.setText(text);
execute(absSender, message, user);
}
}
| UTF-8 | Java | 1,279 | java | PrintAllUsersCommand.java | Java | [] | null | [] | package ru.dexsys.TelegramBot.request_service.command;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.telegram.telegrambots.meta.api.methods.send.SendMessage;
import org.telegram.telegrambots.meta.api.objects.Chat;
import org.telegram.telegrambots.meta.api.objects.User;
import org.telegram.telegrambots.meta.bots.AbsSender;
import ru.dexsys.TelegramBot.model.SavedUser;
import ru.dexsys.TelegramBot.model.SavedUserService;
import java.util.stream.Collectors;
@Slf4j
@Component
public class PrintAllUsersCommand extends AbstractCommand {
public PrintAllUsersCommand(SavedUserService savedUserService) {
super(Command.PRINT, savedUserService);
}
@Override
public void execute(AbsSender absSender, User user, Chat chat, String[] arguments) {
Long chatId = chat.getId();
String text = "There are all saved users:\n" +
savedUserService.getSavedUsers()
.stream()
.map(SavedUser::toString)
.collect(Collectors.joining(",\n", "\t", ""));
SendMessage message = new SendMessage()
.setChatId(chatId)
.setText(text);
execute(absSender, message, user);
}
}
| 1,279 | 0.688038 | 0.685692 | 37 | 33.567566 | 25.072372 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.648649 | false | false | 2 |
9e09b20d9a0d62c9bf289b870df4eaa691275881 | 28,235,115,030,722 | 608e4b47c71ca7bd3716055ed8c8cd25d51d6077 | /src/main/java/org/dhbw/help/Language.java | 5878977669fb2209a9b537b444b918458c271921 | [
"MIT"
] | permissive | Gnuhry/JavaPMTINF19AI2 | https://github.com/Gnuhry/JavaPMTINF19AI2 | cb25557689c1e4657858abc7b5a9ea8bcf912c18 | 18f6136ee870fa1f36bd2b625740408b6fb87aa6 | refs/heads/master | 2022-11-19T06:49:33.923000 | 2020-07-20T14:05:54 | 2020-07-20T14:05:54 | 262,259,187 | 1 | 0 | MIT | false | 2020-07-02T03:50:38 | 2020-05-08T07:43:51 | 2020-06-27T21:18:00 | 2020-07-02T03:50:37 | 2,270 | 0 | 0 | 1 | Java | false | false | package org.dhbw.help;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Locale;
import java.util.Properties;
import java.util.ResourceBundle;
public class Language {
private static final String lang_file_path = "org.dhbw.lang.strings";
private static final String lang_file_path_error = "org.dhbw.lang.error";
private static final String settings_path = "settings.properties";
private static final String[] supportedLanguage = new String[]{"de", "en"};
private static Locale locale;
/**
* get resource bundle to get the translation of the string
*
* @return resource bundle
*/
public static ResourceBundle getResourcedBundle() {
if (locale == null) readLanguageSetting();
return ResourceBundle.getBundle(lang_file_path, locale);
}
/**
* get resource bundle to get the translation of the error strings
*
* @return resource bundle
*/
public static ResourceBundle getResourcedBundleError() {
if (locale == null) readLanguageSetting();
return ResourceBundle.getBundle(lang_file_path_error, locale);
}
/**
* toggle the languages
*/
public static void toggleLocal() {
for (int f = 0; f < supportedLanguage.length; f++) {
if (supportedLanguage[f].equals(locale.getLanguage())) {
locale = new Locale(supportedLanguage[(f + 1) % supportedLanguage.length]);
setLanguageSetting();
return;
}
}
}
//-------------------------Getter------------------------
public static Locale getLocale() {
if (locale == null)
readLanguageSetting();
return locale;
}
/**
* read settings file and set location
*/
private static void readLanguageSetting() {
String lang = "de";
try {
FileReader reader = new FileReader(new File(settings_path));
Properties props = new Properties();
props.load(reader);
lang = props.getProperty("lang");
reader.close();
} catch (IOException ex) {
ex.fillInStackTrace();
}
locale = new Locale(lang);
}
/**
* set location to settings file
*/
private static void setLanguageSetting() {
try {
Properties props = new Properties();
props.setProperty("lang", locale.getLanguage());
FileWriter writer = new FileWriter(new File(settings_path));
props.store(writer, "settings");
writer.close();
} catch (IOException ex) {
ex.fillInStackTrace();
}
}
}
| UTF-8 | Java | 2,739 | java | Language.java | Java | [] | null | [] | package org.dhbw.help;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Locale;
import java.util.Properties;
import java.util.ResourceBundle;
public class Language {
private static final String lang_file_path = "org.dhbw.lang.strings";
private static final String lang_file_path_error = "org.dhbw.lang.error";
private static final String settings_path = "settings.properties";
private static final String[] supportedLanguage = new String[]{"de", "en"};
private static Locale locale;
/**
* get resource bundle to get the translation of the string
*
* @return resource bundle
*/
public static ResourceBundle getResourcedBundle() {
if (locale == null) readLanguageSetting();
return ResourceBundle.getBundle(lang_file_path, locale);
}
/**
* get resource bundle to get the translation of the error strings
*
* @return resource bundle
*/
public static ResourceBundle getResourcedBundleError() {
if (locale == null) readLanguageSetting();
return ResourceBundle.getBundle(lang_file_path_error, locale);
}
/**
* toggle the languages
*/
public static void toggleLocal() {
for (int f = 0; f < supportedLanguage.length; f++) {
if (supportedLanguage[f].equals(locale.getLanguage())) {
locale = new Locale(supportedLanguage[(f + 1) % supportedLanguage.length]);
setLanguageSetting();
return;
}
}
}
//-------------------------Getter------------------------
public static Locale getLocale() {
if (locale == null)
readLanguageSetting();
return locale;
}
/**
* read settings file and set location
*/
private static void readLanguageSetting() {
String lang = "de";
try {
FileReader reader = new FileReader(new File(settings_path));
Properties props = new Properties();
props.load(reader);
lang = props.getProperty("lang");
reader.close();
} catch (IOException ex) {
ex.fillInStackTrace();
}
locale = new Locale(lang);
}
/**
* set location to settings file
*/
private static void setLanguageSetting() {
try {
Properties props = new Properties();
props.setProperty("lang", locale.getLanguage());
FileWriter writer = new FileWriter(new File(settings_path));
props.store(writer, "settings");
writer.close();
} catch (IOException ex) {
ex.fillInStackTrace();
}
}
}
| 2,739 | 0.590361 | 0.589631 | 90 | 29.433332 | 23.830442 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.477778 | false | false | 2 |
dbad2931e6f8ff38e74cc593df2bcc1acd67425f | 6,055,903,894,000 | cf3c99312045e8a9691e475e349d1965983c5898 | /sco.tataapp-web/src/main/java/it/smartcommunitylab/tataapp/sec/IdentityLookupService.java | 1545903ae13109b914e1fa97d1505d67446a94e2 | [] | no_license | smartcommunitylab/sco.tataapp | https://github.com/smartcommunitylab/sco.tataapp | d39b68cd8bd0e74154ae606694ef9868cbbfd31b | c01917e973f1fc552677a1fa6d5a023a54628e93 | refs/heads/master | 2020-04-05T14:08:13.918000 | 2016-11-07T09:54:29 | 2016-11-07T09:54:29 | 55,777,750 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package it.smartcommunitylab.tataapp.sec;
import org.springframework.stereotype.Service;
@Service
public interface IdentityLookupService {
public String getName();
}
| UTF-8 | Java | 170 | java | IdentityLookupService.java | Java | [] | null | [] | package it.smartcommunitylab.tataapp.sec;
import org.springframework.stereotype.Service;
@Service
public interface IdentityLookupService {
public String getName();
}
| 170 | 0.817647 | 0.817647 | 9 | 17.888889 | 18.876467 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 2 |
45f70a3e99ab659b725f465a9b09ab9e39cf49f2 | 33,036,888,464,055 | 008916e4134198c7054f16bec56d30b80eab9c7c | /src/main/java/com/chinasoft/ShirodemoApplication.java | 52ff43956b04834ca00501a973939f56b680757a | [] | no_license | MarkTwoon/shirodemo | https://github.com/MarkTwoon/shirodemo | 12e87f1713e27b038cf102f619c6183807da5cb6 | f8d078214a99745c55323c7a558e719119147514 | refs/heads/master | 2023-03-06T17:06:43.462000 | 2021-02-18T16:11:36 | 2021-02-18T16:11:36 | 339,547,917 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.chinasoft;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ShirodemoApplication {
/*SpringBoot整合Shiro+JPA持久层形式
* 参考大神博客 :
* https://blog.csdn.net/pan_junbiao/article/details/106437248*/
public static void main(String[] args) {
SpringApplication.run(ShirodemoApplication.class, args);
}
}
| UTF-8 | Java | 458 | java | ShirodemoApplication.java | Java | [
{
"context": "iro+JPA持久层形式\n * 参考大神博客 :\n * https://blog.csdn.net/pan_junbiao/article/details/106437248*/\n public static voi",
"end": 282,
"score": 0.9996989965438843,
"start": 271,
"tag": "USERNAME",
"value": "pan_junbiao"
}
] | null | [] | package com.chinasoft;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ShirodemoApplication {
/*SpringBoot整合Shiro+JPA持久层形式
* 参考大神博客 :
* https://blog.csdn.net/pan_junbiao/article/details/106437248*/
public static void main(String[] args) {
SpringApplication.run(ShirodemoApplication.class, args);
}
}
| 458 | 0.783721 | 0.762791 | 15 | 27.666666 | 24.428581 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 2 |
dd6abafd32a8ad5f8141d1d21705408c3de65dfc | 901,943,133,272 | 981fb6321f32d69a45ab14808ff4e626740a0cea | /src/main/java/com/ulpgc/eii/zah/Publisher/Sensor/MyDistanceSensor.java | cc9be7a03198c1d7eb572f8477db67af16cc029b | [] | no_license | Zabai/MonkeyDriver | https://github.com/Zabai/MonkeyDriver | d0f1806742a2b98fe817f6e5e35781385ccf91da | 2c3753d6da96d1ad23fd608d3d9c3ece4fd1a0dc | refs/heads/master | 2021-06-12T00:54:42.899000 | 2017-01-20T14:25:58 | 2017-01-20T14:25:58 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ulpgc.eii.zah.Publisher.Sensor;
import com.ulpgc.eii.zah.Bus.Bus;
import com.ulpgc.eii.zah.Message.DistanceMessage;
import com.ulpgc.eii.zah.Message.Message;
public class MyDistanceSensor implements Sensor {
private Bus bus;
private double distance = 0;
private final double safeDistance = 25.;
public MyDistanceSensor(Bus bus) {
this.bus = bus;
}
public void start(){
Thread thread = new Thread(){
@Override
public void run() {sendMessageToBus();
}
};
thread.start();
}
public double getDistanceFromSensor(){
int min = 20, max = 30;
distance = (Math.random() * ((max - min) + 1)) + min;
return distance;
}
@Override
public void sendMessageToBus() {
while(true){
Message message = new DistanceMessage(getDistanceFromSensor());
if(distance < safeDistance) bus.send(message);
}
}
}
| UTF-8 | Java | 979 | java | MyDistanceSensor.java | Java | [] | null | [] | package com.ulpgc.eii.zah.Publisher.Sensor;
import com.ulpgc.eii.zah.Bus.Bus;
import com.ulpgc.eii.zah.Message.DistanceMessage;
import com.ulpgc.eii.zah.Message.Message;
public class MyDistanceSensor implements Sensor {
private Bus bus;
private double distance = 0;
private final double safeDistance = 25.;
public MyDistanceSensor(Bus bus) {
this.bus = bus;
}
public void start(){
Thread thread = new Thread(){
@Override
public void run() {sendMessageToBus();
}
};
thread.start();
}
public double getDistanceFromSensor(){
int min = 20, max = 30;
distance = (Math.random() * ((max - min) + 1)) + min;
return distance;
}
@Override
public void sendMessageToBus() {
while(true){
Message message = new DistanceMessage(getDistanceFromSensor());
if(distance < safeDistance) bus.send(message);
}
}
}
| 979 | 0.602656 | 0.594484 | 39 | 24.102564 | 20.152998 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.435897 | false | false | 2 |
432fdef9e37347a29b1e93225c7760a21e66c774 | 12,627,203,875,730 | d98ed4986ecdd7df4c04e4ad09f38fdb7a7043e8 | /Hero_Points/src/main/java/net/sf/anathema/points/display/experience/ExperiencePointInitializer.java | e0d0f37c6f2f302db79ceb730aa9919a2ae0003a | [] | no_license | bjblack/anathema_3e | https://github.com/bjblack/anathema_3e | 3d1d42ea3d9a874ac5fbeed506a1a5800e2a99ac | 963f37b64d7cf929f086487950d4870fd40ac67f | refs/heads/master | 2021-01-19T07:12:42.133000 | 2018-12-18T23:57:41 | 2018-12-18T23:57:41 | 67,353,965 | 0 | 0 | null | true | 2016-09-04T15:47:48 | 2016-09-04T15:47:48 | 2016-08-26T08:25:11 | 2016-08-31T11:03:27 | 50,215 | 0 | 0 | 0 | null | null | null | package net.sf.anathema.points.display.experience;
import net.sf.anathema.hero.environment.HeroEnvironment;
import net.sf.anathema.hero.individual.model.Hero;
import net.sf.anathema.hero.individual.model.HeroModelInitializer;
import net.sf.anathema.hero.individual.model.RegisteredInitializer;
import net.sf.anathema.hero.individual.overview.HeroModelGroup;
import net.sf.anathema.hero.individual.view.SectionView;
@RegisteredInitializer (HeroModelGroup.Miscellaneous)
public class ExperiencePointInitializer implements HeroModelInitializer
{
private HeroEnvironment environment;
@SuppressWarnings ("UnusedParameters")
public ExperiencePointInitializer (HeroEnvironment heroEnvironment)
{
this.environment = heroEnvironment;
}
@Override
public void initialize (SectionView sectionView, Hero hero)
{
new ExperiencePointPresenter (environment.getResources (), hero).initPresentation (sectionView);
}
@Override
public boolean canWorkForHero (Hero hero)
{
return true;
}
}
| UTF-8 | Java | 1,028 | java | ExperiencePointInitializer.java | Java | [] | null | [] | package net.sf.anathema.points.display.experience;
import net.sf.anathema.hero.environment.HeroEnvironment;
import net.sf.anathema.hero.individual.model.Hero;
import net.sf.anathema.hero.individual.model.HeroModelInitializer;
import net.sf.anathema.hero.individual.model.RegisteredInitializer;
import net.sf.anathema.hero.individual.overview.HeroModelGroup;
import net.sf.anathema.hero.individual.view.SectionView;
@RegisteredInitializer (HeroModelGroup.Miscellaneous)
public class ExperiencePointInitializer implements HeroModelInitializer
{
private HeroEnvironment environment;
@SuppressWarnings ("UnusedParameters")
public ExperiencePointInitializer (HeroEnvironment heroEnvironment)
{
this.environment = heroEnvironment;
}
@Override
public void initialize (SectionView sectionView, Hero hero)
{
new ExperiencePointPresenter (environment.getResources (), hero).initPresentation (sectionView);
}
@Override
public boolean canWorkForHero (Hero hero)
{
return true;
}
}
| 1,028 | 0.79572 | 0.79572 | 32 | 30.125 | 29.139481 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.09375 | false | false | 2 |
3154f90c9a3022a6185fa27e2c018d0602fe8051 | 1,992,864,881,673 | 016bce3374ecad45d4b7bfe072b11b3233fd4237 | /modules/core/src/main/java/org/synyx/minos/core/message/DispatchingMessageSource.java | b47e3a4d26292d1dfe93af7db9707d4647c76ab7 | [
"Apache-2.0"
] | permissive | synyx/minos | https://github.com/synyx/minos | 087905988556d325577bf3e250acb15299b050f3 | da77a17ebd808feefe7d523f9f2b0c789014cbb8 | refs/heads/master | 2021-01-17T09:08:24.476000 | 2016-04-04T11:40:00 | 2016-04-04T11:40:00 | 4,700,267 | 4 | 1 | null | false | 2016-04-04T11:40:01 | 2012-06-18T11:44:37 | 2014-02-27T12:47:43 | 2016-04-04T11:40:00 | 2,964 | 2 | 0 | 20 | Java | null | null | package org.synyx.minos.core.message;
import org.springframework.context.MessageSource;
import org.springframework.context.NoSuchMessageException;
import org.springframework.context.support.AbstractMessageSource;
import org.synyx.hera.core.OrderAwarePluginRegistry;
import org.synyx.hera.core.PluginRegistry;
import org.synyx.minos.core.module.ModuleAware;
import org.synyx.minos.core.module.internal.ModuleAwareComparator;
import java.text.MessageFormat;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
/**
* MessageSource implementation that delegates to a list of sources by the messages prefix. If a message starts with
* {@code something.} this delegates to a MinosMessageSource that returns something on getPrefix()
*
* @author Marc Kannegiesser - kannegiesser@synyx.de
* @author Oliver Gierke - gierke@synyx.de
*/
public class DispatchingMessageSource extends AbstractMessageSource {
// Comparator to invert natural ordering (more core modules later)
private static final Comparator<ModuleAware> COMPARATOR = new ModuleAwareComparator();
private PluginRegistry<ModuleMessageSource, String> sources = OrderAwarePluginRegistry.create();
/**
* Inject all {@link ModuleMessageSourceImpl}es available in the system.
*
* @param sources
*/
public void setSources(List<ModuleMessageSource> sources) {
this.sources = OrderAwarePluginRegistry.create(sources, COMPARATOR);
}
/**
* Returns the prefix (everything until the first occurence of .
*
* @param code the code to retuorn the prefix for
* @return the prefix or the whole code if no dot exists
*/
private String getPrefixFromCode(String code) {
int firstDotPosition = code.indexOf('.');
return firstDotPosition > 0 ? code.substring(0, firstDotPosition) : code;
}
@Override
protected MessageFormat resolveCode(String code, Locale locale) {
List<ModuleMessageSource> candidates = sources.getPluginsFor(getPrefixFromCode(code));
// No message source at all found
if (candidates.isEmpty()) {
return null;
}
for (MessageSourcePlugin source : candidates) {
MessageFormat format = resolveMessageWithSource(source, code, locale);
if (null != format) {
return format;
}
}
return null;
}
/**
* Resolves the message with the given {@link MessageSource}. Returns {@literal null} if no message could be
* resolved or the code was returned itself.
*
* @param source
* @param code
* @param locale
*/
private MessageFormat resolveMessageWithSource(MessageSource source, String code, Locale locale) {
try {
String message = source.getMessage(code, null, locale);
if (!code.equals(message)) {
return createMessageFormat(message, locale);
}
} catch (NoSuchMessageException e) {
}
return null;
}
}
| UTF-8 | Java | 3,060 | java | DispatchingMessageSource.java | Java | [
{
"context": "hat returns something on getPrefix()\n *\n * @author Marc Kannegiesser - kannegiesser@synyx.de\n * @author Oliver Gierke ",
"end": 791,
"score": 0.999886155128479,
"start": 774,
"tag": "NAME",
"value": "Marc Kannegiesser"
},
{
"context": "g on getPrefix()\n *\n * @author Marc Kannegiesser - kannegiesser@synyx.de\n * @author Oliver Gierke - gierke@synyx.de\n */\npu",
"end": 815,
"score": 0.9999327063560486,
"start": 794,
"tag": "EMAIL",
"value": "kannegiesser@synyx.de"
},
{
"context": "rc Kannegiesser - kannegiesser@synyx.de\n * @author Oliver Gierke - gierke@synyx.de\n */\npublic class DispatchingMes",
"end": 840,
"score": 0.9998653531074524,
"start": 827,
"tag": "NAME",
"value": "Oliver Gierke"
},
{
"context": "- kannegiesser@synyx.de\n * @author Oliver Gierke - gierke@synyx.de\n */\npublic class DispatchingMessageSource extends",
"end": 858,
"score": 0.9999306797981262,
"start": 843,
"tag": "EMAIL",
"value": "gierke@synyx.de"
}
] | null | [] | package org.synyx.minos.core.message;
import org.springframework.context.MessageSource;
import org.springframework.context.NoSuchMessageException;
import org.springframework.context.support.AbstractMessageSource;
import org.synyx.hera.core.OrderAwarePluginRegistry;
import org.synyx.hera.core.PluginRegistry;
import org.synyx.minos.core.module.ModuleAware;
import org.synyx.minos.core.module.internal.ModuleAwareComparator;
import java.text.MessageFormat;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
/**
* MessageSource implementation that delegates to a list of sources by the messages prefix. If a message starts with
* {@code something.} this delegates to a MinosMessageSource that returns something on getPrefix()
*
* @author <NAME> - <EMAIL>
* @author <NAME> - <EMAIL>
*/
public class DispatchingMessageSource extends AbstractMessageSource {
// Comparator to invert natural ordering (more core modules later)
private static final Comparator<ModuleAware> COMPARATOR = new ModuleAwareComparator();
private PluginRegistry<ModuleMessageSource, String> sources = OrderAwarePluginRegistry.create();
/**
* Inject all {@link ModuleMessageSourceImpl}es available in the system.
*
* @param sources
*/
public void setSources(List<ModuleMessageSource> sources) {
this.sources = OrderAwarePluginRegistry.create(sources, COMPARATOR);
}
/**
* Returns the prefix (everything until the first occurence of .
*
* @param code the code to retuorn the prefix for
* @return the prefix or the whole code if no dot exists
*/
private String getPrefixFromCode(String code) {
int firstDotPosition = code.indexOf('.');
return firstDotPosition > 0 ? code.substring(0, firstDotPosition) : code;
}
@Override
protected MessageFormat resolveCode(String code, Locale locale) {
List<ModuleMessageSource> candidates = sources.getPluginsFor(getPrefixFromCode(code));
// No message source at all found
if (candidates.isEmpty()) {
return null;
}
for (MessageSourcePlugin source : candidates) {
MessageFormat format = resolveMessageWithSource(source, code, locale);
if (null != format) {
return format;
}
}
return null;
}
/**
* Resolves the message with the given {@link MessageSource}. Returns {@literal null} if no message could be
* resolved or the code was returned itself.
*
* @param source
* @param code
* @param locale
*/
private MessageFormat resolveMessageWithSource(MessageSource source, String code, Locale locale) {
try {
String message = source.getMessage(code, null, locale);
if (!code.equals(message)) {
return createMessageFormat(message, locale);
}
} catch (NoSuchMessageException e) {
}
return null;
}
}
| 3,020 | 0.687255 | 0.686601 | 102 | 29 | 31.67296 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.352941 | false | false | 2 |
dc03561490a88c0a4ea984114750f7cb10a59c58 | 11,347,303,596,276 | 654fada26f00bb43b2c9df02898e6624381eee74 | /zsea-java/lr1/src/com/zsea/javatech/Utils.java | a5c0b5800e27ea74f5d3ed17bf8280f2f834c7c2 | [] | no_license | Truerall/zsea_java_technology | https://github.com/Truerall/zsea_java_technology | 19894a1fb6b42fc1d19de5ac1d48675c5a6cf7f8 | 1f323c249cee1cd68d9622847f4d8e83b2bae9f9 | refs/heads/master | 2016-09-16T15:04:53.049000 | 2016-07-09T08:01:48 | 2016-07-09T08:01:48 | 60,463,731 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.zsea.javatech;
import java.io.*;
import java.util.Random;
import java.util.Scanner;
/**
* Created by truerall on 5/27/16.
*/
public class Utils {
public final static void DBG(String string){
System.out.println(string);
}
public static final File createNewRandomNumbersFile(String fileName, int numbersCnt){
return createNewRandomNumbersFile(fileName,numbersCnt,false);
}
public static final File createNewRandomNumbersFile(String fileName, int numbersCnt, boolean overwrite) {
Random random = new Random();
File file = new File(fileName);
if (file.exists() & !overwrite ){
Utils.DBG("File already exists!");
return file;
} else if (file.exists() & overwrite) {
Utils.DBG("Trying to write to existing file");
}
FileWriter fw = null;
try {
fw = new FileWriter(file.getAbsoluteFile());
} catch (IOException e) {
e.printStackTrace();
}
if(fw == null){
Utils.DBG("Problem occured during FileWriter creation, please see the stacktrace above.");
return null;
}
BufferedWriter bw = new BufferedWriter(fw);
try {
bw.write(String.valueOf(numbersCnt));
bw.newLine();
for(int i = 0; i< numbersCnt;i++){
bw.write(String.valueOf(random.nextInt(10)-5));
bw.newLine();
}
bw.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
bw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return file;
}
public static int[] readNumbersFromFile(String fileName){
Scanner scanner;
int[] numbersToSort;
try {
scanner = new Scanner(new File(fileName));
} catch (FileNotFoundException e) {
Utils.DBG("Sorry but file not found");
return null;
}
if(scanner.hasNextInt()) {
numbersToSort = new int[scanner.nextInt()];
} else {
Utils.DBG("Header value is incorrect or not exists");
return null;
}
int i = 0;
while(scanner.hasNextInt()) {
numbersToSort[i++] = scanner.nextInt();
}
if (i != numbersToSort.length) {
Utils.DBG("File contains not complete sequence of numbers, be careful with results !");
return numbersToSort;
}
return numbersToSort;
}
}
| UTF-8 | Java | 2,634 | java | Utils.java | Java | [
{
"context": "ndom;\nimport java.util.Scanner;\n\n/**\n * Created by truerall on 5/27/16.\n */\npublic class Utils {\n\n public ",
"end": 124,
"score": 0.9995633959770203,
"start": 116,
"tag": "USERNAME",
"value": "truerall"
}
] | null | [] | package com.zsea.javatech;
import java.io.*;
import java.util.Random;
import java.util.Scanner;
/**
* Created by truerall on 5/27/16.
*/
public class Utils {
public final static void DBG(String string){
System.out.println(string);
}
public static final File createNewRandomNumbersFile(String fileName, int numbersCnt){
return createNewRandomNumbersFile(fileName,numbersCnt,false);
}
public static final File createNewRandomNumbersFile(String fileName, int numbersCnt, boolean overwrite) {
Random random = new Random();
File file = new File(fileName);
if (file.exists() & !overwrite ){
Utils.DBG("File already exists!");
return file;
} else if (file.exists() & overwrite) {
Utils.DBG("Trying to write to existing file");
}
FileWriter fw = null;
try {
fw = new FileWriter(file.getAbsoluteFile());
} catch (IOException e) {
e.printStackTrace();
}
if(fw == null){
Utils.DBG("Problem occured during FileWriter creation, please see the stacktrace above.");
return null;
}
BufferedWriter bw = new BufferedWriter(fw);
try {
bw.write(String.valueOf(numbersCnt));
bw.newLine();
for(int i = 0; i< numbersCnt;i++){
bw.write(String.valueOf(random.nextInt(10)-5));
bw.newLine();
}
bw.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
bw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return file;
}
public static int[] readNumbersFromFile(String fileName){
Scanner scanner;
int[] numbersToSort;
try {
scanner = new Scanner(new File(fileName));
} catch (FileNotFoundException e) {
Utils.DBG("Sorry but file not found");
return null;
}
if(scanner.hasNextInt()) {
numbersToSort = new int[scanner.nextInt()];
} else {
Utils.DBG("Header value is incorrect or not exists");
return null;
}
int i = 0;
while(scanner.hasNextInt()) {
numbersToSort[i++] = scanner.nextInt();
}
if (i != numbersToSort.length) {
Utils.DBG("File contains not complete sequence of numbers, be careful with results !");
return numbersToSort;
}
return numbersToSort;
}
}
| 2,634 | 0.546317 | 0.542521 | 89 | 28.595505 | 23.916389 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.539326 | false | false | 2 |
5b27b6e3516edf70192ba64eabc7acc65c221081 | 17,815,524,400,057 | eeb72be7d79e29d13d3731f9f4cf9046e5111319 | /src/main/java/com/itba/edu/ar/backend/OnSIFTAction.java | 88db2d32b01423052565ff72f9bd340aad23f707 | [] | no_license | alexjck/ATI | https://github.com/alexjck/ATI | 82e9a59fd1d705c022eadb0dd845d1223533af8c | 6636632e0270c95551227c3870854992931c7eca | refs/heads/master | 2020-04-17T23:18:54.380000 | 2014-11-20T20:38:26 | 2014-11-20T20:38:26 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.itba.edu.ar.backend;
import com.itba.edu.ar.backend.model.ImageHanlder;
import com.itba.edu.ar.utils.ImageUtils;
import java.awt.event.ActionEvent;
import java.util.Map;
public class OnSIFTAction extends PanelAction {
public OnSIFTAction(final ImageHanlder imageHanlder) {
super(imageHanlder);
}
@Override
public void actionPerformedImpl(ActionEvent arg0) {
imageHanlder.infoLog("SIFT clicked");
final String title = "Please Enter values";
final String[] texts = new String[]{"Threshold"};
Map<String, String> map = ImageUtils.showDialogAndGetValues(title, texts);
if (map == null) {
return;
}
double umbral = Double.valueOf(map.get("Threshold"));
imageHanlder.sift(umbral);
imageHanlder.draw();
}
}
| UTF-8 | Java | 814 | java | OnSIFTAction.java | Java | [] | null | [] | package com.itba.edu.ar.backend;
import com.itba.edu.ar.backend.model.ImageHanlder;
import com.itba.edu.ar.utils.ImageUtils;
import java.awt.event.ActionEvent;
import java.util.Map;
public class OnSIFTAction extends PanelAction {
public OnSIFTAction(final ImageHanlder imageHanlder) {
super(imageHanlder);
}
@Override
public void actionPerformedImpl(ActionEvent arg0) {
imageHanlder.infoLog("SIFT clicked");
final String title = "Please Enter values";
final String[] texts = new String[]{"Threshold"};
Map<String, String> map = ImageUtils.showDialogAndGetValues(title, texts);
if (map == null) {
return;
}
double umbral = Double.valueOf(map.get("Threshold"));
imageHanlder.sift(umbral);
imageHanlder.draw();
}
}
| 814 | 0.68059 | 0.679361 | 34 | 22.941177 | 22.811171 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.911765 | false | false | 2 |
96f59cedecd7f20ebc699bb2a0527056315dd30c | 20,143,396,677,971 | 7158cbabbbe5037549fdc680c85849b3a2cd8c1a | /GraphCycles/src/CycleIdentifier.java | 0533ff7d0dcc36c758a11e62facb4071b7ffb8a5 | [] | no_license | Nenyalote/TM | https://github.com/Nenyalote/TM | f700e0626c34d911ff1945ada44f2dd19fd0c0be | 6a580599bffff5a8820d74d2a106c6077d694641 | refs/heads/master | 2022-09-01T20:04:04.897000 | 2020-05-26T08:51:26 | 2020-05-26T08:51:26 | 266,991,088 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class CycleIdentifier {
public static void main (String [] args) throws IOException{
/*BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Введите размерность матрицы");
int n = Integer.parseInt(reader.readLine());
int[][] table = new int[n][n];
System.out.println("Введите элементы матрицы");
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++){
table[i][j] = Integer.parseInt(reader.readLine()); //Заполнение матрицы
}
}*/
int n=7;
int[][] table ={{0,1,1,1,1,0,0},{1,0,0,1,1,0,0},{1,0,0,0,0,1,1},{1,1,0,0,1,1,0,0,},{1,1,0,1,0,0,0},{0,0,1,0,0,0,1},{0,0,1,0,0,1,0}};
int sumStr = 0;
int sumStl = 0;
int waysCount = 0;
for (int i=0; i<n; i++){
for (int j=0; j<n; j++){
sumStr=sumStr+table[i][j]; //считаем сумму по строкам
}
if (sumStr==0){ // если сумма 0
for (int k=0; k<n; k++){ //обнуляем столбец нулевой строки
table[k][i]=0;
}
}
}
for (int j=0; j<n; j++){
for (int i=0; i<n; i++){
sumStl=sumStl+table[i][j]; //считаем сумму по cтолбцам
}
if (sumStl==0){ // если сумма 0
for (int k=0; k<n; k++){ //обнуляем строку нулевого столбца
table[k][j]=0;
}
}
}
for (int i=0; i<n; i++){
for (int j=0; j<n; j++){
if (table[i][j]!=0){
waysCount = waysCount+1;
}
}
}
if (waysCount==0){
System.out.println("Циклов нет");
} else{
System.out.println("Циклы есть");
}
}
}
| UTF-8 | Java | 1,997 | java | CycleIdentifier.java | Java | [] | null | [] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class CycleIdentifier {
public static void main (String [] args) throws IOException{
/*BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Введите размерность матрицы");
int n = Integer.parseInt(reader.readLine());
int[][] table = new int[n][n];
System.out.println("Введите элементы матрицы");
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++){
table[i][j] = Integer.parseInt(reader.readLine()); //Заполнение матрицы
}
}*/
int n=7;
int[][] table ={{0,1,1,1,1,0,0},{1,0,0,1,1,0,0},{1,0,0,0,0,1,1},{1,1,0,0,1,1,0,0,},{1,1,0,1,0,0,0},{0,0,1,0,0,0,1},{0,0,1,0,0,1,0}};
int sumStr = 0;
int sumStl = 0;
int waysCount = 0;
for (int i=0; i<n; i++){
for (int j=0; j<n; j++){
sumStr=sumStr+table[i][j]; //считаем сумму по строкам
}
if (sumStr==0){ // если сумма 0
for (int k=0; k<n; k++){ //обнуляем столбец нулевой строки
table[k][i]=0;
}
}
}
for (int j=0; j<n; j++){
for (int i=0; i<n; i++){
sumStl=sumStl+table[i][j]; //считаем сумму по cтолбцам
}
if (sumStl==0){ // если сумма 0
for (int k=0; k<n; k++){ //обнуляем строку нулевого столбца
table[k][j]=0;
}
}
}
for (int i=0; i<n; i++){
for (int j=0; j<n; j++){
if (table[i][j]!=0){
waysCount = waysCount+1;
}
}
}
if (waysCount==0){
System.out.println("Циклов нет");
} else{
System.out.println("Циклы есть");
}
}
}
| 1,997 | 0.494994 | 0.454394 | 67 | 24.835821 | 26.126898 | 136 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.358209 | false | false | 2 |
f01261c89aaff2e0d6c57bc515387f5369bf7cca | 19,567,871,044,307 | 8c3c37416ea01526ebb32fc0ef4447853c99986d | /Java/PP1Pattern.java | 2922366eb6bfafe89f2d6554cb293ff86c5012ff | [] | no_license | ZuhabWasim/ICS4U | https://github.com/ZuhabWasim/ICS4U | eeff205ab008d53a9c49ebf501eb0d6ba5429410 | b23b5615a5effee4a1cd5f8d6451bc5bc2352c5c | refs/heads/master | 2020-04-06T07:58:00.372000 | 2018-11-20T22:26:35 | 2018-11-20T22:26:35 | 157,290,719 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | // The "PP1Pattern" class.
public class PP1Pattern
{
public static void main (String[] args)
{
int n;
System.out.print("Enter a #: ");
n = ReadLib.readInt();
for(int i = n; i > 0; i--) {
for(int k = i; k > 0; k--) {
System.out.print((k) + " ");
}
System.out.println("");
}
} // main method
} // PP1Pattern class
| UTF-8 | Java | 368 | java | PP1Pattern.java | Java | [] | null | [] | // The "PP1Pattern" class.
public class PP1Pattern
{
public static void main (String[] args)
{
int n;
System.out.print("Enter a #: ");
n = ReadLib.readInt();
for(int i = n; i > 0; i--) {
for(int k = i; k > 0; k--) {
System.out.print((k) + " ");
}
System.out.println("");
}
} // main method
} // PP1Pattern class
| 368 | 0.505435 | 0.491848 | 18 | 18.444445 | 13.16655 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.166667 | false | false | 2 |
75e92eb5896e89b4373ac09b6c40b84fc73096a8 | 26,886,495,297,596 | fcf665705a02f12ccc926cd9e5fd29c12ccbcce7 | /rt.xcontainer.framework/src/org/act/xservices/rt/xcontainer/inf/service/wsdl/XcOperation.java | 5047bf95fa1c63180e5dd776350e80fa1c4264a0 | [] | no_license | google-code/actxcontainer | https://github.com/google-code/actxcontainer | b8f6f7b60ba29ae20b94c06b4218708ad031c11e | 7d408629accba7af85a0fe9ea0147c8388e4a379 | refs/heads/master | 2016-08-06T15:45:00.109000 | 2015-03-13T18:37:31 | 2015-03-13T18:37:31 | 32,174,020 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.act.xservices.rt.xcontainer.inf.service.wsdl;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import javax.xml.namespace.QName;
import org.act.xservices.rt.xcontainer.framework.provider.IProvider;
/**
* @LastModifyTime 2009-4-14
* @CreationTime
* @author Lizq [lizq@act.buaa.edu.cn]
* @since JDK1.5
*/
public class XcOperation extends XcElement{
/** */
private static final long serialVersionUID = 1L;
private QName qName;
private String parameterOrder;
// 消息交换模式,to store mepURL
private String mepURI;
//from Binding 服务方法处理方式
private String operationStyle = WSDL11Constants.STYLE_DOC;
private String soapAction;
//输入消息
private XcMessage inputXcMessage;
//输出消息
private XcMessage outputXcMessage;
//错误消息列表
private List<XcMessage> faultXcMessageList = new ArrayList<XcMessage>();
private XcPortType xcPortType;
private XcService xcService;
private XcBindingOperation xcBindingOperation;
//---WSDD---
private Method method;
private IProvider provider;
public XcOperation(){
}
public XcOperation(QName qname){
this.qName = qname;
}
public QName getQName() {
return qName;
}
public void setQName(QName qname) {
this.qName = qname;
}
public XcMessage getInputXcMessage() {
return inputXcMessage;
}
public void setInputXcMessage(XcMessage inputXcMessage) {
this.inputXcMessage = inputXcMessage;
}
public String getMepURI() {
return mepURI;
}
public void setMepURI(String mepURI) {
this.mepURI = mepURI;
}
public String getOperationStyle() {
return operationStyle;
}
public void setOperationStyle(String operationStyle) {
this.operationStyle = operationStyle;
}
public XcMessage getOutputXcMessage() {
return outputXcMessage;
}
public void setOutputXcMessage(XcMessage outputXcMessage) {
this.outputXcMessage = outputXcMessage;
}
public String getSoapAction() {
return soapAction;
}
public void setSoapAction(String soapAction) {
this.soapAction = soapAction;
}
public List<XcMessage> getFaultXcMessages(){
return this.faultXcMessageList;
}
public boolean addFaultXcMessage(XcMessage faultXcMessage){
return this.faultXcMessageList.add(faultXcMessage);
}
public boolean removeFaultXcMessage(XcMessage faultXcMessage){
return this.faultXcMessageList.remove(faultXcMessage);
}
public XcMessage getgetFaultMessageByName(String faultXcMessageName){
for(XcMessage faultMes : faultXcMessageList){
if(faultMes.getQName().getLocalPart().equals(faultXcMessageName))
return faultMes;
}
return null;
}
public String getParameterOrder() {
return parameterOrder;
}
public void setParameterOrder(String parameterOrder) {
this.parameterOrder = parameterOrder;
}
public XcPortType getXcPortType() {
return xcPortType;
}
public void setXcPortType(XcPortType xcPortType) {
this.xcPortType = xcPortType;
}
public XcService getXcService() {
return xcService;
}
public void setXcService(XcService xcService) {
this.xcService = xcService;
}
public XcBindingOperation getXcBindingOperation() {
return xcBindingOperation;
}
public void setXcBindingOperation(XcBindingOperation xcBindingOperation) {
this.xcBindingOperation = xcBindingOperation;
}
//-------------WSDD-----------
public Method getMethod() {
return method;
}
public void setMethod(Method method) {
this.method = method;
}
public IProvider getProvider() {
return provider;
}
public void setProvider(IProvider provider) {
this.provider = provider;
}
}
| GB18030 | Java | 3,893 | java | XcOperation.java | Java | [
{
"context": "ModifyTime 2009-4-14\r\n * @CreationTime\r\n * @author Lizq [lizq@act.buaa.edu.cn]\r\n * @since JDK1.5\r\n */\r\npu",
"end": 329,
"score": 0.9781086444854736,
"start": 325,
"tag": "USERNAME",
"value": "Lizq"
},
{
"context": "ime 2009-4-14\r\n * @CreationTime\r\n * @author Lizq [lizq@act.buaa.edu.cn]\r\n * @since JDK1.5\r\n */\r\npublic class XcOperation",
"end": 351,
"score": 0.9999328851699829,
"start": 331,
"tag": "EMAIL",
"value": "lizq@act.buaa.edu.cn"
}
] | null | [] | package org.act.xservices.rt.xcontainer.inf.service.wsdl;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import javax.xml.namespace.QName;
import org.act.xservices.rt.xcontainer.framework.provider.IProvider;
/**
* @LastModifyTime 2009-4-14
* @CreationTime
* @author Lizq [<EMAIL>]
* @since JDK1.5
*/
public class XcOperation extends XcElement{
/** */
private static final long serialVersionUID = 1L;
private QName qName;
private String parameterOrder;
// 消息交换模式,to store mepURL
private String mepURI;
//from Binding 服务方法处理方式
private String operationStyle = WSDL11Constants.STYLE_DOC;
private String soapAction;
//输入消息
private XcMessage inputXcMessage;
//输出消息
private XcMessage outputXcMessage;
//错误消息列表
private List<XcMessage> faultXcMessageList = new ArrayList<XcMessage>();
private XcPortType xcPortType;
private XcService xcService;
private XcBindingOperation xcBindingOperation;
//---WSDD---
private Method method;
private IProvider provider;
public XcOperation(){
}
public XcOperation(QName qname){
this.qName = qname;
}
public QName getQName() {
return qName;
}
public void setQName(QName qname) {
this.qName = qname;
}
public XcMessage getInputXcMessage() {
return inputXcMessage;
}
public void setInputXcMessage(XcMessage inputXcMessage) {
this.inputXcMessage = inputXcMessage;
}
public String getMepURI() {
return mepURI;
}
public void setMepURI(String mepURI) {
this.mepURI = mepURI;
}
public String getOperationStyle() {
return operationStyle;
}
public void setOperationStyle(String operationStyle) {
this.operationStyle = operationStyle;
}
public XcMessage getOutputXcMessage() {
return outputXcMessage;
}
public void setOutputXcMessage(XcMessage outputXcMessage) {
this.outputXcMessage = outputXcMessage;
}
public String getSoapAction() {
return soapAction;
}
public void setSoapAction(String soapAction) {
this.soapAction = soapAction;
}
public List<XcMessage> getFaultXcMessages(){
return this.faultXcMessageList;
}
public boolean addFaultXcMessage(XcMessage faultXcMessage){
return this.faultXcMessageList.add(faultXcMessage);
}
public boolean removeFaultXcMessage(XcMessage faultXcMessage){
return this.faultXcMessageList.remove(faultXcMessage);
}
public XcMessage getgetFaultMessageByName(String faultXcMessageName){
for(XcMessage faultMes : faultXcMessageList){
if(faultMes.getQName().getLocalPart().equals(faultXcMessageName))
return faultMes;
}
return null;
}
public String getParameterOrder() {
return parameterOrder;
}
public void setParameterOrder(String parameterOrder) {
this.parameterOrder = parameterOrder;
}
public XcPortType getXcPortType() {
return xcPortType;
}
public void setXcPortType(XcPortType xcPortType) {
this.xcPortType = xcPortType;
}
public XcService getXcService() {
return xcService;
}
public void setXcService(XcService xcService) {
this.xcService = xcService;
}
public XcBindingOperation getXcBindingOperation() {
return xcBindingOperation;
}
public void setXcBindingOperation(XcBindingOperation xcBindingOperation) {
this.xcBindingOperation = xcBindingOperation;
}
//-------------WSDD-----------
public Method getMethod() {
return method;
}
public void setMethod(Method method) {
this.method = method;
}
public IProvider getProvider() {
return provider;
}
public void setProvider(IProvider provider) {
this.provider = provider;
}
}
| 3,880 | 0.694292 | 0.691165 | 216 | 15.763889 | 19.744545 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.087963 | false | false | 2 |
4fd0f852b536c1edc5098f4d1eb8374330947578 | 31,945,966,777,322 | 6a61b417a7d0644acfb1f3dd9d65dc477f54ec76 | /src/main/java/Utils.java | df02973e4d79f7b051156aa5892f9e537830bf78 | [] | no_license | matsarou/myRepository | https://github.com/matsarou/myRepository | 88bb637cd44a059c0633665db8a27fbe77794f86 | 5516e19d1a781f8d6ffe3b6d754bbeb552aec1bf | refs/heads/master | 2016-08-07T09:09:25.596000 | 2015-08-30T09:30:22 | 2015-08-30T09:30:22 | 41,622,658 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.io.Console;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Utils {
private static final String TIMESTAMP_PATTERN="dd/MMM/yyyy:HH:mm:ss Z";
static String waitForInput(Console c,String message,Object... args) {
if (c == null) {
return("No console device is available.");
}
if (message != null){
c.format(message,args);
}
return c.readLine();
}
static void printRegularMessage(Console c,String message,Object... args) {
if (c != null && message!=null) {
c.format(message,args);
}
}
static String createTimestamp(){
SimpleDateFormat dateFormat = new SimpleDateFormat(TIMESTAMP_PATTERN);
return dateFormat.format(new Date().getTime());
}
}
| UTF-8 | Java | 763 | java | Utils.java | Java | [] | null | [] | import java.io.Console;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Utils {
private static final String TIMESTAMP_PATTERN="dd/MMM/yyyy:HH:mm:ss Z";
static String waitForInput(Console c,String message,Object... args) {
if (c == null) {
return("No console device is available.");
}
if (message != null){
c.format(message,args);
}
return c.readLine();
}
static void printRegularMessage(Console c,String message,Object... args) {
if (c != null && message!=null) {
c.format(message,args);
}
}
static String createTimestamp(){
SimpleDateFormat dateFormat = new SimpleDateFormat(TIMESTAMP_PATTERN);
return dateFormat.format(new Date().getTime());
}
}
| 763 | 0.653997 | 0.653997 | 29 | 25.310345 | 23.987215 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.275862 | false | false | 2 |
dffb3017f08d493663121d14d474a551bdd40918 | 3,246,995,322,713 | fb98a11841978b80c93cafef1989f950e63b9f5d | /src/Circle.java | 0af1e3215a72804b87666c2d99d151929e27bdec | [] | no_license | pcz007/zadanie9 | https://github.com/pcz007/zadanie9 | 3405d444ba1e54430b66b22d17b95e5cf91e5200 | 032a549a6e7ad42e2c8bfbd38a7fc8f58fb11a7f | refs/heads/master | 2020-03-24T23:41:34.824000 | 2018-08-01T11:57:06 | 2018-08-01T11:57:06 | 143,149,623 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public class Circle extends GeometricShape {
}
| UTF-8 | Java | 47 | java | Circle.java | Java | [] | null | [] | public class Circle extends GeometricShape {
}
| 47 | 0.808511 | 0.808511 | 2 | 22.5 | 21.5 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | false | false | 2 |
cd2277ea08cf9aca645a65b4ab6c214d05b1b7b2 | 3,246,995,322,362 | 2cfcc28d3dacfa805eedff1afbf928f0c6799c95 | /src/viewmodel/areasmodels/InfoPanelViewModel.java | 51c82bfebeb983bef108b4814b4defd31927939c | [] | no_license | AlElizarov/KnapsakProblem2 | https://github.com/AlElizarov/KnapsakProblem2 | 3a06700c6f79e009ed960428598b112ab3c5efd5 | f2f3e1ce3aa365a35cef6f0baaa72258ea324f29 | refs/heads/master | 2021-06-05T17:53:52.699000 | 2016-10-25T09:17:59 | 2016-10-25T09:17:59 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package viewmodel.areasmodels;
import viewmodel.TaskManager;
public class InfoPanelViewModel {
private TaskManager manager;
public InfoPanelViewModel(TaskManager manager) {
this.manager = manager;
}
public String getInfoText() {
if (manager.isTaskCreated()) {
return "<html><h3>Information</h3>"
+ "<hr>"
+ (manager.getCriterionCount() > 1 ? "Multicriteria"
: "One-criterion")
+ " problem<br>"
+ " of "
+ (manager.getLimitationCount() > 1 ? "multidimensional"
: "onedimensional")
+ " knapsack<br><br>"
+ "Variables count: "
+ manager.getVariableCount()
+ "<br>Limitations count: "
+ manager.getLimitationCount()
+ "<br>Criterions count: "
+ manager.getCriterionCount()
+ "<br> Criterions type: "
+ (manager.isMax() ? "maximum" : "minimum")
+ "<br><br>"
+ (manager.getAuthor() == null ? "" : "Author: "
+ manager.getAuthor() + "<br>")
+ (manager.getDate() == null ? "" : "Date: "
+ manager.getDate() + "<br>")
+ (manager.getNote() == null ? "" : "Note: "
+ manager.getNote() + "<br>") + "<br><br></html>";
}
return "<html><h3>Information</h3>" + "<hr>No tasks:<ul>"
+ "<li>Create new task</li>"
+ "<li>Read task from database</li>" + "</ul>" + "</html>";
}
public boolean isTaskNameFieldEnabled() {
if (manager.isTaskCreated()) {
return true;
}
return false;
}
public String getTaskName() {
return manager.getTaskName();
}
public boolean isTaskEconom() {
return manager.isTaskEconom();
}
public String getEconomText() {
return manager.getEconomText();
}
public boolean setTaskName(String taskName) {
if (taskName.length() <= 0 || !taskName.matches("(\\w+|\\s+)")
|| taskName.matches("^\\s+$")) {
return false;
}
manager.setTaskName(taskName);
return true;
}
public boolean setEconomMeaning(String economMeaning) {
if (economMeaning.length() <= 0
|| !economMeaning.matches("(\\w+|\\s+)")
|| economMeaning.matches("^\\s+$")) {
return false;
}
manager.setEconomText(economMeaning);
return true;
}
}
| UTF-8 | Java | 2,117 | java | InfoPanelViewModel.java | Java | [] | null | [] | package viewmodel.areasmodels;
import viewmodel.TaskManager;
public class InfoPanelViewModel {
private TaskManager manager;
public InfoPanelViewModel(TaskManager manager) {
this.manager = manager;
}
public String getInfoText() {
if (manager.isTaskCreated()) {
return "<html><h3>Information</h3>"
+ "<hr>"
+ (manager.getCriterionCount() > 1 ? "Multicriteria"
: "One-criterion")
+ " problem<br>"
+ " of "
+ (manager.getLimitationCount() > 1 ? "multidimensional"
: "onedimensional")
+ " knapsack<br><br>"
+ "Variables count: "
+ manager.getVariableCount()
+ "<br>Limitations count: "
+ manager.getLimitationCount()
+ "<br>Criterions count: "
+ manager.getCriterionCount()
+ "<br> Criterions type: "
+ (manager.isMax() ? "maximum" : "minimum")
+ "<br><br>"
+ (manager.getAuthor() == null ? "" : "Author: "
+ manager.getAuthor() + "<br>")
+ (manager.getDate() == null ? "" : "Date: "
+ manager.getDate() + "<br>")
+ (manager.getNote() == null ? "" : "Note: "
+ manager.getNote() + "<br>") + "<br><br></html>";
}
return "<html><h3>Information</h3>" + "<hr>No tasks:<ul>"
+ "<li>Create new task</li>"
+ "<li>Read task from database</li>" + "</ul>" + "</html>";
}
public boolean isTaskNameFieldEnabled() {
if (manager.isTaskCreated()) {
return true;
}
return false;
}
public String getTaskName() {
return manager.getTaskName();
}
public boolean isTaskEconom() {
return manager.isTaskEconom();
}
public String getEconomText() {
return manager.getEconomText();
}
public boolean setTaskName(String taskName) {
if (taskName.length() <= 0 || !taskName.matches("(\\w+|\\s+)")
|| taskName.matches("^\\s+$")) {
return false;
}
manager.setTaskName(taskName);
return true;
}
public boolean setEconomMeaning(String economMeaning) {
if (economMeaning.length() <= 0
|| !economMeaning.matches("(\\w+|\\s+)")
|| economMeaning.matches("^\\s+$")) {
return false;
}
manager.setEconomText(economMeaning);
return true;
}
}
| 2,117 | 0.601795 | 0.598016 | 83 | 24.506023 | 18.958658 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.855422 | false | false | 2 |
e1af0a7a9a5bf98cf09ee9571e5c855e1800e26a | 28,441,273,450,242 | 0ea145f1d503874ff47b72002b65e8a427225bc3 | /src/main/java/com/nicolea/app/service/IHorariosService.java | 9780a40062465ff01b5ef46dcc9e5ab1fc5c932d | [] | no_license | Nicolea22/spring-proyecto-curso | https://github.com/Nicolea22/spring-proyecto-curso | 3e17001c778f5a945b4a4c2de92c78e3370b66cb | 99d195a4cecfc91c942f9cc346c98b15c1e30789 | refs/heads/master | 2020-12-23T07:48:29.753000 | 2020-03-02T01:51:41 | 2020-03-02T01:51:41 | 237,088,593 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.nicolea.app.service;
import com.nicolea.app.model.Horario;
import java.util.Date;
import java.util.List;
public interface IHorariosService {
List<Horario> buscarPorIdYFecha(int idPelicula, Date fecha);
void insertar(Horario horario);
}
| UTF-8 | Java | 274 | java | IHorariosService.java | Java | [] | null | [] | package com.nicolea.app.service;
import com.nicolea.app.model.Horario;
import java.util.Date;
import java.util.List;
public interface IHorariosService {
List<Horario> buscarPorIdYFecha(int idPelicula, Date fecha);
void insertar(Horario horario);
}
| 274 | 0.733577 | 0.733577 | 13 | 19.076923 | 19.955572 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.538462 | false | false | 2 |
091877fdf0c6390a9519b5b051fb6cb2363e5fc0 | 28,372,553,992,018 | 2df5cd0c5d705be554f951c8392d49dc7c44338d | /app/src/main/java/com/example/app1/MainPage.java | ff9f2dce0e115de618e9714b57e29277822634cb | [] | no_license | Rafin298/flunky | https://github.com/Rafin298/flunky | 7e5d6b89765a7bce2c097c1f7f7624c5d2d46829 | 3589d95968b8188a8aea0fae6ad2b183a97f90cc | refs/heads/main | 2023-08-22T03:37:59.043000 | 2021-10-17T07:20:48 | 2021-10-17T07:20:48 | 418,052,442 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.app1;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.example.app1.journal.Journal3;
import com.example.app1.news.news1;
import com.example.app1.todoList.todo1;
import com.example.app1.weather.weather1;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import util.JournalApi;
public class MainPage extends AppCompatActivity {
private FirebaseAuth firebaseAuth;
private FirebaseUser user;
Button homeButton,signOutButton;
TextView nameUp;
Button weatherButton,journalButton,todoListButton,newsButton,gameButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_page);
weatherButton = findViewById(R.id.weatherButton);
journalButton = findViewById(R.id.journalButton);
todoListButton = findViewById(R.id.todoListButton);
newsButton = findViewById(R.id.newsButton);
gameButton = findViewById(R.id.gameButton);
nameUp =findViewById(R.id.nameUp);
firebaseAuth = FirebaseAuth.getInstance();
user = firebaseAuth.getCurrentUser();
nameUp.setText("Hi "+JournalApi.getInstance().getUsername());
signOutButton = findViewById(R.id.signOutButton);
signOutButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (user != null && firebaseAuth != null) {
firebaseAuth.signOut();
startActivity(new Intent(MainPage.this,
login.class));
//finish();
}
}
});
weatherButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainPage.this, weather1.class));
}
});
journalButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainPage.this, Journal3.class));
}
});
todoListButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainPage.this, todo1.class));
}
});
newsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainPage.this, news1.class));
}
});
gameButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//startActivity(new Intent(login.this, signUp.class));
}
});
}
} | UTF-8 | Java | 3,063 | java | MainPage.java | Java | [] | null | [] | package com.example.app1;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.example.app1.journal.Journal3;
import com.example.app1.news.news1;
import com.example.app1.todoList.todo1;
import com.example.app1.weather.weather1;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import util.JournalApi;
public class MainPage extends AppCompatActivity {
private FirebaseAuth firebaseAuth;
private FirebaseUser user;
Button homeButton,signOutButton;
TextView nameUp;
Button weatherButton,journalButton,todoListButton,newsButton,gameButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_page);
weatherButton = findViewById(R.id.weatherButton);
journalButton = findViewById(R.id.journalButton);
todoListButton = findViewById(R.id.todoListButton);
newsButton = findViewById(R.id.newsButton);
gameButton = findViewById(R.id.gameButton);
nameUp =findViewById(R.id.nameUp);
firebaseAuth = FirebaseAuth.getInstance();
user = firebaseAuth.getCurrentUser();
nameUp.setText("Hi "+JournalApi.getInstance().getUsername());
signOutButton = findViewById(R.id.signOutButton);
signOutButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (user != null && firebaseAuth != null) {
firebaseAuth.signOut();
startActivity(new Intent(MainPage.this,
login.class));
//finish();
}
}
});
weatherButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainPage.this, weather1.class));
}
});
journalButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainPage.this, Journal3.class));
}
});
todoListButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainPage.this, todo1.class));
}
});
newsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainPage.this, news1.class));
}
});
gameButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//startActivity(new Intent(login.this, signUp.class));
}
});
}
} | 3,063 | 0.629448 | 0.625204 | 93 | 31.946236 | 23.597597 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.602151 | false | false | 2 |
c36836d19f07fc19cb3c790048397f328fbbd16d | 19,095,424,638,767 | 374bd506c92f8722953ee509f1e635743814cb5a | /src/com/kaanish/model/Users.java | 75364e431060aeddd6bb3efd9c88128200ad1c9a | [] | no_license | monalisa8/inventory | https://github.com/monalisa8/inventory | bc6c4926cc33cf785dfa70a745244f94a1d4df6f | d0f85df4b0eb648007e4be8d0c75092524ab467b | refs/heads/master | 2023-03-18T23:14:36.350000 | 2016-09-15T14:11:46 | 2016-09-15T14:11:46 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.kaanish.model;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Cacheable;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import org.eclipse.persistence.jpa.config.Cascade;
@Entity
@Cacheable(false)
public class Users implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private String userId;
private String name;
private String ph;
private String password;
@OneToMany(mappedBy = "user")
private List<ApprovalEntry> approvalEntries;
@OneToMany(mappedBy = "user")
private List<ApprovalReturn> approvalReturns;
@OneToMany(mappedBy = "users")
private List<SecurityAnswers> securityAnswers;
@OneToMany(mappedBy = "users")
private List<NotificationView> notificationView;
@ManyToOne
@JoinColumn(name = "companyInfoId")
private CompanyInfo companyInfo;
@OneToMany(mappedBy = "users")
List<Tax> taxes;
@OneToMany(mappedBy = "users")
List<Tax_Type_Group> tax_Type_Groups;
@OneToMany(mappedBy = "users")
private List<Vendor> vendors;
@OneToMany(mappedBy = "users", cascade = CascadeType.PERSIST)
private List<AccountDetails> accountDetails;
@OneToMany(mappedBy = "users")
private List<Purchase_Entry> purchase_Entries;
@OneToMany(mappedBy = "users")
private List<PurchaseOrderEntry> purchaseOrderEntry;
@OneToMany(mappedBy = "users")
private List<VoucherDetails> voucherDetails;
@OneToMany(mappedBy = "users")
private List<SalesReturn> SalesReturn;
@ManyToOne
@JoinColumn(name = "userGroupId")
private UserGroup userGroup;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPh() {
return ph;
}
public void setPh(String ph) {
this.ph = ph;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public List<Tax> getTaxes() {
return taxes;
}
public void setTaxes(List<Tax> taxes) {
this.taxes = taxes;
}
public List<Tax_Type_Group> getTax_Type_Groups() {
return tax_Type_Groups;
}
public void setTax_Type_Groups(List<Tax_Type_Group> tax_Type_Groups) {
this.tax_Type_Groups = tax_Type_Groups;
}
public List<Vendor> getVendors() {
return vendors;
}
public void setVendors(List<Vendor> vendors) {
this.vendors = vendors;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public List<AccountDetails> getAccountDetails() {
return accountDetails;
}
public void setAccountDetails(List<AccountDetails> accountDetails) {
this.accountDetails = accountDetails;
}
public List<Purchase_Entry> getPurchase_Entries() {
return purchase_Entries;
}
public void setPurchase_Entries(List<Purchase_Entry> purchase_Entries) {
this.purchase_Entries = purchase_Entries;
}
public UserGroup getUserGroup() {
return userGroup;
}
public void setUserGroup(UserGroup userGroup) {
this.userGroup = userGroup;
}
public CompanyInfo getCompanyInfo() {
return companyInfo;
}
public void setCompanyInfo(CompanyInfo companyInfo) {
this.companyInfo = companyInfo;
}
public List<SecurityAnswers> getSecurityAnswers() {
return securityAnswers;
}
public void setSecurityAnswers(List<SecurityAnswers> securityAnswers) {
this.securityAnswers = securityAnswers;
}
public List<VoucherDetails> getVoucherDetails() {
return voucherDetails;
}
public void setVoucherDetails(List<VoucherDetails> voucherDetails) {
this.voucherDetails = voucherDetails;
}
public List<SalesReturn> getSalesReturn() {
return SalesReturn;
}
public void setSalesReturn(List<SalesReturn> salesReturn) {
SalesReturn = salesReturn;
}
public List<NotificationView> getNotificationView() {
return notificationView;
}
public void setNotificationView(List<NotificationView> notificationView) {
this.notificationView = notificationView;
}
public List<PurchaseOrderEntry> getPurchaseOrderEntry() {
return purchaseOrderEntry;
}
public void setPurchaseOrderEntry(
List<PurchaseOrderEntry> purchaseOrderEntry) {
this.purchaseOrderEntry = purchaseOrderEntry;
}
public List<ApprovalEntry> getApprovalEntries() {
return approvalEntries;
}
public void setApprovalEntries(List<ApprovalEntry> approvalEntries) {
this.approvalEntries = approvalEntries;
}
public List<ApprovalReturn> getApprovalReturns() {
return approvalReturns;
}
public void setApprovalReturns(List<ApprovalReturn> approvalReturns) {
this.approvalReturns = approvalReturns;
}
}
| UTF-8 | Java | 4,912 | java | Users.java | Java | [] | null | [] | package com.kaanish.model;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Cacheable;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import org.eclipse.persistence.jpa.config.Cascade;
@Entity
@Cacheable(false)
public class Users implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private String userId;
private String name;
private String ph;
private String password;
@OneToMany(mappedBy = "user")
private List<ApprovalEntry> approvalEntries;
@OneToMany(mappedBy = "user")
private List<ApprovalReturn> approvalReturns;
@OneToMany(mappedBy = "users")
private List<SecurityAnswers> securityAnswers;
@OneToMany(mappedBy = "users")
private List<NotificationView> notificationView;
@ManyToOne
@JoinColumn(name = "companyInfoId")
private CompanyInfo companyInfo;
@OneToMany(mappedBy = "users")
List<Tax> taxes;
@OneToMany(mappedBy = "users")
List<Tax_Type_Group> tax_Type_Groups;
@OneToMany(mappedBy = "users")
private List<Vendor> vendors;
@OneToMany(mappedBy = "users", cascade = CascadeType.PERSIST)
private List<AccountDetails> accountDetails;
@OneToMany(mappedBy = "users")
private List<Purchase_Entry> purchase_Entries;
@OneToMany(mappedBy = "users")
private List<PurchaseOrderEntry> purchaseOrderEntry;
@OneToMany(mappedBy = "users")
private List<VoucherDetails> voucherDetails;
@OneToMany(mappedBy = "users")
private List<SalesReturn> SalesReturn;
@ManyToOne
@JoinColumn(name = "userGroupId")
private UserGroup userGroup;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPh() {
return ph;
}
public void setPh(String ph) {
this.ph = ph;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public List<Tax> getTaxes() {
return taxes;
}
public void setTaxes(List<Tax> taxes) {
this.taxes = taxes;
}
public List<Tax_Type_Group> getTax_Type_Groups() {
return tax_Type_Groups;
}
public void setTax_Type_Groups(List<Tax_Type_Group> tax_Type_Groups) {
this.tax_Type_Groups = tax_Type_Groups;
}
public List<Vendor> getVendors() {
return vendors;
}
public void setVendors(List<Vendor> vendors) {
this.vendors = vendors;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public List<AccountDetails> getAccountDetails() {
return accountDetails;
}
public void setAccountDetails(List<AccountDetails> accountDetails) {
this.accountDetails = accountDetails;
}
public List<Purchase_Entry> getPurchase_Entries() {
return purchase_Entries;
}
public void setPurchase_Entries(List<Purchase_Entry> purchase_Entries) {
this.purchase_Entries = purchase_Entries;
}
public UserGroup getUserGroup() {
return userGroup;
}
public void setUserGroup(UserGroup userGroup) {
this.userGroup = userGroup;
}
public CompanyInfo getCompanyInfo() {
return companyInfo;
}
public void setCompanyInfo(CompanyInfo companyInfo) {
this.companyInfo = companyInfo;
}
public List<SecurityAnswers> getSecurityAnswers() {
return securityAnswers;
}
public void setSecurityAnswers(List<SecurityAnswers> securityAnswers) {
this.securityAnswers = securityAnswers;
}
public List<VoucherDetails> getVoucherDetails() {
return voucherDetails;
}
public void setVoucherDetails(List<VoucherDetails> voucherDetails) {
this.voucherDetails = voucherDetails;
}
public List<SalesReturn> getSalesReturn() {
return SalesReturn;
}
public void setSalesReturn(List<SalesReturn> salesReturn) {
SalesReturn = salesReturn;
}
public List<NotificationView> getNotificationView() {
return notificationView;
}
public void setNotificationView(List<NotificationView> notificationView) {
this.notificationView = notificationView;
}
public List<PurchaseOrderEntry> getPurchaseOrderEntry() {
return purchaseOrderEntry;
}
public void setPurchaseOrderEntry(
List<PurchaseOrderEntry> purchaseOrderEntry) {
this.purchaseOrderEntry = purchaseOrderEntry;
}
public List<ApprovalEntry> getApprovalEntries() {
return approvalEntries;
}
public void setApprovalEntries(List<ApprovalEntry> approvalEntries) {
this.approvalEntries = approvalEntries;
}
public List<ApprovalReturn> getApprovalReturns() {
return approvalReturns;
}
public void setApprovalReturns(List<ApprovalReturn> approvalReturns) {
this.approvalReturns = approvalReturns;
}
}
| 4,912 | 0.726181 | 0.725977 | 213 | 21.061033 | 20.782373 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.173709 | false | false | 2 |
378bd31ab6d445fe6e93300995f53699c3d62a06 | 2,267,742,750,527 | 114b3748b7a211a12ce5b6dff4fca8a17a795179 | /app/src/main/java/com/mirror/woodpecker/app/adapter/ImageAddsAdapter.java | af51c6ab9296d7990e01cfc8b4ef639c05aa0235 | [] | no_license | mirror5821/Woodpeckers | https://github.com/mirror5821/Woodpeckers | 40be2db6fb894cd9fe2c18081614c01b3bd77f1e | 23e2576c7ed045f548d6273760104ab69d87cac5 | refs/heads/master | 2020-05-25T15:47:10.393000 | 2016-09-18T07:24:05 | 2016-09-18T07:24:05 | 52,347,043 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mirror.woodpecker.app.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import com.mirror.woodpecker.app.R;
import org.xutils.image.ImageOptions;
import org.xutils.x;
import java.io.File;
import java.util.List;
/**
* Created by 王沛栋 on 2016/3/16.
*/
public class ImageAddsAdapter extends BaseAdapter {
private List<String> mList;
private LayoutInflater mInflater;
private Context mContext;
public ImageAddsAdapter(Context context, List<String> mList){
this.mList = mList;
mInflater = LayoutInflater.from(context);
mContext = context;
}
@Override
public int getCount() {
return mList.size();
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
private ImageOptions mImageOptions;
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder = null;
if (null == convertView){
viewHolder = new ViewHolder();
convertView = mInflater.inflate(R.layout.item_img_add, null);
viewHolder.img = (ImageView) convertView.findViewById(R.id.img_add);
viewHolder.imgDelete = (ImageView)convertView.findViewById(R.id.img_delete);
convertView.setTag(viewHolder);
}
else{
viewHolder = (ViewHolder) convertView.getTag();
}
if(mImageOptions == null){
mImageOptions = new ImageOptions.Builder()
// 如果ImageView的大小不是定义为wrap_content, 不要crop.
.setCrop(true)
// 加载中或错误图片的ScaleType
//.setPlaceholderScaleType(ImageView.ScaleType.MATRIX)
.setImageScaleType(ImageView.ScaleType.CENTER_CROP)
.setLoadingDrawableId(R.mipmap.ic_default_error).setAutoRotate(true)
.setFailureDrawableId(R.mipmap.ic_default_error)
.build();
}
String imgUrl = mList.get(position);
if(mList.size()==1){
viewHolder.imgDelete.setVisibility(View.GONE);
viewHolder.img.setImageResource(R.mipmap.ic_img_add);
}else{
if (imgUrl!=null){
File imageFile = new File(imgUrl);
x.image().bind(viewHolder.img, imageFile.toURI().toString(), mImageOptions);
viewHolder.imgDelete.setVisibility(View.VISIBLE);
}else{
viewHolder.imgDelete.setVisibility(View.GONE);
viewHolder.img.setImageResource(R.mipmap.ic_img_add);
}
}
return convertView;
}
private static class ViewHolder{
ImageView img,imgDelete;
}
}
| UTF-8 | Java | 3,019 | java | ImageAddsAdapter.java | Java | [
{
"context": "o.File;\nimport java.util.List;\n\n/**\n * Created by 王沛栋 on 2016/3/16.\n */\npublic class ImageAddsAdapter e",
"end": 401,
"score": 0.9960554242134094,
"start": 398,
"tag": "NAME",
"value": "王沛栋"
}
] | null | [] | package com.mirror.woodpecker.app.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import com.mirror.woodpecker.app.R;
import org.xutils.image.ImageOptions;
import org.xutils.x;
import java.io.File;
import java.util.List;
/**
* Created by 王沛栋 on 2016/3/16.
*/
public class ImageAddsAdapter extends BaseAdapter {
private List<String> mList;
private LayoutInflater mInflater;
private Context mContext;
public ImageAddsAdapter(Context context, List<String> mList){
this.mList = mList;
mInflater = LayoutInflater.from(context);
mContext = context;
}
@Override
public int getCount() {
return mList.size();
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
private ImageOptions mImageOptions;
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder = null;
if (null == convertView){
viewHolder = new ViewHolder();
convertView = mInflater.inflate(R.layout.item_img_add, null);
viewHolder.img = (ImageView) convertView.findViewById(R.id.img_add);
viewHolder.imgDelete = (ImageView)convertView.findViewById(R.id.img_delete);
convertView.setTag(viewHolder);
}
else{
viewHolder = (ViewHolder) convertView.getTag();
}
if(mImageOptions == null){
mImageOptions = new ImageOptions.Builder()
// 如果ImageView的大小不是定义为wrap_content, 不要crop.
.setCrop(true)
// 加载中或错误图片的ScaleType
//.setPlaceholderScaleType(ImageView.ScaleType.MATRIX)
.setImageScaleType(ImageView.ScaleType.CENTER_CROP)
.setLoadingDrawableId(R.mipmap.ic_default_error).setAutoRotate(true)
.setFailureDrawableId(R.mipmap.ic_default_error)
.build();
}
String imgUrl = mList.get(position);
if(mList.size()==1){
viewHolder.imgDelete.setVisibility(View.GONE);
viewHolder.img.setImageResource(R.mipmap.ic_img_add);
}else{
if (imgUrl!=null){
File imageFile = new File(imgUrl);
x.image().bind(viewHolder.img, imageFile.toURI().toString(), mImageOptions);
viewHolder.imgDelete.setVisibility(View.VISIBLE);
}else{
viewHolder.imgDelete.setVisibility(View.GONE);
viewHolder.img.setImageResource(R.mipmap.ic_img_add);
}
}
return convertView;
}
private static class ViewHolder{
ImageView img,imgDelete;
}
}
| 3,019 | 0.618984 | 0.616291 | 94 | 30.606382 | 24.656025 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.510638 | false | false | 2 |
4606a62084a31138c4cea17363300435a963d049 | 4,174,708,218,143 | 2350ef2e6df96a5426a535b8848541405539d9e0 | /sources/qub/Traversable.java | a8e2a80e321fb06d964b8b51e740c563e5549b5f | [
"MIT"
] | permissive | danschultequb/lib-java | https://github.com/danschultequb/lib-java | 63d32c54caaca166242394384d81fb22ca223526 | 00a8befae5f82f105fc06c37e4948939d3b28ba5 | refs/heads/master | 2023-03-17T11:48:39.192000 | 2023-03-12T16:07:17 | 2023-03-12T16:07:17 | 101,819,540 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package qub;
/**
* An object that can be traversed.
* @param <TNode> The type of the nodes that will be traversed.
* @param <TValue> The type of the values that will be returned by the traversal.
*/
public interface Traversable<TNode,TValue>
{
/**
* Iterate through the values in this Traversable2 using the provided Traversal2.
* @param traversal The Traversal2 to use to iterate through the values in this Traversable2.
* @return An Iterator that will iterate through the values of this Traversable2.
*/
Iterator<TValue> iterate(Traversal<TNode,TValue> traversal);
}
| UTF-8 | Java | 602 | java | Traversable.java | Java | [] | null | [] | package qub;
/**
* An object that can be traversed.
* @param <TNode> The type of the nodes that will be traversed.
* @param <TValue> The type of the values that will be returned by the traversal.
*/
public interface Traversable<TNode,TValue>
{
/**
* Iterate through the values in this Traversable2 using the provided Traversal2.
* @param traversal The Traversal2 to use to iterate through the values in this Traversable2.
* @return An Iterator that will iterate through the values of this Traversable2.
*/
Iterator<TValue> iterate(Traversal<TNode,TValue> traversal);
}
| 602 | 0.725914 | 0.717608 | 16 | 36.625 | 35.596481 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 2 |
49e9c14d06a6cbdb82b4e86fb65b976d7eecc758 | 4,020,089,435,052 | 02faf8a7c1d22d0fdc34cf59ae6bf9f7ddd5e3da | /src/main/java/com/rendinadavide/funadventure/domain/payment/CardPayment.java | ff94296c0820af0040dafe0e9a3d9dbae480d8d7 | [] | no_license | Daviderendina/FunAdventure | https://github.com/Daviderendina/FunAdventure | 086da71eb4d8ca352ca2ffa3a293fd2e191e27d9 | d9cea175dde02b2af4f3f8e2bf81cf4e1536c37a | refs/heads/master | 2023-03-07T05:12:22.026000 | 2021-01-12T22:24:26 | 2021-01-12T22:24:26 | 340,493,300 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.rendinadavide.funadventure.domain.payment;
import javax.persistence.Entity;
import java.util.Objects;
@Entity
public class CardPayment extends Payment {
private String transactionNumber;
public CardPayment(float amount, String transactionNumber) {
super(amount);
this.transactionNumber = transactionNumber;
}
public CardPayment(){}
public String getTransactionNumber() {
return transactionNumber;
}
public void setTransactionNumber(String transactionNumber) {
this.transactionNumber = transactionNumber;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
CardPayment that = (CardPayment) o;
return Objects.equals(transactionNumber, that.transactionNumber);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), transactionNumber);
}
}
| UTF-8 | Java | 1,029 | java | CardPayment.java | Java | [
{
"context": "package com.rendinadavide.funadventure.domain.payment;\n\nimport javax.persis",
"end": 25,
"score": 0.9244049191474915,
"start": 12,
"tag": "USERNAME",
"value": "rendinadavide"
}
] | null | [] | package com.rendinadavide.funadventure.domain.payment;
import javax.persistence.Entity;
import java.util.Objects;
@Entity
public class CardPayment extends Payment {
private String transactionNumber;
public CardPayment(float amount, String transactionNumber) {
super(amount);
this.transactionNumber = transactionNumber;
}
public CardPayment(){}
public String getTransactionNumber() {
return transactionNumber;
}
public void setTransactionNumber(String transactionNumber) {
this.transactionNumber = transactionNumber;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
CardPayment that = (CardPayment) o;
return Objects.equals(transactionNumber, that.transactionNumber);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), transactionNumber);
}
}
| 1,029 | 0.6793 | 0.6793 | 38 | 26.078947 | 23.342283 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 2 |
1e2092ae9eed0279cbb3846ff622795d2713a8f6 | 11,622,181,550,512 | 10c5dfd23c878b976113aad1e93b3460b0ff19b0 | /Yst_web_ssh/src/main/java/com/yst/web/dao/consult/ConsultDao.java | 56ede38f3e6af25097038609ded72a1d0ad6fa42 | [] | no_license | thows/jianqiao_yst | https://github.com/thows/jianqiao_yst | 9b22447b234150ed906d601edc7dc15d3af8dfb3 | 3d21dbd13cf292530c0ffe8209ef80f875d46b5b | refs/heads/master | 2021-01-19T14:21:51.663000 | 2017-04-14T01:03:42 | 2017-04-14T01:03:42 | 88,151,168 | 0 | 5 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.yst.web.dao.consult;
import org.alqframework.orm.hibernate.BaseDao;
import com.yst.web.entity.consult.Consult;
public interface ConsultDao extends BaseDao<Consult>{
}
| UTF-8 | Java | 183 | java | ConsultDao.java | Java | [] | null | [] | package com.yst.web.dao.consult;
import org.alqframework.orm.hibernate.BaseDao;
import com.yst.web.entity.consult.Consult;
public interface ConsultDao extends BaseDao<Consult>{
}
| 183 | 0.803279 | 0.803279 | 9 | 19.333334 | 21.984844 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 2 |
47b00eb2f80b265fb67634acda971a74138d36db | 27,814,208,221,546 | 7ceff96a0284fb783c7da5f0621cbabe43d07add | /src/test/java/com/thinkgem/jeesite/modules/asmt/dao/AssementUserDaoTest.java | 164f159ce8b739ee264b268b4f2a422026fa9c3e | [
"Apache-2.0"
] | permissive | yisheng4666/jeesite-master_hibernate | https://github.com/yisheng4666/jeesite-master_hibernate | 296ae04c25c2e3e92fdd1220034237fc281cb9ac | 7ac50ba022a8d581806d3b072764aeb94ece2d6a | refs/heads/master | 2021-08-07T01:06:04.058000 | 2017-11-07T08:40:37 | 2017-11-07T08:40:37 | 108,609,550 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.thinkgem.jeesite.modules.asmt.dao;
import org.springframework.beans.factory.annotation.Autowired;
import com.thinkgem.jeesite.common.test.SpringTransactionalContextTests;
/**
*
* @author JianHui
* @date 2017年9月14日--下午12:03:46
*
*/
public class AssementUserDaoTest extends SpringTransactionalContextTests {
@Autowired
AssementUserDao assementUserDao;
}
| UTF-8 | Java | 407 | java | AssementUserDaoTest.java | Java | [
{
"context": "TransactionalContextTests;\r\n\r\n/**\r\n * \r\n * @author JianHui\r\n * @date 2017年9月14日--下午12:03:46\r\n *\r\n */\r\n\r\npubl",
"end": 220,
"score": 0.9948806762695312,
"start": 213,
"tag": "NAME",
"value": "JianHui"
}
] | null | [] | package com.thinkgem.jeesite.modules.asmt.dao;
import org.springframework.beans.factory.annotation.Autowired;
import com.thinkgem.jeesite.common.test.SpringTransactionalContextTests;
/**
*
* @author JianHui
* @date 2017年9月14日--下午12:03:46
*
*/
public class AssementUserDaoTest extends SpringTransactionalContextTests {
@Autowired
AssementUserDao assementUserDao;
}
| 407 | 0.758186 | 0.725441 | 19 | 18.894737 | 25.509327 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.315789 | false | false | 2 |
bbdb43c04364a18185cb5a05341b177b6967ddb9 | 20,383,914,838,869 | eea2e5c8891f838b6df99e3b2b3d288d60ba886b | /src/main/java/ReadMe/dao/BlogDao.java | 81d001771022639d326c52e2039d64b7c6f2dfc2 | [
"MIT"
] | permissive | apndx/Lukuvinkkikirjasto | https://github.com/apndx/Lukuvinkkikirjasto | 1739aff0375e21175701a255435fc0e109d188ca | cc4a20265d62234fc3cdf73ba708646266511ea5 | refs/heads/master | 2020-04-07T19:43:03.291000 | 2018-12-17T11:30:02 | 2018-12-17T11:30:02 | 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 ReadMe.dao;
import ReadMe.database.Database;
import ReadMe.domain.Blog;
import ReadMe.domain.ReadingTip;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Interface for Blog database access object.
* @author madjanne
*/
public class BlogDao {
private final Database db;
/**
* Creates new Blog DAO for database
* @param db
*/
public BlogDao(Database db) {
this.db = db;
}
/**
* Lists all Blog objects. Connects to database, retrieves all lines from the Blog table, and returns a list of Blog objects.
* Returns null in case of SQL exception.
* @return List of all Blog objects
*/
public List<ReadingTip> listAll() {
try (Connection c = db.getConnection()) {
List<ReadingTip> blogs = new ArrayList<>();
ResultSet rs = c.prepareStatement("SELECT * FROM Blog").executeQuery();
while (rs.next()) {
blogs.add(rowToBlog(rs));
}
return blogs;
} catch (SQLException ex) {
Logger.getLogger(BlogDao.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
/**
* Adds a new Blog to database. Connects to database, adds a new Blog to the database. In case of database conflict does nothing.
* In case of SQL exception returns null.
* @param blog
*/
public void add(Blog blog) {
try (Connection c = db.getConnection()) {
PreparedStatement add = c.prepareStatement("INSERT INTO Blog (blog_author, blog_title, blog_link, blog_description, blog_year, blog_checked, blog_date_checked) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?)");
add.setString(1, blog.getAuthor());
add.setString(2, blog.getTitle());
add.setString(3, blog.getLink());
add.setString(4, blog.getDescription());
add.setInt(5, blog.getYear());
add.setBoolean(6, false);
add.setDate(7, null);
add.executeUpdate();
} catch (SQLException ex) {
Logger.getLogger(BlogDao.class.getName()).log(Level.SEVERE, null, ex);
}
}
/**
* Marks the Blog as read and sets the date it was read on.
* @param title Title of object that is marked read
* @return boolean
*/
public boolean markAsRead(String title) {
try (Connection c = db.getConnection()) {
PreparedStatement stmt = c.prepareStatement(
"UPDATE Blog SET blog_checked = ?, blog_date_checked = ? WHERE blog_title = ? ");
stmt.setBoolean(1, true);
stmt.setDate(2, new java.sql.Date(System.currentTimeMillis()));
stmt.setString(3, title);
stmt.executeUpdate();
return true;
} catch (SQLException ex) {
Logger.getLogger(BlogDao.class.getName()).log(Level.SEVERE, null, ex);
return false;
}
}
/**
* Creates a new Blog object from database row
* @param rs
* @return Blog object
* @throws SQLException
*/
public static Blog rowToBlog(ResultSet rs) throws SQLException {
return new Blog(rs.getInt("blog_id"), rs.getString("blog_author"), rs.getString("blog_title"), rs.getString("blog_link"), rs.getString("blog_description"), rs.getInt("blog_year"), rs.getBoolean("blog_checked"), rs.getDate("blog_date_checked"));
}
}
| UTF-8 | Java | 3,810 | java | BlogDao.java | Java | [
{
"context": "rface for Blog database access object. \n * @author madjanne\n */\npublic class BlogDao {\n private final Data",
"end": 606,
"score": 0.9992525577545166,
"start": 598,
"tag": "USERNAME",
"value": "madjanne"
}
] | 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 ReadMe.dao;
import ReadMe.database.Database;
import ReadMe.domain.Blog;
import ReadMe.domain.ReadingTip;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Interface for Blog database access object.
* @author madjanne
*/
public class BlogDao {
private final Database db;
/**
* Creates new Blog DAO for database
* @param db
*/
public BlogDao(Database db) {
this.db = db;
}
/**
* Lists all Blog objects. Connects to database, retrieves all lines from the Blog table, and returns a list of Blog objects.
* Returns null in case of SQL exception.
* @return List of all Blog objects
*/
public List<ReadingTip> listAll() {
try (Connection c = db.getConnection()) {
List<ReadingTip> blogs = new ArrayList<>();
ResultSet rs = c.prepareStatement("SELECT * FROM Blog").executeQuery();
while (rs.next()) {
blogs.add(rowToBlog(rs));
}
return blogs;
} catch (SQLException ex) {
Logger.getLogger(BlogDao.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
/**
* Adds a new Blog to database. Connects to database, adds a new Blog to the database. In case of database conflict does nothing.
* In case of SQL exception returns null.
* @param blog
*/
public void add(Blog blog) {
try (Connection c = db.getConnection()) {
PreparedStatement add = c.prepareStatement("INSERT INTO Blog (blog_author, blog_title, blog_link, blog_description, blog_year, blog_checked, blog_date_checked) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?)");
add.setString(1, blog.getAuthor());
add.setString(2, blog.getTitle());
add.setString(3, blog.getLink());
add.setString(4, blog.getDescription());
add.setInt(5, blog.getYear());
add.setBoolean(6, false);
add.setDate(7, null);
add.executeUpdate();
} catch (SQLException ex) {
Logger.getLogger(BlogDao.class.getName()).log(Level.SEVERE, null, ex);
}
}
/**
* Marks the Blog as read and sets the date it was read on.
* @param title Title of object that is marked read
* @return boolean
*/
public boolean markAsRead(String title) {
try (Connection c = db.getConnection()) {
PreparedStatement stmt = c.prepareStatement(
"UPDATE Blog SET blog_checked = ?, blog_date_checked = ? WHERE blog_title = ? ");
stmt.setBoolean(1, true);
stmt.setDate(2, new java.sql.Date(System.currentTimeMillis()));
stmt.setString(3, title);
stmt.executeUpdate();
return true;
} catch (SQLException ex) {
Logger.getLogger(BlogDao.class.getName()).log(Level.SEVERE, null, ex);
return false;
}
}
/**
* Creates a new Blog object from database row
* @param rs
* @return Blog object
* @throws SQLException
*/
public static Blog rowToBlog(ResultSet rs) throws SQLException {
return new Blog(rs.getInt("blog_id"), rs.getString("blog_author"), rs.getString("blog_title"), rs.getString("blog_link"), rs.getString("blog_description"), rs.getInt("blog_year"), rs.getBoolean("blog_checked"), rs.getDate("blog_date_checked"));
}
}
| 3,810 | 0.611024 | 0.608399 | 108 | 34.277779 | 36.327938 | 252 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false | 2 |
499bc603dc1afb17bb7640501ba54a36e459353b | 20,684,562,525,242 | f2231d08060ed7ccf328ecd40db8d96b97a12cda | /ug/src/main/java/com/controller/UserController.java | f23a47776ec72950f601b5e8f4a9be591c7098d7 | [] | no_license | DengDongXia/UG | https://github.com/DengDongXia/UG | 52ba921f39457b152aaf339354aaee7636b7445e | 6a2fc12444250ba86bd4c24647c7e16532c2efdc | refs/heads/master | 2021-08-14T11:46:36.119000 | 2017-11-15T15:32:10 | 2017-11-15T15:32:10 | 111,106,556 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.controller;
import java.util.HashMap;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.entity.user;
import com.service.UserService;
@Controller
@RequestMapping("/user")
public class UserController {
@Resource
private UserService userService;
@RequestMapping("/showUser")
public String toIndex(HttpServletRequest request,Model model)
{
int userId = Integer.parseInt(request.getParameter("userId"));
user user = this.userService.getUserById(userId);
model.addAttribute("user", user);
System.out.println(user.getUsername());
return "showUser";
}
@RequestMapping("/addUser")
public String addUser(HttpServletRequest request,Model model){
user user = new user();
user.setUsername(String.valueOf(request.getParameter("name")));
user.setPassword(String.valueOf(request.getParameter("password")));
userService.addUser(user);
return "query";
}
@RequestMapping("/regist")
public String regist(HttpServletRequest request,Model model){
return "regist";
}
@RequestMapping("c")
@ResponseBody
public HashMap d()
{
HashMap s = new HashMap();
s.put("aaa", "ÄãºÃ°¡");
return s;
}
}
| WINDOWS-1252 | Java | 1,438 | java | UserController.java | Java | [] | null | [] | package com.controller;
import java.util.HashMap;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.entity.user;
import com.service.UserService;
@Controller
@RequestMapping("/user")
public class UserController {
@Resource
private UserService userService;
@RequestMapping("/showUser")
public String toIndex(HttpServletRequest request,Model model)
{
int userId = Integer.parseInt(request.getParameter("userId"));
user user = this.userService.getUserById(userId);
model.addAttribute("user", user);
System.out.println(user.getUsername());
return "showUser";
}
@RequestMapping("/addUser")
public String addUser(HttpServletRequest request,Model model){
user user = new user();
user.setUsername(String.valueOf(request.getParameter("name")));
user.setPassword(String.valueOf(request.getParameter("password")));
userService.addUser(user);
return "query";
}
@RequestMapping("/regist")
public String regist(HttpServletRequest request,Model model){
return "regist";
}
@RequestMapping("c")
@ResponseBody
public HashMap d()
{
HashMap s = new HashMap();
s.put("aaa", "ÄãºÃ°¡");
return s;
}
}
| 1,438 | 0.736732 | 0.736732 | 52 | 26.538462 | 22.256773 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.634615 | false | false | 2 |
3cc01b1e60e6431ca5e94b0b6fe63de39fb42d9c | 5,214,090,353,346 | 6a8913e8fb5c4f552cee033f0cef687f0b10c422 | /src/main/java/rocks/cleanstone/endpoint/minecraft/vanilla/net/listener/inbound/place/BlockPlaceFacingProvider.java | 790556f5cdc42042dab90ed4dde6932de12535b2 | [
"MIT",
"CC-BY-4.0"
] | permissive | CleanstoneMC/Cleanstone | https://github.com/CleanstoneMC/Cleanstone | 5e5c60b01bb6d5f51ef61f32ad5a5c353ba1d55c | 1b35516004d00fa3267063b840a31211b04f9156 | refs/heads/master | 2021-04-12T09:37:56.768000 | 2021-03-25T12:39:19 | 2021-03-25T12:39:19 | 126,891,902 | 160 | 18 | MIT | false | 2021-03-11T22:52:29 | 2018-03-26T21:26:03 | 2021-02-28T17:50:34 | 2021-03-11T22:52:29 | 4,526 | 132 | 10 | 9 | Java | false | false | package rocks.cleanstone.endpoint.minecraft.vanilla.net.listener.inbound.place;
import org.springframework.stereotype.Component;
import rocks.cleanstone.endpoint.minecraft.vanilla.block.VanillaBlockProperties;
import rocks.cleanstone.endpoint.minecraft.vanilla.block.VanillaBlockType;
import rocks.cleanstone.endpoint.minecraft.vanilla.net.packet.inbound.PlayerBlockPlacementPacket;
import rocks.cleanstone.game.block.state.property.Property;
import rocks.cleanstone.game.block.state.property.vanilla.Facing;
import rocks.cleanstone.game.material.block.BlockType;
import rocks.cleanstone.player.Player;
import java.util.Arrays;
import java.util.List;
@Component
public class BlockPlaceFacingProvider implements BlockPlacePropertyProvider<Facing> {
private final List<BlockType> detectByBlockFace = Arrays.asList(
VanillaBlockType.WALL_TORCH,
VanillaBlockType.REDSTONE_WALL_TORCH
);
@Override
public Property<Facing> getSupported() {
return VanillaBlockProperties.FACING;
}
@Override
public Facing computeProperty(BlockType blockType, Player player, PlayerBlockPlacementPacket packet) {
if (detectByBlockFace.contains(blockType)) {
// todo: get correct state when placing below block
// todo: deny if not possible to place block
return getBlockSiteFacing(packet);
} else {
float yaw = player.getEntity().getPosition().getHeadRotation().getYaw();
return getPlayerDirectionFacing(yaw);
}
}
private Facing getPlayerDirectionFacing(float yaw) {
if (yaw < 45 || yaw >= 315) {
return Facing.NORTH;
} else if (yaw >= 45 && yaw < 135) {
return Facing.EAST;
} else if (yaw >= 135 && yaw < 225) {
return Facing.SOUTH;
} else if (yaw >= 225 && yaw < 315) {
return Facing.WEST;
} else {
throw new IllegalStateException("a circle only has 360 degrees");
}
}
private Facing getBlockSiteFacing(PlayerBlockPlacementPacket packet) {
switch (packet.getFace()) {
case SOUTH:
return Facing.NORTH;
case EAST:
return Facing.WEST;
case NORTH:
return Facing.SOUTH;
case WEST:
return Facing.EAST;
default:
throw new IllegalStateException("cant compute facing for " + packet.getFace());
}
}
}
| UTF-8 | Java | 2,501 | java | BlockPlaceFacingProvider.java | Java | [] | null | [] | package rocks.cleanstone.endpoint.minecraft.vanilla.net.listener.inbound.place;
import org.springframework.stereotype.Component;
import rocks.cleanstone.endpoint.minecraft.vanilla.block.VanillaBlockProperties;
import rocks.cleanstone.endpoint.minecraft.vanilla.block.VanillaBlockType;
import rocks.cleanstone.endpoint.minecraft.vanilla.net.packet.inbound.PlayerBlockPlacementPacket;
import rocks.cleanstone.game.block.state.property.Property;
import rocks.cleanstone.game.block.state.property.vanilla.Facing;
import rocks.cleanstone.game.material.block.BlockType;
import rocks.cleanstone.player.Player;
import java.util.Arrays;
import java.util.List;
@Component
public class BlockPlaceFacingProvider implements BlockPlacePropertyProvider<Facing> {
private final List<BlockType> detectByBlockFace = Arrays.asList(
VanillaBlockType.WALL_TORCH,
VanillaBlockType.REDSTONE_WALL_TORCH
);
@Override
public Property<Facing> getSupported() {
return VanillaBlockProperties.FACING;
}
@Override
public Facing computeProperty(BlockType blockType, Player player, PlayerBlockPlacementPacket packet) {
if (detectByBlockFace.contains(blockType)) {
// todo: get correct state when placing below block
// todo: deny if not possible to place block
return getBlockSiteFacing(packet);
} else {
float yaw = player.getEntity().getPosition().getHeadRotation().getYaw();
return getPlayerDirectionFacing(yaw);
}
}
private Facing getPlayerDirectionFacing(float yaw) {
if (yaw < 45 || yaw >= 315) {
return Facing.NORTH;
} else if (yaw >= 45 && yaw < 135) {
return Facing.EAST;
} else if (yaw >= 135 && yaw < 225) {
return Facing.SOUTH;
} else if (yaw >= 225 && yaw < 315) {
return Facing.WEST;
} else {
throw new IllegalStateException("a circle only has 360 degrees");
}
}
private Facing getBlockSiteFacing(PlayerBlockPlacementPacket packet) {
switch (packet.getFace()) {
case SOUTH:
return Facing.NORTH;
case EAST:
return Facing.WEST;
case NORTH:
return Facing.SOUTH;
case WEST:
return Facing.EAST;
default:
throw new IllegalStateException("cant compute facing for " + packet.getFace());
}
}
}
| 2,501 | 0.658537 | 0.648541 | 67 | 36.328358 | 27.799597 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.462687 | false | false | 2 |
18b0c45ecc40776ac69dcad3428df02840cddf61 | 16,862,041,644,313 | 77bacab54e77422c815dbc59dd08e77a5ca09293 | /aoj/introduction/IntroductIonToProgramming/1_9_D_Transformation/Main.java | 2872b2fd6d585a609b0e338085a7a3ab73b07016 | [
"MIT"
] | permissive | KoKumagai/exercises | https://github.com/KoKumagai/exercises | 7819f0199efa99a2321cd8b83cdad76958a49911 | 256b226d3e094f9f67352d75619b392a168eb4d1 | refs/heads/master | 2020-05-21T20:46:57.599000 | 2018-01-15T10:46:56 | 2018-01-15T10:46:56 | 60,871,560 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
char[] str = sc.next().toCharArray();
int q = sc.nextInt();
for (int i = 0; i < q; i++) {
String command = sc.next();
int a = sc.nextInt();
int b = sc.nextInt();
switch (command) {
case "print" :
for (int j = a; j <= b; j++) {
System.out.print(str[j]);
}
System.out.println();
break;
case "reverse" :
for (int j = 0; j < (b - a + 1) / 2; j++) {
char tmp = str[a + j];
str[a + j] = str[b - j];
str[b - j] = tmp;
}
break;
case "replace" :
char[] p = sc.next().toCharArray();
for (int j = a; j <= b; j++) {
str[j] = p[j - a];
}
break;
}
}
}
}
| UTF-8 | Java | 1,179 | java | Main.java | Java | [] | null | [] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
char[] str = sc.next().toCharArray();
int q = sc.nextInt();
for (int i = 0; i < q; i++) {
String command = sc.next();
int a = sc.nextInt();
int b = sc.nextInt();
switch (command) {
case "print" :
for (int j = a; j <= b; j++) {
System.out.print(str[j]);
}
System.out.println();
break;
case "reverse" :
for (int j = 0; j < (b - a + 1) / 2; j++) {
char tmp = str[a + j];
str[a + j] = str[b - j];
str[b - j] = tmp;
}
break;
case "replace" :
char[] p = sc.next().toCharArray();
for (int j = a; j <= b; j++) {
str[j] = p[j - a];
}
break;
}
}
}
}
| 1,179 | 0.317218 | 0.313825 | 53 | 21.245283 | 19.564028 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.471698 | false | false | 2 |
76c0b61f57af61b8cec1dbe4bea972eff2a26340 | 19,894,288,515,174 | da0c7138f80906e0af4be9da71b6a010f8007b84 | /family_order/src/soa/com/asiainfo/veris/crm/order/soa/frame/csservice/common/query/other/BbossXmlMainInfoQrySVC.java | 46d13e14b2de8880fd917a71d96d2cfcc913acc3 | [] | no_license | bellmit/origin | https://github.com/bellmit/origin | 9d0e392cefc0f0c975ee042f2a7a93e3415ba7e6 | 9309074f033a53ba58144085cd044a660911ddb5 | refs/heads/master | 2022-12-02T16:08:42.301000 | 2020-08-21T05:34:24 | 2020-08-21T05:34:24 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.asiainfo.veris.crm.order.soa.frame.csservice.common.query.other;
import com.ailk.common.data.IData;
import com.ailk.common.data.IDataset;
import com.asiainfo.veris.crm.order.soa.frame.bcf.base.CSBizService;
public class BbossXmlMainInfoQrySVC extends CSBizService{
private static final long serialVersionUID = 1L;
/**
* @description 获取延时工单数据
* @author xunyl
* @date 2015-02-05
*/
public static IDataset qryXmlMainInfoListByDealState(IData map)throws Exception{
String dealState = map.getString("DEAL_STATE");
String chanelCode = map.getString("CHANEL_CODE");
String threadCount = map.getString("THREAD_COUNT");
return BbossXmlMainInfoQry.qryXmlMainInfoListByDealState(dealState,chanelCode,threadCount);
}
/**
* @description 获取延时工单报文数据
* @author xunyl
* @date 2015-02-27
*/
public static IDataset qryXmlContentInfoBySeqId(IData map)throws Exception{
String seqId = map.getString("SEQ_ID");
return BbossXmlMainInfoQry.qryXmlContentInfoBySeqId(seqId);
}
}
| UTF-8 | Java | 1,066 | java | BbossXmlMainInfoQrySVC.java | Java | [
{
"context": "= 1L;\n\t\n\t/**\n\t * @description 获取延时工单数据\n\t * @author xunyl\n\t * @date 2015-02-05\n\t */\n\tpublic static IDataset",
"end": 380,
"score": 0.9996439814567566,
"start": 375,
"tag": "USERNAME",
"value": "xunyl"
},
{
"context": "\n\t}\n\t\n\t/**\n\t * @description 获取延时工单报文数据\n\t * @author xunyl\n\t * @date 2015-02-27\n\t */\n\tpublic static IDataset",
"end": 815,
"score": 0.9996455311775208,
"start": 810,
"tag": "USERNAME",
"value": "xunyl"
}
] | null | [] | package com.asiainfo.veris.crm.order.soa.frame.csservice.common.query.other;
import com.ailk.common.data.IData;
import com.ailk.common.data.IDataset;
import com.asiainfo.veris.crm.order.soa.frame.bcf.base.CSBizService;
public class BbossXmlMainInfoQrySVC extends CSBizService{
private static final long serialVersionUID = 1L;
/**
* @description 获取延时工单数据
* @author xunyl
* @date 2015-02-05
*/
public static IDataset qryXmlMainInfoListByDealState(IData map)throws Exception{
String dealState = map.getString("DEAL_STATE");
String chanelCode = map.getString("CHANEL_CODE");
String threadCount = map.getString("THREAD_COUNT");
return BbossXmlMainInfoQry.qryXmlMainInfoListByDealState(dealState,chanelCode,threadCount);
}
/**
* @description 获取延时工单报文数据
* @author xunyl
* @date 2015-02-27
*/
public static IDataset qryXmlContentInfoBySeqId(IData map)throws Exception{
String seqId = map.getString("SEQ_ID");
return BbossXmlMainInfoQry.qryXmlContentInfoBySeqId(seqId);
}
}
| 1,066 | 0.754369 | 0.737864 | 33 | 30.212122 | 29.251011 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.090909 | false | false | 2 |
32f6528468f23936b9ca39bd4e0ce73f697e0ab6 | 17,317,308,196,173 | 811dbf13342357c53a73b11c2fca09d4abe21c10 | /DLBTest.java | 5fdbd7944073253b212e4eecbb8029fc4277eee6 | [] | no_license | Vahti/CS1699 | https://github.com/Vahti/CS1699 | d2bf49567be6ae584ebced1773b1aac411db9d03 | 187d5ce30617109b346a30614e5142429c0a2d5e | refs/heads/master | 2021-01-18T06:28:32.029000 | 2014-10-02T20:18:10 | 2014-10-02T20:18:10 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.*;
import java.util.concurrent.TimeUnit;
import static org.junit.Assert.*;
import static org.mockito.Matchers.anyChar;
import static org.mockito.Mockito.when;
import org.mockito.*;
public class DLBTest {
//DLB output values for easier referencing
private final int IS_WORD_ONLY = 2;
private final int IS_PREFIX_AND_WORD = 3;
private final int IS_PREFIX_ONLY = 1;
private final int NOT_WORD_OR_PREFIX = 0;
private final int WORD_COUNT = 10;
private final int WORD_SIZE = 10;
private final int BULK_WORD_COUNT = 1000;
private final String[] testWords = {
"test",
"word",
"blah",
"stuff",
"things"
};
private final char[] alphabet = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'};
public static long getDateDiff(Date date1, Date date2, TimeUnit timeUnit) {
long diffInMillies = date2.getTime() - date1.getTime();
return timeUnit.convert(diffInMillies,TimeUnit.MILLISECONDS);
}
@Test
//DLB.searchPrefix(StringBuilder s) should return int 1 if a searched word is a prefix
public void testPrefix() throws Exception {
DLB dict = new DLB();
dict.add("hello");
assertEquals(dict.searchPrefix(new StringBuilder("hell")), 1);
}
//DLB.searchPrefix(StringBuilder s) should return int 3 if a word is both a prefix and a word
@Test
public void testPrefixandWord() throws Exception {
DLB dict = new DLB();
dict.add("hello");
dict.add("hell");
assertEquals(dict.searchPrefix(new StringBuilder("hell")),3);
}
@Test
public void testBasicDLBInsertion() {
DLB theDLB = new DLB();
assertEquals(theDLB.isEmpty, true);
theDLB.add("Test 1");
assertEquals(theDLB.contains("Test 1"), true);
}
/*
* Tests the growth of the DLB as words are inserted
* */
@Test
public void testDLBGrowth() {
DLB theDLB = new DLB();
int trieSize = 0;
assertEquals(theDLB.size(), trieSize);
for (String word : testWords) {
theDLB.add(word);
System.out.println("DLB.size " + theDLB.size() + "trieSize " + trieSize);
trieSize++;
assertEquals(theDLB.size(), trieSize);
}
}
/*
* Inserts a series of unique, randomly generated Strings into the DLB; then asserts their presence
* */
@Test
public void testRandomizedWordInsertion() {
DLB theDLB = new DLB();
Random rnd = new Random();
rnd.setSeed(0);
ArrayList<String> randomStrings = new ArrayList<String>(this.WORD_COUNT);
for (int i = 0; i < this.WORD_COUNT; i++) {
char[] chars = new char[this.WORD_SIZE];
for (int j = 0; j < this.WORD_SIZE; j++) {
int randomLetterIndex = rnd.nextInt(this.alphabet.length);
chars[j] = this.alphabet[randomLetterIndex];
}
String newString = (randomStrings.contains(new String(chars))) ? null : new String(chars);
if (newString == null) {
String altString = randomStrings.get(0);
char[] altChars = new char[this.WORD_COUNT];
while (randomStrings.contains(altString)) {
for (int j = 0; j < this.WORD_SIZE; j++) {
int altRandom = this.alphabet[rnd.nextInt(this.alphabet.length)];
altChars[j] = this.alphabet[altRandom];
}
altString = new String(altChars);
}
newString = altString;
}
randomStrings.add(newString);
}
for (String randomString : randomStrings) {
theDLB.add(randomString);
assertEquals(theDLB.searchPrefix(randomString), IS_WORD_ONLY);
}
}
/*
* Inserts a series of unique, randomly generated Strings into the DLB, then verifies the DLB contains the correct # of words
* */
@Test
public void testRandomizedWordInsertionCount() {
DLB theDLB = new DLB();
Random rnd = new Random();
rnd.setSeed(0);
String[] randomStrings = new String[this.WORD_COUNT];
for (int i = 0; i < this.WORD_COUNT; i++) {
char[] chars = new char[this.WORD_SIZE];
for (int j = 0; j < this.WORD_SIZE; j++) {
int randomLetterIndex = rnd.nextInt(this.alphabet.length);
chars[j] = this.alphabet[randomLetterIndex];
}
randomStrings[i] = new String(chars);
}
for (String randomString : randomStrings) {
System.out.println(randomString);
theDLB.add(randomString);
}
assertEquals(theDLB.size(), this.WORD_COUNT);
}
/*
* Inserts words from the global test list, verifies their presence in the DLB
* */
@Test
public void testSearchPrefixPredefinedWords() {
DLB theDLB = new DLB();
for (String word : testWords) {
theDLB.add(word);
}
for (String word : testWords) {
assertEquals(theDLB.searchPrefix(word), IS_WORD_ONLY);
}
}
/*
* Inserts PREFIXES of words from the global test list, verifies their presence in the DLB
* */
@Test
public void testSearchPrefixWithBounds() {
DLB theDLB = new DLB();
ArrayDeque<String> prefixList = new ArrayDeque<String>();
for (String word : testWords) {
theDLB.add(word);
System.out.println("Pushing " + word.substring(2));
prefixList.push(word.substring(0, 2));
}
for (String prefix : prefixList) {
System.out.println("testing prefix..." + prefix);
assertEquals(theDLB.searchPrefix(prefix), IS_PREFIX_ONLY);
}
}
/*
* Tests performance of search functionality with LOTS of words in DLB and Dictionary...DLB should always win
* */
@Test
public void testDictionaryPerformance() {
DLB theDLB= new DLB();
MyDictionary theDictionary = new MyDictionary();
Random rnd = new Random();
rnd.setSeed(0);
String[] randomStrings = new String[BULK_WORD_COUNT];
for (int i = 0; i < BULK_WORD_COUNT; i++) {
char[] chars = new char[this.WORD_SIZE];
for (int j = 0; j < this.WORD_SIZE; j++) {
int randomLetterIndex = rnd.nextInt(this.alphabet.length);
chars[j] = this.alphabet[randomLetterIndex];
}
randomStrings[i] = new String(chars);
}
for (String randomString : randomStrings) {
theDLB.add(randomString);
theDictionary.add(randomString);
}
//picks at random 100 words from randomStrings[] to search for...
int[] randomIndices = new int[100];
for (int i = 0; i < 100; i++) {
int r = rnd.nextInt(BULK_WORD_COUNT);
randomIndices[i] = r;
}
int[] dictionaryResults = new int[100];
int[] dlbResults = new int[100];
int i = 0;
//test DICTIONARY speed:
Date dictionaryStartDate = new Date();
for (int index : randomIndices) {
dictionaryResults[i] = theDictionary.searchPrefix(new StringBuilder(randomStrings[index]));
i++;
}
Date dictionaryEndDate = new Date();
long dictionaryInterval = getDateDiff(dictionaryStartDate, dictionaryEndDate, TimeUnit.MILLISECONDS);
//test DLB speed
Date dlbStartDate = new Date();
i = 0;
for (int index : randomIndices) {
dlbResults[i] = theDLB.searchPrefix(new StringBuilder(randomStrings[index]));
i++;
}
Date dlbEndDate = new Date();
long dlbInterval = getDateDiff(dlbStartDate, dlbEndDate, TimeUnit.MILLISECONDS);
System.out.println("dictionary interval: " + dictionaryInterval);
System.out.println("dlb interval: " + dlbInterval);
assertTrue(dictionaryInterval > dlbInterval);
//assertEquals(theDLB.size(), this.WORD_COUNT);
}
/*
* Tests the addition and presence of a single string composed of numerous other strings...
* */
@Test
public void testConcatenatedWords() {
String cat = this.testWords[0];
for (int i = 1; i < this.testWords.length; i++) {
cat+=new String(" "+this.testWords[i]);
}
DLB theDLB = new DLB();
theDLB.add(cat);
assertEquals(theDLB.contains(cat), true);
}
@Test
//add a word and try to remove it
//check that neither searchPrefix or contains report it as there
public void testWordRemoval() {
DLB dict = new DLB();
dict.add("hello");
assertEquals(dict.searchPrefix(new StringBuilder("hello")),2);
assertTrue(dict.contains("hello"));
assertTrue(dict.remove("hello"));
assertFalse(dict.contains("hello"));
assertEquals(dict.searchPrefix(new StringBuilder("hello")),0);
}
@Test
//try to remove a word that has not been added
//ensure that added word(s) still remain, remove works
public void testFalseRemoval(){
DLB dict = new DLB();
assertTrue(dict.add("hello"));
assertTrue(dict.add("howdy"));
assertFalse(dict.remove("hey"));
assertTrue(dict.remove("howdy"));
assertTrue(dict.contains("hello"));
assertFalse(dict.contains("howdy"));
assertFalse(dict.contains("hey"));
}
@Test
//add a prefix and a word that stems from it
//remove prefix
//verify that the word is still contained (by both contained and searchPrefix)
public void testPrefixRemoval() {
DLB dict = new DLB();
dict.add("pre");
dict.add("prefix");
dict.remove("pre");
assertEquals(dict.searchPrefix(new StringBuilder("prefix")), 2);
assertTrue(dict.contains("prefix"));
}
//performance test
//attempt to load every word in war and peace into dictionary
//then check that every word is contained in the dictionary
//uses bufferedreader and stringtokenizer
//WARNING: expect long runtime
@Test
public void warandPeaceTest() throws Exception{
DLB dict = new DLB();
File warPeace = new File("warandpeace.txt");
StringTokenizer tk;
String str;
String nxt;
boolean allContained = true;
if(warPeace.isFile()){
BufferedReader wpReader = new BufferedReader(new FileReader(warPeace));
while((str = wpReader.readLine())!=null){
tk = new StringTokenizer(str , ",.!?*-' ");
while(tk.hasMoreTokens()){
nxt = tk.nextToken();
if (nxt != null){
dict.add(nxt);
}
}
}
wpReader.close();
wpReader = new BufferedReader(new FileReader(warPeace));
while((str = wpReader.readLine())!=null){
tk = new StringTokenizer(str , ",.!?*-' ");
while(tk.hasMoreTokens()){
nxt = tk.nextToken();
if (nxt != null){
if(dict.searchPrefix(new StringBuilder(nxt)) == 0){
allContained = false;
}
}
}
}
}
assertTrue(allContained);
}
@Test
//try to add a null string to the dictionary
public void testNullAdd() {
DLB dict = new DLB();
assertNotNull(dict.add(null));
}
@Test
//try to search for a null StringBuilder
public void testNullSearch(){
DLB dict = new DLB();
dict.add("hello");
assertNotNull(dict.searchPrefix(new StringBuilder(null)));
}
@Test
//call DLB.contains(null)
public void testNullContains(){
DLB dict = new DLB();
dict.add("hello");
assertNotNull(dict.contains(null));
}
@Test
//no instantiated DLB should equal null
public void testNotEqualsNull(){
DLB dict = new DLB();
assertFalse(dict.equals(null));
}
@Test
//try findSentinel on with a mock of a linked list
public void testFindSentinel() {
LinkedList listMock = Mockito.mock(LinkedList.class);
DLB dict = new DLB();
assertTrue(dict.findSentinel(listMock));
}
@Test
//try to add a string of length 1,000 to the dictionary
//see if it contains the string by both .contains and .searchPrefix
public void test1000String(){
DLB dict = new DLB();
int length = 1000;
StringBuilder target = new StringBuilder();
for (int i = 0; i <= length ; i++) {
target.append("a");
}
assertTrue(dict.add(target.toString()));
assertEquals(dict.searchPrefix(target),2);
assertTrue(dict.contains(target.toString()));
}
@Test(timeout=100000)
//try to add a string of length 1,000,000 to the dictionary
//see if it contains the string by both .contains and .searchPrefix
public void testSixFigString(){
DLB dict = new DLB();
int length = 1000000;
StringBuilder target = new StringBuilder();
for (int i = 0; i <= length ; i++) {
target.append("a");
}
assertTrue(dict.add(target.toString()));
assertEquals(dict.searchPrefix(target),2);
assertTrue(dict.contains(target.toString()));
}
} | UTF-8 | Java | 14,001 | java | DLBTest.java | Java | [] | null | [] | import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.*;
import java.util.concurrent.TimeUnit;
import static org.junit.Assert.*;
import static org.mockito.Matchers.anyChar;
import static org.mockito.Mockito.when;
import org.mockito.*;
public class DLBTest {
//DLB output values for easier referencing
private final int IS_WORD_ONLY = 2;
private final int IS_PREFIX_AND_WORD = 3;
private final int IS_PREFIX_ONLY = 1;
private final int NOT_WORD_OR_PREFIX = 0;
private final int WORD_COUNT = 10;
private final int WORD_SIZE = 10;
private final int BULK_WORD_COUNT = 1000;
private final String[] testWords = {
"test",
"word",
"blah",
"stuff",
"things"
};
private final char[] alphabet = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'};
public static long getDateDiff(Date date1, Date date2, TimeUnit timeUnit) {
long diffInMillies = date2.getTime() - date1.getTime();
return timeUnit.convert(diffInMillies,TimeUnit.MILLISECONDS);
}
@Test
//DLB.searchPrefix(StringBuilder s) should return int 1 if a searched word is a prefix
public void testPrefix() throws Exception {
DLB dict = new DLB();
dict.add("hello");
assertEquals(dict.searchPrefix(new StringBuilder("hell")), 1);
}
//DLB.searchPrefix(StringBuilder s) should return int 3 if a word is both a prefix and a word
@Test
public void testPrefixandWord() throws Exception {
DLB dict = new DLB();
dict.add("hello");
dict.add("hell");
assertEquals(dict.searchPrefix(new StringBuilder("hell")),3);
}
@Test
public void testBasicDLBInsertion() {
DLB theDLB = new DLB();
assertEquals(theDLB.isEmpty, true);
theDLB.add("Test 1");
assertEquals(theDLB.contains("Test 1"), true);
}
/*
* Tests the growth of the DLB as words are inserted
* */
@Test
public void testDLBGrowth() {
DLB theDLB = new DLB();
int trieSize = 0;
assertEquals(theDLB.size(), trieSize);
for (String word : testWords) {
theDLB.add(word);
System.out.println("DLB.size " + theDLB.size() + "trieSize " + trieSize);
trieSize++;
assertEquals(theDLB.size(), trieSize);
}
}
/*
* Inserts a series of unique, randomly generated Strings into the DLB; then asserts their presence
* */
@Test
public void testRandomizedWordInsertion() {
DLB theDLB = new DLB();
Random rnd = new Random();
rnd.setSeed(0);
ArrayList<String> randomStrings = new ArrayList<String>(this.WORD_COUNT);
for (int i = 0; i < this.WORD_COUNT; i++) {
char[] chars = new char[this.WORD_SIZE];
for (int j = 0; j < this.WORD_SIZE; j++) {
int randomLetterIndex = rnd.nextInt(this.alphabet.length);
chars[j] = this.alphabet[randomLetterIndex];
}
String newString = (randomStrings.contains(new String(chars))) ? null : new String(chars);
if (newString == null) {
String altString = randomStrings.get(0);
char[] altChars = new char[this.WORD_COUNT];
while (randomStrings.contains(altString)) {
for (int j = 0; j < this.WORD_SIZE; j++) {
int altRandom = this.alphabet[rnd.nextInt(this.alphabet.length)];
altChars[j] = this.alphabet[altRandom];
}
altString = new String(altChars);
}
newString = altString;
}
randomStrings.add(newString);
}
for (String randomString : randomStrings) {
theDLB.add(randomString);
assertEquals(theDLB.searchPrefix(randomString), IS_WORD_ONLY);
}
}
/*
* Inserts a series of unique, randomly generated Strings into the DLB, then verifies the DLB contains the correct # of words
* */
@Test
public void testRandomizedWordInsertionCount() {
DLB theDLB = new DLB();
Random rnd = new Random();
rnd.setSeed(0);
String[] randomStrings = new String[this.WORD_COUNT];
for (int i = 0; i < this.WORD_COUNT; i++) {
char[] chars = new char[this.WORD_SIZE];
for (int j = 0; j < this.WORD_SIZE; j++) {
int randomLetterIndex = rnd.nextInt(this.alphabet.length);
chars[j] = this.alphabet[randomLetterIndex];
}
randomStrings[i] = new String(chars);
}
for (String randomString : randomStrings) {
System.out.println(randomString);
theDLB.add(randomString);
}
assertEquals(theDLB.size(), this.WORD_COUNT);
}
/*
* Inserts words from the global test list, verifies their presence in the DLB
* */
@Test
public void testSearchPrefixPredefinedWords() {
DLB theDLB = new DLB();
for (String word : testWords) {
theDLB.add(word);
}
for (String word : testWords) {
assertEquals(theDLB.searchPrefix(word), IS_WORD_ONLY);
}
}
/*
* Inserts PREFIXES of words from the global test list, verifies their presence in the DLB
* */
@Test
public void testSearchPrefixWithBounds() {
DLB theDLB = new DLB();
ArrayDeque<String> prefixList = new ArrayDeque<String>();
for (String word : testWords) {
theDLB.add(word);
System.out.println("Pushing " + word.substring(2));
prefixList.push(word.substring(0, 2));
}
for (String prefix : prefixList) {
System.out.println("testing prefix..." + prefix);
assertEquals(theDLB.searchPrefix(prefix), IS_PREFIX_ONLY);
}
}
/*
* Tests performance of search functionality with LOTS of words in DLB and Dictionary...DLB should always win
* */
@Test
public void testDictionaryPerformance() {
DLB theDLB= new DLB();
MyDictionary theDictionary = new MyDictionary();
Random rnd = new Random();
rnd.setSeed(0);
String[] randomStrings = new String[BULK_WORD_COUNT];
for (int i = 0; i < BULK_WORD_COUNT; i++) {
char[] chars = new char[this.WORD_SIZE];
for (int j = 0; j < this.WORD_SIZE; j++) {
int randomLetterIndex = rnd.nextInt(this.alphabet.length);
chars[j] = this.alphabet[randomLetterIndex];
}
randomStrings[i] = new String(chars);
}
for (String randomString : randomStrings) {
theDLB.add(randomString);
theDictionary.add(randomString);
}
//picks at random 100 words from randomStrings[] to search for...
int[] randomIndices = new int[100];
for (int i = 0; i < 100; i++) {
int r = rnd.nextInt(BULK_WORD_COUNT);
randomIndices[i] = r;
}
int[] dictionaryResults = new int[100];
int[] dlbResults = new int[100];
int i = 0;
//test DICTIONARY speed:
Date dictionaryStartDate = new Date();
for (int index : randomIndices) {
dictionaryResults[i] = theDictionary.searchPrefix(new StringBuilder(randomStrings[index]));
i++;
}
Date dictionaryEndDate = new Date();
long dictionaryInterval = getDateDiff(dictionaryStartDate, dictionaryEndDate, TimeUnit.MILLISECONDS);
//test DLB speed
Date dlbStartDate = new Date();
i = 0;
for (int index : randomIndices) {
dlbResults[i] = theDLB.searchPrefix(new StringBuilder(randomStrings[index]));
i++;
}
Date dlbEndDate = new Date();
long dlbInterval = getDateDiff(dlbStartDate, dlbEndDate, TimeUnit.MILLISECONDS);
System.out.println("dictionary interval: " + dictionaryInterval);
System.out.println("dlb interval: " + dlbInterval);
assertTrue(dictionaryInterval > dlbInterval);
//assertEquals(theDLB.size(), this.WORD_COUNT);
}
/*
* Tests the addition and presence of a single string composed of numerous other strings...
* */
@Test
public void testConcatenatedWords() {
String cat = this.testWords[0];
for (int i = 1; i < this.testWords.length; i++) {
cat+=new String(" "+this.testWords[i]);
}
DLB theDLB = new DLB();
theDLB.add(cat);
assertEquals(theDLB.contains(cat), true);
}
@Test
//add a word and try to remove it
//check that neither searchPrefix or contains report it as there
public void testWordRemoval() {
DLB dict = new DLB();
dict.add("hello");
assertEquals(dict.searchPrefix(new StringBuilder("hello")),2);
assertTrue(dict.contains("hello"));
assertTrue(dict.remove("hello"));
assertFalse(dict.contains("hello"));
assertEquals(dict.searchPrefix(new StringBuilder("hello")),0);
}
@Test
//try to remove a word that has not been added
//ensure that added word(s) still remain, remove works
public void testFalseRemoval(){
DLB dict = new DLB();
assertTrue(dict.add("hello"));
assertTrue(dict.add("howdy"));
assertFalse(dict.remove("hey"));
assertTrue(dict.remove("howdy"));
assertTrue(dict.contains("hello"));
assertFalse(dict.contains("howdy"));
assertFalse(dict.contains("hey"));
}
@Test
//add a prefix and a word that stems from it
//remove prefix
//verify that the word is still contained (by both contained and searchPrefix)
public void testPrefixRemoval() {
DLB dict = new DLB();
dict.add("pre");
dict.add("prefix");
dict.remove("pre");
assertEquals(dict.searchPrefix(new StringBuilder("prefix")), 2);
assertTrue(dict.contains("prefix"));
}
//performance test
//attempt to load every word in war and peace into dictionary
//then check that every word is contained in the dictionary
//uses bufferedreader and stringtokenizer
//WARNING: expect long runtime
@Test
public void warandPeaceTest() throws Exception{
DLB dict = new DLB();
File warPeace = new File("warandpeace.txt");
StringTokenizer tk;
String str;
String nxt;
boolean allContained = true;
if(warPeace.isFile()){
BufferedReader wpReader = new BufferedReader(new FileReader(warPeace));
while((str = wpReader.readLine())!=null){
tk = new StringTokenizer(str , ",.!?*-' ");
while(tk.hasMoreTokens()){
nxt = tk.nextToken();
if (nxt != null){
dict.add(nxt);
}
}
}
wpReader.close();
wpReader = new BufferedReader(new FileReader(warPeace));
while((str = wpReader.readLine())!=null){
tk = new StringTokenizer(str , ",.!?*-' ");
while(tk.hasMoreTokens()){
nxt = tk.nextToken();
if (nxt != null){
if(dict.searchPrefix(new StringBuilder(nxt)) == 0){
allContained = false;
}
}
}
}
}
assertTrue(allContained);
}
@Test
//try to add a null string to the dictionary
public void testNullAdd() {
DLB dict = new DLB();
assertNotNull(dict.add(null));
}
@Test
//try to search for a null StringBuilder
public void testNullSearch(){
DLB dict = new DLB();
dict.add("hello");
assertNotNull(dict.searchPrefix(new StringBuilder(null)));
}
@Test
//call DLB.contains(null)
public void testNullContains(){
DLB dict = new DLB();
dict.add("hello");
assertNotNull(dict.contains(null));
}
@Test
//no instantiated DLB should equal null
public void testNotEqualsNull(){
DLB dict = new DLB();
assertFalse(dict.equals(null));
}
@Test
//try findSentinel on with a mock of a linked list
public void testFindSentinel() {
LinkedList listMock = Mockito.mock(LinkedList.class);
DLB dict = new DLB();
assertTrue(dict.findSentinel(listMock));
}
@Test
//try to add a string of length 1,000 to the dictionary
//see if it contains the string by both .contains and .searchPrefix
public void test1000String(){
DLB dict = new DLB();
int length = 1000;
StringBuilder target = new StringBuilder();
for (int i = 0; i <= length ; i++) {
target.append("a");
}
assertTrue(dict.add(target.toString()));
assertEquals(dict.searchPrefix(target),2);
assertTrue(dict.contains(target.toString()));
}
@Test(timeout=100000)
//try to add a string of length 1,000,000 to the dictionary
//see if it contains the string by both .contains and .searchPrefix
public void testSixFigString(){
DLB dict = new DLB();
int length = 1000000;
StringBuilder target = new StringBuilder();
for (int i = 0; i <= length ; i++) {
target.append("a");
}
assertTrue(dict.add(target.toString()));
assertEquals(dict.searchPrefix(target),2);
assertTrue(dict.contains(target.toString()));
}
} | 14,001 | 0.571673 | 0.564745 | 413 | 32.903149 | 24.87081 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.617433 | false | false | 2 |
96e05956b522da0d8781de708fa14787c2d3c1a6 | 3,925,600,150,991 | e25b413f3217155e20034fee9fe423b54a4249bb | /src/main/java/com/sunil/munrotop/controller/ResultController.java | 40c9e3fb1fc0af62a1a8550869ec3b32a9947a67 | [] | no_license | sunildussoye/rework | https://github.com/sunildussoye/rework | 17f7ecf17cb04e4b203d0c2094d482b0ea5ae15b | 0083962a5dc901a69567a74666dde954ca7167c6 | refs/heads/master | 2023-07-14T14:50:31.254000 | 2021-09-05T10:27:11 | 2021-09-05T10:27:11 | 403,279,004 | 0 | 2 | null | false | 2021-09-06T12:35:28 | 2021-09-05T10:30:22 | 2021-09-05T10:32:17 | 2021-09-05T10:32:14 | 109 | 0 | 1 | 1 | Java | false | false | package com.sunil.munrotop.controller;
import com.sunil.munrotop.model.ResultDTO;
import com.sunil.munrotop.service.ResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
public class ResultController {
@Autowired
private ResultService service;
// Use wrapper instead of primitive - for null checks
@GetMapping(value = {"/list"})
public ResponseEntity<List<ResultDTO>> filterByCatSortedByHeightAndName(@RequestParam (value="category", defaultValue="All") String category,
@RequestParam (value="maxHeight",required = false) Integer maxHeight,
@RequestParam (value="minHeight",required = false) Integer minHeight,
@RequestParam (value="limit" ,required = false) Integer limit,
@RequestParam (value="sort" ,required = false) String[] sort ) {
List<ResultDTO> result= service.filterWithParams(category,maxHeight,minHeight,limit, sort);
if (result != null) {
return ResponseEntity.ok(result);
} else {
return ResponseEntity.badRequest().build();
}
}
}
| UTF-8 | Java | 1,576 | java | ResultController.java | Java | [] | null | [] | package com.sunil.munrotop.controller;
import com.sunil.munrotop.model.ResultDTO;
import com.sunil.munrotop.service.ResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
public class ResultController {
@Autowired
private ResultService service;
// Use wrapper instead of primitive - for null checks
@GetMapping(value = {"/list"})
public ResponseEntity<List<ResultDTO>> filterByCatSortedByHeightAndName(@RequestParam (value="category", defaultValue="All") String category,
@RequestParam (value="maxHeight",required = false) Integer maxHeight,
@RequestParam (value="minHeight",required = false) Integer minHeight,
@RequestParam (value="limit" ,required = false) Integer limit,
@RequestParam (value="sort" ,required = false) String[] sort ) {
List<ResultDTO> result= service.filterWithParams(category,maxHeight,minHeight,limit, sort);
if (result != null) {
return ResponseEntity.ok(result);
} else {
return ResponseEntity.badRequest().build();
}
}
}
| 1,576 | 0.633249 | 0.633249 | 38 | 40.473682 | 42.861305 | 145 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.684211 | false | false | 2 |
7349feddf0d503f4b354750fd215b6e4c4cf9d09 | 32,495,722,572,939 | e1e0d4afd52aaa7871b8d0bd3722153a1e01e85b | /Group11_IS1220_Project_part1_Chudeau_Huet/src/classes_part1/PreferPlusStations.java | 749fe6854b8f4ab7476796e076620e677359b99f | [] | no_license | AchilleHuet/Velib | https://github.com/AchilleHuet/Velib | a5cfc1bd2cbc4f9aa750463184aa2101cf00ff1d | 5795498c2923c937a6b50e773de1f57f8418f78e | refs/heads/master | 2021-09-11T14:22:24.477000 | 2018-04-08T21:27:08 | 2018-04-08T21:27:08 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package classes_part1;
public class PreferPlusStations implements Policy {
public PreferPlusStations() {
}
public void PlanRide(User user, Location destination, VelibPark park, BicycleType type) {
if (user.getCurrentRide() == null) {
user.setCurrentRide(new Ride(user, park, this, type, destination));
}
Ride ride = user.getCurrentRide();
Station start = park.stationsList.get(0);
double startDistance = start.location.Distance(user.location);
Station end = park.stationsList.get(0);
double endDistance = end.location.Distance(destination);
for (Station station : park.stationsList) {
if ((station.location.Distance(user.location) < startDistance) && (station.BicycleCount(type) > 0)) {
start = station;
startDistance = start.location.Distance(user.location);
}
if ((station.location.Distance(destination) < endDistance) && (station.FreeSlots() > 0)) {
end = station;
endDistance = end.location.Distance(destination);
}
}
if (end != start) {
double plusDistance = 1.1 * endDistance;
for (Station station : park.stationsList) {
if (station.location.Distance(destination) < plusDistance && station.type == StationType.plus && station.FreeSlots() > 0) {
plusDistance = station.location.Distance(destination);
end = station;
}
}
ride.suggestedDeparture = start;
ride.suggestedArrival = end;
}
System.out.println("The quickest path is by foot");
ride.suggestedDeparture = null;
ride.suggestedArrival = null;
}
} | UTF-8 | Java | 1,519 | java | PreferPlusStations.java | Java | [] | null | [] | package classes_part1;
public class PreferPlusStations implements Policy {
public PreferPlusStations() {
}
public void PlanRide(User user, Location destination, VelibPark park, BicycleType type) {
if (user.getCurrentRide() == null) {
user.setCurrentRide(new Ride(user, park, this, type, destination));
}
Ride ride = user.getCurrentRide();
Station start = park.stationsList.get(0);
double startDistance = start.location.Distance(user.location);
Station end = park.stationsList.get(0);
double endDistance = end.location.Distance(destination);
for (Station station : park.stationsList) {
if ((station.location.Distance(user.location) < startDistance) && (station.BicycleCount(type) > 0)) {
start = station;
startDistance = start.location.Distance(user.location);
}
if ((station.location.Distance(destination) < endDistance) && (station.FreeSlots() > 0)) {
end = station;
endDistance = end.location.Distance(destination);
}
}
if (end != start) {
double plusDistance = 1.1 * endDistance;
for (Station station : park.stationsList) {
if (station.location.Distance(destination) < plusDistance && station.type == StationType.plus && station.FreeSlots() > 0) {
plusDistance = station.location.Distance(destination);
end = station;
}
}
ride.suggestedDeparture = start;
ride.suggestedArrival = end;
}
System.out.println("The quickest path is by foot");
ride.suggestedDeparture = null;
ride.suggestedArrival = null;
}
} | 1,519 | 0.700461 | 0.695194 | 46 | 32.04348 | 30.765562 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.869565 | false | false | 2 |
975e28a3074d87db9ae4e106b3e9e64aaebab2f5 | 5,617,817,226,005 | f6776ddabc076057b693744500e1954ac0d1bc4d | /src/test/scala/cc/io/DirectIOTest.java | 443ed13df09e1d470331980519b3f7550718da49 | [] | no_license | jibaro/PACC | https://github.com/jibaro/PACC | a1be7b4cf296a2d81a123a121255be13bc1e8959 | 5ce2ad7e99205534ba6b91981b3bf12cc872d0f4 | refs/heads/master | 2022-04-10T14:56:30.486000 | 2020-02-22T15:52:02 | 2020-02-22T15:52:02 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cc.io;
import cc.hadoop.utils.LongIteratorFromDirectInput;
import org.junit.Test;
import java.util.NoSuchElementException;
public class DirectIOTest {
@Test
public void testAll() throws Exception {
String tmpPath = "tttttttt/aaa";
DirectWriter dw = new DirectWriter(tmpPath, 16);
for (long i = 0; i < 1000; i++) {
dw.write(i);
}
dw.close();
// DirectReader dr = new DirectReader(tmpPath, 8);
//
// while(dr.hasNext()){
// System.out.println(dr.readLong());
// }
//
// for(int i=0; i<10; i++){
// System.out.println(dr.readLong());
// }
LongIteratorFromDirectInput it = new LongIteratorFromDirectInput(tmpPath);
try {
for (int i = 0; i < 1004; i++) {
System.out.println(it.next());
}
} catch (NoSuchElementException e){
System.out.println("??");
// e.printStackTrace();
}
System.out.println(it.hasNext());
System.out.println(it.hasNext());
System.out.println(it.hasNext());
System.out.println(it.hasNext());
System.out.println(it.hasNext());
}
} | UTF-8 | Java | 1,222 | java | DirectIOTest.java | Java | [] | null | [] | package cc.io;
import cc.hadoop.utils.LongIteratorFromDirectInput;
import org.junit.Test;
import java.util.NoSuchElementException;
public class DirectIOTest {
@Test
public void testAll() throws Exception {
String tmpPath = "tttttttt/aaa";
DirectWriter dw = new DirectWriter(tmpPath, 16);
for (long i = 0; i < 1000; i++) {
dw.write(i);
}
dw.close();
// DirectReader dr = new DirectReader(tmpPath, 8);
//
// while(dr.hasNext()){
// System.out.println(dr.readLong());
// }
//
// for(int i=0; i<10; i++){
// System.out.println(dr.readLong());
// }
LongIteratorFromDirectInput it = new LongIteratorFromDirectInput(tmpPath);
try {
for (int i = 0; i < 1004; i++) {
System.out.println(it.next());
}
} catch (NoSuchElementException e){
System.out.println("??");
// e.printStackTrace();
}
System.out.println(it.hasNext());
System.out.println(it.hasNext());
System.out.println(it.hasNext());
System.out.println(it.hasNext());
System.out.println(it.hasNext());
}
} | 1,222 | 0.545826 | 0.532733 | 52 | 22.51923 | 20.964705 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.538462 | false | false | 2 |
a49d74cd4a19b433d3723c11aacae5c776e3fbbb | 18,038,862,707,187 | 287afe30bcb3c4668447b2e1708fb7c072007302 | /getQuired backups/06012017/GetQueried_android-3/app/src/main/java/com/getqueried/getqueried_android/Invite.java | fcdac34d0adfff6547e57fcb7f4c2899c8cd8286 | [] | no_license | Jagga6202/Googplepalces-and-sqlite | https://github.com/Jagga6202/Googplepalces-and-sqlite | 03959603c08a4f7647d09712d2aad50b2b2527b8 | 4488c58a5e9ac88ac3381ef9a7e47547575c9eb2 | refs/heads/master | 2020-05-25T20:26:51.744000 | 2017-03-02T10:04:18 | 2017-03-02T10:04:18 | 83,662,986 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.getqueried.getqueried_android;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.share.model.AppInviteContent;
import com.facebook.share.model.GameRequestContent;
import com.facebook.share.widget.AppInviteDialog;
import com.facebook.share.widget.GameRequestDialog;
public class Invite extends AppCompatActivity {
GameRequestDialog requestDialog;
CallbackManager callbackManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_invite);
FacebookSdk.sdkInitialize(this.getApplicationContext());
callbackManager = CallbackManager.Factory.create();
requestDialog = new GameRequestDialog(this);
requestDialog.registerCallback(callbackManager,
new FacebookCallback<GameRequestDialog.Result>() {
public void onSuccess(GameRequestDialog.Result result) {
String id = result.getRequestId();
// Toast.makeText(getApplicationContext(),"Send request",Toast.LENGTH_SHORT).show();
String appLinkUrl, previewImageUrl;
appLinkUrl = "http://getqueried-android.pagedemo.co/?__hstc=152250342.1e67a1dd962fb6e8a2544cef64b9f411.1481670093790.1481757107476.1482481073315.6&__hssc=152250342.1.1482481073315&__hsfp=3213607277";
previewImageUrl = "https://pbs.twimg.com/profile_images/737247131371704320/fanGrG3R.jpg";
if (AppInviteDialog.canShow()) {
AppInviteContent content = new AppInviteContent.Builder()
.setApplinkUrl(appLinkUrl)
.setPreviewImageUrl(previewImageUrl)
.build();
AppInviteDialog.show(getParent(), content);
}
}
public void onCancel() {}
public void onError(FacebookException error) {}
}
);
GameRequestContent content = new GameRequestContent.Builder()
.setMessage("Come play this level with me")
.setTo("1151489514943970") // I will work tomorrow on dynamic FB Id
.build();
requestDialog.show(content);
Log.d("Facebook Test","content"+content);
}
private void onClickRequestButton() {
//Toast.makeText(getApplicationContext(),"Send request",Toast.LENGTH_SHORT).show();
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
callbackManager.onActivityResult(requestCode, resultCode, data);
}
}
| UTF-8 | Java | 3,084 | java | Invite.java | Java | [] | null | [] | package com.getqueried.getqueried_android;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.share.model.AppInviteContent;
import com.facebook.share.model.GameRequestContent;
import com.facebook.share.widget.AppInviteDialog;
import com.facebook.share.widget.GameRequestDialog;
public class Invite extends AppCompatActivity {
GameRequestDialog requestDialog;
CallbackManager callbackManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_invite);
FacebookSdk.sdkInitialize(this.getApplicationContext());
callbackManager = CallbackManager.Factory.create();
requestDialog = new GameRequestDialog(this);
requestDialog.registerCallback(callbackManager,
new FacebookCallback<GameRequestDialog.Result>() {
public void onSuccess(GameRequestDialog.Result result) {
String id = result.getRequestId();
// Toast.makeText(getApplicationContext(),"Send request",Toast.LENGTH_SHORT).show();
String appLinkUrl, previewImageUrl;
appLinkUrl = "http://getqueried-android.pagedemo.co/?__hstc=152250342.1e67a1dd962fb6e8a2544cef64b9f411.1481670093790.1481757107476.1482481073315.6&__hssc=152250342.1.1482481073315&__hsfp=3213607277";
previewImageUrl = "https://pbs.twimg.com/profile_images/737247131371704320/fanGrG3R.jpg";
if (AppInviteDialog.canShow()) {
AppInviteContent content = new AppInviteContent.Builder()
.setApplinkUrl(appLinkUrl)
.setPreviewImageUrl(previewImageUrl)
.build();
AppInviteDialog.show(getParent(), content);
}
}
public void onCancel() {}
public void onError(FacebookException error) {}
}
);
GameRequestContent content = new GameRequestContent.Builder()
.setMessage("Come play this level with me")
.setTo("1151489514943970") // I will work tomorrow on dynamic FB Id
.build();
requestDialog.show(content);
Log.d("Facebook Test","content"+content);
}
private void onClickRequestButton() {
//Toast.makeText(getApplicationContext(),"Send request",Toast.LENGTH_SHORT).show();
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
callbackManager.onActivityResult(requestCode, resultCode, data);
}
}
| 3,084 | 0.649805 | 0.605383 | 67 | 45.014927 | 35.233757 | 223 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.731343 | false | false | 2 |
88e59353c851cc784c294e452d89ff0bcde18f98 | 4,604,204,942,304 | 451ed77d525e132837a0ecd1c5d8343616b71486 | /test-manager-runtime/src/main/java/xpadro/testmanager/runtime/ApplicationConfiguration.java | d9b11420c68be68947a6ebcbfeeaf6e88b8b6c5a | [] | no_license | Hansi1007/TestModule | https://github.com/Hansi1007/TestModule | d0a85d89a3463fe2e1563d76f092bcf58bf12a05 | 9bc5aa49efd124734c3e2081a97b6258a98ee3fe | refs/heads/master | 2023-09-05T02:32:26.045000 | 2021-11-21T18:10:23 | 2021-11-21T18:10:23 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package xpadro.testmanager.runtime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import xpadro.testmanager.domain.operation.*;
import xpadro.testmanager.domain.operation.analysis.Analysis;
import xpadro.testmanager.domain.operation.analysis.BiochemistryAnalysis;
import xpadro.testmanager.domain.operation.calculation.BiochemistryCalculation;
import xpadro.testmanager.domain.operation.calculation.Calculation;
import xpadro.testmanager.domain.operation.calculation.ImmunologyCalculation;
import xpadro.testmanager.domain.port.OperationPort;
import xpadro.testmanager.domain.port.OperationResultPort;
import xpadro.testmanager.outbound.OperationResultPortImpl;
import xpadro.testmanager.outbound.OperationResultRepository;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Configuration
@ComponentScan(basePackages = "xpadro.testmanager")
@EnableMongoRepositories(basePackages = "xpadro.testmanager")
public class ApplicationConfiguration {
// Ports
@Bean
public OperationPort operationPort(@Qualifier("calculationOperation") Operation calculationOperation,
@Qualifier("analysisOperation") Operation analysisOperation,
OperationResultPort operationResultPort) {
Map<OperationType, Operation> operations = new HashMap<>();
operations.put(analysisOperation.getType(), analysisOperation);
operations.put(calculationOperation.getType(), calculationOperation);
return new OperationService(operations, operationResultPort);
}
@Bean
@Autowired
public OperationResultPort operationResultPort(OperationResultRepository operationResultRepository) {
return new OperationResultPortImpl(operationResultRepository);
}
// Operations
@Bean
public Operation calculationOperation(List<Calculation> calculations) {
return new CalculationOperation(calculations);
}
@Bean
public Operation analysisOperation(List<Analysis> analyses) {
return new AnalysisOperation(analyses);
}
// Calculations
@Bean
public Calculation biochemistryCalculation() {
return new BiochemistryCalculation();
}
@Bean
public Calculation immunologyCalculation() {
return new ImmunologyCalculation();
}
// Analysis
@Bean
public Analysis biochemistryAnalysis() {
return new BiochemistryAnalysis();
}
}
| UTF-8 | Java | 2,789 | java | ApplicationConfiguration.java | Java | [] | null | [] | package xpadro.testmanager.runtime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import xpadro.testmanager.domain.operation.*;
import xpadro.testmanager.domain.operation.analysis.Analysis;
import xpadro.testmanager.domain.operation.analysis.BiochemistryAnalysis;
import xpadro.testmanager.domain.operation.calculation.BiochemistryCalculation;
import xpadro.testmanager.domain.operation.calculation.Calculation;
import xpadro.testmanager.domain.operation.calculation.ImmunologyCalculation;
import xpadro.testmanager.domain.port.OperationPort;
import xpadro.testmanager.domain.port.OperationResultPort;
import xpadro.testmanager.outbound.OperationResultPortImpl;
import xpadro.testmanager.outbound.OperationResultRepository;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Configuration
@ComponentScan(basePackages = "xpadro.testmanager")
@EnableMongoRepositories(basePackages = "xpadro.testmanager")
public class ApplicationConfiguration {
// Ports
@Bean
public OperationPort operationPort(@Qualifier("calculationOperation") Operation calculationOperation,
@Qualifier("analysisOperation") Operation analysisOperation,
OperationResultPort operationResultPort) {
Map<OperationType, Operation> operations = new HashMap<>();
operations.put(analysisOperation.getType(), analysisOperation);
operations.put(calculationOperation.getType(), calculationOperation);
return new OperationService(operations, operationResultPort);
}
@Bean
@Autowired
public OperationResultPort operationResultPort(OperationResultRepository operationResultRepository) {
return new OperationResultPortImpl(operationResultRepository);
}
// Operations
@Bean
public Operation calculationOperation(List<Calculation> calculations) {
return new CalculationOperation(calculations);
}
@Bean
public Operation analysisOperation(List<Analysis> analyses) {
return new AnalysisOperation(analyses);
}
// Calculations
@Bean
public Calculation biochemistryCalculation() {
return new BiochemistryCalculation();
}
@Bean
public Calculation immunologyCalculation() {
return new ImmunologyCalculation();
}
// Analysis
@Bean
public Analysis biochemistryAnalysis() {
return new BiochemistryAnalysis();
}
}
| 2,789 | 0.768017 | 0.768017 | 79 | 34.303799 | 30.998306 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.455696 | false | false | 2 |
c5d580a2cde3c9382168bab93cbccb5376a91f81 | 13,889,924,240,766 | bc63e35ee530135a59a22bf51d174f0288c85abe | /src/main/java/com/ss/dto/LinkedList.java | 63183e0123c56d3a61770c3855eccc5aaa73273a | [] | no_license | Sushmithasmurthy/fun_with_algorithms | https://github.com/Sushmithasmurthy/fun_with_algorithms | 1d3058623448f6ab0ac10fa2683f1423ead70de2 | 2bfc59eef11a7121872415016ebd07dfc131ea28 | refs/heads/master | 2022-06-25T13:01:04.783000 | 2022-06-06T20:57:02 | 2022-06-06T20:57:02 | 149,543,125 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ss.dto;
public class LinkedList {
public static int size(Node head) {
int count = 0;
Node curNode = head;
while (curNode != null) {
count++;
curNode = curNode.getNext();
}
return count;
}
public static void add(Node head, Node newNode){
Node curNode = head;
while(curNode.getNext()!=null){
curNode = curNode.next;
}
curNode.setNext(newNode);
}
}
| UTF-8 | Java | 484 | java | LinkedList.java | Java | [] | null | [] | package com.ss.dto;
public class LinkedList {
public static int size(Node head) {
int count = 0;
Node curNode = head;
while (curNode != null) {
count++;
curNode = curNode.getNext();
}
return count;
}
public static void add(Node head, Node newNode){
Node curNode = head;
while(curNode.getNext()!=null){
curNode = curNode.next;
}
curNode.setNext(newNode);
}
}
| 484 | 0.52686 | 0.524793 | 21 | 22.047619 | 14.853174 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.47619 | false | false | 2 |
d9d722bb95d95c71450c0a8a3509c90911daf5d2 | 6,794,638,319,266 | 095dd1c50f311cdf6885cbd89057cf2b2a69b0c6 | /mlcp-core/src/main/java/com/marklogic/mlcp2/BaseConfig.java | 8caa4c86a061cda81f4d73fd71ca63ea2bb35229 | [] | no_license | damonfeldman/friendly-telegram | https://github.com/damonfeldman/friendly-telegram | 89eb2149aae97cb7ad9a0a05d030fbf9582627be | ca0ea1b9f5f87b643dc82201a6d0f719a7610fe3 | refs/heads/master | 2023-07-04T23:08:05.480000 | 2021-09-02T17:57:07 | 2021-09-02T17:57:07 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.marklogic.mlcp2;
import com.marklogic.client.ext.DatabaseClientConfig;
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.env.Environment;
/**
* Defines a base configuration for MLCP batch jobs.
*/
@EnableBatchProcessing
@Lazy
public class BaseConfig {
@Autowired
Environment environment;
@Bean
// Ensures this is immediately created so that its properties can be immediately added to the Spring environment
@Lazy(false)
public EnvironmentPropertySource environmentPropertySource() {
return new EnvironmentPropertySource();
}
@Bean
public DatabaseClientConfig databaseClientConfig() {
// TODO Add support for other properties
DatabaseClientConfig config = new DatabaseClientConfig();
config.setHost(environment.getProperty("host"));
config.setPort(environment.getProperty("port", Integer.class));
config.setUsername(environment.getProperty("username"));
config.setPassword(environment.getProperty("password"));
return config;
}
}
| UTF-8 | Java | 1,287 | java | BaseConfig.java | Java | [
{
"context": " config.setUsername(environment.getProperty(\"username\"));\n config.setPassword(environment.getPro",
"end": 1186,
"score": 0.6571263074874878,
"start": 1178,
"tag": "USERNAME",
"value": "username"
}
] | null | [] | package com.marklogic.mlcp2;
import com.marklogic.client.ext.DatabaseClientConfig;
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.env.Environment;
/**
* Defines a base configuration for MLCP batch jobs.
*/
@EnableBatchProcessing
@Lazy
public class BaseConfig {
@Autowired
Environment environment;
@Bean
// Ensures this is immediately created so that its properties can be immediately added to the Spring environment
@Lazy(false)
public EnvironmentPropertySource environmentPropertySource() {
return new EnvironmentPropertySource();
}
@Bean
public DatabaseClientConfig databaseClientConfig() {
// TODO Add support for other properties
DatabaseClientConfig config = new DatabaseClientConfig();
config.setHost(environment.getProperty("host"));
config.setPort(environment.getProperty("port", Integer.class));
config.setUsername(environment.getProperty("username"));
config.setPassword(environment.getProperty("password"));
return config;
}
}
| 1,287 | 0.758353 | 0.757576 | 37 | 33.783783 | 29.308365 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.432432 | false | false | 2 |
9844f8f9b0bb6281b8774a22d9608974ab09bd20 | 20,177,756,416,631 | 8f5b4967feb944ff77b969362be0ce029fd68c74 | /source code/Homework 11/src/VertexNode.java | cc23bfc9f2f2e3098428ebef5b171e1c181dc601 | [] | no_license | quinnajodanti/BUAA_2019_ObjectOriented | https://github.com/quinnajodanti/BUAA_2019_ObjectOriented | 0562471d837570a7c9e871b8334c0ae4a685205f | 3f18681651804ac539d1a23f68194ea4ca29b2ef | refs/heads/master | 2021-04-23T01:34:00.097000 | 2019-06-21T09:21:16 | 2019-06-21T09:21:16 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class VertexNode {
//this class is for bfs || transfer || un
private Vertex vertex;
private int distance;
private boolean visited;
public VertexNode(Vertex vertex) {
this(vertex, 0, false);
}
public VertexNode(Vertex vertex, int distance) {
this(vertex, distance, false);
}
public VertexNode(Vertex vertex, int distance, boolean visited) {
this.vertex = vertex;
this.distance = distance;
this.visited = visited;
}
public int getDistance() {
return distance;
}
public void setDistance(int i) {
distance = i;
}
public boolean wasVisited() {
return visited;
}
public void setVisited() {
visited = true;
}
@Override
public int hashCode() {
return vertex.hashCode();
}
public Vertex getVertex() {
return vertex;
}
}
| UTF-8 | Java | 986 | java | VertexNode.java | Java | [] | null | [] |
public class VertexNode {
//this class is for bfs || transfer || un
private Vertex vertex;
private int distance;
private boolean visited;
public VertexNode(Vertex vertex) {
this(vertex, 0, false);
}
public VertexNode(Vertex vertex, int distance) {
this(vertex, distance, false);
}
public VertexNode(Vertex vertex, int distance, boolean visited) {
this.vertex = vertex;
this.distance = distance;
this.visited = visited;
}
public int getDistance() {
return distance;
}
public void setDistance(int i) {
distance = i;
}
public boolean wasVisited() {
return visited;
}
public void setVisited() {
visited = true;
}
@Override
public int hashCode() {
return vertex.hashCode();
}
public Vertex getVertex() {
return vertex;
}
}
| 986 | 0.539554 | 0.53854 | 45 | 19.866667 | 15.793951 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false | 2 |
8fd0f9b156d0afeb27a007ec7c7faefee041b775 | 10,737,418,280,318 | 19d725816adac3f47c97db93ed2bf5d5983929f3 | /src/com/alipay/one/services/PayServices.java | e418f945b6d2794dd33898b0529abc7fc279a1c5 | [] | no_license | yinxiaobai/AlipayDemo | https://github.com/yinxiaobai/AlipayDemo | f76c7504260d878a50a0df6f82d722ae5ce8a721 | 080cd78760c19d9dad8b24d6367d4ae8e214b577 | refs/heads/master | 2021-01-11T17:29:21.141000 | 2017-01-23T08:34:34 | 2017-01-23T08:34:34 | 79,775,280 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.alipay.one.services;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.alibaba.fastjson.JSONObject;
/**
* @date 2017年1月20日下午3:15:56
* @author jq.yin@i-vpoints.com
*/
public class PayServices {
private static final Logger log = LoggerFactory
.getLogger(PayServices.class);
/**
* @date 2017年1月20日下午3:26:54
* @param map
* @author jq.yin@i-vpoints.com
*/
public static void citiService(Map<String,String> map) {
String outTradeNo = map.get("out_trade_no");
String buyerLogonId = map.get("buyer_logon_id"); // 买家支付宝账号
String sellerEmail = map.get("seller_email"); // 卖家支付宝账号
String tradeStatus = map.get("trade_status"); // 交易状态
String totalAmount = map.get("total_amount"); // 订单金额
String invoiceAmount = map.get("invoice_amount"); // 开票金额
String pointAmount = map.get("point_amount"); // 使用集分宝支付的金额
String subject = map.get("subject");
String buyerPayAmount = map.get("buyer_pay_amount"); // 付款金额
String receiptAmount = map.get("receipt_amount"); // 实收金额
String fundBillList = map.get("fund_bill_list"); // 支付金额信息
JSONObject json = (JSONObject) JSONObject.parse(fundBillList.substring(1,fundBillList.length()-1));
String fundChannel = json.getString("fundChannel"); // 支付渠道
String amount = json.getString("amount"); // 支付金额
log.info(map.toString());
log.info("【{}:买家 {} 通过 {} 方式支付了 {} 元,从卖家 {} 购买:{},{}】",outTradeNo,buyerLogonId,fundChannel,amount,sellerEmail,subject,tradeStatus);
log.info("【订单金额{},开票金额{},集分宝金额{},付款金额{},实收金额{}】",totalAmount,invoiceAmount,pointAmount,buyerPayAmount,receiptAmount);
};
}
| UTF-8 | Java | 1,839 | java | PayServices.java | Java | [
{
"context": "ject;\n\n/**\n * @date 2017年1月20日下午3:15:56\n * @author jq.yin@i-vpoints.com\n */\npublic class PayServices {\n\n\tprivate static f",
"end": 220,
"score": 0.9999345541000366,
"start": 200,
"tag": "EMAIL",
"value": "jq.yin@i-vpoints.com"
},
{
"context": "ate 2017年1月20日下午3:26:54\n\t * @param map\n\t * @author jq.yin@i-vpoints.com\n\t */\n\tpublic static void citiService(Map<String,S",
"end": 419,
"score": 0.9999352693557739,
"start": 399,
"tag": "EMAIL",
"value": "jq.yin@i-vpoints.com"
}
] | null | [] | package com.alipay.one.services;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.alibaba.fastjson.JSONObject;
/**
* @date 2017年1月20日下午3:15:56
* @author <EMAIL>
*/
public class PayServices {
private static final Logger log = LoggerFactory
.getLogger(PayServices.class);
/**
* @date 2017年1月20日下午3:26:54
* @param map
* @author <EMAIL>
*/
public static void citiService(Map<String,String> map) {
String outTradeNo = map.get("out_trade_no");
String buyerLogonId = map.get("buyer_logon_id"); // 买家支付宝账号
String sellerEmail = map.get("seller_email"); // 卖家支付宝账号
String tradeStatus = map.get("trade_status"); // 交易状态
String totalAmount = map.get("total_amount"); // 订单金额
String invoiceAmount = map.get("invoice_amount"); // 开票金额
String pointAmount = map.get("point_amount"); // 使用集分宝支付的金额
String subject = map.get("subject");
String buyerPayAmount = map.get("buyer_pay_amount"); // 付款金额
String receiptAmount = map.get("receipt_amount"); // 实收金额
String fundBillList = map.get("fund_bill_list"); // 支付金额信息
JSONObject json = (JSONObject) JSONObject.parse(fundBillList.substring(1,fundBillList.length()-1));
String fundChannel = json.getString("fundChannel"); // 支付渠道
String amount = json.getString("amount"); // 支付金额
log.info(map.toString());
log.info("【{}:买家 {} 通过 {} 方式支付了 {} 元,从卖家 {} 购买:{},{}】",outTradeNo,buyerLogonId,fundChannel,amount,sellerEmail,subject,tradeStatus);
log.info("【订单金额{},开票金额{},集分宝金额{},付款金额{},实收金额{}】",totalAmount,invoiceAmount,pointAmount,buyerPayAmount,receiptAmount);
};
}
| 1,813 | 0.703019 | 0.685767 | 44 | 35.886364 | 31.584099 | 133 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.5 | false | false | 2 |
05d2e72e74d51fbe3d1316edfc3d7f987536f416 | 14,980,845,939,965 | 49bd13421a23325a91a3c1ea46ff3171130d3c77 | /src/main/java/com/webtrucking/controller/BaseController.java | e14911aff85e1cc20c928970c041e23a3a23fbb7 | [] | no_license | ascend-sparta-vn/code | https://github.com/ascend-sparta-vn/code | a002a4bc1dcc6e87b3a6806bb78f91ac5dc527ba | 4994901e74fb66d366bc8563c1702a5626098a41 | refs/heads/master | 2021-01-02T09:17:28.636000 | 2017-08-19T14:48:04 | 2017-08-19T14:48:04 | 99,181,987 | 1 | 1 | null | false | 2017-08-19T09:42:11 | 2017-08-03T02:33:06 | 2017-08-14T02:00:17 | 2017-08-19T09:42:10 | 130,612 | 1 | 1 | 0 | CSS | null | null | package com.webtrucking.controller;
import com.webtrucking.dao.ShipmentDAO;
import com.webtrucking.dao.UserDAO;
import com.webtrucking.entity.User;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.List;
import java.util.Locale;
public class BaseController {
static Logger log = Logger.getLogger(BaseController.class);
@Autowired
private MessageSource messageSource;
@Autowired
private UserDAO userDAO;
@Autowired
private ShipmentDAO shipmentDAO;
/*
* to get message from language file properties like struts2
*/
public String getText(String text) {
// obtain locale from LocaleContextHolder
// add parametrized message from controller
Locale currentLocale = LocaleContextHolder.getLocale();
String message = messageSource.getMessage(text,
new Object [] {"test"}, "default", currentLocale);
return message;
}
public User getCurrentAccount() {
try {
//UserDetails userDetail = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
org.springframework.security.core.userdetails.User user = (org.springframework.security.core.userdetails.User)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
List<User> accounts = userDAO.findByUsername(user.getUsername());
User account = null;
if(accounts != null && accounts.size() > 0){
account = accounts.get(0);
}
return account;
} catch (Exception e) {
log.error("", e);
}
return null;
}
public String getCurrentUsername(){
String username = "";
try{
org.springframework.security.core.userdetails.User user = (org.springframework.security.core.userdetails.User)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
username = user.getUsername();
}catch(Exception e){
log.error(e);
}
return username;
}
public Integer getNextAutoIncreamentShipment(){
Integer nextId = -1;
List<Object[]> nextRecord = shipmentDAO.getNextAutoIncreamentShipment();
if(nextRecord != null && nextRecord.size() > 0){
Object obj = nextRecord.get(0)[10];
if(obj != null)
nextId = Integer.parseInt(obj.toString());
}
return nextId;
}
public Pageable createPageRequest(Integer page, Integer size, String sortedField) {
return new PageRequest(page, size, Sort.Direction.DESC, sortedField);
}
}
| UTF-8 | Java | 2,816 | java | BaseController.java | Java | [] | null | [] | package com.webtrucking.controller;
import com.webtrucking.dao.ShipmentDAO;
import com.webtrucking.dao.UserDAO;
import com.webtrucking.entity.User;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.List;
import java.util.Locale;
public class BaseController {
static Logger log = Logger.getLogger(BaseController.class);
@Autowired
private MessageSource messageSource;
@Autowired
private UserDAO userDAO;
@Autowired
private ShipmentDAO shipmentDAO;
/*
* to get message from language file properties like struts2
*/
public String getText(String text) {
// obtain locale from LocaleContextHolder
// add parametrized message from controller
Locale currentLocale = LocaleContextHolder.getLocale();
String message = messageSource.getMessage(text,
new Object [] {"test"}, "default", currentLocale);
return message;
}
public User getCurrentAccount() {
try {
//UserDetails userDetail = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
org.springframework.security.core.userdetails.User user = (org.springframework.security.core.userdetails.User)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
List<User> accounts = userDAO.findByUsername(user.getUsername());
User account = null;
if(accounts != null && accounts.size() > 0){
account = accounts.get(0);
}
return account;
} catch (Exception e) {
log.error("", e);
}
return null;
}
public String getCurrentUsername(){
String username = "";
try{
org.springframework.security.core.userdetails.User user = (org.springframework.security.core.userdetails.User)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
username = user.getUsername();
}catch(Exception e){
log.error(e);
}
return username;
}
public Integer getNextAutoIncreamentShipment(){
Integer nextId = -1;
List<Object[]> nextRecord = shipmentDAO.getNextAutoIncreamentShipment();
if(nextRecord != null && nextRecord.size() > 0){
Object obj = nextRecord.get(0)[10];
if(obj != null)
nextId = Integer.parseInt(obj.toString());
}
return nextId;
}
public Pageable createPageRequest(Integer page, Integer size, String sortedField) {
return new PageRequest(page, size, Sort.Direction.DESC, sortedField);
}
}
| 2,816 | 0.747159 | 0.743253 | 88 | 31 | 33.584698 | 183 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.625 | false | false | 2 |
a21b5a059bdc1b4a9532ce0fa5266b2923a977f9 | 5,574,867,585,646 | 9c271c213d168caa2b5b2397d41f17b642313fab | /src/collection/map_interface/HashTable.java | cca631506022da06fdcfed41776bb14f623d7f70 | [] | no_license | PolinaLang/java-test | https://github.com/PolinaLang/java-test | 7b895d68922f455dad4d5c05f55c5f253688fc05 | fd7779a315eaff9766c7e1af30e74f62505fd5ad | refs/heads/master | 2023-07-07T13:58:49.496000 | 2021-08-10T19:34:08 | 2021-08-10T19:34:08 | 381,943,243 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | //4. Коллекции, lesson 19
package collection.map_interface;
import java.util.Hashtable;
public class HashTable {
public static void main(String[] args) {
Hashtable<Double, Student> h1 = new Hashtable<>();
Student s1 = new Student("Morty", "Smith", 1);
Student s2 = new Student("Summer", "Smith", 4);
Student s3 = new Student("Jerry", "Smith", 0);
h1.put(7.8, s1);
h1.put(1.8, s2);
h1.put(6.0, s3);
System.out.println(h1);
}
}
| UTF-8 | Java | 510 | java | HashTable.java | Java | [
{
"context": " Hashtable<>();\n Student s1 = new Student(\"Morty\", \"Smith\", 1);\n Student s2 = new Student(\"",
"end": 258,
"score": 0.99979567527771,
"start": 253,
"tag": "NAME",
"value": "Morty"
},
{
"context": "e<>();\n Student s1 = new Student(\"Morty\", \"Smith\", 1);\n Student s2 = new Student(\"Summer\", ",
"end": 267,
"score": 0.9998241662979126,
"start": 262,
"tag": "NAME",
"value": "Smith"
},
{
"context": "\", \"Smith\", 1);\n Student s2 = new Student(\"Summer\", \"Smith\", 4);\n Student s3 = new Student(\"",
"end": 314,
"score": 0.9998056888580322,
"start": 308,
"tag": "NAME",
"value": "Summer"
},
{
"context": ", 1);\n Student s2 = new Student(\"Summer\", \"Smith\", 4);\n Student s3 = new Student(\"Jerry\", \"",
"end": 323,
"score": 0.9998277425765991,
"start": 318,
"tag": "NAME",
"value": "Smith"
},
{
"context": "\", \"Smith\", 4);\n Student s3 = new Student(\"Jerry\", \"Smith\", 0);\n\n h1.put(7.8, s1);\n ",
"end": 369,
"score": 0.9997800588607788,
"start": 364,
"tag": "NAME",
"value": "Jerry"
},
{
"context": "\", 4);\n Student s3 = new Student(\"Jerry\", \"Smith\", 0);\n\n h1.put(7.8, s1);\n h1.put(1.",
"end": 378,
"score": 0.9998250007629395,
"start": 373,
"tag": "NAME",
"value": "Smith"
}
] | null | [] | //4. Коллекции, lesson 19
package collection.map_interface;
import java.util.Hashtable;
public class HashTable {
public static void main(String[] args) {
Hashtable<Double, Student> h1 = new Hashtable<>();
Student s1 = new Student("Morty", "Smith", 1);
Student s2 = new Student("Summer", "Smith", 4);
Student s3 = new Student("Jerry", "Smith", 0);
h1.put(7.8, s1);
h1.put(1.8, s2);
h1.put(6.0, s3);
System.out.println(h1);
}
}
| 510 | 0.582834 | 0.536926 | 18 | 26.833334 | 19.622126 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.166667 | false | false | 2 |
160534b72654f324c255d3e9b9905a0bc021a595 | 5,574,867,583,045 | db12b990924703cd74748d8585cd9c11fafa6746 | /h2o-core/src/main/java/water/udf/DataColumns.java | 4e2d329e606aac87d08c9c161d103a15902a4230 | [
"Apache-2.0"
] | permissive | h2oai/h2o-3 | https://github.com/h2oai/h2o-3 | 919019a8f297eec676011a9cfd2cc2d97891ce14 | d817ab90c8c47f6787604a0b9639b66234158228 | refs/heads/master | 2023-08-17T18:50:17.732000 | 2023-08-17T16:44:42 | 2023-08-17T16:44:42 | 17,371,412 | 6,872 | 2,345 | Apache-2.0 | false | 2023-09-14T18:05:40 | 2014-03-03T16:08:07 | 2023-09-13T16:15:03 | 2023-09-14T18:05:38 | 619,600 | 6,476 | 1,997 | 2,722 | Jupyter Notebook | false | false | package water.udf;
import water.fvec.Chunk;
import water.fvec.Vec;
import water.util.fp.Function;
import water.util.fp.Functions;
import java.io.IOException;
import java.util.List;
/**
* An adapter to Vec, allows type-safe access to data
*/
public class DataColumns {
protected DataColumns(){}
public static Vec buildZeroVec(long length, byte typeCode) {
return Vec.makeCon(0.0, length, true, typeCode);
}
public static abstract class BaseFactory<T>
implements ColumnFactory<T> {
public final byte typeCode;
public final String name;
protected BaseFactory(byte typeCode, String name) {
this.typeCode = typeCode;
this.name = name;
}
public byte typeCode() { return typeCode; }
public Vec buildZeroVec(long length) {
return DataColumns.buildZeroVec(length, typeCode);
}
public Vec buildZeroVec(Column<?> master) {
Vec vec = buildZeroVec(master.size());
vec.align(master.vec());
return vec;
}
public abstract DataChunk<T> apply(final Chunk c);
public abstract DataColumn<T> newColumn(Vec vec);
public DataColumn<T> newColumn(long length, final Function<Long, T> f) throws IOException {
return new TypedFrame<>(this, length, f).newColumn();
}
public DataColumn<T> materialize(Column<T> xs) throws IOException {
return TypedFrame.forColumn(this, xs).newColumn();
}
public DataColumn<T> newColumn(List<T> xs) throws IOException {
return newColumn(xs.size(), Functions.onList(xs));
}
public DataColumn<T> constColumn(final T t, long length) throws IOException {
return newColumn(length, Functions.<Long, T>constant(t));
}
@Override public String toString() { return name; }
}
// We may never need BufferedStrings
// public static class OfBS extends OnVector<BufferedString> {
// public OfBS(Vec vec) {
// super(vec, Vec.T_STR);
// }
//
// @Override
// public BufferedString get(long idx) {
// BufferedString bs = new BufferedString();
// return vec.atStr(bs, idx);
// }
// }
//-------------------------------------------------------------
// TODO(vlad): figure out if we should support UUIDs
// public static final Factory<UUID> UUIDs = new Factory<UUID>(Vec.T_UUID) {
//
// @Override public DataChunk<UUID> apply(final Chunk c) {
// return new DataChunk<UUID>(c) {
// @Override public UUID get(int idx) { return isNA(idx) ? null : new UUID(c.at16h(idx), c.at16l(idx)); }
// @Override public void set(int idx, UUID value) { c.set(idx, value); }
// };
// }
//
// @Override public DataColumn<UUID> newColumn(final Vec vec) {
// if (vec.get_type() != Vec.T_UUID)
// throw new IllegalArgumentException("Expected a type UUID, got " + vec.get_type_str());
// return new DataColumn<UUID>(vec, typeCode, this) {
// @Override public UUID get(long idx) { return isNA(idx) ? null : new UUID(vec.at16h(idx), vec.at16l(idx)); }
// @Override public void set(long idx, UUID value) { vec.set(idx, value); }
// };
// }
// };
} | UTF-8 | Java | 3,095 | java | DataColumns.java | Java | [
{
"context": "----------------------------------------\n\n// TODO(vlad): figure out if we should support UUIDs \n// pub",
"end": 2160,
"score": 0.988390326499939,
"start": 2156,
"tag": "USERNAME",
"value": "vlad"
}
] | null | [] | package water.udf;
import water.fvec.Chunk;
import water.fvec.Vec;
import water.util.fp.Function;
import water.util.fp.Functions;
import java.io.IOException;
import java.util.List;
/**
* An adapter to Vec, allows type-safe access to data
*/
public class DataColumns {
protected DataColumns(){}
public static Vec buildZeroVec(long length, byte typeCode) {
return Vec.makeCon(0.0, length, true, typeCode);
}
public static abstract class BaseFactory<T>
implements ColumnFactory<T> {
public final byte typeCode;
public final String name;
protected BaseFactory(byte typeCode, String name) {
this.typeCode = typeCode;
this.name = name;
}
public byte typeCode() { return typeCode; }
public Vec buildZeroVec(long length) {
return DataColumns.buildZeroVec(length, typeCode);
}
public Vec buildZeroVec(Column<?> master) {
Vec vec = buildZeroVec(master.size());
vec.align(master.vec());
return vec;
}
public abstract DataChunk<T> apply(final Chunk c);
public abstract DataColumn<T> newColumn(Vec vec);
public DataColumn<T> newColumn(long length, final Function<Long, T> f) throws IOException {
return new TypedFrame<>(this, length, f).newColumn();
}
public DataColumn<T> materialize(Column<T> xs) throws IOException {
return TypedFrame.forColumn(this, xs).newColumn();
}
public DataColumn<T> newColumn(List<T> xs) throws IOException {
return newColumn(xs.size(), Functions.onList(xs));
}
public DataColumn<T> constColumn(final T t, long length) throws IOException {
return newColumn(length, Functions.<Long, T>constant(t));
}
@Override public String toString() { return name; }
}
// We may never need BufferedStrings
// public static class OfBS extends OnVector<BufferedString> {
// public OfBS(Vec vec) {
// super(vec, Vec.T_STR);
// }
//
// @Override
// public BufferedString get(long idx) {
// BufferedString bs = new BufferedString();
// return vec.atStr(bs, idx);
// }
// }
//-------------------------------------------------------------
// TODO(vlad): figure out if we should support UUIDs
// public static final Factory<UUID> UUIDs = new Factory<UUID>(Vec.T_UUID) {
//
// @Override public DataChunk<UUID> apply(final Chunk c) {
// return new DataChunk<UUID>(c) {
// @Override public UUID get(int idx) { return isNA(idx) ? null : new UUID(c.at16h(idx), c.at16l(idx)); }
// @Override public void set(int idx, UUID value) { c.set(idx, value); }
// };
// }
//
// @Override public DataColumn<UUID> newColumn(final Vec vec) {
// if (vec.get_type() != Vec.T_UUID)
// throw new IllegalArgumentException("Expected a type UUID, got " + vec.get_type_str());
// return new DataColumn<UUID>(vec, typeCode, this) {
// @Override public UUID get(long idx) { return isNA(idx) ? null : new UUID(vec.at16h(idx), vec.at16l(idx)); }
// @Override public void set(long idx, UUID value) { vec.set(idx, value); }
// };
// }
// };
} | 3,095 | 0.637803 | 0.634572 | 100 | 29.959999 | 29.08502 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.62 | false | false | 2 |
ce4cf1a55879d802b130617d1626367fb42f2fa4 | 8,641,474,204,339 | 82512ed0f4d4c37191eeb409ff1cc78ca632e931 | /src/main/java/kr/or/dgit/book_project/ui/component/BookReturnMemberPanel.java | df41106978b5554db9ef6976e366951d74787bb9 | [] | no_license | DaeguIT-MinSuKim/it_fuse_2st | https://github.com/DaeguIT-MinSuKim/it_fuse_2st | 29d42860e4dba95a69c904448c577a95a88ed302 | c0639fcaec22ed8d6c0245130cf1dc99c5e63a86 | refs/heads/master | 2021-01-23T01:13:12.506000 | 2017-04-14T04:36:52 | 2017-04-14T04:36:52 | 85,887,443 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package kr.or.dgit.book_project.ui.component;
import javax.swing.JPanel;
import kr.or.dgit.book_project.ui.common.InputComp;
import javax.swing.BoxLayout;
import java.awt.GridLayout;
public class BookReturnMemberPanel extends JPanel {
/**
* Create the panel.
*/
public BookReturnMemberPanel() {
setLayout(new GridLayout(0, 1, 0, 0));
BookLendMemberDetail panel = new BookLendMemberDetail();
add(panel);
JPanel brmp1 = new JPanel();
brmp1.setLayout(new BoxLayout(brmp1, BoxLayout.Y_AXIS));
InputComp pLendDate = new InputComp();
pLendDate.setTitle("대 여 일");
brmp1.add(pLendDate);
InputComp pReturnDate = new InputComp();
pReturnDate.setTitle("반 납 일");
brmp1.add(pReturnDate);
add(brmp1);
}
}
| UTF-8 | Java | 808 | java | BookReturnMemberPanel.java | Java | [] | null | [] | package kr.or.dgit.book_project.ui.component;
import javax.swing.JPanel;
import kr.or.dgit.book_project.ui.common.InputComp;
import javax.swing.BoxLayout;
import java.awt.GridLayout;
public class BookReturnMemberPanel extends JPanel {
/**
* Create the panel.
*/
public BookReturnMemberPanel() {
setLayout(new GridLayout(0, 1, 0, 0));
BookLendMemberDetail panel = new BookLendMemberDetail();
add(panel);
JPanel brmp1 = new JPanel();
brmp1.setLayout(new BoxLayout(brmp1, BoxLayout.Y_AXIS));
InputComp pLendDate = new InputComp();
pLendDate.setTitle("대 여 일");
brmp1.add(pLendDate);
InputComp pReturnDate = new InputComp();
pReturnDate.setTitle("반 납 일");
brmp1.add(pReturnDate);
add(brmp1);
}
}
| 808 | 0.665829 | 0.653266 | 40 | 17.9 | 18.886238 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.7 | false | false | 2 |
b04fc3e6ca039e1ea1f59bdaeb51f9036918388a | 6,330,781,816,022 | f578e5060bf17df2b6b6120c856d1ebe5dfa249b | /src/bean/RssFeed.java | 7c678f682438a25e972108392ed39a4336d2af52 | [] | no_license | SaraTahiriSIR20172018/test | https://github.com/SaraTahiriSIR20172018/test | 4f2c70788745ffbfa0a4d4ed0327dea7001872c1 | bd01890c5d65305d4c2812b351c22541846bd09b | refs/heads/master | 2020-04-07T13:01:28.946000 | 2018-03-07T09:44:44 | 2018-03-07T09:44:44 | 124,213,745 | 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 bean;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
/**
*
* @author lenovo
*/
@Entity
public class RssFeed implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private String url;
private String name;
//what on earth are those types ??
private RssFeed [][] rssfeeds;
private Article[] articles;
public RssFeed( String name,String url, Article[] articles) {
this.url = url;
this.name = name;
this.articles = articles;
}
public RssFeed[][] getRssfeeds() {
return rssfeeds;
}
public void setRssfeeds(RssFeed[][] rssfeeds) {
this.rssfeeds = rssfeeds;
}
public RssFeed() {
}
public Article[] getArticles() {
return articles;
}
public void setArticles(Article[] articles) {
this.articles = articles;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
@Override
public int hashCode() {
int hash = 0;
hash += (url != null ? url.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the url fields are not set
if (!(object instanceof RssFeed)) {
return false;
}
RssFeed other = (RssFeed) object;
if ((this.url == null && other.url != null) || (this.url != null && !this.url.equals(other.url))) {
return false;
}
return true;
}
@Override
public String toString() {
return "RSSfeed{" + "url=" + url + ", name=" + name +'}';
}
}
| UTF-8 | Java | 2,382 | java | RssFeed.java | Java | [
{
"context": "avax.persistence.OneToMany;\r\n\r\n/**\r\n *\r\n * @author lenovo\r\n */\r\n@Entity\r\npublic class RssFeed implements Se",
"end": 474,
"score": 0.9994469285011292,
"start": 468,
"tag": "USERNAME",
"value": "lenovo"
},
{
"context": " return \"RSSfeed{\" + \"url=\" + url + \", name=\" + name +'}';\r\n }\r\n\r\n \r\n \r\n}\r\n",
"end": 2352,
"score": 0.6118645071983337,
"start": 2348,
"tag": "NAME",
"value": "name"
}
] | 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 bean;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
/**
*
* @author lenovo
*/
@Entity
public class RssFeed implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private String url;
private String name;
//what on earth are those types ??
private RssFeed [][] rssfeeds;
private Article[] articles;
public RssFeed( String name,String url, Article[] articles) {
this.url = url;
this.name = name;
this.articles = articles;
}
public RssFeed[][] getRssfeeds() {
return rssfeeds;
}
public void setRssfeeds(RssFeed[][] rssfeeds) {
this.rssfeeds = rssfeeds;
}
public RssFeed() {
}
public Article[] getArticles() {
return articles;
}
public void setArticles(Article[] articles) {
this.articles = articles;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
@Override
public int hashCode() {
int hash = 0;
hash += (url != null ? url.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the url fields are not set
if (!(object instanceof RssFeed)) {
return false;
}
RssFeed other = (RssFeed) object;
if ((this.url == null && other.url != null) || (this.url != null && !this.url.equals(other.url))) {
return false;
}
return true;
}
@Override
public String toString() {
return "RSSfeed{" + "url=" + url + ", name=" + name +'}';
}
}
| 2,382 | 0.572628 | 0.571369 | 104 | 20.903847 | 21.123957 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 2 |
c165802f0b21e8b5416b7a8ddab77fb832285f08 | 3,341,484,598,964 | d1341c88f2c816d996c84fd5d85bd27a11234c1b | /services/users-service/src/test/groovy/com/filos/users/services/security/methods/BasicAuthenticationServiceTest.java | 4196127b5035fcd677c71a5b350bea81063ffb53 | [
"MIT"
] | permissive | FilosGabriel/movie-microservices | https://github.com/FilosGabriel/movie-microservices | f74132dac4ce400175a063e6474aa40936ab2370 | e4c5a7352348d89c077ab897e2f1ca75c17a83a6 | refs/heads/main | 2023-05-04T01:53:44.187000 | 2021-05-28T12:06:57 | 2021-05-28T12:06:57 | 307,127,506 | 0 | 0 | null | false | 2020-11-02T20:06:11 | 2020-10-25T15:19:20 | 2020-10-31T19:15:50 | 2020-11-02T20:06:10 | 41 | 0 | 0 | 0 | Java | false | false | package com.filos.users.services.security.methods;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.codec.digest.MessageDigestAlgorithms;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import com.filos.users.repository.model.User;
import com.filos.users.services.security.exceptions.InvalidLoginRequest;
import com.filos.users.utils.generators.UsersGenerator;
import com.filos.users.web.requests.LoginRequest;
@DisplayName("When a user try to auth using basic")
class BasicAuthenticationServiceTest {
private final UsersGenerator usersGenerator = new UsersGenerator();
private final DigestUtils digestUtils = new DigestUtils(MessageDigestAlgorithms.SHA3_256);
@Test
@DisplayName("It should allow if is correct request")
public void testWhenValid() {
BasicAuthenticationService basicAuthenticationService = new BasicAuthenticationService(
digestUtils);
User user = usersGenerator.createUser();
LoginRequest loginRequest = new LoginRequest("test", "password", "basic", null);
user.getSecurity().setPassword(digestUtils.digestAsHex(loginRequest.getPassword()));
// When
Assertions.assertThatCode(() -> basicAuthenticationService.tryToApproveLogin(loginRequest, user))
// Then
.doesNotThrowAnyException();
}
@Test
@DisplayName("it should not allow if request is invalid")
public void testWhenInvalid() {
BasicAuthenticationService basicAuthenticationService = new BasicAuthenticationService(
digestUtils);
User user = usersGenerator.createUser();
LoginRequest loginRequest = new LoginRequest("test", "password", "basic", null);
user.getSecurity().setPassword(digestUtils.digestAsHex("other password"));
// When
Assertions.assertThatThrownBy(() -> basicAuthenticationService.tryToApproveLogin(loginRequest, user))
// Then
.isInstanceOf(InvalidLoginRequest.class);
}
} | UTF-8 | Java | 2,107 | java | BasicAuthenticationServiceTest.java | Java | [
{
"context": "inRequest = new LoginRequest(\"test\", \"password\", \"basic\", null);\n user.getSecurity().setPassword(d",
"end": 1128,
"score": 0.9196087718009949,
"start": 1123,
"tag": "PASSWORD",
"value": "basic"
},
{
"context": "inRequest = new LoginRequest(\"test\", \"password\", \"basic\", null);\n user.getSecurity().setPassword(d",
"end": 1795,
"score": 0.8102178573608398,
"start": 1790,
"tag": "PASSWORD",
"value": "basic"
}
] | null | [] | package com.filos.users.services.security.methods;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.codec.digest.MessageDigestAlgorithms;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import com.filos.users.repository.model.User;
import com.filos.users.services.security.exceptions.InvalidLoginRequest;
import com.filos.users.utils.generators.UsersGenerator;
import com.filos.users.web.requests.LoginRequest;
@DisplayName("When a user try to auth using basic")
class BasicAuthenticationServiceTest {
private final UsersGenerator usersGenerator = new UsersGenerator();
private final DigestUtils digestUtils = new DigestUtils(MessageDigestAlgorithms.SHA3_256);
@Test
@DisplayName("It should allow if is correct request")
public void testWhenValid() {
BasicAuthenticationService basicAuthenticationService = new BasicAuthenticationService(
digestUtils);
User user = usersGenerator.createUser();
LoginRequest loginRequest = new LoginRequest("test", "password", "<PASSWORD>", null);
user.getSecurity().setPassword(digestUtils.digestAsHex(loginRequest.getPassword()));
// When
Assertions.assertThatCode(() -> basicAuthenticationService.tryToApproveLogin(loginRequest, user))
// Then
.doesNotThrowAnyException();
}
@Test
@DisplayName("it should not allow if request is invalid")
public void testWhenInvalid() {
BasicAuthenticationService basicAuthenticationService = new BasicAuthenticationService(
digestUtils);
User user = usersGenerator.createUser();
LoginRequest loginRequest = new LoginRequest("test", "password", "<PASSWORD>", null);
user.getSecurity().setPassword(digestUtils.digestAsHex("other password"));
// When
Assertions.assertThatThrownBy(() -> basicAuthenticationService.tryToApproveLogin(loginRequest, user))
// Then
.isInstanceOf(InvalidLoginRequest.class);
}
} | 2,117 | 0.725676 | 0.723778 | 47 | 43.851063 | 32.065079 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.638298 | false | false | 2 |
79458efb2f2dd67ffc2d10f43caea6185870cc9f | 15,092,515,144,801 | ccba1df770c3641f486263011dd5eba934ac423a | /client/src/main/java/cf/dropsonde/metron/DropsondeException.java | f0e47e47ca4e422187b18d0e7b0b65d3559b8e33 | [
"Apache-2.0"
] | permissive | cloudfoundry-community/snotel | https://github.com/cloudfoundry-community/snotel | 3451755985e7d8badaa1604dd6535957d2eb07c9 | d1466ec6e3790fa35a26244f15e5211648f1c22a | refs/heads/master | 2023-07-19T13:32:07.796000 | 2017-01-06T05:34:55 | 2017-01-06T05:34:55 | 34,878,049 | 7 | 6 | Apache-2.0 | false | 2021-08-04T23:36:13 | 2015-04-30T21:37:06 | 2021-04-13T06:16:18 | 2021-08-04T23:36:13 | 108 | 5 | 6 | 6 | Java | false | false | package cf.dropsonde.metron;
/**
* @author Mike Heath
*/
public class DropsondeException extends RuntimeException {
public DropsondeException(Throwable cause) {
super(cause);
}
}
| UTF-8 | Java | 186 | java | DropsondeException.java | Java | [
{
"context": "package cf.dropsonde.metron;\n\n/**\n * @author Mike Heath\n */\npublic class DropsondeException extends Runti",
"end": 55,
"score": 0.9997571706771851,
"start": 45,
"tag": "NAME",
"value": "Mike Heath"
}
] | null | [] | package cf.dropsonde.metron;
/**
* @author <NAME>
*/
public class DropsondeException extends RuntimeException {
public DropsondeException(Throwable cause) {
super(cause);
}
}
| 182 | 0.747312 | 0.747312 | 10 | 17.6 | 19.402061 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 2 |
76aeb3b6af2129d9766c5fa42ae075e58140c7cc | 15,092,515,144,759 | 302f9bcb750ecbfdb09810f27320ac16f1319c09 | /src/test/java/comp/pype/helpers/FluentialWaitHelper.java | ffd649fb8c9513a96e14faf98307aababf494019 | [] | no_license | megpha/sonic | https://github.com/megpha/sonic | 011df7060801b3a02bd36693fb8c457b68b2a5db | 78f06d489e3a18ec2a81d8eed354ad8bd5f430b5 | refs/heads/master | 2020-06-16T10:11:31.495000 | 2016-11-29T18:46:07 | 2016-11-29T18:46:07 | 75,115,413 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package comp.pype.helpers;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.FluentWait;
import com.google.common.base.Function;
public class FluentialWaitHelper {
public static FluentWait<WebDriver> createWait(final WebDriver driver) {
return new FluentWait<WebDriver>(driver).withTimeout(30, TimeUnit.SECONDS).pollingEvery(5, TimeUnit.SECONDS)
.ignoring(NoSuchElementException.class);
}
public static void waitForElementVisible(final WebDriver driver, final By targetElement) {
createWait(driver).until(new Function<WebDriver, WebElement>() {
public WebElement apply(WebDriver driver) {
return driver.findElement(targetElement);
}
});
}
}
| UTF-8 | Java | 855 | java | FluentialWaitHelper.java | Java | [] | null | [] | package comp.pype.helpers;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.FluentWait;
import com.google.common.base.Function;
public class FluentialWaitHelper {
public static FluentWait<WebDriver> createWait(final WebDriver driver) {
return new FluentWait<WebDriver>(driver).withTimeout(30, TimeUnit.SECONDS).pollingEvery(5, TimeUnit.SECONDS)
.ignoring(NoSuchElementException.class);
}
public static void waitForElementVisible(final WebDriver driver, final By targetElement) {
createWait(driver).until(new Function<WebDriver, WebElement>() {
public WebElement apply(WebDriver driver) {
return driver.findElement(targetElement);
}
});
}
}
| 855 | 0.795322 | 0.791813 | 26 | 31.884615 | 29.804913 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.5 | false | false | 2 |
8f7dbaaaf406865a142f8415047c146bb35d1dfc | 32,865,089,807,881 | 85eeed4a2022354bdfd8908fa8121ecff3741005 | /ssSfDec2020/src/com/ss/sf/lms/dao/BranchDAO.java | 7f0d4f8f707d2cc68eed16af799e72705f424d83 | [] | no_license | simon-sawyer/ss-sf-dec2020 | https://github.com/simon-sawyer/ss-sf-dec2020 | e4fdbba0d885458c86adfda29151d728da274c80 | d227d7254872d4842cc4d60e2c010eac438da5ad | refs/heads/master | 2023-02-08T12:52:03.063000 | 2020-12-31T22:29:50 | 2020-12-31T22:29:50 | 321,724,092 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ss.sf.lms.dao;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.ss.sf.lms.domain.LibraryBranch;
public class BranchDAO extends BaseDAO {
public void addBranch(LibraryBranch branch) throws ClassNotFoundException, SQLException{
save("Insert into tbl_library_branch Values (?, ?, ?)",
new Object[] {branch.getBranchId(), branch.getBranchName(), branch.getBranchAddress()});
}
public void updateBranch(LibraryBranch branch) throws ClassNotFoundException, SQLException{
save("Update tbl_library_branch Set branchName = ?, branchAddress = ? Where branchId = ?",
new Object[] {branch.getBranchName(), branch.getBranchAddress(), branch.getBranchId()});
}
public void deleteBranch(LibraryBranch branch) throws ClassNotFoundException, SQLException{
save("Delete From tbl_library_branch Where branchId = ?",
new Object[] {branch.getBranchId()});
}
public LibraryBranch getBranch(int branchId) throws ClassNotFoundException, SQLException{
pstmt = getConnection().prepareStatement("Select * From tbl_library_branch Where branchId = ?");
pstmt.setInt(1, branchId);
ResultSet rs = pstmt.executeQuery();
if(rs.next()){
return new LibraryBranch(rs.getInt("branchId"), rs.getString("branchName"), rs.getString("branchAddress"));
}else{
return null;
}
}
public List<LibraryBranch> readBranches() throws ClassNotFoundException, SQLException{
List<LibraryBranch> branchList = new ArrayList<LibraryBranch>();
pstmt = getConnection().prepareStatement("Select * From tbl_library_branch");
ResultSet rs = pstmt.executeQuery();
while(rs.next()){
branchList.add(new LibraryBranch(rs.getInt("branchId"), rs.getString("branchName"), rs.getString("branchAddress")));
}
return branchList;
}
}
| UTF-8 | Java | 1,867 | java | BranchDAO.java | Java | [] | null | [] | package com.ss.sf.lms.dao;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.ss.sf.lms.domain.LibraryBranch;
public class BranchDAO extends BaseDAO {
public void addBranch(LibraryBranch branch) throws ClassNotFoundException, SQLException{
save("Insert into tbl_library_branch Values (?, ?, ?)",
new Object[] {branch.getBranchId(), branch.getBranchName(), branch.getBranchAddress()});
}
public void updateBranch(LibraryBranch branch) throws ClassNotFoundException, SQLException{
save("Update tbl_library_branch Set branchName = ?, branchAddress = ? Where branchId = ?",
new Object[] {branch.getBranchName(), branch.getBranchAddress(), branch.getBranchId()});
}
public void deleteBranch(LibraryBranch branch) throws ClassNotFoundException, SQLException{
save("Delete From tbl_library_branch Where branchId = ?",
new Object[] {branch.getBranchId()});
}
public LibraryBranch getBranch(int branchId) throws ClassNotFoundException, SQLException{
pstmt = getConnection().prepareStatement("Select * From tbl_library_branch Where branchId = ?");
pstmt.setInt(1, branchId);
ResultSet rs = pstmt.executeQuery();
if(rs.next()){
return new LibraryBranch(rs.getInt("branchId"), rs.getString("branchName"), rs.getString("branchAddress"));
}else{
return null;
}
}
public List<LibraryBranch> readBranches() throws ClassNotFoundException, SQLException{
List<LibraryBranch> branchList = new ArrayList<LibraryBranch>();
pstmt = getConnection().prepareStatement("Select * From tbl_library_branch");
ResultSet rs = pstmt.executeQuery();
while(rs.next()){
branchList.add(new LibraryBranch(rs.getInt("branchId"), rs.getString("branchName"), rs.getString("branchAddress")));
}
return branchList;
}
}
| 1,867 | 0.72737 | 0.726834 | 47 | 37.723404 | 37.486851 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.212766 | false | false | 2 |
55f7a0dc817c0000233ef20d23bc6624d83033b9 | 30,090,540,894,257 | 3d2b5af1684842c64bdf4e3a3cb862fb85828120 | /src/main/java/fr/pimouss/ffss/client/controller/AdministrationController.java | 926c134ce0dbd63fef2425dd69c5516c07735f87 | [] | no_license | Pimouss/FFSS-Tenue | https://github.com/Pimouss/FFSS-Tenue | fcb265f65a93e44f5a1ae7f0f5cd189ba678ee69 | e2bf7a4bddc9c96b6e120085028e601a5a823e9b | refs/heads/master | 2019-07-08T03:33:25.721000 | 2017-09-27T17:18:49 | 2017-09-27T17:18:49 | 88,252,963 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package fr.pimouss.ffss.client.controller;
import java.io.IOException;
import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.RemoteService;
import fr.pimouss.ffss.shared.dao.UtilisateurDo;
import fr.pimouss.ffss.shared.exception.ApplicationException;
import fr.pimouss.ffss.shared.exception.DaoException;
import fr.pimouss.ffss.shared.service.SurveillanceBo;
/**
* @author Pimouss - http://www.pimouss-land.fr
*/
public class AdministrationController {
/*---------------------------------------------------------------------------------------------*/
public interface IFace extends RemoteService {
boolean isLogClient() throws IOException;
UtilisateurDo connect(String login, String password) throws ApplicationException, IOException;
UtilisateurDo connectByToken(String token) throws ApplicationException, IOException;
void motDePassePerdu(String mail) throws ApplicationException, IOException;
void changePassword(Long idUser, String password, String newPassword) throws ApplicationException;
String[] getNumVersion() throws ApplicationException;
boolean isUserAdministrateur(long idUser) throws DaoException;
void forceSaveDatabase();
List<SurveillanceBo> getLastAction() throws DaoException;
}
/*---------------------------------------------------------------------------------------------*/
public interface IFaceAsync {
void isLogClient(AsyncCallback<Boolean> callback);
void connect(String login, String password, AsyncCallback<UtilisateurDo> callback);
void connectByToken(String token, AsyncCallback<UtilisateurDo> callback);
void motDePassePerdu(String mail, AsyncCallback<Void> callback);
void changePassword(Long idUser, String password, String newPassword, AsyncCallback<Void> callback);
void getNumVersion(AsyncCallback<String[]> callback);
void isUserAdministrateur(long idUser, AsyncCallback<Boolean> callback);
void forceSaveDatabase(AsyncCallback<Void> callback);
void getLastAction(AsyncCallback<List<SurveillanceBo>> callback);
}
/*---------------------------------------------------------------------------------------------*/
}
| UTF-8 | Java | 2,208 | java | AdministrationController.java | Java | [
{
"context": ".shared.service.SurveillanceBo;\r\n\r\n/**\r\n * @author Pimouss - http://www.pimouss-land.fr\r\n */\r\npublic class A",
"end": 459,
"score": 0.9711819291114807,
"start": 452,
"tag": "NAME",
"value": "Pimouss"
}
] | null | [] | package fr.pimouss.ffss.client.controller;
import java.io.IOException;
import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.RemoteService;
import fr.pimouss.ffss.shared.dao.UtilisateurDo;
import fr.pimouss.ffss.shared.exception.ApplicationException;
import fr.pimouss.ffss.shared.exception.DaoException;
import fr.pimouss.ffss.shared.service.SurveillanceBo;
/**
* @author Pimouss - http://www.pimouss-land.fr
*/
public class AdministrationController {
/*---------------------------------------------------------------------------------------------*/
public interface IFace extends RemoteService {
boolean isLogClient() throws IOException;
UtilisateurDo connect(String login, String password) throws ApplicationException, IOException;
UtilisateurDo connectByToken(String token) throws ApplicationException, IOException;
void motDePassePerdu(String mail) throws ApplicationException, IOException;
void changePassword(Long idUser, String password, String newPassword) throws ApplicationException;
String[] getNumVersion() throws ApplicationException;
boolean isUserAdministrateur(long idUser) throws DaoException;
void forceSaveDatabase();
List<SurveillanceBo> getLastAction() throws DaoException;
}
/*---------------------------------------------------------------------------------------------*/
public interface IFaceAsync {
void isLogClient(AsyncCallback<Boolean> callback);
void connect(String login, String password, AsyncCallback<UtilisateurDo> callback);
void connectByToken(String token, AsyncCallback<UtilisateurDo> callback);
void motDePassePerdu(String mail, AsyncCallback<Void> callback);
void changePassword(Long idUser, String password, String newPassword, AsyncCallback<Void> callback);
void getNumVersion(AsyncCallback<String[]> callback);
void isUserAdministrateur(long idUser, AsyncCallback<Boolean> callback);
void forceSaveDatabase(AsyncCallback<Void> callback);
void getLastAction(AsyncCallback<List<SurveillanceBo>> callback);
}
/*---------------------------------------------------------------------------------------------*/
}
| 2,208 | 0.688406 | 0.688406 | 46 | 46 | 33.107204 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.826087 | false | false | 2 |
84cc25e08a6a62d191458ea88a06547c69cba24a | 17,824,114,297,565 | a45f236bdfd668f9d7c9a1c950561b9f53436a24 | /src/main/java/com/lviv/main/controller/admin/MoviesManageController.java | 29cceb160f6ff67e25fe7418e4a083f52abe7953 | [] | no_license | AndriyKhymera/MovieList | https://github.com/AndriyKhymera/MovieList | 3540d934ad353d65b2066f0b7a300727fd6b4d92 | d86e7c07ef93145e84e1f355cdfe2d491a9cd7db | refs/heads/master | 2020-02-28T15:32:14.846000 | 2019-11-19T08:54:07 | 2019-11-19T08:54:07 | 87,709,703 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lviv.main.controller.admin;
import com.lviv.main.dao.MovieDao;
import com.lviv.main.dto.MovieDto;
import com.lviv.main.dto.MovieUpdateDto;
import com.lviv.main.service.MovieService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
/**
* Created by andrii on 12.04.17.
*/
@Controller
public class MoviesManageController {
@Autowired
private MovieService movieService;
@RequestMapping(value = "/admin/movie/all", method = RequestMethod.GET)
public String getAllMovies(Model model){
model.addAttribute("movies", movieService.getAll());
return "/admin/admin-movies";
}
@RequestMapping(value = "/admin/movie/update", method = RequestMethod.POST)
public ModelAndView updateMovie(@RequestBody MovieUpdateDto movieDto){
movieService.update(movieDto);
return new ModelAndView("redirect:/admin/movie/all");
}
@RequestMapping(value = "/admin/movie/add", method = RequestMethod.POST)
public String addMovie(@RequestBody MovieDto movieDto){
System.out.println(movieDto);
movieService.add(movieDto);
return "redirect:/admin/movie/all";
}
@RequestMapping(value = "/admin/movie/add", method = RequestMethod.GET)
public String addMovie(){
return "/admin/admin-add-movie";
}
}
| UTF-8 | Java | 1,702 | java | MoviesManageController.java | Java | [
{
"context": "ework.web.servlet.ModelAndView;\n\n/**\n * Created by andrii on 12.04.17.\n */\n@Controller\npublic class MoviesM",
"end": 669,
"score": 0.997260332107544,
"start": 663,
"tag": "USERNAME",
"value": "andrii"
}
] | null | [] | package com.lviv.main.controller.admin;
import com.lviv.main.dao.MovieDao;
import com.lviv.main.dto.MovieDto;
import com.lviv.main.dto.MovieUpdateDto;
import com.lviv.main.service.MovieService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
/**
* Created by andrii on 12.04.17.
*/
@Controller
public class MoviesManageController {
@Autowired
private MovieService movieService;
@RequestMapping(value = "/admin/movie/all", method = RequestMethod.GET)
public String getAllMovies(Model model){
model.addAttribute("movies", movieService.getAll());
return "/admin/admin-movies";
}
@RequestMapping(value = "/admin/movie/update", method = RequestMethod.POST)
public ModelAndView updateMovie(@RequestBody MovieUpdateDto movieDto){
movieService.update(movieDto);
return new ModelAndView("redirect:/admin/movie/all");
}
@RequestMapping(value = "/admin/movie/add", method = RequestMethod.POST)
public String addMovie(@RequestBody MovieDto movieDto){
System.out.println(movieDto);
movieService.add(movieDto);
return "redirect:/admin/movie/all";
}
@RequestMapping(value = "/admin/movie/add", method = RequestMethod.GET)
public String addMovie(){
return "/admin/admin-add-movie";
}
}
| 1,702 | 0.745006 | 0.741481 | 50 | 33.040001 | 25.698996 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.54 | false | false | 2 |
a5a349c0245c76d46ee25583533fc07541eac3ee | 9,131,100,471,899 | ed84bde624ca9d6e51b6e7502f3d965701528cf1 | /EscuelaDeAventuras/app/src/main/java/com/example/gonzalo/escueladeaventuras/activity/ExpandableEndLevelActivity.java | 788474aaaf2669c47833bfcd8667b2dd9bed3d5c | [] | no_license | gonzalocozzi/escueladeaventuras | https://github.com/gonzalocozzi/escueladeaventuras | 54cad321dc411eee36b156f5d086f75c3460e41e | 85fb82a83bdb065038b9af6a740734d2d2ff568a | refs/heads/master | 2019-12-15T04:16:26.076000 | 2016-06-27T19:46:20 | 2016-06-27T19:46:20 | 56,601,051 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.gonzalo.escueladeaventuras.activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ExpandableListView;
import android.widget.TextView;
import com.example.gonzalo.escueladeaventuras.R;
import com.example.gonzalo.escueladeaventuras.adapter.ExpandableListAdapter;
import com.example.gonzalo.escueladeaventuras.metadata.EscuelaDeAventuras;
import com.example.gonzalo.escueladeaventuras.metadata.Exercise;
import com.example.gonzalo.escueladeaventuras.metadata.ExerciseType;
import com.example.gonzalo.escueladeaventuras.metadata.Level;
import com.example.gonzalo.escueladeaventuras.metadata.Player;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import butterknife.Bind;
import butterknife.ButterKnife;
/**
* Created by gonzalo on 21/05/16.
*/
public class ExpandableEndLevelActivity extends MainActivity {
private ExpandableListAdapter listAdapter;
private List<String> listDataHeader;
private HashMap<String, ArrayList<Object>> listDataChild;
@Bind(R.id.nextButton)
Button nextButton;
@Bind(R.id.textLevel)
TextView currentLevel;
@Bind(R.id.levelPlayerPunctuation)
TextView levelPlayerPunctuation;
@Bind(R.id.endLevelListView)
ExpandableListView expListView ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_end_level_expandable);
ButterKnife.bind(this);
this.setCabecera();
this.initializeAttribute();
}
private void initializeAttribute(){
this.prepareListData();
this.listAdapter = new ExpandableListAdapter(this, this.listDataHeader, this.listDataChild);
this.expListView.setAdapter(listAdapter);
expListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v,
int groupPosition, long id) {
setListViewHeight(parent, groupPosition);
return false;
}
});
Integer maxLevel = game.getMaxLevel();
Integer currentLevel = game.getNumberCurrentLevel();
if (currentLevel == maxLevel) {
nextButton.setVisibility(View.INVISIBLE);
}
}
private void setCabecera() {
currentLevel.setText("Nivel " + game.getNumberCurrentLevel());
String levelPunctuation = String.valueOf(game.getPlayerPunctuationToCurrentLevel());
levelPlayerPunctuation.setText(levelPunctuation + " puntos ");
}
private void prepareListData() {
ArrayList<Exercise> exercises = game.getExcerciseToCurrentLevel();
this.listDataHeader = new ArrayList<>();
this.listDataChild = new HashMap<>();
Exercise currentExercise;
for (int i =0; i < exercises.size(); i++){
currentExercise = exercises.get(i);
String currentExerciseDescription = currentExercise.getDescription();
//Se establece el contenido de cada cabecera de ejercicio
listDataHeader.add(currentExerciseDescription);
listDataChild.put(currentExerciseDescription, new ArrayList<>());
listDataChild.get(currentExerciseDescription).add(currentExercise.getAnswer());
}
}
private void setListViewHeight(ExpandableListView listView,
int group) {
ExpandableListAdapter listAdapter = (ExpandableListAdapter) listView.getExpandableListAdapter();
int totalHeight = 0;
int desiredWidth = View.MeasureSpec.makeMeasureSpec(listView.getWidth(),
View.MeasureSpec.EXACTLY);
for (int i = 0; i < listAdapter.getGroupCount(); i++) {
View groupItem = listAdapter.getGroupView(i, false, null, listView);
groupItem.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED);
totalHeight += groupItem.getMeasuredHeight();
if (((listView.isGroupExpanded(i)) && (i != group))
|| ((!listView.isGroupExpanded(i)) && (i == group))) {
for (int j = 0; j < listAdapter.getChildrenCount(i); j++) {
View listItem = listAdapter.getChildView(i, j, false, null,
listView);
listItem.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED);
totalHeight += listItem.getMeasuredHeight();
}
}
}
ViewGroup.LayoutParams params = listView.getLayoutParams();
int height = totalHeight
+ (listView.getDividerHeight() * (listAdapter.getGroupCount() - 1));
if (height < 10 || height > 600)
height = 600;
params.height = height;
listView.setLayoutParams(params);
listView.requestLayout();
}
public void setLayout(ExerciseType type){
Intent intent = new Intent(ExpandableEndLevelActivity.this, type.getActivity());
startActivity(intent);
}
public void onNextButtonClick(View view){
Integer nextLevelNumber = game.getNumberCurrentLevel() + 1;
Level currentLevel = game.getLevel(nextLevelNumber);
Player player = game.getPlayer();
player.setLevel(currentLevel);
currentLevel.resetCurrentExerciseIndex();
currentLevel.setRandomExercisesCollection();
this.setLayout(game.getCurrentExercise().getType());
}
public void onRankingButtonClick(View view){
Intent intent = new Intent(ExpandableEndLevelActivity.this, RecordActivity.class);
startActivity(intent);
}
@Override
public void onBackPressed() {
}
}
| UTF-8 | Java | 5,935 | java | ExpandableEndLevelActivity.java | Java | [
{
"context": "import butterknife.ButterKnife;\n\n/**\n * Created by gonzalo on 21/05/16.\n */\npublic class ExpandableEndLevelA",
"end": 948,
"score": 0.9997053146362305,
"start": 941,
"tag": "USERNAME",
"value": "gonzalo"
}
] | null | [] | package com.example.gonzalo.escueladeaventuras.activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ExpandableListView;
import android.widget.TextView;
import com.example.gonzalo.escueladeaventuras.R;
import com.example.gonzalo.escueladeaventuras.adapter.ExpandableListAdapter;
import com.example.gonzalo.escueladeaventuras.metadata.EscuelaDeAventuras;
import com.example.gonzalo.escueladeaventuras.metadata.Exercise;
import com.example.gonzalo.escueladeaventuras.metadata.ExerciseType;
import com.example.gonzalo.escueladeaventuras.metadata.Level;
import com.example.gonzalo.escueladeaventuras.metadata.Player;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import butterknife.Bind;
import butterknife.ButterKnife;
/**
* Created by gonzalo on 21/05/16.
*/
public class ExpandableEndLevelActivity extends MainActivity {
private ExpandableListAdapter listAdapter;
private List<String> listDataHeader;
private HashMap<String, ArrayList<Object>> listDataChild;
@Bind(R.id.nextButton)
Button nextButton;
@Bind(R.id.textLevel)
TextView currentLevel;
@Bind(R.id.levelPlayerPunctuation)
TextView levelPlayerPunctuation;
@Bind(R.id.endLevelListView)
ExpandableListView expListView ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_end_level_expandable);
ButterKnife.bind(this);
this.setCabecera();
this.initializeAttribute();
}
private void initializeAttribute(){
this.prepareListData();
this.listAdapter = new ExpandableListAdapter(this, this.listDataHeader, this.listDataChild);
this.expListView.setAdapter(listAdapter);
expListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v,
int groupPosition, long id) {
setListViewHeight(parent, groupPosition);
return false;
}
});
Integer maxLevel = game.getMaxLevel();
Integer currentLevel = game.getNumberCurrentLevel();
if (currentLevel == maxLevel) {
nextButton.setVisibility(View.INVISIBLE);
}
}
private void setCabecera() {
currentLevel.setText("Nivel " + game.getNumberCurrentLevel());
String levelPunctuation = String.valueOf(game.getPlayerPunctuationToCurrentLevel());
levelPlayerPunctuation.setText(levelPunctuation + " puntos ");
}
private void prepareListData() {
ArrayList<Exercise> exercises = game.getExcerciseToCurrentLevel();
this.listDataHeader = new ArrayList<>();
this.listDataChild = new HashMap<>();
Exercise currentExercise;
for (int i =0; i < exercises.size(); i++){
currentExercise = exercises.get(i);
String currentExerciseDescription = currentExercise.getDescription();
//Se establece el contenido de cada cabecera de ejercicio
listDataHeader.add(currentExerciseDescription);
listDataChild.put(currentExerciseDescription, new ArrayList<>());
listDataChild.get(currentExerciseDescription).add(currentExercise.getAnswer());
}
}
private void setListViewHeight(ExpandableListView listView,
int group) {
ExpandableListAdapter listAdapter = (ExpandableListAdapter) listView.getExpandableListAdapter();
int totalHeight = 0;
int desiredWidth = View.MeasureSpec.makeMeasureSpec(listView.getWidth(),
View.MeasureSpec.EXACTLY);
for (int i = 0; i < listAdapter.getGroupCount(); i++) {
View groupItem = listAdapter.getGroupView(i, false, null, listView);
groupItem.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED);
totalHeight += groupItem.getMeasuredHeight();
if (((listView.isGroupExpanded(i)) && (i != group))
|| ((!listView.isGroupExpanded(i)) && (i == group))) {
for (int j = 0; j < listAdapter.getChildrenCount(i); j++) {
View listItem = listAdapter.getChildView(i, j, false, null,
listView);
listItem.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED);
totalHeight += listItem.getMeasuredHeight();
}
}
}
ViewGroup.LayoutParams params = listView.getLayoutParams();
int height = totalHeight
+ (listView.getDividerHeight() * (listAdapter.getGroupCount() - 1));
if (height < 10 || height > 600)
height = 600;
params.height = height;
listView.setLayoutParams(params);
listView.requestLayout();
}
public void setLayout(ExerciseType type){
Intent intent = new Intent(ExpandableEndLevelActivity.this, type.getActivity());
startActivity(intent);
}
public void onNextButtonClick(View view){
Integer nextLevelNumber = game.getNumberCurrentLevel() + 1;
Level currentLevel = game.getLevel(nextLevelNumber);
Player player = game.getPlayer();
player.setLevel(currentLevel);
currentLevel.resetCurrentExerciseIndex();
currentLevel.setRandomExercisesCollection();
this.setLayout(game.getCurrentExercise().getType());
}
public void onRankingButtonClick(View view){
Intent intent = new Intent(ExpandableEndLevelActivity.this, RecordActivity.class);
startActivity(intent);
}
@Override
public void onBackPressed() {
}
}
| 5,935 | 0.673463 | 0.669924 | 167 | 34.538921 | 28.382071 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.664671 | false | false | 2 |
62a24f2235428646e907be0e3a2b6602244f520d | 25,967,372,275,589 | fa43822420627a6b33bf4f317e5fc2c139278018 | /app/src/main/java/com/digisineproducts/windbine/LifeCycleCallbacks.java | e115e24e066763fcffef5b9d4b26169f31daef63 | [] | no_license | digisine-rd/wind_mppt_app | https://github.com/digisine-rd/wind_mppt_app | 97e9fd4b34973b0efdebd450b9f428cd5d15277a | c6e3958dd43320d8931d0539b67e8fc0286d658d | refs/heads/master | 2022-05-29T06:45:41.209000 | 2022-05-03T01:42:28 | 2022-05-03T01:42:28 | 189,992,639 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.digisineproducts.windbine;
import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
import android.os.Handler;
import com.digisineproducts.windbine.module.Device;
/**
* Created by user on 2016/6/8.
*/
public class LifeCycleCallbacks implements Application.ActivityLifecycleCallbacks{
public static final long CHECK_DELAY = 500;
private Handler handler = new Handler();
private static LifeCycleCallbacks instance;
private boolean isForeground;
private boolean isPause;
private Device mCurrentConnectedDevice;
private Runnable reconnectRunnable = new Runnable() {
@Override
public void run() {
if(mCurrentConnectedDevice != null && !mCurrentConnectedDevice.isConnected()){
mCurrentConnectedDevice.connect();
handler.postDelayed(reconnectRunnable,30000);
}
}
};
public static LifeCycleCallbacks getInstance(){
return instance;
}
public void setConnectedDevice(Device device){
mCurrentConnectedDevice = device;
}
public static void init(Application app){
if (instance == null){
instance = new LifeCycleCallbacks();
app.registerActivityLifecycleCallbacks(instance);
}
}
public static LifeCycleCallbacks get(){
return instance;
}
public void pause(){
isPause = true;
}
public void resume(){
isPause = false;
}
private LifeCycleCallbacks(){
isForeground = false;
isPause = false;
}
@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
}
@Override
public void onActivityStarted(Activity activity) {
}
@Override
public void onActivityResumed(Activity activity) {
isForeground = true;
if(mCurrentConnectedDevice != null && !mCurrentConnectedDevice.isConnected()){
handler.post(reconnectRunnable);
}
}
@Override
public void onActivityPaused(final Activity activity) {
isForeground = false;
handler.postDelayed(new Runnable() {
@Override
public void run() {
if(!isForeground && !isPause){
handler.removeCallbacks(reconnectRunnable);
if(mCurrentConnectedDevice != null) {
mCurrentConnectedDevice.disconnect();
}
}
}
},CHECK_DELAY);
}
@Override
public void onActivityStopped(Activity activity) {
}
@Override
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
}
@Override
public void onActivityDestroyed(Activity activity) {
}
}
| UTF-8 | Java | 2,806 | java | LifeCycleCallbacks.java | Java | [
{
"context": "roducts.windbine.module.Device;\n\n/**\n * Created by user on 2016/6/8.\n */\npublic class LifeCycleCallbacks ",
"end": 230,
"score": 0.727462649345398,
"start": 226,
"tag": "USERNAME",
"value": "user"
}
] | null | [] | package com.digisineproducts.windbine;
import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
import android.os.Handler;
import com.digisineproducts.windbine.module.Device;
/**
* Created by user on 2016/6/8.
*/
public class LifeCycleCallbacks implements Application.ActivityLifecycleCallbacks{
public static final long CHECK_DELAY = 500;
private Handler handler = new Handler();
private static LifeCycleCallbacks instance;
private boolean isForeground;
private boolean isPause;
private Device mCurrentConnectedDevice;
private Runnable reconnectRunnable = new Runnable() {
@Override
public void run() {
if(mCurrentConnectedDevice != null && !mCurrentConnectedDevice.isConnected()){
mCurrentConnectedDevice.connect();
handler.postDelayed(reconnectRunnable,30000);
}
}
};
public static LifeCycleCallbacks getInstance(){
return instance;
}
public void setConnectedDevice(Device device){
mCurrentConnectedDevice = device;
}
public static void init(Application app){
if (instance == null){
instance = new LifeCycleCallbacks();
app.registerActivityLifecycleCallbacks(instance);
}
}
public static LifeCycleCallbacks get(){
return instance;
}
public void pause(){
isPause = true;
}
public void resume(){
isPause = false;
}
private LifeCycleCallbacks(){
isForeground = false;
isPause = false;
}
@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
}
@Override
public void onActivityStarted(Activity activity) {
}
@Override
public void onActivityResumed(Activity activity) {
isForeground = true;
if(mCurrentConnectedDevice != null && !mCurrentConnectedDevice.isConnected()){
handler.post(reconnectRunnable);
}
}
@Override
public void onActivityPaused(final Activity activity) {
isForeground = false;
handler.postDelayed(new Runnable() {
@Override
public void run() {
if(!isForeground && !isPause){
handler.removeCallbacks(reconnectRunnable);
if(mCurrentConnectedDevice != null) {
mCurrentConnectedDevice.disconnect();
}
}
}
},CHECK_DELAY);
}
@Override
public void onActivityStopped(Activity activity) {
}
@Override
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
}
@Override
public void onActivityDestroyed(Activity activity) {
}
}
| 2,806 | 0.631504 | 0.626515 | 114 | 23.614035 | 23.448528 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.298246 | false | false | 2 |
9b23100cf72fddcc7e815f687513a79e7ed2c269 | 27,728,308,876,056 | a2ffd9b89450e5316a674876dea5c8b5a4003036 | /data-library/src/main/java/cz/idc/Exporter.java | 4fff2ce7d6c4022f8b2f684753833acd4c65db5f | [] | no_license | lubosvr/Reports | https://github.com/lubosvr/Reports | 36002c329b581ece8eb90280672a6faf70721cd1 | 9684def16b11c012c3f6c1e081ffa9d1b05a1e69 | refs/heads/master | 2023-06-25T01:00:35.807000 | 2021-07-23T07:31:52 | 2021-07-23T07:31:52 | 388,585,843 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cz.idc;
public interface Exporter {
String convertToString(Report report);
}
| UTF-8 | Java | 90 | java | Exporter.java | Java | [] | null | [] | package cz.idc;
public interface Exporter {
String convertToString(Report report);
}
| 90 | 0.755556 | 0.755556 | 5 | 17 | 15.962456 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 2 |
628b46bcedf805f86ed0dd78b82f77435a0d5ee7 | 27,118,423,552,687 | 4da2f71e22a89b9b3792dd166c4a81c2bd1f8c0d | /pulil-lintcode/src/main/java/binarytree/Q481_binaryTreeLeafSum.java | 8500276cc541a18e7f98bb602f369074fd31993a | [] | no_license | mlw12345678/LintCode | https://github.com/mlw12345678/LintCode | 447c27c08748b008b071ed85aea4749b0b5620ae | a099aec86b4a7d7eab11aa09adeded5a5aa06f8c | refs/heads/master | 2020-04-18T13:51:16.032000 | 2019-02-27T10:15:54 | 2019-02-27T10:15:54 | 167,507,005 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package binarytree;
import org.junit.Test;
import sun.jvm.hotspot.code.ConstantOopReadValue;
import java.util.LinkedList;
import java.util.Queue;
/**
* @author pulil
* @version V1.0
* @Title
* @Description
* @date 2019-02-26 下午10:56
*/
public class Q481_binaryTreeLeafSum {
/**
* Question:计算二叉树的叶子节点之和
*
* 样例1:
* 输入:
* 1
* / \
* 2 3
* /
* 4
* 输出:7
*
* 样例2:
* 输入:
* 1
* \
* 3
* 输出:3
*/
/**
* Solution:
* 关键在于识别所有的叶子节点,即左右子树都为空,就把叶子节点加一下
* 本题采用广度优先搜索机制,每次节点的时候判断一下是否为叶子节点
* 当然也可以采用递归
*/
public int leafSum(TreeNode root) {
if(root == null)
return 0;
int result = 0;
Queue<TreeNode> queue = new LinkedList<TreeNode>();
queue.offer(root);
while(!queue.isEmpty()) {
TreeNode temp = queue.poll();
if(temp.left == null && temp.right == null)
result += temp.val;
if(temp.left != null)
queue.offer(temp.left);
if(temp.right != null)
queue.offer(temp.right);
}
return result;
}
@Test
public void test() {
TreeNode root = new TreeNode(1);
root.left = new TreeNode(2);
root.right = new TreeNode(3);
root.left.left = new TreeNode(4);
int result = leafSum(root);
System.out.println(result);
}
}
| UTF-8 | Java | 1,689 | java | Q481_binaryTreeLeafSum.java | Java | [
{
"context": "inkedList;\nimport java.util.Queue;\n\n/**\n * @author pulil\n * @version V1.0\n * @Title\n * @Description\n * @da",
"end": 169,
"score": 0.9993412494659424,
"start": 164,
"tag": "USERNAME",
"value": "pulil"
}
] | null | [] | package binarytree;
import org.junit.Test;
import sun.jvm.hotspot.code.ConstantOopReadValue;
import java.util.LinkedList;
import java.util.Queue;
/**
* @author pulil
* @version V1.0
* @Title
* @Description
* @date 2019-02-26 下午10:56
*/
public class Q481_binaryTreeLeafSum {
/**
* Question:计算二叉树的叶子节点之和
*
* 样例1:
* 输入:
* 1
* / \
* 2 3
* /
* 4
* 输出:7
*
* 样例2:
* 输入:
* 1
* \
* 3
* 输出:3
*/
/**
* Solution:
* 关键在于识别所有的叶子节点,即左右子树都为空,就把叶子节点加一下
* 本题采用广度优先搜索机制,每次节点的时候判断一下是否为叶子节点
* 当然也可以采用递归
*/
public int leafSum(TreeNode root) {
if(root == null)
return 0;
int result = 0;
Queue<TreeNode> queue = new LinkedList<TreeNode>();
queue.offer(root);
while(!queue.isEmpty()) {
TreeNode temp = queue.poll();
if(temp.left == null && temp.right == null)
result += temp.val;
if(temp.left != null)
queue.offer(temp.left);
if(temp.right != null)
queue.offer(temp.right);
}
return result;
}
@Test
public void test() {
TreeNode root = new TreeNode(1);
root.left = new TreeNode(2);
root.right = new TreeNode(3);
root.left.left = new TreeNode(4);
int result = leafSum(root);
System.out.println(result);
}
}
| 1,689 | 0.499662 | 0.47738 | 70 | 20.157143 | 14.580452 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 2 |
63efc2337ef4e699d3b9fe4b95e33b1e01d8952b | 2,516,850,847,029 | e83d708d0a68349a0cc76584efaae152f76e4608 | /example/android/banuba_sdk/src/main/java/com/banuba/sdk/manager/IEventCallback.java | b7e3603426bd13101157e0f9644f15fc8d6b9dcb | [
"MIT"
] | permissive | AbhishekDoshi-Bacancy/AgoraSDK | https://github.com/AbhishekDoshi-Bacancy/AgoraSDK | 9ba290b1cbfd221471342102d255f86fa29c8bde | 030a024e5c10189526cb98b5db86998f8da43864 | refs/heads/master | 2023-06-16T11:28:57.351000 | 2021-07-08T12:31:47 | 2021-07-08T12:31:47 | 384,116,871 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.banuba.sdk.manager;
import android.graphics.Bitmap;
import androidx.annotation.NonNull;
import com.banuba.sdk.entity.RecordedVideoInfo;
import com.banuba.sdk.types.Data;
/**
* Various events callbacks related to events in Banuba SDK.
*/
public interface IEventCallback {
/**
* Failed to open camera. Check camera permissions first.
* @param error error message
*/
void onCameraOpenError(@NonNull Throwable error);
/**
* Camera open status
* @param opened is camera opened
*/
void onCameraStatus(boolean opened);
/**
* @param photo "Screenshot" from camera frames stream with current effect.
*/
void onScreenshotReady(@NonNull Bitmap photo);
/**
* @param photo High resolution photo from camera with current effect.
*/
void onHQPhotoReady(@NonNull Bitmap photo);
/**
* Video recording was finished
* @param videoInfo info about recorded video
*/
void onVideoRecordingFinished(@NonNull RecordedVideoInfo videoInfo);
/**
* Video recording status was changed
* @param started status flag
*/
void onVideoRecordingStatusChange(boolean started);
/**
* Image processing was finished
* @param processedBitmap image with current effect applied
*/
void onImageProcessed(@NonNull Bitmap processedBitmap);
/**
* @param image edited image with current effect applied
*/
default void onEditedImageReady(@NonNull Bitmap image) {
}
/**
* Editing mode face found status
* @param faceFound status flag
*/
default void onEditingModeFaceFound(boolean faceFound) {
}
/**
* Callback to receive rendered frames.
*
* @param data raw RGBA data, you may decode it with
* `Bitmap.copyPixedData()`, use `Bitmap.Config.ARGB_8888`.
* @param width width of the frame
* @param height height of the frame
*/
void onFrameRendered(@NonNull Data data, int width, int height);
/**
* Callback to receive rendered textures requested by
* `BanubaSdkManager.startForwardingTextures`. This method executed in the
* thread which owns the corresponding EGL context. These textures can be
* passed to other libraries, e.g. WebRTC:
* https://chromium.googlesource.com/external/webrtc/+/HEAD/sdk/android/api/org/webrtc/TextureBufferImpl.java
*
* @param texture OES texture http://www.khronos.org/registry/gles/extensions/OES/OES_EGL_image_external.txt
* @param width texture width
* @param height texture height
* @param timestamp timestamp associated with the texture image in nanoseconds
* @param matrix 4x4 texture coordinate transform matrix associated with the texture image.
* This transform matrix maps 2D homogeneous texture coordinates of the form
* (s, t, 0, 1) with s and t in the inclusive range [0, 1] to the texture
* coordinate that should be used to sample that location from the texture.
* Sampling the texture outside of the range of this transform is undefined.
*/
default void onTextureRendered(
int texture,
int width,
int height,
long timestamp,
float[] matrix) {
}
}
| UTF-8 | Java | 3,257 | java | IEventCallback.java | Java | [] | null | [] | package com.banuba.sdk.manager;
import android.graphics.Bitmap;
import androidx.annotation.NonNull;
import com.banuba.sdk.entity.RecordedVideoInfo;
import com.banuba.sdk.types.Data;
/**
* Various events callbacks related to events in Banuba SDK.
*/
public interface IEventCallback {
/**
* Failed to open camera. Check camera permissions first.
* @param error error message
*/
void onCameraOpenError(@NonNull Throwable error);
/**
* Camera open status
* @param opened is camera opened
*/
void onCameraStatus(boolean opened);
/**
* @param photo "Screenshot" from camera frames stream with current effect.
*/
void onScreenshotReady(@NonNull Bitmap photo);
/**
* @param photo High resolution photo from camera with current effect.
*/
void onHQPhotoReady(@NonNull Bitmap photo);
/**
* Video recording was finished
* @param videoInfo info about recorded video
*/
void onVideoRecordingFinished(@NonNull RecordedVideoInfo videoInfo);
/**
* Video recording status was changed
* @param started status flag
*/
void onVideoRecordingStatusChange(boolean started);
/**
* Image processing was finished
* @param processedBitmap image with current effect applied
*/
void onImageProcessed(@NonNull Bitmap processedBitmap);
/**
* @param image edited image with current effect applied
*/
default void onEditedImageReady(@NonNull Bitmap image) {
}
/**
* Editing mode face found status
* @param faceFound status flag
*/
default void onEditingModeFaceFound(boolean faceFound) {
}
/**
* Callback to receive rendered frames.
*
* @param data raw RGBA data, you may decode it with
* `Bitmap.copyPixedData()`, use `Bitmap.Config.ARGB_8888`.
* @param width width of the frame
* @param height height of the frame
*/
void onFrameRendered(@NonNull Data data, int width, int height);
/**
* Callback to receive rendered textures requested by
* `BanubaSdkManager.startForwardingTextures`. This method executed in the
* thread which owns the corresponding EGL context. These textures can be
* passed to other libraries, e.g. WebRTC:
* https://chromium.googlesource.com/external/webrtc/+/HEAD/sdk/android/api/org/webrtc/TextureBufferImpl.java
*
* @param texture OES texture http://www.khronos.org/registry/gles/extensions/OES/OES_EGL_image_external.txt
* @param width texture width
* @param height texture height
* @param timestamp timestamp associated with the texture image in nanoseconds
* @param matrix 4x4 texture coordinate transform matrix associated with the texture image.
* This transform matrix maps 2D homogeneous texture coordinates of the form
* (s, t, 0, 1) with s and t in the inclusive range [0, 1] to the texture
* coordinate that should be used to sample that location from the texture.
* Sampling the texture outside of the range of this transform is undefined.
*/
default void onTextureRendered(
int texture,
int width,
int height,
long timestamp,
float[] matrix) {
}
}
| 3,257 | 0.67946 | 0.676082 | 100 | 31.57 | 29.112284 | 113 | false | false | 0 | 0 | 0 | 0 | 71 | 0.021799 | 0.26 | false | false | 2 |
63c67a537c3ec8c5e8a70ee435570fd117101b98 | 28,209,345,246,113 | 3b17b6a2c5f746c86c5d1ae17112575670f1a76c | /common/common-core/src/main/java/com/codeabovelab/dm/common/meter/LimitExcess.java | e82a86371a8e4c65151153a0e2b6ef0223e26d15 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | soa4java/haven-platform | https://github.com/soa4java/haven-platform | a9cc3f19fecc3f0f3bd2e670aa30d606996d364b | 00cbd5e9a077117052678c60a2c3f9abc906283b | refs/heads/master | 2020-05-27T14:28:19.881000 | 2017-02-20T08:46:08 | 2017-02-20T08:46:08 | 82,558,415 | 3 | 0 | null | true | 2017-02-20T13:01:56 | 2017-02-20T13:01:56 | 2017-02-01T14:11:07 | 2017-02-20T08:46:08 | 2,983 | 0 | 0 | 0 | null | null | null | /*
* Copyright 2016 Code Above Lab LLC
*
* 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.codeabovelab.dm.common.meter;
import com.fasterxml.jackson.annotation.JsonCreator;
/**
* an object which generated at limit excess
*/
public class LimitExcess {
public static class Builder {
private String message;
public String metric;
public String getMessage() {
return message;
}
public Builder message(String message) {
setMessage(message);
return this;
}
public void setMessage(String message) {
this.message = message;
}
public String getMetric() {
return metric;
}
public Builder metric(String metric) {
setMetric(metric);
return this;
}
public void setMetric(String metric) {
this.metric = metric;
}
public LimitExcess build() {
return new LimitExcess(this);
}
}
private final String metric;
private final String message;
@JsonCreator
public LimitExcess(Builder b) {
this.message = b.message;
this.metric = b.metric;
}
public static Builder builder() {
return new Builder();
}
public String getMessage() {
return message;
}
public String getMetric() {
return metric;
}
@Override
public String toString() {
return "LimitExcess{" +
"metric='" + metric + '\'' +
", message='" + message + '\'' +
'}';
}
}
| UTF-8 | Java | 2,121 | java | LimitExcess.java | Java | [] | null | [] | /*
* Copyright 2016 Code Above Lab LLC
*
* 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.codeabovelab.dm.common.meter;
import com.fasterxml.jackson.annotation.JsonCreator;
/**
* an object which generated at limit excess
*/
public class LimitExcess {
public static class Builder {
private String message;
public String metric;
public String getMessage() {
return message;
}
public Builder message(String message) {
setMessage(message);
return this;
}
public void setMessage(String message) {
this.message = message;
}
public String getMetric() {
return metric;
}
public Builder metric(String metric) {
setMetric(metric);
return this;
}
public void setMetric(String metric) {
this.metric = metric;
}
public LimitExcess build() {
return new LimitExcess(this);
}
}
private final String metric;
private final String message;
@JsonCreator
public LimitExcess(Builder b) {
this.message = b.message;
this.metric = b.metric;
}
public static Builder builder() {
return new Builder();
}
public String getMessage() {
return message;
}
public String getMetric() {
return metric;
}
@Override
public String toString() {
return "LimitExcess{" +
"metric='" + metric + '\'' +
", message='" + message + '\'' +
'}';
}
}
| 2,121 | 0.60066 | 0.596888 | 89 | 22.831461 | 20.422083 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.303371 | false | false | 2 |
e3a627bc8d34f3ca039f3307dad65585e866ca12 | 5,755,256,192,036 | 71ed92aa367cec2c793d85f42d8be2031d1fedb9 | /src/jp/archesporeadventure/main/controllers/GroundPoundController.java | 16b317830adfa6968b4cf4bc953aca8ca55a682a | [] | no_license | Archespore/ArchesporeAdventure | https://github.com/Archespore/ArchesporeAdventure | 5086244ae6facc58050f722157f4ac96472afcbf | 927fbb5d37440d399e535411fefe3987d8d1c667 | refs/heads/master | 2021-07-08T02:47:25.600000 | 2019-02-26T20:51:26 | 2019-02-26T20:51:26 | 141,615,079 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package jp.archesporeadventure.main.controllers;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import jp.archesporeadventure.main.utils.LivingEntityUtil;
import jp.archesporeadventure.main.utils.ParticleUtil;
import jp.archesporeadventure.main.utils.PotionEffectUtil;
public class GroundPoundController {
//Ground Pound effect radius
private final static int GROUND_POUND_EFFECT_RADIUS = 6;
private static List<Player> groundPoundList = new ArrayList<>();
/**
* Adds a chaos storm in the world at the specified location for the specified duration.
* @param location the center of the storm.
* @param duration amount of times the effect should go
*/
public static void addGroundPound(Player player) {
groundPoundList.add(player);
}
/**
* Checks to see if the specified player has a ground pound.
* @param player player to check for.
* @return true or false.
*/
public static boolean doesHaveGroundPond(Player player) {
return groundPoundList.contains(player);
}
/**
* Removes the chaos storm effect with the center at the specified location.
* @param location the center of the storm to remove.
*/
public static void removeGroundPound(Player player) {
groundPoundList.remove(player);
}
/**
* Creates a ground pound effect at the specified player then removes them from the list.
* @param player player to create a ground pound around.
*/
public static void createGroundPoundEffect(Player player) {
Location playerLocation = player.getLocation();
for (int loopValue = 0; loopValue < 64; loopValue++) {
double angle = Math.toRadians((360.0 / 64.0) * loopValue);
ParticleUtil.spawnWorldParticles(Particle.BLOCK_CRACK, playerLocation.clone().add(Math.cos(angle) * GROUND_POUND_EFFECT_RADIUS, .25, Math.sin(angle) * GROUND_POUND_EFFECT_RADIUS), 3, 0, 0, 0, .25, Material.DIRT.createBlockData());
}
ParticleUtil.spawnWorldParticles(Particle.BLOCK_CRACK, playerLocation.clone().add(0, .25, 0), 50, 2.5, 0, 2.5, .25, Material.DIRT.createBlockData());
playerLocation.getWorld().playSound(playerLocation, Sound.BLOCK_ANVIL_LAND, 3.5f, .6f);
playerLocation.getWorld().playSound(playerLocation, Sound.BLOCK_GRASS_BREAK, 3.5f, .9f);
for (Entity entity : player.getNearbyEntities(GROUND_POUND_EFFECT_RADIUS, GROUND_POUND_EFFECT_RADIUS, GROUND_POUND_EFFECT_RADIUS)) {
if (entity.getLocation().distance(playerLocation) <= GROUND_POUND_EFFECT_RADIUS) {
entity.setVelocity(entity.getVelocity().add(new Vector(0, 1.25, 0)));
if (entity instanceof LivingEntity) {
LivingEntity entityLiving = (LivingEntity) entity;
LivingEntityUtil.removeHealth(entityLiving, 8);
entityLiving.addPotionEffect(PotionEffectUtil.comparePotionEffect(new PotionEffect(PotionEffectType.SLOW, 200, 0), entityLiving), true);
}
}
}
removeGroundPound(player);
}
}
| UTF-8 | Java | 3,192 | java | GroundPoundController.java | Java | [] | null | [] | package jp.archesporeadventure.main.controllers;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import jp.archesporeadventure.main.utils.LivingEntityUtil;
import jp.archesporeadventure.main.utils.ParticleUtil;
import jp.archesporeadventure.main.utils.PotionEffectUtil;
public class GroundPoundController {
//Ground Pound effect radius
private final static int GROUND_POUND_EFFECT_RADIUS = 6;
private static List<Player> groundPoundList = new ArrayList<>();
/**
* Adds a chaos storm in the world at the specified location for the specified duration.
* @param location the center of the storm.
* @param duration amount of times the effect should go
*/
public static void addGroundPound(Player player) {
groundPoundList.add(player);
}
/**
* Checks to see if the specified player has a ground pound.
* @param player player to check for.
* @return true or false.
*/
public static boolean doesHaveGroundPond(Player player) {
return groundPoundList.contains(player);
}
/**
* Removes the chaos storm effect with the center at the specified location.
* @param location the center of the storm to remove.
*/
public static void removeGroundPound(Player player) {
groundPoundList.remove(player);
}
/**
* Creates a ground pound effect at the specified player then removes them from the list.
* @param player player to create a ground pound around.
*/
public static void createGroundPoundEffect(Player player) {
Location playerLocation = player.getLocation();
for (int loopValue = 0; loopValue < 64; loopValue++) {
double angle = Math.toRadians((360.0 / 64.0) * loopValue);
ParticleUtil.spawnWorldParticles(Particle.BLOCK_CRACK, playerLocation.clone().add(Math.cos(angle) * GROUND_POUND_EFFECT_RADIUS, .25, Math.sin(angle) * GROUND_POUND_EFFECT_RADIUS), 3, 0, 0, 0, .25, Material.DIRT.createBlockData());
}
ParticleUtil.spawnWorldParticles(Particle.BLOCK_CRACK, playerLocation.clone().add(0, .25, 0), 50, 2.5, 0, 2.5, .25, Material.DIRT.createBlockData());
playerLocation.getWorld().playSound(playerLocation, Sound.BLOCK_ANVIL_LAND, 3.5f, .6f);
playerLocation.getWorld().playSound(playerLocation, Sound.BLOCK_GRASS_BREAK, 3.5f, .9f);
for (Entity entity : player.getNearbyEntities(GROUND_POUND_EFFECT_RADIUS, GROUND_POUND_EFFECT_RADIUS, GROUND_POUND_EFFECT_RADIUS)) {
if (entity.getLocation().distance(playerLocation) <= GROUND_POUND_EFFECT_RADIUS) {
entity.setVelocity(entity.getVelocity().add(new Vector(0, 1.25, 0)));
if (entity instanceof LivingEntity) {
LivingEntity entityLiving = (LivingEntity) entity;
LivingEntityUtil.removeHealth(entityLiving, 8);
entityLiving.addPotionEffect(PotionEffectUtil.comparePotionEffect(new PotionEffect(PotionEffectType.SLOW, 200, 0), entityLiving), true);
}
}
}
removeGroundPound(player);
}
}
| 3,192 | 0.750627 | 0.735589 | 85 | 36.55294 | 40.023376 | 233 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.117647 | false | false | 2 |
0a7efdd356fe990a2e0c6b705a2f8073697dcf4f | 24,180,665,919,505 | 7db1bedbde6a63fb6669f8da089ca21e119ac989 | /src/com/yuntongxun/ecdemo/common/CCPAppManager.java | 797f6dda3a81480b71e81cf12d6961d1eb968dd2 | [
"Apache-2.0"
] | permissive | hairlun/radix-android | https://github.com/hairlun/radix-android | 31ef4551d03fb7df7b269e5b4823014edbe26a72 | fd9c0206c689ad5d274582f2513f481bc4a9364c | refs/heads/master | 2020-05-21T20:09:28.453000 | 2016-12-22T02:49:17 | 2016-12-22T02:49:17 | 60,959,762 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (c) 2015 The CCP project authors. All Rights Reserved.
*
* Use of this source code is governed by a Beijing Speedtong Information Technology Co.,Ltd license
* that can be found in the LICENSE file in the root of the web site.
*
* http://www.yuntongxun.com
*
* An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/package com.yuntongxun.ecdemo.common;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.text.TextUtils;
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
import com.patr.radix.App;
import com.patr.radix.R;
import com.yuntongxun.ecdemo.common.dialog.ECListDialog;
import com.yuntongxun.ecdemo.common.utils.ECPreferenceSettings;
import com.yuntongxun.ecdemo.common.utils.ECPreferences;
import com.yuntongxun.ecdemo.common.utils.LogUtil;
import com.yuntongxun.ecdemo.common.utils.MimeTypesTools;
import com.yuntongxun.ecdemo.common.utils.ToastUtil;
import com.yuntongxun.ecdemo.core.ClientUser;
import com.yuntongxun.ecdemo.ui.ECSuperActivity;
import com.yuntongxun.ecdemo.ui.LocationInfo;
import com.yuntongxun.ecdemo.ui.ShowBaiDuMapActivity;
import com.yuntongxun.ecdemo.ui.chatting.ChattingActivity;
import com.yuntongxun.ecdemo.ui.chatting.ChattingFragment;
import com.yuntongxun.ecdemo.ui.chatting.ImageGalleryActivity;
import com.yuntongxun.ecdemo.ui.chatting.ImageGralleryPagerActivity;
import com.yuntongxun.ecdemo.ui.chatting.ImageMsgInfoEntry;
import com.yuntongxun.ecdemo.ui.chatting.ViewImageInfo;
import com.yuntongxun.ecdemo.ui.chatting.view.ChatFooterPanel;
import com.yuntongxun.ecdemo.ui.voip.VideoActivity;
import com.yuntongxun.ecdemo.ui.voip.VoIPCallActivity;
import com.yuntongxun.ecdemo.ui.voip.VoIPCallHelper;
import com.yuntongxun.ecsdk.ECDevice;
import com.yuntongxun.ecsdk.ECMessage;
import com.yuntongxun.ecsdk.ECVoIPCallManager;
import com.yuntongxun.ecsdk.ECVoIPSetupManager;
import com.yuntongxun.ecsdk.im.ECLocationMessageBody;
/**
* 存储SDK一些全局性的常量
* Created by Jorstin on 2015/3/17.
*/
public class CCPAppManager {
public static Md5FileNameGenerator md5FileNameGenerator = new Md5FileNameGenerator();
/**Android 应用上下文*/
private static Context mContext = null;
/**包名*/
public static String pkgName = "com.yuntongxun.ecdemo";
/**SharedPreferences 存储名字前缀*/
public static final String PREFIX = "com.yuntongxun.ecdemo_";
public static final int FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT = 0x10000000;
/**IM功能UserData字段默认文字*/
public static final String USER_DATA = "yuntongxun.ecdemo";
public static HashMap<String, Integer> mPhotoCache = new HashMap<String, Integer>();
public static ArrayList<ECSuperActivity> activities = new ArrayList<ECSuperActivity>();
/**IM聊天更多功能面板*/
private static ChatFooterPanel mChatFooterPanel;
public static String getPackageName() {
return pkgName;
}
private static ClientUser mClientUser;
/**
* 返回SharePreference配置文件名称
* @return
*/
public static String getSharePreferenceName() {
return pkgName + "_preferences";
}
public static SharedPreferences getSharePreference() {
if (mContext != null) {
return mContext.getSharedPreferences(getSharePreferenceName(), 0);
}
return null;
}
/**
* 返回上下文对象
* @return
*/
public static Context getContext(){
return mContext;
}
public static void sendRemoveMemberBR(){
getContext().sendBroadcast(new Intent("com.yuntongxun.ecdemo.removemember"));
}
/**
* 设置上下文对象
* @param context
*/
public static void setContext(Context context) {
mContext = context;
pkgName = context.getPackageName();
LogUtil.d(LogUtil.getLogUtilsTag(CCPAppManager.class),
"setup application context for package: " + pkgName);
}
public static ChatFooterPanel getChatFooterPanel(Context context) {
return mChatFooterPanel;
}
/**
* 缓存账号注册信息
* @param user
*/
public static void setClientUser(ClientUser user) {
mClientUser = user;
}
public static void setPversion(int version) {
if(mClientUser != null) {
mClientUser.setpVersion(version);
}
}
/**
* 保存注册账号信息
* @return 客户登录信息
*/
public static ClientUser getClientUser() {
if(mClientUser != null) {
return mClientUser;
}
String registerAccount = getAutoRegisterAccount();
if(!TextUtils.isEmpty(registerAccount)) {
mClientUser = new ClientUser("");
return mClientUser.from(registerAccount);
}
return null;
}
public static String getUserId() {
return getClientUser().getUserId();
}
private static String getAutoRegisterAccount() {
// SharedPreferences sharedPreferences = ECPreferences.getSharedPreferences();
// ECPreferenceSettings registerAuto = ECPreferenceSettings.SETTINGS_REGIST_AUTO;
// String registerAccount = sharedPreferences.getString(registerAuto.getId(), (String) registerAuto.getDefaultValue());
SharedPreferences sharedPreferences = App.instance.getSharedPreferences("com.patr.radix.ytx", Context.MODE_PRIVATE);
String registerAccount = sharedPreferences.getString("ytxAccount", String.format("%s", System.currentTimeMillis()));
return registerAccount;
}
/**
* @param context
* @param path
*/
public static void doViewFilePrevieIntent(Context context ,String path) {
try {
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(android.content.Intent.ACTION_VIEW);
String type = MimeTypesTools.getMimeType(context, path);
File file = new File(path);
intent.setDataAndType(Uri.fromFile(file), type);
context.startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
LogUtil.e(LogUtil.getLogUtilsTag(CCPAppManager.class), "do view file error " + e.getLocalizedMessage());
}
}
/**
*
* @param cotnext
* @param value
*/
public static void startChattingImageViewAction(Context cotnext, ImageMsgInfoEntry value) {
Intent intent = new Intent(cotnext, ImageGralleryPagerActivity.class);
intent.putExtra(ImageGalleryActivity.CHATTING_MESSAGE, value);
cotnext.startActivity(intent);
}
/**
* 批量查看图片
* @param ctx
* @param position
* @param session
*/
public static void startChattingImageViewAction(Context ctx , int position , ArrayList<ViewImageInfo> session) {
Intent intent = new Intent(ctx, ImageGralleryPagerActivity.class);
intent.putExtra(ImageGralleryPagerActivity.EXTRA_IMAGE_INDEX, position);
intent.putParcelableArrayListExtra(ImageGralleryPagerActivity.EXTRA_IMAGE_URLS, session);
ctx.startActivity(intent);
}
/**
* 获取应用程序版本名称
* @return
*/
public static String getVersion() {
String version = "0.0.0";
if(mContext == null) {
return version;
}
try {
PackageInfo packageInfo = mContext.getPackageManager().getPackageInfo(
getPackageName(), 0);
version = packageInfo.versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return version;
}
/**
* 获取应用版本号
* @return 版本号
*/
public static int getVersionCode() {
int code = 1;
if(mContext == null) {
return code;
}
try {
PackageInfo packageInfo = mContext.getPackageManager().getPackageInfo(
getPackageName(), 0);
code = packageInfo.versionCode;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return code;
}
public static void addActivity(ECSuperActivity activity) {
activities.add(activity);
}
public static void clearActivity() {
for(ECSuperActivity activity : activities) {
if(activity != null) {
activity.finish();
activity = null;
}
activities.clear();
}
}
/**
* 打开浏览器下载新版本
* @param context
*/
public static void startUpdater(Context context) {
Uri uri = Uri.parse("http://dwz.cn/F8Amj");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
context.startActivity(intent);
}
public static HashMap<String, Object> prefValues = new HashMap<String, Object>();
/**
*
* @param key
* @param value
*/
public static void putPref(String key , Object value) {
prefValues.put(key, value);
}
public static Object getPref(String key) {
return prefValues.remove(key);
}
public static void removePref(String key) {
prefValues.remove(key);
}
/**
* 开启在线客服
* @param context
* @param contactid
*/
public static void startCustomerServiceAction(Context context , String contactid) {
Intent intent = new Intent(context, ChattingActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(ChattingFragment.RECIPIENTS, contactid);
intent.putExtra(ChattingFragment.CONTACT_USER, "在线客服");
intent.putExtra(ChattingActivity.CONNECTIVITY_SERVICE, true);
context.startActivity(intent);
}
/**
* 聊天界面
* @param context
* @param contactid
* @param username
*/
public static void startChattingAction(Context context , String contactid , String username) {
startChattingAction(context, contactid, username, false);
}
/**
*
* @param context
* @param contactid
* @param username
* @param clearTop
*/
public static void startChattingAction(Context context , String contactid , String username , boolean clearTop) {
Intent intent = new Intent(context, ChattingActivity.class);
if(clearTop) {
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
}
intent.putExtra(ChattingFragment.RECIPIENTS, contactid);
intent.putExtra(ChattingFragment.CONTACT_USER, username);
intent.putExtra(ChattingFragment.CUSTOMER_SERVICE, false);
context.startActivity(intent);
}
/**
* VoIP呼叫
* @param nickname 昵称
* @param contactId 呼出号码
*/
public static void callVoIPAction(Context ctx , String nickname, String contactId) {
// VoIP呼叫
callVoIPAction(ctx, ECVoIPCallManager.CallType.VOICE, nickname, contactId, false);
}
/**
* 根据呼叫类型通话
* @param ctx 上下文
* @param callType 呼叫类型
* @param nickname 昵称
* @param contactId 号码
*/
public static void callVoIPAction(Context ctx , ECVoIPCallManager.CallType callType ,String nickname, String contactId,boolean flag) {
// VoIP呼叫
Intent callAction = new Intent(ctx , VoIPCallActivity.class);
if(callType == ECVoIPCallManager.CallType.VIDEO) {
callAction = new Intent(ctx , VideoActivity.class);
VoIPCallHelper.mHandlerVideoCall = true;
} else {
VoIPCallHelper.mHandlerVideoCall = false;
}
callAction.putExtra(VoIPCallActivity.EXTRA_CALL_NAME , nickname);
callAction.putExtra(VoIPCallActivity.EXTRA_CALL_NUMBER , contactId);
callAction.putExtra(ECDevice.CALLTYPE , callType);
callAction.putExtra(VoIPCallActivity.EXTRA_OUTGOING_CALL , true);
if(flag){
callAction.putExtra(VoIPCallActivity.ACTION_CALLBACK_CALL, true);
}
ctx.startActivity(callAction);
}
/**
* 根据呼叫类型通话
* @param ctx 上下文
* @param callType 呼叫类型
* @param nickname 昵称
* @param contactId 号码
*/
public static void callVideoAction(Context ctx , ECVoIPCallManager.CallType callType ,String nickname, String contactId , String callid) {
// VoIP呼叫
Intent callAction = new Intent(ctx , VoIPCallActivity.class);
if(callType == ECVoIPCallManager.CallType.VIDEO) {
callAction = new Intent(ctx , VideoActivity.class);
VoIPCallHelper.mHandlerVideoCall = true;
} else {
VoIPCallHelper.mHandlerVideoCall = false;
}
callAction.putExtra(VoIPCallActivity.EXTRA_CALL_NAME , nickname);
callAction.putExtra(VoIPCallActivity.EXTRA_CALL_NUMBER , contactId);
callAction.putExtra(ECDevice.CALLTYPE , callType);
callAction.putExtra(ECDevice.CALLID, callid);
callAction.putExtra(VoIPCallActivity.EXTRA_OUTGOING_CALL, true);
ctx.startActivity(callAction);
}
/**
* 多选呼叫菜单
* @param ctx 上下文
* @param nickname 昵称
* @param contactId 号码
*/
public static void showCallMenu(final Context ctx , final String nickname, final String contactId) {
ECListDialog dialog = new ECListDialog(ctx , R.array.chat_call);;
dialog.setOnDialogItemClickListener(new ECListDialog.OnDialogItemClickListener() {
@Override
public void onDialogItemClick(Dialog d, int position) {
LogUtil.d("onDialogItemClick", "position " + position);
if (position == 3) {
callVoIPAction(ctx, ECVoIPCallManager.CallType.VOICE, nickname, contactId, true);
return;
}
callVoIPAction(ctx, ECVoIPCallManager.CallType.values()[position], nickname, contactId, false);
}
});
dialog.setTitle(R.string.ec_talk_mode_select);
dialog.show();
}
static List<Integer> mChecks;
/**
* 提示选择呼叫编码设置
* @param ctx 上下文
*/
public static void showCodecConfigMenu(final Context ctx) {
final ECListDialog multiDialog = new ECListDialog(ctx , R.array.Codec_call);
multiDialog.setOnDialogItemClickListener(false, new ECListDialog.OnDialogItemClickListener() {
@Override
public void onDialogItemClick(Dialog d, int position) {
LogUtil.d("onDialogItemClick", "position " + position);
}
});
if(mChecks == null) {
mChecks = new ArrayList<Integer>();
mChecks.add(ECVoIPSetupManager.Codec.Codec_iLBC.ordinal());
mChecks.add(ECVoIPSetupManager.Codec.Codec_G729.ordinal());
mChecks.add(ECVoIPSetupManager.Codec.Codec_PCMU.ordinal());
mChecks.add(ECVoIPSetupManager.Codec.Codec_PCMA.ordinal());
mChecks.add(ECVoIPSetupManager.Codec.Codec_H264.ordinal());
mChecks.add(ECVoIPSetupManager.Codec.Codec_SILK8K.ordinal());
mChecks.add(ECVoIPSetupManager.Codec.Codec_AMR.ordinal());
mChecks.add(ECVoIPSetupManager.Codec.Codec_VP8.ordinal());
mChecks.add(ECVoIPSetupManager.Codec.Codec_SILK16K.ordinal());
}
multiDialog.setChecks(mChecks);
multiDialog.setTitle(R.string.ec_talk_codec_select);
multiDialog.setButton(ECListDialog.BUTTON_POSITIVE, R.string.dialog_ok_button, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mChecks = multiDialog.getCheck();
if (mChecks == null) {
ToastUtil.showMessage("设置失败,未选择任何编码");
return;
}
ECVoIPSetupManager setupManager = ECDevice.getECVoIPSetupManager();
if(setupManager == null) {
ToastUtil.showMessage("设置失败,请先初始化SDK");
return ;
}
for(ECVoIPSetupManager.Codec code : ECVoIPSetupManager.Codec.values()) {
boolean enable = mChecks.contains(code.ordinal());
setupManager.setCodecEnabled(code , enable);
}
ToastUtil.showMessage("设置成功");
}
});
multiDialog.show();
}
public static void startShowBaiDuMapAction(ChattingActivity mContext2,
ECMessage iMessage) {
if(iMessage==null||mContext2==null){
return;
}
Intent intent=new Intent(mContext2,ShowBaiDuMapActivity.class);
ECLocationMessageBody body=(ECLocationMessageBody) iMessage.getBody();
LocationInfo locationInfo =new LocationInfo();
locationInfo.setLat(body.getLatitude());
locationInfo.setLon(body.getLongitude());
locationInfo.setAddress(body.getTitle());
intent.putExtra("location", locationInfo);
mContext2.startActivity(intent);
}
}
| UTF-8 | Java | 17,800 | java | CCPAppManager.java | Java | [
{
"context": "onMessageBody;\n\n/**\n * 存储SDK一些全局性的常量\n * Created by Jorstin on 2015/3/17.\n */\npublic class CCPAppManage",
"end": 2475,
"score": 0.6261605620384216,
"start": 2474,
"tag": "NAME",
"value": "J"
},
{
"context": "aram context\n * @param contactid\n * @param username\n */\n public static void startChattingActio",
"end": 10212,
"score": 0.8133699297904968,
"start": 10204,
"tag": "USERNAME",
"value": "username"
},
{
"context": "aram context\n * @param contactid\n * @param username\n * @param clearTop\n */\n public static ",
"end": 10476,
"score": 0.9708061814308167,
"start": 10468,
"tag": "USERNAME",
"value": "username"
},
{
"context": " intent.putExtra(ChattingFragment.CONTACT_USER, username);\n intent.putExtra(ChattingFragment.CUSTOM",
"end": 10917,
"score": 0.974692165851593,
"start": 10909,
"tag": "USERNAME",
"value": "username"
},
{
"context": " * @param callType 呼叫类型\n * @param nickname 昵称\n * @param contactId 号码\n */\n public st",
"end": 12482,
"score": 0.687976598739624,
"start": 12481,
"tag": "NAME",
"value": "昵"
},
{
"context": "叫菜单\n * @param ctx 上下文\n * @param nickname 昵称\n * @param contactId 号码\n */\n public st",
"end": 13459,
"score": 0.6784587502479553,
"start": 13458,
"tag": "NAME",
"value": "昵"
}
] | null | [] | /*
* Copyright (c) 2015 The CCP project authors. All Rights Reserved.
*
* Use of this source code is governed by a Beijing Speedtong Information Technology Co.,Ltd license
* that can be found in the LICENSE file in the root of the web site.
*
* http://www.yuntongxun.com
*
* An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/package com.yuntongxun.ecdemo.common;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.text.TextUtils;
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
import com.patr.radix.App;
import com.patr.radix.R;
import com.yuntongxun.ecdemo.common.dialog.ECListDialog;
import com.yuntongxun.ecdemo.common.utils.ECPreferenceSettings;
import com.yuntongxun.ecdemo.common.utils.ECPreferences;
import com.yuntongxun.ecdemo.common.utils.LogUtil;
import com.yuntongxun.ecdemo.common.utils.MimeTypesTools;
import com.yuntongxun.ecdemo.common.utils.ToastUtil;
import com.yuntongxun.ecdemo.core.ClientUser;
import com.yuntongxun.ecdemo.ui.ECSuperActivity;
import com.yuntongxun.ecdemo.ui.LocationInfo;
import com.yuntongxun.ecdemo.ui.ShowBaiDuMapActivity;
import com.yuntongxun.ecdemo.ui.chatting.ChattingActivity;
import com.yuntongxun.ecdemo.ui.chatting.ChattingFragment;
import com.yuntongxun.ecdemo.ui.chatting.ImageGalleryActivity;
import com.yuntongxun.ecdemo.ui.chatting.ImageGralleryPagerActivity;
import com.yuntongxun.ecdemo.ui.chatting.ImageMsgInfoEntry;
import com.yuntongxun.ecdemo.ui.chatting.ViewImageInfo;
import com.yuntongxun.ecdemo.ui.chatting.view.ChatFooterPanel;
import com.yuntongxun.ecdemo.ui.voip.VideoActivity;
import com.yuntongxun.ecdemo.ui.voip.VoIPCallActivity;
import com.yuntongxun.ecdemo.ui.voip.VoIPCallHelper;
import com.yuntongxun.ecsdk.ECDevice;
import com.yuntongxun.ecsdk.ECMessage;
import com.yuntongxun.ecsdk.ECVoIPCallManager;
import com.yuntongxun.ecsdk.ECVoIPSetupManager;
import com.yuntongxun.ecsdk.im.ECLocationMessageBody;
/**
* 存储SDK一些全局性的常量
* Created by Jorstin on 2015/3/17.
*/
public class CCPAppManager {
public static Md5FileNameGenerator md5FileNameGenerator = new Md5FileNameGenerator();
/**Android 应用上下文*/
private static Context mContext = null;
/**包名*/
public static String pkgName = "com.yuntongxun.ecdemo";
/**SharedPreferences 存储名字前缀*/
public static final String PREFIX = "com.yuntongxun.ecdemo_";
public static final int FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT = 0x10000000;
/**IM功能UserData字段默认文字*/
public static final String USER_DATA = "yuntongxun.ecdemo";
public static HashMap<String, Integer> mPhotoCache = new HashMap<String, Integer>();
public static ArrayList<ECSuperActivity> activities = new ArrayList<ECSuperActivity>();
/**IM聊天更多功能面板*/
private static ChatFooterPanel mChatFooterPanel;
public static String getPackageName() {
return pkgName;
}
private static ClientUser mClientUser;
/**
* 返回SharePreference配置文件名称
* @return
*/
public static String getSharePreferenceName() {
return pkgName + "_preferences";
}
public static SharedPreferences getSharePreference() {
if (mContext != null) {
return mContext.getSharedPreferences(getSharePreferenceName(), 0);
}
return null;
}
/**
* 返回上下文对象
* @return
*/
public static Context getContext(){
return mContext;
}
public static void sendRemoveMemberBR(){
getContext().sendBroadcast(new Intent("com.yuntongxun.ecdemo.removemember"));
}
/**
* 设置上下文对象
* @param context
*/
public static void setContext(Context context) {
mContext = context;
pkgName = context.getPackageName();
LogUtil.d(LogUtil.getLogUtilsTag(CCPAppManager.class),
"setup application context for package: " + pkgName);
}
public static ChatFooterPanel getChatFooterPanel(Context context) {
return mChatFooterPanel;
}
/**
* 缓存账号注册信息
* @param user
*/
public static void setClientUser(ClientUser user) {
mClientUser = user;
}
public static void setPversion(int version) {
if(mClientUser != null) {
mClientUser.setpVersion(version);
}
}
/**
* 保存注册账号信息
* @return 客户登录信息
*/
public static ClientUser getClientUser() {
if(mClientUser != null) {
return mClientUser;
}
String registerAccount = getAutoRegisterAccount();
if(!TextUtils.isEmpty(registerAccount)) {
mClientUser = new ClientUser("");
return mClientUser.from(registerAccount);
}
return null;
}
public static String getUserId() {
return getClientUser().getUserId();
}
private static String getAutoRegisterAccount() {
// SharedPreferences sharedPreferences = ECPreferences.getSharedPreferences();
// ECPreferenceSettings registerAuto = ECPreferenceSettings.SETTINGS_REGIST_AUTO;
// String registerAccount = sharedPreferences.getString(registerAuto.getId(), (String) registerAuto.getDefaultValue());
SharedPreferences sharedPreferences = App.instance.getSharedPreferences("com.patr.radix.ytx", Context.MODE_PRIVATE);
String registerAccount = sharedPreferences.getString("ytxAccount", String.format("%s", System.currentTimeMillis()));
return registerAccount;
}
/**
* @param context
* @param path
*/
public static void doViewFilePrevieIntent(Context context ,String path) {
try {
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(android.content.Intent.ACTION_VIEW);
String type = MimeTypesTools.getMimeType(context, path);
File file = new File(path);
intent.setDataAndType(Uri.fromFile(file), type);
context.startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
LogUtil.e(LogUtil.getLogUtilsTag(CCPAppManager.class), "do view file error " + e.getLocalizedMessage());
}
}
/**
*
* @param cotnext
* @param value
*/
public static void startChattingImageViewAction(Context cotnext, ImageMsgInfoEntry value) {
Intent intent = new Intent(cotnext, ImageGralleryPagerActivity.class);
intent.putExtra(ImageGalleryActivity.CHATTING_MESSAGE, value);
cotnext.startActivity(intent);
}
/**
* 批量查看图片
* @param ctx
* @param position
* @param session
*/
public static void startChattingImageViewAction(Context ctx , int position , ArrayList<ViewImageInfo> session) {
Intent intent = new Intent(ctx, ImageGralleryPagerActivity.class);
intent.putExtra(ImageGralleryPagerActivity.EXTRA_IMAGE_INDEX, position);
intent.putParcelableArrayListExtra(ImageGralleryPagerActivity.EXTRA_IMAGE_URLS, session);
ctx.startActivity(intent);
}
/**
* 获取应用程序版本名称
* @return
*/
public static String getVersion() {
String version = "0.0.0";
if(mContext == null) {
return version;
}
try {
PackageInfo packageInfo = mContext.getPackageManager().getPackageInfo(
getPackageName(), 0);
version = packageInfo.versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return version;
}
/**
* 获取应用版本号
* @return 版本号
*/
public static int getVersionCode() {
int code = 1;
if(mContext == null) {
return code;
}
try {
PackageInfo packageInfo = mContext.getPackageManager().getPackageInfo(
getPackageName(), 0);
code = packageInfo.versionCode;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return code;
}
public static void addActivity(ECSuperActivity activity) {
activities.add(activity);
}
public static void clearActivity() {
for(ECSuperActivity activity : activities) {
if(activity != null) {
activity.finish();
activity = null;
}
activities.clear();
}
}
/**
* 打开浏览器下载新版本
* @param context
*/
public static void startUpdater(Context context) {
Uri uri = Uri.parse("http://dwz.cn/F8Amj");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
context.startActivity(intent);
}
public static HashMap<String, Object> prefValues = new HashMap<String, Object>();
/**
*
* @param key
* @param value
*/
public static void putPref(String key , Object value) {
prefValues.put(key, value);
}
public static Object getPref(String key) {
return prefValues.remove(key);
}
public static void removePref(String key) {
prefValues.remove(key);
}
/**
* 开启在线客服
* @param context
* @param contactid
*/
public static void startCustomerServiceAction(Context context , String contactid) {
Intent intent = new Intent(context, ChattingActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(ChattingFragment.RECIPIENTS, contactid);
intent.putExtra(ChattingFragment.CONTACT_USER, "在线客服");
intent.putExtra(ChattingActivity.CONNECTIVITY_SERVICE, true);
context.startActivity(intent);
}
/**
* 聊天界面
* @param context
* @param contactid
* @param username
*/
public static void startChattingAction(Context context , String contactid , String username) {
startChattingAction(context, contactid, username, false);
}
/**
*
* @param context
* @param contactid
* @param username
* @param clearTop
*/
public static void startChattingAction(Context context , String contactid , String username , boolean clearTop) {
Intent intent = new Intent(context, ChattingActivity.class);
if(clearTop) {
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
}
intent.putExtra(ChattingFragment.RECIPIENTS, contactid);
intent.putExtra(ChattingFragment.CONTACT_USER, username);
intent.putExtra(ChattingFragment.CUSTOMER_SERVICE, false);
context.startActivity(intent);
}
/**
* VoIP呼叫
* @param nickname 昵称
* @param contactId 呼出号码
*/
public static void callVoIPAction(Context ctx , String nickname, String contactId) {
// VoIP呼叫
callVoIPAction(ctx, ECVoIPCallManager.CallType.VOICE, nickname, contactId, false);
}
/**
* 根据呼叫类型通话
* @param ctx 上下文
* @param callType 呼叫类型
* @param nickname 昵称
* @param contactId 号码
*/
public static void callVoIPAction(Context ctx , ECVoIPCallManager.CallType callType ,String nickname, String contactId,boolean flag) {
// VoIP呼叫
Intent callAction = new Intent(ctx , VoIPCallActivity.class);
if(callType == ECVoIPCallManager.CallType.VIDEO) {
callAction = new Intent(ctx , VideoActivity.class);
VoIPCallHelper.mHandlerVideoCall = true;
} else {
VoIPCallHelper.mHandlerVideoCall = false;
}
callAction.putExtra(VoIPCallActivity.EXTRA_CALL_NAME , nickname);
callAction.putExtra(VoIPCallActivity.EXTRA_CALL_NUMBER , contactId);
callAction.putExtra(ECDevice.CALLTYPE , callType);
callAction.putExtra(VoIPCallActivity.EXTRA_OUTGOING_CALL , true);
if(flag){
callAction.putExtra(VoIPCallActivity.ACTION_CALLBACK_CALL, true);
}
ctx.startActivity(callAction);
}
/**
* 根据呼叫类型通话
* @param ctx 上下文
* @param callType 呼叫类型
* @param nickname 昵称
* @param contactId 号码
*/
public static void callVideoAction(Context ctx , ECVoIPCallManager.CallType callType ,String nickname, String contactId , String callid) {
// VoIP呼叫
Intent callAction = new Intent(ctx , VoIPCallActivity.class);
if(callType == ECVoIPCallManager.CallType.VIDEO) {
callAction = new Intent(ctx , VideoActivity.class);
VoIPCallHelper.mHandlerVideoCall = true;
} else {
VoIPCallHelper.mHandlerVideoCall = false;
}
callAction.putExtra(VoIPCallActivity.EXTRA_CALL_NAME , nickname);
callAction.putExtra(VoIPCallActivity.EXTRA_CALL_NUMBER , contactId);
callAction.putExtra(ECDevice.CALLTYPE , callType);
callAction.putExtra(ECDevice.CALLID, callid);
callAction.putExtra(VoIPCallActivity.EXTRA_OUTGOING_CALL, true);
ctx.startActivity(callAction);
}
/**
* 多选呼叫菜单
* @param ctx 上下文
* @param nickname 昵称
* @param contactId 号码
*/
public static void showCallMenu(final Context ctx , final String nickname, final String contactId) {
ECListDialog dialog = new ECListDialog(ctx , R.array.chat_call);;
dialog.setOnDialogItemClickListener(new ECListDialog.OnDialogItemClickListener() {
@Override
public void onDialogItemClick(Dialog d, int position) {
LogUtil.d("onDialogItemClick", "position " + position);
if (position == 3) {
callVoIPAction(ctx, ECVoIPCallManager.CallType.VOICE, nickname, contactId, true);
return;
}
callVoIPAction(ctx, ECVoIPCallManager.CallType.values()[position], nickname, contactId, false);
}
});
dialog.setTitle(R.string.ec_talk_mode_select);
dialog.show();
}
static List<Integer> mChecks;
/**
* 提示选择呼叫编码设置
* @param ctx 上下文
*/
public static void showCodecConfigMenu(final Context ctx) {
final ECListDialog multiDialog = new ECListDialog(ctx , R.array.Codec_call);
multiDialog.setOnDialogItemClickListener(false, new ECListDialog.OnDialogItemClickListener() {
@Override
public void onDialogItemClick(Dialog d, int position) {
LogUtil.d("onDialogItemClick", "position " + position);
}
});
if(mChecks == null) {
mChecks = new ArrayList<Integer>();
mChecks.add(ECVoIPSetupManager.Codec.Codec_iLBC.ordinal());
mChecks.add(ECVoIPSetupManager.Codec.Codec_G729.ordinal());
mChecks.add(ECVoIPSetupManager.Codec.Codec_PCMU.ordinal());
mChecks.add(ECVoIPSetupManager.Codec.Codec_PCMA.ordinal());
mChecks.add(ECVoIPSetupManager.Codec.Codec_H264.ordinal());
mChecks.add(ECVoIPSetupManager.Codec.Codec_SILK8K.ordinal());
mChecks.add(ECVoIPSetupManager.Codec.Codec_AMR.ordinal());
mChecks.add(ECVoIPSetupManager.Codec.Codec_VP8.ordinal());
mChecks.add(ECVoIPSetupManager.Codec.Codec_SILK16K.ordinal());
}
multiDialog.setChecks(mChecks);
multiDialog.setTitle(R.string.ec_talk_codec_select);
multiDialog.setButton(ECListDialog.BUTTON_POSITIVE, R.string.dialog_ok_button, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mChecks = multiDialog.getCheck();
if (mChecks == null) {
ToastUtil.showMessage("设置失败,未选择任何编码");
return;
}
ECVoIPSetupManager setupManager = ECDevice.getECVoIPSetupManager();
if(setupManager == null) {
ToastUtil.showMessage("设置失败,请先初始化SDK");
return ;
}
for(ECVoIPSetupManager.Codec code : ECVoIPSetupManager.Codec.values()) {
boolean enable = mChecks.contains(code.ordinal());
setupManager.setCodecEnabled(code , enable);
}
ToastUtil.showMessage("设置成功");
}
});
multiDialog.show();
}
public static void startShowBaiDuMapAction(ChattingActivity mContext2,
ECMessage iMessage) {
if(iMessage==null||mContext2==null){
return;
}
Intent intent=new Intent(mContext2,ShowBaiDuMapActivity.class);
ECLocationMessageBody body=(ECLocationMessageBody) iMessage.getBody();
LocationInfo locationInfo =new LocationInfo();
locationInfo.setLat(body.getLatitude());
locationInfo.setLon(body.getLongitude());
locationInfo.setAddress(body.getTitle());
intent.putExtra("location", locationInfo);
mContext2.startActivity(intent);
}
}
| 17,800 | 0.65393 | 0.651102 | 498 | 33.791164 | 29.299871 | 142 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.668675 | false | false | 2 |
5153fa0eb582787ebe9ae11653e4f02dd61f9f53 | 26,886,495,334,717 | 22de380f9ebd3fed39ea051d48c59b5df114b7f8 | /src/week1/Person.java | ebabacc5d70158fbfc10fb6d462068f5d94e2d79 | [] | no_license | DharaniBollineni/TermTwo | https://github.com/DharaniBollineni/TermTwo | 19c905292c94b19a4f9561c7cb9d4b425dfdca97 | f17547cae58dec81c8b0aed7090d9ab4881967f8 | refs/heads/master | 2020-09-10T22:49:15.466000 | 2019-11-15T06:17:04 | 2019-11-15T06:17:04 | 221,856,680 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package week1;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
public class Person implements Comparable<Person>{
private int ID;
private String name;
public int compareTo(Person p)
{
///return (this.getID() - p.getID() );
return this.getName().compareToIgnoreCase(p.getName());
}
public Person (int ID, String s)
{
this.ID = ID;
this.name = s;
}
/**
* @return the iD
*/
public int getID() {
return ID;
}
/**
* @param iD the iD to set
*/
public void setID(int iD) {
ID = iD;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
public String toString()
{
return "ID = " + this.ID + " " + "Name = " + this.name;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Person p1 = new Person (20, "Dharani");
Person p2 = new Person (3, "Muhammed");
Person p3 = new Person (1, "Michael");
Person p4 = new Person (6, "Ali");
Person p5 = new Person (2, "Omar");
List<Person> rList = new ArrayList<Person>();
rList.add(p1);
rList.add(p2);
rList.add(p3);
rList.add(p4);
rList.add(p5);
System.out.println("ArrayList --> "+rList);
//Collections.sort(rList);
Collections.sort(rList, new SortByPersonID());
System.out.println("ArrayList --> "+rList);
Collections.sort(rList, new SortPersonByName());
System.out.println("ArrayList --> "+rList);
}
}
| UTF-8 | Java | 1,586 | java | Person.java | Java | [
{
"context": " method stub\n\t\t\n\t\t\n\t\tPerson p1 = new Person (20, \"Dharani\");\n\t\tPerson p2 = new Person (3, \"Muhammed\");\n\t\tPe",
"end": 977,
"score": 0.9995207786560059,
"start": 970,
"tag": "NAME",
"value": "Dharani"
},
{
"context": "on (20, \"Dharani\");\n\t\tPerson p2 = new Person (3, \"Muhammed\");\n\t\tPerson p3 = new Person (1, \"Michael\");\n\t\tPer",
"end": 1019,
"score": 0.9996679425239563,
"start": 1011,
"tag": "NAME",
"value": "Muhammed"
},
{
"context": "on (3, \"Muhammed\");\n\t\tPerson p3 = new Person (1, \"Michael\");\n\t\tPerson p4 = new Person (6, \"Ali\");\n\t\tPerson ",
"end": 1060,
"score": 0.9998693466186523,
"start": 1053,
"tag": "NAME",
"value": "Michael"
},
{
"context": "son (1, \"Michael\");\n\t\tPerson p4 = new Person (6, \"Ali\");\n\t\tPerson p5 = new Person (2, \"Omar\");\n\t\t\n\t\t\n\t\t",
"end": 1097,
"score": 0.9998565912246704,
"start": 1094,
"tag": "NAME",
"value": "Ali"
},
{
"context": " Person (6, \"Ali\");\n\t\tPerson p5 = new Person (2, \"Omar\");\n\t\t\n\t\t\n\t\tList<Person> rList = new ArrayList<Per",
"end": 1135,
"score": 0.999688982963562,
"start": 1131,
"tag": "NAME",
"value": "Omar"
}
] | null | [] | package week1;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
public class Person implements Comparable<Person>{
private int ID;
private String name;
public int compareTo(Person p)
{
///return (this.getID() - p.getID() );
return this.getName().compareToIgnoreCase(p.getName());
}
public Person (int ID, String s)
{
this.ID = ID;
this.name = s;
}
/**
* @return the iD
*/
public int getID() {
return ID;
}
/**
* @param iD the iD to set
*/
public void setID(int iD) {
ID = iD;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
public String toString()
{
return "ID = " + this.ID + " " + "Name = " + this.name;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Person p1 = new Person (20, "Dharani");
Person p2 = new Person (3, "Muhammed");
Person p3 = new Person (1, "Michael");
Person p4 = new Person (6, "Ali");
Person p5 = new Person (2, "Omar");
List<Person> rList = new ArrayList<Person>();
rList.add(p1);
rList.add(p2);
rList.add(p3);
rList.add(p4);
rList.add(p5);
System.out.println("ArrayList --> "+rList);
//Collections.sort(rList);
Collections.sort(rList, new SortByPersonID());
System.out.println("ArrayList --> "+rList);
Collections.sort(rList, new SortPersonByName());
System.out.println("ArrayList --> "+rList);
}
}
| 1,586 | 0.598361 | 0.587642 | 109 | 13.550459 | 16.326084 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.605505 | false | false | 2 |
be6ea46faf72aece0ba56f165aeb2e45131662cf | 23,691,039,621,230 | 0865bf3c97f7210e2e48f4cf421cd5cceeac9c05 | /src/main/java/com/in9midia/studio/data/rest/TerminalMovementREST.java | 4613b154b8f9b89808a28b6b02205363d005fe57 | [] | no_license | thiagoalvescosta/neonews-studio | https://github.com/thiagoalvescosta/neonews-studio | 844cc1bcf080525493a34a2987cb72f9a86eb081 | 79fd5882f362d3d8ac4b97ca8b88689ee4586e42 | refs/heads/master | 2020-12-31T05:10:21.783000 | 2016-06-03T14:22:36 | 2016-06-03T14:22:36 | 59,693,713 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.in9midia.studio.data.rest;
import org.springframework.data.domain.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.*;
import org.springframework.http.*;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import com.in9midia.studio.data.entity.*;
import com.in9midia.studio.data.business.*;
/**
* Controller para expor serviços REST de TerminalMovement
*
* @author Usuário de Teste
* @version 1.0
* @generated
**/
@RestController
@RequestMapping(value = "/api/rest/com/in9midia/studio/data/TerminalMovement")
public class TerminalMovementREST {
/**
* Classe de negócio para manipulação de dados
*
* @generated
*/
@Autowired
@Qualifier("TerminalMovementBusiness")
private TerminalMovementBusiness terminalMovementBusiness;
/**
* @generated
*/
@Autowired
@Qualifier("RouteStopBusiness")
private RouteStopBusiness routeStopBusiness;
/**
* @generated
*/
@Autowired
@Qualifier("TerminalMovementStopBusiness")
private TerminalMovementStopBusiness terminalMovementStopBusiness;
/**
* Serviço exposto para novo registro de acordo com a entidade fornecida
*
* @generated
*/
@RequestMapping(method = RequestMethod.POST)
public TerminalMovement post(@Validated @RequestBody final TerminalMovement entity) throws Exception {
terminalMovementBusiness.post(entity);
return entity;
}
/**
* Serviço exposto para recuperar a entidade de acordo com o id fornecido
*
* @generated
*/
@RequestMapping(method = RequestMethod.GET, value = "/{id}")
public ResponseEntity<?> get(@PathVariable("id") java.lang.String id) throws Exception {
TerminalMovement entity = terminalMovementBusiness.get(id);
return entity == null ? ResponseEntity.status(404).build() : ResponseEntity.ok(entity);
}
/**
* Serviço exposto para salvar alterações de acordo com a entidade fornecida
*
* @generated
*/
@RequestMapping(method = RequestMethod.PUT)
public ResponseEntity<?> put(@Validated @RequestBody final TerminalMovement entity) throws Exception {
return ResponseEntity.ok(terminalMovementBusiness.put(entity));
}
/**
* Serviço exposto para salvar alterações de acordo com a entidade e id fornecidos
*
* @generated
*/
@RequestMapping(method = RequestMethod.PUT, value = "/{id}")
public TerminalMovement put(@PathVariable("id") final java.lang.String id, @Validated @RequestBody final TerminalMovement entity) throws Exception {
return terminalMovementBusiness.put(entity);
}
/**
* Serviço exposto para remover a entidade de acordo com o id fornecido
*
* @generated
*/
@RequestMapping(method = RequestMethod.DELETE, value = "/{id}")
public void delete(@PathVariable("id") java.lang.String id) throws Exception {
terminalMovementBusiness.delete(id);
}
/**
* NamedQuery list
* @generated
*/
@RequestMapping(method = RequestMethod.GET
)
public List<TerminalMovement> listParams (@RequestParam(defaultValue = "100", required = false) Integer limit, @RequestParam(defaultValue = "0", required = false) Integer offset){
return terminalMovementBusiness.list(new PageRequest(offset, limit) );
}
/**
* OneToMany Relationship GET
* @generated
*/
@RequestMapping(method = RequestMethod.GET
, value="/{instanceId}/TerminalMovementStop")
public List<TerminalMovementStop> findTerminalMovementStop(@PathVariable("instanceId") java.lang.String instanceId, @RequestParam(defaultValue = "100", required = false) Integer limit, @RequestParam(defaultValue = "0", required = false) Integer offset) {
return terminalMovementBusiness.findTerminalMovementStop(instanceId, new PageRequest(offset, limit) );
}
/**
* OneToMany Relationship DELETE
* @generated
*/
@RequestMapping(method = RequestMethod.DELETE
, value="/{instanceId}/TerminalMovementStop/{relationStpId}")
public ResponseEntity<?> deleteTerminalMovementStop(@PathVariable("relationStpId") java.lang.String relationStpId) {
try {
this.terminalMovementStopBusiness.delete(relationStpId);
return ResponseEntity.ok().build();
} catch (Exception e) {
return ResponseEntity.status(404).build();
}
}
/**
* ManyToMany Relationship GET
* @generated
*/
@RequestMapping(method = RequestMethod.GET
,value="/{instanceId}/RouteStop")
public List<RouteStop> listRouteStop(@PathVariable("instanceId") java.lang.String instanceId, @RequestParam(defaultValue = "100", required = false) Integer limit, @RequestParam(defaultValue = "0", required = false) Integer offset ) {
return terminalMovementBusiness.listRouteStop(instanceId, new PageRequest(offset, limit) );
}
/**
* ManyToMany Relationship POST
* @generated
*/
@RequestMapping(method = RequestMethod.POST
,value="/{instanceId}/RouteStop")
public ResponseEntity<?> postRouteStop(@Validated @RequestBody final RouteStop entity, @PathVariable("instanceId") java.lang.String instanceId) throws Exception {
TerminalMovementStop newTerminalMovementStop = new TerminalMovementStop();
TerminalMovement instance = this.terminalMovementBusiness.get(instanceId);
newTerminalMovementStop.setRouteStop(entity);
newTerminalMovementStop.setTerminalMovement(instance);
this.terminalMovementStopBusiness.post(newTerminalMovementStop);
return ResponseEntity.ok(newTerminalMovementStop.getTerminalMovement());
}
/**
* ManyToMany Relationship DELETE
* @generated
*/
@RequestMapping(method = RequestMethod.DELETE
,value="/{instanceId}/RouteStop/{relationRouStopId}")
public ResponseEntity<?> deleteRouteStop(@PathVariable("instanceId") java.lang.String instanceId, @PathVariable("relationRouStopId") java.lang.String relationRouStopId) {
this.terminalMovementBusiness.deleteRouteStop(instanceId, relationRouStopId);
return ResponseEntity.ok().build();
}
}
| UTF-8 | Java | 6,235 | java | TerminalMovementREST.java | Java | [
{
"context": "r serviços REST de TerminalMovement\n * \n * @author Usuário de Teste\n * @version 1.0\n * @generated\n **/\n@RestControlle",
"end": 529,
"score": 0.9997759461402893,
"start": 513,
"tag": "NAME",
"value": "Usuário de Teste"
}
] | null | [] | package com.in9midia.studio.data.rest;
import org.springframework.data.domain.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.*;
import org.springframework.http.*;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import com.in9midia.studio.data.entity.*;
import com.in9midia.studio.data.business.*;
/**
* Controller para expor serviços REST de TerminalMovement
*
* @author <NAME>
* @version 1.0
* @generated
**/
@RestController
@RequestMapping(value = "/api/rest/com/in9midia/studio/data/TerminalMovement")
public class TerminalMovementREST {
/**
* Classe de negócio para manipulação de dados
*
* @generated
*/
@Autowired
@Qualifier("TerminalMovementBusiness")
private TerminalMovementBusiness terminalMovementBusiness;
/**
* @generated
*/
@Autowired
@Qualifier("RouteStopBusiness")
private RouteStopBusiness routeStopBusiness;
/**
* @generated
*/
@Autowired
@Qualifier("TerminalMovementStopBusiness")
private TerminalMovementStopBusiness terminalMovementStopBusiness;
/**
* Serviço exposto para novo registro de acordo com a entidade fornecida
*
* @generated
*/
@RequestMapping(method = RequestMethod.POST)
public TerminalMovement post(@Validated @RequestBody final TerminalMovement entity) throws Exception {
terminalMovementBusiness.post(entity);
return entity;
}
/**
* Serviço exposto para recuperar a entidade de acordo com o id fornecido
*
* @generated
*/
@RequestMapping(method = RequestMethod.GET, value = "/{id}")
public ResponseEntity<?> get(@PathVariable("id") java.lang.String id) throws Exception {
TerminalMovement entity = terminalMovementBusiness.get(id);
return entity == null ? ResponseEntity.status(404).build() : ResponseEntity.ok(entity);
}
/**
* Serviço exposto para salvar alterações de acordo com a entidade fornecida
*
* @generated
*/
@RequestMapping(method = RequestMethod.PUT)
public ResponseEntity<?> put(@Validated @RequestBody final TerminalMovement entity) throws Exception {
return ResponseEntity.ok(terminalMovementBusiness.put(entity));
}
/**
* Serviço exposto para salvar alterações de acordo com a entidade e id fornecidos
*
* @generated
*/
@RequestMapping(method = RequestMethod.PUT, value = "/{id}")
public TerminalMovement put(@PathVariable("id") final java.lang.String id, @Validated @RequestBody final TerminalMovement entity) throws Exception {
return terminalMovementBusiness.put(entity);
}
/**
* Serviço exposto para remover a entidade de acordo com o id fornecido
*
* @generated
*/
@RequestMapping(method = RequestMethod.DELETE, value = "/{id}")
public void delete(@PathVariable("id") java.lang.String id) throws Exception {
terminalMovementBusiness.delete(id);
}
/**
* NamedQuery list
* @generated
*/
@RequestMapping(method = RequestMethod.GET
)
public List<TerminalMovement> listParams (@RequestParam(defaultValue = "100", required = false) Integer limit, @RequestParam(defaultValue = "0", required = false) Integer offset){
return terminalMovementBusiness.list(new PageRequest(offset, limit) );
}
/**
* OneToMany Relationship GET
* @generated
*/
@RequestMapping(method = RequestMethod.GET
, value="/{instanceId}/TerminalMovementStop")
public List<TerminalMovementStop> findTerminalMovementStop(@PathVariable("instanceId") java.lang.String instanceId, @RequestParam(defaultValue = "100", required = false) Integer limit, @RequestParam(defaultValue = "0", required = false) Integer offset) {
return terminalMovementBusiness.findTerminalMovementStop(instanceId, new PageRequest(offset, limit) );
}
/**
* OneToMany Relationship DELETE
* @generated
*/
@RequestMapping(method = RequestMethod.DELETE
, value="/{instanceId}/TerminalMovementStop/{relationStpId}")
public ResponseEntity<?> deleteTerminalMovementStop(@PathVariable("relationStpId") java.lang.String relationStpId) {
try {
this.terminalMovementStopBusiness.delete(relationStpId);
return ResponseEntity.ok().build();
} catch (Exception e) {
return ResponseEntity.status(404).build();
}
}
/**
* ManyToMany Relationship GET
* @generated
*/
@RequestMapping(method = RequestMethod.GET
,value="/{instanceId}/RouteStop")
public List<RouteStop> listRouteStop(@PathVariable("instanceId") java.lang.String instanceId, @RequestParam(defaultValue = "100", required = false) Integer limit, @RequestParam(defaultValue = "0", required = false) Integer offset ) {
return terminalMovementBusiness.listRouteStop(instanceId, new PageRequest(offset, limit) );
}
/**
* ManyToMany Relationship POST
* @generated
*/
@RequestMapping(method = RequestMethod.POST
,value="/{instanceId}/RouteStop")
public ResponseEntity<?> postRouteStop(@Validated @RequestBody final RouteStop entity, @PathVariable("instanceId") java.lang.String instanceId) throws Exception {
TerminalMovementStop newTerminalMovementStop = new TerminalMovementStop();
TerminalMovement instance = this.terminalMovementBusiness.get(instanceId);
newTerminalMovementStop.setRouteStop(entity);
newTerminalMovementStop.setTerminalMovement(instance);
this.terminalMovementStopBusiness.post(newTerminalMovementStop);
return ResponseEntity.ok(newTerminalMovementStop.getTerminalMovement());
}
/**
* ManyToMany Relationship DELETE
* @generated
*/
@RequestMapping(method = RequestMethod.DELETE
,value="/{instanceId}/RouteStop/{relationRouStopId}")
public ResponseEntity<?> deleteRouteStop(@PathVariable("instanceId") java.lang.String instanceId, @PathVariable("relationRouStopId") java.lang.String relationRouStopId) {
this.terminalMovementBusiness.deleteRouteStop(instanceId, relationRouStopId);
return ResponseEntity.ok().build();
}
}
| 6,224 | 0.714355 | 0.710497 | 183 | 32.994537 | 41.896111 | 256 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.338798 | false | false | 2 |
0ea5a31603cc5e85a421eea43e1ab815e1b58310 | 8,864,812,542,727 | 3568c9772fad54ffe71683de31525464642f3cf9 | /word8/src/main/java/eu/doppel_helix/jna/tlb/word8/WdRevisionsMode.java | ad818345ceeda657ec25d6054332367306f4cd36 | [
"MIT"
] | permissive | NoonRightsWarriorBehindHovering/COMTypelibraries | https://github.com/NoonRightsWarriorBehindHovering/COMTypelibraries | c853c41bb495031702d0ad7a4d215ab894c12bbd | c17acfca689305c0e23d4ff9d8ee437e0ee3d437 | refs/heads/master | 2023-06-21T20:52:51.519000 | 2020-03-13T22:33:48 | 2020-03-13T22:33:48 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package eu.doppel_helix.jna.tlb.word8;
import com.sun.jna.platform.win32.COM.util.IComEnum;
/**
* <p>uuid({9C68240F-079D-3FB0-ADA8-09D8F318B022})</p>
*/
public enum WdRevisionsMode implements IComEnum {
/**
* (0)
*/
wdBalloonRevisions(0),
/**
* (1)
*/
wdInLineRevisions(1),
/**
* (2)
*/
wdMixedRevisions(2),
;
private WdRevisionsMode(long value) {
this.value = value;
}
private long value;
public long getValue() {
return this.value;
}
} | UTF-8 | Java | 553 | java | WdRevisionsMode.java | Java | [] | null | [] |
package eu.doppel_helix.jna.tlb.word8;
import com.sun.jna.platform.win32.COM.util.IComEnum;
/**
* <p>uuid({9C68240F-079D-3FB0-ADA8-09D8F318B022})</p>
*/
public enum WdRevisionsMode implements IComEnum {
/**
* (0)
*/
wdBalloonRevisions(0),
/**
* (1)
*/
wdInLineRevisions(1),
/**
* (2)
*/
wdMixedRevisions(2),
;
private WdRevisionsMode(long value) {
this.value = value;
}
private long value;
public long getValue() {
return this.value;
}
} | 553 | 0.553345 | 0.499096 | 34 | 15.264706 | 15.862105 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.264706 | false | false | 2 |
e76b55303729e2c7257b15a9cf1212b64084408c | 21,363,167,373,087 | b32c2d10aea07e4a313c7a09d9be409acac58bdd | /ChatSoft/Server/ServerMainThread.java | 89bbff019f3acaac752ef769cc37e01b22c973e2 | [] | no_license | jduser/simple_chat_program_in_java | https://github.com/jduser/simple_chat_program_in_java | 1e4ab1d813eb21e3c106a3a8ba86fb088ad6d603 | d715c196278d8708db5dc43a04c5c24a053a7626 | refs/heads/master | 2015-08-11T00:52:57.800000 | 2014-03-30T04:06:30 | 2014-03-30T04:06:30 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.net.*;
import java.io.*;
import java.util.*;
import javax.swing.*;
public class ServerMainThread extends Thread{
ServerSocket ss = null;
Vector<SocketInfo> sl = null;
ServerMain sm = null;
JFrame frame = null;
ErrorDisplay ed = null;
ServerMainThread(int port, ServerMain sm) {
sl = new Vector<SocketInfo>(10);
this.sm = sm;
this.frame = sm.getFrame();
try {
ss = new ServerSocket(port);
}
catch (IOException e) {
String error = "Cannot start server!";
ed = new ErrorDisplay(frame, error);
}
}
public void run() {
boolean runServer = true;
try {
while (runServer){
Socket s = ss.accept();
new ServerConnectionProtocolThread(sl, s, sm).start();
}
}
catch (IOException e) {
}
}
} | UTF-8 | Java | 762 | java | ServerMainThread.java | Java | [] | null | [] | import java.net.*;
import java.io.*;
import java.util.*;
import javax.swing.*;
public class ServerMainThread extends Thread{
ServerSocket ss = null;
Vector<SocketInfo> sl = null;
ServerMain sm = null;
JFrame frame = null;
ErrorDisplay ed = null;
ServerMainThread(int port, ServerMain sm) {
sl = new Vector<SocketInfo>(10);
this.sm = sm;
this.frame = sm.getFrame();
try {
ss = new ServerSocket(port);
}
catch (IOException e) {
String error = "Cannot start server!";
ed = new ErrorDisplay(frame, error);
}
}
public void run() {
boolean runServer = true;
try {
while (runServer){
Socket s = ss.accept();
new ServerConnectionProtocolThread(sl, s, sm).start();
}
}
catch (IOException e) {
}
}
} | 762 | 0.643045 | 0.64042 | 41 | 17.609756 | 14.96806 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.146342 | false | false | 2 |
01b862e5ec69bce0a11629ec692b5e171fddc353 | 34,995,393,532,774 | 75d89a70c852c4564214426ee5e79c994b94b7a9 | /src/main/java/com/util/HtmlParser.java | 30173e5287932bdcfb5f66addb780219862930bd | [] | no_license | lintg1989/Spider_JD | https://github.com/lintg1989/Spider_JD | 7885e7e4f8ed27c71c5197741c866136b199fff7 | 4a3d5b1b3818ac51f4b1e9880b25031f9ee08177 | refs/heads/master | 2021-01-18T19:34:42.976000 | 2017-04-13T01:53:14 | 2017-04-13T01:53:14 | 86,901,936 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.util;
import org.w3c.dom.Node;
import org.w3c.dom.traversal.NodeFilter;
import java.util.HashSet;
import java.util.Set;
/**
* 完成对要分析的page包含的地址的提取
* 将提取的地址放入到一个集合中去
* Created by Lin on 2017/3/28.
*/
public class HtmlParser {
private Set<String> links = new HashSet<String>();
public Set<String> extraLinks(String path) {
// 需要两个过滤器,一个过滤掉<frame src=>和<a href>标签
NodeFilter nodeFilter = new NodeFilter() {
public short acceptNode(Node node) {
if (node.getTextContent().startsWith("fram src="))
return 1;
return 0;
}
};
return null;
}
}
| UTF-8 | Java | 765 | java | HtmlParser.java | Java | [] | null | [] | package com.util;
import org.w3c.dom.Node;
import org.w3c.dom.traversal.NodeFilter;
import java.util.HashSet;
import java.util.Set;
/**
* 完成对要分析的page包含的地址的提取
* 将提取的地址放入到一个集合中去
* Created by Lin on 2017/3/28.
*/
public class HtmlParser {
private Set<String> links = new HashSet<String>();
public Set<String> extraLinks(String path) {
// 需要两个过滤器,一个过滤掉<frame src=>和<a href>标签
NodeFilter nodeFilter = new NodeFilter() {
public short acceptNode(Node node) {
if (node.getTextContent().startsWith("fram src="))
return 1;
return 0;
}
};
return null;
}
}
| 765 | 0.600297 | 0.583952 | 28 | 23.035715 | 18.741631 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.357143 | false | false | 2 |
287eb88088faf3fe2469204de4ffd484714b7ab2 | 5,385,889,005,376 | e611f4ef4d585ec425358a1ee769f24f103369f6 | /wire-runtime/src/test/proto-java/com/squareup/wire/protos/one_extension/OneExtensionRegistry.java | f55991d98d50d91d55baa9cae486b5b8ef64a83e | [
"Apache-2.0"
] | permissive | fangzhzh/wire | https://github.com/fangzhzh/wire | 1aa5c67f367a7c3785b306474532183a28cc5b86 | 6ccef1645dcc5610afa44931bd71f6ccf48b642c | refs/heads/master | 2021-05-24T04:00:11.914000 | 2017-06-29T01:42:00 | 2017-06-29T02:38:25 | 43,665,416 | 1 | 0 | Apache-2.0 | false | 2020-10-12T23:50:45 | 2015-10-05T04:36:21 | 2017-06-29T01:46:03 | 2020-10-12T23:50:43 | 2,918 | 1 | 0 | 1 | Java | false | false | // Code generated by Wire protocol buffer compiler, do not edit.
package com.squareup.wire.protos.one_extension;
import java.lang.Class;
import java.lang.SuppressWarnings;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public final class OneExtensionRegistry {
@SuppressWarnings("unchecked")
public static final List<Class<Ext_one_extension>> EXTENSIONS = Collections.unmodifiableList(Arrays.asList(
Ext_one_extension.class));
private OneExtensionRegistry() {
}
}
| UTF-8 | Java | 512 | java | OneExtensionRegistry.java | Java | [] | null | [] | // Code generated by Wire protocol buffer compiler, do not edit.
package com.squareup.wire.protos.one_extension;
import java.lang.Class;
import java.lang.SuppressWarnings;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public final class OneExtensionRegistry {
@SuppressWarnings("unchecked")
public static final List<Class<Ext_one_extension>> EXTENSIONS = Collections.unmodifiableList(Arrays.asList(
Ext_one_extension.class));
private OneExtensionRegistry() {
}
}
| 512 | 0.78125 | 0.78125 | 17 | 29.117647 | 26.847898 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.470588 | false | false | 2 |
0e5dd2c76fa6b3a5bd761e40c80764200c98c7cd | 3,616,362,490,191 | 056322ec9b749fef326b6837d2c46202300332e2 | /src/ForLoopFirstPractice/MultipleTerms.java | 6a1cd5586f523009d2036f5ce6935eec2ac18196 | [] | no_license | nbamsu/Beginnig | https://github.com/nbamsu/Beginnig | 983e73ff270e701d534bfeaae9437cd9874e1554 | 498cafad8527f871d086462c4750c370b562790c | refs/heads/master | 2021-02-03T21:38:13.376000 | 2020-03-04T23:14:44 | 2020-03-04T23:14:44 | 243,546,802 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ForLoopFirstPractice;
public class MultipleTerms {
public static void main(String [] args){
int k=5;
for(int i=0,p=6;k>1 && i<6;k--,i++){
System.out.println("P is the "+p++);// inside the loop
}
System.out.println(k);// outside the loop, output will be only one number
}
}
| UTF-8 | Java | 336 | java | MultipleTerms.java | Java | [] | null | [] | package ForLoopFirstPractice;
public class MultipleTerms {
public static void main(String [] args){
int k=5;
for(int i=0,p=6;k>1 && i<6;k--,i++){
System.out.println("P is the "+p++);// inside the loop
}
System.out.println(k);// outside the loop, output will be only one number
}
}
| 336 | 0.577381 | 0.5625 | 13 | 24.846153 | 25.946236 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.692308 | false | false | 2 |
406d82f75e4af25f62e29f3a584bd197614d8f31 | 3,616,362,491,141 | 4d511f4317f32df233a1911c899b884ad7977578 | /yahtzee/src/test/java/com/cardinalfuse/yahtzee/dataobjects/CategorySinglesTest.java | 4b6ccdfce7e69084aa0fa917a23baf9acfbdbdff | [] | no_license | aservilla/yahtzee | https://github.com/aservilla/yahtzee | 2476e45a7396b6990f374eb1ac05d0fdbe9875d9 | 3ce4e9670f9d3f1468b911e4e53e87ffe8ac5df9 | refs/heads/master | 2021-01-20T19:57:12.422000 | 2016-08-17T02:12:52 | 2016-08-17T02:12:52 | 65,840,438 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.cardinalfuse.yahtzee.dataobjects;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import com.cardinalfuse.yahtzee.enums.DiceValue;
import junit.framework.TestCase;
public class CategorySinglesTest extends TestCase {
@Test
public void testScore1() {
List<DiceValue> roll = new ArrayList<DiceValue>(5);
roll.add(DiceValue.ONE);
roll.add(DiceValue.TWO);
roll.add(DiceValue.THREE);
roll.add(DiceValue.FOUR);
roll.add(DiceValue.TWO);
CategorySingles category = new CategorySingles(DiceValue.ONE);
category.setRoll(roll);
assertEquals(1, category.calculateScore());
}
@Test
public void testScore2() {
List<DiceValue> roll = new ArrayList<DiceValue>(5);
roll.add(DiceValue.ONE);
roll.add(DiceValue.TWO);
roll.add(DiceValue.ONE);
roll.add(DiceValue.FOUR);
roll.add(DiceValue.TWO);
CategorySingles category = new CategorySingles(DiceValue.ONE);
category.setRoll(roll);
assertEquals(2, category.calculateScore());
}
@Test
public void testScore3() {
List<DiceValue> roll = new ArrayList<DiceValue>(5);
roll.add(DiceValue.ONE);
roll.add(DiceValue.TWO);
roll.add(DiceValue.ONE);
roll.add(DiceValue.FOUR);
roll.add(DiceValue.ONE);
CategorySingles category = new CategorySingles(DiceValue.ONE);
category.setRoll(roll);
assertEquals(3, category.calculateScore());
}
@Test
public void testScore4() {
List<DiceValue> roll = new ArrayList<DiceValue>(5);
roll.add(DiceValue.ONE);
roll.add(DiceValue.ONE);
roll.add(DiceValue.ONE);
roll.add(DiceValue.ONE);
roll.add(DiceValue.TWO);
CategorySingles category = new CategorySingles(DiceValue.ONE);
category.setRoll(roll);
assertEquals(4, category.calculateScore());
}
@Test
public void testScore5() {
List<DiceValue> roll = new ArrayList<DiceValue>(5);
roll.add(DiceValue.ONE);
roll.add(DiceValue.ONE);
roll.add(DiceValue.ONE);
roll.add(DiceValue.ONE);
roll.add(DiceValue.ONE);
CategorySingles category = new CategorySingles(DiceValue.ONE);
category.setRoll(roll);
assertEquals(5, category.calculateScore());
}
}
| UTF-8 | Java | 2,109 | java | CategorySinglesTest.java | Java | [] | null | [] | package com.cardinalfuse.yahtzee.dataobjects;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import com.cardinalfuse.yahtzee.enums.DiceValue;
import junit.framework.TestCase;
public class CategorySinglesTest extends TestCase {
@Test
public void testScore1() {
List<DiceValue> roll = new ArrayList<DiceValue>(5);
roll.add(DiceValue.ONE);
roll.add(DiceValue.TWO);
roll.add(DiceValue.THREE);
roll.add(DiceValue.FOUR);
roll.add(DiceValue.TWO);
CategorySingles category = new CategorySingles(DiceValue.ONE);
category.setRoll(roll);
assertEquals(1, category.calculateScore());
}
@Test
public void testScore2() {
List<DiceValue> roll = new ArrayList<DiceValue>(5);
roll.add(DiceValue.ONE);
roll.add(DiceValue.TWO);
roll.add(DiceValue.ONE);
roll.add(DiceValue.FOUR);
roll.add(DiceValue.TWO);
CategorySingles category = new CategorySingles(DiceValue.ONE);
category.setRoll(roll);
assertEquals(2, category.calculateScore());
}
@Test
public void testScore3() {
List<DiceValue> roll = new ArrayList<DiceValue>(5);
roll.add(DiceValue.ONE);
roll.add(DiceValue.TWO);
roll.add(DiceValue.ONE);
roll.add(DiceValue.FOUR);
roll.add(DiceValue.ONE);
CategorySingles category = new CategorySingles(DiceValue.ONE);
category.setRoll(roll);
assertEquals(3, category.calculateScore());
}
@Test
public void testScore4() {
List<DiceValue> roll = new ArrayList<DiceValue>(5);
roll.add(DiceValue.ONE);
roll.add(DiceValue.ONE);
roll.add(DiceValue.ONE);
roll.add(DiceValue.ONE);
roll.add(DiceValue.TWO);
CategorySingles category = new CategorySingles(DiceValue.ONE);
category.setRoll(roll);
assertEquals(4, category.calculateScore());
}
@Test
public void testScore5() {
List<DiceValue> roll = new ArrayList<DiceValue>(5);
roll.add(DiceValue.ONE);
roll.add(DiceValue.ONE);
roll.add(DiceValue.ONE);
roll.add(DiceValue.ONE);
roll.add(DiceValue.ONE);
CategorySingles category = new CategorySingles(DiceValue.ONE);
category.setRoll(roll);
assertEquals(5, category.calculateScore());
}
}
| 2,109 | 0.732101 | 0.724988 | 84 | 24.107143 | 18.78577 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.059524 | false | false | 2 |
c2315aa61185ee4daac656a179f3e0837e90a7ae | 19,473,381,777,763 | c518263b1b6dbadadb854461e0800e7f4b3d58a2 | /app/src/main/java/com/demo/lixuan/mydemo/frame/hotfix/test/BugTest.java | afbab74c516a70ce248412f7a16d48f5b1f422d2 | [] | no_license | lx610/MyDemo | https://github.com/lx610/MyDemo | bba4e426efd135c7873b4741732fdc6d2b7654fb | 47ca5e6143321d16b3fb2bc3bca020efacfdb2fd | refs/heads/master | 2021-06-04T00:55:16.333000 | 2020-08-20T03:47:24 | 2020-08-20T03:47:24 | 132,564,679 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.demo.lixuan.mydemo.frame.hotfix.test;
/**
* className: BugTest
* description:java类作用描述
* author:lix
* email:lixuan_1@163.com
* date: 2020/6/19 14:45
*/
public class BugTest {
public void getBug() {
System.out.println("bug 已经修复");
// throw new NullPointerException();
}
}
| UTF-8 | Java | 337 | java | BugTest.java | Java | [
{
"context": "sName: BugTest\n * description:java类作用描述\n * author:lix\n * email:lixuan_1@163.com\n * date: 2020/6/19 14:4",
"end": 115,
"score": 0.9905720949172974,
"start": 112,
"tag": "USERNAME",
"value": "lix"
},
{
"context": "t\n * description:java类作用描述\n * author:lix\n * email:lixuan_1@163.com\n * date: 2020/6/19 14:45\n */\npublic class BugTest",
"end": 141,
"score": 0.9999195337295532,
"start": 125,
"tag": "EMAIL",
"value": "lixuan_1@163.com"
}
] | null | [] | package com.demo.lixuan.mydemo.frame.hotfix.test;
/**
* className: BugTest
* description:java类作用描述
* author:lix
* email:<EMAIL>
* date: 2020/6/19 14:45
*/
public class BugTest {
public void getBug() {
System.out.println("bug 已经修复");
// throw new NullPointerException();
}
}
| 328 | 0.647619 | 0.6 | 17 | 17.529411 | 15.602102 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.176471 | false | false | 2 |
223573b2fa6b2d38ab5b7a17d111dd8b73f77612 | 35,450,660,069,895 | 0659bb4ba0037037ecaa5ebaf8534674591ce061 | /StudentManage/src/com/qfedu/servlet/AddUserServlet.java | 94eccdcd558bd2aee2596737c66fac7edc69523a | [] | no_license | itcastphp/StudentManager | https://github.com/itcastphp/StudentManager | 17b70ab725a6cbc55d15a154d97822e87354ac7e | 719f9b9fb482b17f4a1c2c2d065d75ca89266ec6 | refs/heads/master | 2020-04-27T21:02:20.533000 | 2019-03-09T11:06:34 | 2019-03-09T11:06:34 | 174,681,544 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.qfedu.servlet;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.util.Iterator;
import java.util.List;
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 org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import com.qfedu.daoImp.UserDaoImpl;
import com.qfedu.serviceImp.AddUserImp;
import com.qfedu.util.MySqlUtil;
import com.qfedu.util.UuidUtil;
@WebServlet("/addUserServlet")
public class AddUserServlet extends HttpServlet{
private AddUserImp addUserImp=null;
public void initData() {
Connection connection = MySqlUtil.getConnection();
UserDaoImpl userDaoImpl = new UserDaoImpl();
userDaoImpl.setConnection(connection);
addUserImp = new AddUserImp();
addUserImp.setUserDao(userDaoImpl);
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doPost(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
initData();
String filePath = getServletContext().getRealPath("/photo");
File file = new File(filePath);
if(!file.exists()) {
file.mkdirs();
}
DiskFileItemFactory diskFileItemFactory = new DiskFileItemFactory();
ServletFileUpload servletFileUpload = new ServletFileUpload(diskFileItemFactory);
String nickname ="";
String password ="";
String email="";
String photo="";
String photoServletPath = "";
if(ServletFileUpload.isMultipartContent(req)) {
try {
List<FileItem> fileItems = servletFileUpload.parseRequest(req);
Iterator<FileItem> iterator = fileItems.iterator();
while(iterator.hasNext()) {
FileItem fileItem = iterator.next();
if(fileItem.isFormField()) {
String fieldValue = fileItem.getString("utf-8");
if(nickname=="") {
nickname=fieldValue;
}else if(password=="") {
password=fieldValue;
}else {
email=fieldValue;
}
}else {
String name = fileItem.getName();
name=new String(name.getBytes("gbk"), "utf-8");
req.setCharacterEncoding("utf-8");
resp.setContentType("text/html; charset=utf-8");
System.out.println(name);
String uuid = UuidUtil.getUuid();
String mainname=name.substring(name.lastIndexOf("/")+1,name.indexOf("."));
String extname=name.substring(name.indexOf("."));
photoServletPath="/"+mainname+uuid+extname;
photo=getServletContext().getContextPath()+"/photo"+photoServletPath;
filePath=filePath+"\\"+mainname+uuid+extname;
InputStream inputStream = fileItem.getInputStream();
File finalFile =new File(filePath);
FileOutputStream fos = new FileOutputStream(finalFile);
int count=0;
byte[] bytes=new byte[1024];
while((count=inputStream.read(bytes))!=-1) {
fos.write(bytes, 0, count);
}
fos.flush();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
System.out.println(nickname+"--"+password+"--"+email);
int row = addUserImp.registerUser(nickname, password, email, photo);
req.getSession().setAttribute("username", nickname);
req.getSession().setAttribute("info", photo);
if(row==1) {
resp.sendRedirect(getServletContext().getContextPath()+"/index.jsp");
}
}
}
| UTF-8 | Java | 3,638 | java | AddUserServlet.java | Java | [
{
"context": "hoto);\n\t\treq.getSession().setAttribute(\"username\", nickname);\n\t\treq.getSession().setAttribute(\"info\", photo);",
"end": 3489,
"score": 0.6887779235839844,
"start": 3481,
"tag": "USERNAME",
"value": "nickname"
}
] | null | [] | package com.qfedu.servlet;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.util.Iterator;
import java.util.List;
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 org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import com.qfedu.daoImp.UserDaoImpl;
import com.qfedu.serviceImp.AddUserImp;
import com.qfedu.util.MySqlUtil;
import com.qfedu.util.UuidUtil;
@WebServlet("/addUserServlet")
public class AddUserServlet extends HttpServlet{
private AddUserImp addUserImp=null;
public void initData() {
Connection connection = MySqlUtil.getConnection();
UserDaoImpl userDaoImpl = new UserDaoImpl();
userDaoImpl.setConnection(connection);
addUserImp = new AddUserImp();
addUserImp.setUserDao(userDaoImpl);
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doPost(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
initData();
String filePath = getServletContext().getRealPath("/photo");
File file = new File(filePath);
if(!file.exists()) {
file.mkdirs();
}
DiskFileItemFactory diskFileItemFactory = new DiskFileItemFactory();
ServletFileUpload servletFileUpload = new ServletFileUpload(diskFileItemFactory);
String nickname ="";
String password ="";
String email="";
String photo="";
String photoServletPath = "";
if(ServletFileUpload.isMultipartContent(req)) {
try {
List<FileItem> fileItems = servletFileUpload.parseRequest(req);
Iterator<FileItem> iterator = fileItems.iterator();
while(iterator.hasNext()) {
FileItem fileItem = iterator.next();
if(fileItem.isFormField()) {
String fieldValue = fileItem.getString("utf-8");
if(nickname=="") {
nickname=fieldValue;
}else if(password=="") {
password=fieldValue;
}else {
email=fieldValue;
}
}else {
String name = fileItem.getName();
name=new String(name.getBytes("gbk"), "utf-8");
req.setCharacterEncoding("utf-8");
resp.setContentType("text/html; charset=utf-8");
System.out.println(name);
String uuid = UuidUtil.getUuid();
String mainname=name.substring(name.lastIndexOf("/")+1,name.indexOf("."));
String extname=name.substring(name.indexOf("."));
photoServletPath="/"+mainname+uuid+extname;
photo=getServletContext().getContextPath()+"/photo"+photoServletPath;
filePath=filePath+"\\"+mainname+uuid+extname;
InputStream inputStream = fileItem.getInputStream();
File finalFile =new File(filePath);
FileOutputStream fos = new FileOutputStream(finalFile);
int count=0;
byte[] bytes=new byte[1024];
while((count=inputStream.read(bytes))!=-1) {
fos.write(bytes, 0, count);
}
fos.flush();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
System.out.println(nickname+"--"+password+"--"+email);
int row = addUserImp.registerUser(nickname, password, email, photo);
req.getSession().setAttribute("username", nickname);
req.getSession().setAttribute("info", photo);
if(row==1) {
resp.sendRedirect(getServletContext().getContextPath()+"/index.jsp");
}
}
}
| 3,638 | 0.717702 | 0.714129 | 104 | 33.98077 | 22.862877 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.644231 | false | false | 2 |
899bca307ec2e06e7d69f43b661f8a3b5e70eb78 | 21,062,519,641,682 | 86de8dc6dda3efee3dd22b99ca665643aa760152 | /src/main/org/nlpcn/commons/utils/内部类/OuterClassMember.java | e025e6e5a4cfd076ee532c55124ff4a35f1dde5f | [] | no_license | sladesha/sladeRode | https://github.com/sladesha/sladeRode | 5405d71e2dfdab220fecc8184b55596d3f22d74c | 3a98f02032dbcd6ae24c050d875a2e7977917609 | refs/heads/master | 2022-06-26T21:06:42.315000 | 2020-01-14T11:30:17 | 2020-01-14T11:30:17 | 204,293,642 | 1 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null | package main.org.nlpcn.commons.utils.内部类;
/**
* Created by slade on 2019/8/28.
* 1.成员内部类相当于成员变量
* 2.成员内部不能有静态成员
* 3.成员内部类可以访问外部类的全部数据
*/
public class OuterClassMember {
private int i = 10;
private static int j = 20;
public static void m1() {
System.out.println("m1");
}
private void m2() {
System.out.println("m2");
}
class InnerClass {
// static int k = 100;
// public static void m4(){}
public void m3() {
System.out.println(i);
System.out.println(j);
System.out.println("m3");
}
}
public static void main(String[] args) {
//外部类先创建出来
OuterClassMember outerClassMember = new OuterClassMember();
//创建对象的时候比较特殊outclass.new去创建内部类
InnerClass innerClass = outerClassMember.new InnerClass();
innerClass.m3();
}
}
| UTF-8 | Java | 1,020 | java | OuterClassMember.java | Java | [
{
"context": "in.org.nlpcn.commons.utils.内部类;\n\n/**\n * Created by slade on 2019/8/28.\n * 1.成员内部类相当于成员变量\n * 2.成员内部不能有静态成员\n",
"end": 66,
"score": 0.9996363520622253,
"start": 61,
"tag": "USERNAME",
"value": "slade"
}
] | null | [] | package main.org.nlpcn.commons.utils.内部类;
/**
* Created by slade on 2019/8/28.
* 1.成员内部类相当于成员变量
* 2.成员内部不能有静态成员
* 3.成员内部类可以访问外部类的全部数据
*/
public class OuterClassMember {
private int i = 10;
private static int j = 20;
public static void m1() {
System.out.println("m1");
}
private void m2() {
System.out.println("m2");
}
class InnerClass {
// static int k = 100;
// public static void m4(){}
public void m3() {
System.out.println(i);
System.out.println(j);
System.out.println("m3");
}
}
public static void main(String[] args) {
//外部类先创建出来
OuterClassMember outerClassMember = new OuterClassMember();
//创建对象的时候比较特殊outclass.new去创建内部类
InnerClass innerClass = outerClassMember.new InnerClass();
innerClass.m3();
}
}
| 1,020 | 0.581448 | 0.553167 | 42 | 20.047619 | 17.705194 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 2 |
c4ac66ab5d3ddf6f6d662441203caa1978092905 | 3,169,685,930,206 | 0cf6fd23080b175d3308257fa5cd9a7cd64ba0ac | /src/java/com/sivotek/crm/persistent/dao/entities/controllers/entitiePrepObjects/CompanydepartmentPrep.java | c6bf853c4f7d1507abe45b35d97630bb8462d6ab | [] | no_license | contactokoyevictor/TRANSCEND-CRM | https://github.com/contactokoyevictor/TRANSCEND-CRM | 2b8f4e89864d5927f3f61d851b391384d87e9e96 | 44312a72716e072da38183dead04add8fa0a1d81 | refs/heads/master | 2020-04-18T13:48:57.820000 | 2019-01-25T15:54:12 | 2019-01-25T15:54:12 | 167,571,621 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* ENTERPRISE RESOURCE PLANNING AND CUSTOMER RELATIONSHIP MANAGEMENT SYSTEM.
* DEVELOPED BY OKOYE VICTOR FOR SIVOTEK SOLUTIONS LLC.
* ALL RIGHT RESERVED 2014
*/
package com.sivotek.crm.persistent.dao.entities.controllers.entitiePrepObjects;
import com.sivotek.crm.persistent.dao.entities.Company;
import com.sivotek.crm.persistent.dao.entities.CompanyPK;
import com.sivotek.crm.persistent.dao.entities.Companydepartment;
import com.sivotek.crm.persistent.dao.entities.CompanydepartmentPK;
import com.sivotek.crm.persistent.dao.entities.Companyemployee;
import com.sivotek.crm.persistent.dao.entities.CompanyemployeePK;
import com.sivotek.crm.persistent.dao.entities.controllers.CompanyJpaController;
import com.sivotek.crm.persistent.dao.entities.controllers.CompanydepartmentJpaController;
import com.sivotek.crm.persistent.dao.entities.controllers.CompanyemployeeJpaController;
import com.sivotek.crm.xsd.jaxb.response.Response;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import javax.xml.bind.JAXBElement;
/**
*
* @author okoyevictor
*/
public class CompanydepartmentPrep {
private String status = "";
private String statusmessage = "";
private int id = 0;
private Response response;
//getters and setters
public int getId()
{return id;}
public void setId(int id)
{this.id = id;}
public String getStatus()
{return status;}
public void setStatus(String status)
{this.status = status;}
public String getStatusmessage()
{return statusmessage;}
public void setStatusmessage(String statusmessage)
{this.statusmessage = statusmessage;}
private String getElementStringValueFromList(String elementName, List elementList) {
for (Object elementList1 : elementList) {
JAXBElement e = (JAXBElement) elementList1;
if (e.getName().getLocalPart().equals(elementName)) {
return e.getValue().toString();
}
}
return null;
}
///
public List<Response.Page.Elements.Element> companydepartment(List children, int publickey, int companyID){
//create response Object Factory
com.sivotek.crm.xsd.jaxb.response.ObjectFactory responseOF = new com.sivotek.crm.xsd.jaxb.response.ObjectFactory();
//create response <Page> Object
com.sivotek.crm.xsd.jaxb.response.Response.Page responsePage = responseOF.createResponsePage();
//create response <elements> object
com.sivotek.crm.xsd.jaxb.response.Response.Page.Elements responseElements = responseOF.createResponsePageElements();
//initialize response object
response = responseOF.createResponse();
Response.Page.Elements.Element resElement = responseOF.createResponsePageElementsElement();
List<Response.Page.Elements.Element> responseElementList = responseElements.getElement();
Company company = new Company();
CompanyPK companyPK = new CompanyPK();
companyPK.setCompanyid(companyID);
companyPK.setPubkey(publickey);
CompanyJpaController companyJpaController = new CompanyJpaController();
company = companyJpaController.findCompany(companyPK);
int empid = 0;
int dphead = 0;
int departid = 0;
if(company.getCompanyPK().getCompanyid() > 0){
String name = getElementStringValueFromList("name", children);
String employeeid = getElementStringValueFromList("employeeid", children);
String code = getElementStringValueFromList("code", children);
String heads = getElementStringValueFromList("heads", children);
String description = getElementStringValueFromList("description", children);
String departmentid = getElementStringValueFromList("departmentid", children);
CompanyemployeeJpaController companyemployeeJpaController;
Companyemployee companyemployee = new Companyemployee();
try{
if(!employeeid.equalsIgnoreCase("") && !name.equalsIgnoreCase("") && !code.equalsIgnoreCase("") && !heads.equalsIgnoreCase("") && !description.equalsIgnoreCase("") && departmentid == null)
{
empid = Integer.parseInt(employeeid);
dphead = Integer.parseInt(heads);
CompanydepartmentJpaController companydepartmentJpaController = new CompanydepartmentJpaController();
Companydepartment companydepartment;
Companydepartment companydepartment_ = new Companydepartment();
CompanydepartmentPK companydepartmentPK = new CompanydepartmentPK();
companydepartmentPK.setPubkey(publickey);
if(empid > 0){
companyemployeeJpaController = new CompanyemployeeJpaController();
companyemployee = new Companyemployee();
CompanyemployeePK companyemployeePK = new CompanyemployeePK();
companyemployeePK.setPubkey(publickey);
companyemployeePK.setId(empid);
companyemployee = companyemployeeJpaController.findCompanyemployee(companyemployeePK);
companydepartment_.setCompanyemployee(companyemployee);
}
long bint = System.currentTimeMillis();
String p = ""+bint;
companydepartmentPK.setId(Integer.parseInt(p.substring(7)));
if(dphead > 0){
companydepartment = new Companydepartment();
companydepartmentPK.setId(dphead);
companydepartment = companydepartmentJpaController.findCompanydepartment(companydepartmentPK);
companydepartment_.setDepartmentHeads(companydepartment.getDepartmentHeads());
}
companydepartment_.setCompany(company);
companydepartment_.setCompanydepartmentPK(companydepartmentPK);
companydepartment_.setDepartmentName(name);
companydepartment_.setDepartmentCode(code);
companydepartment_.setDescription(description);
companydepartment_.setCreateddate(new Date());
companydepartment_.setCreatedfrom("com.sivotek.crm.persistent.dao.entities.controllers.CompanydepartmentPrep.class");
companydepartmentJpaController.create(companydepartment_);
//////////////////
resElement = responseOF.createResponsePageElementsElement();
resElement.setId("companydepartment");
resElement.setDepartmentid(companydepartment_.getCompanydepartmentPK().getId());
resElement.setElementstatus("OK");
resElement.setElementstatusmessage("Success");
////
responseElementList.add(resElement);
}
else if(empid >= 0 && !name.equalsIgnoreCase("") && !code.equalsIgnoreCase("") && dphead >= 0 && !description.equalsIgnoreCase("") && departmentid != null)
{
departid = Integer.parseInt(departmentid);
empid = Integer.parseInt(employeeid);
dphead = Integer.parseInt(heads);
CompanydepartmentJpaController companydepartmentJpaController = new CompanydepartmentJpaController();
Companydepartment companydepartment_ = new Companydepartment();
CompanydepartmentPK companydepartmentPK = new CompanydepartmentPK();
companydepartmentPK.setPubkey(publickey);
if(departid > 0)
{
companydepartmentPK.setId(departid);
companydepartment_ = companydepartmentJpaController.findCompanydepartment(companydepartmentPK);
}
if(empid > 0){
companyemployeeJpaController = new CompanyemployeeJpaController();
Companyemployee companyemployee_ch = new Companyemployee();
CompanyemployeePK companyemployee_chPK = new CompanyemployeePK();
companyemployee_chPK.setPubkey(publickey);
companyemployee_chPK.setId(empid);
companyemployee_ch = companyemployeeJpaController.findCompanyemployee(companyemployee_chPK);
companydepartment_.setCompanyemployee1(companyemployee_ch);
}
companydepartment_.setDepartmentName(name);
companydepartment_.setDepartmentCode(code);
companydepartment_.setDescription(description);
companydepartment_.setChangeddate(new Date());
companydepartment_.setChangedfrom("com.sivotek.crm.persistent.dao.entities.controllers.CompanydepartmentPrep.class");
if(dphead > 0)
{
CompanyemployeeJpaController companyemployeeJpaController_dp = new CompanyemployeeJpaController();
Companyemployee companyemployee_dp = new Companyemployee();
CompanyemployeePK companyemployee_dpPK = new CompanyemployeePK();
companyemployee_dpPK.setPubkey(publickey);
companyemployee_dpPK.setId(dphead);
companyemployee_dp = companyemployeeJpaController_dp.findCompanyemployee(companyemployee_dpPK);
System.out.println("Department head :"+companyemployee_dp.getCompanyemployeePK().getId());
companydepartment_.setDepartmentHeads(companyemployee_dp.getCompanyemployeePK().getId());
}
companydepartmentJpaController.edit(companydepartment_);
//////////////////
resElement = responseOF.createResponsePageElementsElement();
resElement.setId("companydepartment");
resElement.setDepartmentid(companydepartment_.getCompanydepartmentPK().getId());
resElement.setElementstatus("OK");
resElement.setElementstatusmessage("Success");
////
responseElementList.add(resElement);
}
else if(empid >= 0 && name.equalsIgnoreCase("") && code.equalsIgnoreCase("") && dphead >= 0 && description.equalsIgnoreCase("") && departmentid == null)
{
if(company.getCompanydepartmentCollection().size() >= 0 && departid <= 0){
Collection<Companydepartment> companydepartmentColl = company.getCompanydepartmentCollection();
for(Companydepartment department : companydepartmentColl){
//////////////////
resElement = responseOF.createResponsePageElementsElement();
resElement.setId("companydepartment");
resElement.setName(department.getDepartmentName());
resElement.setDepartmentid(department.getCompanydepartmentPK().getId());
if(department.getDepartmentHeads() != null)
{
resElement.setHeads(department.getDepartmentHeads());
}
resElement.setCode(department.getDepartmentCode());
resElement.setHeads(department.getDepartmentHeads());
resElement.setDescription(department.getDescription());
resElement.setElementstatus("OK");
resElement.setElementstatusmessage("Success");
////
responseElementList.add(resElement);
}
}
}
}catch(Exception ex){
System.out.println("Exception Here :"+ex.getMessage());
this.setStatus("ERROR");
this.setStatusmessage(ex.getMessage());
}
}
return responseElementList;
}
}
| UTF-8 | Java | 13,211 | java | CompanydepartmentPrep.java | Java | [
{
"context": "ort javax.xml.bind.JAXBElement;\n\n/**\n *\n * @author okoyevictor\n */\npublic class CompanydepartmentPrep {\n priva",
"end": 1080,
"score": 0.9991917610168457,
"start": 1069,
"tag": "USERNAME",
"value": "okoyevictor"
}
] | null | [] | /*
* ENTERPRISE RESOURCE PLANNING AND CUSTOMER RELATIONSHIP MANAGEMENT SYSTEM.
* DEVELOPED BY OKOYE VICTOR FOR SIVOTEK SOLUTIONS LLC.
* ALL RIGHT RESERVED 2014
*/
package com.sivotek.crm.persistent.dao.entities.controllers.entitiePrepObjects;
import com.sivotek.crm.persistent.dao.entities.Company;
import com.sivotek.crm.persistent.dao.entities.CompanyPK;
import com.sivotek.crm.persistent.dao.entities.Companydepartment;
import com.sivotek.crm.persistent.dao.entities.CompanydepartmentPK;
import com.sivotek.crm.persistent.dao.entities.Companyemployee;
import com.sivotek.crm.persistent.dao.entities.CompanyemployeePK;
import com.sivotek.crm.persistent.dao.entities.controllers.CompanyJpaController;
import com.sivotek.crm.persistent.dao.entities.controllers.CompanydepartmentJpaController;
import com.sivotek.crm.persistent.dao.entities.controllers.CompanyemployeeJpaController;
import com.sivotek.crm.xsd.jaxb.response.Response;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import javax.xml.bind.JAXBElement;
/**
*
* @author okoyevictor
*/
public class CompanydepartmentPrep {
private String status = "";
private String statusmessage = "";
private int id = 0;
private Response response;
//getters and setters
public int getId()
{return id;}
public void setId(int id)
{this.id = id;}
public String getStatus()
{return status;}
public void setStatus(String status)
{this.status = status;}
public String getStatusmessage()
{return statusmessage;}
public void setStatusmessage(String statusmessage)
{this.statusmessage = statusmessage;}
private String getElementStringValueFromList(String elementName, List elementList) {
for (Object elementList1 : elementList) {
JAXBElement e = (JAXBElement) elementList1;
if (e.getName().getLocalPart().equals(elementName)) {
return e.getValue().toString();
}
}
return null;
}
///
public List<Response.Page.Elements.Element> companydepartment(List children, int publickey, int companyID){
//create response Object Factory
com.sivotek.crm.xsd.jaxb.response.ObjectFactory responseOF = new com.sivotek.crm.xsd.jaxb.response.ObjectFactory();
//create response <Page> Object
com.sivotek.crm.xsd.jaxb.response.Response.Page responsePage = responseOF.createResponsePage();
//create response <elements> object
com.sivotek.crm.xsd.jaxb.response.Response.Page.Elements responseElements = responseOF.createResponsePageElements();
//initialize response object
response = responseOF.createResponse();
Response.Page.Elements.Element resElement = responseOF.createResponsePageElementsElement();
List<Response.Page.Elements.Element> responseElementList = responseElements.getElement();
Company company = new Company();
CompanyPK companyPK = new CompanyPK();
companyPK.setCompanyid(companyID);
companyPK.setPubkey(publickey);
CompanyJpaController companyJpaController = new CompanyJpaController();
company = companyJpaController.findCompany(companyPK);
int empid = 0;
int dphead = 0;
int departid = 0;
if(company.getCompanyPK().getCompanyid() > 0){
String name = getElementStringValueFromList("name", children);
String employeeid = getElementStringValueFromList("employeeid", children);
String code = getElementStringValueFromList("code", children);
String heads = getElementStringValueFromList("heads", children);
String description = getElementStringValueFromList("description", children);
String departmentid = getElementStringValueFromList("departmentid", children);
CompanyemployeeJpaController companyemployeeJpaController;
Companyemployee companyemployee = new Companyemployee();
try{
if(!employeeid.equalsIgnoreCase("") && !name.equalsIgnoreCase("") && !code.equalsIgnoreCase("") && !heads.equalsIgnoreCase("") && !description.equalsIgnoreCase("") && departmentid == null)
{
empid = Integer.parseInt(employeeid);
dphead = Integer.parseInt(heads);
CompanydepartmentJpaController companydepartmentJpaController = new CompanydepartmentJpaController();
Companydepartment companydepartment;
Companydepartment companydepartment_ = new Companydepartment();
CompanydepartmentPK companydepartmentPK = new CompanydepartmentPK();
companydepartmentPK.setPubkey(publickey);
if(empid > 0){
companyemployeeJpaController = new CompanyemployeeJpaController();
companyemployee = new Companyemployee();
CompanyemployeePK companyemployeePK = new CompanyemployeePK();
companyemployeePK.setPubkey(publickey);
companyemployeePK.setId(empid);
companyemployee = companyemployeeJpaController.findCompanyemployee(companyemployeePK);
companydepartment_.setCompanyemployee(companyemployee);
}
long bint = System.currentTimeMillis();
String p = ""+bint;
companydepartmentPK.setId(Integer.parseInt(p.substring(7)));
if(dphead > 0){
companydepartment = new Companydepartment();
companydepartmentPK.setId(dphead);
companydepartment = companydepartmentJpaController.findCompanydepartment(companydepartmentPK);
companydepartment_.setDepartmentHeads(companydepartment.getDepartmentHeads());
}
companydepartment_.setCompany(company);
companydepartment_.setCompanydepartmentPK(companydepartmentPK);
companydepartment_.setDepartmentName(name);
companydepartment_.setDepartmentCode(code);
companydepartment_.setDescription(description);
companydepartment_.setCreateddate(new Date());
companydepartment_.setCreatedfrom("com.sivotek.crm.persistent.dao.entities.controllers.CompanydepartmentPrep.class");
companydepartmentJpaController.create(companydepartment_);
//////////////////
resElement = responseOF.createResponsePageElementsElement();
resElement.setId("companydepartment");
resElement.setDepartmentid(companydepartment_.getCompanydepartmentPK().getId());
resElement.setElementstatus("OK");
resElement.setElementstatusmessage("Success");
////
responseElementList.add(resElement);
}
else if(empid >= 0 && !name.equalsIgnoreCase("") && !code.equalsIgnoreCase("") && dphead >= 0 && !description.equalsIgnoreCase("") && departmentid != null)
{
departid = Integer.parseInt(departmentid);
empid = Integer.parseInt(employeeid);
dphead = Integer.parseInt(heads);
CompanydepartmentJpaController companydepartmentJpaController = new CompanydepartmentJpaController();
Companydepartment companydepartment_ = new Companydepartment();
CompanydepartmentPK companydepartmentPK = new CompanydepartmentPK();
companydepartmentPK.setPubkey(publickey);
if(departid > 0)
{
companydepartmentPK.setId(departid);
companydepartment_ = companydepartmentJpaController.findCompanydepartment(companydepartmentPK);
}
if(empid > 0){
companyemployeeJpaController = new CompanyemployeeJpaController();
Companyemployee companyemployee_ch = new Companyemployee();
CompanyemployeePK companyemployee_chPK = new CompanyemployeePK();
companyemployee_chPK.setPubkey(publickey);
companyemployee_chPK.setId(empid);
companyemployee_ch = companyemployeeJpaController.findCompanyemployee(companyemployee_chPK);
companydepartment_.setCompanyemployee1(companyemployee_ch);
}
companydepartment_.setDepartmentName(name);
companydepartment_.setDepartmentCode(code);
companydepartment_.setDescription(description);
companydepartment_.setChangeddate(new Date());
companydepartment_.setChangedfrom("com.sivotek.crm.persistent.dao.entities.controllers.CompanydepartmentPrep.class");
if(dphead > 0)
{
CompanyemployeeJpaController companyemployeeJpaController_dp = new CompanyemployeeJpaController();
Companyemployee companyemployee_dp = new Companyemployee();
CompanyemployeePK companyemployee_dpPK = new CompanyemployeePK();
companyemployee_dpPK.setPubkey(publickey);
companyemployee_dpPK.setId(dphead);
companyemployee_dp = companyemployeeJpaController_dp.findCompanyemployee(companyemployee_dpPK);
System.out.println("Department head :"+companyemployee_dp.getCompanyemployeePK().getId());
companydepartment_.setDepartmentHeads(companyemployee_dp.getCompanyemployeePK().getId());
}
companydepartmentJpaController.edit(companydepartment_);
//////////////////
resElement = responseOF.createResponsePageElementsElement();
resElement.setId("companydepartment");
resElement.setDepartmentid(companydepartment_.getCompanydepartmentPK().getId());
resElement.setElementstatus("OK");
resElement.setElementstatusmessage("Success");
////
responseElementList.add(resElement);
}
else if(empid >= 0 && name.equalsIgnoreCase("") && code.equalsIgnoreCase("") && dphead >= 0 && description.equalsIgnoreCase("") && departmentid == null)
{
if(company.getCompanydepartmentCollection().size() >= 0 && departid <= 0){
Collection<Companydepartment> companydepartmentColl = company.getCompanydepartmentCollection();
for(Companydepartment department : companydepartmentColl){
//////////////////
resElement = responseOF.createResponsePageElementsElement();
resElement.setId("companydepartment");
resElement.setName(department.getDepartmentName());
resElement.setDepartmentid(department.getCompanydepartmentPK().getId());
if(department.getDepartmentHeads() != null)
{
resElement.setHeads(department.getDepartmentHeads());
}
resElement.setCode(department.getDepartmentCode());
resElement.setHeads(department.getDepartmentHeads());
resElement.setDescription(department.getDescription());
resElement.setElementstatus("OK");
resElement.setElementstatusmessage("Success");
////
responseElementList.add(resElement);
}
}
}
}catch(Exception ex){
System.out.println("Exception Here :"+ex.getMessage());
this.setStatus("ERROR");
this.setStatusmessage(ex.getMessage());
}
}
return responseElementList;
}
}
| 13,211 | 0.577625 | 0.575808 | 235 | 55.217022 | 36.312588 | 209 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.625532 | false | false | 2 |
6d16db19584d6cc1fb189eb21bc4605ed02ba328 | 34,041,910,807,539 | 82a8f35c86c274cb23279314db60ab687d33a691 | /app/src/main/java/com/duokan/reader/ui/general/web/C1374t.java | c8711bc24a86855cd7a7e761bc5979a491bf44a8 | [] | no_license | QMSCount/DReader | https://github.com/QMSCount/DReader | 42363f6187b907dedde81ab3b9991523cbf2786d | c1537eed7091e32a5e2e52c79360606f622684bc | refs/heads/master | 2021-09-14T22:16:45.495000 | 2018-05-20T14:57:15 | 2018-05-20T14:57:15 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.duokan.reader.ui.general.web;
import android.view.View;
import android.view.View.OnClickListener;
/* renamed from: com.duokan.reader.ui.general.web.t */
class C1374t implements OnClickListener {
/* renamed from: a */
final /* synthetic */ int f8175a;
/* renamed from: b */
final /* synthetic */ SearchController f8176b;
C1374t(SearchController searchController, int i) {
this.f8176b = searchController;
this.f8175a = i;
}
public void onClick(View view) {
this.f8176b.removeHistory(this.f8175a);
}
}
| UTF-8 | Java | 571 | java | C1374t.java | Java | [] | null | [] | package com.duokan.reader.ui.general.web;
import android.view.View;
import android.view.View.OnClickListener;
/* renamed from: com.duokan.reader.ui.general.web.t */
class C1374t implements OnClickListener {
/* renamed from: a */
final /* synthetic */ int f8175a;
/* renamed from: b */
final /* synthetic */ SearchController f8176b;
C1374t(SearchController searchController, int i) {
this.f8176b = searchController;
this.f8175a = i;
}
public void onClick(View view) {
this.f8176b.removeHistory(this.f8175a);
}
}
| 571 | 0.676007 | 0.619965 | 21 | 26.190475 | 19.355371 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 2 |
c34ee4d9276033444cc46dd3fc822fd707edb077 | 6,536,940,291,374 | a8eb13e507d8c3c0bbf515dc757dd12d5b86c6c1 | /aimxcel-graphics/src/main/java/com/aimxcel/abclearn/aimxcelgraphics/test/jcomponents/TestAimxcelJComponentTabTraversal.java | 675b938a9721e6147608cae00b7b761002c2b721 | [] | no_license | venkat-thota/java-simulations | https://github.com/venkat-thota/java-simulations | 41bb30375c1a2dedff1e1d64fade90c0ab2eac6a | d4c94d9cc84c9ee57c7b541843f8235352726f5e | refs/heads/master | 2020-12-04T01:33:55.211000 | 2020-01-24T16:26:12 | 2020-01-24T16:26:12 | 231,548,090 | 0 | 0 | null | false | 2020-10-13T18:37:51 | 2020-01-03T08:47:26 | 2020-01-24T16:26:21 | 2020-10-13T18:37:50 | 67,751 | 0 | 0 | 4 | Java | false | false |
package com.aimxcel.abclearn.aimxcelgraphics.test.jcomponents;
import java.awt.Color;
import java.awt.Font;
import java.io.IOException;
import javax.swing.JTextField;
import com.aimxcel.abclearn.aimxcelgraphics.application.AimxcelGraphicsModule;
import com.aimxcel.abclearn.aimxcelgraphics.view.ApparatusPanel2;
import com.aimxcel.abclearn.aimxcelgraphics.view.aimxcelcomponents.AimxcelJComponent;
import com.aimxcel.abclearn.aimxcelgraphics.view.aimxcelgraphics.AimxcelGraphic;
import com.aimxcel.abclearn.aimxcelgraphics.view.aimxcelgraphics.HTMLGraphic;
import com.aimxcel.abclearn.common.aimxcelcommon.application.AimxcelTestApplication;
import com.aimxcel.abclearn.common.aimxcelcommon.model.BaseModel;
import com.aimxcel.abclearn.common.aimxcelcommon.model.clock.IClock;
import com.aimxcel.abclearn.common.aimxcelcommon.model.clock.SwingClock;
import com.aimxcel.abclearn.common.aimxcelcommon.view.util.AimxcelFont;
public class TestAimxcelJComponentTabTraversal {
public static void main( String args[] ) throws IOException {
TestAimxcelJComponentTabTraversal test = new TestAimxcelJComponentTabTraversal( args );
}
public TestAimxcelJComponentTabTraversal( String[] args ) throws IOException {
IClock clock = new SwingClock( 40, 1 );
AimxcelTestApplication app = new AimxcelTestApplication( args );
// Add modules.
AimxcelGraphicsModule module = new TestModule( clock );
app.setModules( new AimxcelGraphicsModule[] { module } );
// Start the app.
app.startApplication();
}
private class TestModule extends AimxcelGraphicsModule {
public TestModule( IClock clock ) {
super( "Test Module", clock );
// Model
BaseModel model = new BaseModel();
setModel( model );
// Apparatus Panel
ApparatusPanel2 apparatusPanel = new ApparatusPanel2( clock );
apparatusPanel.setBackground( Color.WHITE );
setApparatusPanel( apparatusPanel );
Font font = new AimxcelFont( Font.PLAIN, 14 );
// Instructions
String html = "<html>Click in a text field.<br>Then use Tab or Shift-Tab to move between text fields.</html>";
HTMLGraphic instructions = new HTMLGraphic( apparatusPanel, font, html, Color.BLACK );
instructions.setLocation( 15, 15 );
apparatusPanel.addGraphic( instructions );
// JTextFields, wrapped by AimxcelJComponent.
for ( int i = 0; i < 5; i++ ) {
JTextField textField = new JTextField();
textField.setFont( font );
textField.setColumns( 3 );
AimxcelGraphic textFieldGraphic = AimxcelJComponent.newInstance( apparatusPanel, textField );
textFieldGraphic.setLocation( 20 + ( i * 60 ), 100 );
apparatusPanel.addGraphic( textFieldGraphic );
}
}
}
}
| UTF-8 | Java | 2,969 | java | TestAimxcelJComponentTabTraversal.java | Java | [] | null | [] |
package com.aimxcel.abclearn.aimxcelgraphics.test.jcomponents;
import java.awt.Color;
import java.awt.Font;
import java.io.IOException;
import javax.swing.JTextField;
import com.aimxcel.abclearn.aimxcelgraphics.application.AimxcelGraphicsModule;
import com.aimxcel.abclearn.aimxcelgraphics.view.ApparatusPanel2;
import com.aimxcel.abclearn.aimxcelgraphics.view.aimxcelcomponents.AimxcelJComponent;
import com.aimxcel.abclearn.aimxcelgraphics.view.aimxcelgraphics.AimxcelGraphic;
import com.aimxcel.abclearn.aimxcelgraphics.view.aimxcelgraphics.HTMLGraphic;
import com.aimxcel.abclearn.common.aimxcelcommon.application.AimxcelTestApplication;
import com.aimxcel.abclearn.common.aimxcelcommon.model.BaseModel;
import com.aimxcel.abclearn.common.aimxcelcommon.model.clock.IClock;
import com.aimxcel.abclearn.common.aimxcelcommon.model.clock.SwingClock;
import com.aimxcel.abclearn.common.aimxcelcommon.view.util.AimxcelFont;
public class TestAimxcelJComponentTabTraversal {
public static void main( String args[] ) throws IOException {
TestAimxcelJComponentTabTraversal test = new TestAimxcelJComponentTabTraversal( args );
}
public TestAimxcelJComponentTabTraversal( String[] args ) throws IOException {
IClock clock = new SwingClock( 40, 1 );
AimxcelTestApplication app = new AimxcelTestApplication( args );
// Add modules.
AimxcelGraphicsModule module = new TestModule( clock );
app.setModules( new AimxcelGraphicsModule[] { module } );
// Start the app.
app.startApplication();
}
private class TestModule extends AimxcelGraphicsModule {
public TestModule( IClock clock ) {
super( "Test Module", clock );
// Model
BaseModel model = new BaseModel();
setModel( model );
// Apparatus Panel
ApparatusPanel2 apparatusPanel = new ApparatusPanel2( clock );
apparatusPanel.setBackground( Color.WHITE );
setApparatusPanel( apparatusPanel );
Font font = new AimxcelFont( Font.PLAIN, 14 );
// Instructions
String html = "<html>Click in a text field.<br>Then use Tab or Shift-Tab to move between text fields.</html>";
HTMLGraphic instructions = new HTMLGraphic( apparatusPanel, font, html, Color.BLACK );
instructions.setLocation( 15, 15 );
apparatusPanel.addGraphic( instructions );
// JTextFields, wrapped by AimxcelJComponent.
for ( int i = 0; i < 5; i++ ) {
JTextField textField = new JTextField();
textField.setFont( font );
textField.setColumns( 3 );
AimxcelGraphic textFieldGraphic = AimxcelJComponent.newInstance( apparatusPanel, textField );
textFieldGraphic.setLocation( 20 + ( i * 60 ), 100 );
apparatusPanel.addGraphic( textFieldGraphic );
}
}
}
}
| 2,969 | 0.691815 | 0.684406 | 72 | 40.222221 | 32.191364 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.694444 | false | false | 2 |
24a801968be5dbb3ed83955d442df0e1de329f0b | 33,767,032,888,208 | d0835aca1415b8aa9cfda95fb187c2e033fd50df | /Chapter 10/CopyFile.java | 80923816c62244b2ead104008b124907fa95f81c | [] | no_license | arviinnd-5989/Java---A-beginner-s-guide | https://github.com/arviinnd-5989/Java---A-beginner-s-guide | c08496ed55ca9648dfb5d5323c6622004bb81803 | 3cafbebdb62b229eb369bfb0017dc548f12ba416 | refs/heads/master | 2022-12-22T01:22:01.610000 | 2020-09-14T05:22:03 | 2020-09-14T05:22:03 | 295,311,615 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.io.*;
class CopyFile {
public static void main(String args[]) throws IOException
{
int i;
FileInputStream fin = null;
FileOutputStream fout = null;
if(args.length !=2){
System.out.println("Usage : copy file from to");
return;
}
try{
fin = new FileInputStream(args[0]);
fout = new FileOutputStream(args[1]);
do{
i = fin.read();
if(i!= -1) fout.write(i);
} while(i!=-1);
} catch(IOException exc){
System.out.println("I/O Error : " + exc);
} finally {
try{
if(fin!=null) fin.close();
} catch(IOException exc){
System.out.println("Error Closing Input File");
}
try{
if(fout!= null) fout.close();
}catch(IOException exc){
System.out.println("Error closing output file");
}
}
}
}
| UTF-8 | Java | 693 | java | CopyFile.java | Java | [] | null | [] | import java.io.*;
class CopyFile {
public static void main(String args[]) throws IOException
{
int i;
FileInputStream fin = null;
FileOutputStream fout = null;
if(args.length !=2){
System.out.println("Usage : copy file from to");
return;
}
try{
fin = new FileInputStream(args[0]);
fout = new FileOutputStream(args[1]);
do{
i = fin.read();
if(i!= -1) fout.write(i);
} while(i!=-1);
} catch(IOException exc){
System.out.println("I/O Error : " + exc);
} finally {
try{
if(fin!=null) fin.close();
} catch(IOException exc){
System.out.println("Error Closing Input File");
}
try{
if(fout!= null) fout.close();
}catch(IOException exc){
System.out.println("Error closing output file");
}
}
}
}
| 693 | 0.679654 | 0.672439 | 38 | 17.18421 | 16.492191 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.421053 | false | false | 2 |
2ab0e59b1269c140f7bab536a71cc0f09add2c6c | 34,583,076,687,378 | c4e561676856d9bf8db5ca02a5753b856b0ffe38 | /pickerui/src/main/java/com/warm/pickerui/ui/base/BaseViewHolder.java | 9fb65400b516835df75c34de41381feb804f5657 | [] | no_license | AWarmHug/PhotoPicker | https://github.com/AWarmHug/PhotoPicker | 9a38fe2925356aecb112e785499a02686336873d | 007a4a580d1b8debd77b0b2e76b0021ca218f6fd | refs/heads/master | 2018-10-28T01:13:00.995000 | 2018-08-24T07:20:07 | 2018-08-24T07:20:07 | 111,041,252 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.warm.pickerui.ui.base;
import android.support.v7.widget.RecyclerView;
import android.view.View;
/**
* 作者: 51hs_android
* 时间: 2017/7/31
* 简介:
*/
public class BaseViewHolder extends RecyclerView.ViewHolder {
public BaseViewHolder(View itemView) {
super(itemView);
}
}
| UTF-8 | Java | 315 | java | BaseViewHolder.java | Java | [
{
"context": "cyclerView;\nimport android.view.View;\n\n/**\n * 作者: 51hs_android\n * 时间: 2017/7/31\n * 简介:\n */\n\npublic class BaseVie",
"end": 133,
"score": 0.9990302324295044,
"start": 121,
"tag": "USERNAME",
"value": "51hs_android"
}
] | null | [] | package com.warm.pickerui.ui.base;
import android.support.v7.widget.RecyclerView;
import android.view.View;
/**
* 作者: 51hs_android
* 时间: 2017/7/31
* 简介:
*/
public class BaseViewHolder extends RecyclerView.ViewHolder {
public BaseViewHolder(View itemView) {
super(itemView);
}
}
| 315 | 0.69967 | 0.666667 | 18 | 15.833333 | 18.472954 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.222222 | false | false | 2 |
8fad525064f1324bad74be4452b6d3ede5ec042b | 36,318,243,468,171 | 75b88ee215b74c0cc33e8e92d8ca107a11c98137 | /touch-EMR/src/WorkList/RefrashWorkList.java | 5db085f6242671978b88d09c0622b2c423f6767a | [] | no_license | Tseegii-Tselmeg/twhis | https://github.com/Tseegii-Tselmeg/twhis | 6cc9f9cc81061e74235c0a3efea61d21dabf0999 | 991693c4c8db79f479a71f77b5d53f7b2ed008fb | refs/heads/master | 2021-01-22T05:01:30.262000 | 2013-09-16T08:26:03 | 2013-09-16T08:26:03 | 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 WorkList;
import Common.TabTools;
import Multilingual.language;
import Common.*;
import cc.johnwu.date.DateMethod;
import cc.johnwu.login.UserInfo;
import cc.johnwu.sql.DBC;
import cc.johnwu.sql.HISModel;
import java.awt.Color;
import java.sql.*;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
/**
*
* @author steven
*/
public class RefrashWorkList extends Thread{
private String m_SysName; // 進入系統名稱
private language paragraph = new language();
private String[] line = paragraph.setlanguage("DIAGNOSISWORKLIST").split("\n") ;
private javax.swing.JTable m_Tab;
private long m_Time;
private String m_LastTouchTime;
private String[] m_Guid;
private ResultSet rs = null;
private String sql;
protected RefrashWorkList(javax.swing.JTable tab,long time, String SysName){
m_SysName = SysName;
if (SysName.equals("dia")) {
sql = "SELECT A.visits_no AS '"+paragraph.getLanguage(line, "COL_NO")+"', "+
"A.register AS '"+paragraph.getLanguage(line, "COL_REGISTER")+"', " +
"(SELECT CASE COUNT(registration_info.guid) "+
"WHEN 0 THEN '*' "+
"END "+
"FROM outpatient_services, registration_info "+
"WHERE registration_info.guid = outpatient_services.reg_guid AND p_no = A.p_no ) AS '"+paragraph.getLanguage(line, "COL_FIRST")+"', "+
"CASE A.finish WHEN 'F' THEN 'F' WHEN 'O' THEN 'Skip' END 'Status', "+
"A.reg_time AS '"+paragraph.getLanguage(line, "COL_REGTIME")+"', A.p_no AS '"+paragraph.getLanguage(line, "COL_PATIENTNO")+"', "+
"concat(patients_info.firstname,' ',patients_info.lastname) AS '"+paragraph.getLanguage(line, "COL_NAME")+"', "+
"patients_info.birth AS '"+paragraph.getLanguage(line, "COL_BIRTH")+"', "+
"patients_info.gender AS '"+paragraph.getLanguage(line, "COL_GENDER")+"', "+
"concat(patients_info.bloodtype,patients_info.rh_type) AS '"+paragraph.getLanguage(line, "COL_BLOOD")+"', "+
"patients_info.ps AS '"+paragraph.getLanguage(line, "COL_PS")+"', "+
"A.guid "+
"FROM registration_info AS A, patients_info, shift_table,staff_info, poli_room, policlinic "+
"WHERE A.shift_guid = shift_table.guid "+
"AND shift_table.s_id = '"+UserInfo.getUserID()+"' "+
"AND shift_table.shift_date = '"+DateMethod.getTodayYMD()+"' "+
"AND shift_table.shift = '"+DateMethod.getNowShiftNum()+"' "+
"AND shift_table.room_guid = poli_room.guid "+
"AND poli_room.poli_guid = policlinic.guid "+
"AND shift_table.s_id = staff_info.s_id "+
"AND (A.finish = 'F' OR A.finish IS NULL OR A.finish = 'O' OR A.finish = '') "+
"AND A.p_no = patients_info.p_no "+
"ORDER BY A.finish, A.visits_no";
} else if (SysName.equals("lab")) {
sql = "SELECT NEWTABLE.visits_no AS 'NO.', " +
"NEWTABLE.register AS 'Register' , " +
"''," +
" NULL, " +
"NEWTABLE.reg_time AS 'Reg time', " +
"NEWTABLE.p_no AS 'Patient No.', " +
"NEWTABLE.Name AS 'Name', " +
"NEWTABLE.birth AS 'Birthday', " +
"NEWTABLE.gender AS 'Gender', " +
"NEWTABLE.Blood, " +
"NEWTABLE.ps AS 'P.S.', " +
"NEWTABLE.regguid AS guid, " +
"pre_status.status AS status "+
"FROM (" +
"SELECT distinct A.visits_no, A.register, A.reg_time , A.p_no, " +
"concat(patients_info.firstname,' ',patients_info.lastname) AS 'Name', "+
"patients_info.birth , patients_info.gender , " +
"concat(patients_info.bloodtype,patients_info.rh_type) AS 'Blood', " +
"patients_info.ps, A.guid AS regguid , outpatient_services.guid AS osguid "+
"FROM registration_info AS A, patients_info, shift_table,staff_info, prescription " +
"LEFT JOIN outpatient_services ON prescription.os_guid = outpatient_services.guid ,prescription_code "+
"WHERE A.shift_guid = shift_table.guid AND shift_table.s_id = staff_info.s_id " +
"AND A.p_no = patients_info.p_no AND prescription.code = prescription_code.code "+
"AND (outpatient_services.reg_guid = A.guid OR prescription.case_guid =A.guid) " +
"AND (SELECT COUNT(code) FROM prescription LEFT JOIN outpatient_services ON prescription.os_guid = outpatient_services.guid, registration_info "+
"WHERE (prescription.finish <> 'F' OR prescription.finish IS NULL ) " +
"AND (outpatient_services.reg_guid = registration_info.guid OR prescription.case_guid = registration_info.guid) " +
"AND prescription.code = prescription_code.code "+
"AND prescription_code.type <> '"+Constant.X_RAY_CODE+"' " +
"AND registration_info.guid = A.guid) > 0 ) AS NEWTABLE "+
"LEFT JOIN (SELECT distinct case_guid,os_guid,'1' AS status FROM prescription " +
"WHERE prescription.specimen_status = '1') AS pre_status ON (pre_status.os_guid = NEWTABLE.osguid " +
"OR pre_status.case_guid = NEWTABLE.regguid) " +
"ORDER BY pre_status.status ,NEWTABLE.reg_time DESC, NEWTABLE.visits_no ";
// sql = "SELECT distinct A.visits_no AS 'NO.', A.register AS 'Register', '', NULL, A.reg_time AS 'Reg time', A.p_no AS 'Patient No.', " +
// "concat(patients_info.firstname,' ',patients_info.lastname) AS 'Name', patients_info.birth AS 'Birth', patients_info.gender AS 'Gender', " +
// "concat(patients_info.bloodtype,patients_info.rh_type) AS 'Blood', patients_info.ps AS 'P.S.', A.guid ,'' " +
// // "pre_status.status AS specimen_status " +
// "FROM registration_info AS A, " +
// " "+
// "patients_info, shift_table,staff_info, prescription LEFT JOIN outpatient_services ON prescription.os_guid = outpatient_services.guid ," +
//
// "prescription_code " +
// "WHERE A.shift_guid = shift_table.guid AND shift_table.s_id = staff_info.s_id AND A.p_no = patients_info.p_no " +
// "AND prescription.code = prescription_code.code " +
// //"AND " +
// "AND (outpatient_services.reg_guid = A.guid " +
// "OR prescription.case_guid =A.guid) " +
// "AND (SELECT COUNT(code) FROM prescription LEFT JOIN outpatient_services " +
// "ON prescription.os_guid = outpatient_services.guid, registration_info " +
// "WHERE (prescription.finish <> 'F' OR prescription.finish IS NULL ) " +
// "AND (outpatient_services.reg_guid = registration_info.guid " +
// "OR prescription.case_guid = registration_info.guid) " +
// "AND prescription.code = prescription_code.code " +
// "AND prescription_code.type <> '"+Constant.X_RAY_CODE+"' "+
// "AND registration_info.guid = A.guid) > 0 ORDER BY A.reg_time DESC, A.visits_no ";
System.out.println(sql);
} else if (SysName.equals("xray")) {
sql = "SELECT distinct A.visits_no AS '"+paragraph.getLanguage(line, "COL_NO")+"', "+
"A.register AS '"+paragraph.getLanguage(line, "COL_REGISTER")+"', " +
"'', "+
"NULL, "+
"A.reg_time AS '"+paragraph.getLanguage(line, "COL_REGTIME")+"', " +
"A.p_no AS '"+paragraph.getLanguage(line, "COL_PATIENTNO")+"', "+
"concat(patients_info.firstname,' ',patients_info.lastname) AS '"+paragraph.getLanguage(line, "COL_NAME")+"', "+
"patients_info.birth AS '"+paragraph.getLanguage(line, "COL_BIRTH")+"', "+
"patients_info.gender AS '"+paragraph.getLanguage(line, "COL_GENDER")+"', "+
"concat(patients_info.bloodtype,patients_info.rh_type) AS '"+paragraph.getLanguage(line, "COL_BLOOD")+"', "+
"patients_info.ps AS '"+paragraph.getLanguage(line, "COL_PS")+"', "+
"A.guid "+
"FROM registration_info AS A, patients_info, shift_table,staff_info, prescription, outpatient_services, prescription_code "+
"WHERE A.shift_guid = shift_table.guid "+
"AND shift_table.s_id = staff_info.s_id "+
"AND A.p_no = patients_info.p_no "+
"AND prescription.code = prescription_code.code "+
"AND prescription.os_guid = outpatient_services.guid "+
"AND outpatient_services.reg_guid = A.guid "+
"AND (SELECT COUNT(code) " +
"FROM prescription,outpatient_services, registration_info " +
"WHERE (prescription.finish <> 'F' OR prescription.finish IS NULL ) " +
"AND prescription.code = prescription_code.code "+
"AND prescription_code.type = '"+Constant.X_RAY_CODE+"' "+
"AND outpatient_services.reg_guid = registration_info.guid " +
"AND prescription.os_guid = outpatient_services.guid " +
"AND registration_info.guid = A.guid) > 0 "+
"ORDER BY A.reg_time DESC, A.visits_no ";
} else if (SysName.equals("case")) {
sql = "SELECT A.visits_no AS '"+paragraph.getLanguage(line, "COL_NO")+"', "+
"A.register AS '"+paragraph.getLanguage(line, "COL_REGISTER")+"', " +
"(SELECT CASE COUNT(registration_info.guid) "+
"WHEN 0 THEN '*' "+
"END "+
"FROM outpatient_services, registration_info "+
"WHERE registration_info.guid = outpatient_services.reg_guid AND p_no = A.p_no ) AS '"+paragraph.getLanguage(line, "COL_FIRST")+"', "+
"CASE A.case_finish WHEN 'F' THEN 'F' END 'Status', "+
"A.reg_time AS '"+paragraph.getLanguage(line, "COL_REGTIME")+"', A.p_no AS '"+paragraph.getLanguage(line, "COL_PATIENTNO")+"', "+
"concat(patients_info.firstname,' ',patients_info.lastname) AS '"+paragraph.getLanguage(line, "COL_NAME")+"', "+
"patients_info.birth AS '"+paragraph.getLanguage(line, "COL_BIRTH")+"', "+
"patients_info.gender AS '"+paragraph.getLanguage(line, "COL_GENDER")+"', "+
"concat(patients_info.bloodtype,patients_info.rh_type) AS '"+paragraph.getLanguage(line, "COL_BLOOD")+"', "+
"patients_info.ps AS '"+paragraph.getLanguage(line, "COL_PS")+"', "+
"A.guid, policlinic.typ "+
"FROM registration_info AS A, patients_info, shift_table,staff_info, poli_room, policlinic "+
"WHERE A.shift_guid = shift_table.guid "+
"AND shift_table.room_guid = poli_room.guid "+
"AND shift_table.shift_date = '"+DateMethod.getTodayYMD()+"' "+
"AND shift_table.shift = '"+DateMethod.getNowShiftNum()+"' "+
"AND poli_room.poli_guid = policlinic.guid " +
"AND shift_table.s_id = staff_info.s_id "+
"AND (A.case_finish = 'F' OR A.case_finish IS NULL) "+
"AND A.p_no = patients_info.p_no " +
"AND policlinic.typ = 'DM' "+
"ORDER BY Status, A.visits_no";
}
this.m_Tab = tab;
this.m_Time = time;
try{
rs = DBC.executeQuery(sql);
((DefaultTableModel)this.m_Tab.getModel()).setRowCount(0);
this.m_Tab.setModel(HISModel.getModel(rs));
rs.last();
setCloumnWidth(this.m_Tab);
if(SysName.equals("dia")) {
Object[][] array = {{"O",Constant.FINISH_COLOR}, {"F",Constant.FINISH_COLOR}};
TabTools.setTabColor(m_Tab, 3, array);
TabTools.setHideColumn(this.m_Tab,11);
} else if (SysName.equals("case")) {
Object[][] array = {{"F",Constant.FINISH_COLOR}};
TabTools.setTabColor(m_Tab, 3, array);
TabTools.setHideColumn(m_Tab,0);
TabTools.setHideColumn(m_Tab,11);
} else if (SysName.equals("lab")) {
Object[][] array = {{"1",Constant.WARNING_COLOR}};
TabTools.setTabColor(m_Tab, 12, array);
TabTools.setHideColumn(this.m_Tab,0);
TabTools.setHideColumn(this.m_Tab,2);
TabTools.setHideColumn(this.m_Tab,3);
TabTools.setHideColumn(this.m_Tab,11);
TabTools.setHideColumn(this.m_Tab,12);
} else if (SysName.equals("xray")) {
TabTools.setHideColumn(this.m_Tab,0);
TabTools.setHideColumn(this.m_Tab,2);
TabTools.setHideColumn(this.m_Tab,3);
TabTools.setHideColumn(this.m_Tab,11);
}
DBC.closeConnection(rs);
}catch (SQLException ex) {System.out.println(ex);
}finally{ try{ DBC.closeConnection(rs); }catch(SQLException ex){} }
}
@Override
public void run(){
try{while(true){
try {
String check_sql ="";
if (m_SysName.equals("dia")) {
check_sql = "SELECT MAX(touchtime) " +
"FROM registration_info,shift_table " +
"WHERE registration_info.shift_guid = shift_table.guid " +
"AND shift_table.s_id = '"+UserInfo.getUserID()+"' " +
"AND shift_table.shift_date = '"+DateMethod.getTodayYMD()+"' " +
"AND shift_table.shift = '"+DateMethod.getNowShiftNum()+"' ";
} else if (m_SysName.equals("lab")) { // 有問題
check_sql = "SELECT MAX(touchtime) " +
"FROM registration_info,shift_table " +
"WHERE registration_info.shift_guid = shift_table.guid " +
"AND shift_table.shift_date = '"+DateMethod.getTodayYMD()+"' " +
"AND shift_table.shift = '"+DateMethod.getNowShiftNum()+"' ";
} else if (m_SysName.equals("xray")) { // 有問題
check_sql = "SELECT MAX(touchtime) " +
"FROM registration_info,shift_table " +
"WHERE registration_info.shift_guid = shift_table.guid " +
"AND shift_table.shift_date = '"+DateMethod.getTodayYMD()+"' " +
"AND shift_table.shift = '"+DateMethod.getNowShiftNum()+"' ";
} else if (m_SysName.equals("case")) {
check_sql = "SELECT MAX(touchtime) " +
"FROM registration_info,shift_table " +
"WHERE registration_info.shift_guid = shift_table.guid " +
"AND shift_table.shift_date = '"+DateMethod.getTodayYMD()+"' " +
"AND shift_table.shift = '"+DateMethod.getNowShiftNum()+"' ";
}
rs = DBC.executeQuery(check_sql);
if(rs.next()
&& (rs.getString(1) == null || rs.getString(1).equals(m_LastTouchTime))){
RefrashWorkList.sleep(m_Time);
continue;
}
m_LastTouchTime = rs.getString(1);
DBC.closeConnection(rs);
rs = DBC.executeQuery(sql);
if(rs.last()){
int row = 0;
this.m_Guid = new String[rs.getRow()];
((DefaultTableModel)m_Tab.getModel()).setRowCount(rs.getRow());
rs.beforeFirst();
while(rs.next()){
for(int col=0; col<12; col++)
m_Tab.setValueAt(rs.getString(col+1), row, col);
row++;
}
}
DBC.closeConnection(rs);
}catch (SQLException ex) {
System.out.println("WorkList:"+ex);
}finally{
try{ DBC.closeConnection(rs);
}catch(SQLException ex){}
}
}}catch(InterruptedException e) {}
}
private void setCloumnWidth(javax.swing.JTable tab){
//設定column寬度
TableColumn columnVisits_no = tab.getColumnModel().getColumn(0);
TableColumn columnVisits_reg = tab.getColumnModel().getColumn(1);
TableColumn columnFirst = tab.getColumnModel().getColumn(2);
TableColumn columnVisits = tab.getColumnModel().getColumn(3);
TableColumn columnReg_time = tab.getColumnModel().getColumn(4);
TableColumn columnP_no = tab.getColumnModel().getColumn(5);
TableColumn columnName = tab.getColumnModel().getColumn(6);
TableColumn columnAge = tab.getColumnModel().getColumn(7);
TableColumn columnSex = tab.getColumnModel().getColumn(8);
TableColumn columnBloodtype = tab.getColumnModel().getColumn(9);
TableColumn columnPs = tab.getColumnModel().getColumn(10);
columnVisits_no.setPreferredWidth(30);
columnVisits_reg.setPreferredWidth(50);
columnFirst.setPreferredWidth(50);
columnVisits.setPreferredWidth(55);
columnReg_time.setPreferredWidth(163);
columnP_no.setPreferredWidth(75);
columnName.setPreferredWidth(150);
columnAge.setPreferredWidth(90);
columnSex.setPreferredWidth(50);
columnBloodtype.setPreferredWidth(50);
columnPs.setPreferredWidth(360);
tab.setRowHeight(30);
}
// 取得選定日期資料
public void getSelectDate(String date) {
if (m_SysName.equals("lab")) {
sql = "SELECT NEWTABLE.visits_no AS 'NO.', " +
"NEWTABLE.register AS 'Register' , " +
"''," +
" NULL, " +
"NEWTABLE.reg_time AS 'Reg time', " +
"NEWTABLE.p_no AS 'Patient No.', " +
"NEWTABLE.Name AS 'Name', " +
"NEWTABLE.birth AS 'Birthday', " +
"NEWTABLE.gender AS 'Gender', " +
"NEWTABLE.Blood, " +
"NEWTABLE.ps AS 'P.S.', " +
"NEWTABLE.regguid AS guid, " +
"pre_status.status AS status "+
"FROM (" +
"SELECT distinct A.visits_no, A.register, A.reg_time , A.p_no, " +
"concat(patients_info.firstname,' ',patients_info.lastname) AS 'Name', "+
"patients_info.birth , patients_info.gender , " +
"concat(patients_info.bloodtype,patients_info.rh_type) AS 'Blood', " +
"patients_info.ps, A.guid AS regguid , outpatient_services.guid AS osguid "+
"FROM registration_info AS A, patients_info, shift_table,staff_info, prescription " +
"LEFT JOIN outpatient_services ON prescription.os_guid = outpatient_services.guid ,prescription_code "+
"WHERE A.shift_guid = shift_table.guid AND shift_table.s_id = staff_info.s_id " +
"AND A.p_no = patients_info.p_no AND prescription.code = prescription_code.code "+
"AND (outpatient_services.reg_guid = A.guid OR prescription.case_guid =A.guid) " +
"AND (SELECT COUNT(code) FROM prescription LEFT JOIN outpatient_services ON prescription.os_guid = outpatient_services.guid, registration_info "+
"WHERE (prescription.finish <> 'F' OR prescription.finish IS NULL ) " +
"AND (outpatient_services.reg_guid = registration_info.guid OR prescription.case_guid = registration_info.guid) " +
"AND prescription.code = prescription_code.code "+
"AND prescription_code.type <> '"+Constant.X_RAY_CODE+"' " +
"AND registration_info.guid = A.guid) > 0 AND A.reg_time LIKE '"+date+"%' ) AS NEWTABLE "+
"LEFT JOIN (SELECT distinct case_guid,os_guid,'1' AS status FROM prescription " +
"WHERE prescription.specimen_status = '1') AS pre_status ON (pre_status.os_guid = NEWTABLE.osguid " +
"OR pre_status.case_guid = NEWTABLE.regguid) " +
"ORDER BY NEWTABLE.reg_time DESC, NEWTABLE.visits_no ";
} else if (m_SysName.equals("xray")) {
sql = "SELECT distinct A.visits_no AS '"+paragraph.getLanguage(line, "COL_NO")+"', "+
"A.register AS '"+paragraph.getLanguage(line, "COL_REGISTER")+"', " +
"'', "+
"NULL, "+
"A.reg_time AS '"+paragraph.getLanguage(line, "COL_REGTIME")+"', " +
"A.p_no AS '"+paragraph.getLanguage(line, "COL_PATIENTNO")+"', "+
"concat(patients_info.firstname,' ',patients_info.lastname) AS '"+paragraph.getLanguage(line, "COL_NAME")+"', "+
"patients_info.birth AS '"+paragraph.getLanguage(line, "COL_BIRTH")+"', "+
"patients_info.gender AS '"+paragraph.getLanguage(line, "COL_GENDER")+"', "+
"concat(patients_info.bloodtype,patients_info.rh_type) AS '"+paragraph.getLanguage(line, "COL_BLOOD")+"', "+
"patients_info.ps AS '"+paragraph.getLanguage(line, "COL_PS")+"', "+
"A.guid "+
"FROM registration_info AS A, patients_info, shift_table,staff_info, prescription, outpatient_services, prescription_code "+
"WHERE A.shift_guid = shift_table.guid "+
"AND shift_table.s_id = staff_info.s_id "+
"AND A.p_no = patients_info.p_no "+
"AND prescription.code = prescription_code.code "+
"AND prescription.os_guid = outpatient_services.guid "+
"AND outpatient_services.reg_guid = A.guid "+
"AND (SELECT COUNT(code) " +
"FROM prescription,outpatient_services, registration_info " +
"WHERE (prescription.finish <> 'F' OR prescription.finish IS NULL ) " +
"AND prescription.code = prescription_code.code "+
"AND prescription_code.type = '"+Constant.X_RAY_CODE+"' "+
"AND outpatient_services.reg_guid = registration_info.guid " +
"AND prescription.os_guid = outpatient_services.guid " +
"AND registration_info.guid = A.guid) > 0 "+
"AND A.reg_time LIKE '"+date+"%' "+
"ORDER BY A.reg_time DESC, A.visits_no ";
} else if (m_SysName.equals("case")) {
sql = "SELECT A.visits_no AS '"+paragraph.getLanguage(line, "COL_NO")+"', "+
"A.register AS '"+paragraph.getLanguage(line, "COL_REGISTER")+"', " +
"(SELECT CASE COUNT(registration_info.guid) "+
"WHEN 0 THEN '*' "+
"END "+
"FROM outpatient_services, registration_info "+
"WHERE registration_info.guid = outpatient_services.reg_guid AND p_no = A.p_no ) AS '"+paragraph.getLanguage(line, "COL_FIRST")+"', "+
"CASE A.case_finish WHEN 'F' THEN 'F' END 'State', "+
"A.reg_time AS '"+paragraph.getLanguage(line, "COL_REGTIME")+"', A.p_no AS '"+paragraph.getLanguage(line, "COL_PATIENTNO")+"', "+
"concat(patients_info.firstname,' ',patients_info.lastname) AS '"+paragraph.getLanguage(line, "COL_NAME")+"', "+
"patients_info.birth AS '"+paragraph.getLanguage(line, "COL_BIRTH")+"', "+
"patients_info.gender AS '"+paragraph.getLanguage(line, "COL_GENDER")+"', "+
"concat(patients_info.bloodtype,patients_info.rh_type) AS '"+paragraph.getLanguage(line, "COL_BLOOD")+"', "+
"patients_info.ps AS '"+paragraph.getLanguage(line, "COL_PS")+"', "+
"A.guid, policlinic.typ "+
"FROM registration_info AS A, patients_info, shift_table,staff_info, poli_room, policlinic "+
"WHERE A.shift_guid = shift_table.guid "+
"AND shift_table.room_guid = poli_room.guid "+
"AND poli_room.poli_guid = policlinic.guid " +
"AND shift_table.s_id = staff_info.s_id "+
"AND (A.case_finish = 'F' OR A.case_finish IS NULL) "+
"AND A.p_no = patients_info.p_no " +
"AND policlinic.typ = 'DM' "+
"AND A.reg_time LIKE '"+date+"%' "+
"ORDER BY State, A.visits_no";
}
try{
rs = DBC.executeQuery(sql);
((DefaultTableModel)this.m_Tab.getModel()).setRowCount(0);
this.m_Tab.setModel(HISModel.getModel(rs));
rs.last();
setCloumnWidth(this.m_Tab);
if(m_SysName.equals("dia")) {
Object[][] array = {{"O",new Color(204,255,153)}, {"F",new Color(204,255,153)}};
TabTools.setTabColor(m_Tab, 3, array);
TabTools.setHideColumn(this.m_Tab,11);
} else if (m_SysName.equals("case")) {
Object[][] array = {{"F",new Color(204,255,153)}};
TabTools.setTabColor(m_Tab, 3, array);
TabTools.setHideColumn(m_Tab,0);
TabTools.setHideColumn(m_Tab,11);
} else if (m_SysName.equals("lab")) {
Object[][] array = {{"1",new Color(250,232,176)}};
TabTools.setTabColor(m_Tab, 12, array);
TabTools.setHideColumn(this.m_Tab,0);
TabTools.setHideColumn(this.m_Tab,2);
TabTools.setHideColumn(this.m_Tab,3);
TabTools.setHideColumn(this.m_Tab,11);
//TabTools.setHideColumn(this.m_Tab,12);
} else if (m_SysName.equals("xray")) {
TabTools.setHideColumn(this.m_Tab,0);
TabTools.setHideColumn(this.m_Tab,2);
TabTools.setHideColumn(this.m_Tab,3);
TabTools.setHideColumn(this.m_Tab,11);
}
DBC.closeConnection(rs);
}catch (SQLException ex) {System.out.println(ex);
}finally{ try{ DBC.closeConnection(rs); }catch(SQLException ex){} }
}
// @Override
// public void interrupt(){
// super.interrupt();
// try{
// DBC.closeConnection(rs);
// System.out.println("DBC.closeConnection(rs)");
// }catch(SQLException ex){}
// try {
// finalize();
// } catch (Throwable ex) {}
// }
}
| UTF-8 | Java | 29,050 | java | RefrashWorkList.java | Java | [
{
"context": "javax.swing.table.TableColumn;\n\n\n/**\n *\n * @author steven\n */\npublic class RefrashWorkList extends Thread{\n",
"end": 465,
"score": 0.9835072755813599,
"start": 459,
"tag": "USERNAME",
"value": "steven"
},
{
"context": "its_no \";\n\n } else if (m_SysName.equals(\"xray\")) {\n sql = \"SELECT distinct A.visits_",
"end": 22247,
"score": 0.510424017906189,
"start": 22244,
"tag": "USERNAME",
"value": "ray"
}
] | null | [] | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package WorkList;
import Common.TabTools;
import Multilingual.language;
import Common.*;
import cc.johnwu.date.DateMethod;
import cc.johnwu.login.UserInfo;
import cc.johnwu.sql.DBC;
import cc.johnwu.sql.HISModel;
import java.awt.Color;
import java.sql.*;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
/**
*
* @author steven
*/
public class RefrashWorkList extends Thread{
private String m_SysName; // 進入系統名稱
private language paragraph = new language();
private String[] line = paragraph.setlanguage("DIAGNOSISWORKLIST").split("\n") ;
private javax.swing.JTable m_Tab;
private long m_Time;
private String m_LastTouchTime;
private String[] m_Guid;
private ResultSet rs = null;
private String sql;
protected RefrashWorkList(javax.swing.JTable tab,long time, String SysName){
m_SysName = SysName;
if (SysName.equals("dia")) {
sql = "SELECT A.visits_no AS '"+paragraph.getLanguage(line, "COL_NO")+"', "+
"A.register AS '"+paragraph.getLanguage(line, "COL_REGISTER")+"', " +
"(SELECT CASE COUNT(registration_info.guid) "+
"WHEN 0 THEN '*' "+
"END "+
"FROM outpatient_services, registration_info "+
"WHERE registration_info.guid = outpatient_services.reg_guid AND p_no = A.p_no ) AS '"+paragraph.getLanguage(line, "COL_FIRST")+"', "+
"CASE A.finish WHEN 'F' THEN 'F' WHEN 'O' THEN 'Skip' END 'Status', "+
"A.reg_time AS '"+paragraph.getLanguage(line, "COL_REGTIME")+"', A.p_no AS '"+paragraph.getLanguage(line, "COL_PATIENTNO")+"', "+
"concat(patients_info.firstname,' ',patients_info.lastname) AS '"+paragraph.getLanguage(line, "COL_NAME")+"', "+
"patients_info.birth AS '"+paragraph.getLanguage(line, "COL_BIRTH")+"', "+
"patients_info.gender AS '"+paragraph.getLanguage(line, "COL_GENDER")+"', "+
"concat(patients_info.bloodtype,patients_info.rh_type) AS '"+paragraph.getLanguage(line, "COL_BLOOD")+"', "+
"patients_info.ps AS '"+paragraph.getLanguage(line, "COL_PS")+"', "+
"A.guid "+
"FROM registration_info AS A, patients_info, shift_table,staff_info, poli_room, policlinic "+
"WHERE A.shift_guid = shift_table.guid "+
"AND shift_table.s_id = '"+UserInfo.getUserID()+"' "+
"AND shift_table.shift_date = '"+DateMethod.getTodayYMD()+"' "+
"AND shift_table.shift = '"+DateMethod.getNowShiftNum()+"' "+
"AND shift_table.room_guid = poli_room.guid "+
"AND poli_room.poli_guid = policlinic.guid "+
"AND shift_table.s_id = staff_info.s_id "+
"AND (A.finish = 'F' OR A.finish IS NULL OR A.finish = 'O' OR A.finish = '') "+
"AND A.p_no = patients_info.p_no "+
"ORDER BY A.finish, A.visits_no";
} else if (SysName.equals("lab")) {
sql = "SELECT NEWTABLE.visits_no AS 'NO.', " +
"NEWTABLE.register AS 'Register' , " +
"''," +
" NULL, " +
"NEWTABLE.reg_time AS 'Reg time', " +
"NEWTABLE.p_no AS 'Patient No.', " +
"NEWTABLE.Name AS 'Name', " +
"NEWTABLE.birth AS 'Birthday', " +
"NEWTABLE.gender AS 'Gender', " +
"NEWTABLE.Blood, " +
"NEWTABLE.ps AS 'P.S.', " +
"NEWTABLE.regguid AS guid, " +
"pre_status.status AS status "+
"FROM (" +
"SELECT distinct A.visits_no, A.register, A.reg_time , A.p_no, " +
"concat(patients_info.firstname,' ',patients_info.lastname) AS 'Name', "+
"patients_info.birth , patients_info.gender , " +
"concat(patients_info.bloodtype,patients_info.rh_type) AS 'Blood', " +
"patients_info.ps, A.guid AS regguid , outpatient_services.guid AS osguid "+
"FROM registration_info AS A, patients_info, shift_table,staff_info, prescription " +
"LEFT JOIN outpatient_services ON prescription.os_guid = outpatient_services.guid ,prescription_code "+
"WHERE A.shift_guid = shift_table.guid AND shift_table.s_id = staff_info.s_id " +
"AND A.p_no = patients_info.p_no AND prescription.code = prescription_code.code "+
"AND (outpatient_services.reg_guid = A.guid OR prescription.case_guid =A.guid) " +
"AND (SELECT COUNT(code) FROM prescription LEFT JOIN outpatient_services ON prescription.os_guid = outpatient_services.guid, registration_info "+
"WHERE (prescription.finish <> 'F' OR prescription.finish IS NULL ) " +
"AND (outpatient_services.reg_guid = registration_info.guid OR prescription.case_guid = registration_info.guid) " +
"AND prescription.code = prescription_code.code "+
"AND prescription_code.type <> '"+Constant.X_RAY_CODE+"' " +
"AND registration_info.guid = A.guid) > 0 ) AS NEWTABLE "+
"LEFT JOIN (SELECT distinct case_guid,os_guid,'1' AS status FROM prescription " +
"WHERE prescription.specimen_status = '1') AS pre_status ON (pre_status.os_guid = NEWTABLE.osguid " +
"OR pre_status.case_guid = NEWTABLE.regguid) " +
"ORDER BY pre_status.status ,NEWTABLE.reg_time DESC, NEWTABLE.visits_no ";
// sql = "SELECT distinct A.visits_no AS 'NO.', A.register AS 'Register', '', NULL, A.reg_time AS 'Reg time', A.p_no AS 'Patient No.', " +
// "concat(patients_info.firstname,' ',patients_info.lastname) AS 'Name', patients_info.birth AS 'Birth', patients_info.gender AS 'Gender', " +
// "concat(patients_info.bloodtype,patients_info.rh_type) AS 'Blood', patients_info.ps AS 'P.S.', A.guid ,'' " +
// // "pre_status.status AS specimen_status " +
// "FROM registration_info AS A, " +
// " "+
// "patients_info, shift_table,staff_info, prescription LEFT JOIN outpatient_services ON prescription.os_guid = outpatient_services.guid ," +
//
// "prescription_code " +
// "WHERE A.shift_guid = shift_table.guid AND shift_table.s_id = staff_info.s_id AND A.p_no = patients_info.p_no " +
// "AND prescription.code = prescription_code.code " +
// //"AND " +
// "AND (outpatient_services.reg_guid = A.guid " +
// "OR prescription.case_guid =A.guid) " +
// "AND (SELECT COUNT(code) FROM prescription LEFT JOIN outpatient_services " +
// "ON prescription.os_guid = outpatient_services.guid, registration_info " +
// "WHERE (prescription.finish <> 'F' OR prescription.finish IS NULL ) " +
// "AND (outpatient_services.reg_guid = registration_info.guid " +
// "OR prescription.case_guid = registration_info.guid) " +
// "AND prescription.code = prescription_code.code " +
// "AND prescription_code.type <> '"+Constant.X_RAY_CODE+"' "+
// "AND registration_info.guid = A.guid) > 0 ORDER BY A.reg_time DESC, A.visits_no ";
System.out.println(sql);
} else if (SysName.equals("xray")) {
sql = "SELECT distinct A.visits_no AS '"+paragraph.getLanguage(line, "COL_NO")+"', "+
"A.register AS '"+paragraph.getLanguage(line, "COL_REGISTER")+"', " +
"'', "+
"NULL, "+
"A.reg_time AS '"+paragraph.getLanguage(line, "COL_REGTIME")+"', " +
"A.p_no AS '"+paragraph.getLanguage(line, "COL_PATIENTNO")+"', "+
"concat(patients_info.firstname,' ',patients_info.lastname) AS '"+paragraph.getLanguage(line, "COL_NAME")+"', "+
"patients_info.birth AS '"+paragraph.getLanguage(line, "COL_BIRTH")+"', "+
"patients_info.gender AS '"+paragraph.getLanguage(line, "COL_GENDER")+"', "+
"concat(patients_info.bloodtype,patients_info.rh_type) AS '"+paragraph.getLanguage(line, "COL_BLOOD")+"', "+
"patients_info.ps AS '"+paragraph.getLanguage(line, "COL_PS")+"', "+
"A.guid "+
"FROM registration_info AS A, patients_info, shift_table,staff_info, prescription, outpatient_services, prescription_code "+
"WHERE A.shift_guid = shift_table.guid "+
"AND shift_table.s_id = staff_info.s_id "+
"AND A.p_no = patients_info.p_no "+
"AND prescription.code = prescription_code.code "+
"AND prescription.os_guid = outpatient_services.guid "+
"AND outpatient_services.reg_guid = A.guid "+
"AND (SELECT COUNT(code) " +
"FROM prescription,outpatient_services, registration_info " +
"WHERE (prescription.finish <> 'F' OR prescription.finish IS NULL ) " +
"AND prescription.code = prescription_code.code "+
"AND prescription_code.type = '"+Constant.X_RAY_CODE+"' "+
"AND outpatient_services.reg_guid = registration_info.guid " +
"AND prescription.os_guid = outpatient_services.guid " +
"AND registration_info.guid = A.guid) > 0 "+
"ORDER BY A.reg_time DESC, A.visits_no ";
} else if (SysName.equals("case")) {
sql = "SELECT A.visits_no AS '"+paragraph.getLanguage(line, "COL_NO")+"', "+
"A.register AS '"+paragraph.getLanguage(line, "COL_REGISTER")+"', " +
"(SELECT CASE COUNT(registration_info.guid) "+
"WHEN 0 THEN '*' "+
"END "+
"FROM outpatient_services, registration_info "+
"WHERE registration_info.guid = outpatient_services.reg_guid AND p_no = A.p_no ) AS '"+paragraph.getLanguage(line, "COL_FIRST")+"', "+
"CASE A.case_finish WHEN 'F' THEN 'F' END 'Status', "+
"A.reg_time AS '"+paragraph.getLanguage(line, "COL_REGTIME")+"', A.p_no AS '"+paragraph.getLanguage(line, "COL_PATIENTNO")+"', "+
"concat(patients_info.firstname,' ',patients_info.lastname) AS '"+paragraph.getLanguage(line, "COL_NAME")+"', "+
"patients_info.birth AS '"+paragraph.getLanguage(line, "COL_BIRTH")+"', "+
"patients_info.gender AS '"+paragraph.getLanguage(line, "COL_GENDER")+"', "+
"concat(patients_info.bloodtype,patients_info.rh_type) AS '"+paragraph.getLanguage(line, "COL_BLOOD")+"', "+
"patients_info.ps AS '"+paragraph.getLanguage(line, "COL_PS")+"', "+
"A.guid, policlinic.typ "+
"FROM registration_info AS A, patients_info, shift_table,staff_info, poli_room, policlinic "+
"WHERE A.shift_guid = shift_table.guid "+
"AND shift_table.room_guid = poli_room.guid "+
"AND shift_table.shift_date = '"+DateMethod.getTodayYMD()+"' "+
"AND shift_table.shift = '"+DateMethod.getNowShiftNum()+"' "+
"AND poli_room.poli_guid = policlinic.guid " +
"AND shift_table.s_id = staff_info.s_id "+
"AND (A.case_finish = 'F' OR A.case_finish IS NULL) "+
"AND A.p_no = patients_info.p_no " +
"AND policlinic.typ = 'DM' "+
"ORDER BY Status, A.visits_no";
}
this.m_Tab = tab;
this.m_Time = time;
try{
rs = DBC.executeQuery(sql);
((DefaultTableModel)this.m_Tab.getModel()).setRowCount(0);
this.m_Tab.setModel(HISModel.getModel(rs));
rs.last();
setCloumnWidth(this.m_Tab);
if(SysName.equals("dia")) {
Object[][] array = {{"O",Constant.FINISH_COLOR}, {"F",Constant.FINISH_COLOR}};
TabTools.setTabColor(m_Tab, 3, array);
TabTools.setHideColumn(this.m_Tab,11);
} else if (SysName.equals("case")) {
Object[][] array = {{"F",Constant.FINISH_COLOR}};
TabTools.setTabColor(m_Tab, 3, array);
TabTools.setHideColumn(m_Tab,0);
TabTools.setHideColumn(m_Tab,11);
} else if (SysName.equals("lab")) {
Object[][] array = {{"1",Constant.WARNING_COLOR}};
TabTools.setTabColor(m_Tab, 12, array);
TabTools.setHideColumn(this.m_Tab,0);
TabTools.setHideColumn(this.m_Tab,2);
TabTools.setHideColumn(this.m_Tab,3);
TabTools.setHideColumn(this.m_Tab,11);
TabTools.setHideColumn(this.m_Tab,12);
} else if (SysName.equals("xray")) {
TabTools.setHideColumn(this.m_Tab,0);
TabTools.setHideColumn(this.m_Tab,2);
TabTools.setHideColumn(this.m_Tab,3);
TabTools.setHideColumn(this.m_Tab,11);
}
DBC.closeConnection(rs);
}catch (SQLException ex) {System.out.println(ex);
}finally{ try{ DBC.closeConnection(rs); }catch(SQLException ex){} }
}
@Override
public void run(){
try{while(true){
try {
String check_sql ="";
if (m_SysName.equals("dia")) {
check_sql = "SELECT MAX(touchtime) " +
"FROM registration_info,shift_table " +
"WHERE registration_info.shift_guid = shift_table.guid " +
"AND shift_table.s_id = '"+UserInfo.getUserID()+"' " +
"AND shift_table.shift_date = '"+DateMethod.getTodayYMD()+"' " +
"AND shift_table.shift = '"+DateMethod.getNowShiftNum()+"' ";
} else if (m_SysName.equals("lab")) { // 有問題
check_sql = "SELECT MAX(touchtime) " +
"FROM registration_info,shift_table " +
"WHERE registration_info.shift_guid = shift_table.guid " +
"AND shift_table.shift_date = '"+DateMethod.getTodayYMD()+"' " +
"AND shift_table.shift = '"+DateMethod.getNowShiftNum()+"' ";
} else if (m_SysName.equals("xray")) { // 有問題
check_sql = "SELECT MAX(touchtime) " +
"FROM registration_info,shift_table " +
"WHERE registration_info.shift_guid = shift_table.guid " +
"AND shift_table.shift_date = '"+DateMethod.getTodayYMD()+"' " +
"AND shift_table.shift = '"+DateMethod.getNowShiftNum()+"' ";
} else if (m_SysName.equals("case")) {
check_sql = "SELECT MAX(touchtime) " +
"FROM registration_info,shift_table " +
"WHERE registration_info.shift_guid = shift_table.guid " +
"AND shift_table.shift_date = '"+DateMethod.getTodayYMD()+"' " +
"AND shift_table.shift = '"+DateMethod.getNowShiftNum()+"' ";
}
rs = DBC.executeQuery(check_sql);
if(rs.next()
&& (rs.getString(1) == null || rs.getString(1).equals(m_LastTouchTime))){
RefrashWorkList.sleep(m_Time);
continue;
}
m_LastTouchTime = rs.getString(1);
DBC.closeConnection(rs);
rs = DBC.executeQuery(sql);
if(rs.last()){
int row = 0;
this.m_Guid = new String[rs.getRow()];
((DefaultTableModel)m_Tab.getModel()).setRowCount(rs.getRow());
rs.beforeFirst();
while(rs.next()){
for(int col=0; col<12; col++)
m_Tab.setValueAt(rs.getString(col+1), row, col);
row++;
}
}
DBC.closeConnection(rs);
}catch (SQLException ex) {
System.out.println("WorkList:"+ex);
}finally{
try{ DBC.closeConnection(rs);
}catch(SQLException ex){}
}
}}catch(InterruptedException e) {}
}
private void setCloumnWidth(javax.swing.JTable tab){
//設定column寬度
TableColumn columnVisits_no = tab.getColumnModel().getColumn(0);
TableColumn columnVisits_reg = tab.getColumnModel().getColumn(1);
TableColumn columnFirst = tab.getColumnModel().getColumn(2);
TableColumn columnVisits = tab.getColumnModel().getColumn(3);
TableColumn columnReg_time = tab.getColumnModel().getColumn(4);
TableColumn columnP_no = tab.getColumnModel().getColumn(5);
TableColumn columnName = tab.getColumnModel().getColumn(6);
TableColumn columnAge = tab.getColumnModel().getColumn(7);
TableColumn columnSex = tab.getColumnModel().getColumn(8);
TableColumn columnBloodtype = tab.getColumnModel().getColumn(9);
TableColumn columnPs = tab.getColumnModel().getColumn(10);
columnVisits_no.setPreferredWidth(30);
columnVisits_reg.setPreferredWidth(50);
columnFirst.setPreferredWidth(50);
columnVisits.setPreferredWidth(55);
columnReg_time.setPreferredWidth(163);
columnP_no.setPreferredWidth(75);
columnName.setPreferredWidth(150);
columnAge.setPreferredWidth(90);
columnSex.setPreferredWidth(50);
columnBloodtype.setPreferredWidth(50);
columnPs.setPreferredWidth(360);
tab.setRowHeight(30);
}
// 取得選定日期資料
public void getSelectDate(String date) {
if (m_SysName.equals("lab")) {
sql = "SELECT NEWTABLE.visits_no AS 'NO.', " +
"NEWTABLE.register AS 'Register' , " +
"''," +
" NULL, " +
"NEWTABLE.reg_time AS 'Reg time', " +
"NEWTABLE.p_no AS 'Patient No.', " +
"NEWTABLE.Name AS 'Name', " +
"NEWTABLE.birth AS 'Birthday', " +
"NEWTABLE.gender AS 'Gender', " +
"NEWTABLE.Blood, " +
"NEWTABLE.ps AS 'P.S.', " +
"NEWTABLE.regguid AS guid, " +
"pre_status.status AS status "+
"FROM (" +
"SELECT distinct A.visits_no, A.register, A.reg_time , A.p_no, " +
"concat(patients_info.firstname,' ',patients_info.lastname) AS 'Name', "+
"patients_info.birth , patients_info.gender , " +
"concat(patients_info.bloodtype,patients_info.rh_type) AS 'Blood', " +
"patients_info.ps, A.guid AS regguid , outpatient_services.guid AS osguid "+
"FROM registration_info AS A, patients_info, shift_table,staff_info, prescription " +
"LEFT JOIN outpatient_services ON prescription.os_guid = outpatient_services.guid ,prescription_code "+
"WHERE A.shift_guid = shift_table.guid AND shift_table.s_id = staff_info.s_id " +
"AND A.p_no = patients_info.p_no AND prescription.code = prescription_code.code "+
"AND (outpatient_services.reg_guid = A.guid OR prescription.case_guid =A.guid) " +
"AND (SELECT COUNT(code) FROM prescription LEFT JOIN outpatient_services ON prescription.os_guid = outpatient_services.guid, registration_info "+
"WHERE (prescription.finish <> 'F' OR prescription.finish IS NULL ) " +
"AND (outpatient_services.reg_guid = registration_info.guid OR prescription.case_guid = registration_info.guid) " +
"AND prescription.code = prescription_code.code "+
"AND prescription_code.type <> '"+Constant.X_RAY_CODE+"' " +
"AND registration_info.guid = A.guid) > 0 AND A.reg_time LIKE '"+date+"%' ) AS NEWTABLE "+
"LEFT JOIN (SELECT distinct case_guid,os_guid,'1' AS status FROM prescription " +
"WHERE prescription.specimen_status = '1') AS pre_status ON (pre_status.os_guid = NEWTABLE.osguid " +
"OR pre_status.case_guid = NEWTABLE.regguid) " +
"ORDER BY NEWTABLE.reg_time DESC, NEWTABLE.visits_no ";
} else if (m_SysName.equals("xray")) {
sql = "SELECT distinct A.visits_no AS '"+paragraph.getLanguage(line, "COL_NO")+"', "+
"A.register AS '"+paragraph.getLanguage(line, "COL_REGISTER")+"', " +
"'', "+
"NULL, "+
"A.reg_time AS '"+paragraph.getLanguage(line, "COL_REGTIME")+"', " +
"A.p_no AS '"+paragraph.getLanguage(line, "COL_PATIENTNO")+"', "+
"concat(patients_info.firstname,' ',patients_info.lastname) AS '"+paragraph.getLanguage(line, "COL_NAME")+"', "+
"patients_info.birth AS '"+paragraph.getLanguage(line, "COL_BIRTH")+"', "+
"patients_info.gender AS '"+paragraph.getLanguage(line, "COL_GENDER")+"', "+
"concat(patients_info.bloodtype,patients_info.rh_type) AS '"+paragraph.getLanguage(line, "COL_BLOOD")+"', "+
"patients_info.ps AS '"+paragraph.getLanguage(line, "COL_PS")+"', "+
"A.guid "+
"FROM registration_info AS A, patients_info, shift_table,staff_info, prescription, outpatient_services, prescription_code "+
"WHERE A.shift_guid = shift_table.guid "+
"AND shift_table.s_id = staff_info.s_id "+
"AND A.p_no = patients_info.p_no "+
"AND prescription.code = prescription_code.code "+
"AND prescription.os_guid = outpatient_services.guid "+
"AND outpatient_services.reg_guid = A.guid "+
"AND (SELECT COUNT(code) " +
"FROM prescription,outpatient_services, registration_info " +
"WHERE (prescription.finish <> 'F' OR prescription.finish IS NULL ) " +
"AND prescription.code = prescription_code.code "+
"AND prescription_code.type = '"+Constant.X_RAY_CODE+"' "+
"AND outpatient_services.reg_guid = registration_info.guid " +
"AND prescription.os_guid = outpatient_services.guid " +
"AND registration_info.guid = A.guid) > 0 "+
"AND A.reg_time LIKE '"+date+"%' "+
"ORDER BY A.reg_time DESC, A.visits_no ";
} else if (m_SysName.equals("case")) {
sql = "SELECT A.visits_no AS '"+paragraph.getLanguage(line, "COL_NO")+"', "+
"A.register AS '"+paragraph.getLanguage(line, "COL_REGISTER")+"', " +
"(SELECT CASE COUNT(registration_info.guid) "+
"WHEN 0 THEN '*' "+
"END "+
"FROM outpatient_services, registration_info "+
"WHERE registration_info.guid = outpatient_services.reg_guid AND p_no = A.p_no ) AS '"+paragraph.getLanguage(line, "COL_FIRST")+"', "+
"CASE A.case_finish WHEN 'F' THEN 'F' END 'State', "+
"A.reg_time AS '"+paragraph.getLanguage(line, "COL_REGTIME")+"', A.p_no AS '"+paragraph.getLanguage(line, "COL_PATIENTNO")+"', "+
"concat(patients_info.firstname,' ',patients_info.lastname) AS '"+paragraph.getLanguage(line, "COL_NAME")+"', "+
"patients_info.birth AS '"+paragraph.getLanguage(line, "COL_BIRTH")+"', "+
"patients_info.gender AS '"+paragraph.getLanguage(line, "COL_GENDER")+"', "+
"concat(patients_info.bloodtype,patients_info.rh_type) AS '"+paragraph.getLanguage(line, "COL_BLOOD")+"', "+
"patients_info.ps AS '"+paragraph.getLanguage(line, "COL_PS")+"', "+
"A.guid, policlinic.typ "+
"FROM registration_info AS A, patients_info, shift_table,staff_info, poli_room, policlinic "+
"WHERE A.shift_guid = shift_table.guid "+
"AND shift_table.room_guid = poli_room.guid "+
"AND poli_room.poli_guid = policlinic.guid " +
"AND shift_table.s_id = staff_info.s_id "+
"AND (A.case_finish = 'F' OR A.case_finish IS NULL) "+
"AND A.p_no = patients_info.p_no " +
"AND policlinic.typ = 'DM' "+
"AND A.reg_time LIKE '"+date+"%' "+
"ORDER BY State, A.visits_no";
}
try{
rs = DBC.executeQuery(sql);
((DefaultTableModel)this.m_Tab.getModel()).setRowCount(0);
this.m_Tab.setModel(HISModel.getModel(rs));
rs.last();
setCloumnWidth(this.m_Tab);
if(m_SysName.equals("dia")) {
Object[][] array = {{"O",new Color(204,255,153)}, {"F",new Color(204,255,153)}};
TabTools.setTabColor(m_Tab, 3, array);
TabTools.setHideColumn(this.m_Tab,11);
} else if (m_SysName.equals("case")) {
Object[][] array = {{"F",new Color(204,255,153)}};
TabTools.setTabColor(m_Tab, 3, array);
TabTools.setHideColumn(m_Tab,0);
TabTools.setHideColumn(m_Tab,11);
} else if (m_SysName.equals("lab")) {
Object[][] array = {{"1",new Color(250,232,176)}};
TabTools.setTabColor(m_Tab, 12, array);
TabTools.setHideColumn(this.m_Tab,0);
TabTools.setHideColumn(this.m_Tab,2);
TabTools.setHideColumn(this.m_Tab,3);
TabTools.setHideColumn(this.m_Tab,11);
//TabTools.setHideColumn(this.m_Tab,12);
} else if (m_SysName.equals("xray")) {
TabTools.setHideColumn(this.m_Tab,0);
TabTools.setHideColumn(this.m_Tab,2);
TabTools.setHideColumn(this.m_Tab,3);
TabTools.setHideColumn(this.m_Tab,11);
}
DBC.closeConnection(rs);
}catch (SQLException ex) {System.out.println(ex);
}finally{ try{ DBC.closeConnection(rs); }catch(SQLException ex){} }
}
// @Override
// public void interrupt(){
// super.interrupt();
// try{
// DBC.closeConnection(rs);
// System.out.println("DBC.closeConnection(rs)");
// }catch(SQLException ex){}
// try {
// finalize();
// } catch (Throwable ex) {}
// }
}
| 29,050 | 0.504138 | 0.499276 | 458 | 62.290394 | 36.304401 | 169 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.982533 | false | false | 2 |
abe56d8162f517ae1bf47032e9c0a7ffd7d706b3 | 36,318,243,468,679 | f652f44bfd27b6f2a6f9a564ea6d1aa77183605a | /SharedSpace/src/Messages/MessageGetReservation.java | 21867182a834b544683fa0928fe01c6c8696eba1 | [] | no_license | atzilik/vcp-systems | https://github.com/atzilik/vcp-systems | 17d7dd969c79a91d1a6a0f856780772eab0ebb28 | 141c64de7ba3637b3bc9d9a80f02672b3052fb48 | refs/heads/master | 2021-01-10T14:00:50.418000 | 2014-02-05T11:28:43 | 2014-02-05T11:28:43 | 45,517,934 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Messages;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Time;
import java.util.Calendar;
import java.util.Map;
import java.sql.Date;
import DataObjects.DateConvert;
import DataObjects.FullMember;
import DataObjects.Reservation;
import DataObjects.STDCustomer;
import DataObjects.STDMember;
/**
*
* @author Boaz
*This class is responsible for getting the reservation.
*/
public class MessageGetReservation extends Message{
private String carNum;
private String id;
Reservation res;
String pl;
java.util.Date todayDate = DateConvert.buildFullDate(DateConvert.getCurrentSqlDate(), DateConvert.getCurrentSqlTime());
/**
*
* @param id id of the customer
* @param carNum car number of the customer
* @param pl string of the parkinglot number
*/
public MessageGetReservation (String id, String carNum, String pl) {
this.carNum = carNum;
this.id = id;
this.pl = pl;
}
@Override
public Message doAction() {
con = this.sqlConnection.getConnection();
try{
ResultSet rs = findReservation();
if (rs == null) // no reservation record
return new MessageGetReservationReply(2); // customer arrived early
else
{
do
{
res = new Reservation(rs.getString(1),rs.getInt(2),rs.getString(3),
rs.getString(4),rs.getDate(5),rs.getTime(6),rs.getDate(7),rs.getTime(8),rs.getBoolean(9),rs.getDouble(10),rs.getBoolean(11),rs.getDate(12));
java.util.Date resCheckInDate = DateConvert.buildFullDate(res.getEstCinDate(), res.getEstCinHour());
//checking if parking lot matching and customer didn't arrive early
if (DateConvert.timeDifference(todayDate,resCheckInDate) >= 0)
{
//check if customer is late, 2 minutes and below delay arriving is acceptable
if (DateConvert.timeDifference(todayDate,DateConvert.buildFullDate(res.getEstCinDate(), res.getEstCinHour())) == 0 || DateConvert.timeDifference(todayDate,DateConvert.buildFullDate(res.getEstCinDate(), res.getEstCinHour())) <= 2)
{
updateReservationUsed();
return new MessageGetReservationReply(res, false); // late or not
}
else
{
updateReservationUsed();
return new MessageGetReservationReply(res, true); // late or not
}
}
//customer arrive too early
else if(DateConvert.timeDifference(todayDate,DateConvert.buildFullDate(res.getEstCinDate(), res.getEstCinHour())) < 0)
{
return new MessageGetReservationReply(1); // early
}
}
while (rs.next());
return new MessageGetReservationReply(2); // no reservation
}
}catch (SQLException e) {e.printStackTrace();}
return null;
} // doAction
/**
*
* @return the result reservation of the customer that didn't already parked
* @throws SQLException
*/
public ResultSet findReservation() throws SQLException {
PreparedStatement ps = con.prepareStatement("SELECT * FROM reservations where customerId=? and carId=? and parkingLotId=? and used=0;");
ps.setString(1, id);
ps.setString(2, carNum);
ps.setString(3, pl);
ResultSet rs = ps.executeQuery();
if (rs.next())
{
return rs;
}
return null;
}
/**
* this method is updating the reservation table if customer did check in
* @throws SQLException
*/
public void updateReservationUsed() throws SQLException{
PreparedStatement ps = con.prepareStatement("UPDATE reservations SET used=? WHERE reservationId=?;");
ps.setBoolean(1, true);
ps.setString(2, res.getRid());
ps.executeUpdate();
ps.close();
}
}
| UTF-8 | Java | 3,668 | java | MessageGetReservation.java | Java | [
{
"context": "ort DataObjects.STDMember;\r\n\r\n/**\r\n * \r\n * @author Boaz\r\n *This class is responsible for getting the re",
"end": 400,
"score": 0.8021132349967957,
"start": 398,
"tag": "NAME",
"value": "Bo"
},
{
"context": " DataObjects.STDMember;\r\n\r\n/**\r\n * \r\n * @author Boaz\r\n *This class is responsible for getting the rese",
"end": 402,
"score": 0.5375789999961853,
"start": 400,
"tag": "USERNAME",
"value": "az"
}
] | null | [] | package Messages;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Time;
import java.util.Calendar;
import java.util.Map;
import java.sql.Date;
import DataObjects.DateConvert;
import DataObjects.FullMember;
import DataObjects.Reservation;
import DataObjects.STDCustomer;
import DataObjects.STDMember;
/**
*
* @author Boaz
*This class is responsible for getting the reservation.
*/
public class MessageGetReservation extends Message{
private String carNum;
private String id;
Reservation res;
String pl;
java.util.Date todayDate = DateConvert.buildFullDate(DateConvert.getCurrentSqlDate(), DateConvert.getCurrentSqlTime());
/**
*
* @param id id of the customer
* @param carNum car number of the customer
* @param pl string of the parkinglot number
*/
public MessageGetReservation (String id, String carNum, String pl) {
this.carNum = carNum;
this.id = id;
this.pl = pl;
}
@Override
public Message doAction() {
con = this.sqlConnection.getConnection();
try{
ResultSet rs = findReservation();
if (rs == null) // no reservation record
return new MessageGetReservationReply(2); // customer arrived early
else
{
do
{
res = new Reservation(rs.getString(1),rs.getInt(2),rs.getString(3),
rs.getString(4),rs.getDate(5),rs.getTime(6),rs.getDate(7),rs.getTime(8),rs.getBoolean(9),rs.getDouble(10),rs.getBoolean(11),rs.getDate(12));
java.util.Date resCheckInDate = DateConvert.buildFullDate(res.getEstCinDate(), res.getEstCinHour());
//checking if parking lot matching and customer didn't arrive early
if (DateConvert.timeDifference(todayDate,resCheckInDate) >= 0)
{
//check if customer is late, 2 minutes and below delay arriving is acceptable
if (DateConvert.timeDifference(todayDate,DateConvert.buildFullDate(res.getEstCinDate(), res.getEstCinHour())) == 0 || DateConvert.timeDifference(todayDate,DateConvert.buildFullDate(res.getEstCinDate(), res.getEstCinHour())) <= 2)
{
updateReservationUsed();
return new MessageGetReservationReply(res, false); // late or not
}
else
{
updateReservationUsed();
return new MessageGetReservationReply(res, true); // late or not
}
}
//customer arrive too early
else if(DateConvert.timeDifference(todayDate,DateConvert.buildFullDate(res.getEstCinDate(), res.getEstCinHour())) < 0)
{
return new MessageGetReservationReply(1); // early
}
}
while (rs.next());
return new MessageGetReservationReply(2); // no reservation
}
}catch (SQLException e) {e.printStackTrace();}
return null;
} // doAction
/**
*
* @return the result reservation of the customer that didn't already parked
* @throws SQLException
*/
public ResultSet findReservation() throws SQLException {
PreparedStatement ps = con.prepareStatement("SELECT * FROM reservations where customerId=? and carId=? and parkingLotId=? and used=0;");
ps.setString(1, id);
ps.setString(2, carNum);
ps.setString(3, pl);
ResultSet rs = ps.executeQuery();
if (rs.next())
{
return rs;
}
return null;
}
/**
* this method is updating the reservation table if customer did check in
* @throws SQLException
*/
public void updateReservationUsed() throws SQLException{
PreparedStatement ps = con.prepareStatement("UPDATE reservations SET used=? WHERE reservationId=?;");
ps.setBoolean(1, true);
ps.setString(2, res.getRid());
ps.executeUpdate();
ps.close();
}
}
| 3,668 | 0.687568 | 0.679662 | 113 | 30.460176 | 36.711754 | 235 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.884956 | false | false | 2 |
bd873e75a13821efe17216fb3c54282ca68112f2 | 36,799,279,792,799 | 8eaf16ad7a87549e0ecd738657ada4f2a3720666 | /webAppSkeletone/src/main/java/com/bh/skeleton/srv/api/common/filestorage/error/FileStorageErrorCode.java | 93f258436fdaf10da8c6be664895d9b54660f54b | [] | no_license | dearjun7/skeleton | https://github.com/dearjun7/skeleton | 2575af4d7e79ddbe94d1cc14425c05aab6eea1a7 | 66c8e7599387fe49247ebdbf742fed27d43a91d1 | refs/heads/master | 2021-01-20T02:37:04.844000 | 2017-04-26T02:08:41 | 2017-04-26T02:08:41 | 89,426,541 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hs.gms.srv.api.common.filestorage.error;
import com.hs.gms.std.common.error.ErrorCode;
/**
* AttachErrorCode
*
* @author BH Jun
*/
public enum FileStorageErrorCode implements ErrorCode {
FILESTORAGE_SYSTEM_ERROR("FST0N00-500"),
FILESTORAGE_UPLOAD_FAIL("FST0N01-400");
private String errorCode;
FileStorageErrorCode(String errorCode) {
this.errorCode = errorCode;
}
@Override
public String getErrorCode() {
return errorCode;
}
}
| UTF-8 | Java | 498 | java | FileStorageErrorCode.java | Java | [
{
"context": ".ErrorCode;\n\n/**\n * AttachErrorCode\n * \n * @author BH Jun\n */\npublic enum FileStorageErrorCode implements E",
"end": 145,
"score": 0.9997484683990479,
"start": 139,
"tag": "NAME",
"value": "BH Jun"
}
] | null | [] | package com.hs.gms.srv.api.common.filestorage.error;
import com.hs.gms.std.common.error.ErrorCode;
/**
* AttachErrorCode
*
* @author <NAME>
*/
public enum FileStorageErrorCode implements ErrorCode {
FILESTORAGE_SYSTEM_ERROR("FST0N00-500"),
FILESTORAGE_UPLOAD_FAIL("FST0N01-400");
private String errorCode;
FileStorageErrorCode(String errorCode) {
this.errorCode = errorCode;
}
@Override
public String getErrorCode() {
return errorCode;
}
}
| 498 | 0.690763 | 0.666667 | 24 | 19.75 | 19.170834 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.291667 | false | false | 2 |
f287d2dcf937160f49677de5f3f2bc463c8ccc8d | 34,703,335,752,982 | 85e26ff5f677b281a4b3386f7d8fdd6427e3cd82 | /Implementacija/src/view/LogInHandler.java | cbaec73400f0d8de1e4dbc8447a0ff0cdab029ad | [] | no_license | NikolaZubic/SIMS_TIM2 | https://github.com/NikolaZubic/SIMS_TIM2 | 96edb7801b9d0cdcb7b5173e11519c8862a1d8df | 98d6b041e33a5887c6c7b472204c1ad9dd73212e | refs/heads/master | 2018-10-14T15:07:38.460000 | 2018-07-15T15:01:24 | 2018-07-15T15:01:24 | 134,576,541 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package view;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.stage.Stage;
public class LogInHandler extends Application {
Stage prozor;
Button dugme;
Scene scena;
Scene scena2;
boolean uspjesan;
public void start(Stage primaryStage) throws Exception {
String operaterCentrale = "joca99";
String administrator = "mare88";
String sefNaplatneStanice = "stefi58";
String operatorNaplatnogMjesta = "enae111";
prozor = primaryStage;
prozor.setTitle("Prijava korisnika");
GridPane matrica = new GridPane();
matrica.setPadding(new Insets(25, 20, 20, 20));
matrica.setVgap(20);
matrica.setHgap(20);
Label prijavaNaSistem = new Label("Prijava na sistem");
GridPane.setConstraints(prijavaNaSistem, 1, 0);
Label korisnickoIme = new Label("Korisnicko ime: ");
korisnickoIme.setFont(Font.font("Verdana", 15));
korisnickoIme.setTextFill(Color.WHITE);
Label lozinka = new Label("Lozinka: ");
lozinka.setTextFill(Color.WHITE);
lozinka.setFont(Font.font("Verdana", 15));
TextField korisnickoImeInput = new TextField("");
PasswordField lozinkaInput = new PasswordField();
GridPane.setConstraints(korisnickoIme, 0, 1);
GridPane.setConstraints(korisnickoImeInput, 1, 1);
GridPane.setConstraints(lozinka, 0, 2);
GridPane.setConstraints(lozinkaInput, 1, 2);
dugme = new Button("Prijava");
dugme.setFont(Font.font("Verdana", 20));
dugme.resize(100, 100);
GridPane.setConstraints(dugme, 1, 3);
dugme.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
if (korisnickoImeInput.getText().equals(operaterCentrale)) {
prozor.close();
LogInDialog.display("Uspjesna prijava", "Uspjesno ste se prijavili kao operater centrale.",
"operaterCentrale");
} else if (korisnickoImeInput.getText().equals(administrator)) {
prozor.close();
LogInDialog.display("Uspjesna prijava", "Uspjesno ste se prijavili kao administrator.",
"administrator");
} else if (korisnickoImeInput.getText().equals(sefNaplatneStanice)) {
prozor.close();
LogInDialog.display("Uspjesna prijava", "Uspjesno ste se prijavili kao sef naplatne stanice.",
"sefNaplatneStanice");
} else if (korisnickoImeInput.getText().equals(operatorNaplatnogMjesta)) {
prozor.close();
LogInDialog.display("Uspjesna prijava", "Uspjesno ste se prijavili kao operater naplatnog mjesta.",
"operatorNaplatnogMjesta");
} else {
NeuspjesnaPrijava.display("Neuspjesna prijava", "Nevalidna kombinacija korisnickog imena i lozinke.\n"
+ "Pokusajte ponovo.");
korisnickoImeInput.clear();
lozinkaInput.clear();
}
}
});
matrica.getChildren().addAll(korisnickoIme, korisnickoImeInput, lozinka, lozinkaInput, dugme);
matrica.setStyle("-fx-background-color: gray");
scena = new Scene(matrica, 400, 220);
scena.setOnKeyPressed(new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent ke) {
if (korisnickoImeInput.getText().equals(operaterCentrale)) {
prozor.close();
LogInDialog.display("Uspjesna prijava", "Uspjesno ste se prijavili kao operater centrale.",
"operaterCentrale");
} else if (korisnickoImeInput.getText().equals(administrator)) {
prozor.close();
LogInDialog.display("Uspjesna prijava", "Uspjesno ste se prijavili kao administrator.",
"administrator");
} else if (korisnickoImeInput.getText().equals(sefNaplatneStanice)) {
prozor.close();
LogInDialog.display("Uspjesna prijava", "Uspjesno ste se prijavili kao sef naplatne stanice.",
"sefNaplatneStanice");
} else if (korisnickoImeInput.getText().equals(operatorNaplatnogMjesta)) {
prozor.close();
LogInDialog.display("Uspjesna prijava", "Uspjesno ste se prijavili kao operater naplatnog mjesta.",
"operatorNaplatnogMjesta");
} else {
NeuspjesnaPrijava.display("Neuspjesna prijava", "Nevalidna kombinacija korisnickog imena i lozinke.\n"
+ "Pokusajte ponovo.");
korisnickoImeInput.clear();
lozinkaInput.clear();
}
}
});
prozor.setScene(scena);
prozor.show();
}
}
| UTF-8 | Java | 5,021 | java | LogInHandler.java | Java | [
{
"context": "erCentrale = \"joca99\";\r\n\t\tString administrator = \"mare88\";\r\n\t\tString sefNaplatneStanice = \"stefi58\";\r\n\t\tSt",
"end": 1013,
"score": 0.9996603727340698,
"start": 1007,
"tag": "USERNAME",
"value": "mare88"
}
] | null | [] | package view;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.stage.Stage;
public class LogInHandler extends Application {
Stage prozor;
Button dugme;
Scene scena;
Scene scena2;
boolean uspjesan;
public void start(Stage primaryStage) throws Exception {
String operaterCentrale = "joca99";
String administrator = "mare88";
String sefNaplatneStanice = "stefi58";
String operatorNaplatnogMjesta = "enae111";
prozor = primaryStage;
prozor.setTitle("Prijava korisnika");
GridPane matrica = new GridPane();
matrica.setPadding(new Insets(25, 20, 20, 20));
matrica.setVgap(20);
matrica.setHgap(20);
Label prijavaNaSistem = new Label("Prijava na sistem");
GridPane.setConstraints(prijavaNaSistem, 1, 0);
Label korisnickoIme = new Label("Korisnicko ime: ");
korisnickoIme.setFont(Font.font("Verdana", 15));
korisnickoIme.setTextFill(Color.WHITE);
Label lozinka = new Label("Lozinka: ");
lozinka.setTextFill(Color.WHITE);
lozinka.setFont(Font.font("Verdana", 15));
TextField korisnickoImeInput = new TextField("");
PasswordField lozinkaInput = new PasswordField();
GridPane.setConstraints(korisnickoIme, 0, 1);
GridPane.setConstraints(korisnickoImeInput, 1, 1);
GridPane.setConstraints(lozinka, 0, 2);
GridPane.setConstraints(lozinkaInput, 1, 2);
dugme = new Button("Prijava");
dugme.setFont(Font.font("Verdana", 20));
dugme.resize(100, 100);
GridPane.setConstraints(dugme, 1, 3);
dugme.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
if (korisnickoImeInput.getText().equals(operaterCentrale)) {
prozor.close();
LogInDialog.display("Uspjesna prijava", "Uspjesno ste se prijavili kao operater centrale.",
"operaterCentrale");
} else if (korisnickoImeInput.getText().equals(administrator)) {
prozor.close();
LogInDialog.display("Uspjesna prijava", "Uspjesno ste se prijavili kao administrator.",
"administrator");
} else if (korisnickoImeInput.getText().equals(sefNaplatneStanice)) {
prozor.close();
LogInDialog.display("Uspjesna prijava", "Uspjesno ste se prijavili kao sef naplatne stanice.",
"sefNaplatneStanice");
} else if (korisnickoImeInput.getText().equals(operatorNaplatnogMjesta)) {
prozor.close();
LogInDialog.display("Uspjesna prijava", "Uspjesno ste se prijavili kao operater naplatnog mjesta.",
"operatorNaplatnogMjesta");
} else {
NeuspjesnaPrijava.display("Neuspjesna prijava", "Nevalidna kombinacija korisnickog imena i lozinke.\n"
+ "Pokusajte ponovo.");
korisnickoImeInput.clear();
lozinkaInput.clear();
}
}
});
matrica.getChildren().addAll(korisnickoIme, korisnickoImeInput, lozinka, lozinkaInput, dugme);
matrica.setStyle("-fx-background-color: gray");
scena = new Scene(matrica, 400, 220);
scena.setOnKeyPressed(new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent ke) {
if (korisnickoImeInput.getText().equals(operaterCentrale)) {
prozor.close();
LogInDialog.display("Uspjesna prijava", "Uspjesno ste se prijavili kao operater centrale.",
"operaterCentrale");
} else if (korisnickoImeInput.getText().equals(administrator)) {
prozor.close();
LogInDialog.display("Uspjesna prijava", "Uspjesno ste se prijavili kao administrator.",
"administrator");
} else if (korisnickoImeInput.getText().equals(sefNaplatneStanice)) {
prozor.close();
LogInDialog.display("Uspjesna prijava", "Uspjesno ste se prijavili kao sef naplatne stanice.",
"sefNaplatneStanice");
} else if (korisnickoImeInput.getText().equals(operatorNaplatnogMjesta)) {
prozor.close();
LogInDialog.display("Uspjesna prijava", "Uspjesno ste se prijavili kao operater naplatnog mjesta.",
"operatorNaplatnogMjesta");
} else {
NeuspjesnaPrijava.display("Neuspjesna prijava", "Nevalidna kombinacija korisnickog imena i lozinke.\n"
+ "Pokusajte ponovo.");
korisnickoImeInput.clear();
lozinkaInput.clear();
}
}
});
prozor.setScene(scena);
prozor.show();
}
}
| 5,021 | 0.693886 | 0.683529 | 153 | 30.816994 | 27.360207 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.457516 | false | false | 2 |
acef532f3491a017f5317586aa6f5d790c67a85c | 34,703,335,751,745 | faebcddda5742d4f1327dacb468da087385a207b | /many-to-many/NewProject2-ManyToMany/src/main/java/com/example/newproject1/controller/StudentController.java | d941c704459770e2c96ecc73d80f729db46e4b9c | [] | no_license | abbas-musayev/many-to-many-test | https://github.com/abbas-musayev/many-to-many-test | a5dae4b19e2b015c32ec0b9e42ef7ed7c8c89bb6 | 4029dafa3de9a8e90ef15f18cc5fcde9694fdce7 | refs/heads/main | 2023-04-28T14:43:32.531000 | 2021-05-02T08:32:39 | 2021-05-02T08:32:39 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.newproject1.controller;
import com.example.newproject1.service.StudentService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import com.example.newproject1.dto.StudentDTO;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/students")
public class StudentController {
private final StudentService studentService;
@PostMapping
public ResponseEntity<StudentDTO> saveStudent(@RequestBody StudentDTO studentDTO) {
return new ResponseEntity<>(studentService.saveStudent(studentDTO), HttpStatus.OK);
}
@GetMapping
public ResponseEntity<List<StudentDTO>> getStudents() {
return null;
}
}
| UTF-8 | Java | 851 | java | StudentController.java | Java | [] | null | [] | package com.example.newproject1.controller;
import com.example.newproject1.service.StudentService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import com.example.newproject1.dto.StudentDTO;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/students")
public class StudentController {
private final StudentService studentService;
@PostMapping
public ResponseEntity<StudentDTO> saveStudent(@RequestBody StudentDTO studentDTO) {
return new ResponseEntity<>(studentService.saveStudent(studentDTO), HttpStatus.OK);
}
@GetMapping
public ResponseEntity<List<StudentDTO>> getStudents() {
return null;
}
}
| 851 | 0.763807 | 0.760282 | 27 | 29.518518 | 25.534828 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 2 |
969da3f8438a1d95088413b534098d988fb72f1c | 19,963,008,032,827 | a3171ee05827c2e0f3bac40001733ea9febfb413 | /src/main/java/test/service/UserService.java | 929aefbb91333325dc286ee35de746231e4d9c12 | [] | no_license | bduda/PZ-PROJ | https://github.com/bduda/PZ-PROJ | dad973ac2eca886123eef58de37acd34d8a20f45 | 0baa39cf08430dd2c1742b41e47818194462c525 | refs/heads/master | 2020-04-19T00:40:56.204000 | 2019-01-27T19:21:13 | 2019-01-27T19:21:13 | 167,853,195 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package test.service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import test.model.*;
import test.repository.UserRepository;
import test.security.UserPrincipal;
import java.util.List;
import java.util.Optional;
@Service
public class UserService {
@Autowired UserRepository userRepository;
private static final Logger logger = LoggerFactory.getLogger(PollService.class);
public List<User> getAllUsers(UserPrincipal currentUser){
List<User> userList = userRepository.findAll();
return userList;
}
}
| UTF-8 | Java | 662 | java | UserService.java | Java | [] | null | [] | package test.service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import test.model.*;
import test.repository.UserRepository;
import test.security.UserPrincipal;
import java.util.List;
import java.util.Optional;
@Service
public class UserService {
@Autowired UserRepository userRepository;
private static final Logger logger = LoggerFactory.getLogger(PollService.class);
public List<User> getAllUsers(UserPrincipal currentUser){
List<User> userList = userRepository.findAll();
return userList;
}
}
| 662 | 0.777946 | 0.774924 | 28 | 22.642857 | 23.130398 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 2 |
663638afb72b53e7684d8638567c337a8ca364f1 | 18,416,819,835,059 | 3a1184ea28875c1904a4aefbc15ab1625407f6cf | /mavenjava/src/main/java/com/test/xiushifu/Animal.java | dc0446eaa95ba22022f9e41cd65ed023889d7db6 | [] | no_license | huangzp/testjava | https://github.com/huangzp/testjava | 0de74cbe587fbaed33f0b86387f455e99af85ac9 | 9ed66f4c94bd8db0dc8e58dee492a9a77e26a0c3 | refs/heads/master | 2020-05-29T15:13:13.893000 | 2016-08-14T08:54:51 | 2016-08-14T08:54:51 | 65,657,787 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.test.xiushifu;
public class Animal {
static {
System.out.println("我是动物");
}
{
System.out.println("我是动物的方法块");
}
public Animal() {
System.out.println("动物的构造器");
}
}
| UTF-8 | Java | 242 | java | Animal.java | Java | [] | null | [] | package com.test.xiushifu;
public class Animal {
static {
System.out.println("我是动物");
}
{
System.out.println("我是动物的方法块");
}
public Animal() {
System.out.println("动物的构造器");
}
}
| 242 | 0.597087 | 0.597087 | 15 | 11.733334 | 12.556362 | 33 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.066667 | false | false | 2 |
63aaf96efd4db190bd89cb2c00a74a93e4c4a2d8 | 34,935,263,988,049 | 382eea5e7e12e03e10abc96139d6ed484697ace2 | /qianmi-reports/src/main/java/com/qianmi/report/main/ReportDataDeal.java | 607fbfac64d8c988983f1adcde583096d4752243 | [] | no_license | xijieh/beifeng | https://github.com/xijieh/beifeng | a40a0d0acad3603ec65e83e7f87d9a34af0feec5 | 2d6ab310ee0dc990b3469d91cc09b19192c2d2b5 | refs/heads/master | 2018-06-01T17:44:57.723000 | 2018-05-30T16:07:35 | 2018-05-30T16:07:35 | 135,237,709 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.qianmi.report.main;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.support.StaticMessageSource;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.qianmi.entity.customer.CustomerAudit;
import com.qianmi.entity.customer.CustomerBase;
import com.qianmi.entity.customer.CustomerBase.AuthStatus;
import com.qianmi.entity.order.OrdRepay;
import com.qianmi.entity.order.OrderLoan;
import com.qianmi.entity.proxy.ProxyUser;
import com.qianmi.framework.kafka.KafkaProducerService.MessageType;
import com.qianmi.report.service.ReportChannelStatisticsService;
import com.qianmi.report.service.ReportCheckInfoService;
import com.qianmi.report.service.ReportCustomerLoanService;
import com.qianmi.report.service.ReportHourLoanService;
import com.qianmi.report.service.ReportLoanInfoService;
import com.qianmi.report.service.ReportPayInfoService;
import com.qianmi.report.service.ReportProxyInfoService;
import com.qianmi.report.service.ReportProxyStatisticsService;
@Component
public class ReportDataDeal {
private static final Logger log = LoggerFactory.getLogger(ReportDataDeal.class);
@Resource(name="redisTemplate")
RedisTemplate<String, String> redisTemplate;
@Resource
ReportChannelStatisticsService reportChannelStatisticsService;
@Resource
ReportCheckInfoService reportCheckInfoService;
@Resource
ReportCustomerLoanService reportCustomerLoanService;
@Resource
ReportHourLoanService reportHourLoanService;
@Resource
ReportLoanInfoService reportLoanInfoService;
@Resource
ReportPayInfoService reportPayInfoService;
@Resource
ReportProxyInfoService reportProxyInfoService;
@Resource
ReportProxyStatisticsService reportProxyStatisticsService;
@Value("${project_name}")
private String key;
public void dealMessage(String topic, String value) {
value = value.substring(1, value.length() - 1).replace("\\", "");
if ((key + "-" + MessageType.registered.name()).equals(topic)) {
dealRegisterMessage(value);
return;
}
if ((key + "-" + MessageType.application.name()).equals(topic)) {
dealComeinMessage(value);
return;
}
if ((key + "-" + MessageType.allocation.name()).equals(topic)) {
dealAllocationMessage(value);
return;
}
if ((key + "-" + MessageType.allocationCancel.name()).equals(topic)) {
dealAllocationCancelMessage(value);
return;
}
if ((key + "-" + MessageType.audit.name()).equals(topic)) {
dealCheckMessage(value);
return;
}
if ((key + "-" + MessageType.createOrder.name()).equals(topic)) {
dealApplyLoanMessage(value);
return;
}
if ((key + "-" + MessageType.paidFinished.name()).equals(topic)) {
dealLoanMessage(value);
return;
}
if ((key + "-" + MessageType.repaid.name()).equals(topic)) {
dealPayMessage(value);
return;
}
if ((key + "-" + MessageType.proxyregistered.name()).equals(topic)) {
dealAddProxyMessage(value);
return;
}
if ((key + "-" + MessageType.proxymodifyed.name()).equals(topic)) {
dealModifyProxyMessage(value);
return;
}
}
public void dealRegisterMessage(String value) {
CustomerBase customerBase = JSONObject.
parseObject(value, CustomerBase.class);
reportLoanInfoService.insertRegister(customerBase);
reportChannelStatisticsService.insertRegister(customerBase);
reportProxyStatisticsService.insertRegister(customerBase);
}
public void dealComeinMessage(String value) {
CustomerBase customerBase = JSONObject.
parseObject(value, CustomerBase.class);
String redisKey = "reports-application:" + customerBase.getId();
if (!redisTemplate.hasKey(redisKey)) {
redisTemplate.opsForValue().set(redisKey, customerBase.getId().toString(), 24, TimeUnit.HOURS);
reportLoanInfoService.insertComein(customerBase);
}
}
public void dealAllocationMessage(String value) {
CustomerAudit customerAudit = JSONObject.
parseObject(value, CustomerAudit.class);
reportCheckInfoService.insertAllocation(customerAudit);
}
public void dealAllocationCancelMessage(String value) {
CustomerAudit customerAudit = JSONObject.
parseObject(value, CustomerAudit.class);
reportCheckInfoService.insertAllocationCanle(customerAudit);
}
public void dealCheckMessage(String value) {
@SuppressWarnings("unchecked")
Map<String, Object> map = JSONObject.
parseObject(value, Map.class);
String date = map.get("auditDate").toString().substring(0, 10);
String customerNo = map.get("customerNo").toString();
String auditorId = map.get("auditorId").toString();
String ifAuditManual = map.get("ifAuditManual").toString();
String authStatus = map.get("authStatus").toString();
/**系统审核*/
if ("0".equals(auditorId)) {
if (AuthStatus.waitingManual.name().equals(authStatus)
|| AuthStatus.waitingThrough.name().equals(authStatus)) {
String redisKey = "reports-system-pass:" + date + ":" + customerNo;
if (!redisTemplate.hasKey(redisKey)) {
redisTemplate.opsForValue().set(redisKey, customerNo, 24, TimeUnit.HOURS);
reportLoanInfoService.insertSysPass(map);
}
}
/**最终通过*/
if (AuthStatus.succeed.name().equals(authStatus)) {
String redisKey = "reports-real-pass:" + date + ":" + customerNo;
if (!redisTemplate.hasKey(redisKey)) {
redisTemplate.opsForValue().set(redisKey, customerNo, 24, TimeUnit.HOURS);
reportLoanInfoService.insertRealPass(map);
/* reportChannelStatisticsService.insertPass(map);
reportProxyStatisticsService.insertPass(map);*/
}
}
}
/**人工审核*/
// else if ("true".equals(ifAuditManual)) {
else {
String redisKey = "reports-manual-audit:" + date + ":" + customerNo;
if (!redisTemplate.hasKey(redisKey)) {
redisTemplate.opsForValue().set(redisKey, customerNo, 24, TimeUnit.HOURS);
reportLoanInfoService.insertCheck(map);
reportCheckInfoService.insertCheck(map);
/*reportProxyStatisticsService.insertCheck(map);*/
}
}
/* *//**最后的黑名单审核*//*
else {
if (AuthStatus.succeed.name().equals(authStatus)) {
String redisKey = "reports-real-pass:" + date + ":" + customerNo;
if (!redisTemplate.hasKey(redisKey)) {
redisTemplate.opsForValue().set(redisKey, customerNo, 24, TimeUnit.HOURS);
reportLoanInfoService.insertRealPass(map);
reportChannelStatisticsService.insertPass(map);
reportProxyStatisticsService.insertPass(map);
}
}
}*/
}
public void dealApplyLoanMessage(String value) {
OrderLoan orderLoan = JSONObject.
parseObject(value, OrderLoan.class);
reportLoanInfoService.insertApplyLoan(orderLoan);
}
public void dealLoanMessage(String value) {
@SuppressWarnings("unchecked")
Map<String, Object> loanMap = JSONObject.
parseObject(value, Map.class);
/**打款失败,不处理*/
if (null != loanMap.get("loanStatus") && !"succeed".equals(loanMap.get("loanStatus").toString())) {
return;
}
reportLoanInfoService.insertLoan(loanMap);
/*reportCustomerLoanService.insertLoan(loanMap);*/
/*reportHourLoanService.insertLoan(loanMap);*/
/**首借*/
if ("0".equals(loanMap.get("loanType").toString())) {
reportChannelStatisticsService.insertNewLoan(loanMap);
reportProxyStatisticsService.insertNewLoan(loanMap);
}
}
public void dealPayMessage(String value) {
@SuppressWarnings("unchecked")
Map<String, Object> map = JSONObject.
parseObject(value, Map.class);
reportLoanInfoService.insertPay(map);
reportPayInfoService.insertPay(map);
reportCustomerLoanService.insertPay(map);
}
public void dealAddProxyMessage(String value) {
ProxyUser proxyUser = JSONObject.
parseObject(value, ProxyUser.class);
reportProxyInfoService.addProxy(proxyUser);
}
public void dealModifyProxyMessage(String value) {
ProxyUser proxyUser = JSONObject.
parseObject(value, ProxyUser.class);
reportProxyInfoService.modifyProxy(proxyUser);
}
public static Logger getLog() {
return log;
}
}
| UTF-8 | Java | 8,416 | java | ReportDataDeal.java | Java | [] | null | [] | package com.qianmi.report.main;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.support.StaticMessageSource;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.qianmi.entity.customer.CustomerAudit;
import com.qianmi.entity.customer.CustomerBase;
import com.qianmi.entity.customer.CustomerBase.AuthStatus;
import com.qianmi.entity.order.OrdRepay;
import com.qianmi.entity.order.OrderLoan;
import com.qianmi.entity.proxy.ProxyUser;
import com.qianmi.framework.kafka.KafkaProducerService.MessageType;
import com.qianmi.report.service.ReportChannelStatisticsService;
import com.qianmi.report.service.ReportCheckInfoService;
import com.qianmi.report.service.ReportCustomerLoanService;
import com.qianmi.report.service.ReportHourLoanService;
import com.qianmi.report.service.ReportLoanInfoService;
import com.qianmi.report.service.ReportPayInfoService;
import com.qianmi.report.service.ReportProxyInfoService;
import com.qianmi.report.service.ReportProxyStatisticsService;
@Component
public class ReportDataDeal {
private static final Logger log = LoggerFactory.getLogger(ReportDataDeal.class);
@Resource(name="redisTemplate")
RedisTemplate<String, String> redisTemplate;
@Resource
ReportChannelStatisticsService reportChannelStatisticsService;
@Resource
ReportCheckInfoService reportCheckInfoService;
@Resource
ReportCustomerLoanService reportCustomerLoanService;
@Resource
ReportHourLoanService reportHourLoanService;
@Resource
ReportLoanInfoService reportLoanInfoService;
@Resource
ReportPayInfoService reportPayInfoService;
@Resource
ReportProxyInfoService reportProxyInfoService;
@Resource
ReportProxyStatisticsService reportProxyStatisticsService;
@Value("${project_name}")
private String key;
public void dealMessage(String topic, String value) {
value = value.substring(1, value.length() - 1).replace("\\", "");
if ((key + "-" + MessageType.registered.name()).equals(topic)) {
dealRegisterMessage(value);
return;
}
if ((key + "-" + MessageType.application.name()).equals(topic)) {
dealComeinMessage(value);
return;
}
if ((key + "-" + MessageType.allocation.name()).equals(topic)) {
dealAllocationMessage(value);
return;
}
if ((key + "-" + MessageType.allocationCancel.name()).equals(topic)) {
dealAllocationCancelMessage(value);
return;
}
if ((key + "-" + MessageType.audit.name()).equals(topic)) {
dealCheckMessage(value);
return;
}
if ((key + "-" + MessageType.createOrder.name()).equals(topic)) {
dealApplyLoanMessage(value);
return;
}
if ((key + "-" + MessageType.paidFinished.name()).equals(topic)) {
dealLoanMessage(value);
return;
}
if ((key + "-" + MessageType.repaid.name()).equals(topic)) {
dealPayMessage(value);
return;
}
if ((key + "-" + MessageType.proxyregistered.name()).equals(topic)) {
dealAddProxyMessage(value);
return;
}
if ((key + "-" + MessageType.proxymodifyed.name()).equals(topic)) {
dealModifyProxyMessage(value);
return;
}
}
public void dealRegisterMessage(String value) {
CustomerBase customerBase = JSONObject.
parseObject(value, CustomerBase.class);
reportLoanInfoService.insertRegister(customerBase);
reportChannelStatisticsService.insertRegister(customerBase);
reportProxyStatisticsService.insertRegister(customerBase);
}
public void dealComeinMessage(String value) {
CustomerBase customerBase = JSONObject.
parseObject(value, CustomerBase.class);
String redisKey = "reports-application:" + customerBase.getId();
if (!redisTemplate.hasKey(redisKey)) {
redisTemplate.opsForValue().set(redisKey, customerBase.getId().toString(), 24, TimeUnit.HOURS);
reportLoanInfoService.insertComein(customerBase);
}
}
public void dealAllocationMessage(String value) {
CustomerAudit customerAudit = JSONObject.
parseObject(value, CustomerAudit.class);
reportCheckInfoService.insertAllocation(customerAudit);
}
public void dealAllocationCancelMessage(String value) {
CustomerAudit customerAudit = JSONObject.
parseObject(value, CustomerAudit.class);
reportCheckInfoService.insertAllocationCanle(customerAudit);
}
public void dealCheckMessage(String value) {
@SuppressWarnings("unchecked")
Map<String, Object> map = JSONObject.
parseObject(value, Map.class);
String date = map.get("auditDate").toString().substring(0, 10);
String customerNo = map.get("customerNo").toString();
String auditorId = map.get("auditorId").toString();
String ifAuditManual = map.get("ifAuditManual").toString();
String authStatus = map.get("authStatus").toString();
/**系统审核*/
if ("0".equals(auditorId)) {
if (AuthStatus.waitingManual.name().equals(authStatus)
|| AuthStatus.waitingThrough.name().equals(authStatus)) {
String redisKey = "reports-system-pass:" + date + ":" + customerNo;
if (!redisTemplate.hasKey(redisKey)) {
redisTemplate.opsForValue().set(redisKey, customerNo, 24, TimeUnit.HOURS);
reportLoanInfoService.insertSysPass(map);
}
}
/**最终通过*/
if (AuthStatus.succeed.name().equals(authStatus)) {
String redisKey = "reports-real-pass:" + date + ":" + customerNo;
if (!redisTemplate.hasKey(redisKey)) {
redisTemplate.opsForValue().set(redisKey, customerNo, 24, TimeUnit.HOURS);
reportLoanInfoService.insertRealPass(map);
/* reportChannelStatisticsService.insertPass(map);
reportProxyStatisticsService.insertPass(map);*/
}
}
}
/**人工审核*/
// else if ("true".equals(ifAuditManual)) {
else {
String redisKey = "reports-manual-audit:" + date + ":" + customerNo;
if (!redisTemplate.hasKey(redisKey)) {
redisTemplate.opsForValue().set(redisKey, customerNo, 24, TimeUnit.HOURS);
reportLoanInfoService.insertCheck(map);
reportCheckInfoService.insertCheck(map);
/*reportProxyStatisticsService.insertCheck(map);*/
}
}
/* *//**最后的黑名单审核*//*
else {
if (AuthStatus.succeed.name().equals(authStatus)) {
String redisKey = "reports-real-pass:" + date + ":" + customerNo;
if (!redisTemplate.hasKey(redisKey)) {
redisTemplate.opsForValue().set(redisKey, customerNo, 24, TimeUnit.HOURS);
reportLoanInfoService.insertRealPass(map);
reportChannelStatisticsService.insertPass(map);
reportProxyStatisticsService.insertPass(map);
}
}
}*/
}
public void dealApplyLoanMessage(String value) {
OrderLoan orderLoan = JSONObject.
parseObject(value, OrderLoan.class);
reportLoanInfoService.insertApplyLoan(orderLoan);
}
public void dealLoanMessage(String value) {
@SuppressWarnings("unchecked")
Map<String, Object> loanMap = JSONObject.
parseObject(value, Map.class);
/**打款失败,不处理*/
if (null != loanMap.get("loanStatus") && !"succeed".equals(loanMap.get("loanStatus").toString())) {
return;
}
reportLoanInfoService.insertLoan(loanMap);
/*reportCustomerLoanService.insertLoan(loanMap);*/
/*reportHourLoanService.insertLoan(loanMap);*/
/**首借*/
if ("0".equals(loanMap.get("loanType").toString())) {
reportChannelStatisticsService.insertNewLoan(loanMap);
reportProxyStatisticsService.insertNewLoan(loanMap);
}
}
public void dealPayMessage(String value) {
@SuppressWarnings("unchecked")
Map<String, Object> map = JSONObject.
parseObject(value, Map.class);
reportLoanInfoService.insertPay(map);
reportPayInfoService.insertPay(map);
reportCustomerLoanService.insertPay(map);
}
public void dealAddProxyMessage(String value) {
ProxyUser proxyUser = JSONObject.
parseObject(value, ProxyUser.class);
reportProxyInfoService.addProxy(proxyUser);
}
public void dealModifyProxyMessage(String value) {
ProxyUser proxyUser = JSONObject.
parseObject(value, ProxyUser.class);
reportProxyInfoService.modifyProxy(proxyUser);
}
public static Logger getLog() {
return log;
}
}
| 8,416 | 0.738335 | 0.736061 | 281 | 28.743773 | 24.852701 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.441281 | false | false | 2 |
b4a17cfb450627fb75d1e1bd720c42755eba884c | 4,758,823,810,992 | ebd4e44cda3055c315f03cf65ee7a2865d65e0f0 | /src/main/java/rocks/zipcodewilmington/week11/p09052018/CasinoOptionDemonstrator.java | a7d16f711422b55e3fc8130c4b7fab6920ffdadc | [] | no_license | Zipcoder/tc-leon-demos | https://github.com/Zipcoder/tc-leon-demos | 895d59e2d97e250acde90bdd5c71c67af9391305 | fa6ca4b5cca25aeac7c807357a11f9010fd27f9a | refs/heads/master | 2020-03-21T13:54:19.023000 | 2018-10-08T09:54:40 | 2018-10-08T09:54:40 | 138,631,132 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package rocks.zipcodewilmington.week11.p09052018;
import java.util.Scanner;
/**
* @author leon on 9/5/18.
*/
public class CasinoOptionDemonstrator {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
String userInput = s.nextLine();
CasinoOption co = CasinoOption.getClientEnumeration(userInput);
co.perform();
}
public static void main1(String[] args) {
StringEnumOption.HELLOWORLD.printEnumString();
}
}
| UTF-8 | Java | 493 | java | CasinoOptionDemonstrator.java | Java | [
{
"context": "052018;\n\nimport java.util.Scanner;\n\n/**\n * @author leon on 9/5/18.\n */\npublic class CasinoOptionDemonstra",
"end": 97,
"score": 0.6769368648529053,
"start": 93,
"tag": "USERNAME",
"value": "leon"
}
] | null | [] | package rocks.zipcodewilmington.week11.p09052018;
import java.util.Scanner;
/**
* @author leon on 9/5/18.
*/
public class CasinoOptionDemonstrator {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
String userInput = s.nextLine();
CasinoOption co = CasinoOption.getClientEnumeration(userInput);
co.perform();
}
public static void main1(String[] args) {
StringEnumOption.HELLOWORLD.printEnumString();
}
}
| 493 | 0.673428 | 0.643002 | 19 | 24.947369 | 22.094233 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.368421 | false | false | 2 |
4427d39066ff1ddbc69d34579cd9773a5a4f764c | 4,793,183,542,217 | fe2ef5d33ed920aef5fc5bdd50daf5e69aa00ed4 | /struts2/src/base/zyf/common/tree/TreeViewI.java | 0ffa944935ff4851d27f4abaa1811f1128a5ea63 | [] | no_license | sensui74/legacy-project | https://github.com/sensui74/legacy-project | 4502d094edbf8964f6bb9805be88f869bae8e588 | ff8156ae963a5c61575ff34612c908c4ccfc219b | refs/heads/master | 2020-03-17T06:28:16.650000 | 2016-01-08T03:46:00 | 2016-01-08T03:46:00 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
*
* 项目名称:struts2
* 制作时间:May 19, 20099:39:35 AM
* 包名:base.zyf.common.tree
* 文件名:TreeViewI.java
* 制作者:zhaoyifei
* @version 1.0
*/
package base.zyf.common.tree;
/**
* 用于显示tree的接口,主要用于<code>TreeControlTag</code>中的现实作用
* @author zhaoyifei
* @version 1.0
*/
public interface TreeViewI extends TreeNodeI{
/**
*
* 功能描述 得到action链接
* @return
* May 19, 2009 10:41:37 AM
* @version 1.0
* @author 赵一非
*/
public abstract String getAction();
/**
*
* 功能描述 是否展开
* @return true 展开,false 没有展开
* May 19, 2009 10:43:49 AM
* @version 1.0
* @author 赵一非
*/
public abstract boolean isExpanded();
/**
*
* 功能描述 设置是否展开
* @param expanded
* May 19, 2009 10:46:53 AM
* @version 1.0
* @author 赵一非
*/
public abstract void setExpanded(boolean expanded);
/**
*
* 功能描述 设置显示图标
* @return
* May 19, 2009 10:47:13 AM
* @version 1.0
* @author 赵一非
*/
public abstract String getIcon();
/**
*
* 功能描述 设置是否被选中
* @param selected
* May 19, 2009 10:48:11 AM
* @version 1.0
* @author 赵一非
*/
public abstract void setSelected(boolean selected);
/**
*
* 功能描述 得到宽度,显示用,宽度为展开节点的最大层数
* @return
* May 19, 2009 10:49:50 AM
* @version 1.0
* @author 赵一非
*/
public abstract int getWidth();
/**
*
* 功能描述 设置图标
* @param string
* May 19, 2009 10:50:46 AM
* @version 1.0
* @author 赵一非
*/
public abstract void setIcon(String string);
/**
*
* 功能描述 设置链接
* @param string
* May 19, 2009 10:51:17 AM
* @version 1.0
* @author 赵一非
*/
public abstract void setAction(String string);
/**
*
* 功能描述 判断是否是最后节点
* @return
* May 19, 2009 10:56:05 AM
* @version 1.0
* @author Administrator
*/
public abstract boolean isLast();
}
| GB18030 | Java | 2,081 | java | TreeViewI.java | Java | [
{
"context": "base.zyf.common.tree\n * 文件名:TreeViewI.java\n * 制作者:zhaoyifei\n * @version 1.0\n */\npackage base.zyf.common.tree;",
"end": 120,
"score": 0.9994286298751831,
"start": 111,
"tag": "USERNAME",
"value": "zhaoyifei"
},
{
"context": "口,主要用于<code>TreeControlTag</code>中的现实作用\n * @author zhaoyifei\n * @version 1.0\n */\npublic interface TreeViewI ex",
"end": 249,
"score": 0.9995329976081848,
"start": 240,
"tag": "USERNAME",
"value": "zhaoyifei"
},
{
"context": "19, 2009 10:41:37 AM\n\t * @version 1.0\n\t * @author 赵一非\n\t */\n\tpublic abstract String getAction();\n\t\n\n\t/**",
"end": 421,
"score": 0.9816122055053711,
"start": 418,
"tag": "NAME",
"value": "赵一非"
},
{
"context": "19, 2009 10:43:49 AM\n\t * @version 1.0\n\t * @author 赵一非\n\t */\n\tpublic abstract boolean isExpanded();\n\n\t/**",
"end": 583,
"score": 0.9855626821517944,
"start": 580,
"tag": "NAME",
"value": "赵一非"
},
{
"context": "19, 2009 10:46:53 AM\n\t * @version 1.0\n\t * @author 赵一非\n\t */\n\tpublic abstract void setExpanded(boolean ex",
"end": 736,
"score": 0.9684644937515259,
"start": 733,
"tag": "NAME",
"value": "赵一非"
},
{
"context": "19, 2009 10:47:13 AM\n\t * @version 1.0\n\t * @author 赵一非\n\t */\n\tpublic abstract String getIcon();\n\n\n\n\t/**\n\t",
"end": 895,
"score": 0.9830479621887207,
"start": 892,
"tag": "NAME",
"value": "赵一非"
},
{
"context": "19, 2009 10:48:11 AM\n\t * @version 1.0\n\t * @author 赵一非\n\t */\n\tpublic abstract void setSelected(boolean se",
"end": 1047,
"score": 0.9879605174064636,
"start": 1044,
"tag": "NAME",
"value": "赵一非"
},
{
"context": "19, 2009 10:49:50 AM\n\t * @version 1.0\n\t * @author 赵一非\n\t */\n\tpublic abstract int getWidth();\n\t\n\n\t/**\n\t *",
"end": 1225,
"score": 0.9952918887138367,
"start": 1222,
"tag": "NAME",
"value": "赵一非"
},
{
"context": "19, 2009 10:50:46 AM\n\t * @version 1.0\n\t * @author 赵一非\n\t */\n\tpublic abstract void setIcon(String string)",
"end": 1370,
"score": 0.9972410202026367,
"start": 1367,
"tag": "NAME",
"value": "赵一非"
},
{
"context": "19, 2009 10:51:17 AM\n\t * @version 1.0\n\t * @author 赵一非\n\t */\n\tpublic abstract void setAction(String strin",
"end": 1527,
"score": 0.9961643815040588,
"start": 1524,
"tag": "NAME",
"value": "赵一非"
}
] | null | [] | /**
*
* 项目名称:struts2
* 制作时间:May 19, 20099:39:35 AM
* 包名:base.zyf.common.tree
* 文件名:TreeViewI.java
* 制作者:zhaoyifei
* @version 1.0
*/
package base.zyf.common.tree;
/**
* 用于显示tree的接口,主要用于<code>TreeControlTag</code>中的现实作用
* @author zhaoyifei
* @version 1.0
*/
public interface TreeViewI extends TreeNodeI{
/**
*
* 功能描述 得到action链接
* @return
* May 19, 2009 10:41:37 AM
* @version 1.0
* @author 赵一非
*/
public abstract String getAction();
/**
*
* 功能描述 是否展开
* @return true 展开,false 没有展开
* May 19, 2009 10:43:49 AM
* @version 1.0
* @author 赵一非
*/
public abstract boolean isExpanded();
/**
*
* 功能描述 设置是否展开
* @param expanded
* May 19, 2009 10:46:53 AM
* @version 1.0
* @author 赵一非
*/
public abstract void setExpanded(boolean expanded);
/**
*
* 功能描述 设置显示图标
* @return
* May 19, 2009 10:47:13 AM
* @version 1.0
* @author 赵一非
*/
public abstract String getIcon();
/**
*
* 功能描述 设置是否被选中
* @param selected
* May 19, 2009 10:48:11 AM
* @version 1.0
* @author 赵一非
*/
public abstract void setSelected(boolean selected);
/**
*
* 功能描述 得到宽度,显示用,宽度为展开节点的最大层数
* @return
* May 19, 2009 10:49:50 AM
* @version 1.0
* @author 赵一非
*/
public abstract int getWidth();
/**
*
* 功能描述 设置图标
* @param string
* May 19, 2009 10:50:46 AM
* @version 1.0
* @author 赵一非
*/
public abstract void setIcon(String string);
/**
*
* 功能描述 设置链接
* @param string
* May 19, 2009 10:51:17 AM
* @version 1.0
* @author 赵一非
*/
public abstract void setAction(String string);
/**
*
* 功能描述 判断是否是最后节点
* @return
* May 19, 2009 10:56:05 AM
* @version 1.0
* @author Administrator
*/
public abstract boolean isLast();
}
| 2,081 | 0.600345 | 0.518689 | 116 | 13.99138 | 13.02484 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.922414 | false | false | 2 |
cde42204686eeb7b9c88410bae87d6ab5f5d9434 | 38,087,769,986,970 | a79a2391d23c1a169ab4bfb42a85ca86cde7a15e | /app/src/main/java/com/example/travel_project/Adapter/TourWasBookedAdapter.java | dfc35b0f3494575128df1912cf46c049b2b1471d | [] | no_license | dotrungtu/Travel_Project | https://github.com/dotrungtu/Travel_Project | 4c7fa4d17f82146c369a354b8c168a0ce86bf35f | 5761be8a2c1724d2ef4aac9817cfa224839f56f7 | refs/heads/master | 2023-01-23T11:11:09.400000 | 2020-12-04T10:29:30 | 2020-12-04T10:29:30 | 318,481,550 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.travel_project.Adapter;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.travel_project.DetailsTourWasBooked_Activity;
import com.example.travel_project.Model.TourWasBookedData;
import com.example.travel_project.NetWork.TourWasBookedDelete;
import com.example.travel_project.R;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.squareup.picasso.Picasso;
import java.util.List;
public class TourWasBookedAdapter extends RecyclerView.Adapter<TourWasBookedAdapter.TourWasBookedAdapterViewHolder> {
private Context context;
private List<TourWasBookedData> tourWasBookedDataList;
public TourWasBookedAdapter(Context context, List<TourWasBookedData> tourWasBookedDataList) {
this.context = context;
this.tourWasBookedDataList = tourWasBookedDataList;
notifyDataSetChanged();
}
@NonNull
@Override
public TourWasBookedAdapterViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View v = LayoutInflater.from(context).inflate(R.layout.tourwasbooked_row_item, viewGroup, false);
return new TourWasBookedAdapterViewHolder(v);
}
@Override
public void onBindViewHolder(@NonNull final TourWasBookedAdapterViewHolder tourWasBookedAdapterViewHolder, final int i) {
final TourWasBookedData tourWasBookedData = tourWasBookedDataList.get(i);
tourWasBookedAdapterViewHolder.tvTenDatNuoc.setText(tourWasBookedData.getCountryName());
tourWasBookedAdapterViewHolder.tvTenThanhPho.setText(tourWasBookedData.getPlaceName());
tourWasBookedAdapterViewHolder.tvEmail.setText("Email người đặt: " + tourWasBookedData.getEmail());
tourWasBookedAdapterViewHolder.tvGiaTien.setText("Giá tiền: " + tourWasBookedData.getPrice() + " VNĐ");
tourWasBookedAdapterViewHolder.tvNgayKhoiHanh.setText("Ngày khởi hành: " + tourWasBookedData.getDePartures());
Picasso.get()
.load(tourWasBookedData.getImageUrl())
.fit()
.centerCrop()
.into(tourWasBookedAdapterViewHolder.imgHinhAnhThanhPho);
tourWasBookedAdapterViewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, DetailsTourWasBooked_Activity.class);
intent.putExtra("placeNameTourWasBooked", tourWasBookedDataList.get(i).getPlaceName());
intent.putExtra("countryNameTourWasBooked", tourWasBookedDataList.get(i).getCountryName());
intent.putExtra("priceTourWasBooked", tourWasBookedDataList.get(i).getPrice());
intent.putExtra("imageUrlTourWasBooked", tourWasBookedDataList.get(i).getImageUrl());
intent.putExtra("deParturesTourWasBooked", tourWasBookedDataList.get(i).getDePartures());
intent.putExtra("desCriptionTourWasBooked", tourWasBookedDataList.get(i).getDesCription());
intent.putExtra("img1TourWasBooked", tourWasBookedDataList.get(i).getImageUrl_1());
intent.putExtra("img2TourWasBooked", tourWasBookedDataList.get(i).getImageUrl_2());
intent.putExtra("img3TourWasBooked", tourWasBookedDataList.get(i).getImageUrl_3());
intent.putExtra("tripInformationTourWasBooked", tourWasBookedDataList.get(i).getTripInformation());
context.startActivity(intent);
}
});
tourWasBookedAdapterViewHolder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
AlertDialog.Builder dialogMess = new AlertDialog.Builder(context);
dialogMess.setMessage("Bạn muốn xóa tour này?");
dialogMess.setPositiveButton("Có", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String tourWasBookedDataPlaceName = tourWasBookedData.getPlaceName();
Task<Void> voidTask = TourWasBookedDelete
.deleteBookTour(tourWasBookedDataPlaceName);
voidTask.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
Toast.makeText(context, "Đã xóa dữ liệu từ firebase", Toast.LENGTH_SHORT).show();
}
});
}
});
dialogMess.setNegativeButton("Không", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
dialogMess.show();
return true;
}
});
}
@Override
public int getItemCount() {
return tourWasBookedDataList.size();
}
public class TourWasBookedAdapterViewHolder extends RecyclerView.ViewHolder {
public TextView tvTenThanhPho, tvTenDatNuoc, tvGiaTien, tvNgayKhoiHanh, tvEmail;
public ImageView imgHinhAnhThanhPho;
public TourWasBookedAdapterViewHolder(View view) {
super(view);
tvTenDatNuoc = (TextView) view.findViewById(R.id.country_nameWasBooked);
tvEmail = (TextView) view.findViewById(R.id.tv_EmailUserWasBooked);
tvTenThanhPho = (TextView) view.findViewById(R.id.place_nameWasBooked);
tvGiaTien = (TextView) view.findViewById(R.id.priceWasBooked);
tvNgayKhoiHanh = (TextView) view.findViewById(R.id.tv_checkInWasBooked);
imgHinhAnhThanhPho = (ImageView) view.findViewById(R.id.place_imageWasBooked);
}
}
}
| UTF-8 | Java | 6,361 | java | TourWasBookedAdapter.java | Java | [] | null | [] | package com.example.travel_project.Adapter;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.travel_project.DetailsTourWasBooked_Activity;
import com.example.travel_project.Model.TourWasBookedData;
import com.example.travel_project.NetWork.TourWasBookedDelete;
import com.example.travel_project.R;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.squareup.picasso.Picasso;
import java.util.List;
public class TourWasBookedAdapter extends RecyclerView.Adapter<TourWasBookedAdapter.TourWasBookedAdapterViewHolder> {
private Context context;
private List<TourWasBookedData> tourWasBookedDataList;
public TourWasBookedAdapter(Context context, List<TourWasBookedData> tourWasBookedDataList) {
this.context = context;
this.tourWasBookedDataList = tourWasBookedDataList;
notifyDataSetChanged();
}
@NonNull
@Override
public TourWasBookedAdapterViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View v = LayoutInflater.from(context).inflate(R.layout.tourwasbooked_row_item, viewGroup, false);
return new TourWasBookedAdapterViewHolder(v);
}
@Override
public void onBindViewHolder(@NonNull final TourWasBookedAdapterViewHolder tourWasBookedAdapterViewHolder, final int i) {
final TourWasBookedData tourWasBookedData = tourWasBookedDataList.get(i);
tourWasBookedAdapterViewHolder.tvTenDatNuoc.setText(tourWasBookedData.getCountryName());
tourWasBookedAdapterViewHolder.tvTenThanhPho.setText(tourWasBookedData.getPlaceName());
tourWasBookedAdapterViewHolder.tvEmail.setText("Email người đặt: " + tourWasBookedData.getEmail());
tourWasBookedAdapterViewHolder.tvGiaTien.setText("Giá tiền: " + tourWasBookedData.getPrice() + " VNĐ");
tourWasBookedAdapterViewHolder.tvNgayKhoiHanh.setText("Ngày khởi hành: " + tourWasBookedData.getDePartures());
Picasso.get()
.load(tourWasBookedData.getImageUrl())
.fit()
.centerCrop()
.into(tourWasBookedAdapterViewHolder.imgHinhAnhThanhPho);
tourWasBookedAdapterViewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, DetailsTourWasBooked_Activity.class);
intent.putExtra("placeNameTourWasBooked", tourWasBookedDataList.get(i).getPlaceName());
intent.putExtra("countryNameTourWasBooked", tourWasBookedDataList.get(i).getCountryName());
intent.putExtra("priceTourWasBooked", tourWasBookedDataList.get(i).getPrice());
intent.putExtra("imageUrlTourWasBooked", tourWasBookedDataList.get(i).getImageUrl());
intent.putExtra("deParturesTourWasBooked", tourWasBookedDataList.get(i).getDePartures());
intent.putExtra("desCriptionTourWasBooked", tourWasBookedDataList.get(i).getDesCription());
intent.putExtra("img1TourWasBooked", tourWasBookedDataList.get(i).getImageUrl_1());
intent.putExtra("img2TourWasBooked", tourWasBookedDataList.get(i).getImageUrl_2());
intent.putExtra("img3TourWasBooked", tourWasBookedDataList.get(i).getImageUrl_3());
intent.putExtra("tripInformationTourWasBooked", tourWasBookedDataList.get(i).getTripInformation());
context.startActivity(intent);
}
});
tourWasBookedAdapterViewHolder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
AlertDialog.Builder dialogMess = new AlertDialog.Builder(context);
dialogMess.setMessage("Bạn muốn xóa tour này?");
dialogMess.setPositiveButton("Có", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String tourWasBookedDataPlaceName = tourWasBookedData.getPlaceName();
Task<Void> voidTask = TourWasBookedDelete
.deleteBookTour(tourWasBookedDataPlaceName);
voidTask.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
Toast.makeText(context, "Đã xóa dữ liệu từ firebase", Toast.LENGTH_SHORT).show();
}
});
}
});
dialogMess.setNegativeButton("Không", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
dialogMess.show();
return true;
}
});
}
@Override
public int getItemCount() {
return tourWasBookedDataList.size();
}
public class TourWasBookedAdapterViewHolder extends RecyclerView.ViewHolder {
public TextView tvTenThanhPho, tvTenDatNuoc, tvGiaTien, tvNgayKhoiHanh, tvEmail;
public ImageView imgHinhAnhThanhPho;
public TourWasBookedAdapterViewHolder(View view) {
super(view);
tvTenDatNuoc = (TextView) view.findViewById(R.id.country_nameWasBooked);
tvEmail = (TextView) view.findViewById(R.id.tv_EmailUserWasBooked);
tvTenThanhPho = (TextView) view.findViewById(R.id.place_nameWasBooked);
tvGiaTien = (TextView) view.findViewById(R.id.priceWasBooked);
tvNgayKhoiHanh = (TextView) view.findViewById(R.id.tv_checkInWasBooked);
imgHinhAnhThanhPho = (ImageView) view.findViewById(R.id.place_imageWasBooked);
}
}
}
| 6,361 | 0.678515 | 0.677409 | 125 | 49.639999 | 36.844841 | 125 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.76 | false | false | 2 |
3e5bf98b0b7c10d3fc746fa77b66f10a1a268d0c | 34,711,925,702,147 | bef6955e059fe7ef500f27b64476640590139bb4 | /Bank_0/src/Userhandler.java | d1884b6556cf366f2fca17b38bcb6627d278d087 | [] | no_license | FatemehSetareh/Project1 | https://github.com/FatemehSetareh/Project1 | 6de1bf260011348af44552205dada4e0c06cc1ec | 52f784a0eeefaf68405d1736f75dc5ca994abb34 | refs/heads/master | 2015-09-25T13:17:55.863000 | 2015-08-17T10:55:53 | 2015-08-17T10:55:53 | 40,433,163 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
public class Userhandler extends DefaultHandler {
boolean bdepositType = false;
boolean bdepositBalance = false;
boolean bdurationDay = false;
@Override
public void startElement(String uri,String localname,String qname, Attributes attributes)
throws SAXException {
if(qname.equalsIgnoreCase("deposit")) {
String depositnumber = attributes.getValue("depositNumber");
System.out.println("Customer Number is : " + depositnumber);
} else if(qname.equalsIgnoreCase("depositType"))
bdepositType = true;
else if(qname.equalsIgnoreCase("depositBalance"))
bdepositBalance = true;
else if (qname.equalsIgnoreCase("durationDay"))
bdurationDay = true;
}
@Override
public void endElement(String qname, String uri,String localname)throws SAXException {
if(qname.equalsIgnoreCase("deposit")) {
System.out.println("End Element :" + qname);
}
}
@Override
public void characters(char ch[], int start, int length)throws SAXException {
/*if(bdepositNumber){
System.out.println("Deposit Number is : "+ new String(ch, start, length));
bdepositNumber = false;
}*/
if(bdepositType) {
System.out.println("Deposit Type is : "+ new String(ch, start, length));
bdepositType = false;
}
if(bdepositBalance) {
System.out.println("Deposit Balance is : "+ new String(ch, start, length));
bdepositBalance = false;
}
if(bdurationDay) {
System.out.println("Duration Day is : "+ new String(ch, start, length));
bdurationDay = false;
}
}
}
| UTF-8 | Java | 1,664 | java | Userhandler.java | Java | [] | null | [] | import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
public class Userhandler extends DefaultHandler {
boolean bdepositType = false;
boolean bdepositBalance = false;
boolean bdurationDay = false;
@Override
public void startElement(String uri,String localname,String qname, Attributes attributes)
throws SAXException {
if(qname.equalsIgnoreCase("deposit")) {
String depositnumber = attributes.getValue("depositNumber");
System.out.println("Customer Number is : " + depositnumber);
} else if(qname.equalsIgnoreCase("depositType"))
bdepositType = true;
else if(qname.equalsIgnoreCase("depositBalance"))
bdepositBalance = true;
else if (qname.equalsIgnoreCase("durationDay"))
bdurationDay = true;
}
@Override
public void endElement(String qname, String uri,String localname)throws SAXException {
if(qname.equalsIgnoreCase("deposit")) {
System.out.println("End Element :" + qname);
}
}
@Override
public void characters(char ch[], int start, int length)throws SAXException {
/*if(bdepositNumber){
System.out.println("Deposit Number is : "+ new String(ch, start, length));
bdepositNumber = false;
}*/
if(bdepositType) {
System.out.println("Deposit Type is : "+ new String(ch, start, length));
bdepositType = false;
}
if(bdepositBalance) {
System.out.println("Deposit Balance is : "+ new String(ch, start, length));
bdepositBalance = false;
}
if(bdurationDay) {
System.out.println("Duration Day is : "+ new String(ch, start, length));
bdurationDay = false;
}
}
}
| 1,664 | 0.694712 | 0.694712 | 54 | 29.814816 | 26.407122 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.481481 | false | false | 2 |
0ee2dfc94d614b9dd48e173a756e48905712f3b2 | 4,269,197,534,291 | 6f2312fe5fca3a5dc4559ea50a305ac7daaf5645 | /Day6/filereader/FIleReadingOperation.java | 2fd3dfebb908b1388301cd447ff059dc496bbcf9 | [] | no_license | akashhulbutti-Thinkitive/Java-practice | https://github.com/akashhulbutti-Thinkitive/Java-practice | eb9cb4817527aa065ffbe6442c8307b05ed6e948 | 94e965583e3b5f3774f21e8611df0680ff47c892 | refs/heads/master | 2023-02-21T15:08:19.736000 | 2021-01-27T13:09:36 | 2021-01-27T13:09:36 | 333,419,957 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package filereader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class FIleReadingOperation {
public static void main(String[] args) {
writeFile();
readFile();
}
public static void readFile() {
try(FileReader fr=new FileReader("newText.txt")) {
int i=0;
while((i=fr.read())!=-1) {
System.out.print((char)i);
}
}catch(IOException io) {
io.printStackTrace();
}
}
public static void writeFile() {
try(FileWriter fw=new FileWriter("newText.txt")){
fw.write("Hello there hi how are you?");
}catch(IOException io) {
io.printStackTrace();
}
}
}
| UTF-8 | Java | 631 | java | FIleReadingOperation.java | Java | [] | null | [] | package filereader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class FIleReadingOperation {
public static void main(String[] args) {
writeFile();
readFile();
}
public static void readFile() {
try(FileReader fr=new FileReader("newText.txt")) {
int i=0;
while((i=fr.read())!=-1) {
System.out.print((char)i);
}
}catch(IOException io) {
io.printStackTrace();
}
}
public static void writeFile() {
try(FileWriter fw=new FileWriter("newText.txt")){
fw.write("Hello there hi how are you?");
}catch(IOException io) {
io.printStackTrace();
}
}
}
| 631 | 0.66878 | 0.66561 | 32 | 18.71875 | 15.988735 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.71875 | false | false | 2 |
8e8a4e8c9e9517b8679944e17b28ca525bd77c76 | 4,269,197,536,634 | cfe94f2dcaa3af340a3a4611f6da317665134a36 | /src1/StringFun/STest.java | aca641d37054d5fd235a32d03fb2a0bd70faf9c1 | [] | no_license | harsh68/Java-OCA8-Programmer-1-Exam-Preparation-Practices-Java-Codes | https://github.com/harsh68/Java-OCA8-Programmer-1-Exam-Preparation-Practices-Java-Codes | 5dd7276cb0a61e7c5416b53a5237e5ae70470db2 | d78c5a580e4f5ab824d97fd61ac992947633de0b | refs/heads/master | 2023-08-01T01:26:22.985000 | 2021-09-27T13:40:34 | 2021-09-27T13:40:34 | 309,591,244 | 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 StringFun;
/**
*
* @author Harsh
*/
public class STest {
public static void main(String[] args) {
int a=33;
int b = 99;
String s = "Hello";
System.out.println(a+b+s);
System.out.println(s+a+b);
System.out.println(a+s+b);
System.out.println(s+a);
System.out.println(a+s);
}
}
| UTF-8 | Java | 553 | java | STest.java | Java | [
{
"context": " editor.\n */\npackage StringFun;\n\n/**\n *\n * @author Harsh\n */\npublic class STest {\n public static void m",
"end": 228,
"score": 0.9984854459762573,
"start": 223,
"tag": "NAME",
"value": "Harsh"
}
] | 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 StringFun;
/**
*
* @author Harsh
*/
public class STest {
public static void main(String[] args) {
int a=33;
int b = 99;
String s = "Hello";
System.out.println(a+b+s);
System.out.println(s+a+b);
System.out.println(a+s+b);
System.out.println(s+a);
System.out.println(a+s);
}
}
| 553 | 0.59132 | 0.584087 | 24 | 22.041666 | 19.671213 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 2 |
732e32a93ed3750dee672dfea395c4a4c210b86e | 16,114,717,349,522 | 58937be2f81289d7f56f8cb174800d26049e963c | /src/main/java/scs/pojo/TableContainerresourceusagestartExample.java | 0f209c9feec87f2aa0c2f51c2d484bc358002967 | [] | no_license | SDC5-TJU/sdcloud | https://github.com/SDC5-TJU/sdcloud | 76b1c15c4f72737ee9f054c1049e29d463100a8b | 876b408158bc6dab9e9507df6474e7ac76e7d3ce | refs/heads/master | 2020-03-09T18:15:17.671000 | 2018-07-13T15:04:17 | 2018-07-13T15:04:17 | 125,297,718 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package scs.pojo;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class TableContainerresourceusagestartExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public TableContainerresourceusagestartExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andAutoidIsNull() {
addCriterion("autoId is null");
return (Criteria) this;
}
public Criteria andAutoidIsNotNull() {
addCriterion("autoId is not null");
return (Criteria) this;
}
public Criteria andAutoidEqualTo(Integer value) {
addCriterion("autoId =", value, "autoid");
return (Criteria) this;
}
public Criteria andAutoidNotEqualTo(Integer value) {
addCriterion("autoId <>", value, "autoid");
return (Criteria) this;
}
public Criteria andAutoidGreaterThan(Integer value) {
addCriterion("autoId >", value, "autoid");
return (Criteria) this;
}
public Criteria andAutoidGreaterThanOrEqualTo(Integer value) {
addCriterion("autoId >=", value, "autoid");
return (Criteria) this;
}
public Criteria andAutoidLessThan(Integer value) {
addCriterion("autoId <", value, "autoid");
return (Criteria) this;
}
public Criteria andAutoidLessThanOrEqualTo(Integer value) {
addCriterion("autoId <=", value, "autoid");
return (Criteria) this;
}
public Criteria andAutoidIn(List<Integer> values) {
addCriterion("autoId in", values, "autoid");
return (Criteria) this;
}
public Criteria andAutoidNotIn(List<Integer> values) {
addCriterion("autoId not in", values, "autoid");
return (Criteria) this;
}
public Criteria andAutoidBetween(Integer value1, Integer value2) {
addCriterion("autoId between", value1, value2, "autoid");
return (Criteria) this;
}
public Criteria andAutoidNotBetween(Integer value1, Integer value2) {
addCriterion("autoId not between", value1, value2, "autoid");
return (Criteria) this;
}
public Criteria andContainernameIsNull() {
addCriterion("containerName is null");
return (Criteria) this;
}
public Criteria andContainernameIsNotNull() {
addCriterion("containerName is not null");
return (Criteria) this;
}
public Criteria andContainernameEqualTo(String value) {
addCriterion("containerName =", value, "containername");
return (Criteria) this;
}
public Criteria andContainernameNotEqualTo(String value) {
addCriterion("containerName <>", value, "containername");
return (Criteria) this;
}
public Criteria andContainernameGreaterThan(String value) {
addCriterion("containerName >", value, "containername");
return (Criteria) this;
}
public Criteria andContainernameGreaterThanOrEqualTo(String value) {
addCriterion("containerName >=", value, "containername");
return (Criteria) this;
}
public Criteria andContainernameLessThan(String value) {
addCriterion("containerName <", value, "containername");
return (Criteria) this;
}
public Criteria andContainernameLessThanOrEqualTo(String value) {
addCriterion("containerName <=", value, "containername");
return (Criteria) this;
}
public Criteria andContainernameLike(String value) {
addCriterion("containerName like", value, "containername");
return (Criteria) this;
}
public Criteria andContainernameNotLike(String value) {
addCriterion("containerName not like", value, "containername");
return (Criteria) this;
}
public Criteria andContainernameIn(List<String> values) {
addCriterion("containerName in", values, "containername");
return (Criteria) this;
}
public Criteria andContainernameNotIn(List<String> values) {
addCriterion("containerName not in", values, "containername");
return (Criteria) this;
}
public Criteria andContainernameBetween(String value1, String value2) {
addCriterion("containerName between", value1, value2, "containername");
return (Criteria) this;
}
public Criteria andContainernameNotBetween(String value1, String value2) {
addCriterion("containerName not between", value1, value2, "containername");
return (Criteria) this;
}
public Criteria andCpuusagerateIsNull() {
addCriterion("cpuUsageRate is null");
return (Criteria) this;
}
public Criteria andCpuusagerateIsNotNull() {
addCriterion("cpuUsageRate is not null");
return (Criteria) this;
}
public Criteria andCpuusagerateEqualTo(Float value) {
addCriterion("cpuUsageRate =", value, "cpuusagerate");
return (Criteria) this;
}
public Criteria andCpuusagerateNotEqualTo(Float value) {
addCriterion("cpuUsageRate <>", value, "cpuusagerate");
return (Criteria) this;
}
public Criteria andCpuusagerateGreaterThan(Float value) {
addCriterion("cpuUsageRate >", value, "cpuusagerate");
return (Criteria) this;
}
public Criteria andCpuusagerateGreaterThanOrEqualTo(Float value) {
addCriterion("cpuUsageRate >=", value, "cpuusagerate");
return (Criteria) this;
}
public Criteria andCpuusagerateLessThan(Float value) {
addCriterion("cpuUsageRate <", value, "cpuusagerate");
return (Criteria) this;
}
public Criteria andCpuusagerateLessThanOrEqualTo(Float value) {
addCriterion("cpuUsageRate <=", value, "cpuusagerate");
return (Criteria) this;
}
public Criteria andCpuusagerateIn(List<Float> values) {
addCriterion("cpuUsageRate in", values, "cpuusagerate");
return (Criteria) this;
}
public Criteria andCpuusagerateNotIn(List<Float> values) {
addCriterion("cpuUsageRate not in", values, "cpuusagerate");
return (Criteria) this;
}
public Criteria andCpuusagerateBetween(Float value1, Float value2) {
addCriterion("cpuUsageRate between", value1, value2, "cpuusagerate");
return (Criteria) this;
}
public Criteria andCpuusagerateNotBetween(Float value1, Float value2) {
addCriterion("cpuUsageRate not between", value1, value2, "cpuusagerate");
return (Criteria) this;
}
public Criteria andMemusagerateIsNull() {
addCriterion("memUsageRate is null");
return (Criteria) this;
}
public Criteria andMemusagerateIsNotNull() {
addCriterion("memUsageRate is not null");
return (Criteria) this;
}
public Criteria andMemusagerateEqualTo(Float value) {
addCriterion("memUsageRate =", value, "memusagerate");
return (Criteria) this;
}
public Criteria andMemusagerateNotEqualTo(Float value) {
addCriterion("memUsageRate <>", value, "memusagerate");
return (Criteria) this;
}
public Criteria andMemusagerateGreaterThan(Float value) {
addCriterion("memUsageRate >", value, "memusagerate");
return (Criteria) this;
}
public Criteria andMemusagerateGreaterThanOrEqualTo(Float value) {
addCriterion("memUsageRate >=", value, "memusagerate");
return (Criteria) this;
}
public Criteria andMemusagerateLessThan(Float value) {
addCriterion("memUsageRate <", value, "memusagerate");
return (Criteria) this;
}
public Criteria andMemusagerateLessThanOrEqualTo(Float value) {
addCriterion("memUsageRate <=", value, "memusagerate");
return (Criteria) this;
}
public Criteria andMemusagerateIn(List<Float> values) {
addCriterion("memUsageRate in", values, "memusagerate");
return (Criteria) this;
}
public Criteria andMemusagerateNotIn(List<Float> values) {
addCriterion("memUsageRate not in", values, "memusagerate");
return (Criteria) this;
}
public Criteria andMemusagerateBetween(Float value1, Float value2) {
addCriterion("memUsageRate between", value1, value2, "memusagerate");
return (Criteria) this;
}
public Criteria andMemusagerateNotBetween(Float value1, Float value2) {
addCriterion("memUsageRate not between", value1, value2, "memusagerate");
return (Criteria) this;
}
public Criteria andMemusageamountIsNull() {
addCriterion("memUsageAmount is null");
return (Criteria) this;
}
public Criteria andMemusageamountIsNotNull() {
addCriterion("memUsageAmount is not null");
return (Criteria) this;
}
public Criteria andMemusageamountEqualTo(Float value) {
addCriterion("memUsageAmount =", value, "memusageamount");
return (Criteria) this;
}
public Criteria andMemusageamountNotEqualTo(Float value) {
addCriterion("memUsageAmount <>", value, "memusageamount");
return (Criteria) this;
}
public Criteria andMemusageamountGreaterThan(Float value) {
addCriterion("memUsageAmount >", value, "memusageamount");
return (Criteria) this;
}
public Criteria andMemusageamountGreaterThanOrEqualTo(Float value) {
addCriterion("memUsageAmount >=", value, "memusageamount");
return (Criteria) this;
}
public Criteria andMemusageamountLessThan(Float value) {
addCriterion("memUsageAmount <", value, "memusageamount");
return (Criteria) this;
}
public Criteria andMemusageamountLessThanOrEqualTo(Float value) {
addCriterion("memUsageAmount <=", value, "memusageamount");
return (Criteria) this;
}
public Criteria andMemusageamountIn(List<Float> values) {
addCriterion("memUsageAmount in", values, "memusageamount");
return (Criteria) this;
}
public Criteria andMemusageamountNotIn(List<Float> values) {
addCriterion("memUsageAmount not in", values, "memusageamount");
return (Criteria) this;
}
public Criteria andMemusageamountBetween(Float value1, Float value2) {
addCriterion("memUsageAmount between", value1, value2, "memusageamount");
return (Criteria) this;
}
public Criteria andMemusageamountNotBetween(Float value1, Float value2) {
addCriterion("memUsageAmount not between", value1, value2, "memusageamount");
return (Criteria) this;
}
public Criteria andIoinputIsNull() {
addCriterion("ioInput is null");
return (Criteria) this;
}
public Criteria andIoinputIsNotNull() {
addCriterion("ioInput is not null");
return (Criteria) this;
}
public Criteria andIoinputEqualTo(Float value) {
addCriterion("ioInput =", value, "ioinput");
return (Criteria) this;
}
public Criteria andIoinputNotEqualTo(Float value) {
addCriterion("ioInput <>", value, "ioinput");
return (Criteria) this;
}
public Criteria andIoinputGreaterThan(Float value) {
addCriterion("ioInput >", value, "ioinput");
return (Criteria) this;
}
public Criteria andIoinputGreaterThanOrEqualTo(Float value) {
addCriterion("ioInput >=", value, "ioinput");
return (Criteria) this;
}
public Criteria andIoinputLessThan(Float value) {
addCriterion("ioInput <", value, "ioinput");
return (Criteria) this;
}
public Criteria andIoinputLessThanOrEqualTo(Float value) {
addCriterion("ioInput <=", value, "ioinput");
return (Criteria) this;
}
public Criteria andIoinputIn(List<Float> values) {
addCriterion("ioInput in", values, "ioinput");
return (Criteria) this;
}
public Criteria andIoinputNotIn(List<Float> values) {
addCriterion("ioInput not in", values, "ioinput");
return (Criteria) this;
}
public Criteria andIoinputBetween(Float value1, Float value2) {
addCriterion("ioInput between", value1, value2, "ioinput");
return (Criteria) this;
}
public Criteria andIoinputNotBetween(Float value1, Float value2) {
addCriterion("ioInput not between", value1, value2, "ioinput");
return (Criteria) this;
}
public Criteria andIooutputIsNull() {
addCriterion("ioOutput is null");
return (Criteria) this;
}
public Criteria andIooutputIsNotNull() {
addCriterion("ioOutput is not null");
return (Criteria) this;
}
public Criteria andIooutputEqualTo(Float value) {
addCriterion("ioOutput =", value, "iooutput");
return (Criteria) this;
}
public Criteria andIooutputNotEqualTo(Float value) {
addCriterion("ioOutput <>", value, "iooutput");
return (Criteria) this;
}
public Criteria andIooutputGreaterThan(Float value) {
addCriterion("ioOutput >", value, "iooutput");
return (Criteria) this;
}
public Criteria andIooutputGreaterThanOrEqualTo(Float value) {
addCriterion("ioOutput >=", value, "iooutput");
return (Criteria) this;
}
public Criteria andIooutputLessThan(Float value) {
addCriterion("ioOutput <", value, "iooutput");
return (Criteria) this;
}
public Criteria andIooutputLessThanOrEqualTo(Float value) {
addCriterion("ioOutput <=", value, "iooutput");
return (Criteria) this;
}
public Criteria andIooutputIn(List<Float> values) {
addCriterion("ioOutput in", values, "iooutput");
return (Criteria) this;
}
public Criteria andIooutputNotIn(List<Float> values) {
addCriterion("ioOutput not in", values, "iooutput");
return (Criteria) this;
}
public Criteria andIooutputBetween(Float value1, Float value2) {
addCriterion("ioOutput between", value1, value2, "iooutput");
return (Criteria) this;
}
public Criteria andIooutputNotBetween(Float value1, Float value2) {
addCriterion("ioOutput not between", value1, value2, "iooutput");
return (Criteria) this;
}
public Criteria andNetinputIsNull() {
addCriterion("netInput is null");
return (Criteria) this;
}
public Criteria andNetinputIsNotNull() {
addCriterion("netInput is not null");
return (Criteria) this;
}
public Criteria andNetinputEqualTo(Float value) {
addCriterion("netInput =", value, "netinput");
return (Criteria) this;
}
public Criteria andNetinputNotEqualTo(Float value) {
addCriterion("netInput <>", value, "netinput");
return (Criteria) this;
}
public Criteria andNetinputGreaterThan(Float value) {
addCriterion("netInput >", value, "netinput");
return (Criteria) this;
}
public Criteria andNetinputGreaterThanOrEqualTo(Float value) {
addCriterion("netInput >=", value, "netinput");
return (Criteria) this;
}
public Criteria andNetinputLessThan(Float value) {
addCriterion("netInput <", value, "netinput");
return (Criteria) this;
}
public Criteria andNetinputLessThanOrEqualTo(Float value) {
addCriterion("netInput <=", value, "netinput");
return (Criteria) this;
}
public Criteria andNetinputIn(List<Float> values) {
addCriterion("netInput in", values, "netinput");
return (Criteria) this;
}
public Criteria andNetinputNotIn(List<Float> values) {
addCriterion("netInput not in", values, "netinput");
return (Criteria) this;
}
public Criteria andNetinputBetween(Float value1, Float value2) {
addCriterion("netInput between", value1, value2, "netinput");
return (Criteria) this;
}
public Criteria andNetinputNotBetween(Float value1, Float value2) {
addCriterion("netInput not between", value1, value2, "netinput");
return (Criteria) this;
}
public Criteria andNetoutputIsNull() {
addCriterion("netOutput is null");
return (Criteria) this;
}
public Criteria andNetoutputIsNotNull() {
addCriterion("netOutput is not null");
return (Criteria) this;
}
public Criteria andNetoutputEqualTo(Float value) {
addCriterion("netOutput =", value, "netoutput");
return (Criteria) this;
}
public Criteria andNetoutputNotEqualTo(Float value) {
addCriterion("netOutput <>", value, "netoutput");
return (Criteria) this;
}
public Criteria andNetoutputGreaterThan(Float value) {
addCriterion("netOutput >", value, "netoutput");
return (Criteria) this;
}
public Criteria andNetoutputGreaterThanOrEqualTo(Float value) {
addCriterion("netOutput >=", value, "netoutput");
return (Criteria) this;
}
public Criteria andNetoutputLessThan(Float value) {
addCriterion("netOutput <", value, "netoutput");
return (Criteria) this;
}
public Criteria andNetoutputLessThanOrEqualTo(Float value) {
addCriterion("netOutput <=", value, "netoutput");
return (Criteria) this;
}
public Criteria andNetoutputIn(List<Float> values) {
addCriterion("netOutput in", values, "netoutput");
return (Criteria) this;
}
public Criteria andNetoutputNotIn(List<Float> values) {
addCriterion("netOutput not in", values, "netoutput");
return (Criteria) this;
}
public Criteria andNetoutputBetween(Float value1, Float value2) {
addCriterion("netOutput between", value1, value2, "netoutput");
return (Criteria) this;
}
public Criteria andNetoutputNotBetween(Float value1, Float value2) {
addCriterion("netOutput not between", value1, value2, "netoutput");
return (Criteria) this;
}
public Criteria andCollecttimeIsNull() {
addCriterion("collectTime is null");
return (Criteria) this;
}
public Criteria andCollecttimeIsNotNull() {
addCriterion("collectTime is not null");
return (Criteria) this;
}
public Criteria andCollecttimeEqualTo(Date value) {
addCriterion("collectTime =", value, "collecttime");
return (Criteria) this;
}
public Criteria andCollecttimeNotEqualTo(Date value) {
addCriterion("collectTime <>", value, "collecttime");
return (Criteria) this;
}
public Criteria andCollecttimeGreaterThan(Date value) {
addCriterion("collectTime >", value, "collecttime");
return (Criteria) this;
}
public Criteria andCollecttimeGreaterThanOrEqualTo(Date value) {
addCriterion("collectTime >=", value, "collecttime");
return (Criteria) this;
}
public Criteria andCollecttimeLessThan(Date value) {
addCriterion("collectTime <", value, "collecttime");
return (Criteria) this;
}
public Criteria andCollecttimeLessThanOrEqualTo(Date value) {
addCriterion("collectTime <=", value, "collecttime");
return (Criteria) this;
}
public Criteria andCollecttimeIn(List<Date> values) {
addCriterion("collectTime in", values, "collecttime");
return (Criteria) this;
}
public Criteria andCollecttimeNotIn(List<Date> values) {
addCriterion("collectTime not in", values, "collecttime");
return (Criteria) this;
}
public Criteria andCollecttimeBetween(Date value1, Date value2) {
addCriterion("collectTime between", value1, value2, "collecttime");
return (Criteria) this;
}
public Criteria andCollecttimeNotBetween(Date value1, Date value2) {
addCriterion("collectTime not between", value1, value2, "collecttime");
return (Criteria) this;
}
public Criteria andTestrecordIsNull() {
addCriterion("testRecord is null");
return (Criteria) this;
}
public Criteria andTestrecordIsNotNull() {
addCriterion("testRecord is not null");
return (Criteria) this;
}
public Criteria andTestrecordEqualTo(Byte value) {
addCriterion("testRecord =", value, "testrecord");
return (Criteria) this;
}
public Criteria andTestrecordNotEqualTo(Byte value) {
addCriterion("testRecord <>", value, "testrecord");
return (Criteria) this;
}
public Criteria andTestrecordGreaterThan(Byte value) {
addCriterion("testRecord >", value, "testrecord");
return (Criteria) this;
}
public Criteria andTestrecordGreaterThanOrEqualTo(Byte value) {
addCriterion("testRecord >=", value, "testrecord");
return (Criteria) this;
}
public Criteria andTestrecordLessThan(Byte value) {
addCriterion("testRecord <", value, "testrecord");
return (Criteria) this;
}
public Criteria andTestrecordLessThanOrEqualTo(Byte value) {
addCriterion("testRecord <=", value, "testrecord");
return (Criteria) this;
}
public Criteria andTestrecordIn(List<Byte> values) {
addCriterion("testRecord in", values, "testrecord");
return (Criteria) this;
}
public Criteria andTestrecordNotIn(List<Byte> values) {
addCriterion("testRecord not in", values, "testrecord");
return (Criteria) this;
}
public Criteria andTestrecordBetween(Byte value1, Byte value2) {
addCriterion("testRecord between", value1, value2, "testrecord");
return (Criteria) this;
}
public Criteria andTestrecordNotBetween(Byte value1, Byte value2) {
addCriterion("testRecord not between", value1, value2, "testrecord");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | UTF-8 | Java | 28,730 | java | TableContainerresourceusagestartExample.java | Java | [] | null | [] | package scs.pojo;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class TableContainerresourceusagestartExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public TableContainerresourceusagestartExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andAutoidIsNull() {
addCriterion("autoId is null");
return (Criteria) this;
}
public Criteria andAutoidIsNotNull() {
addCriterion("autoId is not null");
return (Criteria) this;
}
public Criteria andAutoidEqualTo(Integer value) {
addCriterion("autoId =", value, "autoid");
return (Criteria) this;
}
public Criteria andAutoidNotEqualTo(Integer value) {
addCriterion("autoId <>", value, "autoid");
return (Criteria) this;
}
public Criteria andAutoidGreaterThan(Integer value) {
addCriterion("autoId >", value, "autoid");
return (Criteria) this;
}
public Criteria andAutoidGreaterThanOrEqualTo(Integer value) {
addCriterion("autoId >=", value, "autoid");
return (Criteria) this;
}
public Criteria andAutoidLessThan(Integer value) {
addCriterion("autoId <", value, "autoid");
return (Criteria) this;
}
public Criteria andAutoidLessThanOrEqualTo(Integer value) {
addCriterion("autoId <=", value, "autoid");
return (Criteria) this;
}
public Criteria andAutoidIn(List<Integer> values) {
addCriterion("autoId in", values, "autoid");
return (Criteria) this;
}
public Criteria andAutoidNotIn(List<Integer> values) {
addCriterion("autoId not in", values, "autoid");
return (Criteria) this;
}
public Criteria andAutoidBetween(Integer value1, Integer value2) {
addCriterion("autoId between", value1, value2, "autoid");
return (Criteria) this;
}
public Criteria andAutoidNotBetween(Integer value1, Integer value2) {
addCriterion("autoId not between", value1, value2, "autoid");
return (Criteria) this;
}
public Criteria andContainernameIsNull() {
addCriterion("containerName is null");
return (Criteria) this;
}
public Criteria andContainernameIsNotNull() {
addCriterion("containerName is not null");
return (Criteria) this;
}
public Criteria andContainernameEqualTo(String value) {
addCriterion("containerName =", value, "containername");
return (Criteria) this;
}
public Criteria andContainernameNotEqualTo(String value) {
addCriterion("containerName <>", value, "containername");
return (Criteria) this;
}
public Criteria andContainernameGreaterThan(String value) {
addCriterion("containerName >", value, "containername");
return (Criteria) this;
}
public Criteria andContainernameGreaterThanOrEqualTo(String value) {
addCriterion("containerName >=", value, "containername");
return (Criteria) this;
}
public Criteria andContainernameLessThan(String value) {
addCriterion("containerName <", value, "containername");
return (Criteria) this;
}
public Criteria andContainernameLessThanOrEqualTo(String value) {
addCriterion("containerName <=", value, "containername");
return (Criteria) this;
}
public Criteria andContainernameLike(String value) {
addCriterion("containerName like", value, "containername");
return (Criteria) this;
}
public Criteria andContainernameNotLike(String value) {
addCriterion("containerName not like", value, "containername");
return (Criteria) this;
}
public Criteria andContainernameIn(List<String> values) {
addCriterion("containerName in", values, "containername");
return (Criteria) this;
}
public Criteria andContainernameNotIn(List<String> values) {
addCriterion("containerName not in", values, "containername");
return (Criteria) this;
}
public Criteria andContainernameBetween(String value1, String value2) {
addCriterion("containerName between", value1, value2, "containername");
return (Criteria) this;
}
public Criteria andContainernameNotBetween(String value1, String value2) {
addCriterion("containerName not between", value1, value2, "containername");
return (Criteria) this;
}
public Criteria andCpuusagerateIsNull() {
addCriterion("cpuUsageRate is null");
return (Criteria) this;
}
public Criteria andCpuusagerateIsNotNull() {
addCriterion("cpuUsageRate is not null");
return (Criteria) this;
}
public Criteria andCpuusagerateEqualTo(Float value) {
addCriterion("cpuUsageRate =", value, "cpuusagerate");
return (Criteria) this;
}
public Criteria andCpuusagerateNotEqualTo(Float value) {
addCriterion("cpuUsageRate <>", value, "cpuusagerate");
return (Criteria) this;
}
public Criteria andCpuusagerateGreaterThan(Float value) {
addCriterion("cpuUsageRate >", value, "cpuusagerate");
return (Criteria) this;
}
public Criteria andCpuusagerateGreaterThanOrEqualTo(Float value) {
addCriterion("cpuUsageRate >=", value, "cpuusagerate");
return (Criteria) this;
}
public Criteria andCpuusagerateLessThan(Float value) {
addCriterion("cpuUsageRate <", value, "cpuusagerate");
return (Criteria) this;
}
public Criteria andCpuusagerateLessThanOrEqualTo(Float value) {
addCriterion("cpuUsageRate <=", value, "cpuusagerate");
return (Criteria) this;
}
public Criteria andCpuusagerateIn(List<Float> values) {
addCriterion("cpuUsageRate in", values, "cpuusagerate");
return (Criteria) this;
}
public Criteria andCpuusagerateNotIn(List<Float> values) {
addCriterion("cpuUsageRate not in", values, "cpuusagerate");
return (Criteria) this;
}
public Criteria andCpuusagerateBetween(Float value1, Float value2) {
addCriterion("cpuUsageRate between", value1, value2, "cpuusagerate");
return (Criteria) this;
}
public Criteria andCpuusagerateNotBetween(Float value1, Float value2) {
addCriterion("cpuUsageRate not between", value1, value2, "cpuusagerate");
return (Criteria) this;
}
public Criteria andMemusagerateIsNull() {
addCriterion("memUsageRate is null");
return (Criteria) this;
}
public Criteria andMemusagerateIsNotNull() {
addCriterion("memUsageRate is not null");
return (Criteria) this;
}
public Criteria andMemusagerateEqualTo(Float value) {
addCriterion("memUsageRate =", value, "memusagerate");
return (Criteria) this;
}
public Criteria andMemusagerateNotEqualTo(Float value) {
addCriterion("memUsageRate <>", value, "memusagerate");
return (Criteria) this;
}
public Criteria andMemusagerateGreaterThan(Float value) {
addCriterion("memUsageRate >", value, "memusagerate");
return (Criteria) this;
}
public Criteria andMemusagerateGreaterThanOrEqualTo(Float value) {
addCriterion("memUsageRate >=", value, "memusagerate");
return (Criteria) this;
}
public Criteria andMemusagerateLessThan(Float value) {
addCriterion("memUsageRate <", value, "memusagerate");
return (Criteria) this;
}
public Criteria andMemusagerateLessThanOrEqualTo(Float value) {
addCriterion("memUsageRate <=", value, "memusagerate");
return (Criteria) this;
}
public Criteria andMemusagerateIn(List<Float> values) {
addCriterion("memUsageRate in", values, "memusagerate");
return (Criteria) this;
}
public Criteria andMemusagerateNotIn(List<Float> values) {
addCriterion("memUsageRate not in", values, "memusagerate");
return (Criteria) this;
}
public Criteria andMemusagerateBetween(Float value1, Float value2) {
addCriterion("memUsageRate between", value1, value2, "memusagerate");
return (Criteria) this;
}
public Criteria andMemusagerateNotBetween(Float value1, Float value2) {
addCriterion("memUsageRate not between", value1, value2, "memusagerate");
return (Criteria) this;
}
public Criteria andMemusageamountIsNull() {
addCriterion("memUsageAmount is null");
return (Criteria) this;
}
public Criteria andMemusageamountIsNotNull() {
addCriterion("memUsageAmount is not null");
return (Criteria) this;
}
public Criteria andMemusageamountEqualTo(Float value) {
addCriterion("memUsageAmount =", value, "memusageamount");
return (Criteria) this;
}
public Criteria andMemusageamountNotEqualTo(Float value) {
addCriterion("memUsageAmount <>", value, "memusageamount");
return (Criteria) this;
}
public Criteria andMemusageamountGreaterThan(Float value) {
addCriterion("memUsageAmount >", value, "memusageamount");
return (Criteria) this;
}
public Criteria andMemusageamountGreaterThanOrEqualTo(Float value) {
addCriterion("memUsageAmount >=", value, "memusageamount");
return (Criteria) this;
}
public Criteria andMemusageamountLessThan(Float value) {
addCriterion("memUsageAmount <", value, "memusageamount");
return (Criteria) this;
}
public Criteria andMemusageamountLessThanOrEqualTo(Float value) {
addCriterion("memUsageAmount <=", value, "memusageamount");
return (Criteria) this;
}
public Criteria andMemusageamountIn(List<Float> values) {
addCriterion("memUsageAmount in", values, "memusageamount");
return (Criteria) this;
}
public Criteria andMemusageamountNotIn(List<Float> values) {
addCriterion("memUsageAmount not in", values, "memusageamount");
return (Criteria) this;
}
public Criteria andMemusageamountBetween(Float value1, Float value2) {
addCriterion("memUsageAmount between", value1, value2, "memusageamount");
return (Criteria) this;
}
public Criteria andMemusageamountNotBetween(Float value1, Float value2) {
addCriterion("memUsageAmount not between", value1, value2, "memusageamount");
return (Criteria) this;
}
public Criteria andIoinputIsNull() {
addCriterion("ioInput is null");
return (Criteria) this;
}
public Criteria andIoinputIsNotNull() {
addCriterion("ioInput is not null");
return (Criteria) this;
}
public Criteria andIoinputEqualTo(Float value) {
addCriterion("ioInput =", value, "ioinput");
return (Criteria) this;
}
public Criteria andIoinputNotEqualTo(Float value) {
addCriterion("ioInput <>", value, "ioinput");
return (Criteria) this;
}
public Criteria andIoinputGreaterThan(Float value) {
addCriterion("ioInput >", value, "ioinput");
return (Criteria) this;
}
public Criteria andIoinputGreaterThanOrEqualTo(Float value) {
addCriterion("ioInput >=", value, "ioinput");
return (Criteria) this;
}
public Criteria andIoinputLessThan(Float value) {
addCriterion("ioInput <", value, "ioinput");
return (Criteria) this;
}
public Criteria andIoinputLessThanOrEqualTo(Float value) {
addCriterion("ioInput <=", value, "ioinput");
return (Criteria) this;
}
public Criteria andIoinputIn(List<Float> values) {
addCriterion("ioInput in", values, "ioinput");
return (Criteria) this;
}
public Criteria andIoinputNotIn(List<Float> values) {
addCriterion("ioInput not in", values, "ioinput");
return (Criteria) this;
}
public Criteria andIoinputBetween(Float value1, Float value2) {
addCriterion("ioInput between", value1, value2, "ioinput");
return (Criteria) this;
}
public Criteria andIoinputNotBetween(Float value1, Float value2) {
addCriterion("ioInput not between", value1, value2, "ioinput");
return (Criteria) this;
}
public Criteria andIooutputIsNull() {
addCriterion("ioOutput is null");
return (Criteria) this;
}
public Criteria andIooutputIsNotNull() {
addCriterion("ioOutput is not null");
return (Criteria) this;
}
public Criteria andIooutputEqualTo(Float value) {
addCriterion("ioOutput =", value, "iooutput");
return (Criteria) this;
}
public Criteria andIooutputNotEqualTo(Float value) {
addCriterion("ioOutput <>", value, "iooutput");
return (Criteria) this;
}
public Criteria andIooutputGreaterThan(Float value) {
addCriterion("ioOutput >", value, "iooutput");
return (Criteria) this;
}
public Criteria andIooutputGreaterThanOrEqualTo(Float value) {
addCriterion("ioOutput >=", value, "iooutput");
return (Criteria) this;
}
public Criteria andIooutputLessThan(Float value) {
addCriterion("ioOutput <", value, "iooutput");
return (Criteria) this;
}
public Criteria andIooutputLessThanOrEqualTo(Float value) {
addCriterion("ioOutput <=", value, "iooutput");
return (Criteria) this;
}
public Criteria andIooutputIn(List<Float> values) {
addCriterion("ioOutput in", values, "iooutput");
return (Criteria) this;
}
public Criteria andIooutputNotIn(List<Float> values) {
addCriterion("ioOutput not in", values, "iooutput");
return (Criteria) this;
}
public Criteria andIooutputBetween(Float value1, Float value2) {
addCriterion("ioOutput between", value1, value2, "iooutput");
return (Criteria) this;
}
public Criteria andIooutputNotBetween(Float value1, Float value2) {
addCriterion("ioOutput not between", value1, value2, "iooutput");
return (Criteria) this;
}
public Criteria andNetinputIsNull() {
addCriterion("netInput is null");
return (Criteria) this;
}
public Criteria andNetinputIsNotNull() {
addCriterion("netInput is not null");
return (Criteria) this;
}
public Criteria andNetinputEqualTo(Float value) {
addCriterion("netInput =", value, "netinput");
return (Criteria) this;
}
public Criteria andNetinputNotEqualTo(Float value) {
addCriterion("netInput <>", value, "netinput");
return (Criteria) this;
}
public Criteria andNetinputGreaterThan(Float value) {
addCriterion("netInput >", value, "netinput");
return (Criteria) this;
}
public Criteria andNetinputGreaterThanOrEqualTo(Float value) {
addCriterion("netInput >=", value, "netinput");
return (Criteria) this;
}
public Criteria andNetinputLessThan(Float value) {
addCriterion("netInput <", value, "netinput");
return (Criteria) this;
}
public Criteria andNetinputLessThanOrEqualTo(Float value) {
addCriterion("netInput <=", value, "netinput");
return (Criteria) this;
}
public Criteria andNetinputIn(List<Float> values) {
addCriterion("netInput in", values, "netinput");
return (Criteria) this;
}
public Criteria andNetinputNotIn(List<Float> values) {
addCriterion("netInput not in", values, "netinput");
return (Criteria) this;
}
public Criteria andNetinputBetween(Float value1, Float value2) {
addCriterion("netInput between", value1, value2, "netinput");
return (Criteria) this;
}
public Criteria andNetinputNotBetween(Float value1, Float value2) {
addCriterion("netInput not between", value1, value2, "netinput");
return (Criteria) this;
}
public Criteria andNetoutputIsNull() {
addCriterion("netOutput is null");
return (Criteria) this;
}
public Criteria andNetoutputIsNotNull() {
addCriterion("netOutput is not null");
return (Criteria) this;
}
public Criteria andNetoutputEqualTo(Float value) {
addCriterion("netOutput =", value, "netoutput");
return (Criteria) this;
}
public Criteria andNetoutputNotEqualTo(Float value) {
addCriterion("netOutput <>", value, "netoutput");
return (Criteria) this;
}
public Criteria andNetoutputGreaterThan(Float value) {
addCriterion("netOutput >", value, "netoutput");
return (Criteria) this;
}
public Criteria andNetoutputGreaterThanOrEqualTo(Float value) {
addCriterion("netOutput >=", value, "netoutput");
return (Criteria) this;
}
public Criteria andNetoutputLessThan(Float value) {
addCriterion("netOutput <", value, "netoutput");
return (Criteria) this;
}
public Criteria andNetoutputLessThanOrEqualTo(Float value) {
addCriterion("netOutput <=", value, "netoutput");
return (Criteria) this;
}
public Criteria andNetoutputIn(List<Float> values) {
addCriterion("netOutput in", values, "netoutput");
return (Criteria) this;
}
public Criteria andNetoutputNotIn(List<Float> values) {
addCriterion("netOutput not in", values, "netoutput");
return (Criteria) this;
}
public Criteria andNetoutputBetween(Float value1, Float value2) {
addCriterion("netOutput between", value1, value2, "netoutput");
return (Criteria) this;
}
public Criteria andNetoutputNotBetween(Float value1, Float value2) {
addCriterion("netOutput not between", value1, value2, "netoutput");
return (Criteria) this;
}
public Criteria andCollecttimeIsNull() {
addCriterion("collectTime is null");
return (Criteria) this;
}
public Criteria andCollecttimeIsNotNull() {
addCriterion("collectTime is not null");
return (Criteria) this;
}
public Criteria andCollecttimeEqualTo(Date value) {
addCriterion("collectTime =", value, "collecttime");
return (Criteria) this;
}
public Criteria andCollecttimeNotEqualTo(Date value) {
addCriterion("collectTime <>", value, "collecttime");
return (Criteria) this;
}
public Criteria andCollecttimeGreaterThan(Date value) {
addCriterion("collectTime >", value, "collecttime");
return (Criteria) this;
}
public Criteria andCollecttimeGreaterThanOrEqualTo(Date value) {
addCriterion("collectTime >=", value, "collecttime");
return (Criteria) this;
}
public Criteria andCollecttimeLessThan(Date value) {
addCriterion("collectTime <", value, "collecttime");
return (Criteria) this;
}
public Criteria andCollecttimeLessThanOrEqualTo(Date value) {
addCriterion("collectTime <=", value, "collecttime");
return (Criteria) this;
}
public Criteria andCollecttimeIn(List<Date> values) {
addCriterion("collectTime in", values, "collecttime");
return (Criteria) this;
}
public Criteria andCollecttimeNotIn(List<Date> values) {
addCriterion("collectTime not in", values, "collecttime");
return (Criteria) this;
}
public Criteria andCollecttimeBetween(Date value1, Date value2) {
addCriterion("collectTime between", value1, value2, "collecttime");
return (Criteria) this;
}
public Criteria andCollecttimeNotBetween(Date value1, Date value2) {
addCriterion("collectTime not between", value1, value2, "collecttime");
return (Criteria) this;
}
public Criteria andTestrecordIsNull() {
addCriterion("testRecord is null");
return (Criteria) this;
}
public Criteria andTestrecordIsNotNull() {
addCriterion("testRecord is not null");
return (Criteria) this;
}
public Criteria andTestrecordEqualTo(Byte value) {
addCriterion("testRecord =", value, "testrecord");
return (Criteria) this;
}
public Criteria andTestrecordNotEqualTo(Byte value) {
addCriterion("testRecord <>", value, "testrecord");
return (Criteria) this;
}
public Criteria andTestrecordGreaterThan(Byte value) {
addCriterion("testRecord >", value, "testrecord");
return (Criteria) this;
}
public Criteria andTestrecordGreaterThanOrEqualTo(Byte value) {
addCriterion("testRecord >=", value, "testrecord");
return (Criteria) this;
}
public Criteria andTestrecordLessThan(Byte value) {
addCriterion("testRecord <", value, "testrecord");
return (Criteria) this;
}
public Criteria andTestrecordLessThanOrEqualTo(Byte value) {
addCriterion("testRecord <=", value, "testrecord");
return (Criteria) this;
}
public Criteria andTestrecordIn(List<Byte> values) {
addCriterion("testRecord in", values, "testrecord");
return (Criteria) this;
}
public Criteria andTestrecordNotIn(List<Byte> values) {
addCriterion("testRecord not in", values, "testrecord");
return (Criteria) this;
}
public Criteria andTestrecordBetween(Byte value1, Byte value2) {
addCriterion("testRecord between", value1, value2, "testrecord");
return (Criteria) this;
}
public Criteria andTestrecordNotBetween(Byte value1, Byte value2) {
addCriterion("testRecord not between", value1, value2, "testrecord");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | 28,730 | 0.591925 | 0.588583 | 871 | 31.986223 | 26.501215 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.724455 | false | false | 2 |
325610fba4995213401ee5fe67a99ed3c363decf | 34,041,910,820,465 | 085470ae369d5067e58af9cbce6553ca028efd03 | /src/Randall_SVM/libsvm/svm_problem.java | 0a39e285afa7a755a7d03fed125a7afd25baf93a | [] | no_license | Randall-zhang/SVM_base1 | https://github.com/Randall-zhang/SVM_base1 | 51936c8da2beb401625c66fd3b3bb5e041fcf2a8 | c3eac97ad014a4a1053625bb37f346e8576eba43 | refs/heads/master | 2022-12-18T15:49:17.381000 | 2020-09-26T04:20:05 | 2020-09-26T04:20:05 | 298,755,896 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Randall_SVM.libsvm;
/**
* 包含了训练集数据的基本信息
* @author Randall_Zhang
*
*/
public class svm_problem implements java.io.Serializable
{
//定义了向量的总个数
public int l;
//分类类型值数组
public double[] y;
//训练集向量表
public svm_node[][] x;
}
| GB18030 | Java | 305 | java | svm_problem.java | Java | [
{
"context": "andall_SVM.libsvm;\n/**\n * 包含了训练集数据的基本信息\n * @author Randall_Zhang\n *\n */\npublic class svm_problem implements java.i",
"end": 73,
"score": 0.9984530210494995,
"start": 60,
"tag": "NAME",
"value": "Randall_Zhang"
}
] | null | [] | package Randall_SVM.libsvm;
/**
* 包含了训练集数据的基本信息
* @author Randall_Zhang
*
*/
public class svm_problem implements java.io.Serializable
{
//定义了向量的总个数
public int l;
//分类类型值数组
public double[] y;
//训练集向量表
public svm_node[][] x;
}
| 305 | 0.689362 | 0.689362 | 15 | 14.666667 | 13.917215 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 2 |
9cf71518c53399a015b133915c7ecc7884fa6988 | 38,001,870,644,116 | d82daec7fb6ac02c7a0c9868242644e9688a95da | /src/main/java/com/ming800/core/base/controller/ExcelViewController.java | a65d0a1588d67f55e2dcb1c50b75d43bbb76347e | [] | no_license | notbadwt/ypl3 | https://github.com/notbadwt/ypl3 | 6a93348444a3ebfea22d51a20ac2cbfdb6b9cffa | fa73dd1e20127e4b7244907fdfb28c40789d442b | refs/heads/master | 2016-08-04T14:57:13.794000 | 2014-11-13T07:49:19 | 2014-11-13T07:49:19 | 26,584,106 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ming800.core.base.controller;
import com.ming800.core.does.model.Do;
import com.ming800.core.does.model.DoResult;
import com.ming800.core.does.model.Page;
import com.ming800.core.does.model.PageField;
import com.ming800.core.p.PConst;
import com.ming800.core.p.model.DictionaryData;
import com.ming800.core.p.model.MethodCache;
import com.ming800.core.p.model.SystemLog;
import com.ming800.core.p.service.ModuleManager;
import com.ming800.core.base.service.BaseManager;
import com.ming800.core.util.ApplicationContextUtil;
import com.ming800.core.util.AuthorizationUtil;
import com.ming800.core.util.DateUtil;
import com.ming800.core.util.SystemValueUtil;
import org.springframework.web.servlet.view.document.AbstractExcelView;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* Created with IntelliJ IDEA.
* User: Administrator
* Date: 13-1-9
* Time: 上午11:40
* To change this template use File | Settings | File Templates.
*/
public class ExcelViewController extends AbstractExcelView {
private BaseManager baseManager = (BaseManager)ApplicationContextUtil.getApplicationContext().getBean("baseManagerImpl");
private ModuleManager moduleManager = (ModuleManager)ApplicationContextUtil.getApplicationContext().getBean("moduleManagerImpl");
@SuppressWarnings("unchecked")
protected void buildExcelDocument(Map map, HSSFWorkbook hssfWorkbook, HttpServletRequest request, HttpServletResponse response) throws Exception {
List<Object> objectList = (List<Object>) map.get("objectList");
Do tempDo = (Do)map.get("tempDo");
Page tempPage = (Page)map.get("tempPage");
/*缓存*/
MethodCache methodCache = new MethodCache();
methodCache.init(tempDo, tempPage);
HSSFSheet hssfSheet = hssfWorkbook.createSheet();
int fi = 0;
for (PageField pageField:tempPage.getFieldList()) {
if (!pageField.getInputType().equals("default")) {
this.getCell(hssfSheet, 0, fi).setCellValue(new HSSFRichTextString(pageField.getLabel()));
fi ++;
}
}
for (Object object:objectList) {
int rowCount = hssfSheet.getLastRowNum();
int fd = 0;
for (PageField pageField:tempPage.getFieldList()) {
if (!pageField.getInputType().equals("default")) {
Object tempObjectValue = SystemValueUtil.fetchFieldValue(object, methodCache, pageField.getName().split("\\."));
// Object tempObjectValue = SystemValueUtil.generateTempObjectValue(object, pageField.getName().split("\\."));
if (tempObjectValue == null) {
tempObjectValue = "";
} else {
if (pageField.getDataType().equals("status")) {
tempObjectValue = moduleManager.convertStatusTypeLabel(pageField.getKey(), tempObjectValue.toString());
} else if (pageField.getInputType().equals("select_dictionary") || pageField.getInputType().equals("radio_dictionary")) {
DictionaryData dictionaryData = (DictionaryData)baseManager.getObject(DictionaryData.class.getName(), tempObjectValue.toString());
tempObjectValue = dictionaryData.getData();
} else if (pageField.getDataType().equals("datetime")) {
tempObjectValue = DateUtil.formatDateMinute((Date) tempObjectValue);
} else if (pageField.getDataType().equals("date")) {
tempObjectValue = DateUtil.formatDate((Date) tempObjectValue);
}
}
this.getCell(hssfSheet, rowCount + 1, fd).setCellValue(new HSSFRichTextString(tempObjectValue.toString()));
fd ++;
}
}
}
DoResult doResult = (DoResult)map.get("doResult");
SystemLog systemLog = new SystemLog();
systemLog.setContent(doResult.getLabel() + "导出成功");
systemLog.setTheDateTime(new Date());
systemLog.setTeachArea(AuthorizationUtil.getMyTeachArea());
systemLog.setBranch(AuthorizationUtil.getMyBranch());
systemLog.setUser(AuthorizationUtil.getUser());
systemLog.setTheType(PConst.SYSTEM_LOG_THE_TYPE_EXPORT);
baseManager.saveOrUpdate(systemLog.getClass().getName(), systemLog);
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
response.setContentType("multipart/form-data");
//2.设置文件头:最后一个参数是设置下载文件名(假如我们叫a.pdf)
response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(tempDo.getLabel(), "UTF-8") + ".xls");
}
}
| UTF-8 | Java | 5,152 | java | ExcelViewController.java | Java | [
{
"context": ".Map;\n\n/**\n * Created with IntelliJ IDEA.\n * User: Administrator\n * Date: 13-1-9\n * Time: 上午11:40\n * To change thi",
"end": 1147,
"score": 0.8531606197357178,
"start": 1134,
"tag": "USERNAME",
"value": "Administrator"
}
] | null | [] | package com.ming800.core.base.controller;
import com.ming800.core.does.model.Do;
import com.ming800.core.does.model.DoResult;
import com.ming800.core.does.model.Page;
import com.ming800.core.does.model.PageField;
import com.ming800.core.p.PConst;
import com.ming800.core.p.model.DictionaryData;
import com.ming800.core.p.model.MethodCache;
import com.ming800.core.p.model.SystemLog;
import com.ming800.core.p.service.ModuleManager;
import com.ming800.core.base.service.BaseManager;
import com.ming800.core.util.ApplicationContextUtil;
import com.ming800.core.util.AuthorizationUtil;
import com.ming800.core.util.DateUtil;
import com.ming800.core.util.SystemValueUtil;
import org.springframework.web.servlet.view.document.AbstractExcelView;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* Created with IntelliJ IDEA.
* User: Administrator
* Date: 13-1-9
* Time: 上午11:40
* To change this template use File | Settings | File Templates.
*/
public class ExcelViewController extends AbstractExcelView {
private BaseManager baseManager = (BaseManager)ApplicationContextUtil.getApplicationContext().getBean("baseManagerImpl");
private ModuleManager moduleManager = (ModuleManager)ApplicationContextUtil.getApplicationContext().getBean("moduleManagerImpl");
@SuppressWarnings("unchecked")
protected void buildExcelDocument(Map map, HSSFWorkbook hssfWorkbook, HttpServletRequest request, HttpServletResponse response) throws Exception {
List<Object> objectList = (List<Object>) map.get("objectList");
Do tempDo = (Do)map.get("tempDo");
Page tempPage = (Page)map.get("tempPage");
/*缓存*/
MethodCache methodCache = new MethodCache();
methodCache.init(tempDo, tempPage);
HSSFSheet hssfSheet = hssfWorkbook.createSheet();
int fi = 0;
for (PageField pageField:tempPage.getFieldList()) {
if (!pageField.getInputType().equals("default")) {
this.getCell(hssfSheet, 0, fi).setCellValue(new HSSFRichTextString(pageField.getLabel()));
fi ++;
}
}
for (Object object:objectList) {
int rowCount = hssfSheet.getLastRowNum();
int fd = 0;
for (PageField pageField:tempPage.getFieldList()) {
if (!pageField.getInputType().equals("default")) {
Object tempObjectValue = SystemValueUtil.fetchFieldValue(object, methodCache, pageField.getName().split("\\."));
// Object tempObjectValue = SystemValueUtil.generateTempObjectValue(object, pageField.getName().split("\\."));
if (tempObjectValue == null) {
tempObjectValue = "";
} else {
if (pageField.getDataType().equals("status")) {
tempObjectValue = moduleManager.convertStatusTypeLabel(pageField.getKey(), tempObjectValue.toString());
} else if (pageField.getInputType().equals("select_dictionary") || pageField.getInputType().equals("radio_dictionary")) {
DictionaryData dictionaryData = (DictionaryData)baseManager.getObject(DictionaryData.class.getName(), tempObjectValue.toString());
tempObjectValue = dictionaryData.getData();
} else if (pageField.getDataType().equals("datetime")) {
tempObjectValue = DateUtil.formatDateMinute((Date) tempObjectValue);
} else if (pageField.getDataType().equals("date")) {
tempObjectValue = DateUtil.formatDate((Date) tempObjectValue);
}
}
this.getCell(hssfSheet, rowCount + 1, fd).setCellValue(new HSSFRichTextString(tempObjectValue.toString()));
fd ++;
}
}
}
DoResult doResult = (DoResult)map.get("doResult");
SystemLog systemLog = new SystemLog();
systemLog.setContent(doResult.getLabel() + "导出成功");
systemLog.setTheDateTime(new Date());
systemLog.setTeachArea(AuthorizationUtil.getMyTeachArea());
systemLog.setBranch(AuthorizationUtil.getMyBranch());
systemLog.setUser(AuthorizationUtil.getUser());
systemLog.setTheType(PConst.SYSTEM_LOG_THE_TYPE_EXPORT);
baseManager.saveOrUpdate(systemLog.getClass().getName(), systemLog);
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
response.setContentType("multipart/form-data");
//2.设置文件头:最后一个参数是设置下载文件名(假如我们叫a.pdf)
response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(tempDo.getLabel(), "UTF-8") + ".xls");
}
}
| 5,152 | 0.666865 | 0.65496 | 108 | 45.657406 | 38.027565 | 158 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.740741 | false | false | 2 |
2cb4e6f884b16a146a0746a530e97f05658b35d8 | 38,457,137,172,607 | 5f5f309bdf8fa7946e89dbfd2b1c3eb8e3892bd6 | /src/main/test/com/hit/memory/CacheUnitTest.java | 9d686a2b4075e0d029b7dbe4fb10962d85087cbd | [] | no_license | KatanMichael/CacheUnitProject | https://github.com/KatanMichael/CacheUnitProject | 792e83e949bec71b28e4c32da071d262ab4a6206 | be8bdc5bd91a35c8dbbc423fd4c8768fb3da7ad9 | refs/heads/master | 2020-03-08T22:00:10.951000 | 2018-06-30T13:32:59 | 2018-06-30T13:32:59 | 127,892,205 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hit.memory;
import com.hit.algorithm.LRUAlgoCacheImpl;
import com.hit.dao.DaoFileImpl;
import com.hit.dm.DataModel;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.*;
import java.util.ArrayList;
import java.util.UUID;
import static org.junit.Assert.*;
public class CacheUnitTest
{
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Test
public void getDataModels()
{
LRUAlgoCacheImpl<Long, DataModel<Integer>> lru = new LRUAlgoCacheImpl<>(25);
DaoFileImpl<Integer> daoFile = new DaoFileImpl<>("out.txt");
CacheUnit<Integer> cacheUnit = new CacheUnit(lru, daoFile);
for (int i = 0; i < 27; i++)
{
//lru.putElement(Long.valueOf(i),new DataModel(Long.valueOf(i),i));
}
for (int i = 0; i < 150; i++)
{
int integer = i;
//daoFile.save(new DataModel(Long.valueOf(i), integer));
}
Long[] ids = {Long.valueOf(19),Long.valueOf(20),Long.valueOf(110),Long.valueOf(101)};
DataModel<Integer>[] dataModels = null;
dataModels = cacheUnit.getDataModels(ids);
for (DataModel model: dataModels)
{
System.out.println(model.getId() + " "+model.getContent());
}
}
} | UTF-8 | Java | 1,371 | java | CacheUnitTest.java | Java | [] | null | [] | package com.hit.memory;
import com.hit.algorithm.LRUAlgoCacheImpl;
import com.hit.dao.DaoFileImpl;
import com.hit.dm.DataModel;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.*;
import java.util.ArrayList;
import java.util.UUID;
import static org.junit.Assert.*;
public class CacheUnitTest
{
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Test
public void getDataModels()
{
LRUAlgoCacheImpl<Long, DataModel<Integer>> lru = new LRUAlgoCacheImpl<>(25);
DaoFileImpl<Integer> daoFile = new DaoFileImpl<>("out.txt");
CacheUnit<Integer> cacheUnit = new CacheUnit(lru, daoFile);
for (int i = 0; i < 27; i++)
{
//lru.putElement(Long.valueOf(i),new DataModel(Long.valueOf(i),i));
}
for (int i = 0; i < 150; i++)
{
int integer = i;
//daoFile.save(new DataModel(Long.valueOf(i), integer));
}
Long[] ids = {Long.valueOf(19),Long.valueOf(20),Long.valueOf(110),Long.valueOf(101)};
DataModel<Integer>[] dataModels = null;
dataModels = cacheUnit.getDataModels(ids);
for (DataModel model: dataModels)
{
System.out.println(model.getId() + " "+model.getContent());
}
}
} | 1,371 | 0.612691 | 0.598833 | 62 | 21.129032 | 24.522198 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.532258 | false | false | 2 |
fea45155847246f8efb53a5abd12d5233c1610cb | 33,346,126,152,000 | fa345ba6fe9899912df4521c69df9a72b4f3be6d | /BootcampManagement/src/tools/TestController.java | 7bae67b4377ab25c0bfcd5a6bfee036b3382163c | [] | no_license | bootcamp23-mii/BootcampManagement | https://github.com/bootcamp23-mii/BootcampManagement | d152b6f2ce43ddf06a8aa49b73e853e3af933e59 | b8e004894a3bf512e962c86b783ce7eece678cb5 | refs/heads/master | 2020-04-26T03:02:44.124000 | 2019-03-11T14:50:52 | 2019-03-11T14:59:00 | 173,253,982 | 2 | 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 tools;
import controllers.EducationHistoryController;
import controllers.EducationHistoryControllerInterface;
import controllers.EmployeeController;
import controllers.UploadController;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.sql.Connection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import models.*;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.query.JRHibernateQueryExecuterFactory;
import net.sf.jasperreports.view.JasperViewer;
import org.hibernate.SessionFactory;
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
/**
*
* @author FES
*/
public class TestController {
public static void main(String[] args) throws FileNotFoundException, IOException {
SessionFactory factory = HibernateUtil.getSessionFactory();
EducationHistoryControllerInterface eh = new EducationHistoryController(factory);
EmployeeController emp = new EmployeeController(factory);
List<Employee> empList = emp.searchWD("14201");
// UploadController up = new UploadController(factory);
//// byte temp = (byte) up.getById("14303").getPhoto();
// FileInputStream file = new FileInputStream(up.getById("14303").getPhoto().toString());
// ObjectInputStream in = new ObjectInputStream(file);
// System.out.println(in);
// System.out.println(eh.save("", "4.0", "CVE1", "14303"));
// System.out.println(eh.getByid("CVEH1").getEmployee().getName());
// System.out.println();
// try {
// String fileName = "./src/reports/CV.jrxml";
// String filetoFill = "./src/reports/CV.jasper";
// JasperCompileManager.compileReport(fileName);
// Map param = new HashMap();
//// param.put(JRHibernateQueryExecuterFactory.PARAMETER_HIBERNATE_SESSION, factory.openSession());
// param.put("setID", 14303);
// Connection conn = factory.getSessionFactoryOptions().getServiceRegistry().getService(ConnectionProvider.class).getConnection();
//// JasperFillManager.fillReport(filetoFill, param);
//// JasperPrint jp = JasperFillManager.fillReport(filetoFill, param);
// JasperFillManager.fillReport(filetoFill, param, conn);
// JasperPrint jp = JasperFillManager.fillReport(filetoFill, param, conn);
// JasperViewer.viewReport(jp, true);
// } catch (Exception ex) {
// ex.printStackTrace();
// System.out.println(ex.toString());
// }
for (Employee employee : empList) {
for (BatchClass data : employee.getBatchClassList()) {
System.out.println(data.getTrainer());
}
}
for (Employee employee : empList) {
for (EmployeeRole data : employee.getEmployeeRoleList()) {
System.out.println(data.getRole().getName());
}
}
}
}
| UTF-8 | Java | 3,422 | java | TestController.java | Java | [
{
"context": "ons.spi.ConnectionProvider;\r\n\r\n/**\r\n *\r\n * @author FES\r\n */\r\npublic class TestController {\r\n public s",
"end": 1068,
"score": 0.8648731708526611,
"start": 1065,
"tag": "USERNAME",
"value": "FES"
}
] | 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 tools;
import controllers.EducationHistoryController;
import controllers.EducationHistoryControllerInterface;
import controllers.EmployeeController;
import controllers.UploadController;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.sql.Connection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import models.*;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.query.JRHibernateQueryExecuterFactory;
import net.sf.jasperreports.view.JasperViewer;
import org.hibernate.SessionFactory;
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
/**
*
* @author FES
*/
public class TestController {
public static void main(String[] args) throws FileNotFoundException, IOException {
SessionFactory factory = HibernateUtil.getSessionFactory();
EducationHistoryControllerInterface eh = new EducationHistoryController(factory);
EmployeeController emp = new EmployeeController(factory);
List<Employee> empList = emp.searchWD("14201");
// UploadController up = new UploadController(factory);
//// byte temp = (byte) up.getById("14303").getPhoto();
// FileInputStream file = new FileInputStream(up.getById("14303").getPhoto().toString());
// ObjectInputStream in = new ObjectInputStream(file);
// System.out.println(in);
// System.out.println(eh.save("", "4.0", "CVE1", "14303"));
// System.out.println(eh.getByid("CVEH1").getEmployee().getName());
// System.out.println();
// try {
// String fileName = "./src/reports/CV.jrxml";
// String filetoFill = "./src/reports/CV.jasper";
// JasperCompileManager.compileReport(fileName);
// Map param = new HashMap();
//// param.put(JRHibernateQueryExecuterFactory.PARAMETER_HIBERNATE_SESSION, factory.openSession());
// param.put("setID", 14303);
// Connection conn = factory.getSessionFactoryOptions().getServiceRegistry().getService(ConnectionProvider.class).getConnection();
//// JasperFillManager.fillReport(filetoFill, param);
//// JasperPrint jp = JasperFillManager.fillReport(filetoFill, param);
// JasperFillManager.fillReport(filetoFill, param, conn);
// JasperPrint jp = JasperFillManager.fillReport(filetoFill, param, conn);
// JasperViewer.viewReport(jp, true);
// } catch (Exception ex) {
// ex.printStackTrace();
// System.out.println(ex.toString());
// }
for (Employee employee : empList) {
for (BatchClass data : employee.getBatchClassList()) {
System.out.println(data.getTrainer());
}
}
for (Employee employee : empList) {
for (EmployeeRole data : employee.getEmployeeRoleList()) {
System.out.println(data.getRole().getName());
}
}
}
}
| 3,422 | 0.670076 | 0.661601 | 76 | 43.026318 | 28.794634 | 141 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.855263 | false | false | 2 |
d8814979088a551f1f7552c765c903dec3f57630 | 37,323,265,812,372 | 6c713a946e9f98d6ccf1de918036039264ab3f83 | /src/main/java/donjon/Sort.java | 0a7b9fffe37f91171de4c52f9e4cbc37db2fff05 | [] | no_license | Geraud-Vercasson/Donjons | https://github.com/Geraud-Vercasson/Donjons | 978a2730e2f5e2d9600de5ae2c25105e46e5e97f | 07660592854d7a93fc59bf060ab59da818b59c7e | refs/heads/master | 2021-09-10T00:13:52.601000 | 2018-03-20T10:29:24 | 2018-03-20T10:29:24 | 125,999,684 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package donjon;
public class Sort {
private String nom;
private int puissance;
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
public int getPuissance() {
return puissance;
}
public void setPuissance(int puissance) {
this.puissance = puissance;
}
}
| UTF-8 | Java | 368 | java | Sort.java | Java | [] | null | [] | package donjon;
public class Sort {
private String nom;
private int puissance;
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
public int getPuissance() {
return puissance;
}
public void setPuissance(int puissance) {
this.puissance = puissance;
}
}
| 368 | 0.589674 | 0.589674 | 22 | 15.727273 | 13.909388 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.318182 | false | false | 2 |
e103d74dbf4e83f5887bb7c2b85868664c888fd9 | 2,430,951,541,662 | a9a37e3dcd4caca8639d67d5a12a306f27ecb456 | /app/src/main/java/com/example/pbego/giveeat/MainActivity.java | b4bb73e2834bcbe13f7761497786089bd191b628 | [] | no_license | PierreBEGOUT/PFE_Giv-Eat | https://github.com/PierreBEGOUT/PFE_Giv-Eat | 0f7bd6482481091992a3115768ba5a1767a96892 | d25c65dd090ad7dd3c102e8913cc3f1109ba4cca | refs/heads/master | 2021-09-05T14:13:04.851000 | 2018-01-28T17:02:07 | 2018-01-28T17:02:07 | 111,567,249 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.pbego.giveeat;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;
import android.view.View.OnTouchListener;
import android.view.View.OnClickListener;
import android.view.MotionEvent;
import android.view.View;
public class MainActivity extends AppCompatActivity implements OnClickListener {
private Button b = null;
private Button a = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b = findViewById(R.id.connexion);
b.setOnClickListener(this);
a=findViewById(R.id.creationCompte);
a.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch(v.getId())
{
//si on appuit sur le 1er
case R.id.connexion:
Intent connexion = new Intent(MainActivity.this, Connexion.class);
startActivity(connexion);
break;
//si on appuit sur le 2e
case R.id.creationCompte:
Intent enregistrement = new Intent(MainActivity.this, Enregistrement.class);
startActivity(enregistrement);
break;
}
}
}
| UTF-8 | Java | 1,407 | java | MainActivity.java | Java | [] | null | [] | package com.example.pbego.giveeat;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;
import android.view.View.OnTouchListener;
import android.view.View.OnClickListener;
import android.view.MotionEvent;
import android.view.View;
public class MainActivity extends AppCompatActivity implements OnClickListener {
private Button b = null;
private Button a = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b = findViewById(R.id.connexion);
b.setOnClickListener(this);
a=findViewById(R.id.creationCompte);
a.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch(v.getId())
{
//si on appuit sur le 1er
case R.id.connexion:
Intent connexion = new Intent(MainActivity.this, Connexion.class);
startActivity(connexion);
break;
//si on appuit sur le 2e
case R.id.creationCompte:
Intent enregistrement = new Intent(MainActivity.this, Enregistrement.class);
startActivity(enregistrement);
break;
}
}
}
| 1,407 | 0.661692 | 0.659559 | 50 | 27.120001 | 21.953259 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.54 | false | false | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.