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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3421286b54ae59439a3530212fe6f1535be4e145 | 15,178,414,457,757 | 7f49365c3fb97554b860d09963dcb20c4e71b982 | /src/main/java/com/github/TKnudsen/ComplexDataObject/data/features/FeatureVectorContainer.java | de45319e240a0c4130feb48faf1c47209dceb90e | [
"Apache-2.0"
] | permissive | TKnudsen/ComplexDataObject | https://github.com/TKnudsen/ComplexDataObject | 093129c3667a5155767b600c4de5534b6c27f1be | 6e8d5dfdcbbe737a71773a3289367d2d25e38c34 | refs/heads/master | 2023-05-01T23:16:30.081000 | 2023-04-24T19:25:32 | 2023-04-24T19:25:32 | 47,545,451 | 3 | 11 | Apache-2.0 | false | 2023-04-14T17:33:58 | 2015-12-07T10:30:54 | 2022-01-02T22:58:18 | 2023-04-14T17:33:58 | 1,136 | 1 | 8 | 3 | Java | false | false | package com.github.TKnudsen.ComplexDataObject.data.features;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import com.github.TKnudsen.ComplexDataObject.data.interfaces.IFeatureVectorObject;
import com.github.TKnudsen.ComplexDataObject.data.interfaces.IKeyValueProvider;
/**
* <p>
* Stores and manages collections of Feature Vectors. A FeatureSchema manages
* the features of the collection.
* </p>
*
* <p>
* Copyright: Copyright (c) 2016-2020
* </p>
*
* @author Juergen Bernard
* @version 1.05
*/
public class FeatureVectorContainer<FV extends IFeatureVectorObject<?, ?>> implements Iterable<FV> {
private Map<Long, FV> featureVectorMap = new HashMap<Long, FV>();
/**
* created to allow values() operation without iterator to be more thread-safe.
*
* Important: always needs to be kept in sync with the featureVectorMap.
*/
private ArrayList<FV> values = new ArrayList<FV>();
protected Map<String, Map<Long, Object>> featureValues = new HashMap<String, Map<Long, Object>>();
protected FeatureSchema featureSchema;
public FeatureVectorContainer(FeatureSchema featureSchema) {
this.featureSchema = featureSchema;
}
public FeatureVectorContainer(Map<Long, FV> featureVectorMap) {
this.featureVectorMap = featureVectorMap;
featureSchema = new FeatureSchema();
for (Long ID : featureVectorMap.keySet())
extendDataSchema(featureVectorMap.get(ID));
}
public FeatureVectorContainer(Iterable<FV> objects) {
featureSchema = new FeatureSchema();
for (FV object : objects) {
featureVectorMap.put(object.getID(), object);
values.add(object);
extendDataSchema(object);
}
}
private void extendDataSchema(FV object) {
for (String feature : object.getFeatureKeySet())
if (!featureSchema.contains(feature))
if (feature == null || object.getFeature(feature) == null
|| object.getFeature(feature).getFeatureValue() == null)
throw new IllegalArgumentException("FeatureContainer: feature in object was associated with null");
else
featureSchema.add(feature, object.getFeature(feature).getFeatureValue().getClass(),
object.getFeature(feature).getFeatureType());
// TODO maybe add type information to Feature class itself (currently an
// enum)
}
/**
* Introduces or updates a new feature.
*
* @param feature
* @return the data schema instance for call-chaining.
*/
public FeatureSchema addFeature(Feature<?> feature) {
featureValues = new HashMap<String, Map<Long, Object>>();
featureSchema.add(feature.getFeatureName(), feature.getFeatureValue().getClass(), feature.getFeatureType());
Iterator<FV> objectIterator = iterator();
while (objectIterator.hasNext()) {
FV next = objectIterator.next();
if (next.getFeature(feature.getFeatureName()) == null)
next.addFeature(feature.getFeatureName(), null, feature.getFeatureType());
}
return featureSchema;
}
/**
* Introduces or updates a feature.
*
* @param featureName the feature name
* @return the data schema instance for call-chaining.
*/
public FeatureSchema addFeature(String featureName, Class<Feature<?>> featureClass, FeatureType featureType) {
featureValues = new HashMap<String, Map<Long, Object>>();
featureSchema.add(featureName, featureClass, featureType);
Iterator<FV> objectIterator = iterator();
while (objectIterator.hasNext()) {
FV next = objectIterator.next();
if (next.getFeature(featureName) == null)
next.addFeature(featureName, null, featureType);
}
return featureSchema;
}
/**
* Remove functionality. For test purposes. Maybe this functionality will be
* removed sometime.
*
* @param featureVector
* @return
*/
public boolean remove(FV featureVector) {
if (featureVector == null)
return false;
long id = featureVector.getID();
if (!featureVectorMap.containsKey(id))
return false;
for (String featureName : featureValues.keySet()) {
if (featureValues.get(featureName) != null)
featureValues.get(featureName).remove(id);
}
featureVectorMap.remove(id);
values.remove(featureVector);
return true;
}
/**
* Removes a feature from the container and the set of objects.
*
* @param featureName the feature name.
* @return the data schema instance for call-chaining.
*/
public FeatureSchema remove(String featureName) {
Iterator<FV> iterator = iterator();
while (iterator.hasNext()) {
FV o = iterator.next();
o.removeFeature(featureName);
}
return featureSchema.remove(featureName);
}
@Override
public Iterator<FV> iterator() {
return featureVectorMap.values().iterator();
}
/**
* thread-safe as no iterator of the featureVectorMap is needed.
*
* @return
*/
public Collection<FV> values() {
return new CopyOnWriteArrayList<FV>(values);
}
public Boolean isNumeric(String featureName) {
if (Number.class.isAssignableFrom(featureSchema.getType(featureName)))
return true;
return false;
}
public Boolean isBoolean(String feature) {
if (Boolean.class.isAssignableFrom(featureSchema.getType(feature)))
return true;
return false;
}
public Collection<String> getFeatureNames() {
return featureSchema.getFeatureNames();
}
public Map<Long, Object> getFeatureValues(String featureName) {
if (featureValues.get(featureName) == null) {
calculateEntities(featureName);
}
return featureValues.get(featureName);
}
public boolean contains(FV featureVector) {
if (featureVectorMap.containsKey(featureVector.getID()))
return true;
return false;
}
private void calculateEntities(String featureName) {
Map<Long, Object> ent = new HashMap<Long, Object>();
Iterator<FV> iterator = iterator();
while (iterator.hasNext()) {
FV o = iterator.next();
if (o instanceof IKeyValueProvider)
ent.put(o.getID(), o.getFeature(featureName));
}
this.featureValues.put(featureName, ent);
}
@Override
public String toString() {
if (featureSchema == null)
return super.toString();
return featureSchema.toString();
}
public int size() {
if (featureVectorMap == null)
return 0;
return featureVectorMap.size();
}
}
| UTF-8 | Java | 6,455 | java | FeatureVectorContainer.java | Java | [
{
"context": ": Copyright (c) 2016-2020\r\n * </p>\r\n *\r\n * @author Juergen Bernard\r\n * @version 1.05\r\n */\r\npublic class FeatureVecto",
"end": 648,
"score": 0.999819815158844,
"start": 633,
"tag": "NAME",
"value": "Juergen Bernard"
}
] | null | [] | package com.github.TKnudsen.ComplexDataObject.data.features;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import com.github.TKnudsen.ComplexDataObject.data.interfaces.IFeatureVectorObject;
import com.github.TKnudsen.ComplexDataObject.data.interfaces.IKeyValueProvider;
/**
* <p>
* Stores and manages collections of Feature Vectors. A FeatureSchema manages
* the features of the collection.
* </p>
*
* <p>
* Copyright: Copyright (c) 2016-2020
* </p>
*
* @author <NAME>
* @version 1.05
*/
public class FeatureVectorContainer<FV extends IFeatureVectorObject<?, ?>> implements Iterable<FV> {
private Map<Long, FV> featureVectorMap = new HashMap<Long, FV>();
/**
* created to allow values() operation without iterator to be more thread-safe.
*
* Important: always needs to be kept in sync with the featureVectorMap.
*/
private ArrayList<FV> values = new ArrayList<FV>();
protected Map<String, Map<Long, Object>> featureValues = new HashMap<String, Map<Long, Object>>();
protected FeatureSchema featureSchema;
public FeatureVectorContainer(FeatureSchema featureSchema) {
this.featureSchema = featureSchema;
}
public FeatureVectorContainer(Map<Long, FV> featureVectorMap) {
this.featureVectorMap = featureVectorMap;
featureSchema = new FeatureSchema();
for (Long ID : featureVectorMap.keySet())
extendDataSchema(featureVectorMap.get(ID));
}
public FeatureVectorContainer(Iterable<FV> objects) {
featureSchema = new FeatureSchema();
for (FV object : objects) {
featureVectorMap.put(object.getID(), object);
values.add(object);
extendDataSchema(object);
}
}
private void extendDataSchema(FV object) {
for (String feature : object.getFeatureKeySet())
if (!featureSchema.contains(feature))
if (feature == null || object.getFeature(feature) == null
|| object.getFeature(feature).getFeatureValue() == null)
throw new IllegalArgumentException("FeatureContainer: feature in object was associated with null");
else
featureSchema.add(feature, object.getFeature(feature).getFeatureValue().getClass(),
object.getFeature(feature).getFeatureType());
// TODO maybe add type information to Feature class itself (currently an
// enum)
}
/**
* Introduces or updates a new feature.
*
* @param feature
* @return the data schema instance for call-chaining.
*/
public FeatureSchema addFeature(Feature<?> feature) {
featureValues = new HashMap<String, Map<Long, Object>>();
featureSchema.add(feature.getFeatureName(), feature.getFeatureValue().getClass(), feature.getFeatureType());
Iterator<FV> objectIterator = iterator();
while (objectIterator.hasNext()) {
FV next = objectIterator.next();
if (next.getFeature(feature.getFeatureName()) == null)
next.addFeature(feature.getFeatureName(), null, feature.getFeatureType());
}
return featureSchema;
}
/**
* Introduces or updates a feature.
*
* @param featureName the feature name
* @return the data schema instance for call-chaining.
*/
public FeatureSchema addFeature(String featureName, Class<Feature<?>> featureClass, FeatureType featureType) {
featureValues = new HashMap<String, Map<Long, Object>>();
featureSchema.add(featureName, featureClass, featureType);
Iterator<FV> objectIterator = iterator();
while (objectIterator.hasNext()) {
FV next = objectIterator.next();
if (next.getFeature(featureName) == null)
next.addFeature(featureName, null, featureType);
}
return featureSchema;
}
/**
* Remove functionality. For test purposes. Maybe this functionality will be
* removed sometime.
*
* @param featureVector
* @return
*/
public boolean remove(FV featureVector) {
if (featureVector == null)
return false;
long id = featureVector.getID();
if (!featureVectorMap.containsKey(id))
return false;
for (String featureName : featureValues.keySet()) {
if (featureValues.get(featureName) != null)
featureValues.get(featureName).remove(id);
}
featureVectorMap.remove(id);
values.remove(featureVector);
return true;
}
/**
* Removes a feature from the container and the set of objects.
*
* @param featureName the feature name.
* @return the data schema instance for call-chaining.
*/
public FeatureSchema remove(String featureName) {
Iterator<FV> iterator = iterator();
while (iterator.hasNext()) {
FV o = iterator.next();
o.removeFeature(featureName);
}
return featureSchema.remove(featureName);
}
@Override
public Iterator<FV> iterator() {
return featureVectorMap.values().iterator();
}
/**
* thread-safe as no iterator of the featureVectorMap is needed.
*
* @return
*/
public Collection<FV> values() {
return new CopyOnWriteArrayList<FV>(values);
}
public Boolean isNumeric(String featureName) {
if (Number.class.isAssignableFrom(featureSchema.getType(featureName)))
return true;
return false;
}
public Boolean isBoolean(String feature) {
if (Boolean.class.isAssignableFrom(featureSchema.getType(feature)))
return true;
return false;
}
public Collection<String> getFeatureNames() {
return featureSchema.getFeatureNames();
}
public Map<Long, Object> getFeatureValues(String featureName) {
if (featureValues.get(featureName) == null) {
calculateEntities(featureName);
}
return featureValues.get(featureName);
}
public boolean contains(FV featureVector) {
if (featureVectorMap.containsKey(featureVector.getID()))
return true;
return false;
}
private void calculateEntities(String featureName) {
Map<Long, Object> ent = new HashMap<Long, Object>();
Iterator<FV> iterator = iterator();
while (iterator.hasNext()) {
FV o = iterator.next();
if (o instanceof IKeyValueProvider)
ent.put(o.getID(), o.getFeature(featureName));
}
this.featureValues.put(featureName, ent);
}
@Override
public String toString() {
if (featureSchema == null)
return super.toString();
return featureSchema.toString();
}
public int size() {
if (featureVectorMap == null)
return 0;
return featureVectorMap.size();
}
}
| 6,446 | 0.698373 | 0.696514 | 227 | 26.436123 | 26.1968 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.762115 | false | false | 15 |
3dfdb78936fa39c99911b080cd393921addb0a37 | 4,372,276,731,906 | 466f6057ee8cc487b8964b068efb050e8b17a054 | /src/com/github/blackjar72/kfengine1/ui/render/RenderList.java | d3cfdc97a71f307f685a858ca342377591dd131d | [
"BSD-3-Clause"
] | permissive | BlackJar72/KFEngine1 | https://github.com/BlackJar72/KFEngine1 | 7cd917202c12792044af498d5103ee9a5ef81909 | bcfdf3712642766be4ce4a4e529426d6acd8c11e | refs/heads/master | 2016-09-12T11:27:27.218000 | 2016-05-15T18:43:14 | 2016-05-15T18:43:14 | 58,570,495 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | // Copyright (C) Jared Blackburn 2016
package com.github.blackjar72.kfengine1.ui.render;
import com.github.blackjar72.kfengine1.util.math.Mat4f;
import java.util.ArrayList;
//FIXME: I suddenly remember an older meaning of "renderlist" -- name change?
/**
* The core class for implementing rendering list as a hierarchy or drawables,
* with Drawable models as the leaves and drawable lists as the branches of an
* arbitrary size and complexity tree. Put in terms of tradition scenegraph
* this is essentially a "<em>spatial</em>," and is also a component of
* a scenegraph "geometry" as represented by the Geometry class.
*
* The class also tracks render ticks so to prevents drawables from being drawn
* more than once in the same frame.
*
* @author Jared Blackburn
*/
public class RenderList extends ArrayList<IDrawable> implements IDrawList {
Mat4f normRotation;
Mat4f transform;
IDrawable parent;
private static int centralRenderTick = 0;
/**
* Conceptually, the centralRenderList should be used to contain other
* renderlists (for example, list corresponding to sectors / chunks / level,
* to regions of a quadtree or octtree, or to whatever orgamization you use.
* adding / removing lists (which may contain there own sublists) would then
* control which drawables are eligible for drawing (though they may still
* be removed later based of frustum culling).
*
* Though this member will continue to be used as the root node (which it is
* by another name) circumventing encapsulation by its direct use is not
* advised and is considered deprecated. It is at least possible this will
* handled differently and not publicly available in the future.
*/
@Deprecated
public static final RenderList worldRender = new RenderList();
public RenderList() {
this.normRotation = Mat4f.giveIdentity();
this.transform = Mat4f.giveIdentity();
this.parent = null;
}
public RenderList(Mat4f normRotation, Mat4f transform) {
this.normRotation = normRotation;
this.transform = transform;
this.parent = null;
}
public RenderList(Mat4f normRotation, Mat4f transform, IDrawable parent) {
this.parent = parent;
this.normRotation = normRotation;
this.transform = transform;
}
/**
* This should not be used on the centralRenderList, which should be drawn
* using the update method instead. Generally, other such lists would be
* add to centralRenderList which will take care of the rest; such sub-lists
* need not be of this class, so but should implementRenderList and probably
* be structures similarly. This assumes another game specific system has
* not been implemented in lieu of the centralRenderList.
*
* Conceptually, the centralRenderList should be used to contain other
* renderlists (for example, list corresponding to sectors / chunks / level,
* to regions of a quadtree or octtree, or to whatever orgamization you use.
* adding / removing lists (which may contain there own sublists) would then
* control which drawables are eligible for drawing (though they may still
* be removed later based of frustum culling).
*
* @param renderTick
*/
@Override
public void draw(int renderTick) {
for(IDrawable drawable : this) {
drawable.draw(renderTick);
}
}
/**
* This method is intended to be used with the centralRenderList, for other
* lists draw should be used instead.
*/
public void update() {
if(this == worldRender) {
centralRenderTick = (++centralRenderTick) % 256;
}
draw(centralRenderTick);
}
/**
* This will return the rootNode for rendering (aka, <code>worldRender</code>
* in code). This the preferred way to get this object. The world render
* is currectly <code>public static final</code> there it is not guaranteed
* to remain so.
*
* @return the root node of the master scene graph (aka, <code>worldRender)</code>
*/
@SuppressWarnings("deprecation")
public static RenderList getRootNode() {
return worldRender;
}
@Override
public Mat4f getTransform() {
return transform;
}
public void setTransform(Mat4f transform) {
this.transform = transform;
}
public IDrawable getParent() {
return parent;
}
public void setParent(IDrawable parent) {
this.parent = parent;
}
@Override
public Mat4f getNoramlRotation() {
return normRotation;
}
@Override
public Mat4f getActualTransform() {
if(parent == null || !(parent instanceof IDrawable)) {
return transform;
} else {
return transform.mul(parent.getActualTransform());
}
}
@Override
public Mat4f getActualRotation() {
if(parent == null || !(parent instanceof IDrawable)) {
return normRotation;
} else {
return normRotation.mul(parent.getActualRotation());
}
}
@Override
public void attach(IDrawable child) {
if(!contains(child)) {
add(child);
child.setParent(this);
}
}
@Override
public void detach(IDrawable child) {
remove(child);
child.setParent(null);
}
}
| UTF-8 | Java | 5,554 | java | RenderList.java | Java | [
{
"context": "// Copyright (C) Jared Blackburn 2016\npackage com.github.blackjar72.kfengine1.ui.r",
"end": 32,
"score": 0.9997760057449341,
"start": 17,
"tag": "NAME",
"value": "Jared Blackburn"
},
{
"context": "right (C) Jared Blackburn 2016\npackage com.github.blackjar72.kfengine1.ui.render;\n\nimport com.github.blackjar7",
"end": 67,
"score": 0.996503472328186,
"start": 57,
"tag": "USERNAME",
"value": "blackjar72"
},
{
"context": "lackjar72.kfengine1.ui.render;\n\nimport com.github.blackjar72.kfengine1.util.math.Mat4f;\nimport java.util.Array",
"end": 118,
"score": 0.9956830143928528,
"start": 108,
"tag": "USERNAME",
"value": "blackjar72"
},
{
"context": "* more than once in the same frame.\n * \n * @author Jared Blackburn\n */\npublic class RenderList extends ArrayList<IDr",
"end": 782,
"score": 0.9976772665977478,
"start": 767,
"tag": "NAME",
"value": "Jared Blackburn"
}
] | null | [] | // Copyright (C) <NAME> 2016
package com.github.blackjar72.kfengine1.ui.render;
import com.github.blackjar72.kfengine1.util.math.Mat4f;
import java.util.ArrayList;
//FIXME: I suddenly remember an older meaning of "renderlist" -- name change?
/**
* The core class for implementing rendering list as a hierarchy or drawables,
* with Drawable models as the leaves and drawable lists as the branches of an
* arbitrary size and complexity tree. Put in terms of tradition scenegraph
* this is essentially a "<em>spatial</em>," and is also a component of
* a scenegraph "geometry" as represented by the Geometry class.
*
* The class also tracks render ticks so to prevents drawables from being drawn
* more than once in the same frame.
*
* @author <NAME>
*/
public class RenderList extends ArrayList<IDrawable> implements IDrawList {
Mat4f normRotation;
Mat4f transform;
IDrawable parent;
private static int centralRenderTick = 0;
/**
* Conceptually, the centralRenderList should be used to contain other
* renderlists (for example, list corresponding to sectors / chunks / level,
* to regions of a quadtree or octtree, or to whatever orgamization you use.
* adding / removing lists (which may contain there own sublists) would then
* control which drawables are eligible for drawing (though they may still
* be removed later based of frustum culling).
*
* Though this member will continue to be used as the root node (which it is
* by another name) circumventing encapsulation by its direct use is not
* advised and is considered deprecated. It is at least possible this will
* handled differently and not publicly available in the future.
*/
@Deprecated
public static final RenderList worldRender = new RenderList();
public RenderList() {
this.normRotation = Mat4f.giveIdentity();
this.transform = Mat4f.giveIdentity();
this.parent = null;
}
public RenderList(Mat4f normRotation, Mat4f transform) {
this.normRotation = normRotation;
this.transform = transform;
this.parent = null;
}
public RenderList(Mat4f normRotation, Mat4f transform, IDrawable parent) {
this.parent = parent;
this.normRotation = normRotation;
this.transform = transform;
}
/**
* This should not be used on the centralRenderList, which should be drawn
* using the update method instead. Generally, other such lists would be
* add to centralRenderList which will take care of the rest; such sub-lists
* need not be of this class, so but should implementRenderList and probably
* be structures similarly. This assumes another game specific system has
* not been implemented in lieu of the centralRenderList.
*
* Conceptually, the centralRenderList should be used to contain other
* renderlists (for example, list corresponding to sectors / chunks / level,
* to regions of a quadtree or octtree, or to whatever orgamization you use.
* adding / removing lists (which may contain there own sublists) would then
* control which drawables are eligible for drawing (though they may still
* be removed later based of frustum culling).
*
* @param renderTick
*/
@Override
public void draw(int renderTick) {
for(IDrawable drawable : this) {
drawable.draw(renderTick);
}
}
/**
* This method is intended to be used with the centralRenderList, for other
* lists draw should be used instead.
*/
public void update() {
if(this == worldRender) {
centralRenderTick = (++centralRenderTick) % 256;
}
draw(centralRenderTick);
}
/**
* This will return the rootNode for rendering (aka, <code>worldRender</code>
* in code). This the preferred way to get this object. The world render
* is currectly <code>public static final</code> there it is not guaranteed
* to remain so.
*
* @return the root node of the master scene graph (aka, <code>worldRender)</code>
*/
@SuppressWarnings("deprecation")
public static RenderList getRootNode() {
return worldRender;
}
@Override
public Mat4f getTransform() {
return transform;
}
public void setTransform(Mat4f transform) {
this.transform = transform;
}
public IDrawable getParent() {
return parent;
}
public void setParent(IDrawable parent) {
this.parent = parent;
}
@Override
public Mat4f getNoramlRotation() {
return normRotation;
}
@Override
public Mat4f getActualTransform() {
if(parent == null || !(parent instanceof IDrawable)) {
return transform;
} else {
return transform.mul(parent.getActualTransform());
}
}
@Override
public Mat4f getActualRotation() {
if(parent == null || !(parent instanceof IDrawable)) {
return normRotation;
} else {
return normRotation.mul(parent.getActualRotation());
}
}
@Override
public void attach(IDrawable child) {
if(!contains(child)) {
add(child);
child.setParent(this);
}
}
@Override
public void detach(IDrawable child) {
remove(child);
child.setParent(null);
}
}
| 5,536 | 0.651422 | 0.646381 | 174 | 30.91954 | 28.089642 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 15 |
939c54e3412f52aab58410a88678935d04e84511 | 19,559,281,098,436 | b67ff658a6eeccae6eb9c25dcda76d0f30f32ab7 | /src/main/java/com/KafkaConsumer.java | 40116e4a2b925c5f0d83346e03ad63c4e9edf113 | [] | no_license | qq646276005/spring-boot-eventhub-kafka | https://github.com/qq646276005/spring-boot-eventhub-kafka | a4b4b5ee243c1e85e9872f63e45fa4d65395614a | 22b318f1fd8c023ed922c814cce0ddf73e6c9a33 | refs/heads/master | 2023-03-18T04:58:39.657000 | 2020-08-17T10:49:24 | 2020-08-17T10:49:24 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;
@Service
public class KafkaConsumer {
private static final org.slf4j.Logger log =
org.slf4j.LoggerFactory.getLogger(KafkaConsumer.class);
@KafkaListener(topics = "${topic.name}")
public void receive(SimpleMessage consumerMessage) {
log.info("Received message from kafka queue: {}", consumerMessage.getBody());
}
}
| UTF-8 | Java | 462 | java | KafkaConsumer.java | Java | [] | null | [] | package com;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;
@Service
public class KafkaConsumer {
private static final org.slf4j.Logger log =
org.slf4j.LoggerFactory.getLogger(KafkaConsumer.class);
@KafkaListener(topics = "${topic.name}")
public void receive(SimpleMessage consumerMessage) {
log.info("Received message from kafka queue: {}", consumerMessage.getBody());
}
}
| 462 | 0.753247 | 0.748918 | 16 | 27.875 | 27.101372 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.625 | false | false | 15 |
2855d3bea4a624f7e5dab4b13c71a7e9820b8308 | 27,341,761,844,385 | 2ea1da02e06ff53d8d308bbfc697ed70bd2f1247 | /src/main/java/edu/kozhinov/enjoyit/protocol/exception/ValidationException.java | e0f58de00b8325c5eb19749cc7b5daf0d404c3f6 | [] | no_license | Aiden-Izumi/Enjoyit | https://github.com/Aiden-Izumi/Enjoyit | 1e001fa44b6f5bbf0f24b910dc7f4f49e38ab500 | f6be413e54489b64a64139fecff9164c0f456ff4 | refs/heads/master | 2023-05-07T01:59:20.001000 | 2021-05-24T05:22:59 | 2021-05-24T05:22:59 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package edu.kozhinov.enjoyit.protocol.exception;
public class ValidationException extends EnjoyitProtocolException {
public ValidationException(String message) {
super(message);
}
public ValidationException(String message, Throwable cause) {
super(message, cause);
}
}
| UTF-8 | Java | 303 | java | ValidationException.java | Java | [] | null | [] | package edu.kozhinov.enjoyit.protocol.exception;
public class ValidationException extends EnjoyitProtocolException {
public ValidationException(String message) {
super(message);
}
public ValidationException(String message, Throwable cause) {
super(message, cause);
}
}
| 303 | 0.732673 | 0.732673 | 11 | 26.545454 | 25.317488 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.454545 | false | false | 15 |
2b7963aa0e8bb738fda97990d279eaa6c4203e2f | 27,839,978,051,165 | 9d013ddbe0e986bada99f0597750da01591eea09 | /src.core/ebank/core/bank/third/Online.java | bb5ac04f3c0e906803aa9c64897b8d403cdf1b97 | [] | no_license | moutainhigh/casher | https://github.com/moutainhigh/casher | 01862494d885ee6b31bc13e2d1139a0cc1af315c | 2a85ba75956f1df5c8b74397e09d5b79cf683752 | refs/heads/master | 2020-12-28T13:24:15.964000 | 2015-09-21T09:32:09 | 2015-09-21T09:32:09 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ebank.core.bank.third;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONObject;
import org.apache.log4j.Logger;
import reapal.RongpayFunction;
import alipay.AlipayNotify;
import ebank.core.bank.BankService;
import ebank.core.bank.logic.BankExt;
import ebank.core.common.EventCode;
import ebank.core.common.ServiceException;
import ebank.core.common.util.CryptUtil;
import ebank.core.common.util.MD5sign;
import beartool.Md5Encrypt;
import ebank.core.domain.BankOrder;
import ebank.core.domain.PayResult;
public class Online extends BankExt implements BankService {
static Logger logger = Logger.getLogger(Online.class);
private String pubkey;
private String moneytype;
private String input_charset;
public String sendOrderToBank(BankOrder order) throws ServiceException {
HashMap mp=order.getMp();
JSONObject jo=null;
if(mp!=null&&mp.get("outJson")!=null){
String outjson=CryptUtil.decrypt(String.valueOf(mp.get("outJson")));
logger.info(outjson);
jo=JSONObject.fromObject(outjson);
}
String v_md5info;
String v_mid = this.corpid;
String v_url = this.getRecurl();
String v_oid = order.getRandOrderID();
String v_amount=order.getAmount();
String v_moneytype=this.moneytype;
String key=this.pubkey;
String pay_type=mp.get("pay_type").toString().equals("8")?"2":mp.get("pay_type").toString();//1:d 2:c 3:all
String text = v_amount+v_moneytype+v_oid+v_mid+v_url+key; // 拼凑加密串
v_md5info = Md5Encrypt.md5(text,input_charset).toUpperCase();
logger.debug(v_md5info);
String gateID = "";
if (order.getMp() != null && order.getMp().get("outChannel") != null) {
gateID = String.valueOf(order.getMp().get("outChannel"));
}
String defaultbank = getBankCode(getJsonParams(jo,"defaultbank",gateID),pay_type);
//拼接form
StringBuffer sf=new StringBuffer("");
sf.append("<form name=\"sendOrder\" action=\"" +this.desturl+ "\" method=\"post\">");
sf.append("<input type=\"hidden\" name=\"v_md5info\" value=\""+v_md5info+"\" >");
sf.append("<input type=\"hidden\" name=\"v_mid\" value=\""+v_mid+"\" >");
sf.append("<input type=\"hidden\" name=\"v_oid\" value=\""+v_oid+"\" >");
sf.append("<input type=\"hidden\" name=\"v_amount\" value=\""+v_amount+"\" >");
sf.append("<input type=\"hidden\" name=\"v_moneytype\" value=\""+v_moneytype+"\" >");
sf.append("<input type=\"hidden\" name=\"v_url\" value=\""+v_url+"\" >");
sf.append("<input type=\"hidden\" name=\"remark2\" value=\"[url:="+v_url+"]\" >");
sf.append("<input type=\"hidden\" name=\"pmode_id\" value=\""+defaultbank+"\" >");
sf.append("</form>");
if(logger.isDebugEnabled()) logger.debug(sf.toString());
return sf.toString();
}
public PayResult getPayResult(HashMap request) throws ServiceException {
PayResult bean=null;
String NR = String.valueOf(request.get("NR"));
request.remove("RemoteIP");
request.remove("queryString");
request.remove("idx");
request.remove("NR");
String v_oid = (String)request.get("v_oid"); // 订单号
String v_pmode = (String)request.get("v_pmode"); // 支付方式中文说明,如"中行长城信用卡"
String v_pstatus = (String)request.get("v_pstatus"); // 支付结果,20支付完成;30支付失败;
String v_pstring = (String)request.get("v_pstring"); // 对支付结果的说明,成功时(v_pstatus=20)为"支付成功",支付失败时(v_pstatus=30)为"支付失败"
String v_amount = (String)request.get("v_amount"); // 订单实际支付金额
String v_moneytype = (String)request.get("v_moneytype"); // 币种
String v_md5str = (String)request.get("v_md5str"); // MD5校验码
String text = v_oid+v_pstatus+v_amount+v_moneytype+this.pubkey;
String v_md5text = Md5Encrypt.md5(text,input_charset).toUpperCase();
logger.debug("v_md5text:"+v_md5text);
logger.debug("v_md5str:"+v_md5str);
if(v_md5text.equals(v_md5str)){
if("20".equals(v_pstatus)){
bean=new PayResult(v_oid,this.bankcode,new BigDecimal(v_amount),1);
if(String.valueOf("SID_"+this.idx).equalsIgnoreCase(NR)){
request.put("RES","ok");
}
}else{
bean=new PayResult(v_oid,this.bankcode,new BigDecimal(v_amount),-1);
}
}else{
if(("SID_"+this.idx).equals(NR)){
request.put("RES","error");
}else{
throw new ServiceException(EventCode.SIGN_VERIFY);
}
}
return bean;
}
public String getMoneytype() {
return moneytype;
}
public void setMoneytype(String moneytype) {
this.moneytype = moneytype;
}
public String getInput_charsert() {
return input_charset;
}
public void setInput_charsert(String input_charsert) {
this.input_charset = input_charsert;
}
public String getPubkey() {
return pubkey;
}
public void setPubkey(String pubkey) {
this.pubkey = pubkey;
}
private String getJsonParams(JSONObject jo,String key,String defaults){
try{
if(jo!=null) return jo.getString(key)==null?defaults:jo.getString(key);
}catch(Exception e){
}
return defaults;
}
private String getBankCode(String code,String payType)
{
String bankcode="";
if(code.equals("ICBC"))
{
if("1".equals(payType)){//借记
bankcode="1025";
}else{
bankcode="1027";
}
}else if(code.equals("CCB")){
if("1".equals(payType)){//借记
bankcode="1051";
}else{
bankcode="1054";
}
}else if(code.equals("ABC")){
// bankcode="103";
if("1".equals(payType)){//借记
bankcode="103";
}else{//无可用通道
bankcode="1031";
}
}else if(code.equals("CMB")){
if("1".equals(payType)){//借记
bankcode="3080";
}else{
bankcode="308";
}
}else if(code.equals("BOC")){
if("1".equals(payType)){//借记
bankcode="104";
}else{
bankcode="106";
}
}else if(code.equals("BOCM")){
if("1".equals(payType)){//借记
bankcode="301";
}else{
bankcode="301";
}
}else if(code.equals("HXB")){
if("1".equals(payType)){//借记
bankcode="311";
}else{
bankcode="3112";
}
// bankcode="3283";
}else if(code.equals("CIB")){
if("1".equals(payType)){//借记
bankcode="309";
}else{
bankcode="3091";
}
}else if(code.equals("CMBC")){
if("1".equals(payType)){//借记
bankcode="305";
}else{
bankcode="3051";
}
}else if(code.equals("GDB")){
if("1".equals(payType)){//借记
bankcode="3061";
}else{//无可用通道
bankcode="306";
}
}
else if(code.equals("SDB")){
if("1".equals(payType)){//借记
bankcode="307";
}else{
bankcode="3071";
}
}
else if(code.equals("SPDB")){
if("1".equals(payType)){//借记
bankcode="314";
}else{//无可用通道
bankcode="3141";
}
}else if(code.equals("CITIC")){
if("1".equals(payType)){//借记
bankcode="313";
}else{//无可用通道
bankcode="3131";
}
}else if(code.equals("CEB")){
if("1".equals(payType)){//借记
bankcode="312";
}else{//无可用通道
bankcode="3121";
}
}else {
bankcode="327";
}
return bankcode;
}
}
| GB18030 | Java | 7,266 | java | Online.java | Java | [] | null | [] | package ebank.core.bank.third;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONObject;
import org.apache.log4j.Logger;
import reapal.RongpayFunction;
import alipay.AlipayNotify;
import ebank.core.bank.BankService;
import ebank.core.bank.logic.BankExt;
import ebank.core.common.EventCode;
import ebank.core.common.ServiceException;
import ebank.core.common.util.CryptUtil;
import ebank.core.common.util.MD5sign;
import beartool.Md5Encrypt;
import ebank.core.domain.BankOrder;
import ebank.core.domain.PayResult;
public class Online extends BankExt implements BankService {
static Logger logger = Logger.getLogger(Online.class);
private String pubkey;
private String moneytype;
private String input_charset;
public String sendOrderToBank(BankOrder order) throws ServiceException {
HashMap mp=order.getMp();
JSONObject jo=null;
if(mp!=null&&mp.get("outJson")!=null){
String outjson=CryptUtil.decrypt(String.valueOf(mp.get("outJson")));
logger.info(outjson);
jo=JSONObject.fromObject(outjson);
}
String v_md5info;
String v_mid = this.corpid;
String v_url = this.getRecurl();
String v_oid = order.getRandOrderID();
String v_amount=order.getAmount();
String v_moneytype=this.moneytype;
String key=this.pubkey;
String pay_type=mp.get("pay_type").toString().equals("8")?"2":mp.get("pay_type").toString();//1:d 2:c 3:all
String text = v_amount+v_moneytype+v_oid+v_mid+v_url+key; // 拼凑加密串
v_md5info = Md5Encrypt.md5(text,input_charset).toUpperCase();
logger.debug(v_md5info);
String gateID = "";
if (order.getMp() != null && order.getMp().get("outChannel") != null) {
gateID = String.valueOf(order.getMp().get("outChannel"));
}
String defaultbank = getBankCode(getJsonParams(jo,"defaultbank",gateID),pay_type);
//拼接form
StringBuffer sf=new StringBuffer("");
sf.append("<form name=\"sendOrder\" action=\"" +this.desturl+ "\" method=\"post\">");
sf.append("<input type=\"hidden\" name=\"v_md5info\" value=\""+v_md5info+"\" >");
sf.append("<input type=\"hidden\" name=\"v_mid\" value=\""+v_mid+"\" >");
sf.append("<input type=\"hidden\" name=\"v_oid\" value=\""+v_oid+"\" >");
sf.append("<input type=\"hidden\" name=\"v_amount\" value=\""+v_amount+"\" >");
sf.append("<input type=\"hidden\" name=\"v_moneytype\" value=\""+v_moneytype+"\" >");
sf.append("<input type=\"hidden\" name=\"v_url\" value=\""+v_url+"\" >");
sf.append("<input type=\"hidden\" name=\"remark2\" value=\"[url:="+v_url+"]\" >");
sf.append("<input type=\"hidden\" name=\"pmode_id\" value=\""+defaultbank+"\" >");
sf.append("</form>");
if(logger.isDebugEnabled()) logger.debug(sf.toString());
return sf.toString();
}
public PayResult getPayResult(HashMap request) throws ServiceException {
PayResult bean=null;
String NR = String.valueOf(request.get("NR"));
request.remove("RemoteIP");
request.remove("queryString");
request.remove("idx");
request.remove("NR");
String v_oid = (String)request.get("v_oid"); // 订单号
String v_pmode = (String)request.get("v_pmode"); // 支付方式中文说明,如"中行长城信用卡"
String v_pstatus = (String)request.get("v_pstatus"); // 支付结果,20支付完成;30支付失败;
String v_pstring = (String)request.get("v_pstring"); // 对支付结果的说明,成功时(v_pstatus=20)为"支付成功",支付失败时(v_pstatus=30)为"支付失败"
String v_amount = (String)request.get("v_amount"); // 订单实际支付金额
String v_moneytype = (String)request.get("v_moneytype"); // 币种
String v_md5str = (String)request.get("v_md5str"); // MD5校验码
String text = v_oid+v_pstatus+v_amount+v_moneytype+this.pubkey;
String v_md5text = Md5Encrypt.md5(text,input_charset).toUpperCase();
logger.debug("v_md5text:"+v_md5text);
logger.debug("v_md5str:"+v_md5str);
if(v_md5text.equals(v_md5str)){
if("20".equals(v_pstatus)){
bean=new PayResult(v_oid,this.bankcode,new BigDecimal(v_amount),1);
if(String.valueOf("SID_"+this.idx).equalsIgnoreCase(NR)){
request.put("RES","ok");
}
}else{
bean=new PayResult(v_oid,this.bankcode,new BigDecimal(v_amount),-1);
}
}else{
if(("SID_"+this.idx).equals(NR)){
request.put("RES","error");
}else{
throw new ServiceException(EventCode.SIGN_VERIFY);
}
}
return bean;
}
public String getMoneytype() {
return moneytype;
}
public void setMoneytype(String moneytype) {
this.moneytype = moneytype;
}
public String getInput_charsert() {
return input_charset;
}
public void setInput_charsert(String input_charsert) {
this.input_charset = input_charsert;
}
public String getPubkey() {
return pubkey;
}
public void setPubkey(String pubkey) {
this.pubkey = pubkey;
}
private String getJsonParams(JSONObject jo,String key,String defaults){
try{
if(jo!=null) return jo.getString(key)==null?defaults:jo.getString(key);
}catch(Exception e){
}
return defaults;
}
private String getBankCode(String code,String payType)
{
String bankcode="";
if(code.equals("ICBC"))
{
if("1".equals(payType)){//借记
bankcode="1025";
}else{
bankcode="1027";
}
}else if(code.equals("CCB")){
if("1".equals(payType)){//借记
bankcode="1051";
}else{
bankcode="1054";
}
}else if(code.equals("ABC")){
// bankcode="103";
if("1".equals(payType)){//借记
bankcode="103";
}else{//无可用通道
bankcode="1031";
}
}else if(code.equals("CMB")){
if("1".equals(payType)){//借记
bankcode="3080";
}else{
bankcode="308";
}
}else if(code.equals("BOC")){
if("1".equals(payType)){//借记
bankcode="104";
}else{
bankcode="106";
}
}else if(code.equals("BOCM")){
if("1".equals(payType)){//借记
bankcode="301";
}else{
bankcode="301";
}
}else if(code.equals("HXB")){
if("1".equals(payType)){//借记
bankcode="311";
}else{
bankcode="3112";
}
// bankcode="3283";
}else if(code.equals("CIB")){
if("1".equals(payType)){//借记
bankcode="309";
}else{
bankcode="3091";
}
}else if(code.equals("CMBC")){
if("1".equals(payType)){//借记
bankcode="305";
}else{
bankcode="3051";
}
}else if(code.equals("GDB")){
if("1".equals(payType)){//借记
bankcode="3061";
}else{//无可用通道
bankcode="306";
}
}
else if(code.equals("SDB")){
if("1".equals(payType)){//借记
bankcode="307";
}else{
bankcode="3071";
}
}
else if(code.equals("SPDB")){
if("1".equals(payType)){//借记
bankcode="314";
}else{//无可用通道
bankcode="3141";
}
}else if(code.equals("CITIC")){
if("1".equals(payType)){//借记
bankcode="313";
}else{//无可用通道
bankcode="3131";
}
}else if(code.equals("CEB")){
if("1".equals(payType)){//借记
bankcode="312";
}else{//无可用通道
bankcode="3121";
}
}else {
bankcode="327";
}
return bankcode;
}
}
| 7,266 | 0.630404 | 0.607214 | 271 | 24.778597 | 23.712976 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.878229 | false | false | 15 |
0a50f9b333eec20ab3759e6546c8addc435591e0 | 26,156,350,886,714 | 754c1444ec76666ec577d7ae50000cdb9376ad3a | /ProjetoUrna/src/Eleitor.java | 1c6fe817b9de4d5eee58befdef839f6bc206f042 | [] | no_license | paulogusstavo/UrnaEletronica | https://github.com/paulogusstavo/UrnaEletronica | aea5bfe06dee8846268e86bfd6fa92e86bb5e78f | 650eb23d0d3747b581394bd20367fd457eec428e | refs/heads/master | 2021-03-27T10:49:06.290000 | 2016-09-22T05:09:49 | 2016-09-22T05:09:49 | 67,306,045 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class Eleitor {
private String nome;
private int titulo;
private int zona;
private int secao;
private boolean votou;
//-----Construtor------------------------------------------------------------
public Eleitor (String nome,int titulo, int zona, int secao) {
this.nome = nome;
this.titulo = titulo;
this.zona = zona;
this.secao = secao;
}
//-----GET E SET--------------------------------------------------------------
public String getNome () { return nome; }
public int getTitulo () {return titulo;}
public int getZona () { return zona; }
public int getSecao () { return secao; }
public boolean getVotou() { return votou; }
public void setVotar() { votou = true; }
//----------------------------------------------------------------------------
} | UTF-8 | Java | 781 | java | Eleitor.java | Java | [] | null | [] |
public class Eleitor {
private String nome;
private int titulo;
private int zona;
private int secao;
private boolean votou;
//-----Construtor------------------------------------------------------------
public Eleitor (String nome,int titulo, int zona, int secao) {
this.nome = nome;
this.titulo = titulo;
this.zona = zona;
this.secao = secao;
}
//-----GET E SET--------------------------------------------------------------
public String getNome () { return nome; }
public int getTitulo () {return titulo;}
public int getZona () { return zona; }
public int getSecao () { return secao; }
public boolean getVotou() { return votou; }
public void setVotar() { votou = true; }
//----------------------------------------------------------------------------
} | 781 | 0.498079 | 0.498079 | 25 | 30.24 | 23.683378 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.72 | false | false | 15 |
0a791c37e7692d0f1937a1005243e164ce202f8b | 19,318,762,954,699 | 062b858324ced71adbf05477d73693db1ca43ef1 | /Lista de exercicios 3/e2/InterfaceFuncional.java | 2de01760d6cb7aad3e67393fce36a772b203e325 | [] | no_license | rafael3021734/LP3A5 | https://github.com/rafael3021734/LP3A5 | 45c45a749421e0a1c6c0e991712b7d1fb6837307 | 2c4ceb70fdf3ea525e1f324f8875e36f25b08e99 | refs/heads/master | 2023-07-02T06:32:34.395000 | 2021-08-12T03:00:22 | 2021-08-12T03:00:22 | 373,353,120 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.lp3a5.lambda1.exercicio.e2;
@FunctionalInterface
public interface InterfaceFuncional{
public void show();
}
| UTF-8 | Java | 125 | java | InterfaceFuncional.java | Java | [] | null | [] | package br.com.lp3a5.lambda1.exercicio.e2;
@FunctionalInterface
public interface InterfaceFuncional{
public void show();
}
| 125 | 0.808 | 0.776 | 6 | 19.833334 | 15.81578 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 15 |
f9e511ca0e47508109f63e92079cfbf7278896b3 | 17,463,337,036,055 | fbb70f5d814225dbf1fca78891e9b7ec047f5fe4 | /src/com/profitera/dc/filehandler/XMLRecordIterator.java | 092cc2b503f889ffeb444ee153078285ac8dc26e | [] | no_license | joshluisaac/dataconnector | https://github.com/joshluisaac/dataconnector | 8bac959e3c7cac724984be9afdf6756fd9c9356b | 8ab0372a72317ba8781a5d0e0d666fc4215ad4f6 | refs/heads/master | 2020-05-07T21:31:57.772000 | 2019-04-11T14:08:29 | 2019-04-11T14:08:29 | 180,908,052 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.profitera.dc.filehandler;
import java.io.BufferedInputStream;
import java.util.NoSuchElementException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.stream.StreamSource;
import net.sf.saxon.Configuration;
import net.sf.saxon.query.DynamicQueryContext;
import net.sf.saxon.query.StaticQueryContext;
import net.sf.saxon.query.XQueryExpression;
import org.xml.sax.helpers.DefaultHandler;
public class XMLRecordIterator implements IXMLRecordIterator {
private Object currentObject = null;
private XMLRecordIteratorThread iteratorThread = null;
private Exception exception = null;
private RuntimeException rtException = null;
public XMLRecordIterator(final BufferedInputStream inStream, String recordTag) throws Exception{
SAXParserFactory factory = SAXParserFactory.newInstance();
final SAXParser parser = factory.newSAXParser();
final DefaultHandler handler = new XMLHandoffFileHandler(recordTag, this);
synchronized (this) {
iteratorThread = new XMLRecordIteratorThread(){
protected void execute() throws Exception {
parser.parse(inStream, handler);
}};
iteratorThread.start();
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
if (exception != null)
throw exception;
if (rtException != null)
throw rtException;
}
}
public XMLRecordIterator(final BufferedInputStream inStream, String recordTag, String xquery) throws Exception{
final DefaultHandler handler = new XMLHandoffFileHandler(recordTag, this);
Configuration conf = new Configuration();
StaticQueryContext sqc = new StaticQueryContext(conf);
final XQueryExpression xqe = sqc.compileQuery(xquery);
final DynamicQueryContext dynamicContext = new DynamicQueryContext(conf);
dynamicContext.setContextItem(sqc.buildDocument(new StreamSource(inStream)));
final SAXResult result = new SAXResult(handler);
synchronized (this) {
iteratorThread = new XMLRecordIteratorThread(){
protected void execute() throws Exception {
xqe.run(dynamicContext, result, null);
}};
iteratorThread.start();
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
if (exception != null)
throw exception;
if (rtException != null)
throw rtException;
}
}
public synchronized void put(Object o) {
currentObject = o;
doNotifyAndWait();
}
public void remove() {
throw new UnsupportedOperationException("Remove not supported.");
}
public boolean hasNext() {
return (currentObject != null);
}
public Object next() {
if (!hasNext())
throw new NoSuchElementException();
Object toReturn = currentObject;
doNotifyAndWait();
return toReturn;
}
private synchronized void doNotifyAndWait() {
notify();
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
private synchronized void finalNotify() {
notify();
}
private abstract class XMLRecordIteratorThread extends Thread {
public void run(){
try {
execute();
} catch (RuntimeException e){
rtException = e;
} catch (Exception e) {
exception = e;
}
currentObject = null;
finalNotify();
}
protected abstract void execute() throws Exception;
}
} | UTF-8 | Java | 3,349 | java | XMLRecordIterator.java | Java | [] | null | [] | package com.profitera.dc.filehandler;
import java.io.BufferedInputStream;
import java.util.NoSuchElementException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.stream.StreamSource;
import net.sf.saxon.Configuration;
import net.sf.saxon.query.DynamicQueryContext;
import net.sf.saxon.query.StaticQueryContext;
import net.sf.saxon.query.XQueryExpression;
import org.xml.sax.helpers.DefaultHandler;
public class XMLRecordIterator implements IXMLRecordIterator {
private Object currentObject = null;
private XMLRecordIteratorThread iteratorThread = null;
private Exception exception = null;
private RuntimeException rtException = null;
public XMLRecordIterator(final BufferedInputStream inStream, String recordTag) throws Exception{
SAXParserFactory factory = SAXParserFactory.newInstance();
final SAXParser parser = factory.newSAXParser();
final DefaultHandler handler = new XMLHandoffFileHandler(recordTag, this);
synchronized (this) {
iteratorThread = new XMLRecordIteratorThread(){
protected void execute() throws Exception {
parser.parse(inStream, handler);
}};
iteratorThread.start();
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
if (exception != null)
throw exception;
if (rtException != null)
throw rtException;
}
}
public XMLRecordIterator(final BufferedInputStream inStream, String recordTag, String xquery) throws Exception{
final DefaultHandler handler = new XMLHandoffFileHandler(recordTag, this);
Configuration conf = new Configuration();
StaticQueryContext sqc = new StaticQueryContext(conf);
final XQueryExpression xqe = sqc.compileQuery(xquery);
final DynamicQueryContext dynamicContext = new DynamicQueryContext(conf);
dynamicContext.setContextItem(sqc.buildDocument(new StreamSource(inStream)));
final SAXResult result = new SAXResult(handler);
synchronized (this) {
iteratorThread = new XMLRecordIteratorThread(){
protected void execute() throws Exception {
xqe.run(dynamicContext, result, null);
}};
iteratorThread.start();
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
if (exception != null)
throw exception;
if (rtException != null)
throw rtException;
}
}
public synchronized void put(Object o) {
currentObject = o;
doNotifyAndWait();
}
public void remove() {
throw new UnsupportedOperationException("Remove not supported.");
}
public boolean hasNext() {
return (currentObject != null);
}
public Object next() {
if (!hasNext())
throw new NoSuchElementException();
Object toReturn = currentObject;
doNotifyAndWait();
return toReturn;
}
private synchronized void doNotifyAndWait() {
notify();
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
private synchronized void finalNotify() {
notify();
}
private abstract class XMLRecordIteratorThread extends Thread {
public void run(){
try {
execute();
} catch (RuntimeException e){
rtException = e;
} catch (Exception e) {
exception = e;
}
currentObject = null;
finalNotify();
}
protected abstract void execute() throws Exception;
}
} | 3,349 | 0.728874 | 0.728874 | 123 | 26.235773 | 22.946413 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.422764 | false | false | 15 |
489827f805757b95d6b5fdd399a46289aed4f5e8 | 11,742,440,626,586 | 79676fc0e133b2d57189e5d91a11adeb540db3c8 | /TNCSC/src/java/com/onward/budget/dao/ControlofExpenditureReport.java | 17f56c53e25cca88d29f67fa3a261ada71f1de28 | [] | no_license | dhamotharang/a2ztoday | https://github.com/dhamotharang/a2ztoday | a58e94e8fbd3c203f9e172f575f8a4a4d51bb287 | 87ba97f2600121fb7ae84738cf5b2d802f07865d | refs/heads/master | 2021-12-07T14:33:42.416000 | 2015-12-09T10:19:24 | 2015-12-09T10:19:24 | 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 com.onward.budget.dao;
/**
*
* @author Prince vijayakumar.M
*/
import com.onward.valueobjects.ReportModel;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.util.Iterator;
import java.util.Set;
import org.jboss.management.j2ee.JVM;
public class ControlofExpenditureReport {
private final char[] FORM_FEED = {(char) 12};
private final char LARGEFONT = (char) 14;
private final char[] BOLD = {(char) 14, (char) 15};
private final char RELEASE = (char) 18;
private char[] horizontalsign = new char[120];
private char[] horizontalline = new char[120];
private char[] equalline = new char[120];
private final DecimalFormat decimalFormat = new DecimalFormat("####0.00");
private int lineno;
private String groupname = "";
int pageno;
private double groupfundsallot = 0;
private double groupcurrent = 0;
private double groupuptothe = 0;
private double groupbalance = 0;
private double groupexcees = 0;
private double grandfundsallot = 0;
private double grandcurrent = 0;
private double granduptothe = 0;
private double grandbalance = 0;
private double grandexcees = 0;
public ControlofExpenditureReport() {
for (int i = 0; i < 120; i++) {
horizontalsign[i] = '~';
}
for (int i = 0; i < 120; i++) {
horizontalline[i] = '-';
}
for (int i = 0; i < 120; i++) {
equalline[i] = '=';
}
}
public void ControlofExpenditureReportHeader(PrintWriter pw, ReportModel rm) {
pw.printf("%s", " TAMIL NADU CIVIL SUPPLIES CORPORATION");
pw.println();
pw.printf("%73s%-6s", "CONTROL OF EXPENDITURE STATEMENT FOR THE MONTH OF ", rm.getBudgetmonthandyear());
pw.println();
pw.printf("%59s%-7s", "ACCOUNTING PERIOD : ", rm.getBudgetperiod());
pw.println();
pw.printf("%11s%-53s%37s%-2s", " REGION : ", rm.getRegionname(), "(RS. in Lakhs) Page No : ", pageno);
pw.println();
pw.printf("%s", " =======================================================================================================");
pw.println();
pw.printf("%s", " | SNO ACCOUNT HEAD OF ACCOUNT FUNDS EXPS EXPS BALANCE EXCESS|");
pw.println();
pw.printf("%s", " | CODE ALLOT DURING UPTO FUND EXPS |");
pw.println();
// pw.printf("%-61s%-11s%-22s%10s", " | ", rm.getBudgetmonthandyear(), rm.getBudgetmonthandyear(), "IF ANY |");
pw.printf("%-63s%-11s%-22s%8s", " |", rm.getBudgetmonthandyear(), rm.getBudgetmonthandyear(), "IF ANY |");
pw.println();
pw.printf("%s", " |=====================================================================================================|");
pw.println();
lineno = 0;
pageno++;
}
public void ControlofExpenditureReportGrandTotal(String filePath) {
try {
PrintWriter pw = null;
File file = new File(filePath);
try {
pw = new PrintWriter(new BufferedWriter(new FileWriter(file, true)));
} catch (IOException ex) {
ex.printStackTrace();
}
pw.printf("%48s%10s%s%10s%s%10s%s%10s%s%10s%2s", " | GROUP TOTAL ", decimalFormat.format(groupfundsallot), " ", decimalFormat.format(groupcurrent), " ", decimalFormat.format(groupuptothe), " ", decimalFormat.format(groupfundsallot - groupuptothe), " ", decimalFormat.format(groupexcees), " |");
pw.println();
pw.printf("%s", " |-----------------------------------------------------------------------------------------------------|");
pw.println();
pw.printf("%48s%10s%s%10s%s%10s%s%10s%s%10s%2s", " | GRAND TOTAL ", decimalFormat.format(grandfundsallot), " ", decimalFormat.format(grandcurrent), " ", decimalFormat.format(granduptothe), " ", decimalFormat.format(grandfundsallot - granduptothe), " ", decimalFormat.format(grandexcees), " |");
pw.println();
pw.printf("%s", " |-----------------------------------------------------------------------------------------------------|");
pw.println();
pw.flush();
pw.close();
groupfundsallot = 0;
groupcurrent = 0;
groupuptothe = 0;
groupbalance = 0;
groupexcees = 0;
grandfundsallot = 0;
grandcurrent = 0;
granduptothe = 0;
grandbalance = 0;
grandexcees = 0;
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void ControlofExpenditureReportGroupTotal(PrintWriter pw) {
try {
// pw.printf("%s", " |-----------------------------------------------------------------------------------------------------|");
// pw.println();
// lineno++;
pw.printf("%48s%10s%s%10s%s%10s%s%10s%s%10s%2s", " | GROUP TOTAL ", decimalFormat.format(groupfundsallot), " ", decimalFormat.format(groupcurrent), " ", decimalFormat.format(groupuptothe), " ", decimalFormat.format(groupfundsallot - groupuptothe), " ", decimalFormat.format(groupexcees), " |");
pw.println();
lineno++;
groupfundsallot = 0;
groupcurrent = 0;
groupuptothe = 0;
groupbalance = 0;
groupexcees = 0;
pw.printf("%s", " |-----------------------------------------------------------------------------------------------------|");
pw.println();
lineno++;
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void getControlofExpenditureReportPrintWriter(ReportModel rm, String filePath) {
try {
PrintWriter pw = null;
File file = new File(filePath);
try {
pw = new PrintWriter(new BufferedWriter(new FileWriter(file, true)));
} catch (IOException ex) {
ex.printStackTrace();
}
if (lineno > 48) {
pw.write(FORM_FEED);
pw.println();
ControlofExpenditureReportHeader(pw, rm);
}
if (rm.getSlipno() == 1) {
pageno = 0;
lineno = 0;
pageno++;
ControlofExpenditureReportHeader(pw, rm);
groupname = rm.getLedgergroupname();
pw.printf("%3s%-100s%s", " | ", rm.getLedgergroupname(), "|");
pw.println();
lineno++;
pw.printf("%s", " | *********************************** |");
pw.println();
lineno++;
}
if (!groupname.equals(rm.getLedgergroupname())) {
ControlofExpenditureReportGroupTotal(pw);
pw.printf("%3s%-100s%s", " | ", rm.getLedgergroupname(), "|");
pw.println();
lineno++;
pw.printf("%s", " | *********************************** |");
pw.println();
lineno++;
groupname = rm.getLedgergroupname();
}
pw.printf("%3s%3s%2s%7s%s%-30s%2s%10s%s%10s%s%10s%s%10s%s%10s%2s", " | ", rm.getSlipno(), ". ", rm.getLedgerid(), " ", rm.getLedgername(), " ", rm.getActual(), " ", rm.getCurrentbudget(), " ", rm.getUptothebudget(), " ", decimalFormat.format((Double.valueOf(rm.getActual()) - Double.valueOf(rm.getUptothebudget()))), " ", rm.getExcessexpense(), " |");
pw.println();
grandfundsallot += Double.valueOf(rm.getActual());
grandcurrent += Double.valueOf(rm.getCurrentbudget());
granduptothe += Double.valueOf(rm.getUptothebudget());
grandbalance += Double.valueOf(rm.getBudgetbalance());
grandexcees += Double.valueOf(rm.getExcessexpense());
groupfundsallot += Double.valueOf(rm.getActual());
groupcurrent += Double.valueOf(rm.getCurrentbudget());
groupuptothe += Double.valueOf(rm.getUptothebudget());
groupbalance += Double.valueOf(rm.getBudgetbalance());
groupexcees += Double.valueOf(rm.getExcessexpense());
lineno++;
pw.printf("%s", " |-----------------------------------------------------------------------------------------------------|");
pw.println();
lineno++;
pw.flush();
pw.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
} | UTF-8 | Java | 9,280 | java | ControlofExpenditureReport.java | Java | [
{
"context": "\npackage com.onward.budget.dao;\n\n/**\n *\n * @author Prince vijayakumar.M\n */\nimport com.onward.valueobjects.ReportModel;\ni",
"end": 170,
"score": 0.9998738765716553,
"start": 150,
"tag": "NAME",
"value": "Prince vijayakumar.M"
}
] | null | [] | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.onward.budget.dao;
/**
*
* @author <NAME>
*/
import com.onward.valueobjects.ReportModel;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.util.Iterator;
import java.util.Set;
import org.jboss.management.j2ee.JVM;
public class ControlofExpenditureReport {
private final char[] FORM_FEED = {(char) 12};
private final char LARGEFONT = (char) 14;
private final char[] BOLD = {(char) 14, (char) 15};
private final char RELEASE = (char) 18;
private char[] horizontalsign = new char[120];
private char[] horizontalline = new char[120];
private char[] equalline = new char[120];
private final DecimalFormat decimalFormat = new DecimalFormat("####0.00");
private int lineno;
private String groupname = "";
int pageno;
private double groupfundsallot = 0;
private double groupcurrent = 0;
private double groupuptothe = 0;
private double groupbalance = 0;
private double groupexcees = 0;
private double grandfundsallot = 0;
private double grandcurrent = 0;
private double granduptothe = 0;
private double grandbalance = 0;
private double grandexcees = 0;
public ControlofExpenditureReport() {
for (int i = 0; i < 120; i++) {
horizontalsign[i] = '~';
}
for (int i = 0; i < 120; i++) {
horizontalline[i] = '-';
}
for (int i = 0; i < 120; i++) {
equalline[i] = '=';
}
}
public void ControlofExpenditureReportHeader(PrintWriter pw, ReportModel rm) {
pw.printf("%s", " TAMIL NADU CIVIL SUPPLIES CORPORATION");
pw.println();
pw.printf("%73s%-6s", "CONTROL OF EXPENDITURE STATEMENT FOR THE MONTH OF ", rm.getBudgetmonthandyear());
pw.println();
pw.printf("%59s%-7s", "ACCOUNTING PERIOD : ", rm.getBudgetperiod());
pw.println();
pw.printf("%11s%-53s%37s%-2s", " REGION : ", rm.getRegionname(), "(RS. in Lakhs) Page No : ", pageno);
pw.println();
pw.printf("%s", " =======================================================================================================");
pw.println();
pw.printf("%s", " | SNO ACCOUNT HEAD OF ACCOUNT FUNDS EXPS EXPS BALANCE EXCESS|");
pw.println();
pw.printf("%s", " | CODE ALLOT DURING UPTO FUND EXPS |");
pw.println();
// pw.printf("%-61s%-11s%-22s%10s", " | ", rm.getBudgetmonthandyear(), rm.getBudgetmonthandyear(), "IF ANY |");
pw.printf("%-63s%-11s%-22s%8s", " |", rm.getBudgetmonthandyear(), rm.getBudgetmonthandyear(), "IF ANY |");
pw.println();
pw.printf("%s", " |=====================================================================================================|");
pw.println();
lineno = 0;
pageno++;
}
public void ControlofExpenditureReportGrandTotal(String filePath) {
try {
PrintWriter pw = null;
File file = new File(filePath);
try {
pw = new PrintWriter(new BufferedWriter(new FileWriter(file, true)));
} catch (IOException ex) {
ex.printStackTrace();
}
pw.printf("%48s%10s%s%10s%s%10s%s%10s%s%10s%2s", " | GROUP TOTAL ", decimalFormat.format(groupfundsallot), " ", decimalFormat.format(groupcurrent), " ", decimalFormat.format(groupuptothe), " ", decimalFormat.format(groupfundsallot - groupuptothe), " ", decimalFormat.format(groupexcees), " |");
pw.println();
pw.printf("%s", " |-----------------------------------------------------------------------------------------------------|");
pw.println();
pw.printf("%48s%10s%s%10s%s%10s%s%10s%s%10s%2s", " | GRAND TOTAL ", decimalFormat.format(grandfundsallot), " ", decimalFormat.format(grandcurrent), " ", decimalFormat.format(granduptothe), " ", decimalFormat.format(grandfundsallot - granduptothe), " ", decimalFormat.format(grandexcees), " |");
pw.println();
pw.printf("%s", " |-----------------------------------------------------------------------------------------------------|");
pw.println();
pw.flush();
pw.close();
groupfundsallot = 0;
groupcurrent = 0;
groupuptothe = 0;
groupbalance = 0;
groupexcees = 0;
grandfundsallot = 0;
grandcurrent = 0;
granduptothe = 0;
grandbalance = 0;
grandexcees = 0;
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void ControlofExpenditureReportGroupTotal(PrintWriter pw) {
try {
// pw.printf("%s", " |-----------------------------------------------------------------------------------------------------|");
// pw.println();
// lineno++;
pw.printf("%48s%10s%s%10s%s%10s%s%10s%s%10s%2s", " | GROUP TOTAL ", decimalFormat.format(groupfundsallot), " ", decimalFormat.format(groupcurrent), " ", decimalFormat.format(groupuptothe), " ", decimalFormat.format(groupfundsallot - groupuptothe), " ", decimalFormat.format(groupexcees), " |");
pw.println();
lineno++;
groupfundsallot = 0;
groupcurrent = 0;
groupuptothe = 0;
groupbalance = 0;
groupexcees = 0;
pw.printf("%s", " |-----------------------------------------------------------------------------------------------------|");
pw.println();
lineno++;
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void getControlofExpenditureReportPrintWriter(ReportModel rm, String filePath) {
try {
PrintWriter pw = null;
File file = new File(filePath);
try {
pw = new PrintWriter(new BufferedWriter(new FileWriter(file, true)));
} catch (IOException ex) {
ex.printStackTrace();
}
if (lineno > 48) {
pw.write(FORM_FEED);
pw.println();
ControlofExpenditureReportHeader(pw, rm);
}
if (rm.getSlipno() == 1) {
pageno = 0;
lineno = 0;
pageno++;
ControlofExpenditureReportHeader(pw, rm);
groupname = rm.getLedgergroupname();
pw.printf("%3s%-100s%s", " | ", rm.getLedgergroupname(), "|");
pw.println();
lineno++;
pw.printf("%s", " | *********************************** |");
pw.println();
lineno++;
}
if (!groupname.equals(rm.getLedgergroupname())) {
ControlofExpenditureReportGroupTotal(pw);
pw.printf("%3s%-100s%s", " | ", rm.getLedgergroupname(), "|");
pw.println();
lineno++;
pw.printf("%s", " | *********************************** |");
pw.println();
lineno++;
groupname = rm.getLedgergroupname();
}
pw.printf("%3s%3s%2s%7s%s%-30s%2s%10s%s%10s%s%10s%s%10s%s%10s%2s", " | ", rm.getSlipno(), ". ", rm.getLedgerid(), " ", rm.getLedgername(), " ", rm.getActual(), " ", rm.getCurrentbudget(), " ", rm.getUptothebudget(), " ", decimalFormat.format((Double.valueOf(rm.getActual()) - Double.valueOf(rm.getUptothebudget()))), " ", rm.getExcessexpense(), " |");
pw.println();
grandfundsallot += Double.valueOf(rm.getActual());
grandcurrent += Double.valueOf(rm.getCurrentbudget());
granduptothe += Double.valueOf(rm.getUptothebudget());
grandbalance += Double.valueOf(rm.getBudgetbalance());
grandexcees += Double.valueOf(rm.getExcessexpense());
groupfundsallot += Double.valueOf(rm.getActual());
groupcurrent += Double.valueOf(rm.getCurrentbudget());
groupuptothe += Double.valueOf(rm.getUptothebudget());
groupbalance += Double.valueOf(rm.getBudgetbalance());
groupexcees += Double.valueOf(rm.getExcessexpense());
lineno++;
pw.printf("%s", " |-----------------------------------------------------------------------------------------------------|");
pw.println();
lineno++;
pw.flush();
pw.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
} | 9,266 | 0.477155 | 0.460022 | 207 | 43.835751 | 54.182392 | 364 | false | false | 0 | 0 | 0 | 0 | 103 | 0.021983 | 1.338164 | false | false | 15 |
c0e46bddc0a79c42cba40985914263e684967ac3 | 17,686,675,358,378 | 9d99f27792cbcd1a2b456db1dd98d789e13e9faf | /src/main/java/uniandes/cupi2/numeroMvc/interfaz/romano/VentanaRomano.java | bc1ade19a13bb1bc9ef53f3d0fc36b8743779f9b | [] | no_license | felpmag/FabricasTaller2 | https://github.com/felpmag/FabricasTaller2 | c8a42d4a4273038d0aa0cca84008f434e33888a1 | 52d2062127d00186271572cd2231871a69348f8e | refs/heads/master | 2021-01-15T09:53:15.302000 | 2016-09-27T16:53:38 | 2016-09-27T16:53:38 | 68,551,876 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* $Id: VentanaRomano.java,v 1.8 2008/08/14 10:28:30 jua-gome Exp $
* Universidad de los Andes (Bogot� - Colombia)
* Departamento de Ingenier�a de Sistemas y Computaci�n
* Licenciado bajo el esquema Academic Free License version 2.1
*
* Proyecto Cupi2 (http://cupi2.uniandes.edu.co)
* Ejercicio: n15_numeroMvc
* Autor: Pablo Barvo - Mar 3, 2006
* Modificado por: Daniel Romero - 22-Sep-2006
* Modificado por: Juan Erasmo G�mez - 7-Ago-2008
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
package uniandes.cupi2.numeroMvc.interfaz.romano;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JInternalFrame;
import annotation.Feature;
import annotation.Feature.RestriccionHijos;
import uniandes.cupi2.numeroMvc.mundo.Numero;
/**
* Ventana de visualizaci�n en formato de n�meros romanos.
*/
@Feature(padre = "Ventana", nombre = "VentanaRomano")
public class VentanaRomano extends JInternalFrame {
// -----------------------------------------------------------------
// Constantes
// -----------------------------------------------------------------
/**
* Constante de serializaci�n.
*/
private static final long serialVersionUID = 3325218644134834205L;
// -----------------------------------------------------------------
// Atributos de Interfaz
// -----------------------------------------------------------------
/**
* Panel con la visualizaci�n y el control.
*/
private PanelRomano panelRomano;
// -----------------------------------------------------------------
// Constructores
// -----------------------------------------------------------------
/**
* Constructor del panel.
*
* @param numero
* N�mero a visualizar-modificar.
*/
@Feature(padre = "VentanaRomano", nombre = "VentanaRomanoConstructor", requerido = true)
public VentanaRomano(Numero numero) {
setSize(276, 150);
setMaximizable(true);
setClosable(true);
setResizable(true);
setPreferredSize(new Dimension(276, 150));
setTitle("Vista-Controlador Romano");
// panelRomano
panelRomano = new PanelRomano(numero);
add(panelRomano, BorderLayout.CENTER);
}
}
| UTF-8 | Java | 2,388 | java | VentanaRomano.java | Java | [
{
"context": "ndes.edu.co)\n * Ejercicio: n15_numeroMvc\n * Autor: Pablo Barvo - Mar 3, 2006\n * Modificado por: Daniel Romero - ",
"end": 414,
"score": 0.9998873472213745,
"start": 403,
"tag": "NAME",
"value": "Pablo Barvo"
},
{
"context": "utor: Pablo Barvo - Mar 3, 2006\n * Modificado por: Daniel Romero - 22-Sep-2006\n * Modificado por: Juan Erasmo G�me",
"end": 461,
"score": 0.9998682141304016,
"start": 448,
"tag": "NAME",
"value": "Daniel Romero"
},
{
"context": "or: Daniel Romero - 22-Sep-2006\n * Modificado por: Juan Erasmo G�mez - 7-Ago-2008 \n * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~",
"end": 512,
"score": 0.9998758435249329,
"start": 495,
"tag": "NAME",
"value": "Juan Erasmo G�mez"
}
] | null | [] | /**
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* $Id: VentanaRomano.java,v 1.8 2008/08/14 10:28:30 jua-gome Exp $
* Universidad de los Andes (Bogot� - Colombia)
* Departamento de Ingenier�a de Sistemas y Computaci�n
* Licenciado bajo el esquema Academic Free License version 2.1
*
* Proyecto Cupi2 (http://cupi2.uniandes.edu.co)
* Ejercicio: n15_numeroMvc
* Autor: <NAME> - Mar 3, 2006
* Modificado por: <NAME> - 22-Sep-2006
* Modificado por: <NAME> - 7-Ago-2008
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
package uniandes.cupi2.numeroMvc.interfaz.romano;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JInternalFrame;
import annotation.Feature;
import annotation.Feature.RestriccionHijos;
import uniandes.cupi2.numeroMvc.mundo.Numero;
/**
* Ventana de visualizaci�n en formato de n�meros romanos.
*/
@Feature(padre = "Ventana", nombre = "VentanaRomano")
public class VentanaRomano extends JInternalFrame {
// -----------------------------------------------------------------
// Constantes
// -----------------------------------------------------------------
/**
* Constante de serializaci�n.
*/
private static final long serialVersionUID = 3325218644134834205L;
// -----------------------------------------------------------------
// Atributos de Interfaz
// -----------------------------------------------------------------
/**
* Panel con la visualizaci�n y el control.
*/
private PanelRomano panelRomano;
// -----------------------------------------------------------------
// Constructores
// -----------------------------------------------------------------
/**
* Constructor del panel.
*
* @param numero
* N�mero a visualizar-modificar.
*/
@Feature(padre = "VentanaRomano", nombre = "VentanaRomanoConstructor", requerido = true)
public VentanaRomano(Numero numero) {
setSize(276, 150);
setMaximizable(true);
setClosable(true);
setResizable(true);
setPreferredSize(new Dimension(276, 150));
setTitle("Vista-Controlador Romano");
// panelRomano
panelRomano = new PanelRomano(numero);
add(panelRomano, BorderLayout.CENTER);
}
}
| 2,363 | 0.510549 | 0.480591 | 74 | 31.027027 | 25.576052 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.337838 | false | false | 15 |
c3e1c7cb8fe1dce95eeee332f4bb40041636153b | 35,442,070,141,405 | a17861dbda6c910d723c66305a37a2996e0d995a | /app/src/main/java/com/ns/yc/lifehelper/base/mvp2/BaseMvpActivity.java | f4f0fae4d177ad9645313c451d09e0485cf87d40 | [] | no_license | 275726281/LifeHelper | https://github.com/275726281/LifeHelper | 2acd7d5f87d88cc6f292e5b1a66ad0a4d0522f84 | 984538711b1fb4df4b1a8b1a2f11a7a5aed968ac | refs/heads/master | 2020-03-27T04:20:20.351000 | 2018-08-17T05:12:46 | 2018-08-17T05:12:46 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ns.yc.lifehelper.base.mvp2;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import com.blankj.utilcode.util.NetworkUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.ns.yc.lifehelper.R;
import javax.inject.Inject;
import butterknife.ButterKnife;
import cn.ycbjie.ycstatusbarlib.bar.YCAppBar;
/**
* ================================================
* 作 者:杨充
* 版 本:1.0
* 创建日期:2017/11/23
* 描 述:改版封装MVP结构的Activity的父类
* 修订历史:
* ================================================
*/
public abstract class BaseMvpActivity<T extends BaseMvpPresenter> extends AppCompatActivity implements BaseMvpView {
@Inject
protected T mPresenter;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(getContentView());
ButterKnife.bind(this);
//避免切换横竖屏
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
YCAppBar.setStatusBarColor(this, R.color.colorTheme);
if(mPresenter!=null){
mPresenter.subscribe(this);
}
initView();
initListener();
initData();
if(!NetworkUtils.isConnected()){
ToastUtils.showShort("请检查网络是否连接");
}
}
@Override
protected void onDestroy() {
super.onDestroy();
//注意一定要先做销毁mPresenter.unSubscribe(),然后在调用这步ButterKnife.unbind(this),销毁所有控件对象
//查询unbind源码可知,执行这步后会将创建所有控件对象置null,如果后调用mPresenter.unSubscribe(),
//那么如果有对象在做执行行为,将会导致控件对象报空指针。一定注意先后顺序。
if(mPresenter!=null){
mPresenter.unSubscribe();
}
ButterKnife.unbind(this);
}
/** 返回一个用于显示界面的布局id */
public abstract int getContentView();
/** 初始化View的代码写在这个方法中 */
public abstract void initView();
/** 初始化监听器的代码写在这个方法中 */
public abstract void initListener();
/** 初始数据的代码写在这个方法中,用于从服务器获取数据 */
public abstract void initData();
/**
* 通过Class跳转界面
**/
public void startActivity(Class<?> cls) {
startActivity(cls, null);
}
/**
* 通过Class跳转界面
**/
public void startActivityForResult(Class<?> cls, int requestCode) {
startActivityForResult(cls, null, requestCode);
}
/**
* 含有Bundle通过Class跳转界面
**/
public void startActivityForResult(Class<?> cls, Bundle bundle, int requestCode) {
Intent intent = new Intent();
intent.setClass(this, cls);
if (bundle != null) {
intent.putExtras(bundle);
}
startActivityForResult(intent, requestCode);
}
/**
* 含有Bundle通过Class跳转界面
**/
public void startActivity(Class<?> cls, Bundle bundle) {
Intent intent = new Intent();
intent.setClass(this, cls);
if (bundle != null) {
intent.putExtras(bundle);
}
startActivity(intent);
}
}
| UTF-8 | Java | 3,511 | java | BaseMvpActivity.java | Java | [
{
"context": "=======================================\n * 作 者:杨充\n * 版 本:1.0\n * 创建日期:2017/11/23\n * 描 述:改版封装MV",
"end": 530,
"score": 0.9991421699523926,
"start": 528,
"tag": "NAME",
"value": "杨充"
}
] | null | [] | package com.ns.yc.lifehelper.base.mvp2;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import com.blankj.utilcode.util.NetworkUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.ns.yc.lifehelper.R;
import javax.inject.Inject;
import butterknife.ButterKnife;
import cn.ycbjie.ycstatusbarlib.bar.YCAppBar;
/**
* ================================================
* 作 者:杨充
* 版 本:1.0
* 创建日期:2017/11/23
* 描 述:改版封装MVP结构的Activity的父类
* 修订历史:
* ================================================
*/
public abstract class BaseMvpActivity<T extends BaseMvpPresenter> extends AppCompatActivity implements BaseMvpView {
@Inject
protected T mPresenter;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(getContentView());
ButterKnife.bind(this);
//避免切换横竖屏
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
YCAppBar.setStatusBarColor(this, R.color.colorTheme);
if(mPresenter!=null){
mPresenter.subscribe(this);
}
initView();
initListener();
initData();
if(!NetworkUtils.isConnected()){
ToastUtils.showShort("请检查网络是否连接");
}
}
@Override
protected void onDestroy() {
super.onDestroy();
//注意一定要先做销毁mPresenter.unSubscribe(),然后在调用这步ButterKnife.unbind(this),销毁所有控件对象
//查询unbind源码可知,执行这步后会将创建所有控件对象置null,如果后调用mPresenter.unSubscribe(),
//那么如果有对象在做执行行为,将会导致控件对象报空指针。一定注意先后顺序。
if(mPresenter!=null){
mPresenter.unSubscribe();
}
ButterKnife.unbind(this);
}
/** 返回一个用于显示界面的布局id */
public abstract int getContentView();
/** 初始化View的代码写在这个方法中 */
public abstract void initView();
/** 初始化监听器的代码写在这个方法中 */
public abstract void initListener();
/** 初始数据的代码写在这个方法中,用于从服务器获取数据 */
public abstract void initData();
/**
* 通过Class跳转界面
**/
public void startActivity(Class<?> cls) {
startActivity(cls, null);
}
/**
* 通过Class跳转界面
**/
public void startActivityForResult(Class<?> cls, int requestCode) {
startActivityForResult(cls, null, requestCode);
}
/**
* 含有Bundle通过Class跳转界面
**/
public void startActivityForResult(Class<?> cls, Bundle bundle, int requestCode) {
Intent intent = new Intent();
intent.setClass(this, cls);
if (bundle != null) {
intent.putExtras(bundle);
}
startActivityForResult(intent, requestCode);
}
/**
* 含有Bundle通过Class跳转界面
**/
public void startActivity(Class<?> cls, Bundle bundle) {
Intent intent = new Intent();
intent.setClass(this, cls);
if (bundle != null) {
intent.putExtras(bundle);
}
startActivity(intent);
}
}
| 3,511 | 0.623069 | 0.619126 | 117 | 25.008547 | 22.384172 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.435897 | false | false | 15 |
4fb79ddb848aba254f865ebb44b85f33bd3640db | 1,211,180,827,552 | f95123a1f0353554ec6989de32b835d34621aea3 | /src/main/java/by/epam/movieapp/model/User.java | 08baa3695347efcb3e5b50d51ec620c71ccdf58d | [] | no_license | olgabelous/movieapp | https://github.com/olgabelous/movieapp | 83f8ef0c264fb614663837fb25a309ac1283d213 | e2fd3f8a9329eb8f76559ff39d1213849f280ee2 | refs/heads/master | 2023-07-19T20:51:47.077000 | 2016-12-05T20:42:56 | 2016-12-05T20:42:56 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package by.epam.movieapp.model;
import java.util.Date;
import java.util.Objects;
/**
* @author Olga Shahray
*/
public class User {
protected int id;
protected String name;
protected String email;
protected String pass;
protected String phone;
protected String photo;
protected Date dateRegistration = new Date();
protected Role role;
public User() {}
public User(int id, String name, String email, String pass, String phone, String photo,
Date dateRegistration, Role role) {
this.id = id;
this.name = name;
this.email = email;
this.pass = pass;
this.phone = phone;
this.photo = photo;
this.dateRegistration = dateRegistration;
this.role = role;
}
public User(String name, String email, String pass, String phone, Role role) {
this.name = name;
this.email = email;
this.pass = pass;
this.phone = phone;
this.role = role;
}
public User(int id, String name, String email, String pass, String phone, Role role) {
this.id = id;
this.name = name;
this.email = email;
this.pass = pass;
this.phone = phone;
this.role = role;
}
public User(User user) {
this(user.getId(), user.getName(), user.getEmail(), user.getPass(), user.getPhone(), user.getPhoto(),
user.getDateRegistration(), user.getRole());
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPass() {
return pass;
}
public void setPass(String pass) {
this.pass = pass;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Date getDateRegistration() {
return dateRegistration;
}
public void setDateRegistration(Date dateRegistration) {
this.dateRegistration = dateRegistration;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public Role getRole() {
return role;
}
public void setRole(Role role) {
this.role = role;
}
public boolean isNew() {
return id == 0;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o.getClass() != this.getClass()) return false;
User user = (User) o;
return id == user.id &&
Objects.equals(name, user.name) &&
Objects.equals(email, user.email) &&
Objects.equals(pass, user.pass) &&
Objects.equals(phone, user.phone) &&
Objects.equals(photo, user.photo) &&
Objects.equals(dateRegistration, user.dateRegistration) &&
role == user.role;
}
@Override
public int hashCode() {
return Objects.hash(id, name, email, pass, phone, photo, dateRegistration, role);
}
@Override
public String toString() {
return "User{" +
"id=" + id +
", name='" + name + '\'' +
", email='" + email + '\'' +
", pass='" + pass + '\'' +
", phone='" + phone + '\'' +
", photo='" + photo + '\'' +
", dateRegistration=" + dateRegistration +
", role=" + role +
'}';
}
}
| UTF-8 | Java | 3,798 | java | User.java | Java | [
{
"context": "il.Date;\nimport java.util.Objects;\n\n/**\n * @author Olga Shahray\n */\npublic class User {\n protected int id;\n ",
"end": 110,
"score": 0.9998773336410522,
"start": 98,
"tag": "NAME",
"value": "Olga Shahray"
},
{
"context": "e;\n this.email = email;\n this.pass = pass;\n this.phone = phone;\n this.role = ",
"end": 1193,
"score": 0.9944258332252502,
"start": 1189,
"tag": "PASSWORD",
"value": "pass"
},
{
"context": " \"id=\" + id +\n \", name='\" + name + '\\'' +\n \", email='\" + email + '\\",
"end": 3485,
"score": 0.6481220126152039,
"start": 3481,
"tag": "NAME",
"value": "name"
},
{
"context": "l='\" + email + '\\'' +\n \", pass='\" + pass + '\\'' +\n \", phone='\" + phone + '\\",
"end": 3573,
"score": 0.7697362899780273,
"start": 3569,
"tag": "PASSWORD",
"value": "pass"
}
] | null | [] | package by.epam.movieapp.model;
import java.util.Date;
import java.util.Objects;
/**
* @author <NAME>
*/
public class User {
protected int id;
protected String name;
protected String email;
protected String pass;
protected String phone;
protected String photo;
protected Date dateRegistration = new Date();
protected Role role;
public User() {}
public User(int id, String name, String email, String pass, String phone, String photo,
Date dateRegistration, Role role) {
this.id = id;
this.name = name;
this.email = email;
this.pass = pass;
this.phone = phone;
this.photo = photo;
this.dateRegistration = dateRegistration;
this.role = role;
}
public User(String name, String email, String pass, String phone, Role role) {
this.name = name;
this.email = email;
this.pass = pass;
this.phone = phone;
this.role = role;
}
public User(int id, String name, String email, String pass, String phone, Role role) {
this.id = id;
this.name = name;
this.email = email;
this.pass = <PASSWORD>;
this.phone = phone;
this.role = role;
}
public User(User user) {
this(user.getId(), user.getName(), user.getEmail(), user.getPass(), user.getPhone(), user.getPhoto(),
user.getDateRegistration(), user.getRole());
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPass() {
return pass;
}
public void setPass(String pass) {
this.pass = pass;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Date getDateRegistration() {
return dateRegistration;
}
public void setDateRegistration(Date dateRegistration) {
this.dateRegistration = dateRegistration;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public Role getRole() {
return role;
}
public void setRole(Role role) {
this.role = role;
}
public boolean isNew() {
return id == 0;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o.getClass() != this.getClass()) return false;
User user = (User) o;
return id == user.id &&
Objects.equals(name, user.name) &&
Objects.equals(email, user.email) &&
Objects.equals(pass, user.pass) &&
Objects.equals(phone, user.phone) &&
Objects.equals(photo, user.photo) &&
Objects.equals(dateRegistration, user.dateRegistration) &&
role == user.role;
}
@Override
public int hashCode() {
return Objects.hash(id, name, email, pass, phone, photo, dateRegistration, role);
}
@Override
public String toString() {
return "User{" +
"id=" + id +
", name='" + name + '\'' +
", email='" + email + '\'' +
", pass='" + <PASSWORD> + '\'' +
", phone='" + phone + '\'' +
", photo='" + photo + '\'' +
", dateRegistration=" + dateRegistration +
", role=" + role +
'}';
}
}
| 3,804 | 0.533965 | 0.533702 | 158 | 23.037975 | 20.909353 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.613924 | false | false | 15 |
1be6982519863955672521206af32587b3d29114 | 7,164,005,490,170 | ffc941fa59773ef7645958e1a13739c813f965b1 | /app/src/main/java/app/tuancuong/com/tuancuong/IntroActivity.java | b3261129ca94ef4b9499ced1d900728ef10b4e62 | [] | no_license | tungnguyenvan/Freelance_codeSale | https://github.com/tungnguyenvan/Freelance_codeSale | a651bee932ad600bd9b7970871abd67cddb69d9d | 9c25893a962c3120bf42fcfcffba4b1c5a8c4f18 | refs/heads/develop | 2020-03-27T04:38:53.247000 | 2018-09-07T13:38:03 | 2018-09-07T13:38:03 | 145,957,974 | 3 | 1 | null | false | 2018-09-07T13:38:04 | 2018-08-24T07:27:42 | 2018-08-31T02:13:28 | 2018-09-07T13:38:03 | 1,567 | 0 | 1 | 0 | Java | false | null | package app.tuancuong.com.tuancuong;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import com.hololo.tutorial.library.Step;
import com.hololo.tutorial.library.TutorialActivity;
import app.tuancuong.com.tuancuong.utils.PrefManager;
public class IntroActivity extends TutorialActivity {
private PrefManager prefManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Checking for first time launch - before calling setContentView()
prefManager = new PrefManager(this);
if (!prefManager.isFirstTimeLaunch()) {
launchHomeScreen();
}
initTutorialView();
}
private void launchHomeScreen() {
prefManager.setFirstTimeLaunch(false);
Intent intent = new Intent(getBaseContext(), MenuActivity.class);
startActivity(intent);
finish();
}
private void initTutorialView() {
/*
setPrevText(text); // Previous button text
setNextText(text); // Next button text
setFinishText(text); // Finish button text
setCancelText(text); // Cancel button text
setIndicatorSelected(int drawable); // Indicator drawable when selected
setIndicator(int drawable); // Indicator drawable
setGivePermissionText(String text); // Permission but
*/
//Init Fragment
addFragment(new Step.Builder().setTitle("This is header")
.setContent("This is content")
.setBackgroundColor(Color.parseColor("#FF0957")) // int background color
.setDrawable(R.drawable.ss_1) // int top drawable
.setSummary("This is summary")
.build());
addFragment(new Step.Builder().setTitle("This is header")
.setContent("This is content")
.setBackgroundColor(Color.parseColor("#00D4BA")) // int background color
.setDrawable(R.drawable.ss_2) // int top drawable
.setSummary("This is summary")
.build());
addFragment(new Step.Builder().setTitle("This is header")
.setContent("This is content")
.setBackgroundColor(Color.parseColor("#1098FE")) // int background color
.setDrawable(R.drawable.ss_3) // int top drawable
.setSummary("This is summary")
.build());
addFragment(new Step.Builder().setTitle("This is header")
.setContent("This is content")
.setBackgroundColor(Color.parseColor("#CA70F3")) // int background color
.setDrawable(R.drawable.ss_4) // int top drawable
.setSummary("This is summary")
.build());
}
@Override
public void finishTutorial() {
super.finishTutorial();
launchHomeScreen();
}
}
| UTF-8 | Java | 2,924 | java | IntroActivity.java | Java | [] | null | [] | package app.tuancuong.com.tuancuong;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import com.hololo.tutorial.library.Step;
import com.hololo.tutorial.library.TutorialActivity;
import app.tuancuong.com.tuancuong.utils.PrefManager;
public class IntroActivity extends TutorialActivity {
private PrefManager prefManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Checking for first time launch - before calling setContentView()
prefManager = new PrefManager(this);
if (!prefManager.isFirstTimeLaunch()) {
launchHomeScreen();
}
initTutorialView();
}
private void launchHomeScreen() {
prefManager.setFirstTimeLaunch(false);
Intent intent = new Intent(getBaseContext(), MenuActivity.class);
startActivity(intent);
finish();
}
private void initTutorialView() {
/*
setPrevText(text); // Previous button text
setNextText(text); // Next button text
setFinishText(text); // Finish button text
setCancelText(text); // Cancel button text
setIndicatorSelected(int drawable); // Indicator drawable when selected
setIndicator(int drawable); // Indicator drawable
setGivePermissionText(String text); // Permission but
*/
//Init Fragment
addFragment(new Step.Builder().setTitle("This is header")
.setContent("This is content")
.setBackgroundColor(Color.parseColor("#FF0957")) // int background color
.setDrawable(R.drawable.ss_1) // int top drawable
.setSummary("This is summary")
.build());
addFragment(new Step.Builder().setTitle("This is header")
.setContent("This is content")
.setBackgroundColor(Color.parseColor("#00D4BA")) // int background color
.setDrawable(R.drawable.ss_2) // int top drawable
.setSummary("This is summary")
.build());
addFragment(new Step.Builder().setTitle("This is header")
.setContent("This is content")
.setBackgroundColor(Color.parseColor("#1098FE")) // int background color
.setDrawable(R.drawable.ss_3) // int top drawable
.setSummary("This is summary")
.build());
addFragment(new Step.Builder().setTitle("This is header")
.setContent("This is content")
.setBackgroundColor(Color.parseColor("#CA70F3")) // int background color
.setDrawable(R.drawable.ss_4) // int top drawable
.setSummary("This is summary")
.build());
}
@Override
public void finishTutorial() {
super.finishTutorial();
launchHomeScreen();
}
}
| 2,924 | 0.619015 | 0.612859 | 78 | 36.487179 | 25.380056 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 15 |
adbe31499d03276fdf6e315f871ac5e139d0d414 | 12,816,182,456,915 | c78953e7cc1b492fa3ba2d99bae578eee15f4997 | /extends/src/com/imooc/Annimal.java | f6d135589664380f480d043e3b6e9c8eb55db252 | [] | no_license | atongliyagetong/extends | https://github.com/atongliyagetong/extends | 0aef65ae735f1604ab50cf45a850ed00e61c9b03 | 4d8a8f02d97799bd74035a9608ad45b0509b2166 | refs/heads/master | 2020-09-10T23:21:04.992000 | 2016-08-31T01:58:21 | 2016-08-31T01:58:21 | 66,989,140 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.imooc;
public class Annimal {
public int age;
public String name;
public void eat(){
System.out.println("动物能吃");
}
public Annimal()
{
System.out.println("Annimal构造函数调用");
}
@Override
public String toString() {
return "Annimal [age=" + age + ", name=" + name + "]";
}
}
| GB18030 | Java | 321 | java | Annimal.java | Java | [] | null | [] | package com.imooc;
public class Annimal {
public int age;
public String name;
public void eat(){
System.out.println("动物能吃");
}
public Annimal()
{
System.out.println("Annimal构造函数调用");
}
@Override
public String toString() {
return "Annimal [age=" + age + ", name=" + name + "]";
}
}
| 321 | 0.634551 | 0.634551 | 19 | 14.842105 | 14.86169 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.263158 | false | false | 15 |
51734c792b313f585fa7a083a74beee86209066a | 37,495,064,495,616 | f2acd30526043098bc13f8ab852480af7ec38f9d | /src/main/java/pl/com/tkarolczyk/anonymous_classes/lambda/FlyableCleaner.java | ec36cd91c647c6cb8a72829a4f29315922fc7f5d | [] | no_license | Tobomabas/kurs | https://github.com/Tobomabas/kurs | 1948031b18943c7eaf937d020be96ec2b4895b9b | c4a5415e27933797cd28fb25092668a77cb637ca | refs/heads/master | 2020-04-10T12:23:12.436000 | 2019-01-17T18:17:47 | 2019-01-17T18:17:47 | 161,020,817 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pl.com.tkarolczyk.anonymous_classes.lambda;
public class FlyableCleaner {
public void clean (Flyable flyable){
System.out.println("Cleaning Flyeable");
}
}
| UTF-8 | Java | 186 | java | FlyableCleaner.java | Java | [] | null | [] | package pl.com.tkarolczyk.anonymous_classes.lambda;
public class FlyableCleaner {
public void clean (Flyable flyable){
System.out.println("Cleaning Flyeable");
}
}
| 186 | 0.698925 | 0.698925 | 12 | 14.5 | 20.101824 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | false | false | 15 |
9abe50608a0ffbb988986a30bf7b9d6b4aeaf204 | 37,495,064,496,879 | 342379b0e7a0572860158a34058dfad1c8944186 | /core/src/test/java/com/vladmihalcea/hpjp/hibernate/identifier/batch/SequenceAllocationSizeIdentifierTest.java | 8bc82d9afce02deedbba6fc9e07d55b1e1a9776d | [
"Apache-2.0"
] | permissive | vladmihalcea/high-performance-java-persistence | https://github.com/vladmihalcea/high-performance-java-persistence | 80a20e67fa376322f5b1c5eddf75758b29247a2a | acef7e84e8e2dff89a6113f007eb7656bc6bdea4 | refs/heads/master | 2023-09-01T03:43:41.263000 | 2023-08-31T14:44:54 | 2023-08-31T14:44:54 | 44,294,727 | 1,211 | 518 | Apache-2.0 | false | 2023-07-21T19:06:38 | 2015-10-15T04:57:57 | 2023-07-13T15:48:17 | 2023-07-21T11:00:38 | 4,114 | 1,162 | 457 | 2 | Java | false | false | package com.vladmihalcea.hpjp.hibernate.identifier.batch;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.junit.Test;
import jakarta.persistence.*;
public class SequenceAllocationSizeIdentifierTest extends AbstractBatchIdentifierTest {
@Override
protected Class<?>[] entities() {
return new Class<?>[] {
Post.class,
};
}
@Test
public void testSequenceIdentifierGenerator() {
LOGGER.debug("testSequenceIdentifierGenerator");
doInJPA(entityManager -> {
for (int i = 0; i < 10; i++) {
entityManager.persist(new Post());
}
LOGGER.debug("Flush is triggered at commit-time");
});
}
@Entity(name = "Post")
@Table(name = "post")
public static class Post {
@Id
@GeneratedValue(strategy= GenerationType.SEQUENCE, generator="pooledLo_seq")
@GenericGenerator(name="pooledLo_seq", strategy="enhanced-sequence",
parameters={
@Parameter(name="sequence_name", value="pooledLo_sequence"),
@Parameter(name="initial_value", value="1"),
@Parameter(name="increment_size",value="2"),
@Parameter(name="optimizer", value="pooled")
})
private Long id;
}
}
| UTF-8 | Java | 1,365 | java | SequenceAllocationSizeIdentifierTest.java | Java | [
{
"context": "package com.vladmihalcea.hpjp.hibernate.identifier.batch;\n\nimport org.hibe",
"end": 24,
"score": 0.6136289238929749,
"start": 14,
"tag": "USERNAME",
"value": "admihalcea"
}
] | null | [] | package com.vladmihalcea.hpjp.hibernate.identifier.batch;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.junit.Test;
import jakarta.persistence.*;
public class SequenceAllocationSizeIdentifierTest extends AbstractBatchIdentifierTest {
@Override
protected Class<?>[] entities() {
return new Class<?>[] {
Post.class,
};
}
@Test
public void testSequenceIdentifierGenerator() {
LOGGER.debug("testSequenceIdentifierGenerator");
doInJPA(entityManager -> {
for (int i = 0; i < 10; i++) {
entityManager.persist(new Post());
}
LOGGER.debug("Flush is triggered at commit-time");
});
}
@Entity(name = "Post")
@Table(name = "post")
public static class Post {
@Id
@GeneratedValue(strategy= GenerationType.SEQUENCE, generator="pooledLo_seq")
@GenericGenerator(name="pooledLo_seq", strategy="enhanced-sequence",
parameters={
@Parameter(name="sequence_name", value="pooledLo_sequence"),
@Parameter(name="initial_value", value="1"),
@Parameter(name="increment_size",value="2"),
@Parameter(name="optimizer", value="pooled")
})
private Long id;
}
}
| 1,365 | 0.606593 | 0.60293 | 45 | 29.333334 | 25.65844 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.533333 | false | false | 15 |
05fec8fbd637965dd43264e9ee4c6f27a3b77e01 | 22,230,750,724,188 | 4c21ff121407f78be80bb959d590dc1b65981b90 | /app/src/main/java/com/chen/ellen/amy/bean/Music.java | c447aa0d05e3f2187821cccb59d521eb9edf47b3 | [] | no_license | jsonhui/Amy | https://github.com/jsonhui/Amy | 9c2d43692178c2922eb0d80744fba192d17590df | cdfadf75bfc730894c313904a89198b255c6b8a4 | refs/heads/master | 2020-04-23T02:01:31.017000 | 2019-02-09T14:25:20 | 2019-02-09T14:25:20 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.chen.ellen.amy.bean;
public class Music {
private String name;
private String singerName;
private String path;
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public Music(String name, String singerName, String path){
this.name = name;
this.singerName = singerName;
this.path = path;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSingerName() {
return singerName;
}
public void setSingerName(String singerName) {
this.singerName = singerName;
}
}
| UTF-8 | Java | 725 | java | Music.java | Java | [] | null | [] | package com.chen.ellen.amy.bean;
public class Music {
private String name;
private String singerName;
private String path;
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public Music(String name, String singerName, String path){
this.name = name;
this.singerName = singerName;
this.path = path;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSingerName() {
return singerName;
}
public void setSingerName(String singerName) {
this.singerName = singerName;
}
}
| 725 | 0.598621 | 0.598621 | 38 | 18.078947 | 16.290749 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.394737 | false | false | 15 |
e9754376e17463c6c2d952702a0d687ac2ff5dd5 | 33,784,212,778,110 | 816be070347a11ae472b3a369001de39500e8a37 | /JavaLib/src/com/lostcode/javalib/entities/systems/EntitySystem.java | 00dfcd423263d78f52b8d8dcc5ba0049cae7f710 | [
"MIT"
] | permissive | LostCodeStudios/JavaLib | https://github.com/LostCodeStudios/JavaLib | 553d8638ebc0454bddb3a3c1b31466f5be0af868 | 71c98f1b6ef44eceafe3ea0314ca5d40d0c60ab6 | refs/heads/master | 2021-01-01T18:41:46.698000 | 2015-01-25T17:38:50 | 2015-01-25T17:38:50 | 11,191,973 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lostcode.javalib.entities.systems;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Disposable;
import com.lostcode.javalib.entities.Entity;
import com.lostcode.javalib.entities.EntityWorld;
/**
* Base class for all EntitySystems. An EntitySystem contains a predicate for
* determining which Entities concern it, as well as a process() method for
* performing logic on Entities.
*
* @author Natman64
*
*/
public abstract class EntitySystem implements Disposable {
// region Fields
/**
* This system's processing list. Use direct access sparingly.
*/
protected Array<Entity> entities = new Array<Entity>();
private long previousTime;
private float processTime;
private float interval = 0f;
private float elapsed = 0f;
/**
* The {@link EntityWorld} in which this system is contained.
*/
protected EntityWorld world;
/**
* If the processing list has been modified since the last call to
* processEntities(), this value is true.
*/
protected boolean processingListChanged;
// endregion
// region Initialization
/**
* Constructs an EntitySystem.
*/
public EntitySystem() {
}
/**
* Constructs an EntitySystem with a required interval between calls of its
* processEntities() method.
*
* @param world
* The {@link EntityWorld} in which this system is contained.
* @param interval
* The seconds required between calls.
*/
public EntitySystem(float interval) {
this.interval = interval;
}
// endregion
// region Accessors
/**
* @return The amount of seconds that need to pass between calls of
* processEntities().
*/
public float getInterval() {
return interval;
}
/**
* @return The amount of seconds that have passed since the last call of
* processEntities().
*/
public float getElapsedInterval() {
return elapsed;
}
// endregion
// region Mutators
/**
* Sets this system's EntityWorld.
*
* @param world
* The EntityWorld containing this system.
*/
public void setWorld(EntityWorld world) {
this.world = world;
}
// endregion
// region Interval Processing
/**
* Adds to the time elapsed since the last call of processEntities().
*
* @param elapsed
* The seconds elapsed.
*/
public void addElapsedInterval(float elapsed) {
this.elapsed += elapsed;
}
/**
* Resets the timer for this system's interval.
*/
public void resetElapsedInterval() {
elapsed -= interval; // Subtract interval to account for extra time.
}
// endregion
// region Entity Processing
/**
* Processes the given list of entities.
*
* @param entities
* A list of all desired entities.
*/
public void processEntities() {
long time = System.nanoTime();
for (Entity e : entities) {
process(e);
}
previousTime = time;
time = System.nanoTime();
processTime = (float) ((time - previousTime) / 1000.0);
processingListChanged = false;
}
/**
* Processes an individual entity.
*
* @param e
* The entity to be processed.
*/
protected abstract void process(Entity e);
// endregion
// region Events
/**
* Called when the game application is paused.
*/
public void pause() {
}
/**
* Called when the game application is resumed.
*/
public void resume() {
}
// endregion
// region Time Values
/**
* @return The amount of seconds between this call of processEntities() and
* the previous call of processEntities().
*/
public float deltaSeconds() {
return Gdx.graphics.getDeltaTime() * world.getTimeCoefficient();
}
/**
* @return The amount of seconds this system took during its last call of
* processEntities().
*/
public float processTime() {
return processTime;
}
// endregion
// region Entity Management
/**
* Checks if an Entity is part of this system's processing list.
*
* @param e
* The Entity to check for.
* @return Whether it's in this system's processing list.
*/
public boolean isProcessing(Entity e) {
return entities.contains(e, true);
}
/**
* Predicate for determining if an {@link Entity} needs to be sent to this
* system for processing.
*
* @param e
* The {@link Entity} to be checked.
* @return Whether this system needs to process the given {@link Entity}.
*/
public abstract boolean canProcess(Entity e);
/**
* Adds the given entity to the processing list.
*
* @param e
* The entity to add.
*/
public void add(Entity e) {
entities.add(e);
onAdded(e);
processingListChanged = true;
}
/**
* Removes the given entity from the processing list.
*
* @param e
* The entity to remove.
*/
public void remove(Entity e) {
entities.removeValue(e, true);
onRemoved(e);
processingListChanged = true;
}
/**
* Called when an Entity is added to the system's processing list.
*
* @param e
* The added Entity.
*/
protected void onAdded(Entity e) {
}
/**
* Called when one of this system's Entities is changed.
*
* @param e
* The changed entity.
*/
public void onChanged(Entity e) {
}
/**
* Called when an Entity is removed from the system's processing list.
*
* @param e
* The removed entity.
*/
protected void onRemoved(Entity e) {
}
// endregion
}
| UTF-8 | Java | 5,421 | java | EntitySystem.java | Java | [
{
"context": "or\n * performing logic on Entities.\n * \n * @author Natman64\n * \n */\npublic abstract class EntitySystem implem",
"end": 466,
"score": 0.9995602369308472,
"start": 458,
"tag": "USERNAME",
"value": "Natman64"
}
] | null | [] | package com.lostcode.javalib.entities.systems;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Disposable;
import com.lostcode.javalib.entities.Entity;
import com.lostcode.javalib.entities.EntityWorld;
/**
* Base class for all EntitySystems. An EntitySystem contains a predicate for
* determining which Entities concern it, as well as a process() method for
* performing logic on Entities.
*
* @author Natman64
*
*/
public abstract class EntitySystem implements Disposable {
// region Fields
/**
* This system's processing list. Use direct access sparingly.
*/
protected Array<Entity> entities = new Array<Entity>();
private long previousTime;
private float processTime;
private float interval = 0f;
private float elapsed = 0f;
/**
* The {@link EntityWorld} in which this system is contained.
*/
protected EntityWorld world;
/**
* If the processing list has been modified since the last call to
* processEntities(), this value is true.
*/
protected boolean processingListChanged;
// endregion
// region Initialization
/**
* Constructs an EntitySystem.
*/
public EntitySystem() {
}
/**
* Constructs an EntitySystem with a required interval between calls of its
* processEntities() method.
*
* @param world
* The {@link EntityWorld} in which this system is contained.
* @param interval
* The seconds required between calls.
*/
public EntitySystem(float interval) {
this.interval = interval;
}
// endregion
// region Accessors
/**
* @return The amount of seconds that need to pass between calls of
* processEntities().
*/
public float getInterval() {
return interval;
}
/**
* @return The amount of seconds that have passed since the last call of
* processEntities().
*/
public float getElapsedInterval() {
return elapsed;
}
// endregion
// region Mutators
/**
* Sets this system's EntityWorld.
*
* @param world
* The EntityWorld containing this system.
*/
public void setWorld(EntityWorld world) {
this.world = world;
}
// endregion
// region Interval Processing
/**
* Adds to the time elapsed since the last call of processEntities().
*
* @param elapsed
* The seconds elapsed.
*/
public void addElapsedInterval(float elapsed) {
this.elapsed += elapsed;
}
/**
* Resets the timer for this system's interval.
*/
public void resetElapsedInterval() {
elapsed -= interval; // Subtract interval to account for extra time.
}
// endregion
// region Entity Processing
/**
* Processes the given list of entities.
*
* @param entities
* A list of all desired entities.
*/
public void processEntities() {
long time = System.nanoTime();
for (Entity e : entities) {
process(e);
}
previousTime = time;
time = System.nanoTime();
processTime = (float) ((time - previousTime) / 1000.0);
processingListChanged = false;
}
/**
* Processes an individual entity.
*
* @param e
* The entity to be processed.
*/
protected abstract void process(Entity e);
// endregion
// region Events
/**
* Called when the game application is paused.
*/
public void pause() {
}
/**
* Called when the game application is resumed.
*/
public void resume() {
}
// endregion
// region Time Values
/**
* @return The amount of seconds between this call of processEntities() and
* the previous call of processEntities().
*/
public float deltaSeconds() {
return Gdx.graphics.getDeltaTime() * world.getTimeCoefficient();
}
/**
* @return The amount of seconds this system took during its last call of
* processEntities().
*/
public float processTime() {
return processTime;
}
// endregion
// region Entity Management
/**
* Checks if an Entity is part of this system's processing list.
*
* @param e
* The Entity to check for.
* @return Whether it's in this system's processing list.
*/
public boolean isProcessing(Entity e) {
return entities.contains(e, true);
}
/**
* Predicate for determining if an {@link Entity} needs to be sent to this
* system for processing.
*
* @param e
* The {@link Entity} to be checked.
* @return Whether this system needs to process the given {@link Entity}.
*/
public abstract boolean canProcess(Entity e);
/**
* Adds the given entity to the processing list.
*
* @param e
* The entity to add.
*/
public void add(Entity e) {
entities.add(e);
onAdded(e);
processingListChanged = true;
}
/**
* Removes the given entity from the processing list.
*
* @param e
* The entity to remove.
*/
public void remove(Entity e) {
entities.removeValue(e, true);
onRemoved(e);
processingListChanged = true;
}
/**
* Called when an Entity is added to the system's processing list.
*
* @param e
* The added Entity.
*/
protected void onAdded(Entity e) {
}
/**
* Called when one of this system's Entities is changed.
*
* @param e
* The changed entity.
*/
public void onChanged(Entity e) {
}
/**
* Called when an Entity is removed from the system's processing list.
*
* @param e
* The removed entity.
*/
protected void onRemoved(Entity e) {
}
// endregion
}
| 5,421 | 0.653569 | 0.651909 | 271 | 19.003691 | 21.350441 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.98155 | false | false | 15 |
2b144015b7bfcdaa466203ade277e5d0a6c96249 | 33,930,241,655,326 | 95e20a09cc6f555859ff8b478a149ba0d3370523 | /CoreJava2018/src/com/oracle/corejava/advance/t6/map/Actor.java | 03ad09d91faf2240143c72d581fd6320e137e611 | [] | no_license | TengSir/corejavaDemo | https://github.com/TengSir/corejavaDemo | 1124974d3655af9a7fd8705fd0b8fce55158674b | e5e066ae4d286ae50bd4953050eeeb63d7f617f3 | refs/heads/master | 2020-03-30T06:02:24.790000 | 2018-11-27T12:59:32 | 2018-11-27T12:59:32 | 150,834,985 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.oracle.corejava.advance.t6.map;
public class Actor {
private String name;
private int age;
private String sex;
private String tz;
/**
* @param name
* @param age
* @param sex
* @param tz
*/
public Actor(String name, int age, String sex, String tz) {
super();
this.name = name;
this.age = age;
this.sex = sex;
this.tz = tz;
}
@Override
public String toString() {
return "Actor [name=" + name + ", age=" + age + ", sex=" + sex + ", tz=" + tz + "]";
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getTz() {
return tz;
}
public void setTz(String tz) {
this.tz = tz;
}
}
| UTF-8 | Java | 881 | java | Actor.java | Java | [] | null | [] | package com.oracle.corejava.advance.t6.map;
public class Actor {
private String name;
private int age;
private String sex;
private String tz;
/**
* @param name
* @param age
* @param sex
* @param tz
*/
public Actor(String name, int age, String sex, String tz) {
super();
this.name = name;
this.age = age;
this.sex = sex;
this.tz = tz;
}
@Override
public String toString() {
return "Actor [name=" + name + ", age=" + age + ", sex=" + sex + ", tz=" + tz + "]";
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getTz() {
return tz;
}
public void setTz(String tz) {
this.tz = tz;
}
}
| 881 | 0.611805 | 0.61067 | 49 | 16.979591 | 15.609377 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.714286 | false | false | 15 |
3d2649b9fb170bf2ec3db79a26a6bb392f75f892 | 14,276,471,357,667 | e8fb2cb60fce9ed55a66c1add1026906ae414b4a | /src/com/cp/model/Salary.java | 459bbfdca0a09b0407df1becf521fcf98d02330a | [] | no_license | CodeDaMoWang/company | https://github.com/CodeDaMoWang/company | 62210850214dabf8c70881f879edf8fa648ef9a5 | 223f5213015d378f410039f2c09acf28017b2fe4 | refs/heads/master | 2021-09-01T05:17:53.599000 | 2017-12-25T02:18:32 | 2017-12-25T02:18:32 | 115,294,006 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.cp.model;
import java.sql.Date;
/**
* Created by 熊康 on 2017/12/19.
*/
public class Salary {
private Integer id;//流水号
private String staffNumber;//员工工号
private Integer basicSalary;//基础工资
private Integer bfSalary;//补发工资
private Integer deductSalary;//应扣工资
private Integer personalTax;//税收
private Integer socialSec;//社保
private Integer reservedFunds;//公积金
private Integer finalSalary;//实发工资
private Date time;//发放时间
public Salary( String staffNumber, Integer basicSalary, Integer bfSalary,
Integer deductSalary, Integer personalTax, Integer socialSec,
Integer reservedFunds, Integer finalSalary, Date time) {
this.staffNumber = staffNumber;
this.basicSalary = basicSalary;
this.bfSalary = bfSalary;
this.deductSalary = deductSalary;
this.personalTax = personalTax;
this.socialSec = socialSec;
this.reservedFunds = reservedFunds;
this.finalSalary = finalSalary;
this.time = time;
}
public Salary(){
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getStaffNumber() {
return staffNumber;
}
public void setStaffNumber(String staffNumber) {
this.staffNumber = staffNumber;
}
public Integer getBasicSalary() {
return basicSalary;
}
public void setBasicSalary(Integer basicSalary) {
this.basicSalary = basicSalary;
}
public Integer getBfSalary() {
return bfSalary;
}
public void setBfSalary(Integer bfSalary) {
this.bfSalary = bfSalary;
}
public Integer getDeductSalary() {
return deductSalary;
}
public void setDeductSalary(Integer deductSalary) {
this.deductSalary = deductSalary;
}
public Integer getPersonalTax() {
return personalTax;
}
public void setPersonalTax(Integer personalTax) {
this.personalTax = personalTax;
}
public Integer getSocialSec() {
return socialSec;
}
public void setSocialSec(Integer socialSec) {
this.socialSec = socialSec;
}
public Integer getReservedFunds() {
return reservedFunds;
}
public void setReservedFunds(Integer reservedFunds) {
this.reservedFunds = reservedFunds;
}
public Integer getFinalSalary() {
return finalSalary;
}
public void setFinalSalary(Integer finalSalary) {
this.finalSalary = finalSalary;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
@Override
public String toString() {
return "Salary{" +
"id=" + id +
", staffNumber='" + staffNumber + '\'' +
", basicSalary=" + basicSalary +
", bfSalary=" + bfSalary +
", deductSalary=" + deductSalary +
", personalTax=" + personalTax +
", socialSec=" + socialSec +
", reservedFunds=" + reservedFunds +
", finalSalary=" + finalSalary +
", time=" + time +
'}';
}
}
| UTF-8 | Java | 3,339 | java | Salary.java | Java | [
{
"context": ".model;\n\nimport java.sql.Date;\n\n/**\n * Created by 熊康 on 2017/12/19.\n */\npublic class Salary {\n priv",
"end": 66,
"score": 0.9956409931182861,
"start": 64,
"tag": "NAME",
"value": "熊康"
}
] | null | [] | package com.cp.model;
import java.sql.Date;
/**
* Created by 熊康 on 2017/12/19.
*/
public class Salary {
private Integer id;//流水号
private String staffNumber;//员工工号
private Integer basicSalary;//基础工资
private Integer bfSalary;//补发工资
private Integer deductSalary;//应扣工资
private Integer personalTax;//税收
private Integer socialSec;//社保
private Integer reservedFunds;//公积金
private Integer finalSalary;//实发工资
private Date time;//发放时间
public Salary( String staffNumber, Integer basicSalary, Integer bfSalary,
Integer deductSalary, Integer personalTax, Integer socialSec,
Integer reservedFunds, Integer finalSalary, Date time) {
this.staffNumber = staffNumber;
this.basicSalary = basicSalary;
this.bfSalary = bfSalary;
this.deductSalary = deductSalary;
this.personalTax = personalTax;
this.socialSec = socialSec;
this.reservedFunds = reservedFunds;
this.finalSalary = finalSalary;
this.time = time;
}
public Salary(){
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getStaffNumber() {
return staffNumber;
}
public void setStaffNumber(String staffNumber) {
this.staffNumber = staffNumber;
}
public Integer getBasicSalary() {
return basicSalary;
}
public void setBasicSalary(Integer basicSalary) {
this.basicSalary = basicSalary;
}
public Integer getBfSalary() {
return bfSalary;
}
public void setBfSalary(Integer bfSalary) {
this.bfSalary = bfSalary;
}
public Integer getDeductSalary() {
return deductSalary;
}
public void setDeductSalary(Integer deductSalary) {
this.deductSalary = deductSalary;
}
public Integer getPersonalTax() {
return personalTax;
}
public void setPersonalTax(Integer personalTax) {
this.personalTax = personalTax;
}
public Integer getSocialSec() {
return socialSec;
}
public void setSocialSec(Integer socialSec) {
this.socialSec = socialSec;
}
public Integer getReservedFunds() {
return reservedFunds;
}
public void setReservedFunds(Integer reservedFunds) {
this.reservedFunds = reservedFunds;
}
public Integer getFinalSalary() {
return finalSalary;
}
public void setFinalSalary(Integer finalSalary) {
this.finalSalary = finalSalary;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
@Override
public String toString() {
return "Salary{" +
"id=" + id +
", staffNumber='" + staffNumber + '\'' +
", basicSalary=" + basicSalary +
", bfSalary=" + bfSalary +
", deductSalary=" + deductSalary +
", personalTax=" + personalTax +
", socialSec=" + socialSec +
", reservedFunds=" + reservedFunds +
", finalSalary=" + finalSalary +
", time=" + time +
'}';
}
}
| 3,339 | 0.597184 | 0.594735 | 133 | 23.56391 | 19.671495 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.443609 | false | false | 15 |
0caf9b718bb169047d7d21b1fa459ff5ddeed38b | 34,050,500,748,493 | cf0978b3fe8def519852d128421600da0794de8f | /src/main/java/DDS/SGE/Dispositivo/IntervaloActivo.java | e9492d3a02193043ea0b99fceec1f6cef2d17b28 | [] | no_license | aleperaltabazas/tp-dds-2018 | https://github.com/aleperaltabazas/tp-dds-2018 | 5ec9360af0c6d521ec0087f9b24d1ff0750a745a | 96f7a969a71c430fb47963476c378da34e94f001 | refs/heads/master | 2022-07-10T19:28:35.127000 | 2019-08-30T22:59:48 | 2019-08-30T22:59:48 | 175,646,956 | 0 | 0 | null | false | 2022-06-21T00:59:15 | 2019-03-14T15:14:06 | 2019-08-30T23:00:20 | 2022-06-21T00:59:11 | 17,024 | 0 | 0 | 16 | Java | false | false | package DDS.SGE.Dispositivo;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class IntervaloActivo {
@Id
@GeneratedValue
private Long id;
LocalDateTime tiempoInicial;
LocalDateTime tiempoFinal;
protected IntervaloActivo() {}
public IntervaloActivo(LocalDateTime tiempoInicial, LocalDateTime tiempoFinal) {
this.tiempoInicial = tiempoInicial;
this.tiempoFinal = tiempoFinal;
}
public long getIntervaloEncendidoEnMinutos() {
return ChronoUnit.MINUTES.between(tiempoInicial, tiempoFinal);
}
public boolean ocurreDespuesDe(LocalDateTime fecha) {
return tiempoInicial.isAfter(fecha);
}
public boolean ocurreAntesDe(LocalDateTime fecha) {
return !ocurreDespuesDe(fecha);
}
public LocalDateTime getTiempoInicial() {
return this.tiempoInicial;
}
public LocalDateTime getTiempoFinal() {
return this.tiempoFinal;
}
}
| UTF-8 | Java | 995 | java | IntervaloActivo.java | Java | [] | null | [] | package DDS.SGE.Dispositivo;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class IntervaloActivo {
@Id
@GeneratedValue
private Long id;
LocalDateTime tiempoInicial;
LocalDateTime tiempoFinal;
protected IntervaloActivo() {}
public IntervaloActivo(LocalDateTime tiempoInicial, LocalDateTime tiempoFinal) {
this.tiempoInicial = tiempoInicial;
this.tiempoFinal = tiempoFinal;
}
public long getIntervaloEncendidoEnMinutos() {
return ChronoUnit.MINUTES.between(tiempoInicial, tiempoFinal);
}
public boolean ocurreDespuesDe(LocalDateTime fecha) {
return tiempoInicial.isAfter(fecha);
}
public boolean ocurreAntesDe(LocalDateTime fecha) {
return !ocurreDespuesDe(fecha);
}
public LocalDateTime getTiempoInicial() {
return this.tiempoInicial;
}
public LocalDateTime getTiempoFinal() {
return this.tiempoFinal;
}
}
| 995 | 0.78995 | 0.78995 | 44 | 21.613636 | 20.416367 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.272727 | false | false | 15 |
f0dfb009fa4c2d033c7f9b05b3233f9a6fa160fd | 20,315,195,371,560 | 6842a40e50c633a40f9542d16d996cc60eb6bbf6 | /java/GrantType.java | adbcc93f41ef11f52dba9ea4d43d5df4fb7af6ce | [] | no_license | typeguard/typed-consumer-complaints | https://github.com/typeguard/typed-consumer-complaints | ce2806946aef9f261eb5e3b130b3efb06fb70ad8 | 50554bbdcdb158c282c601c9175cad81a80aaee0 | refs/heads/master | 2021-05-04T15:00:29.141000 | 2018-08-18T00:31:46 | 2018-08-18T00:31:46 | 120,217,621 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package io.quicktype;
import java.util.Map;
import java.io.IOException;
import com.fasterxml.jackson.annotation.*;
public enum GrantType {
VIEWER;
@JsonValue
public String toValue() {
switch (this) {
case VIEWER: return "viewer";
}
return null;
}
@JsonCreator
public static GrantType forValue(String value) throws IOException {
if (value.equals("viewer")) return VIEWER;
throw new IOException("Cannot deserialize GrantType");
}
}
| UTF-8 | Java | 510 | java | GrantType.java | Java | [] | null | [] | package io.quicktype;
import java.util.Map;
import java.io.IOException;
import com.fasterxml.jackson.annotation.*;
public enum GrantType {
VIEWER;
@JsonValue
public String toValue() {
switch (this) {
case VIEWER: return "viewer";
}
return null;
}
@JsonCreator
public static GrantType forValue(String value) throws IOException {
if (value.equals("viewer")) return VIEWER;
throw new IOException("Cannot deserialize GrantType");
}
}
| 510 | 0.65098 | 0.65098 | 23 | 21.173914 | 19.584049 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.391304 | false | false | 15 |
4c7706d9ee1c79d72b31def97b1549052255bb24 | 14,156,212,253,222 | 05005c625729dd9f729e435ac5b1e8b0a042f0fa | /kn-spring-start/src/main/java/com/kenan/spring/config/CustomApplicationContextInitializer.java | fef2847a0aae166db7bc6f0b2d065e48bf82afa4 | [] | no_license | dashboardijo/kn-spring | https://github.com/dashboardijo/kn-spring | d74d020dc256b52d653fcee25ddb710c2437278f | 140ff363b9fff43f4d9683a0663e921af5160c43 | refs/heads/master | 2023-08-22T21:16:25.353000 | 2020-11-02T08:51:46 | 2020-11-02T08:51:46 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.kenan.spring.config;
import com.kenan.spring.util.ComponentUtils;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
/**
* 这是整个spring容器在刷新之前初始化ConfigurableApplicationContext的回调接口,
* 简单来说,就是在容器刷新之前调用此类的initialize方法。这个点允许被用户自己扩展。
* 可以在整个spring容器还没被初始化之前做一些事情。例如 版本检测,字节码注入等操作。
*
* @author kenan
*/
public class CustomApplicationContextInitializer implements ApplicationContextInitializer {
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
ComponentUtils.assertSpringVersion();
}
}
| UTF-8 | Java | 824 | java | CustomApplicationContextInitializer.java | Java | [
{
"context": "ing容器还没被初始化之前做一些事情。例如 版本检测,字节码注入等操作。\n *\n * @author kenan\n */\npublic class CustomApplicationContextInitiali",
"end": 393,
"score": 0.998903751373291,
"start": 388,
"tag": "USERNAME",
"value": "kenan"
}
] | null | [] | package com.kenan.spring.config;
import com.kenan.spring.util.ComponentUtils;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
/**
* 这是整个spring容器在刷新之前初始化ConfigurableApplicationContext的回调接口,
* 简单来说,就是在容器刷新之前调用此类的initialize方法。这个点允许被用户自己扩展。
* 可以在整个spring容器还没被初始化之前做一些事情。例如 版本检测,字节码注入等操作。
*
* @author kenan
*/
public class CustomApplicationContextInitializer implements ApplicationContextInitializer {
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
ComponentUtils.assertSpringVersion();
}
}
| 824 | 0.825 | 0.825 | 21 | 29.476191 | 29.52742 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.238095 | false | false | 15 |
85a2c0e6a6e69368931a6957641e8b21535aed72 | 34,316,788,728,008 | 57ebb672b89c14c9d7bd8ac86c0045750e3820a4 | /extjs-samples/mastering-extjs-java/src/main/java/sivalabs/app/web/controllers/ViewController.java | 3ffef1b339899111fe6bd928270c8d3cbcb5068a | [] | no_license | cryptopk-others/proof-of-concepts | https://github.com/cryptopk-others/proof-of-concepts | cb12e21b7ff5486818adeca9103422be839f2928 | e0ec8c1ce25c2acc6e144f2a54446082e819b248 | refs/heads/master | 2021-06-06T16:29:44.154000 | 2016-07-14T08:20:44 | 2016-07-14T08:20:44 | 64,490,733 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
*
*/
package sivalabs.app.web.controllers;
import java.util.Set;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import sivalabs.app.entities.Actor;
import sivalabs.app.entities.Category;
import sivalabs.app.entities.City;
import sivalabs.app.entities.Country;
import sivalabs.app.entities.Group;
import sivalabs.app.entities.Language;
import sivalabs.app.entities.Menu;
import sivalabs.app.entities.User;
import sivalabs.app.repositories.ActorRepository;
import sivalabs.app.repositories.CategoryRepository;
import sivalabs.app.repositories.CityRepository;
import sivalabs.app.repositories.CountryRepository;
import sivalabs.app.repositories.GroupRepository;
import sivalabs.app.repositories.LanguageRepository;
import sivalabs.app.services.UserService;
import sivalabs.app.web.viewmodels.GenericResponse;
import sivalabs.app.web.viewmodels.GroupsModel;
import sivalabs.app.web.viewmodels.MenuModel;
import sivalabs.app.web.viewmodels.StaticDataModel;
/**
* @author Siva
*
*/
@RestController
public class ViewController
{
@Autowired
UserService userService;
@Autowired GroupRepository groupRepository;
//@Autowired StaticDataRepository staticDataRepository;
@Autowired ActorRepository actorRepository;
@Autowired CategoryRepository categoryRepository;
@Autowired CityRepository cityRepository;
@Autowired CountryRepository countryRepository;
@Autowired LanguageRepository languageRepository;
@RequestMapping(value="menu", produces=MediaType.APPLICATION_JSON_VALUE)
public MenuModel getMenuJson(@RequestParam("userId")int userId) {
User user = userService.findUserById(userId);
Group group = user.getGroup();
Set<Menu> menus = group.getMenus();
MenuModel menu = new MenuModel();
menu.populate(menus);
return menu;
}
@RequestMapping(value="security/group", produces=MediaType.APPLICATION_JSON_VALUE)
public GroupsModel findAllGroups(HttpSession session) {
GroupsModel groupsModel = new GroupsModel(groupRepository.findAll());
return groupsModel ;
}
@RequestMapping(value="staticData/list", produces=MediaType.APPLICATION_JSON_VALUE,params="entity=Category")
public GenericResponse<Category> staticDataCategory() {
GenericResponse<Category> genericResponse = new GenericResponse<>();
genericResponse.setData(categoryRepository.findAll());
return genericResponse;
}
@RequestMapping(value="staticData/list", produces=MediaType.APPLICATION_JSON_VALUE,params="entity=Country")
public GenericResponse<Country> staticDataCountry() {
GenericResponse<Country> genericResponse = new GenericResponse<>();
genericResponse.setData(countryRepository.findAll());
return genericResponse;
}
@RequestMapping(value="staticData/list", produces=MediaType.APPLICATION_JSON_VALUE,params="entity=Language")
public GenericResponse<Language> staticDataLanguage() {
GenericResponse<Language> genericResponse = new GenericResponse<>();
genericResponse.setData(languageRepository.findAll());
return genericResponse;
}
@RequestMapping(value="staticData/list", produces=MediaType.APPLICATION_JSON_VALUE,params="entity=City")
public GenericResponse<City> staticDataCity() {
GenericResponse<City> genericResponse = new GenericResponse<>();
genericResponse.setData(cityRepository.findAll());
return genericResponse;
}
@RequestMapping(value="staticData/list", produces={MediaType.APPLICATION_JSON_VALUE,MediaType.APPLICATION_XML_VALUE },params="entity=Actor")
public GenericResponse<Actor> staticDataActor() {
GenericResponse<Actor> genericResponse = new GenericResponse<>();
genericResponse.setData(actorRepository.findAll());
return genericResponse;
}
@RequestMapping(value="staticData/create", params="entity=Actor")
public void createActor(StaticDataModel<Actor> dataModel) {
System.out.println(dataModel.getEntity()+":"+dataModel.getData());
}
@RequestMapping(value="staticData/create", params="entity=City")
public void createCity(StaticDataModel<City> dataModel) {
System.out.println(dataModel.getEntity()+":"+dataModel.getData());
}
@RequestMapping(value="staticData/create", params="entity=Country")
public void createCountry(StaticDataModel<Country> dataModel) {
System.out.println(dataModel.getEntity()+":"+dataModel.getData());
}
@RequestMapping(value="staticData/create", params="entity=Category")
public void createCategory(StaticDataModel<Category> dataModel) {
System.out.println(dataModel.getEntity()+":"+dataModel.getData());
}
@RequestMapping(value="staticData/create", params="entity=Language")
public void createLanguage(StaticDataModel<Language> dataModel) {
System.out.println(dataModel.getEntity()+":"+dataModel.getData());
}
}
| UTF-8 | Java | 4,964 | java | ViewController.java | Java | [
{
"context": "pp.web.viewmodels.StaticDataModel;\n\n/**\n * @author Siva\n *\n */\n@RestController\npublic class ViewControlle",
"end": 1268,
"score": 0.9948949813842773,
"start": 1264,
"tag": "NAME",
"value": "Siva"
}
] | null | [] | /**
*
*/
package sivalabs.app.web.controllers;
import java.util.Set;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import sivalabs.app.entities.Actor;
import sivalabs.app.entities.Category;
import sivalabs.app.entities.City;
import sivalabs.app.entities.Country;
import sivalabs.app.entities.Group;
import sivalabs.app.entities.Language;
import sivalabs.app.entities.Menu;
import sivalabs.app.entities.User;
import sivalabs.app.repositories.ActorRepository;
import sivalabs.app.repositories.CategoryRepository;
import sivalabs.app.repositories.CityRepository;
import sivalabs.app.repositories.CountryRepository;
import sivalabs.app.repositories.GroupRepository;
import sivalabs.app.repositories.LanguageRepository;
import sivalabs.app.services.UserService;
import sivalabs.app.web.viewmodels.GenericResponse;
import sivalabs.app.web.viewmodels.GroupsModel;
import sivalabs.app.web.viewmodels.MenuModel;
import sivalabs.app.web.viewmodels.StaticDataModel;
/**
* @author Siva
*
*/
@RestController
public class ViewController
{
@Autowired
UserService userService;
@Autowired GroupRepository groupRepository;
//@Autowired StaticDataRepository staticDataRepository;
@Autowired ActorRepository actorRepository;
@Autowired CategoryRepository categoryRepository;
@Autowired CityRepository cityRepository;
@Autowired CountryRepository countryRepository;
@Autowired LanguageRepository languageRepository;
@RequestMapping(value="menu", produces=MediaType.APPLICATION_JSON_VALUE)
public MenuModel getMenuJson(@RequestParam("userId")int userId) {
User user = userService.findUserById(userId);
Group group = user.getGroup();
Set<Menu> menus = group.getMenus();
MenuModel menu = new MenuModel();
menu.populate(menus);
return menu;
}
@RequestMapping(value="security/group", produces=MediaType.APPLICATION_JSON_VALUE)
public GroupsModel findAllGroups(HttpSession session) {
GroupsModel groupsModel = new GroupsModel(groupRepository.findAll());
return groupsModel ;
}
@RequestMapping(value="staticData/list", produces=MediaType.APPLICATION_JSON_VALUE,params="entity=Category")
public GenericResponse<Category> staticDataCategory() {
GenericResponse<Category> genericResponse = new GenericResponse<>();
genericResponse.setData(categoryRepository.findAll());
return genericResponse;
}
@RequestMapping(value="staticData/list", produces=MediaType.APPLICATION_JSON_VALUE,params="entity=Country")
public GenericResponse<Country> staticDataCountry() {
GenericResponse<Country> genericResponse = new GenericResponse<>();
genericResponse.setData(countryRepository.findAll());
return genericResponse;
}
@RequestMapping(value="staticData/list", produces=MediaType.APPLICATION_JSON_VALUE,params="entity=Language")
public GenericResponse<Language> staticDataLanguage() {
GenericResponse<Language> genericResponse = new GenericResponse<>();
genericResponse.setData(languageRepository.findAll());
return genericResponse;
}
@RequestMapping(value="staticData/list", produces=MediaType.APPLICATION_JSON_VALUE,params="entity=City")
public GenericResponse<City> staticDataCity() {
GenericResponse<City> genericResponse = new GenericResponse<>();
genericResponse.setData(cityRepository.findAll());
return genericResponse;
}
@RequestMapping(value="staticData/list", produces={MediaType.APPLICATION_JSON_VALUE,MediaType.APPLICATION_XML_VALUE },params="entity=Actor")
public GenericResponse<Actor> staticDataActor() {
GenericResponse<Actor> genericResponse = new GenericResponse<>();
genericResponse.setData(actorRepository.findAll());
return genericResponse;
}
@RequestMapping(value="staticData/create", params="entity=Actor")
public void createActor(StaticDataModel<Actor> dataModel) {
System.out.println(dataModel.getEntity()+":"+dataModel.getData());
}
@RequestMapping(value="staticData/create", params="entity=City")
public void createCity(StaticDataModel<City> dataModel) {
System.out.println(dataModel.getEntity()+":"+dataModel.getData());
}
@RequestMapping(value="staticData/create", params="entity=Country")
public void createCountry(StaticDataModel<Country> dataModel) {
System.out.println(dataModel.getEntity()+":"+dataModel.getData());
}
@RequestMapping(value="staticData/create", params="entity=Category")
public void createCategory(StaticDataModel<Category> dataModel) {
System.out.println(dataModel.getEntity()+":"+dataModel.getData());
}
@RequestMapping(value="staticData/create", params="entity=Language")
public void createLanguage(StaticDataModel<Language> dataModel) {
System.out.println(dataModel.getEntity()+":"+dataModel.getData());
}
}
| 4,964 | 0.795931 | 0.795931 | 132 | 36.60606 | 29.986805 | 141 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.606061 | false | false | 15 |
7695c689928e4782937ded703a3f46af1b9e5b63 | 38,826,504,386,587 | ce5edf5a5ec543e9b476e51670a7e8621745e061 | /src/com/wanma/client/services/CableService.java | 37830d5f2b794cb0153b5cf5ea7494c9b404c66a | [] | no_license | XiangjunFu/IONM | https://github.com/XiangjunFu/IONM | 91028c21896a1487f731d6e02869fa141a7469d2 | 839fcc56e332948ad8ac11eed19cb1e89a8384d5 | refs/heads/master | 2021-01-10T14:37:17.662000 | 2015-10-18T14:11:17 | 2015-10-18T14:11:17 | 44,418,781 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wanma.client.services;
import java.util.List;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.wanma.domain.Cable;
import com.wanma.domain.CableSpan;
import com.wanma.domain.Fiber;
@RemoteServiceRelativePath("cableService")
public interface CableService extends RemoteService {
public String addCable(Cable cable);
public List<Cable> getCables();
public Boolean deleteCable(String cableName);
public Boolean deleteCableSpan(String code);
public List<CableSpan> getAllCableSpan();
public Cable getCableByCableName(String cableName);
public void updateCable(Cable cable);
public CableSpan getCableSpanByCode(String code);
public String addCableSpan(CableSpan cableSpan);
public void updateCableSpan(CableSpan cableSpan);
public List<Fiber> getAllFibers();
public boolean deleteFiber(String fiberCode);
public String addFiber(Fiber fiber);
public Fiber getFiberByFiberCode(String code);
public void updateFiber(Fiber fiber);
public int updateFiberByLogicalNo(String cableSpanCode,int logicalNo,String deviceName, String aPortCode);
}
| UTF-8 | Java | 1,218 | java | CableService.java | Java | [] | null | [] | package com.wanma.client.services;
import java.util.List;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.wanma.domain.Cable;
import com.wanma.domain.CableSpan;
import com.wanma.domain.Fiber;
@RemoteServiceRelativePath("cableService")
public interface CableService extends RemoteService {
public String addCable(Cable cable);
public List<Cable> getCables();
public Boolean deleteCable(String cableName);
public Boolean deleteCableSpan(String code);
public List<CableSpan> getAllCableSpan();
public Cable getCableByCableName(String cableName);
public void updateCable(Cable cable);
public CableSpan getCableSpanByCode(String code);
public String addCableSpan(CableSpan cableSpan);
public void updateCableSpan(CableSpan cableSpan);
public List<Fiber> getAllFibers();
public boolean deleteFiber(String fiberCode);
public String addFiber(Fiber fiber);
public Fiber getFiberByFiberCode(String code);
public void updateFiber(Fiber fiber);
public int updateFiberByLogicalNo(String cableSpanCode,int logicalNo,String deviceName, String aPortCode);
}
| 1,218 | 0.770936 | 0.770936 | 45 | 25.066668 | 24.661621 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.266667 | false | false | 15 |
99a3cfad1ebd3baf5a56e3021cfd21ffde9d30bb | 36,661,840,847,410 | 3a211508539ce3ed1f0b497dd5143034f93cc52f | /5B/src/main/java/entities/Available.java | 4cefce90e6b0654048f1d9f8fac575919ea865ae | [] | no_license | Pastornak/database_labs | https://github.com/Pastornak/database_labs | 9bc68837dc32394291a5365b153a60553774b13e | e2f25cc9dc7f80cfd664433e44be92479343d57d | refs/heads/master | 2021-09-01T11:53:40.636000 | 2017-12-26T21:00:10 | 2017-12-26T21:00:10 | 115,454,082 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package entities;
import javax.persistence.*;
import java.io.Serializable;
@Entity
@Table(name = "available", schema = "pasternak_5")
public class Available implements Serializable{
@EmbeddedId
private AvailablePK pk;
public Available(){}
@Override
public boolean equals(Object o) {
return pk.equals(o);
}
@Override
public int hashCode() {
return pk.hashCode();
}
public void setAvailablePK(AvailablePK availablePK){
this.pk = availablePK;
}
public int getPerson() {
return pk.getId_person();
}
public void setPerson(int person) {
this.pk.setId_person(person);
}
public int getMessanger() {
return pk.getId_messanger();
}
public void setMessanger(int messanger) {
this.pk.setId_messanger(messanger);
}
}
| UTF-8 | Java | 847 | java | Available.java | Java | [] | null | [] | package entities;
import javax.persistence.*;
import java.io.Serializable;
@Entity
@Table(name = "available", schema = "pasternak_5")
public class Available implements Serializable{
@EmbeddedId
private AvailablePK pk;
public Available(){}
@Override
public boolean equals(Object o) {
return pk.equals(o);
}
@Override
public int hashCode() {
return pk.hashCode();
}
public void setAvailablePK(AvailablePK availablePK){
this.pk = availablePK;
}
public int getPerson() {
return pk.getId_person();
}
public void setPerson(int person) {
this.pk.setId_person(person);
}
public int getMessanger() {
return pk.getId_messanger();
}
public void setMessanger(int messanger) {
this.pk.setId_messanger(messanger);
}
}
| 847 | 0.631641 | 0.63046 | 44 | 18.25 | 16.923794 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.272727 | false | false | 15 |
084184fa4292698dc802a2e73a84ba51e4de1f01 | 9,199,819,994,960 | 92fc479f9667c93489240c5af40735b801379a78 | /src/main/java/solutions/autorun/invoicemanager/service/dto/package-info.java | d04124f5cc9efabaad58668847a62312bfc598b9 | [] | no_license | mszaranek/invoicemanagerj | https://github.com/mszaranek/invoicemanagerj | 2e5fce0f944ba7b2a918b0b2ee8dd124bbbac49c | de64150bb6b26b5f0527b209aeca7e764bb6527d | refs/heads/master | 2020-04-11T20:48:19.771000 | 2018-12-17T06:14:45 | 2018-12-17T06:14:45 | 162,083,387 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Data Transfer Objects.
*/
package solutions.autorun.invoicemanager.service.dto;
| UTF-8 | Java | 88 | java | package-info.java | Java | [] | null | [] | /**
* Data Transfer Objects.
*/
package solutions.autorun.invoicemanager.service.dto;
| 88 | 0.75 | 0.75 | 4 | 21 | 20.542639 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 15 |
1b0a7558ba5df255c1db3e2d21209b0ba7bb6885 | 37,915,971,300,467 | 44bc8f347113e64dab1d67547c23b5422b3ff80e | /virtualltedemo/src/main/java/com/flyzebra/virtuallte/MainActivity.java | 04df7cf889ed4490519fc260fc84073fe5785195 | [] | no_license | TTFlyzebra/VirtualLTE | https://github.com/TTFlyzebra/VirtualLTE | dba274be527f5b0266b9c1e85a07f9fbc1452687 | 93383f26851716dbf6c3dba7e75e81d693e6544c | refs/heads/master | 2021-02-12T11:12:58.881000 | 2020-03-24T23:52:31 | 2020-03-24T23:52:31 | 243,887,318 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.flyzebra.virtuallte;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void goNetworkConfigure(View view) {
startActivity(new Intent(this,NetworkActivity.class));
}
public void goSimConfigure(View view) {
startActivity(new Intent(this,SimConfigureActivity.class));
}
public void goATCommandTest(View view) {
startActivity(new Intent(this,ATComandActivity.class));
}
public void goByteStringTool(View view) {
startActivity(new Intent(this,ByteStringActivity.class));
}
}
| UTF-8 | Java | 865 | java | MainActivity.java | Java | [] | null | [] | package com.flyzebra.virtuallte;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void goNetworkConfigure(View view) {
startActivity(new Intent(this,NetworkActivity.class));
}
public void goSimConfigure(View view) {
startActivity(new Intent(this,SimConfigureActivity.class));
}
public void goATCommandTest(View view) {
startActivity(new Intent(this,ATComandActivity.class));
}
public void goByteStringTool(View view) {
startActivity(new Intent(this,ByteStringActivity.class));
}
}
| 865 | 0.72948 | 0.72948 | 31 | 26.903225 | 24.019287 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.483871 | false | false | 15 |
1d50e8d6469c892d35886b0e8e079fe1632dacf7 | 23,862,838,362,436 | 9be6c67db256f0da2061e2750d7bf819a25e38bb | /packet/NetChannelDimTrip.java | 47066005078c6fb060e7b07581d51a7eed3a3efb | [] | no_license | Tsuteto/TofuCraft-MC1.6.2 | https://github.com/Tsuteto/TofuCraft-MC1.6.2 | f1d00e172b860d1545269b1a26982aca966c5510 | ad8e1461bd812a4d87294e65247cfb1b0ea99d59 | refs/heads/master | 2016-08-05T10:44:04.183000 | 2014-08-17T15:16:02 | 2014-08-17T15:16:02 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package tsuteto.tofu.packet;
import java.util.Random;
import net.minecraft.client.Minecraft;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.network.Player;
public class NetChannelDimTrip implements INetChannelHandler
{
private Random rand = new Random();
@Override
public void onChannelData(INetworkManager manager, Packet250CustomPayload packet, Player player)
{
Minecraft mc = FMLClientHandler.instance().getClient();
mc.sndManager.playSoundFX("portal.trigger", 1.0F, this.rand.nextFloat() * 0.4F + 0.8F);
}
}
| UTF-8 | Java | 684 | java | NetChannelDimTrip.java | Java | [] | null | [] | package tsuteto.tofu.packet;
import java.util.Random;
import net.minecraft.client.Minecraft;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.network.Player;
public class NetChannelDimTrip implements INetChannelHandler
{
private Random rand = new Random();
@Override
public void onChannelData(INetworkManager manager, Packet250CustomPayload packet, Player player)
{
Minecraft mc = FMLClientHandler.instance().getClient();
mc.sndManager.playSoundFX("portal.trigger", 1.0F, this.rand.nextFloat() * 0.4F + 0.8F);
}
}
| 684 | 0.766082 | 0.748538 | 22 | 30.09091 | 30.470417 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.636364 | false | false | 15 |
c70bb007845da32a004608890893d47bb2edfc97 | 10,015,863,786,719 | defa8b83e22ac7538bb581308e6291241105e227 | /app/src/main/java/com/commandus/vapidchatter/activity/Settings.java | 6f1175c4f96d9368bea2fb83bd64f9c04c022f69 | [] | no_license | commandus/vapidchatter | https://github.com/commandus/vapidchatter | 0576fb96cfc8bdc68e161669c402e3e5e9a588ca | f3d9be8176593259ca52de2ed43f473ecf0795e8 | refs/heads/master | 2022-08-16T21:45:54.228000 | 2022-08-05T07:03:05 | 2022-08-05T07:03:05 | 253,727,212 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.commandus.vapidchatter.activity;
import android.app.Activity;
import android.content.ClipData;
import android.content.ClipDescription;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;
import com.commandus.vapidchatter.wpn.Config;
import com.commandus.vapidchatter.wpn.Subscription;
import com.commandus.vapidchatter.wpn.SubscriptionPropertiesList;
import com.commandus.vapidchatter.wpn.VapidClient;
import com.commandus.vapidchatter.wpn.wpnAndroid;
import com.google.zxing.integration.android.IntentIntegrator;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import static android.content.ClipDescription.MIMETYPE_TEXT_PLAIN;
public class Settings {
public static final String VAPID_PUBLIC_KEY = "publicKey";
public static final String VAPID_AUTH_SECRET = "authSecret";
public static final String VAPID_TOKEN = "token";
public static final String SUBSCRIPTION = "subscription";
private static final String TAG = Settings.class.getSimpleName();
private static final String LINK_PREFIX = "https://vapidchatter.commandus.com/code/?";
private static VapidClient mVapidClient = null;
private SubscriptionPropertiesList subscriptionPropertiesList;
private static Settings mInstance = null;
private final Context context;
static final String PREFS_NAME = "vapidchatter";
private static final String PREF_IPV6_LIST = "ipv6";
public Settings(Context context) {
this.context = context;
load();
}
public synchronized static VapidClient getVapidClient(Context context) {
if (mVapidClient == null) {
mVapidClient = new VapidClient(context);
}
return mVapidClient;
}
public synchronized static Settings getInstance(Context context) {
if (mInstance == null) {
mInstance = new Settings(context);
}
return mInstance;
}
public static boolean checkVapidPublicKey(String vapidPublicKey) {
if (vapidPublicKey == null) {
return false;
}
return wpnAndroid.checkVapidPublicKey(vapidPublicKey);
}
public static boolean checkVapidAuthSecret(String authSecret) {
if (authSecret == null) {
return false;
}
return wpnAndroid.checkVapidAuthSecret(authSecret);
}
public static boolean checkVapidToken(String subscriptionToken) {
if (subscriptionToken == null) {
return false;
}
return wpnAndroid.checkVapidToken(subscriptionToken);
}
/**
* Get text from the clipboard
* @param context application context
* @return clipboard text
*/
public static String getClipboardText(Context context) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
String pasteData = "";
if (clipboard != null && clipboard.hasPrimaryClip()) {
try {
ClipDescription clipDescription = clipboard.getPrimaryClipDescription();
if (clipDescription != null && clipDescription.hasMimeType(MIMETYPE_TEXT_PLAIN)) {
ClipData clip = clipboard.getPrimaryClip();
if (clip != null) {
ClipData.Item item = clip.getItemAt(0);
pasteData = item.getText().toString();
}
}
} catch (NullPointerException e) {
Log.e(TAG, e.toString());
}
}
return pasteData;
}
public static Subscription subscribe2VapidKey(Context context, String vapidPublicKey, String authSecret) {
String env = Settings.getVapidClient(context).getEnvDescriptor();
return wpnAndroid.subscribe2VapidPublicKey(env, vapidPublicKey, authSecret);
}
public static void startScanCode(Activity context, String prompt) {
IntentIntegrator integrator = new IntentIntegrator(context);
integrator.setOrientationLocked(false);
integrator.setPrompt(prompt);
integrator.setCaptureActivity(CaptureActivityPortrait.class);
integrator.initiateScan();
}
public static String getShareLink(String publicKey, String auth) {
try {
return LINK_PREFIX
+ Settings.VAPID_PUBLIC_KEY + "=" + URLEncoder.encode(publicKey, "utf-8") + "&"
+ Settings.VAPID_AUTH_SECRET + "=" + URLEncoder.encode(auth, "utf-8");
} catch (UnsupportedEncodingException e) {
Log.e(TAG, e.toString());
return LINK_PREFIX;
}
}
/**
* Return share link from the VAPID token
* @param token subscription token
* @param authSecret auth secret
* @return share link from the VAPID token
*/
public static String getShareLinkSubscription(String token, String authSecret) {
try {
return LINK_PREFIX
+ Settings.VAPID_TOKEN + "=" + URLEncoder.encode(token, "utf-8") + "&"
+ Settings.VAPID_AUTH_SECRET + "=" + URLEncoder.encode(authSecret, "utf-8");
} catch (UnsupportedEncodingException e) {
Log.e(TAG, e.toString());
return LINK_PREFIX;
}
}
public void save(Config config) {
// save client's subscriptions
VapidClient client = Settings.getVapidClient(context);
String env = client.getEnvDescriptor();
String js = config.toString();
wpnAndroid.setConfigJson(env, js);
// wpnAndroid.saveEnv(env);
// save IPv6 address list
SharedPreferences settings = context.getSharedPreferences(PREFS_NAME, 0);
SharedPreferences.Editor editor = settings.edit();
if (subscriptionPropertiesList != null) {
editor.putString(PREF_IPV6_LIST, subscriptionPropertiesList.toString());
}
editor.apply();
}
private void load() {
SharedPreferences settings = context.getSharedPreferences(PREFS_NAME, 0);
String js = settings.getString(PREF_IPV6_LIST, "");
subscriptionPropertiesList = new SubscriptionPropertiesList(js);
}
}
| UTF-8 | Java | 6,243 | java | Settings.java | Java | [] | null | [] | package com.commandus.vapidchatter.activity;
import android.app.Activity;
import android.content.ClipData;
import android.content.ClipDescription;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;
import com.commandus.vapidchatter.wpn.Config;
import com.commandus.vapidchatter.wpn.Subscription;
import com.commandus.vapidchatter.wpn.SubscriptionPropertiesList;
import com.commandus.vapidchatter.wpn.VapidClient;
import com.commandus.vapidchatter.wpn.wpnAndroid;
import com.google.zxing.integration.android.IntentIntegrator;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import static android.content.ClipDescription.MIMETYPE_TEXT_PLAIN;
public class Settings {
public static final String VAPID_PUBLIC_KEY = "publicKey";
public static final String VAPID_AUTH_SECRET = "authSecret";
public static final String VAPID_TOKEN = "token";
public static final String SUBSCRIPTION = "subscription";
private static final String TAG = Settings.class.getSimpleName();
private static final String LINK_PREFIX = "https://vapidchatter.commandus.com/code/?";
private static VapidClient mVapidClient = null;
private SubscriptionPropertiesList subscriptionPropertiesList;
private static Settings mInstance = null;
private final Context context;
static final String PREFS_NAME = "vapidchatter";
private static final String PREF_IPV6_LIST = "ipv6";
public Settings(Context context) {
this.context = context;
load();
}
public synchronized static VapidClient getVapidClient(Context context) {
if (mVapidClient == null) {
mVapidClient = new VapidClient(context);
}
return mVapidClient;
}
public synchronized static Settings getInstance(Context context) {
if (mInstance == null) {
mInstance = new Settings(context);
}
return mInstance;
}
public static boolean checkVapidPublicKey(String vapidPublicKey) {
if (vapidPublicKey == null) {
return false;
}
return wpnAndroid.checkVapidPublicKey(vapidPublicKey);
}
public static boolean checkVapidAuthSecret(String authSecret) {
if (authSecret == null) {
return false;
}
return wpnAndroid.checkVapidAuthSecret(authSecret);
}
public static boolean checkVapidToken(String subscriptionToken) {
if (subscriptionToken == null) {
return false;
}
return wpnAndroid.checkVapidToken(subscriptionToken);
}
/**
* Get text from the clipboard
* @param context application context
* @return clipboard text
*/
public static String getClipboardText(Context context) {
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
String pasteData = "";
if (clipboard != null && clipboard.hasPrimaryClip()) {
try {
ClipDescription clipDescription = clipboard.getPrimaryClipDescription();
if (clipDescription != null && clipDescription.hasMimeType(MIMETYPE_TEXT_PLAIN)) {
ClipData clip = clipboard.getPrimaryClip();
if (clip != null) {
ClipData.Item item = clip.getItemAt(0);
pasteData = item.getText().toString();
}
}
} catch (NullPointerException e) {
Log.e(TAG, e.toString());
}
}
return pasteData;
}
public static Subscription subscribe2VapidKey(Context context, String vapidPublicKey, String authSecret) {
String env = Settings.getVapidClient(context).getEnvDescriptor();
return wpnAndroid.subscribe2VapidPublicKey(env, vapidPublicKey, authSecret);
}
public static void startScanCode(Activity context, String prompt) {
IntentIntegrator integrator = new IntentIntegrator(context);
integrator.setOrientationLocked(false);
integrator.setPrompt(prompt);
integrator.setCaptureActivity(CaptureActivityPortrait.class);
integrator.initiateScan();
}
public static String getShareLink(String publicKey, String auth) {
try {
return LINK_PREFIX
+ Settings.VAPID_PUBLIC_KEY + "=" + URLEncoder.encode(publicKey, "utf-8") + "&"
+ Settings.VAPID_AUTH_SECRET + "=" + URLEncoder.encode(auth, "utf-8");
} catch (UnsupportedEncodingException e) {
Log.e(TAG, e.toString());
return LINK_PREFIX;
}
}
/**
* Return share link from the VAPID token
* @param token subscription token
* @param authSecret auth secret
* @return share link from the VAPID token
*/
public static String getShareLinkSubscription(String token, String authSecret) {
try {
return LINK_PREFIX
+ Settings.VAPID_TOKEN + "=" + URLEncoder.encode(token, "utf-8") + "&"
+ Settings.VAPID_AUTH_SECRET + "=" + URLEncoder.encode(authSecret, "utf-8");
} catch (UnsupportedEncodingException e) {
Log.e(TAG, e.toString());
return LINK_PREFIX;
}
}
public void save(Config config) {
// save client's subscriptions
VapidClient client = Settings.getVapidClient(context);
String env = client.getEnvDescriptor();
String js = config.toString();
wpnAndroid.setConfigJson(env, js);
// wpnAndroid.saveEnv(env);
// save IPv6 address list
SharedPreferences settings = context.getSharedPreferences(PREFS_NAME, 0);
SharedPreferences.Editor editor = settings.edit();
if (subscriptionPropertiesList != null) {
editor.putString(PREF_IPV6_LIST, subscriptionPropertiesList.toString());
}
editor.apply();
}
private void load() {
SharedPreferences settings = context.getSharedPreferences(PREFS_NAME, 0);
String js = settings.getString(PREF_IPV6_LIST, "");
subscriptionPropertiesList = new SubscriptionPropertiesList(js);
}
}
| 6,243 | 0.659138 | 0.656896 | 170 | 35.72353 | 27.895605 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.547059 | false | false | 15 |
a8bebd7f3dc4b07ba7b2a1f2dc324bb8ade4e771 | 39,195,871,568,028 | c25f4888c78cad169ad9f394467f949ab656d2c3 | /Project_Dementia_Game/PluginProject/unity/src/main/java/com/theavenger/unity/PluginTest.java | 3a9a2d19536e49981462833001cf3ab1acf50008 | [] | no_license | mal977/D.O.T | https://github.com/mal977/D.O.T | 6259f41fa070cc1e0942cf7fc468d709facccf41 | cb923eb6cf8aba2a6135ca00400dab1189103502 | refs/heads/main | 2023-07-29T10:39:29.344000 | 2021-03-22T10:42:36 | 2021-03-22T10:42:36 | 401,633,944 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.theavenger.unity;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.os.Build;
import android.util.Log;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
public class PluginTest {
private static final PluginTest instance = new PluginTest();
private static final String TAG = "UnityAndroidMalPlugin";
private static final String CHANNEL_ID = "Demencia";
public long startTime;
public static Activity mainActivity;
public static PluginTest getInstance() {
return instance;
}
private PluginTest(){
Log.i(TAG,"PlugInTest" + System.currentTimeMillis());
startTime = System.currentTimeMillis();
}
public void showNotification() {
Log.i(TAG,mainActivity.toString());
NotificationCompat.Builder builder = new NotificationCompat.Builder(mainActivity.getApplicationContext(),CHANNEL_ID)
.setContentTitle("Hello")
.setContentText("Err this is a hello message")
.setPriority(NotificationCompat.PRIORITY_DEFAULT);
createNotificationChannel();
NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(mainActivity.getApplicationContext());
notificationManagerCompat.notify(1,builder.build());
}
private void createNotificationChannel() {
// Create the NotificationChannel, but only on API 26+ because
// the NotificationChannel class is new and not in the support library
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
CharSequence name = "demencia_channel";
String description = "demencia_notifications";
int importance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
channel.setDescription(description);
// Register the channel with the system; you can't change the importance
// or other notification behaviors after this
NotificationManager notificationManager = mainActivity.getSystemService(NotificationManager.class);
notificationManager.createNotificationChannel(channel);
}
}
public double getElapsedTime(){
return (System.currentTimeMillis() - startTime)/1000.0f;
}
}
| UTF-8 | Java | 2,475 | java | PluginTest.java | Java | [
{
"context": "n\";\n private static final String CHANNEL_ID = \"Demencia\";\n\n public long startTime;\n\n public static ",
"end": 530,
"score": 0.720005989074707,
"start": 522,
"tag": "USERNAME",
"value": "Demencia"
}
] | null | [] | package com.theavenger.unity;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.os.Build;
import android.util.Log;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
public class PluginTest {
private static final PluginTest instance = new PluginTest();
private static final String TAG = "UnityAndroidMalPlugin";
private static final String CHANNEL_ID = "Demencia";
public long startTime;
public static Activity mainActivity;
public static PluginTest getInstance() {
return instance;
}
private PluginTest(){
Log.i(TAG,"PlugInTest" + System.currentTimeMillis());
startTime = System.currentTimeMillis();
}
public void showNotification() {
Log.i(TAG,mainActivity.toString());
NotificationCompat.Builder builder = new NotificationCompat.Builder(mainActivity.getApplicationContext(),CHANNEL_ID)
.setContentTitle("Hello")
.setContentText("Err this is a hello message")
.setPriority(NotificationCompat.PRIORITY_DEFAULT);
createNotificationChannel();
NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(mainActivity.getApplicationContext());
notificationManagerCompat.notify(1,builder.build());
}
private void createNotificationChannel() {
// Create the NotificationChannel, but only on API 26+ because
// the NotificationChannel class is new and not in the support library
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
CharSequence name = "demencia_channel";
String description = "demencia_notifications";
int importance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
channel.setDescription(description);
// Register the channel with the system; you can't change the importance
// or other notification behaviors after this
NotificationManager notificationManager = mainActivity.getSystemService(NotificationManager.class);
notificationManager.createNotificationChannel(channel);
}
}
public double getElapsedTime(){
return (System.currentTimeMillis() - startTime)/1000.0f;
}
}
| 2,475 | 0.711111 | 0.707879 | 63 | 38.285713 | 31.900354 | 131 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.603175 | false | false | 15 |
f96f9c3e0dc10a622c341bf7e4a84166932d460e | 25,013,889,595,252 | 4e036d85a03db9b25bfd2c17595c81232b20e548 | /src/main/java/com/team1/healthcare/vo/notice/UpdateNoticeCommentVO.java | 29cd57da363c06d974d15590c71b8d888d86926f | [] | no_license | hwang1995/team1_backend_project | https://github.com/hwang1995/team1_backend_project | 48625be4d2ec9edfd97d9877c623a69392fe3d21 | 87834c1bc8f3173d63b417ac5a9a6aa8f870b9cd | refs/heads/master | 2023-06-27T22:35:53.783000 | 2021-07-25T11:37:00 | 2021-07-25T11:37:00 | 382,279,247 | 0 | 0 | null | false | 2021-07-25T11:37:01 | 2021-07-02T08:19:10 | 2021-07-02T08:21:39 | 2021-07-25T11:37:00 | 32,828 | 0 | 0 | 0 | Java | false | false | package com.team1.healthcare.vo.notice;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;
@Getter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class UpdateNoticeCommentVO {
private int noticeCommentId;
private String comment;
@JsonIgnore
public boolean isNull() {
Integer noticeCommentIdWrapper = new Integer(noticeCommentId);
if (noticeCommentIdWrapper == null || comment.trim().isEmpty()) {
return true;
} else {
return false;
}
}
}
| UTF-8 | Java | 602 | java | UpdateNoticeCommentVO.java | Java | [] | null | [] | package com.team1.healthcare.vo.notice;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;
@Getter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class UpdateNoticeCommentVO {
private int noticeCommentId;
private String comment;
@JsonIgnore
public boolean isNull() {
Integer noticeCommentIdWrapper = new Integer(noticeCommentId);
if (noticeCommentIdWrapper == null || comment.trim().isEmpty()) {
return true;
} else {
return false;
}
}
}
| 602 | 0.755814 | 0.754153 | 26 | 22.153847 | 18.563181 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 15 |
92031eddab38687adfc3ca76966749432898301f | 25,013,889,593,386 | 131f914526fafcefca1a43c969669af28c58ec3a | /src/main/java/com/auc/service/CarService.java | 954dc5ea240a3e84e5acc5a47d563967f30c081a | [] | no_license | Cavolo-7/PakeManag | https://github.com/Cavolo-7/PakeManag | 64a30eaf80c3a7e1646c91e17ad9afaaf7468eef | ebee167d15169ca2ad884d83f66760b82662f24b | refs/heads/master | 2022-12-25T08:36:49.357000 | 2020-09-26T01:20:52 | 2020-09-26T01:20:52 | 293,689,505 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.auc.service;
import com.auc.pojo.Alipay;
import com.auc.pojo.CarPort;
import com.auc.pojo.Result;
import com.auc.pojo.WelcomeInfo;
import org.springframework.web.multipart.MultipartFile;
import java.util.HashMap;
/**
* @基本功能:
* @program:ParkManage
* @author:acsk
* @create:2020-09-08 09:05:43
**/
public interface CarService {
public Integer findCarPortNum();//查询车库剩余车位
public WelcomeInfo noCarWelcome();//空闲时入场显示屏信息
public WelcomeInfo carIn(String carNumber, String path);//车辆入场
public WelcomeInfo carOut(String carNumber);//车辆出场
public boolean carOutNoPay(String carNumber, Integer carportId);//车辆出场无需缴费
public boolean carOutMoney(Integer money, String carNumber, Integer carportId);//车辆出场现金支付
public String carOutAlipay(String subject, String total_amount, String body);//车辆出场调用支付宝进行支付
public boolean carOutAlipaySuccess(Integer money, String carNumber, Integer carportId);//车辆出场支付宝支付成功
public String alipay(String subject, String total_amount, String body);//自助缴费调用支付宝进行支付
public boolean alipaySuccess(Integer money, String carNumber, Integer carportId);//自助缴费支付宝支付成功
public Alipay findAlipay(String alipayNumber);//支付宝订单查询数据
public WelcomeInfo findCarPayInfo(String carNumber);//查询车辆结算信息
public CarPort findCarPort(String carNumber);//根据车牌查询车位
} | UTF-8 | Java | 1,575 | java | CarService.java | Java | [
{
"context": "\n\n/**\n * @基本功能:\n * @program:ParkManage\n * @author:acsk\n * @create:2020-09-08 09:05:43\n **/\npublic interf",
"end": 280,
"score": 0.9996552467346191,
"start": 276,
"tag": "USERNAME",
"value": "acsk"
}
] | null | [] | package com.auc.service;
import com.auc.pojo.Alipay;
import com.auc.pojo.CarPort;
import com.auc.pojo.Result;
import com.auc.pojo.WelcomeInfo;
import org.springframework.web.multipart.MultipartFile;
import java.util.HashMap;
/**
* @基本功能:
* @program:ParkManage
* @author:acsk
* @create:2020-09-08 09:05:43
**/
public interface CarService {
public Integer findCarPortNum();//查询车库剩余车位
public WelcomeInfo noCarWelcome();//空闲时入场显示屏信息
public WelcomeInfo carIn(String carNumber, String path);//车辆入场
public WelcomeInfo carOut(String carNumber);//车辆出场
public boolean carOutNoPay(String carNumber, Integer carportId);//车辆出场无需缴费
public boolean carOutMoney(Integer money, String carNumber, Integer carportId);//车辆出场现金支付
public String carOutAlipay(String subject, String total_amount, String body);//车辆出场调用支付宝进行支付
public boolean carOutAlipaySuccess(Integer money, String carNumber, Integer carportId);//车辆出场支付宝支付成功
public String alipay(String subject, String total_amount, String body);//自助缴费调用支付宝进行支付
public boolean alipaySuccess(Integer money, String carNumber, Integer carportId);//自助缴费支付宝支付成功
public Alipay findAlipay(String alipayNumber);//支付宝订单查询数据
public WelcomeInfo findCarPayInfo(String carNumber);//查询车辆结算信息
public CarPort findCarPort(String carNumber);//根据车牌查询车位
} | 1,575 | 0.769634 | 0.759162 | 46 | 28.086956 | 32.861916 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.695652 | false | false | 15 |
cf97db418b1c81028ef0b2cd75de81e93b71ce1e | 6,957,847,075,858 | 39e2ec63cceea07c83ebc0ee7ea0732bbfa42f7b | /Pokemon/BattleDemo.java | 37fd181a703bc0f705c5fc5eebd4c0d9e625e8b3 | [] | no_license | black315/develop | https://github.com/black315/develop | 6e5d2144d43f74731cc94f6d756d81c7e0331f46 | a86765abae81d4fe924a0ea2c91eccd50d7a39b9 | refs/heads/master | 2020-03-22T12:17:40.065000 | 2018-07-07T05:52:36 | 2018-07-07T05:52:36 | 135,775,407 | 0 | 0 | null | false | 2018-07-06T20:42:38 | 2018-06-02T00:44:36 | 2018-06-15T01:07:51 | 2018-07-06T20:38:16 | 15 | 0 | 0 | 1 | Java | false | null | package jp.co.plise.igarashi_ryo.ex11;
import java.util.Random;
import java.util.Scanner;
public class BattleDemo {
public static void main(String[] args) {
Battle battle = new Battle();
Pokemon myPokemon = new Pikachu(50);
Pokemon enemy = new Machoke(50);
Scanner sc = new Scanner(System.in);
Random rand = new Random();
while(myPokemon.getHp() > 0 && enemy.getHp() > 0) {
battle.printEnemyStatus(enemy);
battle.printStatus(myPokemon);
battle.printSkills(myPokemon);
int choise = sc.nextInt();
if(myPokemon.getSpeed() > enemy.getSpeed()) {
myPokemon.attackEnemy(enemy, myPokemon.getSkill(choise-1));
battle.printEnemyStatus(enemy);
battle.printStatus(myPokemon);
enemy.attackEnemy(myPokemon, enemy.getSkill(rand.nextInt(enemy.getNumberOfSkill())));
} else {
enemy.attackEnemy(myPokemon, enemy.getSkill(rand.nextInt(enemy.getNumberOfSkill())));
battle.printEnemyStatus(enemy);
battle.printStatus(myPokemon);
myPokemon.attackEnemy(enemy, myPokemon.getSkill(choise-1));
}
}
sc.close();
battle.printEnemyStatus(enemy);
battle.printStatus(myPokemon);
}
}
| UTF-8 | Java | 1,209 | java | BattleDemo.java | Java | [] | null | [] | package jp.co.plise.igarashi_ryo.ex11;
import java.util.Random;
import java.util.Scanner;
public class BattleDemo {
public static void main(String[] args) {
Battle battle = new Battle();
Pokemon myPokemon = new Pikachu(50);
Pokemon enemy = new Machoke(50);
Scanner sc = new Scanner(System.in);
Random rand = new Random();
while(myPokemon.getHp() > 0 && enemy.getHp() > 0) {
battle.printEnemyStatus(enemy);
battle.printStatus(myPokemon);
battle.printSkills(myPokemon);
int choise = sc.nextInt();
if(myPokemon.getSpeed() > enemy.getSpeed()) {
myPokemon.attackEnemy(enemy, myPokemon.getSkill(choise-1));
battle.printEnemyStatus(enemy);
battle.printStatus(myPokemon);
enemy.attackEnemy(myPokemon, enemy.getSkill(rand.nextInt(enemy.getNumberOfSkill())));
} else {
enemy.attackEnemy(myPokemon, enemy.getSkill(rand.nextInt(enemy.getNumberOfSkill())));
battle.printEnemyStatus(enemy);
battle.printStatus(myPokemon);
myPokemon.attackEnemy(enemy, myPokemon.getSkill(choise-1));
}
}
sc.close();
battle.printEnemyStatus(enemy);
battle.printStatus(myPokemon);
}
}
| 1,209 | 0.669975 | 0.661704 | 43 | 26.11628 | 22.727106 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.976744 | false | false | 15 |
0246c60f8389736542961fbb4e52984c35385029 | 32,658,931,339,974 | f88891e45b9ab059eacf2996987a957b278bc4b3 | /AaronsCode/src/Ear.java | 6940de558e7d04505a5b7a1f9043b481419286d8 | [] | no_license | zuesmajor/AaronsTheBot | https://github.com/zuesmajor/AaronsTheBot | b5c7be17420b7c80861667174889d772e71ed8fc | f6bc47043c8065d6456651c0c2aa36087ed1f938 | refs/heads/master | 2016-09-06T16:17:08.672000 | 2015-04-07T23:24:30 | 2015-04-07T23:24:30 | 30,879,432 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Polygon;
import java.awt.geom.Point2D;
public class Ear extends Drawable
{
private Polygon poly;
public Ear()
{
}
@Override
public void draw(Graphics2D g2d)
{
poly = new Polygon(
new int[]{(int)position.getX() - 30, (int)position.getX(), (int)position.getX() + 10},
new int[]{(int)position.getY() - 80, (int)position.getY() - 100, (int)position.getY() - 80},
3);
g2d.drawPolygon(poly);
Color color = new Color(random.nextInt(255), random.nextInt(255), random.nextInt(255));
g2d.setColor(color);
g2d.fillPolygon(poly);
}
}
| UTF-8 | Java | 697 | java | Ear.java | Java | [] | null | [] |
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Polygon;
import java.awt.geom.Point2D;
public class Ear extends Drawable
{
private Polygon poly;
public Ear()
{
}
@Override
public void draw(Graphics2D g2d)
{
poly = new Polygon(
new int[]{(int)position.getX() - 30, (int)position.getX(), (int)position.getX() + 10},
new int[]{(int)position.getY() - 80, (int)position.getY() - 100, (int)position.getY() - 80},
3);
g2d.drawPolygon(poly);
Color color = new Color(random.nextInt(255), random.nextInt(255), random.nextInt(255));
g2d.setColor(color);
g2d.fillPolygon(poly);
}
}
| 697 | 0.631277 | 0.591105 | 30 | 22.166666 | 28.530783 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.366667 | false | false | 15 |
bf1568c1cb70b0d456bc39e4f3ac49f7a5a8d498 | 7,937,099,582,596 | e317403d57f142b7cbb1d5c7bc8ad1d6e1ae4fe8 | /src/UI/userstore.java | 23f2b3520fd813a16d082e5e8923be5cbe467f46 | [] | no_license | enterdawn/flower | https://github.com/enterdawn/flower | fca604d56460b657bd76a76247c68c2c1546694a | efdc36c2938644be72d79bc94cedb24d25d11625 | refs/heads/master | 2023-06-02T23:16:14.606000 | 2021-06-27T07:54:24 | 2021-06-27T07:54:24 | 374,671,802 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Created by JFormDesigner on Fri Jun 25 16:23:58 CST 2021
*/
package UI;
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
import java.util.regex.Pattern;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import BI.BIfactory;
import ent.customerent;
import ent.flower;
import ent.flowerstore;
import net.miginfocom.swing.*;
/**
* @author unknown
*/
public class userstore extends JFrame {
customerent User;
flowerstore store;
ArrayList<flower> flowers;
String a[][]={};
int selectrow=-1;
String columnNames[]={"编号","名称","颜色","单价","库存"};
public userstore(customerent User, flowerstore store) {
this.User=User;
this.store=store;
initComponents();
table1.getTableHeader().setReorderingAllowed( false ) ;
label1.setText(store.getName());
label2.setText(store.getPhone());
label3.setText(store.getAddress());
flowers= BIfactory.getInstance().getCustomerService().getflower(store.getId());
table1.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
for (int i = 0; i < flowers.size(); i++) {
String values[]={String.valueOf(flowers.get(i).getId()),flowers.get(i).getName(),flowers.get(i).getColor(), String.valueOf(flowers.get(i).getPrice()), String.valueOf(flowers.get(i).getStock()-flowers.get(i).getSaled())};
tableModel1.addRow(values);
}
}
private void table1MouseClicked(MouseEvent e) {
selectrow=table1.getSelectedRow();
}
private void button1MouseClicked(MouseEvent e) {
if(selectrow==-1){
JOptionPane.showMessageDialog(null,"请选择鲜花","失败",JOptionPane.ERROR_MESSAGE);
return;
}
System.out.println(table1.getValueAt(selectrow, 0));
int id=Integer.valueOf(table1.getValueAt(selectrow, 0).toString());
flower d = new flower();
for (int i = 0; i < flowers.size(); i++) {
if(flowers.get(i).getId()==id){
d=flowers.get(i);
break;
}
}
if((int)spinner1.getValue()>d.getStock()-d.getSaled()){
JOptionPane.showMessageDialog(null,"库存不足","失败",JOptionPane.ERROR_MESSAGE);
return;
}
if(BIfactory.getInstance().getCustomerService().addorder(store.getId(),d.getId(),User.getid(),(int)spinner1.getValue(),d.getPrice())==true){
JOptionPane.showMessageDialog(null,"下单成功","",JOptionPane.PLAIN_MESSAGE);
tableModel1.getDataVector().clear();
for (int i = 0; i < flowers.size(); i++) {
String values[]={String.valueOf(flowers.get(i).getId()),flowers.get(i).getName(),flowers.get(i).getColor(), String.valueOf(flowers.get(i).getPrice()), String.valueOf(flowers.get(i).getStock()-flowers.get(i).getSaled())};
tableModel1.addRow(values);
}
}
}
private boolean isDouble(String str) {
if (null == str || "".equals(str)) {
return false;
}
Pattern pattern = Pattern.compile("^[-\\+]?\\d*[.]\\d+$");
return pattern.matcher(str).matches();
}
private void button2MouseClicked(MouseEvent e) {
tableModel1.getDataVector().clear();
for (int i = 0; i < flowers.size(); i++) {
if(!textField1.getText().equals("")){
if(!flowers.get(i).getName().contains(textField1.getText())) continue;
}
if(!textField2.getText().equals("")){
if(!flowers.get(i).getColor().contains(textField2.getText())) continue;
}
if(!textField3.getText().equals("")){
if(!isDouble(textField3.getText())) JOptionPane.showMessageDialog(null,"最小价格非法","失败",JOptionPane.ERROR_MESSAGE);
if(!(flowers.get(i).getPrice()<Float.parseFloat(textField3.getText()))) continue;
}
if(!textField4.getText().equals("")){
if(!isDouble(textField4.getText())) JOptionPane.showMessageDialog(null,"最大价格非法","失败",JOptionPane.ERROR_MESSAGE);
if(!(flowers.get(i).getPrice()>Float.parseFloat(textField4.getText()))) continue;
}
String values[]={String.valueOf(flowers.get(i).getId()),flowers.get(i).getName(),flowers.get(i).getColor(), String.valueOf(flowers.get(i).getPrice()), String.valueOf(flowers.get(i).getStock()-flowers.get(i).getSaled())};
tableModel1.addRow(values);
}
}
private void initComponents() {
tableModel1=new DefaultTableModel(a,columnNames){
public boolean isCellEditable(int rowIndex, int ColIndex){
return false;
}
} ;
SpinnerNumberModel nModel = new SpinnerNumberModel(0, 0,0x7ffffff, 1);
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
// Generated using JFormDesigner Evaluation license - unknown
label1 = new JLabel();
label2 = new JLabel();
label3 = new JLabel();
label4 = new JLabel();
textField1 = new JTextField();
label5 = new JLabel();
textField2 = new JTextField();
label8 = new JLabel();
spinner1 = new JSpinner(nModel);
label6 = new JLabel();
textField3 = new JTextField();
label7 = new JLabel();
textField4 = new JTextField();
button2 = new JButton();
button1 = new JButton();
scrollPane1 = new JScrollPane();
table1 = new JTable(tableModel1);
//======== this ========
Container contentPane = getContentPane();
contentPane.setLayout(new MigLayout(
"hidemode 3",
// columns
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]",
// rows
"[]" +
"[]" +
"[]" +
"[]" +
"[]"));
//---- label1 ----
label1.setText("text");
contentPane.add(label1, "cell 0 0");
//---- label2 ----
label2.setText("text");
contentPane.add(label2, "cell 15 0");
//---- label3 ----
label3.setText("text");
contentPane.add(label3, "cell 0 1");
//---- label4 ----
label4.setText("\u82b1\u540d");
contentPane.add(label4, "cell 0 2");
contentPane.add(textField1, "cell 3 2 21 1");
//---- label5 ----
label5.setText("\u989c\u8272");
contentPane.add(label5, "cell 26 2");
contentPane.add(textField2, "cell 28 2 19 1");
//---- label8 ----
label8.setText("\u8d2d\u4e70\u6570\u91cf");
contentPane.add(label8, "cell 48 2");
contentPane.add(spinner1, "cell 50 2 5 1");
//---- label6 ----
label6.setText("\u4ef7\u683c");
contentPane.add(label6, "cell 0 3");
contentPane.add(textField3, "cell 3 3 8 1");
//---- label7 ----
label7.setText("\u5230");
contentPane.add(label7, "cell 11 3");
contentPane.add(textField4, "cell 15 3 7 1");
//---- button2 ----
button2.setText("\u67e5\u627e");
button2.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
button2MouseClicked(e);
}
});
contentPane.add(button2, "cell 45 3");
//---- button1 ----
button1.setText("\u4e0b\u8ba2\u5355");
button1.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
button1MouseClicked(e);
}
});
contentPane.add(button1, "cell 53 3");
//======== scrollPane1 ========
{
//---- table1 ----
table1.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
table1MouseClicked(e);
}
});
scrollPane1.setViewportView(table1);
}
contentPane.add(scrollPane1, "cell 0 4 55 1");
pack();
setLocationRelativeTo(getOwner());
// JFormDesigner - End of component initialization //GEN-END:initComponents
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
// Generated using JFormDesigner Evaluation license - unknown
private JLabel label1;
private JLabel label2;
private JLabel label3;
private JLabel label4;
private JTextField textField1;
private JLabel label5;
private JTextField textField2;
private JLabel label8;
private JSpinner spinner1;
private JLabel label6;
private JTextField textField3;
private JLabel label7;
private JTextField textField4;
private JButton button2;
private JButton button1;
private JScrollPane scrollPane1;
private JTable table1;
// JFormDesigner - End of variables declaration //GEN-END:variables
private DefaultTableModel tableModel1;
private JScrollPane jScrollPane;
}
| UTF-8 | Java | 10,719 | java | userstore.java | Java | [] | null | [] | /*
* Created by JFormDesigner on Fri Jun 25 16:23:58 CST 2021
*/
package UI;
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
import java.util.regex.Pattern;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import BI.BIfactory;
import ent.customerent;
import ent.flower;
import ent.flowerstore;
import net.miginfocom.swing.*;
/**
* @author unknown
*/
public class userstore extends JFrame {
customerent User;
flowerstore store;
ArrayList<flower> flowers;
String a[][]={};
int selectrow=-1;
String columnNames[]={"编号","名称","颜色","单价","库存"};
public userstore(customerent User, flowerstore store) {
this.User=User;
this.store=store;
initComponents();
table1.getTableHeader().setReorderingAllowed( false ) ;
label1.setText(store.getName());
label2.setText(store.getPhone());
label3.setText(store.getAddress());
flowers= BIfactory.getInstance().getCustomerService().getflower(store.getId());
table1.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
for (int i = 0; i < flowers.size(); i++) {
String values[]={String.valueOf(flowers.get(i).getId()),flowers.get(i).getName(),flowers.get(i).getColor(), String.valueOf(flowers.get(i).getPrice()), String.valueOf(flowers.get(i).getStock()-flowers.get(i).getSaled())};
tableModel1.addRow(values);
}
}
private void table1MouseClicked(MouseEvent e) {
selectrow=table1.getSelectedRow();
}
private void button1MouseClicked(MouseEvent e) {
if(selectrow==-1){
JOptionPane.showMessageDialog(null,"请选择鲜花","失败",JOptionPane.ERROR_MESSAGE);
return;
}
System.out.println(table1.getValueAt(selectrow, 0));
int id=Integer.valueOf(table1.getValueAt(selectrow, 0).toString());
flower d = new flower();
for (int i = 0; i < flowers.size(); i++) {
if(flowers.get(i).getId()==id){
d=flowers.get(i);
break;
}
}
if((int)spinner1.getValue()>d.getStock()-d.getSaled()){
JOptionPane.showMessageDialog(null,"库存不足","失败",JOptionPane.ERROR_MESSAGE);
return;
}
if(BIfactory.getInstance().getCustomerService().addorder(store.getId(),d.getId(),User.getid(),(int)spinner1.getValue(),d.getPrice())==true){
JOptionPane.showMessageDialog(null,"下单成功","",JOptionPane.PLAIN_MESSAGE);
tableModel1.getDataVector().clear();
for (int i = 0; i < flowers.size(); i++) {
String values[]={String.valueOf(flowers.get(i).getId()),flowers.get(i).getName(),flowers.get(i).getColor(), String.valueOf(flowers.get(i).getPrice()), String.valueOf(flowers.get(i).getStock()-flowers.get(i).getSaled())};
tableModel1.addRow(values);
}
}
}
private boolean isDouble(String str) {
if (null == str || "".equals(str)) {
return false;
}
Pattern pattern = Pattern.compile("^[-\\+]?\\d*[.]\\d+$");
return pattern.matcher(str).matches();
}
private void button2MouseClicked(MouseEvent e) {
tableModel1.getDataVector().clear();
for (int i = 0; i < flowers.size(); i++) {
if(!textField1.getText().equals("")){
if(!flowers.get(i).getName().contains(textField1.getText())) continue;
}
if(!textField2.getText().equals("")){
if(!flowers.get(i).getColor().contains(textField2.getText())) continue;
}
if(!textField3.getText().equals("")){
if(!isDouble(textField3.getText())) JOptionPane.showMessageDialog(null,"最小价格非法","失败",JOptionPane.ERROR_MESSAGE);
if(!(flowers.get(i).getPrice()<Float.parseFloat(textField3.getText()))) continue;
}
if(!textField4.getText().equals("")){
if(!isDouble(textField4.getText())) JOptionPane.showMessageDialog(null,"最大价格非法","失败",JOptionPane.ERROR_MESSAGE);
if(!(flowers.get(i).getPrice()>Float.parseFloat(textField4.getText()))) continue;
}
String values[]={String.valueOf(flowers.get(i).getId()),flowers.get(i).getName(),flowers.get(i).getColor(), String.valueOf(flowers.get(i).getPrice()), String.valueOf(flowers.get(i).getStock()-flowers.get(i).getSaled())};
tableModel1.addRow(values);
}
}
private void initComponents() {
tableModel1=new DefaultTableModel(a,columnNames){
public boolean isCellEditable(int rowIndex, int ColIndex){
return false;
}
} ;
SpinnerNumberModel nModel = new SpinnerNumberModel(0, 0,0x7ffffff, 1);
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
// Generated using JFormDesigner Evaluation license - unknown
label1 = new JLabel();
label2 = new JLabel();
label3 = new JLabel();
label4 = new JLabel();
textField1 = new JTextField();
label5 = new JLabel();
textField2 = new JTextField();
label8 = new JLabel();
spinner1 = new JSpinner(nModel);
label6 = new JLabel();
textField3 = new JTextField();
label7 = new JLabel();
textField4 = new JTextField();
button2 = new JButton();
button1 = new JButton();
scrollPane1 = new JScrollPane();
table1 = new JTable(tableModel1);
//======== this ========
Container contentPane = getContentPane();
contentPane.setLayout(new MigLayout(
"hidemode 3",
// columns
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]",
// rows
"[]" +
"[]" +
"[]" +
"[]" +
"[]"));
//---- label1 ----
label1.setText("text");
contentPane.add(label1, "cell 0 0");
//---- label2 ----
label2.setText("text");
contentPane.add(label2, "cell 15 0");
//---- label3 ----
label3.setText("text");
contentPane.add(label3, "cell 0 1");
//---- label4 ----
label4.setText("\u82b1\u540d");
contentPane.add(label4, "cell 0 2");
contentPane.add(textField1, "cell 3 2 21 1");
//---- label5 ----
label5.setText("\u989c\u8272");
contentPane.add(label5, "cell 26 2");
contentPane.add(textField2, "cell 28 2 19 1");
//---- label8 ----
label8.setText("\u8d2d\u4e70\u6570\u91cf");
contentPane.add(label8, "cell 48 2");
contentPane.add(spinner1, "cell 50 2 5 1");
//---- label6 ----
label6.setText("\u4ef7\u683c");
contentPane.add(label6, "cell 0 3");
contentPane.add(textField3, "cell 3 3 8 1");
//---- label7 ----
label7.setText("\u5230");
contentPane.add(label7, "cell 11 3");
contentPane.add(textField4, "cell 15 3 7 1");
//---- button2 ----
button2.setText("\u67e5\u627e");
button2.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
button2MouseClicked(e);
}
});
contentPane.add(button2, "cell 45 3");
//---- button1 ----
button1.setText("\u4e0b\u8ba2\u5355");
button1.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
button1MouseClicked(e);
}
});
contentPane.add(button1, "cell 53 3");
//======== scrollPane1 ========
{
//---- table1 ----
table1.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
table1MouseClicked(e);
}
});
scrollPane1.setViewportView(table1);
}
contentPane.add(scrollPane1, "cell 0 4 55 1");
pack();
setLocationRelativeTo(getOwner());
// JFormDesigner - End of component initialization //GEN-END:initComponents
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
// Generated using JFormDesigner Evaluation license - unknown
private JLabel label1;
private JLabel label2;
private JLabel label3;
private JLabel label4;
private JTextField textField1;
private JLabel label5;
private JTextField textField2;
private JLabel label8;
private JSpinner spinner1;
private JLabel label6;
private JTextField textField3;
private JLabel label7;
private JTextField textField4;
private JButton button2;
private JButton button1;
private JScrollPane scrollPane1;
private JTable table1;
// JFormDesigner - End of variables declaration //GEN-END:variables
private DefaultTableModel tableModel1;
private JScrollPane jScrollPane;
}
| 10,719 | 0.520643 | 0.498072 | 313 | 32.971245 | 29.699493 | 236 | false | false | 0 | 0 | 24 | 0.002257 | 0 | 0 | 0.645367 | false | false | 15 |
d557d7afbde262a30e5ed15ed00e649d5b5045a6 | 23,106,924,057,176 | a13d9e921736224f10334f5b2e87969f66050a32 | /bSocks/src/uk/codingbadgers/bsocks/web/PermissionsListener.java | 0e113e5c646f7a97a0f07555d7009a9d63f38904 | [] | no_license | devBuzzy/bFundamentals | https://github.com/devBuzzy/bFundamentals | c1328dc6fdfb872fd50ec1e4d847cc8f3f8fc3e9 | 40135725dc4074c8fc370876c09fee02426a75a1 | refs/heads/master | 2021-05-27T05:51:29.345000 | 2014-04-18T07:39:44 | 2014-04-18T07:40:06 | 30,706,089 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* bSocks 1.2-SNAPSHOT
* Copyright (C) 2013 CodingBadgers <plugins@mcbadgercraft.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package uk.codingbadgers.bsocks.web;
import java.net.MalformedURLException;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Effect;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import ru.tehkode.permissions.PermissionEntity;
import ru.tehkode.permissions.PermissionGroup;
import ru.tehkode.permissions.PermissionUser;
import ru.tehkode.permissions.events.PermissionEntityEvent;
import ru.tehkode.permissions.events.PermissionEntityEvent.Action;
import uk.codingbadgers.bFundamentals.bFundamentals;
import uk.codingbadgers.bsocks.bSocksModule;
/**
* Listener for PermissionsEx based events
*
* @see PermissionsEvent
*/
public class PermissionsListener implements Listener {
/**
* On permissions event.
*
* @param event the event fired by pex
*/
@EventHandler
public void onPermissionsEvent(PermissionEntityEvent event) {
if (event.getAction() == Action.INHERITANCE_CHANGED) {
onRankChange(event);
}
}
/**
* On rank change, handles sending information to website through
* the post handler and applying the fire effect around the player.
*
* @param event the event
*/
public void onRankChange(PermissionEntityEvent event) {
PermissionEntity entity = event.getEntity();
if (!(entity instanceof PermissionUser)) {
return;
}
PermissionUser user = (PermissionUser) entity;
PermissionGroup group = user.getGroups()[0];
try {
WebHandler ph = bSocksModule.getInstance().getPostHandler("promote.php");
Map<String, String> data = new HashMap<String, String>();
data.put("user", user.getName());
data.put("group", group.getName());
ph.put(data);
ph.start();
} catch (MalformedURLException e) {
e.printStackTrace();
}
Player player = bFundamentals.getInstance().getServer().getPlayerExact(user.getName());
if (player == null) {
return;
}
player.getWorld().playEffect(player.getLocation(), Effect.MOBSPAWNER_FLAMES, 9);
}
}
| UTF-8 | Java | 2,846 | java | PermissionsListener.java | Java | [
{
"context": "**\r\n * bSocks 1.2-SNAPSHOT\r\n * Copyright (C) 2013 CodingBadgers <plugins@mcbadgercraft.com>\r\n *\r\n * This program ",
"end": 65,
"score": 0.9988956451416016,
"start": 52,
"tag": "USERNAME",
"value": "CodingBadgers"
},
{
"context": "2-SNAPSHOT\r\n * Copyright (C) 2013 CodingBadgers <plugins@mcbadgercraft.com>\r\n *\r\n * This program is free software: you can r",
"end": 92,
"score": 0.9999322891235352,
"start": 67,
"tag": "EMAIL",
"value": "plugins@mcbadgercraft.com"
}
] | null | [] | /**
* bSocks 1.2-SNAPSHOT
* Copyright (C) 2013 CodingBadgers <<EMAIL>>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package uk.codingbadgers.bsocks.web;
import java.net.MalformedURLException;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Effect;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import ru.tehkode.permissions.PermissionEntity;
import ru.tehkode.permissions.PermissionGroup;
import ru.tehkode.permissions.PermissionUser;
import ru.tehkode.permissions.events.PermissionEntityEvent;
import ru.tehkode.permissions.events.PermissionEntityEvent.Action;
import uk.codingbadgers.bFundamentals.bFundamentals;
import uk.codingbadgers.bsocks.bSocksModule;
/**
* Listener for PermissionsEx based events
*
* @see PermissionsEvent
*/
public class PermissionsListener implements Listener {
/**
* On permissions event.
*
* @param event the event fired by pex
*/
@EventHandler
public void onPermissionsEvent(PermissionEntityEvent event) {
if (event.getAction() == Action.INHERITANCE_CHANGED) {
onRankChange(event);
}
}
/**
* On rank change, handles sending information to website through
* the post handler and applying the fire effect around the player.
*
* @param event the event
*/
public void onRankChange(PermissionEntityEvent event) {
PermissionEntity entity = event.getEntity();
if (!(entity instanceof PermissionUser)) {
return;
}
PermissionUser user = (PermissionUser) entity;
PermissionGroup group = user.getGroups()[0];
try {
WebHandler ph = bSocksModule.getInstance().getPostHandler("promote.php");
Map<String, String> data = new HashMap<String, String>();
data.put("user", user.getName());
data.put("group", group.getName());
ph.put(data);
ph.start();
} catch (MalformedURLException e) {
e.printStackTrace();
}
Player player = bFundamentals.getInstance().getServer().getPlayerExact(user.getName());
if (player == null) {
return;
}
player.getWorld().playEffect(player.getLocation(), Effect.MOBSPAWNER_FLAMES, 9);
}
}
| 2,828 | 0.714336 | 0.711174 | 93 | 28.60215 | 25.93712 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.451613 | false | false | 15 |
2bc5743cce27ecc0e9605b9c0f368b6e82e417d6 | 23,106,924,054,074 | da84ae7feb3ce6801d626366969ff846e79bdf65 | /opends/tests/unit-tests-testng/src/server/org/opends/server/admin/server/AdminTestCaseUtils.java | 1c9711a4ea15b231ff308fb68e136c583b2a2654 | [] | no_license | openam-org-ru/org.forgerock.opendj | https://github.com/openam-org-ru/org.forgerock.opendj | bdc23b288da925b88e5c35c3ad4e3ef6d798bc48 | e7a978573d296672231564ac5855764696b19795 | refs/heads/master | 2016-09-02T04:55:42.456000 | 2015-10-12T06:54:03 | 2015-10-12T06:54:03 | 30,578,997 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* or http://forgerock.org/license/CDDLv1.0.html.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2008 Sun Microsystems, Inc.
*/
package org.opends.server.admin.server;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.Configuration;
import org.opends.server.admin.ConfigurationClient;
import org.opends.server.admin.DefinitionDecodingException;
import org.opends.server.admin.LDAPProfile;
import org.opends.server.admin.ManagedObjectPath;
import org.opends.server.admin.RelationDefinition;
import org.opends.server.admin.SingletonRelationDefinition;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.opends.server.config.ConfigEntry;
import org.opends.server.config.ConfigException;
import org.opends.server.types.Entry;
/**
* This class defines some utility functions which can be used by test
* cases which interact with the admin framework.
*/
public final class AdminTestCaseUtils {
// The relation name which will be used for dummy configurations. A
// deliberately obfuscated name is chosen to avoid clashes.
private static final String DUMMY_TEST_RELATION = "*dummy*test*relation*";
// Indicates if the dummy relation profile has been registered.
private static boolean isProfileRegistered = false;
// Prevent instantiation.
private AdminTestCaseUtils() {
// No implementation required.
}
/**
* Decodes a configuration entry into the required type of server
* configuration.
*
* @param <S>
* The type of server configuration to be decoded.
* @param definition
* The required definition of the required managed object.
* @param entry
* An entry containing the configuration to be decoded.
* @return Returns the new server-side configuration.
* @throws ConfigException
* If the entry could not be decoded.
*/
public static <S extends Configuration> S getConfiguration(
AbstractManagedObjectDefinition<?, S> definition, Entry entry)
throws ConfigException {
ConfigEntry configEntry = new ConfigEntry(entry, null);
try {
ServerManagementContext context = ServerManagementContext.getInstance();
ServerManagedObject<? extends S> mo = context.decode(getPath(definition),
configEntry);
// Ensure constraints are satisfied.
mo.ensureIsUsable();
return mo.getConfiguration();
} catch (DefinitionDecodingException e) {
throw ConfigExceptionFactory.getInstance()
.createDecodingExceptionAdaptor(entry.getDN(), e);
} catch (ServerManagedObjectDecodingException e) {
throw ConfigExceptionFactory.getInstance()
.createDecodingExceptionAdaptor(e);
} catch (ConstraintViolationException e) {
throw ConfigExceptionFactory.getInstance()
.createDecodingExceptionAdaptor(e);
}
}
// Construct a dummy path.
private synchronized static <C extends ConfigurationClient, S extends Configuration>
ManagedObjectPath<C, S> getPath(AbstractManagedObjectDefinition<C, S> d) {
if (!isProfileRegistered) {
LDAPProfile.Wrapper profile = new LDAPProfile.Wrapper() {
/**
* {@inheritDoc}
*/
@Override
public String getRelationRDNSequence(RelationDefinition<?, ?> r) {
if (r.getName().equals(DUMMY_TEST_RELATION)) {
return "cn=dummy configuration,cn=config";
} else {
return null;
}
}
};
LDAPProfile.getInstance().pushWrapper(profile);
isProfileRegistered = true;
}
SingletonRelationDefinition.Builder<C, S> builder =
new SingletonRelationDefinition.Builder<C, S>(
RootCfgDefn.getInstance(), DUMMY_TEST_RELATION, d);
ManagedObjectPath<?, ?> root = ManagedObjectPath.emptyPath();
return root.child(builder.getInstance());
}
}
| UTF-8 | Java | 4,660 | java | AdminTestCaseUtils.java | Java | [] | null | [] | /*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* or http://forgerock.org/license/CDDLv1.0.html.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2008 Sun Microsystems, Inc.
*/
package org.opends.server.admin.server;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.Configuration;
import org.opends.server.admin.ConfigurationClient;
import org.opends.server.admin.DefinitionDecodingException;
import org.opends.server.admin.LDAPProfile;
import org.opends.server.admin.ManagedObjectPath;
import org.opends.server.admin.RelationDefinition;
import org.opends.server.admin.SingletonRelationDefinition;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.opends.server.config.ConfigEntry;
import org.opends.server.config.ConfigException;
import org.opends.server.types.Entry;
/**
* This class defines some utility functions which can be used by test
* cases which interact with the admin framework.
*/
public final class AdminTestCaseUtils {
// The relation name which will be used for dummy configurations. A
// deliberately obfuscated name is chosen to avoid clashes.
private static final String DUMMY_TEST_RELATION = "*dummy*test*relation*";
// Indicates if the dummy relation profile has been registered.
private static boolean isProfileRegistered = false;
// Prevent instantiation.
private AdminTestCaseUtils() {
// No implementation required.
}
/**
* Decodes a configuration entry into the required type of server
* configuration.
*
* @param <S>
* The type of server configuration to be decoded.
* @param definition
* The required definition of the required managed object.
* @param entry
* An entry containing the configuration to be decoded.
* @return Returns the new server-side configuration.
* @throws ConfigException
* If the entry could not be decoded.
*/
public static <S extends Configuration> S getConfiguration(
AbstractManagedObjectDefinition<?, S> definition, Entry entry)
throws ConfigException {
ConfigEntry configEntry = new ConfigEntry(entry, null);
try {
ServerManagementContext context = ServerManagementContext.getInstance();
ServerManagedObject<? extends S> mo = context.decode(getPath(definition),
configEntry);
// Ensure constraints are satisfied.
mo.ensureIsUsable();
return mo.getConfiguration();
} catch (DefinitionDecodingException e) {
throw ConfigExceptionFactory.getInstance()
.createDecodingExceptionAdaptor(entry.getDN(), e);
} catch (ServerManagedObjectDecodingException e) {
throw ConfigExceptionFactory.getInstance()
.createDecodingExceptionAdaptor(e);
} catch (ConstraintViolationException e) {
throw ConfigExceptionFactory.getInstance()
.createDecodingExceptionAdaptor(e);
}
}
// Construct a dummy path.
private synchronized static <C extends ConfigurationClient, S extends Configuration>
ManagedObjectPath<C, S> getPath(AbstractManagedObjectDefinition<C, S> d) {
if (!isProfileRegistered) {
LDAPProfile.Wrapper profile = new LDAPProfile.Wrapper() {
/**
* {@inheritDoc}
*/
@Override
public String getRelationRDNSequence(RelationDefinition<?, ?> r) {
if (r.getName().equals(DUMMY_TEST_RELATION)) {
return "cn=dummy configuration,cn=config";
} else {
return null;
}
}
};
LDAPProfile.getInstance().pushWrapper(profile);
isProfileRegistered = true;
}
SingletonRelationDefinition.Builder<C, S> builder =
new SingletonRelationDefinition.Builder<C, S>(
RootCfgDefn.getInstance(), DUMMY_TEST_RELATION, d);
ManagedObjectPath<?, ?> root = ManagedObjectPath.emptyPath();
return root.child(builder.getInstance());
}
}
| 4,660 | 0.712661 | 0.710086 | 140 | 32.285713 | 26.386492 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.364286 | false | false | 15 |
5315ca382dc8b10a0dcee2043b39cb735fe5af87 | 21,912,923,145,141 | a2ab08ae9f1c824a51c86d7b9df557681f0c8d5c | /emoji-keyboard/src/main/java/com/klinker/android/emoji_keyboard/adapter/RecentEmojiAdapter.java | 2efa388ea8f97a8ee74494fce788842d8dcbcd65 | [
"Apache-2.0"
] | permissive | APIHacks2017/silence_mustbe_heard | https://github.com/APIHacks2017/silence_mustbe_heard | 0eaf13316b5349182c61a64deb2cef0be7125d00 | 270cff8e97aff4300135725358bedaa4e19e21c1 | refs/heads/master | 2020-03-28T19:56:31.043000 | 2017-06-17T14:35:10 | 2017-06-17T14:35:10 | 94,605,065 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.klinker.android.emoji_keyboard.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.klinker.android.emoji_keyboard.EmojiKeyboardService;
import com.klinker.android.emoji_keyboard.sqlite.EmojiDataSource;
import com.klinker.android.emoji_keyboard.sqlite.RecentEntry;
import com.klinker.android.emoji_keyboard_trial.R;
import java.util.ArrayList;
public class RecentEmojiAdapter extends BaseEmojiAdapter {
private final Context mContext;
private ArrayList<RecentEntry> frequentlyUsedEmojiList;
private EmojiDataSource dataSource;
public RecentEmojiAdapter(Context context) {
super((EmojiKeyboardService) context);
mContext = context;
dataSource = new EmojiDataSource(context);
dataSource.openInReadWriteMode();
frequentlyUsedEmojiList = (ArrayList<RecentEntry>) dataSource.getAllEntriesInDescendingOrderOfCount();
setupEmojiDataFromList(frequentlyUsedEmojiList);
}
private void setupEmojiDataFromList(ArrayList<RecentEntry> recentEntries) {
emojiTexts = new ArrayList<String>();
iconIds = new ArrayList<Integer>();
for(RecentEntry i: recentEntries) {
emojiTexts.add(i.getText());
iconIds.add(Integer.parseInt(i.getIcon()));
}
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
// final View imageView = super.getView(position, convertView, parent);
//
// final RecentEmojiAdapter adapter = this;
//
// imageView.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// emojiKeyboardService.sendText(emojiTexts.get(position));
//
// for (int i = 0; i < frequentlyUsedEmojiList.size(); i++) {
// if (frequentlyUsedEmojiList.get(i).getText().equals(emojiTexts.get(position))) {
// dataSource.incrementExistingEntryCountbyOne(iconIds.get(position) + "");
// frequentlyUsedEmojiList.get(i).setCount(frequentlyUsedEmojiList.get(i).getCount());
// return;
// }
// }
//
// RecentEntry recentEntry = dataSource.insertNewEntry(emojiTexts.get(position), iconIds.get(position) + "");
//
// if (recentEntry != null)
// frequentlyUsedEmojiList.add(recentEntry);
// }
// });
//
// imageView.setOnLongClickListener(new View.OnLongClickListener() {
// @Override
// public boolean onLongClick(View view) {
//
// dataSource.deleteEntryWithId(frequentlyUsedEmojiList.get(position).getId());
// frequentlyUsedEmojiList.remove(position);
// adapter.notifyDataSetChanged();
// return true;
// }
// });
final View myView = LayoutInflater.from(mContext).inflate(R.layout.keyboard_default,null);
return myView;
}
@Override
protected void finalize() throws Throwable {
super.finalize();
dataSource.close();
}
} | UTF-8 | Java | 3,241 | java | RecentEmojiAdapter.java | Java | [] | null | [] | package com.klinker.android.emoji_keyboard.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.klinker.android.emoji_keyboard.EmojiKeyboardService;
import com.klinker.android.emoji_keyboard.sqlite.EmojiDataSource;
import com.klinker.android.emoji_keyboard.sqlite.RecentEntry;
import com.klinker.android.emoji_keyboard_trial.R;
import java.util.ArrayList;
public class RecentEmojiAdapter extends BaseEmojiAdapter {
private final Context mContext;
private ArrayList<RecentEntry> frequentlyUsedEmojiList;
private EmojiDataSource dataSource;
public RecentEmojiAdapter(Context context) {
super((EmojiKeyboardService) context);
mContext = context;
dataSource = new EmojiDataSource(context);
dataSource.openInReadWriteMode();
frequentlyUsedEmojiList = (ArrayList<RecentEntry>) dataSource.getAllEntriesInDescendingOrderOfCount();
setupEmojiDataFromList(frequentlyUsedEmojiList);
}
private void setupEmojiDataFromList(ArrayList<RecentEntry> recentEntries) {
emojiTexts = new ArrayList<String>();
iconIds = new ArrayList<Integer>();
for(RecentEntry i: recentEntries) {
emojiTexts.add(i.getText());
iconIds.add(Integer.parseInt(i.getIcon()));
}
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
// final View imageView = super.getView(position, convertView, parent);
//
// final RecentEmojiAdapter adapter = this;
//
// imageView.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// emojiKeyboardService.sendText(emojiTexts.get(position));
//
// for (int i = 0; i < frequentlyUsedEmojiList.size(); i++) {
// if (frequentlyUsedEmojiList.get(i).getText().equals(emojiTexts.get(position))) {
// dataSource.incrementExistingEntryCountbyOne(iconIds.get(position) + "");
// frequentlyUsedEmojiList.get(i).setCount(frequentlyUsedEmojiList.get(i).getCount());
// return;
// }
// }
//
// RecentEntry recentEntry = dataSource.insertNewEntry(emojiTexts.get(position), iconIds.get(position) + "");
//
// if (recentEntry != null)
// frequentlyUsedEmojiList.add(recentEntry);
// }
// });
//
// imageView.setOnLongClickListener(new View.OnLongClickListener() {
// @Override
// public boolean onLongClick(View view) {
//
// dataSource.deleteEntryWithId(frequentlyUsedEmojiList.get(position).getId());
// frequentlyUsedEmojiList.remove(position);
// adapter.notifyDataSetChanged();
// return true;
// }
// });
final View myView = LayoutInflater.from(mContext).inflate(R.layout.keyboard_default,null);
return myView;
}
@Override
protected void finalize() throws Throwable {
super.finalize();
dataSource.close();
}
} | 3,241 | 0.64332 | 0.643011 | 87 | 36.264366 | 31.40593 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.563218 | false | false | 15 |
c9df39389ba1b6bf4296babefeb80c3598427605 | 21,758,304,348,215 | c09c303dda09fdc9de6d336457717a60d8c4437f | /code/java30/src/java30_0613/HttpServerV2.java | f3518f4bbc581ca9da19528820506c982f3f5af8 | [
"MIT"
] | permissive | hong-zheng/ProjectCode | https://github.com/hong-zheng/ProjectCode | b852a4f11ae8ee29b238297916149801fe5bce91 | 20f6842311d471597dbf7ca25b387c7235003250 | refs/heads/master | 2022-12-16T10:24:00.565000 | 2020-09-15T13:04:30 | 2020-09-15T13:04:30 | 295,729,447 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package java30_0613;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
// 表示服务器主干逻辑
public class HttpServerV2 {
private ServerSocket serverSocket = null;
public HttpServerV2(int port) throws IOException {
serverSocket = new ServerSocket(port);
}
public void start() throws IOException {
System.out.println("服务器启动");
ExecutorService executorService = Executors.newCachedThreadPool();
while (true) {
Socket clientSocket = serverSocket.accept();
executorService.execute(new Runnable() {
@Override
public void run() {
try {
process(clientSocket);
} catch (IOException e) {
e.printStackTrace();
}
}
});
}
}
private void process(Socket clientSocket) throws IOException {
// 1. 构造并解析请求(本质上就是一个反序列化操作)
Request request = Request.build(clientSocket.getInputStream());
System.out.println("request: " + request);
// 2. 准备一个响应对象
Response response = Response.build(clientSocket.getOutputStream());
// 3. 根据请求来生成响应
if (request.getUrl().equals("/200")) {
response.setStatus(200);
response.setMessage("OK");
response.setHeader("Content-Type", "text/html; charset=utf-8");
response.writeBody("<html>");
response.writeBody("200 OK");
response.writeBody("</html>");
} else if (request.getUrl().startsWith("/calc")) {
// URL: /calc?a=10&b=20
int a = Integer.parseInt(request.getParameter("a"));
int b = Integer.parseInt(request.getParameter("b"));
int result = a + b;
response.setStatus(200);
response.setMessage("OK");
response.setHeader("Content-Type", "text/html; charset=utf-8");
response.writeBody("<html>");
response.writeBody("result = " + result);
response.writeBody("</html>");
} else if (request.getUrl().startsWith("/cookie")) {
// 从服务器获取一个 cookie 写回到客户端
response.setStatus(200);
response.setMessage("OK");
String cookie = "sessionId=aaabbbccc";
response.setHeader("Set-Cookie", cookie);
response.setHeader("Content-Type", "text/html; charset=utf-8");
response.writeBody("<html>");
response.writeBody("服务器给客户端设置 cookie 了, cookie 的内容为: " + cookie);
response.writeBody("</html>");
}
// 4. 把响应写回到客户端(本质上就是一个序列化操作)
response.flush();
clientSocket.close(); // 此处关闭 socket 对象也就能自动关闭 InputStream 和 OutputStream
}
public static void main(String[] args) throws IOException {
HttpServerV2 server = new HttpServerV2(9090);
server.start();
}
}
| UTF-8 | Java | 3,262 | java | HttpServerV2.java | Java | [] | null | [] | package java30_0613;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
// 表示服务器主干逻辑
public class HttpServerV2 {
private ServerSocket serverSocket = null;
public HttpServerV2(int port) throws IOException {
serverSocket = new ServerSocket(port);
}
public void start() throws IOException {
System.out.println("服务器启动");
ExecutorService executorService = Executors.newCachedThreadPool();
while (true) {
Socket clientSocket = serverSocket.accept();
executorService.execute(new Runnable() {
@Override
public void run() {
try {
process(clientSocket);
} catch (IOException e) {
e.printStackTrace();
}
}
});
}
}
private void process(Socket clientSocket) throws IOException {
// 1. 构造并解析请求(本质上就是一个反序列化操作)
Request request = Request.build(clientSocket.getInputStream());
System.out.println("request: " + request);
// 2. 准备一个响应对象
Response response = Response.build(clientSocket.getOutputStream());
// 3. 根据请求来生成响应
if (request.getUrl().equals("/200")) {
response.setStatus(200);
response.setMessage("OK");
response.setHeader("Content-Type", "text/html; charset=utf-8");
response.writeBody("<html>");
response.writeBody("200 OK");
response.writeBody("</html>");
} else if (request.getUrl().startsWith("/calc")) {
// URL: /calc?a=10&b=20
int a = Integer.parseInt(request.getParameter("a"));
int b = Integer.parseInt(request.getParameter("b"));
int result = a + b;
response.setStatus(200);
response.setMessage("OK");
response.setHeader("Content-Type", "text/html; charset=utf-8");
response.writeBody("<html>");
response.writeBody("result = " + result);
response.writeBody("</html>");
} else if (request.getUrl().startsWith("/cookie")) {
// 从服务器获取一个 cookie 写回到客户端
response.setStatus(200);
response.setMessage("OK");
String cookie = "sessionId=aaabbbccc";
response.setHeader("Set-Cookie", cookie);
response.setHeader("Content-Type", "text/html; charset=utf-8");
response.writeBody("<html>");
response.writeBody("服务器给客户端设置 cookie 了, cookie 的内容为: " + cookie);
response.writeBody("</html>");
}
// 4. 把响应写回到客户端(本质上就是一个序列化操作)
response.flush();
clientSocket.close(); // 此处关闭 socket 对象也就能自动关闭 InputStream 和 OutputStream
}
public static void main(String[] args) throws IOException {
HttpServerV2 server = new HttpServerV2(9090);
server.start();
}
}
| 3,262 | 0.575148 | 0.561964 | 82 | 36 | 22.120512 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.634146 | false | false | 15 |
e1a596c92684406bf26a76067a279803a3f53d07 | 28,784,870,861,269 | d25f6fb41db468e8454541276b89ef48e7557608 | /core/src/main/java/org/clickframes/model/Validation.java | 90636b37f95702155b80c6e76f6c0823300c5f6c | [] | no_license | CrawfordWCR/clickframes | https://github.com/CrawfordWCR/clickframes | 14258a807a841a6bb248fd6b0af62a2468e2494b | cc1cf62c56687762abf8e2d24a2459b47b6e2f5b | refs/heads/master | 2020-06-06T05:09:01.625000 | 2010-10-22T15:32:22 | 2010-10-22T15:32:22 | 34,627,031 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Clickframes: Full lifecycle software development automation.
* Copyright (C) 2009 Children's Hospital Boston
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.clickframes.model;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.clickframes.xmlbindings.ValidationType;
import org.clickframes.xmlbindings.ValidationsType;
/**
* @author Vineet Manohar
*/
public class Validation extends AbstractElement{
private final Log logger = LogFactory.getLog(getClass());
private String type;
private String typeArgs;
protected String description;
private String messageHtmlId;
private String negativeExample;
public Validation(String id, String type, String typeArgs, String description, AppspecElement parent) {
super(id, type, parent);
setType(type);
setTypeArgs(typeArgs);
setDescription(description);
}
/**
* @param type
* e.g. length(min=2,max=8)
* @param description
* @return
*
* @author Vineet Manohar
* @param string
*/
private static Validation create(String id, String typeAttribute, String description, AppspecElement parent) {
Pattern typePattern = Pattern.compile("^([^\\(]+)(\\((.*)\\))?$");
Matcher m = typePattern.matcher(typeAttribute);
if (!m.matches()) {
throw new RuntimeException("Bad format for validation type: " + typeAttribute);
}
String type = m.group(1);
String typeArgs = m.group(3);
if (type.equals("required")) {
return new RequiredValidation(id, type, typeArgs, description, parent);
}
if (type.equals("length")) {
return new LengthValidation(id, type, typeArgs, description, parent);
}
if (type.equals("regex")) {
return new RegexValidation(id, type, typeArgs, description, parent);
}
if (type.equals("matchesInput")) {
return new MatchesInputValidation(id, type, typeArgs, description, parent);
}
return new CustomValidation(id, type, typeArgs, description, parent);
}
public String getDescription() {
return description;
}
/**
* @return validation message, cleaned up to not throw errors in a
* JavaScript String declaration.
*/
public String getJavaScriptValidationMessage() {
if (getDescription() == null) {
logger.error("Your description is NULL. Your code monkey has failed you. Beat him!");
return null;
}
return getDescription().replace("'", "\\'");
}
public String getAuthoredOrGeneratedDescription() {
if (description != null) {
return description;
}
return getDefaultDescription();
}
public String getDefaultDescription() {
return "Invalid input";
}
public void setDescription(String description) {
this.description = description;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getTypeArgs() {
return typeArgs;
}
public void setTypeArgs(String typeArgs) {
this.typeArgs = typeArgs;
}
public Map<String, String> getArgsAsMap() {
Map<String, String> args = new HashMap<String, String>();
if (typeArgs != null) {
String[] nvps = typeArgs.split(",");
for (String nvp : nvps) {
String[] nv = nvp.split("=", 2);
String name = null;
String value = null;
if (nv.length > 0) {
name = nv[0];
}
if (nv.length > 1) {
value = nv[1];
}
if (name != null) {
args.put(name, value);
}
}
}
return args;
}
public String getArgAsString(String name) {
return getArgsAsMap().get(name);
}
public boolean hasArg(String name) {
return getArgsAsMap().containsKey(name);
}
/**
* @param name
* @return null if argument with this name not present
*
* @author Vineet Manohar
*/
public Integer getArgAsInteger(String name) {
String arg = getArgsAsMap().get(name);
if (arg == null) {
return null;
}
return Integer.parseInt(arg);
}
/**
* This field tell you where in the HTML the error message is expected to
* appear when this validation fails. This is used by test plugins.
*
* @return the id of the message (div or span element) in the rendered HTML
*
* @author Vineet Manohar
*/
public String getMessageHtmlId() {
return messageHtmlId;
}
public void setMessageHtmlId(String messageHtmlId) {
this.messageHtmlId = messageHtmlId;
}
public static List<Validation> createList(ValidationsType validationsType, AppspecElement parent) {
List<Validation> retVal = new ArrayList<Validation>();
if (validationsType != null) {
for (ValidationType validationType : validationsType.getValidation()) {
retVal.add(create(validationType, parent));
}
}
return retVal;
}
private static Validation create(ValidationType validationType, AppspecElement parent) {
String typeAttribute = validationType.getType();
String id = validationType.getId();
String description = validationType.getDescription();
Validation validation = create(id, typeAttribute, description, parent);
if (validationType.getNegativeExample() != null) {
validation.setNegativeExample(validationType.getNegativeExample().getValue());
}
return validation;
}
public String getNegativeExample() {
return negativeExample;
}
public void setNegativeExample(String negativeExample) {
this.negativeExample = negativeExample;
}
@Override
public String getMetaName() {
return "validation";
}
} | UTF-8 | Java | 7,071 | java | Validation.java | Java | [
{
"context": "rames.xmlbindings.ValidationsType;\n\n/**\n * @author Vineet Manohar\n */\npublic class Validation extends AbstractEleme",
"end": 1280,
"score": 0.9998694062232971,
"start": 1266,
"tag": "NAME",
"value": "Vineet Manohar"
},
{
"context": "m description\n * @return\n *\n * @author Vineet Manohar\n * @param string\n */\n private static V",
"end": 1939,
"score": 0.9998700618743896,
"start": 1925,
"tag": "NAME",
"value": "Vineet Manohar"
},
{
"context": "t with this name not present\n *\n * @author Vineet Manohar\n */\n public Integer getArgAsInteger(String",
"end": 5177,
"score": 0.9998924136161804,
"start": 5163,
"tag": "NAME",
"value": "Vineet Manohar"
},
{
"context": "lement) in the rendered HTML\n *\n * @author Vineet Manohar\n */\n public String getMessageHtmlId() {\n ",
"end": 5671,
"score": 0.9998891353607178,
"start": 5657,
"tag": "NAME",
"value": "Vineet Manohar"
}
] | null | [] | /*
* Clickframes: Full lifecycle software development automation.
* Copyright (C) 2009 Children's Hospital Boston
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.clickframes.model;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.clickframes.xmlbindings.ValidationType;
import org.clickframes.xmlbindings.ValidationsType;
/**
* @author <NAME>
*/
public class Validation extends AbstractElement{
private final Log logger = LogFactory.getLog(getClass());
private String type;
private String typeArgs;
protected String description;
private String messageHtmlId;
private String negativeExample;
public Validation(String id, String type, String typeArgs, String description, AppspecElement parent) {
super(id, type, parent);
setType(type);
setTypeArgs(typeArgs);
setDescription(description);
}
/**
* @param type
* e.g. length(min=2,max=8)
* @param description
* @return
*
* @author <NAME>
* @param string
*/
private static Validation create(String id, String typeAttribute, String description, AppspecElement parent) {
Pattern typePattern = Pattern.compile("^([^\\(]+)(\\((.*)\\))?$");
Matcher m = typePattern.matcher(typeAttribute);
if (!m.matches()) {
throw new RuntimeException("Bad format for validation type: " + typeAttribute);
}
String type = m.group(1);
String typeArgs = m.group(3);
if (type.equals("required")) {
return new RequiredValidation(id, type, typeArgs, description, parent);
}
if (type.equals("length")) {
return new LengthValidation(id, type, typeArgs, description, parent);
}
if (type.equals("regex")) {
return new RegexValidation(id, type, typeArgs, description, parent);
}
if (type.equals("matchesInput")) {
return new MatchesInputValidation(id, type, typeArgs, description, parent);
}
return new CustomValidation(id, type, typeArgs, description, parent);
}
public String getDescription() {
return description;
}
/**
* @return validation message, cleaned up to not throw errors in a
* JavaScript String declaration.
*/
public String getJavaScriptValidationMessage() {
if (getDescription() == null) {
logger.error("Your description is NULL. Your code monkey has failed you. Beat him!");
return null;
}
return getDescription().replace("'", "\\'");
}
public String getAuthoredOrGeneratedDescription() {
if (description != null) {
return description;
}
return getDefaultDescription();
}
public String getDefaultDescription() {
return "Invalid input";
}
public void setDescription(String description) {
this.description = description;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getTypeArgs() {
return typeArgs;
}
public void setTypeArgs(String typeArgs) {
this.typeArgs = typeArgs;
}
public Map<String, String> getArgsAsMap() {
Map<String, String> args = new HashMap<String, String>();
if (typeArgs != null) {
String[] nvps = typeArgs.split(",");
for (String nvp : nvps) {
String[] nv = nvp.split("=", 2);
String name = null;
String value = null;
if (nv.length > 0) {
name = nv[0];
}
if (nv.length > 1) {
value = nv[1];
}
if (name != null) {
args.put(name, value);
}
}
}
return args;
}
public String getArgAsString(String name) {
return getArgsAsMap().get(name);
}
public boolean hasArg(String name) {
return getArgsAsMap().containsKey(name);
}
/**
* @param name
* @return null if argument with this name not present
*
* @author <NAME>
*/
public Integer getArgAsInteger(String name) {
String arg = getArgsAsMap().get(name);
if (arg == null) {
return null;
}
return Integer.parseInt(arg);
}
/**
* This field tell you where in the HTML the error message is expected to
* appear when this validation fails. This is used by test plugins.
*
* @return the id of the message (div or span element) in the rendered HTML
*
* @author <NAME>
*/
public String getMessageHtmlId() {
return messageHtmlId;
}
public void setMessageHtmlId(String messageHtmlId) {
this.messageHtmlId = messageHtmlId;
}
public static List<Validation> createList(ValidationsType validationsType, AppspecElement parent) {
List<Validation> retVal = new ArrayList<Validation>();
if (validationsType != null) {
for (ValidationType validationType : validationsType.getValidation()) {
retVal.add(create(validationType, parent));
}
}
return retVal;
}
private static Validation create(ValidationType validationType, AppspecElement parent) {
String typeAttribute = validationType.getType();
String id = validationType.getId();
String description = validationType.getDescription();
Validation validation = create(id, typeAttribute, description, parent);
if (validationType.getNegativeExample() != null) {
validation.setNegativeExample(validationType.getNegativeExample().getValue());
}
return validation;
}
public String getNegativeExample() {
return negativeExample;
}
public void setNegativeExample(String negativeExample) {
this.negativeExample = negativeExample;
}
@Override
public String getMetaName() {
return "validation";
}
} | 7,039 | 0.622119 | 0.618442 | 236 | 28.966103 | 26.452526 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.563559 | false | false | 15 |
784b4d8d710e30e1d97380b7603395669e6b9ecc | 17,763,984,744,680 | 2bffed172b10aab9b808d2b3636f3a5bb6240a0b | /app/src/main/java/event/superman/com/androidmorethread/MyIntentService.java | e2b475d217157a0e04a46bb6d482e908d028fb55 | [] | no_license | Sususuperman/AndroidMoreThread | https://github.com/Sususuperman/AndroidMoreThread | 8e8da944c45236e4d9b9ee08ac6afd86a22b60fc | 77c35538271615ca1d4a12c77772473d032041d5 | refs/heads/master | 2020-04-11T03:10:08.465000 | 2018-12-18T06:21:04 | 2018-12-18T06:21:04 | 161,469,505 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package event.superman.com.androidmorethread;
import android.app.IntentService;
import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.Nullable;
import android.telecom.Call;
import android.util.Log;
/**
* 作者 Superman
* 日期 2018/12/13 15:36.
* 文件 AndroidMoreThread
* 描述 四大组件activity和service是不能通过new来进行创建的。
* 四大组件是系统管理的
组件要“注册”给系统才会有作用
你只有“注册”或“不注册”的权利。
*/
public class MyIntentService extends IntentService {
public static final String TOAST_ACTION = "toast_action";
public static final String INDEX = "index";
public static CallbackListener listener;
public MyIntentService() {
super("MyIntentService");
}
/**
* 实现异步任务的方法
*
* @param intent Activity传递过来的Intent,数据封装在intent中
*/
@Override
protected void onHandleIntent(@Nullable Intent intent) {
String toast = intent.getStringExtra(TOAST_ACTION);
int index = intent.getIntExtra(INDEX,0);
try {
Thread.sleep(1000);
Message message = Message.obtain();
message.obj = toast+"。。经过耗时";
message.what = index;
//更新ui
if(listener!=null){
listener.update(message);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public static void setCallbackListener(CallbackListener listener1){
listener = listener1;
}
interface CallbackListener{
void update(Message msg);
// default void toast(){
//
// }
}
Handler handler = new Handler(){};//与主线程looper绑定。在主线程中运行
@Override
public void onCreate() {
super.onCreate();
Log.i("TAG",handler.getLooper().getThread().getName());
}
}
| UTF-8 | Java | 2,006 | java | MyIntentService.java | Java | [
{
"context": ".telecom.Call;\nimport android.util.Log;\n\n/**\n * 作者 Superman\n * 日期 2018/12/13 15:36.\n * 文件 AndroidMoreThread\n ",
"end": 283,
"score": 0.9811294078826904,
"start": 275,
"tag": "USERNAME",
"value": "Superman"
}
] | null | [] | package event.superman.com.androidmorethread;
import android.app.IntentService;
import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.Nullable;
import android.telecom.Call;
import android.util.Log;
/**
* 作者 Superman
* 日期 2018/12/13 15:36.
* 文件 AndroidMoreThread
* 描述 四大组件activity和service是不能通过new来进行创建的。
* 四大组件是系统管理的
组件要“注册”给系统才会有作用
你只有“注册”或“不注册”的权利。
*/
public class MyIntentService extends IntentService {
public static final String TOAST_ACTION = "toast_action";
public static final String INDEX = "index";
public static CallbackListener listener;
public MyIntentService() {
super("MyIntentService");
}
/**
* 实现异步任务的方法
*
* @param intent Activity传递过来的Intent,数据封装在intent中
*/
@Override
protected void onHandleIntent(@Nullable Intent intent) {
String toast = intent.getStringExtra(TOAST_ACTION);
int index = intent.getIntExtra(INDEX,0);
try {
Thread.sleep(1000);
Message message = Message.obtain();
message.obj = toast+"。。经过耗时";
message.what = index;
//更新ui
if(listener!=null){
listener.update(message);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public static void setCallbackListener(CallbackListener listener1){
listener = listener1;
}
interface CallbackListener{
void update(Message msg);
// default void toast(){
//
// }
}
Handler handler = new Handler(){};//与主线程looper绑定。在主线程中运行
@Override
public void onCreate() {
super.onCreate();
Log.i("TAG",handler.getLooper().getThread().getName());
}
}
| 2,006 | 0.634787 | 0.624161 | 69 | 24.913044 | 19.098326 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.405797 | false | false | 15 |
876754c3126f6489333f6f685c318a1782650bd7 | 29,386,166,257,232 | fe36ef71abf8c93d6791f90e124ec5f52b8cf1bb | /Examples/src/main/java/com/groupdocs/watermark/examples/MainClass.java | 1c01a4e7a365d499ec7b56961419d1c44c44205b | [
"MIT"
] | permissive | groupdocs-watermark/GroupDocs.Watermark-for-Java | https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-Java | bf20e22062d97557de7aa09338d561c35a3bb683 | fed5e7f0ed1c05bfb0e3890bb03179d4dc2d90cc | refs/heads/master | 2022-12-09T08:38:20.165000 | 2021-06-24T12:00:00 | 2021-06-24T12:00:00 | 119,377,660 | 7 | 3 | MIT | false | 2022-12-06T00:39:43 | 2018-01-29T12:08:16 | 2021-11-29T11:02:41 | 2022-12-06T00:39:41 | 12,317 | 5 | 3 | 1 | null | false | false | package com.groupdocs.watermark.examples;
import com.groupdocs.watermark.examples.quick_start.*;
import com.groupdocs.watermark.examples.basic_usage.*;
import com.groupdocs.watermark.examples.advanced_usage.loading_documents.*;
import com.groupdocs.watermark.examples.advanced_usage.adding_watermarks.add_watermarks_to_email_attachments.*;
import com.groupdocs.watermark.examples.advanced_usage.adding_watermarks.add_watermarks_to_images.*;
import com.groupdocs.watermark.examples.advanced_usage.adding_watermarks.add_watermarks_to_pdf.*;
import com.groupdocs.watermark.examples.advanced_usage.adding_watermarks.add_watermarks_to_presentations.*;
import com.groupdocs.watermark.examples.advanced_usage.adding_watermarks.add_watermarks_to_spreadsheets.*;
import com.groupdocs.watermark.examples.advanced_usage.adding_watermarks.add_watermarks_to_word_processing.*;
import com.groupdocs.watermark.examples.advanced_usage.adding_watermarks.adding_image_watermarks.*;
import com.groupdocs.watermark.examples.advanced_usage.adding_watermarks.adding_text_watermarks.*;
import com.groupdocs.watermark.examples.advanced_usage.adding_watermarks.add_watermarks_to_diagrams.*;
import com.groupdocs.watermark.examples.advanced_usage.saving_documents.*;
import com.groupdocs.watermark.examples.advanced_usage.searching_and_modifying_watermarks.*;
public class MainClass {
public static void main(String[] args) throws Throwable {
System.out.println("Open MainClass.java.\n");
System.out.println("In main() method uncomment the example that you want to run.");
System.out.println("=====================================================");
// NOTE: Please uncomment the example you want to try out
//region Quick Start
SetLicenseFromFile.run();
// SetLicenseFromStream.run();
// SetMeteredLicense.run();
// HelloWorld.run();
//endregion
//region Basic Usage
// GetSupportedFileFormats.run();
// GetDocumentInfoForTheFileFromLocalDisk.run();
// GetDocumentInfoForTheFileFromStream.run();
// AddATextWatermark.run();
// AddAnImageWatermark.run();
// GenerateDocumentPreview.run();
//endregion
//region Advanced Usage
//region Loading Documents
// LoadFromLocalDisk.run();
// LoadFromStream.run();
// LoadingDocumentOfSpecificFormat.run();
// LoadPasswordProtectedDocument.run();
// LoadPasswordProtectedWordProcessingDocument.run();
//endregion
//region AddingTextWatermarks
// AddTextWatermark.run();
// AddWatermarkToAbsolutePosition.run();
// AddWatermarkToRelativePosition.run();
// AddWatermarkWithMarginType.run();
// AddWatermarkWithSizeType.run();
// AddTextWatermarkWithRotationAngle.run();
// AddWatermarkWithParentMargin.run();
//endregion
//region AddingImageWatermarks
// AddImageWatermark.run();
// AddImageWatermarkUsingStream.run();
//endregion
//region AddWatermarksToDiagrams
// DiagramAddWatermarkToAllPagesOfParticularType.run();
// DiagramAddWatermarkToSeparateBackgroundPage.run();
// DiagramAddWatermarkToParticularPage.run();
// DiagramLockWatermarkShape.run();
// DiagramRemoveWatermark.run();
// DiagramGetShapesInformation.run();
// DiagramRemoveShape.run();
// DiagramRemoveTextShapesWithParticularTextFormatting.run();
// DiagramRemoveHyperlinks.run();
// DiagramReplaceTextForParticularShapes.run();
// DiagramReplaceTextWithFormatting.run();
// DiagramReplaceShapeImage.run();
// DiagramGetHeaderFooterInformation.run();
// DiagramRemoveOrReplaceHeaderFooter.run();
//endregion
//region AddWatermarksToEmailAttachments
// EmailAddWatermarkToAllAttachments.run();
// EmailExtractAllAttachments.run();
// EmailRemoveAttachment.run();
// EmailAddAttachment.run();
// EmailUpdateBody.run();
// EmailAddEmbeddedImage.run();
// EmailRemoveEmbeddedImages.run();
// EmailSearchTextInBody.run();
// EmailListRecipients.run();
//endregion
//region AddWatermarksToImages
// AddWatermarkToImage.run();
// AddWatermarkToImagesInsideDocument.run();
//endregion
//region AddWatermarksToPdf
// PdfAddWatermarks.run();
// PdfAddWatermarkToImages.run();
// PdfGetDimensions.run();
// PdfAddWatermarkWithPageMarginType.run();
// PdfAddWatermarkToAllAttachments.run();
// PdfAddArtifactWatermark.run();
// PdfAddAnnotationWatermark.run();
// PdfAddPrintOnlyAnnotationWatermark.run();
// PdfRasterizeDocument.run();
// PdfRasterizePage.run();
// PdfRemoveWatermark.run();
// PdfExtractXObjectInformation.run();
// PdfRemoveXObject.run();
// PdfRemoveXObjectWithParticularTextFormatting.run();
// PdfAddWatermarkToXObjects.run();
// PdfReplaceTextForParticularXObject.run();
// PdfReplaceTextForParticularXObjectWithFormatting.run();
// PdfReplaceImageForParticularXObject.run();
// PdfExtractArtifactInformation.run();
// PdfRemoveArtifact.run();
// PdfRemoveArtifactsWithParticularTextFormatting.run();
// PdfAddWatermarkToImageArtifacts.run();
// PdfReplaceTextForParticularArtifact.run();
// PdfReplaceTextForParticularArtifactWithFormatting.run();
// PdfReplaceImageForParticularArtifact.run();
// PdfExtractAnnotationInformation.run();
// PdfRemoveAnnotation.run();
// PdfRemoveAnnotationsWithParticularTextFormatting.run();
// PdfAddWatermarkToAnnotationImages.run();
// PdfReplaceTextForParticularAnnotation.run();
// PdfReplaceTextForParticularAnnotationWithFormatting.run();
// PdfReplaceImageForParticularAnnotation.run();
// PdfExtractAllAttachments.run();
// PdfAddAttachment.run();
// PdfRemoveAttachment.run();
// PdfSearchImageInAttachment.run();
//endregion
//region AddWatermarksToPresentations
// PresentationAddWatermarkToSlide.run();
// PresentationProtectWatermarkUsingUnreadableCharacters.run();
// PresentationGetSlideDimensions.run();
// PresentationAddWatermarkToSlideImages.run();
// PresentationAddWatermarkToAllSlideTypes.run();
// PresentationAddWatermarkWithSlidesShapeSettings.run();
// PresentationAddWatermarkWithTextEffects.run();
// PresentationAddWatermarkWithImageEffects.run();
// PresentationGetSlideBackgroundsInformation.run();
// PresentationRemoveSlideBackground.run();
// PresentationAddWatermarkToSlideBackgroundImages.run();
// PresentationSetTiledSemitransparentBackground.run();
// PresentationSetBackgroundImageForChart.run();
//endregion
//region AddWatermarksToSpreadsheets
// SpreadsheetAddWatermarkToWorksheet.run();
// SpreadsheetGetContentAreaDimensions.run();
// SpreadsheetAddWatermarkToWorksheetImages.run();
// SpreadsheetAddModernWordArtWatermark.run();
// SpreadsheetAddWatermarkUsingShapeSettings.run();
// SpreadsheetAddWatermarkWithTextEffects.run();
// SpreadsheetAddWatermarkWithImageEffects.run();
// SpreadsheetAddWatermarkAsBackground.run();
// SpreadsheetAddWatermarkAsBackgroundWithRelativeSizeAndPosition.run();
// SpreadsheetAddTextWatermarkAsBackground.run();
// SpreadsheetAddImageWatermarkIntoHeaderFooter.run();
// SpreadsheetAddTextWatermarkIntoHeaderFooter.run();
// SpreadsheetGetInformationOfWorksheetBackgrounds.run();
// SpreadsheetRemoveWorksheetBackground.run();
// SpreadsheetAddWatermarkToBackgroundImages.run();
// SpreadsheetSetBackgroundImageForChart.run();
// SpreadsheetGetHeaderFooterInformation.run();
// SpreadsheetClearHeaderFooter.run();
// SpreadsheetClearSectionOfHeaderFooter.run();
// SpreadsheetAddWatermarkToImagesInHeaderFooter.run();
// SpreadsheetExtractAllAttachments.run();
// SpreadsheetAddAttachment.run();
// SpreadsheetAddLinkedAttachment.run();
// SpreadsheetRemoveAttachment.run();
// SpreadsheetAddWatermarkToAttachment.run();
// SpreadsheetSearchImageInAttachment.run();
// SpreadsheetGetShapesInformation.run();
// SpreadsheetRemoveShape.run();
// SpreadsheetRemoveTextShapesWithParticularTextFormatting.run();
// SpreadsheetRemoveHyperlinks.run();
// SpreadsheetReplaceTextForParticularShapes.run();
// SpreadsheetReplaceTextWithFormattingForParticularShapes.run();
// SpreadsheetReplaceImageOfParticularShapes.run();
// SpreadsheetSetBackgroundImageForParticularShapes.run();
// SpreadsheetUpdateShapeProperties.run();
//endregion
//region AddWatermarksToWordProcessing
// WordProcessingAddWatermarkToSection.run();
// WordProcessingGetSectionProperties.run();
// WordProcessingAddWatermarkToSectionImages.run();
// WordProcessingAddWatermarkToShapeImages.run();
// WordProcessingAddWatermarkToParticularPage.run();
// WordProcessingLinkHeaderFooterInSection.run();
// WordProcessingLinkAllHeaderFooterInSection.run();
// WordProcessingAddImageWatermarkToAllHeaders.run();
// WordProcessingSetDifferentFirstPageHeaderFooter.run();
// WordProcessingAddLockedWatermarkToAllPages.run();
// WordProcessingAddLockedWatermarkToParticularPages.run();
// WordProcessingAddLockedWatermarkToSection.run();
// WordProcessingAddWatermarkWithShapeSettings.run();
// WordProcessingAddWatermarkWithTextEffects.run();
// WordProcessingAddWatermarkWithImageEffects.run();
// WordProcessingRemoveWatermarkFromSection.run();
// WordProcessingFindWatermarkInHeaderFooter.run();
// WordProcessingGetShapesInformation.run();
// WordProcessingShapeTypeUsage.run();
// WordProcessingRemoveShape.run();
// WordProcessingRemoveShapesWithParticularTextFormatting.run();
// WordProcessingRemoveHyperlinks.run();
// WordProcessingReplaceTextForParticularShape.run();
// WordProcessingReplaceShapeTextWithFormattedText.run();
// WordProcessingReplaceShapeImage.run();
// WordProcessingModifyShapeProperties.run();
// WordProcessingProtectDocument.run();
// WordProcessingUnProtectDocument.run();
//endregion
//region SavingDocuments
// SaveDocumentToTheSpecifiedLocation.run();
// SaveDocumentToTheSpecifiedStream.run();
//endregion
//region SearchAndRemoveWatermarks
// SearchWatermark.run();
// SearchWatermarkWithSearchString.run();
// SearchWatermarkWithRegularExpression.run();
// SearchImageWatermark.run();
// SearchWatermarkWithCombinedSearch.run();
// SearchWatermarkWithParticularTextFormatting.run();
// SearchWatermarkInParticularObjectsAllInstances.run();
// SearchWatermarkInParticularObjectsForParticularDocument.run();
// SearchTextWatermarkSkippingUnreadableCharacters.run();
// RemoveWatermark.run();
// RemoveWatermarkWithParticularTextFormatting.run();
// RemoveHyperlinksWithParticularUrl.run();
// ModifyTextInFoundWatermarks.run();
// ModifyTextWithFormattingInFoundWatermarks.run();
// ModifyImageInFoundWatermarks.run();
//endregion
//endregion
System.out.println("\nAll done.");
}
}
| UTF-8 | Java | 11,802 | java | MainClass.java | Java | [] | null | [] | package com.groupdocs.watermark.examples;
import com.groupdocs.watermark.examples.quick_start.*;
import com.groupdocs.watermark.examples.basic_usage.*;
import com.groupdocs.watermark.examples.advanced_usage.loading_documents.*;
import com.groupdocs.watermark.examples.advanced_usage.adding_watermarks.add_watermarks_to_email_attachments.*;
import com.groupdocs.watermark.examples.advanced_usage.adding_watermarks.add_watermarks_to_images.*;
import com.groupdocs.watermark.examples.advanced_usage.adding_watermarks.add_watermarks_to_pdf.*;
import com.groupdocs.watermark.examples.advanced_usage.adding_watermarks.add_watermarks_to_presentations.*;
import com.groupdocs.watermark.examples.advanced_usage.adding_watermarks.add_watermarks_to_spreadsheets.*;
import com.groupdocs.watermark.examples.advanced_usage.adding_watermarks.add_watermarks_to_word_processing.*;
import com.groupdocs.watermark.examples.advanced_usage.adding_watermarks.adding_image_watermarks.*;
import com.groupdocs.watermark.examples.advanced_usage.adding_watermarks.adding_text_watermarks.*;
import com.groupdocs.watermark.examples.advanced_usage.adding_watermarks.add_watermarks_to_diagrams.*;
import com.groupdocs.watermark.examples.advanced_usage.saving_documents.*;
import com.groupdocs.watermark.examples.advanced_usage.searching_and_modifying_watermarks.*;
public class MainClass {
public static void main(String[] args) throws Throwable {
System.out.println("Open MainClass.java.\n");
System.out.println("In main() method uncomment the example that you want to run.");
System.out.println("=====================================================");
// NOTE: Please uncomment the example you want to try out
//region Quick Start
SetLicenseFromFile.run();
// SetLicenseFromStream.run();
// SetMeteredLicense.run();
// HelloWorld.run();
//endregion
//region Basic Usage
// GetSupportedFileFormats.run();
// GetDocumentInfoForTheFileFromLocalDisk.run();
// GetDocumentInfoForTheFileFromStream.run();
// AddATextWatermark.run();
// AddAnImageWatermark.run();
// GenerateDocumentPreview.run();
//endregion
//region Advanced Usage
//region Loading Documents
// LoadFromLocalDisk.run();
// LoadFromStream.run();
// LoadingDocumentOfSpecificFormat.run();
// LoadPasswordProtectedDocument.run();
// LoadPasswordProtectedWordProcessingDocument.run();
//endregion
//region AddingTextWatermarks
// AddTextWatermark.run();
// AddWatermarkToAbsolutePosition.run();
// AddWatermarkToRelativePosition.run();
// AddWatermarkWithMarginType.run();
// AddWatermarkWithSizeType.run();
// AddTextWatermarkWithRotationAngle.run();
// AddWatermarkWithParentMargin.run();
//endregion
//region AddingImageWatermarks
// AddImageWatermark.run();
// AddImageWatermarkUsingStream.run();
//endregion
//region AddWatermarksToDiagrams
// DiagramAddWatermarkToAllPagesOfParticularType.run();
// DiagramAddWatermarkToSeparateBackgroundPage.run();
// DiagramAddWatermarkToParticularPage.run();
// DiagramLockWatermarkShape.run();
// DiagramRemoveWatermark.run();
// DiagramGetShapesInformation.run();
// DiagramRemoveShape.run();
// DiagramRemoveTextShapesWithParticularTextFormatting.run();
// DiagramRemoveHyperlinks.run();
// DiagramReplaceTextForParticularShapes.run();
// DiagramReplaceTextWithFormatting.run();
// DiagramReplaceShapeImage.run();
// DiagramGetHeaderFooterInformation.run();
// DiagramRemoveOrReplaceHeaderFooter.run();
//endregion
//region AddWatermarksToEmailAttachments
// EmailAddWatermarkToAllAttachments.run();
// EmailExtractAllAttachments.run();
// EmailRemoveAttachment.run();
// EmailAddAttachment.run();
// EmailUpdateBody.run();
// EmailAddEmbeddedImage.run();
// EmailRemoveEmbeddedImages.run();
// EmailSearchTextInBody.run();
// EmailListRecipients.run();
//endregion
//region AddWatermarksToImages
// AddWatermarkToImage.run();
// AddWatermarkToImagesInsideDocument.run();
//endregion
//region AddWatermarksToPdf
// PdfAddWatermarks.run();
// PdfAddWatermarkToImages.run();
// PdfGetDimensions.run();
// PdfAddWatermarkWithPageMarginType.run();
// PdfAddWatermarkToAllAttachments.run();
// PdfAddArtifactWatermark.run();
// PdfAddAnnotationWatermark.run();
// PdfAddPrintOnlyAnnotationWatermark.run();
// PdfRasterizeDocument.run();
// PdfRasterizePage.run();
// PdfRemoveWatermark.run();
// PdfExtractXObjectInformation.run();
// PdfRemoveXObject.run();
// PdfRemoveXObjectWithParticularTextFormatting.run();
// PdfAddWatermarkToXObjects.run();
// PdfReplaceTextForParticularXObject.run();
// PdfReplaceTextForParticularXObjectWithFormatting.run();
// PdfReplaceImageForParticularXObject.run();
// PdfExtractArtifactInformation.run();
// PdfRemoveArtifact.run();
// PdfRemoveArtifactsWithParticularTextFormatting.run();
// PdfAddWatermarkToImageArtifacts.run();
// PdfReplaceTextForParticularArtifact.run();
// PdfReplaceTextForParticularArtifactWithFormatting.run();
// PdfReplaceImageForParticularArtifact.run();
// PdfExtractAnnotationInformation.run();
// PdfRemoveAnnotation.run();
// PdfRemoveAnnotationsWithParticularTextFormatting.run();
// PdfAddWatermarkToAnnotationImages.run();
// PdfReplaceTextForParticularAnnotation.run();
// PdfReplaceTextForParticularAnnotationWithFormatting.run();
// PdfReplaceImageForParticularAnnotation.run();
// PdfExtractAllAttachments.run();
// PdfAddAttachment.run();
// PdfRemoveAttachment.run();
// PdfSearchImageInAttachment.run();
//endregion
//region AddWatermarksToPresentations
// PresentationAddWatermarkToSlide.run();
// PresentationProtectWatermarkUsingUnreadableCharacters.run();
// PresentationGetSlideDimensions.run();
// PresentationAddWatermarkToSlideImages.run();
// PresentationAddWatermarkToAllSlideTypes.run();
// PresentationAddWatermarkWithSlidesShapeSettings.run();
// PresentationAddWatermarkWithTextEffects.run();
// PresentationAddWatermarkWithImageEffects.run();
// PresentationGetSlideBackgroundsInformation.run();
// PresentationRemoveSlideBackground.run();
// PresentationAddWatermarkToSlideBackgroundImages.run();
// PresentationSetTiledSemitransparentBackground.run();
// PresentationSetBackgroundImageForChart.run();
//endregion
//region AddWatermarksToSpreadsheets
// SpreadsheetAddWatermarkToWorksheet.run();
// SpreadsheetGetContentAreaDimensions.run();
// SpreadsheetAddWatermarkToWorksheetImages.run();
// SpreadsheetAddModernWordArtWatermark.run();
// SpreadsheetAddWatermarkUsingShapeSettings.run();
// SpreadsheetAddWatermarkWithTextEffects.run();
// SpreadsheetAddWatermarkWithImageEffects.run();
// SpreadsheetAddWatermarkAsBackground.run();
// SpreadsheetAddWatermarkAsBackgroundWithRelativeSizeAndPosition.run();
// SpreadsheetAddTextWatermarkAsBackground.run();
// SpreadsheetAddImageWatermarkIntoHeaderFooter.run();
// SpreadsheetAddTextWatermarkIntoHeaderFooter.run();
// SpreadsheetGetInformationOfWorksheetBackgrounds.run();
// SpreadsheetRemoveWorksheetBackground.run();
// SpreadsheetAddWatermarkToBackgroundImages.run();
// SpreadsheetSetBackgroundImageForChart.run();
// SpreadsheetGetHeaderFooterInformation.run();
// SpreadsheetClearHeaderFooter.run();
// SpreadsheetClearSectionOfHeaderFooter.run();
// SpreadsheetAddWatermarkToImagesInHeaderFooter.run();
// SpreadsheetExtractAllAttachments.run();
// SpreadsheetAddAttachment.run();
// SpreadsheetAddLinkedAttachment.run();
// SpreadsheetRemoveAttachment.run();
// SpreadsheetAddWatermarkToAttachment.run();
// SpreadsheetSearchImageInAttachment.run();
// SpreadsheetGetShapesInformation.run();
// SpreadsheetRemoveShape.run();
// SpreadsheetRemoveTextShapesWithParticularTextFormatting.run();
// SpreadsheetRemoveHyperlinks.run();
// SpreadsheetReplaceTextForParticularShapes.run();
// SpreadsheetReplaceTextWithFormattingForParticularShapes.run();
// SpreadsheetReplaceImageOfParticularShapes.run();
// SpreadsheetSetBackgroundImageForParticularShapes.run();
// SpreadsheetUpdateShapeProperties.run();
//endregion
//region AddWatermarksToWordProcessing
// WordProcessingAddWatermarkToSection.run();
// WordProcessingGetSectionProperties.run();
// WordProcessingAddWatermarkToSectionImages.run();
// WordProcessingAddWatermarkToShapeImages.run();
// WordProcessingAddWatermarkToParticularPage.run();
// WordProcessingLinkHeaderFooterInSection.run();
// WordProcessingLinkAllHeaderFooterInSection.run();
// WordProcessingAddImageWatermarkToAllHeaders.run();
// WordProcessingSetDifferentFirstPageHeaderFooter.run();
// WordProcessingAddLockedWatermarkToAllPages.run();
// WordProcessingAddLockedWatermarkToParticularPages.run();
// WordProcessingAddLockedWatermarkToSection.run();
// WordProcessingAddWatermarkWithShapeSettings.run();
// WordProcessingAddWatermarkWithTextEffects.run();
// WordProcessingAddWatermarkWithImageEffects.run();
// WordProcessingRemoveWatermarkFromSection.run();
// WordProcessingFindWatermarkInHeaderFooter.run();
// WordProcessingGetShapesInformation.run();
// WordProcessingShapeTypeUsage.run();
// WordProcessingRemoveShape.run();
// WordProcessingRemoveShapesWithParticularTextFormatting.run();
// WordProcessingRemoveHyperlinks.run();
// WordProcessingReplaceTextForParticularShape.run();
// WordProcessingReplaceShapeTextWithFormattedText.run();
// WordProcessingReplaceShapeImage.run();
// WordProcessingModifyShapeProperties.run();
// WordProcessingProtectDocument.run();
// WordProcessingUnProtectDocument.run();
//endregion
//region SavingDocuments
// SaveDocumentToTheSpecifiedLocation.run();
// SaveDocumentToTheSpecifiedStream.run();
//endregion
//region SearchAndRemoveWatermarks
// SearchWatermark.run();
// SearchWatermarkWithSearchString.run();
// SearchWatermarkWithRegularExpression.run();
// SearchImageWatermark.run();
// SearchWatermarkWithCombinedSearch.run();
// SearchWatermarkWithParticularTextFormatting.run();
// SearchWatermarkInParticularObjectsAllInstances.run();
// SearchWatermarkInParticularObjectsForParticularDocument.run();
// SearchTextWatermarkSkippingUnreadableCharacters.run();
// RemoveWatermark.run();
// RemoveWatermarkWithParticularTextFormatting.run();
// RemoveHyperlinksWithParticularUrl.run();
// ModifyTextInFoundWatermarks.run();
// ModifyTextWithFormattingInFoundWatermarks.run();
// ModifyImageInFoundWatermarks.run();
//endregion
//endregion
System.out.println("\nAll done.");
}
}
| 11,802 | 0.704203 | 0.704203 | 301 | 38.209301 | 26.008421 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.654485 | false | false | 15 |
16e7c61c8f86b3067ce6b0cbe8332d05cce9e030 | 28,398,323,813,861 | 8265b82f2f54c9fba69f49a44bc9447592e5c9f2 | /src/test/java/cloudos/appstore/AppStoreCrudIT.java | 3f8235e98577e7243883a338817e9b928fbf7e1c | [] | no_license | cloudstead/appstore-server | https://github.com/cloudstead/appstore-server | 8336e191994603d0e7b8b52a87ff6b291756d398 | 3ed0e3bea76962517e1e8e2714e23743ce09cd8a | refs/heads/master | 2021-01-15T07:53:15.208000 | 2015-10-07T22:13:14 | 2015-10-07T22:13:14 | 24,455,657 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cloudos.appstore;
import cloudos.appstore.model.*;
import org.cobbzilla.wizard.model.ApiToken;
import cloudos.appstore.model.support.AppStoreAccountRegistration;
import cloudos.appstore.test.AppStoreTestUtil;
import cloudos.appstore.test.TestApp;
import lombok.Cleanup;
import org.cobbzilla.wizard.api.NotFoundException;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.File;
import static org.junit.Assert.*;
public class AppStoreCrudIT extends AppStoreITBase {
public static final String DOC_TARGET = "account registration and app publishing";
private static TestApp testApp;
@BeforeClass public static void setupApp() throws Exception {
testApp = webServer.buildAppBundle(TEST_MANIFEST, null, TEST_ICON);
}
@Test public void testAppCrud () throws Exception {
apiDocs.startRecording(DOC_TARGET, "register an account and publish an app");
final AppStoreAccountRegistration registration = AppStoreTestUtil.buildPublisherRegistration();
apiDocs.addNote("send the registration request");
final ApiToken token = appStoreClient.registerAccount(registration);
assertNotNull(token);
assertNotNull(token.getToken());
apiDocs.addNote("lookup the account we just registered");
final AppStoreAccount found = appStoreClient.findAccount();
assertEquals(registration.getEmail(), found.getEmail());
assertNull(found.getHashedPassword());
assertNotNull(found.getUuid());
final String accountUuid = found.getUuid();
apiDocs.addNote("lookup the publisher associated with the account");
final AppStorePublisher publisher = appStoreClient.findPublisher(accountUuid);
final String pubName = publisher.getName();
assertEquals(registration.getName(), pubName);
apiDocs.addNote("define a cloud app");
CloudAppVersion appVersion = AppStoreTestUtil.newCloudApp(appStoreClient, pubName, testApp.getBundleUrl(), testApp.getBundleUrlSha());
assertEquals(testApp.getNameAndVersion(), appVersion.getApp()+"/"+appVersion.getVersion());
apiDocs.addNote("lookup the app we just defined");
final String appName = testApp.getManifest().getName();
final CloudApp foundApp = appStoreClient.findApp(pubName, appName);
assertNotNull(foundApp);
apiDocs.addNote("request the bundle asset for this version");
apiDocs.setBinaryResponse(".tar.gz tarball");
@Cleanup("delete") final File bundleFile = appStoreClient.getAppBundle(pubName, appName, appVersion.getVersion());
assertNotNull(bundleFile);
assertTrue(bundleFile.length() > 0);
apiDocs.addNote("request the taskbarIcon asset for this version");
apiDocs.setBinaryResponse("PNG image");
File taskbarIcon = appStoreClient.getAppAsset(pubName, appName, appVersion.getVersion(), "taskbarIcon");
assertNotNull(taskbarIcon);
assertTrue(taskbarIcon.length() > 0);
apiDocs.addNote("request to publish the app");
final String version = testApp.getManifest().getVersion();
appVersion = appStoreClient.updateAppStatus(pubName, appName, version, CloudAppStatus.pending);
assertEquals(CloudAppStatus.pending, appVersion.getStatus());
apiDocs.addNote("admin approves the app (note the session token -- it's different because this call is made by an admin user)");
publishApp(pubName, appName, version);
apiDocs.addNote("verify that the admin is listed as the author");
assertEquals(admin.getUuid(), appStoreClient.findVersion(pubName, appName, version).getApprovedBy());
appStoreClient.popToken();
apiDocs.addNote("request the latest bundle asset");
apiDocs.setBinaryResponse(".tar.gz tarball");
@Cleanup("delete") final File latestBundleFile = appStoreClient.getLatestAppBundle(pubName, appName);
assertNotNull(latestBundleFile);
assertTrue(bundleFile.length() > 0);
apiDocs.addNote("request the latest taskbarIcon asset");
apiDocs.setBinaryResponse("PNG image");
taskbarIcon = appStoreClient.getLatestAsset(pubName, appName, "taskbarIcon");
assertNotNull(taskbarIcon);
assertTrue(taskbarIcon.length() > 0);
apiDocs.addNote("delete the version");
appStoreClient.deleteVersion(pubName, appName, version);
try {
apiDocs.addNote("try to lookup the version, should fail");
final CloudAppVersion notFound = appStoreClient.findVersion(pubName, appName, version);
assertNull(notFound);
} catch (NotFoundException expected) { /* noop */ }
apiDocs.addNote("delete the app");
appStoreClient.deleteApp(pubName, appName);
try {
apiDocs.addNote("try to lookup the app, should fail");
final CloudApp notFound = appStoreClient.findApp(pubName, appName);
assertNull(notFound);
} catch (NotFoundException expected) { /* noop */ }
apiDocs.addNote("delete the account");
appStoreClient.deleteAccount();
appStoreClient.pushToken(adminToken);
try {
apiDocs.addNote("as admin, try to lookup the deleted account, should fail");
final AppStoreAccount notFound = appStoreClient.findAccount(accountUuid);
assertNull(notFound);
} catch (NotFoundException expected) { /* noop */ }
try {
apiDocs.addNote("as admin, try to lookup the deleted publisher, should fail");
final AppStorePublisher notFound = appStoreClient.findPublisher(accountUuid);
assertNull(notFound);
} catch (NotFoundException expected) { /* noop */ }
appStoreClient.popToken();
}
}
| UTF-8 | Java | 5,798 | java | AppStoreCrudIT.java | Java | [] | null | [] | package cloudos.appstore;
import cloudos.appstore.model.*;
import org.cobbzilla.wizard.model.ApiToken;
import cloudos.appstore.model.support.AppStoreAccountRegistration;
import cloudos.appstore.test.AppStoreTestUtil;
import cloudos.appstore.test.TestApp;
import lombok.Cleanup;
import org.cobbzilla.wizard.api.NotFoundException;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.File;
import static org.junit.Assert.*;
public class AppStoreCrudIT extends AppStoreITBase {
public static final String DOC_TARGET = "account registration and app publishing";
private static TestApp testApp;
@BeforeClass public static void setupApp() throws Exception {
testApp = webServer.buildAppBundle(TEST_MANIFEST, null, TEST_ICON);
}
@Test public void testAppCrud () throws Exception {
apiDocs.startRecording(DOC_TARGET, "register an account and publish an app");
final AppStoreAccountRegistration registration = AppStoreTestUtil.buildPublisherRegistration();
apiDocs.addNote("send the registration request");
final ApiToken token = appStoreClient.registerAccount(registration);
assertNotNull(token);
assertNotNull(token.getToken());
apiDocs.addNote("lookup the account we just registered");
final AppStoreAccount found = appStoreClient.findAccount();
assertEquals(registration.getEmail(), found.getEmail());
assertNull(found.getHashedPassword());
assertNotNull(found.getUuid());
final String accountUuid = found.getUuid();
apiDocs.addNote("lookup the publisher associated with the account");
final AppStorePublisher publisher = appStoreClient.findPublisher(accountUuid);
final String pubName = publisher.getName();
assertEquals(registration.getName(), pubName);
apiDocs.addNote("define a cloud app");
CloudAppVersion appVersion = AppStoreTestUtil.newCloudApp(appStoreClient, pubName, testApp.getBundleUrl(), testApp.getBundleUrlSha());
assertEquals(testApp.getNameAndVersion(), appVersion.getApp()+"/"+appVersion.getVersion());
apiDocs.addNote("lookup the app we just defined");
final String appName = testApp.getManifest().getName();
final CloudApp foundApp = appStoreClient.findApp(pubName, appName);
assertNotNull(foundApp);
apiDocs.addNote("request the bundle asset for this version");
apiDocs.setBinaryResponse(".tar.gz tarball");
@Cleanup("delete") final File bundleFile = appStoreClient.getAppBundle(pubName, appName, appVersion.getVersion());
assertNotNull(bundleFile);
assertTrue(bundleFile.length() > 0);
apiDocs.addNote("request the taskbarIcon asset for this version");
apiDocs.setBinaryResponse("PNG image");
File taskbarIcon = appStoreClient.getAppAsset(pubName, appName, appVersion.getVersion(), "taskbarIcon");
assertNotNull(taskbarIcon);
assertTrue(taskbarIcon.length() > 0);
apiDocs.addNote("request to publish the app");
final String version = testApp.getManifest().getVersion();
appVersion = appStoreClient.updateAppStatus(pubName, appName, version, CloudAppStatus.pending);
assertEquals(CloudAppStatus.pending, appVersion.getStatus());
apiDocs.addNote("admin approves the app (note the session token -- it's different because this call is made by an admin user)");
publishApp(pubName, appName, version);
apiDocs.addNote("verify that the admin is listed as the author");
assertEquals(admin.getUuid(), appStoreClient.findVersion(pubName, appName, version).getApprovedBy());
appStoreClient.popToken();
apiDocs.addNote("request the latest bundle asset");
apiDocs.setBinaryResponse(".tar.gz tarball");
@Cleanup("delete") final File latestBundleFile = appStoreClient.getLatestAppBundle(pubName, appName);
assertNotNull(latestBundleFile);
assertTrue(bundleFile.length() > 0);
apiDocs.addNote("request the latest taskbarIcon asset");
apiDocs.setBinaryResponse("PNG image");
taskbarIcon = appStoreClient.getLatestAsset(pubName, appName, "taskbarIcon");
assertNotNull(taskbarIcon);
assertTrue(taskbarIcon.length() > 0);
apiDocs.addNote("delete the version");
appStoreClient.deleteVersion(pubName, appName, version);
try {
apiDocs.addNote("try to lookup the version, should fail");
final CloudAppVersion notFound = appStoreClient.findVersion(pubName, appName, version);
assertNull(notFound);
} catch (NotFoundException expected) { /* noop */ }
apiDocs.addNote("delete the app");
appStoreClient.deleteApp(pubName, appName);
try {
apiDocs.addNote("try to lookup the app, should fail");
final CloudApp notFound = appStoreClient.findApp(pubName, appName);
assertNull(notFound);
} catch (NotFoundException expected) { /* noop */ }
apiDocs.addNote("delete the account");
appStoreClient.deleteAccount();
appStoreClient.pushToken(adminToken);
try {
apiDocs.addNote("as admin, try to lookup the deleted account, should fail");
final AppStoreAccount notFound = appStoreClient.findAccount(accountUuid);
assertNull(notFound);
} catch (NotFoundException expected) { /* noop */ }
try {
apiDocs.addNote("as admin, try to lookup the deleted publisher, should fail");
final AppStorePublisher notFound = appStoreClient.findPublisher(accountUuid);
assertNull(notFound);
} catch (NotFoundException expected) { /* noop */ }
appStoreClient.popToken();
}
}
| 5,798 | 0.697827 | 0.697137 | 131 | 43.259541 | 33.963066 | 142 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.961832 | false | false | 15 |
f60c98b3920edf8ea2e3c0cf65cad227fcbb0d62 | 11,751,030,541,068 | a2eb9c809951dc2a35bd94f6ef93114213d89609 | /oauth2-resource/src/main/java/com/teletic/oauth2resource/service/UserServiceImpl.java | ed327a2235b31b7a565b32c3086e46e72f6a6a09 | [] | no_license | GuttakindaBhaskar/oauth2-spring-boilerplate | https://github.com/GuttakindaBhaskar/oauth2-spring-boilerplate | 6527361c16478f00f33140bebdf94049bfde1ef8 | c82bee5ff12f88c95e76a142ed220c001cc7dcbc | refs/heads/main | 2023-03-27T16:35:55.720000 | 2021-03-13T22:41:46 | 2021-03-13T22:41:46 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.teletic.oauth2resource.service;
import com.teletic.oauth2resource.entity.User;
import com.teletic.oauth2resource.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.Optional;
@Service
@Transactional
public class UserServiceImpl implements UserService {
@Autowired
private UserRepository userRepository;
@Override
public void save(User user) {
userRepository.save(user);
}
@Override
public Optional<User> findByUsername(String username) {
return userRepository.findByUsername(username);
}
}
| UTF-8 | Java | 697 | java | UserServiceImpl.java | Java | [] | null | [] | package com.teletic.oauth2resource.service;
import com.teletic.oauth2resource.entity.User;
import com.teletic.oauth2resource.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.Optional;
@Service
@Transactional
public class UserServiceImpl implements UserService {
@Autowired
private UserRepository userRepository;
@Override
public void save(User user) {
userRepository.save(user);
}
@Override
public Optional<User> findByUsername(String username) {
return userRepository.findByUsername(username);
}
}
| 697 | 0.780488 | 0.776184 | 26 | 25.807692 | 21.991291 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 15 |
db4ff6d9d6af76e878f4b7d1cc301daa9375fe35 | 5,634,997,131,796 | a9008171b09985ddfc92fc9f327a4b426758f68f | /CrudJSPHibernate/src/com/example/daoImpl/EmployeeDaoImpl.java | c9844c7c029218a1262afa2ee32ab4911d48c91b | [] | no_license | CristinaDaogaru/Hibernate-Example | https://github.com/CristinaDaogaru/Hibernate-Example | 82f1f16ac9c183947a8b055c8e27c432e91b6cf8 | b6036500bb8d434d589892ec8970d75dcb56108d | refs/heads/master | 2021-01-21T22:25:43.063000 | 2017-05-28T19:22:31 | 2017-05-28T19:22:31 | 92,326,875 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.daoImpl;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import com.example.dao.DaoInterface;
import com.example.pojo.EmployeeDetails;
public class EmployeeDaoImpl implements DaoInterface {
@Override
public void saveEmployee(EmployeeDetails employee) {
Session session = HibernateUtil.getSessionFactory().openSession();
Transaction transaction = session.beginTransaction();
session.save(employee);
transaction.commit();
session.close();
}
@Override
public List<EmployeeDetails> showAllEmployees() {
List<EmployeeDetails> employeeDetails = new ArrayList<>();
Session session = HibernateUtil.getSessionFactory().openSession();
Query query = session.createQuery("from EmployeeDetails");
employeeDetails = query.list();
return employeeDetails;
}
@Override
public void updateEmployee(int id, String ename, String enumber) {
Session session = HibernateUtil.getSessionFactory().openSession();
Transaction transaction = session.beginTransaction();
EmployeeDetails employeeDetails = (EmployeeDetails) session.load(EmployeeDetails.class, id);
employeeDetails.setEname(ename);
employeeDetails.setEnumber(enumber);
session.update(employeeDetails);
transaction.commit();
session.close();
}
@Override
public void deleteEmployee(EmployeeDetails employee) {
Session session = HibernateUtil.getSessionFactory().openSession();
Transaction transaction = session.beginTransaction();
session.delete(employee);
transaction.commit();
session.close();
}
}
| UTF-8 | Java | 1,654 | java | EmployeeDaoImpl.java | Java | [] | null | [] | package com.example.daoImpl;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import com.example.dao.DaoInterface;
import com.example.pojo.EmployeeDetails;
public class EmployeeDaoImpl implements DaoInterface {
@Override
public void saveEmployee(EmployeeDetails employee) {
Session session = HibernateUtil.getSessionFactory().openSession();
Transaction transaction = session.beginTransaction();
session.save(employee);
transaction.commit();
session.close();
}
@Override
public List<EmployeeDetails> showAllEmployees() {
List<EmployeeDetails> employeeDetails = new ArrayList<>();
Session session = HibernateUtil.getSessionFactory().openSession();
Query query = session.createQuery("from EmployeeDetails");
employeeDetails = query.list();
return employeeDetails;
}
@Override
public void updateEmployee(int id, String ename, String enumber) {
Session session = HibernateUtil.getSessionFactory().openSession();
Transaction transaction = session.beginTransaction();
EmployeeDetails employeeDetails = (EmployeeDetails) session.load(EmployeeDetails.class, id);
employeeDetails.setEname(ename);
employeeDetails.setEnumber(enumber);
session.update(employeeDetails);
transaction.commit();
session.close();
}
@Override
public void deleteEmployee(EmployeeDetails employee) {
Session session = HibernateUtil.getSessionFactory().openSession();
Transaction transaction = session.beginTransaction();
session.delete(employee);
transaction.commit();
session.close();
}
}
| 1,654 | 0.76179 | 0.76179 | 68 | 23.32353 | 24.180353 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.735294 | false | false | 15 |
05af1c69f8ee5880d489526196a334a789d8ae89 | 29,721,173,756,436 | 447520f40e82a060368a0802a391697bc00be96f | /apks/comparison_qark/com_db_pwcc_dbmobile/classes_dex2jar/com/db/pwcc/dbmobile/investment/details/OrderTransactionDetailsFragment.java | f46336ffff37270b5ae41b591172be4d4e52533f | [
"Apache-2.0"
] | permissive | iantal/AndroidPermissions | https://github.com/iantal/AndroidPermissions | 7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465 | d623b732734243590b5f004d167e542e2e2ae249 | refs/heads/master | 2023-07-19T01:29:26.689000 | 2019-09-30T19:01:42 | 2019-09-30T19:01:42 | 107,239,248 | 0 | 0 | Apache-2.0 | false | 2023-07-16T07:41:38 | 2017-10-17T08:22:57 | 2019-09-30T19:01:44 | 2023-07-16T07:41:38 | 1,616,319 | 0 | 0 | 1 | null | false | false | /*
* Decompiled with CFR 0_115.
*
* Could not load the following classes:
* android.app.Activity
* android.content.Context
* android.content.Intent
* android.os.Bundle
* android.view.LayoutInflater
* android.view.View
* android.view.View$OnClickListener
* android.view.ViewGroup
* com.db.pwcc.dbmobile.investment.details.OrderTransactionDetailsFragment$1
* com.db.pwcc.dbmobile.investment.details.OrderTransactionDetailsFragment$2
* com.db.pwcc.dbmobile.investment.details.OrderTransactionDetailsFragment$3
* com.db.pwcc.dbmobile.investment.model.NotationUnit
* com.db.pwcc.dbmobile.investment.model.SecurityDetails
* com.db.pwcc.dbmobile.investment.model.SecurityRate
* uuuuuu.dvvddv
* uuuuuu.dvvvvd
* uuuuuu.vvdvvd
* uuuuuu.vvdvvd$ddvvvd
*/
package com.db.pwcc.dbmobile.investment.details;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.appdynamics.eumagent.runtime.InstrumentationCallbacks;
import com.db.pwcc.dbmobile.foundation.views.button.Button;
import com.db.pwcc.dbmobile.foundation.widgets.DbTextView;
import com.db.pwcc.dbmobile.investment.R;
import com.db.pwcc.dbmobile.investment.details.OrderTransactionDetailsFragment;
import com.db.pwcc.dbmobile.investment.model.NotationUnit;
import com.db.pwcc.dbmobile.investment.model.SecurityDetails;
import com.db.pwcc.dbmobile.investment.model.SecurityRate;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import uuuuuu.dvvddv;
import uuuuuu.dvvvvd;
import uuuuuu.kkvkvk;
import uuuuuu.kvvkvk;
import uuuuuu.ppphhp;
import uuuuuu.rvvvrv;
import uuuuuu.vkvkvk;
import uuuuuu.vvdvvd;
import xxxxxx.uxxxxx;
public class OrderTransactionDetailsFragment
extends Fragment
implements vvdvvd.vdvvvd,
kkvkvk,
kvvkvk {
private static final String TAG;
public static int b0079007900790079yyyy = 87;
public static int b0079yyy0079yyy = 1;
public static int by0079yy0079yyy = 2;
public static int byyyy0079yyy;
private Button buyButton = null;
private DbTextView category = null;
private View dataSection = null;
private View errorSection = null;
private DbTextView errorTextView = null;
private DbTextView isin = null;
private DbTextView notationUnit = null;
private vvdvvd.ddvvvd presenter = null;
private DbTextView riskClass = null;
private DbTextView securityIsFund = null;
private DbTextView securityIsOpenEndedRealEstateFund = null;
private DbTextView securityRateCurrency = null;
private DbTextView securityRateTimestamp = null;
private Button sellButton = null;
private DbTextView shortName = null;
private dvvddv transactionDetailsMapper = null;
private DbTextView wkn = null;
private vkvkvk workflowEnvironment = null;
public static {
String string2 = OrderTransactionDetailsFragment.class.getSimpleName();
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
int n2 = b0079007900790079yyyy;
switch (n2 * (n2 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = 11;
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
case 0:
}
}
TAG = string2;
}
public static /* synthetic */ void access$000(OrderTransactionDetailsFragment orderTransactionDetailsFragment) {
orderTransactionDetailsFragment.doSell();
int n2 = b0079007900790079yyyy + b0079yyy0079yyy;
if ((OrderTransactionDetailsFragment.b00790079yy0079yyy() + b0079yyy0079yyy) * OrderTransactionDetailsFragment.b00790079yy0079yyy() % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
if (n2 * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 78;
}
}
public static /* synthetic */ void access$100(OrderTransactionDetailsFragment orderTransactionDetailsFragment) {
int n2 = b0079007900790079yyyy;
switch (n2 * (n2 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 31;
}
case 0:
}
orderTransactionDetailsFragment.doBuy();
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
}
public static /* synthetic */ vkvkvk access$200(OrderTransactionDetailsFragment orderTransactionDetailsFragment) {
vkvkvk vkvkvk2 = orderTransactionDetailsFragment.workflowEnvironment;
if ((b0079007900790079yyyy + OrderTransactionDetailsFragment.byy0079y0079yyy()) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
int n2 = OrderTransactionDetailsFragment.b00790079yy0079yyy();
switch (n2 * (n2 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = 41;
byyyy0079yyy = 98;
}
case 0:
}
byyyy0079yyy = 76;
}
return vkvkvk2;
}
public static int b00790079yy0079yyy() {
return 20;
}
public static int b0079y0079y0079yyy() {
return 0;
}
public static int by00790079y0079yyy() {
return 2;
}
public static int byy0079y0079yyy() {
return 1;
}
private void doBuy() {
Object object;
Object object2;
Object object3;
String string2 = TAG;
if ((OrderTransactionDetailsFragment.b00790079yy0079yyy() + b0079yyy0079yyy) * OrderTransactionDetailsFragment.b00790079yy0079yyy() % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
int n2 = b0079007900790079yyyy;
switch (n2 * (n2 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
case 0:
}
}
String string3 = uxxxxx.bb00620062bb0062b0062b0062("\u0016*)('^]cbZY_^\u001eUTZYQPVU\u0015", '\u00ed', '\u0005');
Class[] arrclass = new Class[]{String.class, Character.TYPE, Character.TYPE};
Method method = ppphhp.class.getMethod(string3, arrclass);
Object[] arrobject = new Object[]{"isEwz", Character.valueOf('='), Character.valueOf('\u0004')};
try {
object3 = method.invoke(null, arrobject);
}
catch (InvocationTargetException var6_26) {
throw var6_26.getCause();
}
rvvvrv.bqq0071q00710071q0071q0071(string2, (String)object3);
vvdvvd.ddvvvd ddvvvd2 = this.presenter;
String string4 = uxxxxx.bb00620062bb0062b0062b0062("Pfghi#$,-'(01r,-56019:{", 'y', '\u0000');
Class[] arrclass2 = new Class[]{String.class, Character.TYPE, Character.TYPE};
Method method2 = ppphhp.class.getMethod(string4, arrclass2);
Object[] arrobject2 = new Object[]{"J^c", Character.valueOf('\b'), Character.valueOf('\u0002')};
try {
object2 = method2.invoke(null, arrobject2);
}
catch (InvocationTargetException var13_25) {
throw var13_25.getCause();
}
String string5 = (String)object2;
Method method3 = vvdvvd.ddvvvd.class.getMethod(uxxxxx.bbbb0062b0062b0062b0062("|IHNGEDJC\u0003@?E>}|:9?865;42170o", '\u00bc', '\u00d6', '\u0001'), String.class);
Object[] arrobject3 = new Object[]{string5};
try {
object = method3.invoke((Object)ddvvvd2, arrobject3);
}
catch (InvocationTargetException var18_27) {
throw var18_27.getCause();
}
Bundle bundle = (Bundle)object;
vkvkvk vkvkvk2 = this.workflowEnvironment;
String string6 = uxxxxx.bb00620062bb0062b0062b0062("m\u0002\u0001~65;:2176u-,21)(.-l", '\u00b9', '\u0004');
Class[] arrclass3 = new Class[]{String.class, Character.TYPE, Character.TYPE};
Method method4 = ppphhp.class.getMethod(string6, arrclass3);
Object[] arrobject4 = new Object[]{"!%\u0018\u001a(d/(,&\")-6m7#/-)';188", Character.valueOf('\u00b0'), Character.valueOf('\u0002')};
try {
Object object4 = method4.invoke(null, arrobject4);
vkvkvk2.navigateToPage((String)object4, bundle, true);
return;
}
catch (InvocationTargetException var26_28) {
throw var26_28.getCause();
}
}
private void doSell() {
Object object;
Object object2;
Object object3;
String string2 = TAG;
String string3 = uxxxxx.bbbb0062b0062b0062b0062("\b\u001cSRXW\u0017\u0016MLRQIHNM\rDCIH@?ED\u0004", '-', '\u00ac', '\u0000');
Class[] arrclass = new Class[]{String.class, Character.TYPE, Character.TYPE, Character.TYPE};
Method method = ppphhp.class.getMethod(string3, arrclass);
Object[] arrobject = new Object[]{"\u0006\u0010r\u0004\n\t", Character.valueOf('\u00da'), Character.valueOf('\u0082'), Character.valueOf('\u0000')};
try {
object3 = method.invoke(null, arrobject);
}
catch (InvocationTargetException var6_25) {
throw var6_25.getCause();
}
rvvvrv.bqq0071q00710071q0071q0071(string2, (String)object3);
vvdvvd.ddvvvd ddvvvd2 = this.presenter;
String string4 = uxxxxx.bb00620062bb0062b0062b0062("o\u0006?@HI\u000b\fEFNOIJRS\u0015NOWXRS[\\\u001e", '\u008c', '\u0002');
Class[] arrclass2 = new Class[]{String.class, Character.TYPE, Character.TYPE, Character.TYPE};
Method method2 = ppphhp.class.getMethod(string4, arrclass2);
Object[] arrobject2 = new Object[]{"\u0003u}~", Character.valueOf('\u0012'), Character.valueOf('\u00e1'), Character.valueOf('\u0002')};
try {
object2 = method2.invoke(null, arrobject2);
}
catch (InvocationTargetException var13_26) {
throw var13_26.getCause();
}
String string5 = (String)object2;
Method method3 = vvdvvd.ddvvvd.class.getMethod(uxxxxx.bbbb0062b0062b0062b0062("Y&%+$\"!' _\u001d\u001c\"\u001bZY\u0017\u0016\u001c\u0015\u0013\u0012\u0018\u0011\u000f\u000e\u0014\rL", '\u000b', '}', '\u0000'), String.class);
Object[] arrobject3 = new Object[]{string5};
try {
object = method3.invoke((Object)ddvvvd2, arrobject3);
}
catch (InvocationTargetException var18_27) {
throw var18_27.getCause();
}
Bundle bundle = (Bundle)object;
int n2 = b0079007900790079yyyy;
switch (n2 * (n2 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = 2;
byyyy0079yyy = 42;
}
case 0:
}
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != OrderTransactionDetailsFragment.b0079y0079y0079yyy()) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 0;
}
vkvkvk vkvkvk2 = this.workflowEnvironment;
String string6 = uxxxxx.bb00620062bb0062b0062b0062("\u000f#ZY_^\u001e\u001dTSYXPOUT\u0014KJPOGFLK\u000b", '\u00d2', '\u0003');
Class[] arrclass3 = new Class[]{String.class, Character.TYPE, Character.TYPE, Character.TYPE};
Method method4 = ppphhp.class.getMethod(string6, arrclass3);
Object[] arrobject4 = new Object[]{"\u0015\u0019\f\u000e\u001cX#\u001c \u001a\u0016\u001d!*a+\u0017#!\u001d\u001b/%,,", Character.valueOf('\u0096'), Character.valueOf('\u008d'), Character.valueOf('\u0003')};
try {
Object object4 = method4.invoke(null, arrobject4);
vkvkvk2.navigateToPage((String)object4, bundle, true);
return;
}
catch (InvocationTargetException var27_28) {
throw var27_28.getCause();
}
}
private void initDefaults() {
if (this.presenter == null) {
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % OrderTransactionDetailsFragment.by00790079y0079yyy() != byyyy0079yyy) {
b0079007900790079yyyy = 16;
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
this.presenter = new dvvvvd((vvdvvd.vdvvvd)this);
}
}
private void initView(View view) {
this.sellButton = (Button)view.findViewById(R.id.button_sell);
InstrumentationCallbacks.setOnClickListenerCalled((View)this.sellButton, (View.OnClickListener)new 1(this));
this.buyButton = (Button)view.findViewById(R.id.button_buy);
InstrumentationCallbacks.setOnClickListenerCalled((View)this.buyButton, (View.OnClickListener)new 2(this));
this.wkn = (DbTextView)view.findViewById(R.id.wkn);
this.isin = (DbTextView)view.findViewById(R.id.isin);
this.shortName = (DbTextView)view.findViewById(R.id.short_name);
this.category = (DbTextView)view.findViewById(R.id.category);
this.riskClass = (DbTextView)view.findViewById(R.id.risk_class);
this.securityIsFund = (DbTextView)view.findViewById(R.id.is_fund);
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 21;
}
this.securityIsOpenEndedRealEstateFund = (DbTextView)view.findViewById(R.id.is_oif);
View view2 = view.findViewById(R.id.notation_unit_code);
if ((b0079007900790079yyyy + OrderTransactionDetailsFragment.byy0079y0079yyy()) * b0079007900790079yyyy % OrderTransactionDetailsFragment.by00790079y0079yyy() != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
this.notationUnit = (DbTextView)view2;
this.securityRateCurrency = (DbTextView)view.findViewById(R.id.security_rate_currency);
this.securityRateTimestamp = (DbTextView)view.findViewById(R.id.security_rate_timestamp);
this.errorSection = view.findViewById(R.id.details_error_section);
this.dataSection = view.findViewById(R.id.order_data_section);
this.errorTextView = (DbTextView)view.findViewById(R.id.error_text);
}
public int getLayout() {
int n2 = R.layout.security_order_details;
int n3 = b0079007900790079yyyy;
switch (n3 * (n3 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = 4;
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
byyyy0079yyy = 43;
}
case 0:
}
return n2;
}
public boolean isDataLoaded() {
int n2 = this.wkn.getText().length();
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
if ((b0079007900790079yyyy + OrderTransactionDetailsFragment.byy0079y0079yyy()) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 43;
}
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
if (n2 > 0) {
return true;
}
return false;
}
/*
* Enabled force condition propagation
* Lifted jumps to return sites
*/
@Override
public void onAttach(Context context) {
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 31;
}
super.onAttach(context);
this.initDefaults();
if (context instanceof vkvkvk) {
this.workflowEnvironment = (vkvkvk)context;
this.workflowEnvironment.setToolbarAction(R.drawable.ic_close, (View.OnClickListener)new 3(this));
}
if (!(context instanceof Activity)) return;
Bundle bundle = ((Activity)context).getIntent().getExtras();
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = 42;
byyyy0079yyy = 1;
}
vvdvvd.ddvvvd ddvvvd2 = this.presenter;
Method method = vvdvvd.ddvvvd.class.getMethod(uxxxxx.bbbb0062b0062b0062b0062("\u0014\"!^]c\\ZY_X\u0018\u0017TSYRPOUNLKQJ\n", '\u00c5', '\b', '\u0000'), Bundle.class);
Object[] arrobject = new Object[]{bundle};
try {
method.invoke((Object)ddvvvd2, arrobject);
return;
}
catch (InvocationTargetException var6_6) {
throw var6_6.getCause();
}
}
@Override
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
View view = layoutInflater.inflate(this.getLayout(), viewGroup, false);
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = 30;
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
b0079007900790079yyyy = 33;
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
this.initView(view);
return view;
}
@Override
public void onDetach() {
super.onDetach();
if ((OrderTransactionDetailsFragment.b00790079yy0079yyy() + b0079yyy0079yyy) * OrderTransactionDetailsFragment.b00790079yy0079yyy() % by0079yy0079yyy != byyyy0079yyy) {
int n2 = b0079007900790079yyyy;
switch (n2 * (n2 + b0079yyy0079yyy) % OrderTransactionDetailsFragment.by00790079y0079yyy()) {
default: {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 32;
}
case 0:
}
b0079007900790079yyyy = 12;
byyyy0079yyy = 98;
}
this.workflowEnvironment = null;
}
@Override
public void setButtonState(boolean bl) {
int n2 = b0079007900790079yyyy;
switch (n2 * (n2 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 58;
}
case 0:
}
this.buyButton.setEnabled(bl);
this.sellButton.setEnabled(bl);
if ((b0079007900790079yyyy + OrderTransactionDetailsFragment.byy0079y0079yyy()) * b0079007900790079yyyy % by0079yy0079yyy != OrderTransactionDetailsFragment.b0079y0079y0079yyy()) {
b0079007900790079yyyy = 11;
byyyy0079yyy = 59;
}
}
/*
* Enabled force condition propagation
* Lifted jumps to return sites
*/
@Override
public void setData(Bundle bundle) {
int n2 = b0079007900790079yyyy;
switch (n2 * (n2 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = 62;
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy == byyyy0079yyy) break;
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
case 0:
}
if (bundle == null) return;
vvdvvd.ddvvvd ddvvvd2 = this.presenter;
Method method = vvdvvd.ddvvvd.class.getMethod(uxxxxx.bbbb0062b0062b0062b0062("\n\u0018\u0017TSYRPOUN\u000e\rJIOHFEKDBAG@", '(', '\u00af', '\u0000'), Bundle.class);
Object[] arrobject = new Object[]{bundle};
try {
method.invoke((Object)ddvvvd2, arrobject);
return;
}
catch (InvocationTargetException var6_6) {
throw var6_6.getCause();
}
}
@Override
public void showSecurity(SecurityDetails securityDetails) {
this.workflowEnvironment.stopProgress();
if (securityDetails != null) {
this.dataSection.setVisibility(0);
this.errorSection.setVisibility(8);
this.wkn.setText((CharSequence)securityDetails.getWkn());
this.isin.setText((CharSequence)securityDetails.getIsin());
this.riskClass.setText((CharSequence)securityDetails.getRiskClass());
this.shortName.setText((CharSequence)securityDetails.getShortName());
if (this.transactionDetailsMapper == null) {
this.transactionDetailsMapper = new dvvddv();
}
this.category.setText((CharSequence)this.transactionDetailsMapper.b007100710071qq0071007100710071q(securityDetails.getCategory(), this.getContext()));
this.securityIsFund.setText((CharSequence)this.transactionDetailsMapper.bq0071qqq0071007100710071q(securityDetails.isFund(), this.getContext()));
this.securityIsOpenEndedRealEstateFund.setText((CharSequence)this.transactionDetailsMapper.bq0071qqq0071007100710071q(securityDetails.isOpenEndedRealEstateFund(), this.getContext()));
DbTextView dbTextView = this.notationUnit;
String string2 = this.transactionDetailsMapper.bqq0071qq0071007100710071q(securityDetails.getNotationUnit().getCode(), this.getContext());
int n2 = b0079007900790079yyyy;
switch (n2 * (n2 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = 99;
byyyy0079yyy = 82;
}
case 0:
}
dbTextView.setText((CharSequence)string2);
this.securityRateCurrency.setText((CharSequence)this.transactionDetailsMapper.bq00710071qq0071007100710071q(securityDetails.getSecurityRate()));
DbTextView dbTextView2 = this.securityRateTimestamp;
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 94;
}
dbTextView2.setText((CharSequence)this.transactionDetailsMapper.bqqq0071q0071007100710071q(securityDetails.getSecurityRate().getTimestamp(), this.getContext()));
}
}
@Override
public void showSecurityError(String string2) {
Object object;
this.workflowEnvironment.stopProgress();
this.dataSection.setVisibility(8);
this.errorSection.setVisibility(0);
this.errorTextView.setText((CharSequence)string2);
int n2 = b0079007900790079yyyy + b0079yyy0079yyy;
int n3 = b0079007900790079yyyy;
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != OrderTransactionDetailsFragment.b0079y0079y0079yyy()) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
if (n2 * n3 % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 90;
}
String string3 = TAG;
StringBuilder stringBuilder = new StringBuilder();
String string4 = uxxxxx.bb00620062bb0062b0062b0062("o\u0006\u0007\b\tBCKLFGOP\u0012KLTUOPXY\u001b", '\u00d8', '\u0000');
Class[] arrclass = new Class[]{String.class, Character.TYPE, Character.TYPE};
Method method = ppphhp.class.getMethod(string4, arrclass);
Object[] arrobject = new Object[]{"\u000f \u001d.* *.S\u0017\u0017%\u0011\u0018\u001a K\u0010\u001c\u001b\u0017\u0019E^C", Character.valueOf('D'), Character.valueOf('\u0003')};
try {
object = method.invoke(null, arrobject);
}
catch (InvocationTargetException var10_11) {
throw var10_11.getCause();
}
rvvvrv.bqq0071q00710071q0071q0071(string3, stringBuilder.append((String)object).append(string2).toString());
}
/*
* Loose catch block
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
* Lifted jumps to return sites
*/
@Override
public void workflowPageEntered() {
if (!this.isDataLoaded()) {
this.workflowEnvironment.startProgress(R.string.security_details_loading_progress);
int n2 = b0079007900790079yyyy;
switch (n2 * (n2 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = 5;
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
case 0:
}
vvdvvd.ddvvvd ddvvvd2 = this.presenter;
Method method = vvdvvd.ddvvvd.class.getMethod(uxxxxx.bbbb0062b0062b0062b0062("}JIOH\bEDJCA@F?~};:@976<53281p", '\u00dc', '\u0086', '\u0000'), new Class[0]);
Object[] arrobject = new Object[]{};
method.invoke((Object)ddvvvd2, arrobject);
}
vkvkvk vkvkvk2 = this.workflowEnvironment;
String string2 = this.getString(R.string.security_details_title);
int n3 = b0079007900790079yyyy;
switch (n3 * (n3 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 33;
}
case 0:
}
vkvkvk2.setToolbarInfo(string2, null);
return;
catch (InvocationTargetException invocationTargetException) {
throw invocationTargetException.getCause();
}
}
@Override
public void workflowPageExited() {
if ((b0079007900790079yyyy + OrderTransactionDetailsFragment.byy0079y0079yyy()) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = 69;
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
b0079007900790079yyyy = 10;
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
this.workflowEnvironment.stopProgress();
}
}
| UTF-8 | Java | 28,980 | java | OrderTransactionDetailsFragment.java | Java | [] | null | [] | /*
* Decompiled with CFR 0_115.
*
* Could not load the following classes:
* android.app.Activity
* android.content.Context
* android.content.Intent
* android.os.Bundle
* android.view.LayoutInflater
* android.view.View
* android.view.View$OnClickListener
* android.view.ViewGroup
* com.db.pwcc.dbmobile.investment.details.OrderTransactionDetailsFragment$1
* com.db.pwcc.dbmobile.investment.details.OrderTransactionDetailsFragment$2
* com.db.pwcc.dbmobile.investment.details.OrderTransactionDetailsFragment$3
* com.db.pwcc.dbmobile.investment.model.NotationUnit
* com.db.pwcc.dbmobile.investment.model.SecurityDetails
* com.db.pwcc.dbmobile.investment.model.SecurityRate
* uuuuuu.dvvddv
* uuuuuu.dvvvvd
* uuuuuu.vvdvvd
* uuuuuu.vvdvvd$ddvvvd
*/
package com.db.pwcc.dbmobile.investment.details;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.appdynamics.eumagent.runtime.InstrumentationCallbacks;
import com.db.pwcc.dbmobile.foundation.views.button.Button;
import com.db.pwcc.dbmobile.foundation.widgets.DbTextView;
import com.db.pwcc.dbmobile.investment.R;
import com.db.pwcc.dbmobile.investment.details.OrderTransactionDetailsFragment;
import com.db.pwcc.dbmobile.investment.model.NotationUnit;
import com.db.pwcc.dbmobile.investment.model.SecurityDetails;
import com.db.pwcc.dbmobile.investment.model.SecurityRate;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import uuuuuu.dvvddv;
import uuuuuu.dvvvvd;
import uuuuuu.kkvkvk;
import uuuuuu.kvvkvk;
import uuuuuu.ppphhp;
import uuuuuu.rvvvrv;
import uuuuuu.vkvkvk;
import uuuuuu.vvdvvd;
import xxxxxx.uxxxxx;
public class OrderTransactionDetailsFragment
extends Fragment
implements vvdvvd.vdvvvd,
kkvkvk,
kvvkvk {
private static final String TAG;
public static int b0079007900790079yyyy = 87;
public static int b0079yyy0079yyy = 1;
public static int by0079yy0079yyy = 2;
public static int byyyy0079yyy;
private Button buyButton = null;
private DbTextView category = null;
private View dataSection = null;
private View errorSection = null;
private DbTextView errorTextView = null;
private DbTextView isin = null;
private DbTextView notationUnit = null;
private vvdvvd.ddvvvd presenter = null;
private DbTextView riskClass = null;
private DbTextView securityIsFund = null;
private DbTextView securityIsOpenEndedRealEstateFund = null;
private DbTextView securityRateCurrency = null;
private DbTextView securityRateTimestamp = null;
private Button sellButton = null;
private DbTextView shortName = null;
private dvvddv transactionDetailsMapper = null;
private DbTextView wkn = null;
private vkvkvk workflowEnvironment = null;
public static {
String string2 = OrderTransactionDetailsFragment.class.getSimpleName();
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
int n2 = b0079007900790079yyyy;
switch (n2 * (n2 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = 11;
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
case 0:
}
}
TAG = string2;
}
public static /* synthetic */ void access$000(OrderTransactionDetailsFragment orderTransactionDetailsFragment) {
orderTransactionDetailsFragment.doSell();
int n2 = b0079007900790079yyyy + b0079yyy0079yyy;
if ((OrderTransactionDetailsFragment.b00790079yy0079yyy() + b0079yyy0079yyy) * OrderTransactionDetailsFragment.b00790079yy0079yyy() % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
if (n2 * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 78;
}
}
public static /* synthetic */ void access$100(OrderTransactionDetailsFragment orderTransactionDetailsFragment) {
int n2 = b0079007900790079yyyy;
switch (n2 * (n2 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 31;
}
case 0:
}
orderTransactionDetailsFragment.doBuy();
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
}
public static /* synthetic */ vkvkvk access$200(OrderTransactionDetailsFragment orderTransactionDetailsFragment) {
vkvkvk vkvkvk2 = orderTransactionDetailsFragment.workflowEnvironment;
if ((b0079007900790079yyyy + OrderTransactionDetailsFragment.byy0079y0079yyy()) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
int n2 = OrderTransactionDetailsFragment.b00790079yy0079yyy();
switch (n2 * (n2 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = 41;
byyyy0079yyy = 98;
}
case 0:
}
byyyy0079yyy = 76;
}
return vkvkvk2;
}
public static int b00790079yy0079yyy() {
return 20;
}
public static int b0079y0079y0079yyy() {
return 0;
}
public static int by00790079y0079yyy() {
return 2;
}
public static int byy0079y0079yyy() {
return 1;
}
private void doBuy() {
Object object;
Object object2;
Object object3;
String string2 = TAG;
if ((OrderTransactionDetailsFragment.b00790079yy0079yyy() + b0079yyy0079yyy) * OrderTransactionDetailsFragment.b00790079yy0079yyy() % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
int n2 = b0079007900790079yyyy;
switch (n2 * (n2 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
case 0:
}
}
String string3 = uxxxxx.bb00620062bb0062b0062b0062("\u0016*)('^]cbZY_^\u001eUTZYQPVU\u0015", '\u00ed', '\u0005');
Class[] arrclass = new Class[]{String.class, Character.TYPE, Character.TYPE};
Method method = ppphhp.class.getMethod(string3, arrclass);
Object[] arrobject = new Object[]{"isEwz", Character.valueOf('='), Character.valueOf('\u0004')};
try {
object3 = method.invoke(null, arrobject);
}
catch (InvocationTargetException var6_26) {
throw var6_26.getCause();
}
rvvvrv.bqq0071q00710071q0071q0071(string2, (String)object3);
vvdvvd.ddvvvd ddvvvd2 = this.presenter;
String string4 = uxxxxx.bb00620062bb0062b0062b0062("Pfghi#$,-'(01r,-56019:{", 'y', '\u0000');
Class[] arrclass2 = new Class[]{String.class, Character.TYPE, Character.TYPE};
Method method2 = ppphhp.class.getMethod(string4, arrclass2);
Object[] arrobject2 = new Object[]{"J^c", Character.valueOf('\b'), Character.valueOf('\u0002')};
try {
object2 = method2.invoke(null, arrobject2);
}
catch (InvocationTargetException var13_25) {
throw var13_25.getCause();
}
String string5 = (String)object2;
Method method3 = vvdvvd.ddvvvd.class.getMethod(uxxxxx.bbbb0062b0062b0062b0062("|IHNGEDJC\u0003@?E>}|:9?865;42170o", '\u00bc', '\u00d6', '\u0001'), String.class);
Object[] arrobject3 = new Object[]{string5};
try {
object = method3.invoke((Object)ddvvvd2, arrobject3);
}
catch (InvocationTargetException var18_27) {
throw var18_27.getCause();
}
Bundle bundle = (Bundle)object;
vkvkvk vkvkvk2 = this.workflowEnvironment;
String string6 = uxxxxx.bb00620062bb0062b0062b0062("m\u0002\u0001~65;:2176u-,21)(.-l", '\u00b9', '\u0004');
Class[] arrclass3 = new Class[]{String.class, Character.TYPE, Character.TYPE};
Method method4 = ppphhp.class.getMethod(string6, arrclass3);
Object[] arrobject4 = new Object[]{"!%\u0018\u001a(d/(,&\")-6m7#/-)';188", Character.valueOf('\u00b0'), Character.valueOf('\u0002')};
try {
Object object4 = method4.invoke(null, arrobject4);
vkvkvk2.navigateToPage((String)object4, bundle, true);
return;
}
catch (InvocationTargetException var26_28) {
throw var26_28.getCause();
}
}
private void doSell() {
Object object;
Object object2;
Object object3;
String string2 = TAG;
String string3 = uxxxxx.bbbb0062b0062b0062b0062("\b\u001cSRXW\u0017\u0016MLRQIHNM\rDCIH@?ED\u0004", '-', '\u00ac', '\u0000');
Class[] arrclass = new Class[]{String.class, Character.TYPE, Character.TYPE, Character.TYPE};
Method method = ppphhp.class.getMethod(string3, arrclass);
Object[] arrobject = new Object[]{"\u0006\u0010r\u0004\n\t", Character.valueOf('\u00da'), Character.valueOf('\u0082'), Character.valueOf('\u0000')};
try {
object3 = method.invoke(null, arrobject);
}
catch (InvocationTargetException var6_25) {
throw var6_25.getCause();
}
rvvvrv.bqq0071q00710071q0071q0071(string2, (String)object3);
vvdvvd.ddvvvd ddvvvd2 = this.presenter;
String string4 = uxxxxx.bb00620062bb0062b0062b0062("o\u0006?@HI\u000b\fEFNOIJRS\u0015NOWXRS[\\\u001e", '\u008c', '\u0002');
Class[] arrclass2 = new Class[]{String.class, Character.TYPE, Character.TYPE, Character.TYPE};
Method method2 = ppphhp.class.getMethod(string4, arrclass2);
Object[] arrobject2 = new Object[]{"\u0003u}~", Character.valueOf('\u0012'), Character.valueOf('\u00e1'), Character.valueOf('\u0002')};
try {
object2 = method2.invoke(null, arrobject2);
}
catch (InvocationTargetException var13_26) {
throw var13_26.getCause();
}
String string5 = (String)object2;
Method method3 = vvdvvd.ddvvvd.class.getMethod(uxxxxx.bbbb0062b0062b0062b0062("Y&%+$\"!' _\u001d\u001c\"\u001bZY\u0017\u0016\u001c\u0015\u0013\u0012\u0018\u0011\u000f\u000e\u0014\rL", '\u000b', '}', '\u0000'), String.class);
Object[] arrobject3 = new Object[]{string5};
try {
object = method3.invoke((Object)ddvvvd2, arrobject3);
}
catch (InvocationTargetException var18_27) {
throw var18_27.getCause();
}
Bundle bundle = (Bundle)object;
int n2 = b0079007900790079yyyy;
switch (n2 * (n2 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = 2;
byyyy0079yyy = 42;
}
case 0:
}
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != OrderTransactionDetailsFragment.b0079y0079y0079yyy()) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 0;
}
vkvkvk vkvkvk2 = this.workflowEnvironment;
String string6 = uxxxxx.bb00620062bb0062b0062b0062("\u000f#ZY_^\u001e\u001dTSYXPOUT\u0014KJPOGFLK\u000b", '\u00d2', '\u0003');
Class[] arrclass3 = new Class[]{String.class, Character.TYPE, Character.TYPE, Character.TYPE};
Method method4 = ppphhp.class.getMethod(string6, arrclass3);
Object[] arrobject4 = new Object[]{"\u0015\u0019\f\u000e\u001cX#\u001c \u001a\u0016\u001d!*a+\u0017#!\u001d\u001b/%,,", Character.valueOf('\u0096'), Character.valueOf('\u008d'), Character.valueOf('\u0003')};
try {
Object object4 = method4.invoke(null, arrobject4);
vkvkvk2.navigateToPage((String)object4, bundle, true);
return;
}
catch (InvocationTargetException var27_28) {
throw var27_28.getCause();
}
}
private void initDefaults() {
if (this.presenter == null) {
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % OrderTransactionDetailsFragment.by00790079y0079yyy() != byyyy0079yyy) {
b0079007900790079yyyy = 16;
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
this.presenter = new dvvvvd((vvdvvd.vdvvvd)this);
}
}
private void initView(View view) {
this.sellButton = (Button)view.findViewById(R.id.button_sell);
InstrumentationCallbacks.setOnClickListenerCalled((View)this.sellButton, (View.OnClickListener)new 1(this));
this.buyButton = (Button)view.findViewById(R.id.button_buy);
InstrumentationCallbacks.setOnClickListenerCalled((View)this.buyButton, (View.OnClickListener)new 2(this));
this.wkn = (DbTextView)view.findViewById(R.id.wkn);
this.isin = (DbTextView)view.findViewById(R.id.isin);
this.shortName = (DbTextView)view.findViewById(R.id.short_name);
this.category = (DbTextView)view.findViewById(R.id.category);
this.riskClass = (DbTextView)view.findViewById(R.id.risk_class);
this.securityIsFund = (DbTextView)view.findViewById(R.id.is_fund);
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 21;
}
this.securityIsOpenEndedRealEstateFund = (DbTextView)view.findViewById(R.id.is_oif);
View view2 = view.findViewById(R.id.notation_unit_code);
if ((b0079007900790079yyyy + OrderTransactionDetailsFragment.byy0079y0079yyy()) * b0079007900790079yyyy % OrderTransactionDetailsFragment.by00790079y0079yyy() != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
this.notationUnit = (DbTextView)view2;
this.securityRateCurrency = (DbTextView)view.findViewById(R.id.security_rate_currency);
this.securityRateTimestamp = (DbTextView)view.findViewById(R.id.security_rate_timestamp);
this.errorSection = view.findViewById(R.id.details_error_section);
this.dataSection = view.findViewById(R.id.order_data_section);
this.errorTextView = (DbTextView)view.findViewById(R.id.error_text);
}
public int getLayout() {
int n2 = R.layout.security_order_details;
int n3 = b0079007900790079yyyy;
switch (n3 * (n3 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = 4;
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
byyyy0079yyy = 43;
}
case 0:
}
return n2;
}
public boolean isDataLoaded() {
int n2 = this.wkn.getText().length();
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
if ((b0079007900790079yyyy + OrderTransactionDetailsFragment.byy0079y0079yyy()) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 43;
}
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
if (n2 > 0) {
return true;
}
return false;
}
/*
* Enabled force condition propagation
* Lifted jumps to return sites
*/
@Override
public void onAttach(Context context) {
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 31;
}
super.onAttach(context);
this.initDefaults();
if (context instanceof vkvkvk) {
this.workflowEnvironment = (vkvkvk)context;
this.workflowEnvironment.setToolbarAction(R.drawable.ic_close, (View.OnClickListener)new 3(this));
}
if (!(context instanceof Activity)) return;
Bundle bundle = ((Activity)context).getIntent().getExtras();
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = 42;
byyyy0079yyy = 1;
}
vvdvvd.ddvvvd ddvvvd2 = this.presenter;
Method method = vvdvvd.ddvvvd.class.getMethod(uxxxxx.bbbb0062b0062b0062b0062("\u0014\"!^]c\\ZY_X\u0018\u0017TSYRPOUNLKQJ\n", '\u00c5', '\b', '\u0000'), Bundle.class);
Object[] arrobject = new Object[]{bundle};
try {
method.invoke((Object)ddvvvd2, arrobject);
return;
}
catch (InvocationTargetException var6_6) {
throw var6_6.getCause();
}
}
@Override
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
View view = layoutInflater.inflate(this.getLayout(), viewGroup, false);
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = 30;
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
b0079007900790079yyyy = 33;
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
this.initView(view);
return view;
}
@Override
public void onDetach() {
super.onDetach();
if ((OrderTransactionDetailsFragment.b00790079yy0079yyy() + b0079yyy0079yyy) * OrderTransactionDetailsFragment.b00790079yy0079yyy() % by0079yy0079yyy != byyyy0079yyy) {
int n2 = b0079007900790079yyyy;
switch (n2 * (n2 + b0079yyy0079yyy) % OrderTransactionDetailsFragment.by00790079y0079yyy()) {
default: {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 32;
}
case 0:
}
b0079007900790079yyyy = 12;
byyyy0079yyy = 98;
}
this.workflowEnvironment = null;
}
@Override
public void setButtonState(boolean bl) {
int n2 = b0079007900790079yyyy;
switch (n2 * (n2 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 58;
}
case 0:
}
this.buyButton.setEnabled(bl);
this.sellButton.setEnabled(bl);
if ((b0079007900790079yyyy + OrderTransactionDetailsFragment.byy0079y0079yyy()) * b0079007900790079yyyy % by0079yy0079yyy != OrderTransactionDetailsFragment.b0079y0079y0079yyy()) {
b0079007900790079yyyy = 11;
byyyy0079yyy = 59;
}
}
/*
* Enabled force condition propagation
* Lifted jumps to return sites
*/
@Override
public void setData(Bundle bundle) {
int n2 = b0079007900790079yyyy;
switch (n2 * (n2 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = 62;
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy == byyyy0079yyy) break;
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
case 0:
}
if (bundle == null) return;
vvdvvd.ddvvvd ddvvvd2 = this.presenter;
Method method = vvdvvd.ddvvvd.class.getMethod(uxxxxx.bbbb0062b0062b0062b0062("\n\u0018\u0017TSYRPOUN\u000e\rJIOHFEKDBAG@", '(', '\u00af', '\u0000'), Bundle.class);
Object[] arrobject = new Object[]{bundle};
try {
method.invoke((Object)ddvvvd2, arrobject);
return;
}
catch (InvocationTargetException var6_6) {
throw var6_6.getCause();
}
}
@Override
public void showSecurity(SecurityDetails securityDetails) {
this.workflowEnvironment.stopProgress();
if (securityDetails != null) {
this.dataSection.setVisibility(0);
this.errorSection.setVisibility(8);
this.wkn.setText((CharSequence)securityDetails.getWkn());
this.isin.setText((CharSequence)securityDetails.getIsin());
this.riskClass.setText((CharSequence)securityDetails.getRiskClass());
this.shortName.setText((CharSequence)securityDetails.getShortName());
if (this.transactionDetailsMapper == null) {
this.transactionDetailsMapper = new dvvddv();
}
this.category.setText((CharSequence)this.transactionDetailsMapper.b007100710071qq0071007100710071q(securityDetails.getCategory(), this.getContext()));
this.securityIsFund.setText((CharSequence)this.transactionDetailsMapper.bq0071qqq0071007100710071q(securityDetails.isFund(), this.getContext()));
this.securityIsOpenEndedRealEstateFund.setText((CharSequence)this.transactionDetailsMapper.bq0071qqq0071007100710071q(securityDetails.isOpenEndedRealEstateFund(), this.getContext()));
DbTextView dbTextView = this.notationUnit;
String string2 = this.transactionDetailsMapper.bqq0071qq0071007100710071q(securityDetails.getNotationUnit().getCode(), this.getContext());
int n2 = b0079007900790079yyyy;
switch (n2 * (n2 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = 99;
byyyy0079yyy = 82;
}
case 0:
}
dbTextView.setText((CharSequence)string2);
this.securityRateCurrency.setText((CharSequence)this.transactionDetailsMapper.bq00710071qq0071007100710071q(securityDetails.getSecurityRate()));
DbTextView dbTextView2 = this.securityRateTimestamp;
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 94;
}
dbTextView2.setText((CharSequence)this.transactionDetailsMapper.bqqq0071q0071007100710071q(securityDetails.getSecurityRate().getTimestamp(), this.getContext()));
}
}
@Override
public void showSecurityError(String string2) {
Object object;
this.workflowEnvironment.stopProgress();
this.dataSection.setVisibility(8);
this.errorSection.setVisibility(0);
this.errorTextView.setText((CharSequence)string2);
int n2 = b0079007900790079yyyy + b0079yyy0079yyy;
int n3 = b0079007900790079yyyy;
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != OrderTransactionDetailsFragment.b0079y0079y0079yyy()) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
if (n2 * n3 % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 90;
}
String string3 = TAG;
StringBuilder stringBuilder = new StringBuilder();
String string4 = uxxxxx.bb00620062bb0062b0062b0062("o\u0006\u0007\b\tBCKLFGOP\u0012KLTUOPXY\u001b", '\u00d8', '\u0000');
Class[] arrclass = new Class[]{String.class, Character.TYPE, Character.TYPE};
Method method = ppphhp.class.getMethod(string4, arrclass);
Object[] arrobject = new Object[]{"\u000f \u001d.* *.S\u0017\u0017%\u0011\u0018\u001a K\u0010\u001c\u001b\u0017\u0019E^C", Character.valueOf('D'), Character.valueOf('\u0003')};
try {
object = method.invoke(null, arrobject);
}
catch (InvocationTargetException var10_11) {
throw var10_11.getCause();
}
rvvvrv.bqq0071q00710071q0071q0071(string3, stringBuilder.append((String)object).append(string2).toString());
}
/*
* Loose catch block
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
* Lifted jumps to return sites
*/
@Override
public void workflowPageEntered() {
if (!this.isDataLoaded()) {
this.workflowEnvironment.startProgress(R.string.security_details_loading_progress);
int n2 = b0079007900790079yyyy;
switch (n2 * (n2 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = 5;
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
case 0:
}
vvdvvd.ddvvvd ddvvvd2 = this.presenter;
Method method = vvdvvd.ddvvvd.class.getMethod(uxxxxx.bbbb0062b0062b0062b0062("}JIOH\bEDJCA@F?~};:@976<53281p", '\u00dc', '\u0086', '\u0000'), new Class[0]);
Object[] arrobject = new Object[]{};
method.invoke((Object)ddvvvd2, arrobject);
}
vkvkvk vkvkvk2 = this.workflowEnvironment;
String string2 = this.getString(R.string.security_details_title);
int n3 = b0079007900790079yyyy;
switch (n3 * (n3 + b0079yyy0079yyy) % by0079yy0079yyy) {
default: {
b0079007900790079yyyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
byyyy0079yyy = 33;
}
case 0:
}
vkvkvk2.setToolbarInfo(string2, null);
return;
catch (InvocationTargetException invocationTargetException) {
throw invocationTargetException.getCause();
}
}
@Override
public void workflowPageExited() {
if ((b0079007900790079yyyy + OrderTransactionDetailsFragment.byy0079y0079yyy()) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
if ((b0079007900790079yyyy + b0079yyy0079yyy) * b0079007900790079yyyy % by0079yy0079yyy != byyyy0079yyy) {
b0079007900790079yyyy = 69;
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
b0079007900790079yyyy = 10;
byyyy0079yyy = OrderTransactionDetailsFragment.b00790079yy0079yyy();
}
this.workflowEnvironment.stopProgress();
}
}
| 28,980 | 0.659938 | 0.512905 | 603 | 47.058044 | 40.642334 | 232 | false | false | 0 | 0 | 66 | 0.003313 | 0 | 0 | 0.718076 | false | false | 15 |
044ae51f3bf6530fbd045dfd40ca23079fad7239 | 5,368,709,186,022 | 413cd218fa8bb52bb83203123c749befae6b2b9d | /app/src/main/java/com/vacationplanner/an/vacationguru/FindAttr.java | 87be1a12d6eea189dfcee75410ae240f1daa36e8 | [] | no_license | vothanhan/VacationGuru | https://github.com/vothanhan/VacationGuru | 37f142f23940cb476b9b0e3dc536ceeb3de37301 | efb40d30f021d37e806fd783a0cb4599a3e1fe7f | refs/heads/master | 2021-01-10T01:32:15.698000 | 2016-03-15T14:39:52 | 2016-03-15T14:39:52 | 53,951,708 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.vacationplanner.an.vacationguru;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.RadioGroup;
import android.widget.Toast;
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import com.google.android.gms.common.GooglePlayServicesRepairableException;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.places.*;
import com.google.android.gms.location.places.Place;
import com.google.android.gms.location.places.ui.PlacePicker;
public class FindAttr extends AppCompatActivity {
RadioGroup radioGroup;
int PLACE_PICKER_REQUEST = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_find_attr);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_find_attr, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public void findonmap(View view) throws GooglePlayServicesNotAvailableException, GooglePlayServicesRepairableException {
PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
Context context = getApplicationContext();
startActivityForResult(builder.build(context), PLACE_PICKER_REQUEST);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == PLACE_PICKER_REQUEST) {
if (resultCode == RESULT_OK) {
com.google.android.gms.location.places.Place place = PlacePicker.getPlace(data, this);
Intent intent=new Intent(this,ShowPlace.class);
String type="Other";
for(int i=0;i<place.getPlaceTypes().size();++i)
{
if(place.getPlaceTypes().get(i)== Place.TYPE_RESTAURANT)
{
type="Restaurant";
break;
}
else if(place.getPlaceTypes().get(i)==Place.TYPE_STORE)
{
type="Shop";
break;
}
else if(place.getPlaceTypes().get(i)==Place.TYPE_LODGING)
{
type="Hotel";
break;
}
else if(place.getPlaceTypes().get(i)==Place.TYPE_MUSEUM)
{
type="Museum";
break;
}
else if(place.getPlaceTypes().get(i)==Place.TYPE_PARK)
{
type="Park";
break;
}
else
{
type="Other";
break;
}
}
intent.putExtra("Name",place.getName());
intent.putExtra("Address",place.getAddress());
intent.putExtra("Type",type);
intent.putExtra("ID",place.getId());
intent.putExtra("Long",place.getLatLng().longitude);
intent.putExtra("Lat",place.getLatLng().latitude);
startActivity(intent);
}
}
}
public void findnearby(View view) {
Intent intent=new Intent(this,ChooseType.class);
startActivity(intent);
}
}
| UTF-8 | Java | 4,226 | java | FindAttr.java | Java | [] | null | [] | package com.vacationplanner.an.vacationguru;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.RadioGroup;
import android.widget.Toast;
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import com.google.android.gms.common.GooglePlayServicesRepairableException;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.places.*;
import com.google.android.gms.location.places.Place;
import com.google.android.gms.location.places.ui.PlacePicker;
public class FindAttr extends AppCompatActivity {
RadioGroup radioGroup;
int PLACE_PICKER_REQUEST = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_find_attr);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_find_attr, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public void findonmap(View view) throws GooglePlayServicesNotAvailableException, GooglePlayServicesRepairableException {
PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
Context context = getApplicationContext();
startActivityForResult(builder.build(context), PLACE_PICKER_REQUEST);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == PLACE_PICKER_REQUEST) {
if (resultCode == RESULT_OK) {
com.google.android.gms.location.places.Place place = PlacePicker.getPlace(data, this);
Intent intent=new Intent(this,ShowPlace.class);
String type="Other";
for(int i=0;i<place.getPlaceTypes().size();++i)
{
if(place.getPlaceTypes().get(i)== Place.TYPE_RESTAURANT)
{
type="Restaurant";
break;
}
else if(place.getPlaceTypes().get(i)==Place.TYPE_STORE)
{
type="Shop";
break;
}
else if(place.getPlaceTypes().get(i)==Place.TYPE_LODGING)
{
type="Hotel";
break;
}
else if(place.getPlaceTypes().get(i)==Place.TYPE_MUSEUM)
{
type="Museum";
break;
}
else if(place.getPlaceTypes().get(i)==Place.TYPE_PARK)
{
type="Park";
break;
}
else
{
type="Other";
break;
}
}
intent.putExtra("Name",place.getName());
intent.putExtra("Address",place.getAddress());
intent.putExtra("Type",type);
intent.putExtra("ID",place.getId());
intent.putExtra("Long",place.getLatLng().longitude);
intent.putExtra("Lat",place.getLatLng().latitude);
startActivity(intent);
}
}
}
public void findnearby(View view) {
Intent intent=new Intent(this,ChooseType.class);
startActivity(intent);
}
}
| 4,226 | 0.572409 | 0.571699 | 114 | 36.070175 | 25.780695 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.614035 | false | false | 15 |
a13a2de232161c62d5ddd87af26736541de05bba | 33,483,565,101,177 | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.mm/classes.jar/com/tencent/mm/plugin/finder/webview/k.java | b090bd265e340090185e84794dbc0a367a588a4c | [] | no_license | tsuzcx/qq_apk | https://github.com/tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651000 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | false | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | 2022-01-31T06:56:43 | 2022-01-31T09:46:26 | 167,304 | 0 | 1 | 1 | Java | false | false | package com.tencent.mm.plugin.finder.webview;
import kotlin.Metadata;
@Metadata(d1={""}, d2={"Lcom/tencent/mm/plugin/finder/webview/IDetectPosProvider;", "", "provideXPos", "", "provideYPos", "plugin-finder_release"}, k=1, mv={1, 5, 1}, xi=48)
public abstract interface k
{
public abstract float fqe();
public abstract float fqf();
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes.jar
* Qualified Name: com.tencent.mm.plugin.finder.webview.k
* JD-Core Version: 0.7.0.1
*/ | UTF-8 | Java | 541 | java | k.java | Java | [] | null | [] | package com.tencent.mm.plugin.finder.webview;
import kotlin.Metadata;
@Metadata(d1={""}, d2={"Lcom/tencent/mm/plugin/finder/webview/IDetectPosProvider;", "", "provideXPos", "", "provideYPos", "plugin-finder_release"}, k=1, mv={1, 5, 1}, xi=48)
public abstract interface k
{
public abstract float fqe();
public abstract float fqf();
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes.jar
* Qualified Name: com.tencent.mm.plugin.finder.webview.k
* JD-Core Version: 0.7.0.1
*/ | 541 | 0.656192 | 0.634011 | 21 | 24.047619 | 40.086189 | 173 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.761905 | false | false | 15 |
6f5fd959954671827e2bfdf8c8c8421f51ad922b | 60,129,569,145 | 306ca3d7cb9a798038f4499061b8ba2ea2dab428 | /src/main/java/org/openpaas/paasta/portal/common/api/entity/portal/CatalogHistory.java | 945446894d4cf7cf8a161cee1e714b13432545db | [
"Apache-2.0"
] | permissive | PaaS-TA/PAAS-TA-PORTAL-COMMON-API | https://github.com/PaaS-TA/PAAS-TA-PORTAL-COMMON-API | 3335be8689a1ef1c7dcca1f2e0302c1eb9d99788 | d20bad47e620c27b8064e5777db4a38a961d7727 | refs/heads/master | 2022-12-26T03:05:48.726000 | 2022-12-15T09:25:33 | 2022-12-15T09:25:33 | 118,844,877 | 22 | 5 | Apache-2.0 | false | 2022-12-15T09:25:34 | 2018-01-25T01:26:47 | 2022-11-02T21:31:10 | 2022-12-15T09:25:33 | 746 | 17 | 4 | 1 | Java | false | false | package org.openpaas.paasta.portal.common.api.entity.portal;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.UpdateTimestamp;
import javax.persistence.*;
import java.util.Date;
/**
* Created by SEJI on 2018-03-06.
*/
@Entity
@Table(name = "catalog_history")
public class CatalogHistory {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "no", nullable = false)
private int no;
@Column(name = "catalog_no", nullable = false)
private int catalogNo;
@Column(name = "catalog_type", nullable = false)
private String catalogType;
@Column(name = "user_id", nullable = false)
private String userId;
@UpdateTimestamp
@Column(name = "created", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
@Temporal(TemporalType.TIMESTAMP)
private Date created;
@UpdateTimestamp
@Column(name = "lastmodified", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
@Temporal(TemporalType.TIMESTAMP)
private Date lastmodified;
@Transient
private String searchKeyword;
@Transient
private String searchTypeColumn;
@Transient
private String searchTypeUseYn;
@Transient
private int starterCatalogNo;
@Transient
private String name;
public int getNo() {
return no;
}
public void setNo(int no) {
this.no = no;
}
public int getCatalogNo() {
return catalogNo;
}
public void setCatalogNo(int catalogNo) {
this.catalogNo = catalogNo;
}
public String getCatalogType() {
return catalogType;
}
public void setCatalogType(String catalogType) {
this.catalogType = catalogType;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Seoul")
public Date getCreated() {
return created == null ? null : new Date(created.getTime());
}
public void setCreated(Date created) {
this.created = created == null ? null : new Date(created.getTime());
}
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Seoul")
public Date getLastmodified() {
return lastmodified == null ? null : new Date(lastmodified.getTime()) ;
}
public void setLastmodified(Date lastmodified) {
this.lastmodified = lastmodified == null ? null : new Date(lastmodified.getTime());
}
public String getSearchKeyword() {
return searchKeyword;
}
public void setSearchKeyword(String searchKeyword) {
this.searchKeyword = searchKeyword;
}
public String getSearchTypeColumn() {
return searchTypeColumn;
}
public void setSearchTypeColumn(String searchTypeColumn) {
this.searchTypeColumn = searchTypeColumn;
}
public String getSearchTypeUseYn() {
return searchTypeUseYn;
}
public void setSearchTypeUseYn(String searchTypeUseYn) {
this.searchTypeUseYn = searchTypeUseYn;
}
public int getStarterCatalogNo() {
return starterCatalogNo;
}
public void setStarterCatalogNo(int starterCatalogNo) {
this.starterCatalogNo = starterCatalogNo;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "Catalog{" +
"no=" + no +
", catalogNo=" + catalogNo +
", catalogType=" + catalogType +
", userId='" + userId + '\'' +
", created=" + created +
", lastmodified=" + lastmodified +
", searchKeyword='" + searchKeyword + '\'' +
", searchTypeColumn='" + searchTypeColumn + '\'' +
", searchTypeUseYn='" + searchTypeUseYn + '\'' +
", starterCatalogNo=" + starterCatalogNo +
", name='" + name + '\'' +
'}';
}
}
| UTF-8 | Java | 4,176 | java | CatalogHistory.java | Java | [
{
"context": "tence.*;\nimport java.util.Date;\n\n/**\n * Created by SEJI on 2018-03-06.\n */\n@Entity\n@Table(name = \"catalog",
"end": 239,
"score": 0.9724758863449097,
"start": 235,
"tag": "USERNAME",
"value": "SEJI"
}
] | null | [] | package org.openpaas.paasta.portal.common.api.entity.portal;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.UpdateTimestamp;
import javax.persistence.*;
import java.util.Date;
/**
* Created by SEJI on 2018-03-06.
*/
@Entity
@Table(name = "catalog_history")
public class CatalogHistory {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "no", nullable = false)
private int no;
@Column(name = "catalog_no", nullable = false)
private int catalogNo;
@Column(name = "catalog_type", nullable = false)
private String catalogType;
@Column(name = "user_id", nullable = false)
private String userId;
@UpdateTimestamp
@Column(name = "created", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
@Temporal(TemporalType.TIMESTAMP)
private Date created;
@UpdateTimestamp
@Column(name = "lastmodified", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
@Temporal(TemporalType.TIMESTAMP)
private Date lastmodified;
@Transient
private String searchKeyword;
@Transient
private String searchTypeColumn;
@Transient
private String searchTypeUseYn;
@Transient
private int starterCatalogNo;
@Transient
private String name;
public int getNo() {
return no;
}
public void setNo(int no) {
this.no = no;
}
public int getCatalogNo() {
return catalogNo;
}
public void setCatalogNo(int catalogNo) {
this.catalogNo = catalogNo;
}
public String getCatalogType() {
return catalogType;
}
public void setCatalogType(String catalogType) {
this.catalogType = catalogType;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Seoul")
public Date getCreated() {
return created == null ? null : new Date(created.getTime());
}
public void setCreated(Date created) {
this.created = created == null ? null : new Date(created.getTime());
}
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Seoul")
public Date getLastmodified() {
return lastmodified == null ? null : new Date(lastmodified.getTime()) ;
}
public void setLastmodified(Date lastmodified) {
this.lastmodified = lastmodified == null ? null : new Date(lastmodified.getTime());
}
public String getSearchKeyword() {
return searchKeyword;
}
public void setSearchKeyword(String searchKeyword) {
this.searchKeyword = searchKeyword;
}
public String getSearchTypeColumn() {
return searchTypeColumn;
}
public void setSearchTypeColumn(String searchTypeColumn) {
this.searchTypeColumn = searchTypeColumn;
}
public String getSearchTypeUseYn() {
return searchTypeUseYn;
}
public void setSearchTypeUseYn(String searchTypeUseYn) {
this.searchTypeUseYn = searchTypeUseYn;
}
public int getStarterCatalogNo() {
return starterCatalogNo;
}
public void setStarterCatalogNo(int starterCatalogNo) {
this.starterCatalogNo = starterCatalogNo;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "Catalog{" +
"no=" + no +
", catalogNo=" + catalogNo +
", catalogType=" + catalogType +
", userId='" + userId + '\'' +
", created=" + created +
", lastmodified=" + lastmodified +
", searchKeyword='" + searchKeyword + '\'' +
", searchTypeColumn='" + searchTypeColumn + '\'' +
", searchTypeUseYn='" + searchTypeUseYn + '\'' +
", starterCatalogNo=" + starterCatalogNo +
", name='" + name + '\'' +
'}';
}
}
| 4,176 | 0.620929 | 0.619013 | 163 | 24.619633 | 24.164875 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.361963 | false | false | 15 |
298cebfd4a1c08aae093acf9fe977043a7a056c6 | 22,093,311,801,111 | db77e7c6fe4cc0ba7b729ce6b1382cb8fa9b5762 | /app/src/main/java/com/example/messagebird/Login.java | 7498fe2b1279a055737bc261df79a34886de8a2a | [] | no_license | Nikola525/MessageBird | https://github.com/Nikola525/MessageBird | c09e70c69ebaeb0a3195abccd14f18751d2c9458 | 6e375f042d687b42b6ba165aa82ccbe50de3829f | refs/heads/master | 2020-05-02T05:36:33.356000 | 2019-03-26T12:41:39 | 2019-03-26T12:41:39 | 177,226,351 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.messagebird;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
import networkpacket.NetworkPacket;
public class Login extends Activity {
private MsdBirdApplication app = null;
private EditText usrid = null;
private EditText password = null;
private Button login = null;
private Button toregiter = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
app = (MsdBirdApplication)getApplication();
usrid = findViewById(R.id.edtUsrid_login);
usrid.setText(String.valueOf(app.registeredusrid));
password = findViewById(R.id.edtPassword_login);
login = findViewById(R.id.btnLogin_login);
login.setOnClickListener(new View.OnClickListener() {
NetworkPacket sndpkt = null;
@Override
public void onClick(View v) {
sndpkt = new NetworkPacket();
sndpkt.type = NetworkPacket.TYPE_LOGIN;
sndpkt.password = password.getText().toString();
sndpkt.from = Long.parseLong(usrid.getText().toString());
new LoginInBackGround().execute(sndpkt);
}
});
toregiter = findViewById(R.id.btnLinkToRegisterScreen_login);
toregiter.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Login.this,
Register.class);
startActivity(intent);
}
});
}
private class LoginInBackGround extends AsyncTask<NetworkPacket, Void, Boolean> {
@Override
protected Boolean doInBackground(NetworkPacket... packets) {
try{
app.oos.writeObject(packets[0]);
NetworkPacket rcvpkt = (NetworkPacket)app.ois.readObject();
if(rcvpkt.state == NetworkPacket.STATE_SUCCESS){
return true;
}else{
return false;
}
}catch(Exception e){
e.printStackTrace();
return false;
}
}
@Override
protected void onPostExecute(Boolean b) {
if(b.booleanValue()){
app.logined = true;
app.usrid = Long.parseLong(usrid.getText().toString());
Intent intent = new Intent(Login.this,
MainActivity.class);
startActivity(intent);
}else{
Toast.makeText(getApplicationContext(), "UserID or password is not correct,\n Please retry.", Toast.LENGTH_LONG).show();
}
}
}
public class Rcv extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(getApplicationContext(), "HHH", Toast.LENGTH_LONG).show();
}
}
}
| UTF-8 | Java | 3,428 | java | Login.java | Java | [
{
"context": " sndpkt.password = password.getText().toString();\n sndpkt.from = Long.parseLong(u",
"end": 1489,
"score": 0.6751106381416321,
"start": 1481,
"tag": "PASSWORD",
"value": "toString"
}
] | null | [] | package com.example.messagebird;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
import networkpacket.NetworkPacket;
public class Login extends Activity {
private MsdBirdApplication app = null;
private EditText usrid = null;
private EditText password = null;
private Button login = null;
private Button toregiter = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
app = (MsdBirdApplication)getApplication();
usrid = findViewById(R.id.edtUsrid_login);
usrid.setText(String.valueOf(app.registeredusrid));
password = findViewById(R.id.edtPassword_login);
login = findViewById(R.id.btnLogin_login);
login.setOnClickListener(new View.OnClickListener() {
NetworkPacket sndpkt = null;
@Override
public void onClick(View v) {
sndpkt = new NetworkPacket();
sndpkt.type = NetworkPacket.TYPE_LOGIN;
sndpkt.password = password.getText().<PASSWORD>();
sndpkt.from = Long.parseLong(usrid.getText().toString());
new LoginInBackGround().execute(sndpkt);
}
});
toregiter = findViewById(R.id.btnLinkToRegisterScreen_login);
toregiter.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Login.this,
Register.class);
startActivity(intent);
}
});
}
private class LoginInBackGround extends AsyncTask<NetworkPacket, Void, Boolean> {
@Override
protected Boolean doInBackground(NetworkPacket... packets) {
try{
app.oos.writeObject(packets[0]);
NetworkPacket rcvpkt = (NetworkPacket)app.ois.readObject();
if(rcvpkt.state == NetworkPacket.STATE_SUCCESS){
return true;
}else{
return false;
}
}catch(Exception e){
e.printStackTrace();
return false;
}
}
@Override
protected void onPostExecute(Boolean b) {
if(b.booleanValue()){
app.logined = true;
app.usrid = Long.parseLong(usrid.getText().toString());
Intent intent = new Intent(Login.this,
MainActivity.class);
startActivity(intent);
}else{
Toast.makeText(getApplicationContext(), "UserID or password is not correct,\n Please retry.", Toast.LENGTH_LONG).show();
}
}
}
public class Rcv extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(getApplicationContext(), "HHH", Toast.LENGTH_LONG).show();
}
}
}
| 3,430 | 0.602392 | 0.6021 | 123 | 26.869919 | 25.236752 | 136 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.495935 | false | false | 15 |
a5dde3b258b29565ffdd92c68c00c07d696bd9fb | 25,572,235,315,183 | 1a141c359177f4f462a141eae48a0bd3859e166d | /zcy-vanyar/vanyar-center/vanyar-supplier-api/src/main/java/com/dtdream/vanyar/supplier/mybank/dto/MybankDTO.java | 449aa97926918a75bfb3defb2aae1ad845b62526 | [] | no_license | ansongit/AnsonLearning | https://github.com/ansongit/AnsonLearning | daaf2e71aeafe1863966824f255affac865a1f94 | 7c24602bf67d9ba88452805b528821306fa1a5b2 | refs/heads/master | 2016-09-12T14:29:51.187000 | 2016-06-07T02:25:54 | 2016-06-07T02:25:54 | 60,574,679 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.dtdream.vanyar.supplier.mybank.dto;
import com.dtdream.vanyar.supplier.mybank.enums.OpenAccountResult;
import lombok.Data;
import java.io.Serializable;
/**
* 网商银行DTO
* @author yuchenchen
*/
@Data
public class MybankDTO implements Serializable {
private static final long serialVersionUID = -2514417529506027942L;
private Long id;
private Long supplierId; //供应商ID
private String registerNo; //工商注册号
private String status; //流程状态
private OpenAccountResult outerStatus;
private String memberId; //政采云平台会员账号
private String memberName; //供应商全称
private String accountType; //账户类型
private String accountNo; //账号名
private String accountName; //户名
private String remark; //失败原因备注
private String extension; //扩展字段
@Override
public String toString() {
return "MybankDTO{" +
"id=" + id +
", supplierId=" + supplierId +
", registerNo='" + registerNo + '\'' +
", status='" + status + '\'' +
", outerStatus=" + outerStatus +
", memberId='" + memberId + '\'' +
", memberName='" + memberName + '\'' +
", accountType=" + accountType +
", accountNo='" + accountNo + '\'' +
", accountName='" + accountName + '\'' +
", remark='" + remark + '\'' +
", extension='" + extension + '\'' +
'}';
}
}
| UTF-8 | Java | 1,625 | java | MybankDTO.java | Java | [
{
"context": "t java.io.Serializable;\n\n/**\n * 网商银行DTO\n * @author yuchenchen\n */\n@Data\npublic class MybankDTO implements Seria",
"end": 203,
"score": 0.9990963935852051,
"start": 193,
"tag": "USERNAME",
"value": "yuchenchen"
},
{
"context": "mberId + '\\'' +\n \", memberName='\" + memberName + '\\'' +\n \", accountType=\" + accou",
"end": 1229,
"score": 0.7982205152511597,
"start": 1219,
"tag": "USERNAME",
"value": "memberName"
}
] | null | [] | package com.dtdream.vanyar.supplier.mybank.dto;
import com.dtdream.vanyar.supplier.mybank.enums.OpenAccountResult;
import lombok.Data;
import java.io.Serializable;
/**
* 网商银行DTO
* @author yuchenchen
*/
@Data
public class MybankDTO implements Serializable {
private static final long serialVersionUID = -2514417529506027942L;
private Long id;
private Long supplierId; //供应商ID
private String registerNo; //工商注册号
private String status; //流程状态
private OpenAccountResult outerStatus;
private String memberId; //政采云平台会员账号
private String memberName; //供应商全称
private String accountType; //账户类型
private String accountNo; //账号名
private String accountName; //户名
private String remark; //失败原因备注
private String extension; //扩展字段
@Override
public String toString() {
return "MybankDTO{" +
"id=" + id +
", supplierId=" + supplierId +
", registerNo='" + registerNo + '\'' +
", status='" + status + '\'' +
", outerStatus=" + outerStatus +
", memberId='" + memberId + '\'' +
", memberName='" + memberName + '\'' +
", accountType=" + accountType +
", accountNo='" + accountNo + '\'' +
", accountName='" + accountName + '\'' +
", remark='" + remark + '\'' +
", extension='" + extension + '\'' +
'}';
}
}
| 1,625 | 0.541585 | 0.529142 | 56 | 26.267857 | 21.941067 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.517857 | false | false | 15 |
4fbe15a2901bd4790d091d7176ee0e658038eb46 | 30,288,109,405,841 | eee95bd17bea80d0ba83015c0279126a64bb75c9 | /ui/src/test/java/de/ipb_halle/lbac/file/mock/PartMock.java | 09172d9875b654b9947331bf88a06dad7c4d6f26 | [
"Apache-2.0"
] | permissive | ipb-halle/CRIMSy | https://github.com/ipb-halle/CRIMSy | e7a67e9cd4622775f577d4382741630fec264e2f | 1cafbf2db85bcb72bd80b10be4b772784c46e5ff | refs/heads/master | 2023-09-03T21:41:41.601000 | 2023-08-25T14:48:06 | 2023-08-25T14:48:06 | 246,850,750 | 2 | 3 | Apache-2.0 | false | 2023-08-25T14:48:07 | 2020-03-12T14:09:34 | 2022-12-14T23:13:36 | 2023-08-25T14:48:06 | 24,184 | 2 | 3 | 48 | Java | false | false | /*
* Cloud Resource & Information Management System (CRIMSy)
* Copyright 2020 Leibniz-Institut f. Pflanzenbiochemie
*
* 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 de.ipb_halle.lbac.file.mock;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import javax.servlet.http.Part;
/**
*
* @author fmauz
*/
public class PartMock implements Part {
private final File file;
public PartMock(File f) {
this.file = f;
}
@Override
public InputStream getInputStream() throws IOException {
return new BufferedInputStream(new FileInputStream(file));
}
@Override
public String getContentType() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getName() {
return file.getName();
}
@Override
public String getSubmittedFileName() {
return file.getName();
}
@Override
public long getSize() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void write(String fileName) throws IOException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void delete() throws IOException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getHeader(String name) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Collection<String> getHeaders(String name) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Collection<String> getHeaderNames() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
| UTF-8 | Java | 2,834 | java | PartMock.java | Java | [
{
"context": "import javax.servlet.http.Part;\n\n/**\n *\n * @author fmauz\n */\npublic class PartMock implements Part {\n\n ",
"end": 951,
"score": 0.9990919232368469,
"start": 946,
"tag": "USERNAME",
"value": "fmauz"
}
] | null | [] | /*
* Cloud Resource & Information Management System (CRIMSy)
* Copyright 2020 Leibniz-Institut f. Pflanzenbiochemie
*
* 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 de.ipb_halle.lbac.file.mock;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import javax.servlet.http.Part;
/**
*
* @author fmauz
*/
public class PartMock implements Part {
private final File file;
public PartMock(File f) {
this.file = f;
}
@Override
public InputStream getInputStream() throws IOException {
return new BufferedInputStream(new FileInputStream(file));
}
@Override
public String getContentType() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getName() {
return file.getName();
}
@Override
public String getSubmittedFileName() {
return file.getName();
}
@Override
public long getSize() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void write(String fileName) throws IOException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void delete() throws IOException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getHeader(String name) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Collection<String> getHeaders(String name) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Collection<String> getHeaderNames() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
| 2,834 | 0.708186 | 0.705363 | 91 | 30.142857 | 37.122185 | 135 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 15 |
d6e3ab6f989118314355fe7ff315003241b41193 | 17,575,006,229,367 | e9ed7dad1ce707112c98c0206f58dea79c2d345d | /Lines/src/com/control9/lines/screens/GameOverScreen.java | 0e4bd67b983553f43a0e792b71c9e33ba8a406f8 | [] | no_license | control9/FrozenLines | https://github.com/control9/FrozenLines | f29e37cd24a8102db014e8eec1c6ec465afe3240 | bf049f8a98ff0043f5da1c90972f9b1849b82735 | refs/heads/master | 2021-01-09T06:06:57.322000 | 2017-02-04T13:05:54 | 2017-02-04T13:05:54 | 80,919,031 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.control9.lines.screens;
import static com.control9.lines.view.GraphicHolder.GAMEOVER_RENDERER;
import static com.control9.lines.view.GraphicHolder.SIDEBAR_RENDERER;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL10;
public class GameOverScreen implements Screen {
@Override
public void render(float delta) {
Gdx.gl.glClearColor(1, 1, 1, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
SIDEBAR_RENDERER.render();
GAMEOVER_RENDERER.render();
}
@Override
public void resize(int width, int height) {
// TODO Auto-generated method stub
}
@Override
public void show() {
}
@Override
public void hide() {
ScreenHolder.getGame().changeScreen(ScreenHolder.getGameScreen());
}
@Override
public void pause() {
// TODO Auto-generated method stub
}
@Override
public void resume() {
}
@Override
public void dispose() {
}
}
| UTF-8 | Java | 926 | java | GameOverScreen.java | Java | [] | null | [] | package com.control9.lines.screens;
import static com.control9.lines.view.GraphicHolder.GAMEOVER_RENDERER;
import static com.control9.lines.view.GraphicHolder.SIDEBAR_RENDERER;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL10;
public class GameOverScreen implements Screen {
@Override
public void render(float delta) {
Gdx.gl.glClearColor(1, 1, 1, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
SIDEBAR_RENDERER.render();
GAMEOVER_RENDERER.render();
}
@Override
public void resize(int width, int height) {
// TODO Auto-generated method stub
}
@Override
public void show() {
}
@Override
public void hide() {
ScreenHolder.getGame().changeScreen(ScreenHolder.getGameScreen());
}
@Override
public void pause() {
// TODO Auto-generated method stub
}
@Override
public void resume() {
}
@Override
public void dispose() {
}
}
| 926 | 0.723542 | 0.711663 | 53 | 16.471699 | 19.518354 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.075472 | false | false | 15 |
8620c041c87349e6a48d63c9a1ca1027db982d04 | 37,366,215,485,083 | 53b705f5fc4cb622a30668b4d6a3cb631eaea347 | /ss-dsp-rest/src/main/java/com/foresee/ss/dsp/rest/controller/cxjm/CxjmgrcbxxController.java | cc76ed7c6c74c4118baf26b5c8c6eb48a874852f | [] | no_license | wyxroot/BaseCxjm | https://github.com/wyxroot/BaseCxjm | bfe865cd24d09499f447f61742cec0139eee20f9 | 642a909c7fd1bc65508110e53ed01a42885607b4 | refs/heads/master | 2020-04-04T13:36:06.175000 | 2018-11-09T13:29:04 | 2018-11-09T13:29:04 | 155,967,808 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.foresee.ss.dsp.rest.controller.cxjm;
import com.foresee.ss.dsp.rest.controller.base.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.foresee.icap.framework.entity.api.Response;
import com.foresee.ss.dsp.auto.model.SfzjCxjmgrcbxx;
import com.foresee.ss.dsp.auto.vo.CxjmxxVO;
import com.foresee.ss.dsp.service.cxjm.CxjmgrcbxxService;
/**
* 描述:
* 城乡居民个人参保信息
*
* @author liuqiang@foresee.com.cn
* @create 2018-11-01 9:20
*/
@RestController
@RequestMapping("/v1/insurInfo")
public class CxjmgrcbxxController extends BaseController<SfzjCxjmgrcbxx> {
@Autowired
private CxjmgrcbxxService cxjmgrcbxxService;
@PostMapping("/saveOrUpdate")
public Response insert(@RequestBody CxjmxxVO<SfzjCxjmgrcbxx> cxjmgrcbxxVO) {
return super.saveOrUpdate(cxjmgrcbxxVO);
}
}
| UTF-8 | Java | 1,113 | java | CxjmgrcbxxController.java | Java | [
{
"context": "xxService;\n\n/**\n * 描述:\n * 城乡居民个人参保信息\n *\n * @author liuqiang@foresee.com.cn\n * @create 2018-11-01 9:20\n */\n@RestController\n@R",
"end": 695,
"score": 0.9999294877052307,
"start": 672,
"tag": "EMAIL",
"value": "liuqiang@foresee.com.cn"
}
] | null | [] | package com.foresee.ss.dsp.rest.controller.cxjm;
import com.foresee.ss.dsp.rest.controller.base.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.foresee.icap.framework.entity.api.Response;
import com.foresee.ss.dsp.auto.model.SfzjCxjmgrcbxx;
import com.foresee.ss.dsp.auto.vo.CxjmxxVO;
import com.foresee.ss.dsp.service.cxjm.CxjmgrcbxxService;
/**
* 描述:
* 城乡居民个人参保信息
*
* @author <EMAIL>
* @create 2018-11-01 9:20
*/
@RestController
@RequestMapping("/v1/insurInfo")
public class CxjmgrcbxxController extends BaseController<SfzjCxjmgrcbxx> {
@Autowired
private CxjmgrcbxxService cxjmgrcbxxService;
@PostMapping("/saveOrUpdate")
public Response insert(@RequestBody CxjmxxVO<SfzjCxjmgrcbxx> cxjmgrcbxxVO) {
return super.saveOrUpdate(cxjmgrcbxxVO);
}
}
| 1,097 | 0.79798 | 0.786961 | 32 | 33.03125 | 25.950054 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.40625 | false | false | 15 |
ac773021907ddbfd80e8bd95075e1bbbe53bbde4 | 35,003,983,491,481 | 85e94c0deaa56ce93201664952c4c12278f7fbcb | /JavaProgram/src/com/is_a/P2.java | 58a74a2e057af437dc24657244531bb06d979740 | [] | no_license | Asmitha-UP-12/Java-repository | https://github.com/Asmitha-UP-12/Java-repository | c2a9ecf8aab9c14b6e29793100fe1c6e47414347 | 1b807027315676af6e7274acb31ee9f69f4618ac | refs/heads/master | 2020-08-31T11:56:20.341000 | 2019-11-22T14:14:19 | 2019-11-22T14:14:19 | 218,685,308 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.is_a;
public class P2 extends P1{
int j;
{
System.out.println("from iib of P2");
}
P2()
{
super();
System.out.println("from p1()");
}
public static void main(String[] args) {
P2 ob=new P2();
System.out.println(ob.i);
System.out.println(ob.j);
P1 ob2=new P1();
System.out.println(ob2.i);
}
}
| UTF-8 | Java | 362 | java | P2.java | Java | [] | null | [] | package com.is_a;
public class P2 extends P1{
int j;
{
System.out.println("from iib of P2");
}
P2()
{
super();
System.out.println("from p1()");
}
public static void main(String[] args) {
P2 ob=new P2();
System.out.println(ob.i);
System.out.println(ob.j);
P1 ob2=new P1();
System.out.println(ob2.i);
}
}
| 362 | 0.558011 | 0.527624 | 24 | 13.083333 | 13.431668 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.666667 | false | false | 15 |
e20f0d0de78def43b9ad3df06b683177da676eba | 36,060,545,438,329 | 2bb3296be3e9b054aa94f21acdd3458d68546862 | /Codes 1st Year - Second Semester/AdvanceArray/SalesPerson/DemoSalesPerson.java | 992f3be00557235d482f9fae49435c4846fa8359 | [] | no_license | angelohizon-coder/academics | https://github.com/angelohizon-coder/academics | 68f29e0f42c2e64eec337c6b311bd0e888f16d35 | 20ab6380a370be715fa34a68cf3a222a37354783 | refs/heads/main | 2023-06-21T09:15:03.176000 | 2021-07-29T12:43:40 | 2021-07-29T12:43:40 | 376,338,423 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public class DemoSalesPerson
{
public static void main (String argsp[])
{
SalesPerson[] SPArray = new SalesPerson[10];
final int ID_NUM = 111;
final double SALES_VALUE = 25000;
for(int i = 0; i < SPArray.length; ++i)
{
SPArray[i] = new SalesPerson(ID_NUM + i, (SALES_VALUE + i * 5000));
}
for(int i = 0; i < SPArray.length; ++i)
{
System.out.println(SPArray[i].getIdNum() + " " + SPArray[i].getSalesAmt());
}
}
} | UTF-8 | Java | 449 | java | DemoSalesPerson.java | Java | [] | null | [] | public class DemoSalesPerson
{
public static void main (String argsp[])
{
SalesPerson[] SPArray = new SalesPerson[10];
final int ID_NUM = 111;
final double SALES_VALUE = 25000;
for(int i = 0; i < SPArray.length; ++i)
{
SPArray[i] = new SalesPerson(ID_NUM + i, (SALES_VALUE + i * 5000));
}
for(int i = 0; i < SPArray.length; ++i)
{
System.out.println(SPArray[i].getIdNum() + " " + SPArray[i].getSalesAmt());
}
}
} | 449 | 0.608018 | 0.572383 | 20 | 21.5 | 24.146429 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.15 | false | false | 15 |
b5a9223b7949b084460d8b28ceefcbeca1d02bce | 32,384,053,461,694 | da9d030aa70ac1975b7b7eb35dc6645def81d503 | /Aula_18/src/entities/Cachorro.java | 7535279f683867a277a458c8dd4e9e3ef83eec44 | [] | no_license | Aline-Ferreira1980/Digital-House_JAVA | https://github.com/Aline-Ferreira1980/Digital-House_JAVA | ba5797cd16dcd908bf5e25a3e88ee3f3928a290c | f5bcef92f0609c4d45a2efd53c06a2d3660c380a | refs/heads/master | 2023-01-07T12:49:42.210000 | 2020-11-02T14:31:16 | 2020-11-02T14:31:16 | 287,069,474 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package entities;
public class Cachorro extends Mamiferos{
public Cachorro() {
super();
}
public Cachorro(String nome) {
super(nome);
}
@Override
public void falar() {
System.out.println("Estou latindo");
}
}
| UTF-8 | Java | 225 | java | Cachorro.java | Java | [] | null | [] | package entities;
public class Cachorro extends Mamiferos{
public Cachorro() {
super();
}
public Cachorro(String nome) {
super(nome);
}
@Override
public void falar() {
System.out.println("Estou latindo");
}
}
| 225 | 0.68 | 0.68 | 15 | 14 | 13.286585 | 40 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.2 | false | false | 15 |
90afbd93329eb83fd7b84e007a13165d88d432af | 33,200,097,228,781 | 8009f3bcaab38c41dd2c6140b977352463a1b290 | /src/main/java/site/muzhi/leetcode/string/$402_RemoveKDigits.java | 174d32d0b211953d3e3d571cefec2c3d440a2ae9 | [] | no_license | lichuangCN/leetcode-solve | https://github.com/lichuangCN/leetcode-solve | 1b485e537a76b63f15a10b037a8efff479365b99 | b7c4a7883548751be91ad8d634f8855007d83598 | refs/heads/master | 2023-08-17T11:57:48.044000 | 2023-08-16T07:21:23 | 2023-08-16T07:21:23 | 222,054,384 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package site.muzhi.leetcode.string;
import java.util.LinkedList;
/**
* @author: LiChuang
* @date: 2020/02/22
* @description:
* 给定一个以字符串表示的非负整数 num,移除这个数中的 k 位数字,使得剩下的数字最小
*
* 算法思想:采用栈的数据结构,保存可能小的字符
*/
public class $402_RemoveKDigits {
public String removeKDigits(String num, int k) {
LinkedList<Character> stack = new LinkedList<>();
if (num == null || num.length() == 0 || k > num.length()) {
return "0";
}
char[] array = num.toCharArray();
// 遍历字符数组
for (int i = 0; i < array.length; i++) {
while (stack.size() > 0 && k > 0 && stack.peekLast() > array[i]) {
// 第i个元素小于栈顶元素,移除栈顶元素
stack.removeLast();
k--;
}
stack.addLast(array[i]);
}
// 若没有移除指定个数的元素,则移除剩余个数的末尾元素
for (int j = 0; j < k; j++) {
stack.removeLast();
}
// 拼接栈内字符
boolean leaderZero = true;
StringBuilder sb = new StringBuilder();
for (Character character : stack) {
// 当首位为0时,不拼接
if (leaderZero && character == '0') {
continue;
}
leaderZero = false;
sb.append(character);
}
// 当移除全部元素时,返回"0"
if (sb.length() ==0) {
return "0";
}
return sb.toString();
}
}
| UTF-8 | Java | 1,651 | java | $402_RemoveKDigits.java | Java | [
{
"context": "ng;\n\nimport java.util.LinkedList;\n\n/**\n * @author: LiChuang\n * @date: 2020/02/22\n * @description:\n * 给定一个以字符串",
"end": 91,
"score": 0.9997005462646484,
"start": 83,
"tag": "NAME",
"value": "LiChuang"
}
] | null | [] | package site.muzhi.leetcode.string;
import java.util.LinkedList;
/**
* @author: LiChuang
* @date: 2020/02/22
* @description:
* 给定一个以字符串表示的非负整数 num,移除这个数中的 k 位数字,使得剩下的数字最小
*
* 算法思想:采用栈的数据结构,保存可能小的字符
*/
public class $402_RemoveKDigits {
public String removeKDigits(String num, int k) {
LinkedList<Character> stack = new LinkedList<>();
if (num == null || num.length() == 0 || k > num.length()) {
return "0";
}
char[] array = num.toCharArray();
// 遍历字符数组
for (int i = 0; i < array.length; i++) {
while (stack.size() > 0 && k > 0 && stack.peekLast() > array[i]) {
// 第i个元素小于栈顶元素,移除栈顶元素
stack.removeLast();
k--;
}
stack.addLast(array[i]);
}
// 若没有移除指定个数的元素,则移除剩余个数的末尾元素
for (int j = 0; j < k; j++) {
stack.removeLast();
}
// 拼接栈内字符
boolean leaderZero = true;
StringBuilder sb = new StringBuilder();
for (Character character : stack) {
// 当首位为0时,不拼接
if (leaderZero && character == '0') {
continue;
}
leaderZero = false;
sb.append(character);
}
// 当移除全部元素时,返回"0"
if (sb.length() ==0) {
return "0";
}
return sb.toString();
}
}
| 1,651 | 0.485241 | 0.469402 | 55 | 24.254545 | 18.426481 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.472727 | false | false | 15 |
099aea9c6184a3da424a2b619ea9964da73b0ccc | 26,036,091,776,849 | c6223165b4911c8288c3d0928349cde5bb81febc | /JavaLabs/Lab2.524/SourceCode/Battleground.java | 7bc684e6d05c13c6b9a68296d3735e3f28258736 | [] | no_license | chapsan2001/ITMO.Labs | https://github.com/chapsan2001/ITMO.Labs | e3b8da88a446d38547497f44d0128d04d36c0d2c | 5a39f6b6e97cac6a73cbef854f358fa610986158 | refs/heads/master | 2020-12-05T16:07:03.883000 | 2020-08-17T09:31:16 | 2020-08-17T09:31:16 | 232,167,264 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import ru.ifmo.se.pokemon.*;
public class Battleground {
public static void main(String[] args) {
Battle field = new Battle();
field.addAlly(new Tropius("Письмак А. Е.", 4));
field.addAlly(new Mienfoo("Белозубов А. В.", 2));
field.addAlly(new Mienshao("Калинин И. В.", 3));
field.addFoe(new Starly("Гусарова Е. В.", 5));
field.addFoe(new Staravia("Пшеничнов В. Е.", 3));
field.addFoe(new Staraptor("Прищепенок О. Б.", 2));
field.go();
}
}
| UTF-8 | Java | 588 | java | Battleground.java | Java | [
{
"context": "new Battle();\r\n field.addAlly(new Tropius(\"Письмак А. Е.\", 4));\r\n field.addAlly(new Mienfoo(\"",
"end": 187,
"score": 0.9939546585083008,
"start": 180,
"tag": "NAME",
"value": "Письмак"
},
{
"context": "e();\r\n field.addAlly(new Tropius(\"Письмак А. Е.\", 4));\r\n field.addAlly(new Mienfoo(\"Белоз",
"end": 192,
"score": 0.5711550116539001,
"start": 191,
"tag": "NAME",
"value": "Е"
},
{
"context": " А. Е.\", 4));\r\n field.addAlly(new Mienfoo(\"Белозубов А. В.\", 2));\r\n field.addAlly(new Mienshao(\"Ка",
"end": 248,
"score": 0.8637701869010925,
"start": 237,
"tag": "NAME",
"value": "Белозубов А"
},
{
"context": "А. В.\", 2));\r\n field.addAlly(new Mienshao(\"Калинин И. В.\", 3));\r\n field.addFoe(new Starly(\"Гу",
"end": 304,
"score": 0.9104366302490234,
"start": 297,
"tag": "NAME",
"value": "Калинин"
},
{
"context": "н И. В.\", 3));\r\n field.addFoe(new Starly(\"Гусарова Е. В.\", 5));\r\n field.addFoe(new Staravia(",
"end": 359,
"score": 0.5760369300842285,
"start": 353,
"tag": "NAME",
"value": "усаров"
},
{
"context": "Е. В.\", 5));\r\n field.addFoe(new Staravia(\"Пшеничнов В. Е.\", 3));\r\n field.addFoe(new Starap",
"end": 415,
"score": 0.6028695106506348,
"start": 411,
"tag": "NAME",
"value": "шени"
}
] | null | [] | import ru.ifmo.se.pokemon.*;
public class Battleground {
public static void main(String[] args) {
Battle field = new Battle();
field.addAlly(new Tropius("Письмак А. Е.", 4));
field.addAlly(new Mienfoo("<NAME>. В.", 2));
field.addAlly(new Mienshao("Калинин И. В.", 3));
field.addFoe(new Starly("Гусарова Е. В.", 5));
field.addFoe(new Staravia("Пшеничнов В. Е.", 3));
field.addFoe(new Staraptor("Прищепенок О. Б.", 2));
field.go();
}
}
| 573 | 0.572243 | 0.560836 | 14 | 35.57143 | 21.503202 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.071429 | false | false | 15 |
0aec6febc5630cf3e8e6d023e8df0d0e4ee5a718 | 3,624,952,435,943 | c33c8b5327c4557ac1eac7fe3d8d4d289d8d1536 | /hanu_7/LabelTest1.java | 11bfeb1804bfe19e7139db88d72116a80915a6b0 | [] | no_license | mayabay/java_oca | https://github.com/mayabay/java_oca | caeb40f98ab3bb3c47f3285f77d72a72b2da8d17 | b0183c0b2c23744c357be703a22334459d97fa9c | refs/heads/master | 2020-12-28T09:04:59.569000 | 2020-06-24T10:05:23 | 2020-06-24T10:05:23 | 238,256,767 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package hanu_7;
class LabelTest1 {
public static void main(String[] args){
do2();
}
static void m(){
System.out.println( "m()" );
}
static void do1(){
NAME_1: {}
NAME_2: do{} while (false);
//NAME_DECL: int n = 42; 12: error: '.class' expected
int n = 42, o = 43;
NAME_EXPR: n++;
NAME_MCALL: m();
NAME_WHILE: while(true)break;
NAME_IF: if ( n == 42 ){
//continue NAME_MCALL; // DNC 25: error: undefined label: NAME_MCALL
//continue NAME_WHILE; // DNC same
//continue NAME_IF; // DNC 27: error: not a loop label: NAME_IF
//continue; // DNC 29: error: continue outside of loop
NAME_INNER_IF: if ( o == 43 ){
break NAME_IF;
}
break NAME_IF; // OK
}
NAME_RETURN: return;
}
static void do2(){
Object args = new Object();
System.out.println( "A" );
BLOCK_1: {
if ( args != null ) break BLOCK_1;
System.out.println( "B" );
}
System.out.println( "C" );
}
}
| UTF-8 | Java | 958 | java | LabelTest1.java | Java | [] | null | [] | package hanu_7;
class LabelTest1 {
public static void main(String[] args){
do2();
}
static void m(){
System.out.println( "m()" );
}
static void do1(){
NAME_1: {}
NAME_2: do{} while (false);
//NAME_DECL: int n = 42; 12: error: '.class' expected
int n = 42, o = 43;
NAME_EXPR: n++;
NAME_MCALL: m();
NAME_WHILE: while(true)break;
NAME_IF: if ( n == 42 ){
//continue NAME_MCALL; // DNC 25: error: undefined label: NAME_MCALL
//continue NAME_WHILE; // DNC same
//continue NAME_IF; // DNC 27: error: not a loop label: NAME_IF
//continue; // DNC 29: error: continue outside of loop
NAME_INNER_IF: if ( o == 43 ){
break NAME_IF;
}
break NAME_IF; // OK
}
NAME_RETURN: return;
}
static void do2(){
Object args = new Object();
System.out.println( "A" );
BLOCK_1: {
if ( args != null ) break BLOCK_1;
System.out.println( "B" );
}
System.out.println( "C" );
}
}
| 958 | 0.564718 | 0.536534 | 57 | 15.807017 | 18.067553 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.052632 | false | false | 15 |
34da49cc2fafb865402885869dff2d47668ae43a | 2,559,800,551,652 | 77b4bb29f7caa3fd66e3d029fe77cb737db72670 | /core/src/main/java/org/kohsuke/stapler/WebMethodContext.java | 231a42399aa277a8e274c452e779bf5127af6e0e | [
"BSD-2-Clause"
] | permissive | Dohbedoh/stapler | https://github.com/Dohbedoh/stapler | 79d9406b1fab5c07315db94d0fc9c32121cc2a6c | e1055a467c41d7482546efaf62aafecdddb70c1c | refs/heads/master | 2023-03-19T09:26:07.938000 | 2022-05-10T06:43:03 | 2022-05-10T06:43:03 | 201,357,634 | 0 | 0 | BSD-2-Clause | true | 2023-03-10T18:03:56 | 2019-08-09T00:23:01 | 2022-05-11T02:42:23 | 2023-03-10T18:03:52 | 41,785 | 0 | 0 | 8 | Java | false | false | package org.kohsuke.stapler;
/**
* {@link Function#contextualize(Object)} parameter that indicates
* the function is called to serve request, such as {@code doFoo(...)} or {@code doIndex(...)}
*
* @author Kohsuke Kawaguchi
* @see WebMethod
*/
public final class WebMethodContext {
private final String name;
// instantiation restricted to this class
/*package*/ WebMethodContext(String name) {
this.name = name;
}
/**
* Name of the web method. "" for index route.
*/
public String getName() {
return name;
}
/**
* Used as a special name that represents {@code doDynamic(...)} that does dynamic traversal.
*/
public static final String DYNAMIC = "\u0000";
}
| UTF-8 | Java | 739 | java | WebMethodContext.java | Java | [
{
"context": " doFoo(...)} or {@code doIndex(...)}\n *\n * @author Kohsuke Kawaguchi\n * @see WebMethod\n */\npublic final class WebMetho",
"end": 227,
"score": 0.9998484253883362,
"start": 210,
"tag": "NAME",
"value": "Kohsuke Kawaguchi"
}
] | null | [] | package org.kohsuke.stapler;
/**
* {@link Function#contextualize(Object)} parameter that indicates
* the function is called to serve request, such as {@code doFoo(...)} or {@code doIndex(...)}
*
* @author <NAME>
* @see WebMethod
*/
public final class WebMethodContext {
private final String name;
// instantiation restricted to this class
/*package*/ WebMethodContext(String name) {
this.name = name;
}
/**
* Name of the web method. "" for index route.
*/
public String getName() {
return name;
}
/**
* Used as a special name that represents {@code doDynamic(...)} that does dynamic traversal.
*/
public static final String DYNAMIC = "\u0000";
}
| 728 | 0.634641 | 0.629229 | 29 | 24.482759 | 26.725451 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.206897 | false | false | 15 |
be3862e7dd1a065435b5092267d19670fa62c55f | 8,933,532,017,178 | 015090e9051d467d93a1f7dcf4ff1e099a689c7f | /src/main/java/com/zhquake/leetcode/MedianOfTwoSortedArrays.java | 8befd4a208aa4122549d45fe12336981e363ba97 | [] | no_license | zhquake/zhquake-leetcode | https://github.com/zhquake/zhquake-leetcode | dbc36eaaa8d8bf57a3e52e4321ed1bb187bb5635 | bf12116ceb3cae12fcc1883983d95876c223715e | refs/heads/master | 2020-05-29T19:46:07.657000 | 2014-11-04T14:13:39 | 2014-11-04T14:13:39 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.zhquake.leetcode;
/**
* There are two sorted arrays A and B of size m and n respectively. Find the
* median of the two sorted arrays. The overall run time complexity should be
* O(log (m+n)).
*
* @author zhen
*
*/
public class MedianOfTwoSortedArrays {
public class Solution {
public double findMedianSortedArrays(int A[], int B[]) {
int length = A.length + B.length;
if (length % 2 == 0) {
return (findKthValue(A, 0, B, 0, length / 2) + findKthValue(A,
0, B, 0, length / 2 + 1)) / 2.0;
} else {
return findKthValue(A, 0, B, 0, length / 2 + 1);
}
}
private int findKthValue(int A[], int firstA, int B[], int firstB, int k) {
if (firstA >= A.length)
return B[k - 1];
if (firstB >= B.length)
return A[k - 1];
if (k == 1)
return Math.min(A[firstA], B[firstB]);
if (A.length > B.length)
return findKthValue(B, firstB, A, firstA, k);
int partA = Math.min(A.length, k / 2);
int partB = k - partA;
if (A[firstA + partA - 1] > B[firstB + partB - 1]) {
return findKthValue(A, firstA, B, firstB + partB, k - partB);
} else if (A[firstA + partA - 1] < B[firstB + partB - 1]) {
return findKthValue(A, firstA + partA, B, firstB, k - partA);
} else {
return A[firstA + partA - 1];
}
}
}
}
| UTF-8 | Java | 1,296 | java | MedianOfTwoSortedArrays.java | Java | [
{
"context": "mplexity should be\n * O(log (m+n)).\n * \n * @author zhen\n *\n */\npublic class MedianOfTwoSortedArrays {\n\tpu",
"end": 227,
"score": 0.9943826794624329,
"start": 223,
"tag": "USERNAME",
"value": "zhen"
}
] | null | [] | package com.zhquake.leetcode;
/**
* There are two sorted arrays A and B of size m and n respectively. Find the
* median of the two sorted arrays. The overall run time complexity should be
* O(log (m+n)).
*
* @author zhen
*
*/
public class MedianOfTwoSortedArrays {
public class Solution {
public double findMedianSortedArrays(int A[], int B[]) {
int length = A.length + B.length;
if (length % 2 == 0) {
return (findKthValue(A, 0, B, 0, length / 2) + findKthValue(A,
0, B, 0, length / 2 + 1)) / 2.0;
} else {
return findKthValue(A, 0, B, 0, length / 2 + 1);
}
}
private int findKthValue(int A[], int firstA, int B[], int firstB, int k) {
if (firstA >= A.length)
return B[k - 1];
if (firstB >= B.length)
return A[k - 1];
if (k == 1)
return Math.min(A[firstA], B[firstB]);
if (A.length > B.length)
return findKthValue(B, firstB, A, firstA, k);
int partA = Math.min(A.length, k / 2);
int partB = k - partA;
if (A[firstA + partA - 1] > B[firstB + partB - 1]) {
return findKthValue(A, firstA, B, firstB + partB, k - partB);
} else if (A[firstA + partA - 1] < B[firstB + partB - 1]) {
return findKthValue(A, firstA + partA, B, firstB, k - partA);
} else {
return A[firstA + partA - 1];
}
}
}
}
| 1,296 | 0.589506 | 0.570988 | 48 | 26 | 24.475328 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.875 | false | false | 15 |
eac849aea7209bcf319056fee220f669bc2dcba2 | 6,064,493,873,460 | 72a7e1f5ea07b560cced055433d8481e0b5d9628 | /koolping-service/src/main/java/com/oceantech/koolping/service/PersonService.java | 12d8a2ad3fbca63eeb99b21ed876f2243aef2640 | [] | no_license | durdan/koolping | https://github.com/durdan/koolping | b30e0695ae89536a5637d9f8c650260819c91d96 | de04f7891210490e1a33f9c59296fdf279cee4c9 | refs/heads/master | 2016-09-10T22:32:04.806000 | 2014-06-01T18:45:29 | 2014-06-01T18:45:29 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.oceantech.koolping.service;
import com.oceantech.koolping.domain.Item;
import com.oceantech.koolping.domain.Person;
import java.util.List;
/**
* @author Sanjoy Roy
*/
public interface PersonService {
List<Person> findAll();
Person findById(final Long id);
Person findByUsername(final String username);
Person findByFacebookId(final String facebookId);
Person findByTwitterId(final String twitterId);
Person findByGoogleplusId(final String googleplusId);
Person create(final Person person);
Person update(final Person person);
void delete(final Person person);
String findMyRating(final Person person, final Item item);
Integer findMyFriendsRating(final Person person, final Item item, final String rating);
}
| UTF-8 | Java | 772 | java | PersonService.java | Java | [
{
"context": "in.Person;\n\nimport java.util.List;\n\n/**\n * @author Sanjoy Roy\n */\npublic interface PersonService {\n List<Per",
"end": 179,
"score": 0.9998537302017212,
"start": 169,
"tag": "NAME",
"value": "Sanjoy Roy"
}
] | null | [] | package com.oceantech.koolping.service;
import com.oceantech.koolping.domain.Item;
import com.oceantech.koolping.domain.Person;
import java.util.List;
/**
* @author <NAME>
*/
public interface PersonService {
List<Person> findAll();
Person findById(final Long id);
Person findByUsername(final String username);
Person findByFacebookId(final String facebookId);
Person findByTwitterId(final String twitterId);
Person findByGoogleplusId(final String googleplusId);
Person create(final Person person);
Person update(final Person person);
void delete(final Person person);
String findMyRating(final Person person, final Item item);
Integer findMyFriendsRating(final Person person, final Item item, final String rating);
}
| 768 | 0.760363 | 0.760363 | 25 | 29.879999 | 24.015528 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.72 | false | false | 15 |
1d0c6dcee7e332ed204ee7b0c9f2bb7c6e7c150d | 4,672,924,456,204 | 3a7fc869350459c40ea80d6287cfb2b89d502c00 | /src/com/theshoes/jsp/cs/controller/QuestionListServlet.java | 3d8bf6d03dc50dc9a9145750061c1a687b07b631 | [] | no_license | Semi-The-Shoes/TheShoes | https://github.com/Semi-The-Shoes/TheShoes | 4463b5f01693a9bdaf94cfe748aaf4a53a0422e5 | 01ae1e7c453ad825b070c4efb89aa4cd7c2eb064 | refs/heads/master | 2023-09-03T11:15:58.234000 | 2021-10-25T00:43:03 | 2021-10-25T00:43:03 | 405,625,143 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.theshoes.jsp.cs.controller;
import java.io.IOException;
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 com.theshoes.jsp.board.model.dto.BoardDTO;
import com.theshoes.jsp.board.model.service.BoardService;
import com.theshoes.jsp.common.paging.Pagenation;
import com.theshoes.jsp.common.paging.SelectCriteria;
import com.theshoes.jsp.cs.model.dto.QuestionDTO;
import com.theshoes.jsp.cs.model.service.QuestionService;
@WebServlet("/cs/list")
public class QuestionListServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
/* 페이징처리 */
int pageNo = 1; // 기본 시작 페이지번호
int onePost = 10; // 한 페이지에 노출시킬 게시글의 수
int onePage = 5; // 한번에 보여줄 페이지 버튼의 갯수
String currentPage = request.getParameter("currentPage"); // 현재 페이지 값
if(currentPage != null && !"".equals(currentPage)) {
pageNo = Integer.parseInt(currentPage);
}
QuestionService questionService = new QuestionService();
BoardService boardService = new BoardService();
/* 전체 게시물 수 조회 */
int totalCsCount = questionService.selectCsTotalCount();
System.out.println("csList.size : " + totalCsCount);
/* 전체 공지사항 목록 조회 */
SelectCriteria selectCriteria = null;
/* 페이징 처리를 위한 로직 호출 후 페이징 처리에 관한 정보를 담고 있는 인스턴스를 반환받는다. */
selectCriteria = Pagenation.getSelectCriteria(pageNo, totalCsCount, onePost, onePage);
System.out.println(selectCriteria);
List<QuestionDTO> csList = questionService.selectAllCsList(selectCriteria);
System.out.println(csList);
List<BoardDTO> noticeList = boardService.selectAllNoticeList(selectCriteria);
System.out.println(noticeList);
String path = "";
if(csList != null) {
path = "/WEB-INF/views/cs/questionList.jsp";
request.setAttribute("pagingPath", "cs/list");
request.setAttribute("csList", csList);
request.setAttribute("noticeList", noticeList);
request.setAttribute("selectCriteria", selectCriteria);
} else {
path = "/WEB-INF/views/common/errorPage.jsp";
}
request.getRequestDispatcher(path).forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
}
| UTF-8 | Java | 2,787 | java | QuestionListServlet.java | Java | [] | null | [] | package com.theshoes.jsp.cs.controller;
import java.io.IOException;
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 com.theshoes.jsp.board.model.dto.BoardDTO;
import com.theshoes.jsp.board.model.service.BoardService;
import com.theshoes.jsp.common.paging.Pagenation;
import com.theshoes.jsp.common.paging.SelectCriteria;
import com.theshoes.jsp.cs.model.dto.QuestionDTO;
import com.theshoes.jsp.cs.model.service.QuestionService;
@WebServlet("/cs/list")
public class QuestionListServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
/* 페이징처리 */
int pageNo = 1; // 기본 시작 페이지번호
int onePost = 10; // 한 페이지에 노출시킬 게시글의 수
int onePage = 5; // 한번에 보여줄 페이지 버튼의 갯수
String currentPage = request.getParameter("currentPage"); // 현재 페이지 값
if(currentPage != null && !"".equals(currentPage)) {
pageNo = Integer.parseInt(currentPage);
}
QuestionService questionService = new QuestionService();
BoardService boardService = new BoardService();
/* 전체 게시물 수 조회 */
int totalCsCount = questionService.selectCsTotalCount();
System.out.println("csList.size : " + totalCsCount);
/* 전체 공지사항 목록 조회 */
SelectCriteria selectCriteria = null;
/* 페이징 처리를 위한 로직 호출 후 페이징 처리에 관한 정보를 담고 있는 인스턴스를 반환받는다. */
selectCriteria = Pagenation.getSelectCriteria(pageNo, totalCsCount, onePost, onePage);
System.out.println(selectCriteria);
List<QuestionDTO> csList = questionService.selectAllCsList(selectCriteria);
System.out.println(csList);
List<BoardDTO> noticeList = boardService.selectAllNoticeList(selectCriteria);
System.out.println(noticeList);
String path = "";
if(csList != null) {
path = "/WEB-INF/views/cs/questionList.jsp";
request.setAttribute("pagingPath", "cs/list");
request.setAttribute("csList", csList);
request.setAttribute("noticeList", noticeList);
request.setAttribute("selectCriteria", selectCriteria);
} else {
path = "/WEB-INF/views/common/errorPage.jsp";
}
request.getRequestDispatcher(path).forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
}
| 2,787 | 0.72625 | 0.724312 | 77 | 31.493507 | 28.381731 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.181818 | false | false | 15 |
e14f8cd31154ab80b7f463e681cb1e008a4f257b | 420,906,832,784 | c6ef4679b33736711ccad7984421d830b6e90c43 | /adoptor/Circle.java | 7725b63eb3a826257f35360972893908892ed853 | [] | no_license | Ainapurgaurav/Object_Oriented_Analysis_of_Design_Patterns_Lab | https://github.com/Ainapurgaurav/Object_Oriented_Analysis_of_Design_Patterns_Lab | 736562816c54bc9bad40a20d03d4d538612ab0ca | 932d549b3008cd1d8c86b9bdcfbcc2dc2ddaf8e2 | refs/heads/master | 2020-03-19T11:49:32.521000 | 2020-01-09T00:40:06 | 2020-01-09T00:40:06 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class Circle extends Shape {
public xxcircle myobj=new xxcircle();
void setLocation(int a) {
myobj.locationset(a);
}
void getLocation(int a) {
myobj.locationget(a);
}
void fill() {
myobj.fillcolour();
}
void display() {
myobj.disp();
}
void setColour() {
myobj.colourset();
}
}
| UTF-8 | Java | 332 | java | Circle.java | Java | [] | null | [] |
public class Circle extends Shape {
public xxcircle myobj=new xxcircle();
void setLocation(int a) {
myobj.locationset(a);
}
void getLocation(int a) {
myobj.locationget(a);
}
void fill() {
myobj.fillcolour();
}
void display() {
myobj.disp();
}
void setColour() {
myobj.colourset();
}
}
| 332 | 0.605422 | 0.605422 | 19 | 15.368421 | 11.411954 | 37 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.631579 | false | false | 15 |
19b9abfe097aa1e8565b58ddc01deb44effffdcc | 987,842,540,086 | 583e02e1d58780405f934bcf62c895c35a54789a | /tThrowBlockGames/src/net/throwblock/throwblockgames/cmds/SpawnCommand.java | cec859cb1da8339c6e88af300410a1b10d4c2079 | [] | no_license | vduuude/--ThrowGamez-- | https://github.com/vduuude/--ThrowGamez-- | f3a54df221fbbc3bf2c4e4dd0ac4fd88518c9661 | 6a192e139da2cbe4a964954dc329ce9ead72c920 | refs/heads/master | 2019-01-25T13:31:28.191000 | 2014-01-16T09:56:29 | 2014-01-16T09:56:29 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.throwblock.throwblockgames.cmds;
import java.util.Random;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import net.throwblock.throwblockgames.game.GameStatus;
import net.throwblock.throwblockgames.game.GameUtils;
public class SpawnCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("Only players can use this command.");
return true;
}
Player player = (Player) sender;
if (((GameUtils.getStatus() == GameStatus.WAITING) || (GameUtils.getStatus() == GameStatus.COUNTDOWN)) || (player.getGameMode() == GameMode.CREATIVE)) {
Random random = new Random();
int x = random.nextInt(900) - 450;
int z = random.nextInt(900) - 450;
Location loc = player.getWorld().getHighestBlockAt(x, z).getLocation().clone().add(0.5D, 1.5D, 0.5);
player.teleport(loc);
}
return true;
}
}
| UTF-8 | Java | 1,116 | java | SpawnCommand.java | Java | [] | null | [] | package net.throwblock.throwblockgames.cmds;
import java.util.Random;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import net.throwblock.throwblockgames.game.GameStatus;
import net.throwblock.throwblockgames.game.GameUtils;
public class SpawnCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("Only players can use this command.");
return true;
}
Player player = (Player) sender;
if (((GameUtils.getStatus() == GameStatus.WAITING) || (GameUtils.getStatus() == GameStatus.COUNTDOWN)) || (player.getGameMode() == GameMode.CREATIVE)) {
Random random = new Random();
int x = random.nextInt(900) - 450;
int z = random.nextInt(900) - 450;
Location loc = player.getWorld().getHighestBlockAt(x, z).getLocation().clone().add(0.5D, 1.5D, 0.5);
player.teleport(loc);
}
return true;
}
}
| 1,116 | 0.743728 | 0.727599 | 32 | 33.875 | 33.6329 | 154 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2 | false | false | 15 |
8ed4f82486845a00c923ed6f40dadcfc95b51714 | 5,205,500,421,394 | 194381693166760fc46971b521459f5bc1afd6c7 | /src/main/java/com/felipe/library/controller/dto/AuthorDTO.java | 5de79e98890ec074894ccd40058c957ae4944093 | [] | no_license | felipesilvamelo28/library_api_Spring_boot | https://github.com/felipesilvamelo28/library_api_Spring_boot | a426b35052464487c91e82d6c736cfaa202e815d | 41f4926928d3f769aab20ce012a97d1256e2dcf6 | refs/heads/master | 2021-01-05T23:24:32.814000 | 2020-02-17T18:54:46 | 2020-02-17T18:54:46 | 241,165,921 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.felipe.library.controller.dto;
public class AuthorDTO {
}
| UTF-8 | Java | 71 | java | AuthorDTO.java | Java | [] | null | [] | package com.felipe.library.controller.dto;
public class AuthorDTO {
}
| 71 | 0.788732 | 0.788732 | 4 | 16.75 | 17.455299 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 15 |
2748fe0061d7787e4bbbcfdd3d77f54822cd801d | 12,266,426,639,851 | e8af09d700aab202ed74a9eb2e618ab4061c0532 | /src/java/beans/GeneroEJB.java | eb33bb763f443239885b70fca6f62349c440a398 | [] | no_license | alexfun97/EJBAcceso | https://github.com/alexfun97/EJBAcceso | 280a812545870c7a914afe7ee09cda98e43ddf37 | 81063eb7d440d673b1abda50784e4f0e5bfa6e6e | refs/heads/master | 2021-05-06T12:48:51.246000 | 2017-12-05T12:58:30 | 2017-12-05T12:58:30 | 113,182,550 | 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 beans;
import javax.ejb.Stateless;
import java.util.List;
import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceUnit;
@Stateless
public class GeneroEJB {
@PersistenceUnit
EntityManagerFactory emf;
public List findAll(){
return emf.createEntityManager().createNamedQuery("Genero.findAll").getResultList();
}
}
| UTF-8 | Java | 563 | java | GeneroEJB.java | Java | [] | 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 beans;
import javax.ejb.Stateless;
import java.util.List;
import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceUnit;
@Stateless
public class GeneroEJB {
@PersistenceUnit
EntityManagerFactory emf;
public List findAll(){
return emf.createEntityManager().createNamedQuery("Genero.findAll").getResultList();
}
}
| 563 | 0.751332 | 0.751332 | 22 | 24.59091 | 25.249048 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.454545 | false | false | 15 |
b8df330af77d7a292db4d8298637a278f99171b3 | 1,855,425,876,134 | 1cbb56250932fe70cfab29ce7e51348602f82dc3 | /src/perso/logement/DeleteAnnonceServlet.java | 20c40cccb99088361b8d515b98f12efde2947856 | [] | no_license | tomate690/logement | https://github.com/tomate690/logement | 9f206ad7ea099d7e2ff60b2354203313c97b9906 | 02ae8716a14155177fde3f97e4b33fcf8e43e2ec | refs/heads/master | 2021-05-17T20:35:37.757000 | 2018-06-19T18:04:35 | 2018-06-19T18:04:35 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package perso.logement;
import static java.lang.Integer.parseInt;
import java.io.IOException;
import java.util.Calendar;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.jdo.PersistenceManager;
import javax.jdo.Query;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import perso.logement.core.Annonce;
@SuppressWarnings("serial")
public class DeleteAnnonceServlet extends HttpServlet {
private static final Logger log = Logger.getLogger(DeleteAnnonceServlet.class.getName());
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
PersistenceManager pm = PMF.get().getPersistenceManager();
int year = parseInt(req.getParameter("year"));
int month = parseInt(req.getParameter("month"));
int day = parseInt(req.getParameter("day"));
try {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, year);
cal.set(Calendar.MONTH, month - 1);
cal.set(Calendar.DAY_OF_MONTH, day);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
Query query = pm.newQuery(Annonce.class, "date >= startDate");
query.declareParameters("java.util.Date startDate");
List<Annonce> annonces = (List<Annonce>) query.execute(cal.getTime());
log.log(Level.INFO, "deleting " + annonces.size() + " annonces");
pm.deletePersistentAll(annonces);
} finally {
pm.close();
}
resp.setContentType("text/plain");
resp.getWriter().println("Hello, world");
}
}
| UTF-8 | Java | 1,714 | java | DeleteAnnonceServlet.java | Java | [] | null | [] | package perso.logement;
import static java.lang.Integer.parseInt;
import java.io.IOException;
import java.util.Calendar;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.jdo.PersistenceManager;
import javax.jdo.Query;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import perso.logement.core.Annonce;
@SuppressWarnings("serial")
public class DeleteAnnonceServlet extends HttpServlet {
private static final Logger log = Logger.getLogger(DeleteAnnonceServlet.class.getName());
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
PersistenceManager pm = PMF.get().getPersistenceManager();
int year = parseInt(req.getParameter("year"));
int month = parseInt(req.getParameter("month"));
int day = parseInt(req.getParameter("day"));
try {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, year);
cal.set(Calendar.MONTH, month - 1);
cal.set(Calendar.DAY_OF_MONTH, day);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
Query query = pm.newQuery(Annonce.class, "date >= startDate");
query.declareParameters("java.util.Date startDate");
List<Annonce> annonces = (List<Annonce>) query.execute(cal.getTime());
log.log(Level.INFO, "deleting " + annonces.size() + " annonces");
pm.deletePersistentAll(annonces);
} finally {
pm.close();
}
resp.setContentType("text/plain");
resp.getWriter().println("Hello, world");
}
}
| 1,714 | 0.715286 | 0.712369 | 50 | 33.279999 | 23.381224 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.9 | false | false | 15 |
a2595e66b4f3eecc5a8d748e91cde1fff27b0839 | 14,233,521,681,995 | c3361bb886bfe213a2c7a04dd5f8ee0340c72439 | /app/src/main/java/com/spark/coinpay/acceptances/detail/LevelDetailPresenterImpl.java | b1f021e7cf3f750b0f612a049d024891424283f0 | [] | no_license | kxiangguang/coinpay_bft_android | https://github.com/kxiangguang/coinpay_bft_android | 2864381fbefb861c8bce55971f5434e341ce5422 | cc5d45f254142d7f3859cbf9b0eabb6b556cfc9a | refs/heads/master | 2020-06-07T18:27:41.453000 | 2019-06-17T11:06:31 | 2019-06-17T11:06:31 | 193,071,613 | 1 | 1 | null | true | 2019-06-21T09:35:26 | 2019-06-21T09:35:26 | 2019-06-17T11:06:57 | 2019-06-17T11:06:53 | 1,841 | 0 | 0 | 0 | null | false | false | package com.spark.coinpay.acceptances.detail;
import com.android.volley.VolleyError;
import com.spark.library.acp.model.AcceptMerchantApplyMarginType;
import com.spark.library.acp.model.AcceptMerchantFrontVo;
import com.spark.modulebase.callback.ResponseCallBack;
import com.spark.modulebase.entity.HttpErrorEntity;
import com.spark.modulebase.utils.LogUtils;
import com.spark.moduleotc.model.AcceptanceMerchantControllerModel;
/**
* 承兑商等级详情
*/
public class LevelDetailPresenterImpl implements LevelDetailContract.LevelDetailPresenter {
private LevelDetailContract.LevelDetailView levelDetailView;
private AcceptanceMerchantControllerModel acceptanceMerchantControllerModel;
public LevelDetailPresenterImpl(LevelDetailContract.LevelDetailView levelDetailView) {
this.levelDetailView = levelDetailView;
acceptanceMerchantControllerModel = new AcceptanceMerchantControllerModel();
}
@Override
public void getSelfLevelInfo() {
showLoading();
acceptanceMerchantControllerModel.getSelfLevelInfo(new ResponseCallBack.SuccessListener<AcceptMerchantFrontVo>() {
@Override
public void onResponse(AcceptMerchantFrontVo response) {
LogUtils.i("response==" + response.toString());
hideLoading();
if (levelDetailView != null)
levelDetailView.getSelfLevelInfoSuccess(response);
}
}, new ResponseCallBack.ErrorListener() {
@Override
public void onErrorResponse(HttpErrorEntity httpErrorEntity) {
hideLoading();
if (levelDetailView != null)
levelDetailView.getSelfLevelInfoError(httpErrorEntity);
}
@Override
public void onErrorResponse(VolleyError volleyError) {
hideLoading();
if (levelDetailView != null)
levelDetailView.dealError(volleyError);
}
});
}
@Override
public void getAcceptancesProcessInfo(int type) {
showLoading();
acceptanceMerchantControllerModel.getAcceptancesProcessInfo(type, new ResponseCallBack.SuccessListener<AcceptMerchantApplyMarginType>() {
@Override
public void onResponse(AcceptMerchantApplyMarginType response) {
hideLoading();
if (levelDetailView != null)
levelDetailView.getAcceptancesProcessInfoSuccess(response);
}
}, new ResponseCallBack.ErrorListener() {
@Override
public void onErrorResponse(HttpErrorEntity httpErrorEntity) {
hideLoading();
if (levelDetailView != null)
levelDetailView.dealError(httpErrorEntity);
}
@Override
public void onErrorResponse(VolleyError volleyError) {
hideLoading();
if (levelDetailView != null)
levelDetailView.dealError(volleyError);
}
});
}
@Override
public void showLoading() {
if (levelDetailView != null)
levelDetailView.showLoading();
}
@Override
public void hideLoading() {
if (levelDetailView != null)
levelDetailView.hideLoading();
}
@Override
public void destory() {
levelDetailView = null;
}
}
| UTF-8 | Java | 3,435 | java | LevelDetailPresenterImpl.java | Java | [] | null | [] | package com.spark.coinpay.acceptances.detail;
import com.android.volley.VolleyError;
import com.spark.library.acp.model.AcceptMerchantApplyMarginType;
import com.spark.library.acp.model.AcceptMerchantFrontVo;
import com.spark.modulebase.callback.ResponseCallBack;
import com.spark.modulebase.entity.HttpErrorEntity;
import com.spark.modulebase.utils.LogUtils;
import com.spark.moduleotc.model.AcceptanceMerchantControllerModel;
/**
* 承兑商等级详情
*/
public class LevelDetailPresenterImpl implements LevelDetailContract.LevelDetailPresenter {
private LevelDetailContract.LevelDetailView levelDetailView;
private AcceptanceMerchantControllerModel acceptanceMerchantControllerModel;
public LevelDetailPresenterImpl(LevelDetailContract.LevelDetailView levelDetailView) {
this.levelDetailView = levelDetailView;
acceptanceMerchantControllerModel = new AcceptanceMerchantControllerModel();
}
@Override
public void getSelfLevelInfo() {
showLoading();
acceptanceMerchantControllerModel.getSelfLevelInfo(new ResponseCallBack.SuccessListener<AcceptMerchantFrontVo>() {
@Override
public void onResponse(AcceptMerchantFrontVo response) {
LogUtils.i("response==" + response.toString());
hideLoading();
if (levelDetailView != null)
levelDetailView.getSelfLevelInfoSuccess(response);
}
}, new ResponseCallBack.ErrorListener() {
@Override
public void onErrorResponse(HttpErrorEntity httpErrorEntity) {
hideLoading();
if (levelDetailView != null)
levelDetailView.getSelfLevelInfoError(httpErrorEntity);
}
@Override
public void onErrorResponse(VolleyError volleyError) {
hideLoading();
if (levelDetailView != null)
levelDetailView.dealError(volleyError);
}
});
}
@Override
public void getAcceptancesProcessInfo(int type) {
showLoading();
acceptanceMerchantControllerModel.getAcceptancesProcessInfo(type, new ResponseCallBack.SuccessListener<AcceptMerchantApplyMarginType>() {
@Override
public void onResponse(AcceptMerchantApplyMarginType response) {
hideLoading();
if (levelDetailView != null)
levelDetailView.getAcceptancesProcessInfoSuccess(response);
}
}, new ResponseCallBack.ErrorListener() {
@Override
public void onErrorResponse(HttpErrorEntity httpErrorEntity) {
hideLoading();
if (levelDetailView != null)
levelDetailView.dealError(httpErrorEntity);
}
@Override
public void onErrorResponse(VolleyError volleyError) {
hideLoading();
if (levelDetailView != null)
levelDetailView.dealError(volleyError);
}
});
}
@Override
public void showLoading() {
if (levelDetailView != null)
levelDetailView.showLoading();
}
@Override
public void hideLoading() {
if (levelDetailView != null)
levelDetailView.hideLoading();
}
@Override
public void destory() {
levelDetailView = null;
}
}
| 3,435 | 0.646595 | 0.646595 | 97 | 34.26804 | 29.481958 | 145 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.360825 | false | false | 15 |
6f815ce44297bd13110fc4ad21c2f65702f9e423 | 17,205,639,011,833 | 40ae27b95c752fe1fe2c9311dfd9cff13859d040 | /api/src/main/java/org/openmrs/module/ugandaemrreports/UgandaEMRReportUtil.java | 8922bf04a88475ade5375d9e2d3994cb4f53947e | [] | no_license | METS-Programme/openmrs-module-ugandaemr-reports | https://github.com/METS-Programme/openmrs-module-ugandaemr-reports | 5501eb095150955aee1fd94c6f4d8bccdd3f369a | 6627bcc976046deb818d0d7c80dd6141de7fd6ec | refs/heads/master | 2023-08-14T17:56:57.061000 | 2023-04-18T09:37:11 | 2023-04-18T09:37:11 | 53,608,581 | 1 | 34 | null | false | 2023-09-09T14:15:28 | 2016-03-10T18:46:37 | 2021-12-21T10:58:32 | 2023-09-09T14:15:27 | 5,184 | 1 | 33 | 6 | Java | false | false | package org.openmrs.module.ugandaemrreports;
import org.openmrs.module.reporting.evaluation.parameter.Mapped;
import org.openmrs.module.reporting.evaluation.parameter.Parameterizable;
import org.openmrs.module.reporting.evaluation.parameter.ParameterizableUtil;
import org.openmrs.module.reporting.report.ReportDesign;
import org.openmrs.module.reporting.report.definition.ReportDefinition;
import org.openmrs.module.reporting.report.manager.ReportManagerUtil;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
/**
* Utility classes that can be used for convenience
*/
public class UgandaEMRReportUtil {
/**
* @return a new ReportDesign for a standard Excel output
*/
public static ReportDesign createExcelDesign(String reportDesignUuid, ReportDefinition reportDefinition) {
ReportDesign design = ReportManagerUtil.createExcelDesign(reportDesignUuid, reportDefinition);
return design;
}
/**
* @return a new ReportDesign for a standard Excel output
*/
public static ReportDesign createExcelDesignWithProperties(String reportDesignUuid, ReportDefinition reportDefinition, Properties props) {
ReportDesign design = ReportManagerUtil.createExcelDesign(reportDesignUuid, reportDefinition);
design.setProperties(props);
return design;
}
/**
* Maps a parameterizable item with no parameters
*
* @param parameterizable the parameterizable item
* @param <T>
* @return the mapped item
*/
public static <T extends Parameterizable> Mapped<T> map(T parameterizable) {
if (parameterizable == null) {
throw new IllegalArgumentException("Parameterizable cannot be null");
}
return new Mapped<T>(parameterizable, null);
}
/**
* Maps a parameterizable item using a string list of parameters and values
*
* @param parameterizable the parameterizable item
* @param mappings the string list of mappings
* @param <T>
* @return the mapped item
*/
public static <T extends Parameterizable> Mapped<T> map(T parameterizable, String mappings) {
if (parameterizable == null) {
throw new IllegalArgumentException("Parameterizable cannot be null");
}
if (mappings == null) {
mappings = ""; // probably not necessary, just to be safe
}
return new Mapped<T>(parameterizable, ParameterizableUtil.createParameterMappings(mappings));
}
/**
* Maps a parameterizable item using a string list of parameters and values
*
* @param parameterizable the parameterizable item
* @param mappings the string list of mappings
* @param <T>
* @return the mapped item
*/
public static <T extends Parameterizable> Mapped<T> map(T parameterizable, Object... mappings) {
if (parameterizable == null) {
throw new IllegalArgumentException("Parameterizable cannot be null");
}
Map<String, Object> paramMap = new HashMap<String, Object>();
for (int m = 0; m < mappings.length; m += 2) {
String param = (String) mappings[m];
Object value = mappings[m + 1];
paramMap.put(param, value);
}
return new Mapped<T>(parameterizable, paramMap);
}
/**
* @return a new ReportDesign for a CSV output
*/
public static ReportDesign createCSVDesign(String reportDesignUuid, ReportDefinition reportDefinition) {
ReportDesign design = ReportManagerUtil.createCsvReportDesign(reportDesignUuid, reportDefinition);
return design;
}
}
| UTF-8 | Java | 3,663 | java | UgandaEMRReportUtil.java | Java | [] | null | [] | package org.openmrs.module.ugandaemrreports;
import org.openmrs.module.reporting.evaluation.parameter.Mapped;
import org.openmrs.module.reporting.evaluation.parameter.Parameterizable;
import org.openmrs.module.reporting.evaluation.parameter.ParameterizableUtil;
import org.openmrs.module.reporting.report.ReportDesign;
import org.openmrs.module.reporting.report.definition.ReportDefinition;
import org.openmrs.module.reporting.report.manager.ReportManagerUtil;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
/**
* Utility classes that can be used for convenience
*/
public class UgandaEMRReportUtil {
/**
* @return a new ReportDesign for a standard Excel output
*/
public static ReportDesign createExcelDesign(String reportDesignUuid, ReportDefinition reportDefinition) {
ReportDesign design = ReportManagerUtil.createExcelDesign(reportDesignUuid, reportDefinition);
return design;
}
/**
* @return a new ReportDesign for a standard Excel output
*/
public static ReportDesign createExcelDesignWithProperties(String reportDesignUuid, ReportDefinition reportDefinition, Properties props) {
ReportDesign design = ReportManagerUtil.createExcelDesign(reportDesignUuid, reportDefinition);
design.setProperties(props);
return design;
}
/**
* Maps a parameterizable item with no parameters
*
* @param parameterizable the parameterizable item
* @param <T>
* @return the mapped item
*/
public static <T extends Parameterizable> Mapped<T> map(T parameterizable) {
if (parameterizable == null) {
throw new IllegalArgumentException("Parameterizable cannot be null");
}
return new Mapped<T>(parameterizable, null);
}
/**
* Maps a parameterizable item using a string list of parameters and values
*
* @param parameterizable the parameterizable item
* @param mappings the string list of mappings
* @param <T>
* @return the mapped item
*/
public static <T extends Parameterizable> Mapped<T> map(T parameterizable, String mappings) {
if (parameterizable == null) {
throw new IllegalArgumentException("Parameterizable cannot be null");
}
if (mappings == null) {
mappings = ""; // probably not necessary, just to be safe
}
return new Mapped<T>(parameterizable, ParameterizableUtil.createParameterMappings(mappings));
}
/**
* Maps a parameterizable item using a string list of parameters and values
*
* @param parameterizable the parameterizable item
* @param mappings the string list of mappings
* @param <T>
* @return the mapped item
*/
public static <T extends Parameterizable> Mapped<T> map(T parameterizable, Object... mappings) {
if (parameterizable == null) {
throw new IllegalArgumentException("Parameterizable cannot be null");
}
Map<String, Object> paramMap = new HashMap<String, Object>();
for (int m = 0; m < mappings.length; m += 2) {
String param = (String) mappings[m];
Object value = mappings[m + 1];
paramMap.put(param, value);
}
return new Mapped<T>(parameterizable, paramMap);
}
/**
* @return a new ReportDesign for a CSV output
*/
public static ReportDesign createCSVDesign(String reportDesignUuid, ReportDefinition reportDefinition) {
ReportDesign design = ReportManagerUtil.createCsvReportDesign(reportDesignUuid, reportDefinition);
return design;
}
}
| 3,663 | 0.688234 | 0.687415 | 98 | 36.377552 | 34.274258 | 142 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.469388 | false | false | 15 |
b029168c2012a052f67edec8b09b915f1541fb2d | 28,011,776,760,939 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/naver--pinpoint/8b4ccd92d434e212a3f8c4b5737a1b8013c3b027/after/HbaseAgentInfoDao.java | c48d2d428fa0e87ec6906d51c9143c4e627bd170 | [] | no_license | fracz/refactor-extractor | https://github.com/fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211000 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.profiler.server.dao.hbase;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.util.Bytes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import com.profiler.common.dto.thrift.AgentInfo;
import com.profiler.common.hbase.HBaseTables;
import com.profiler.common.hbase.HbaseOperations2;
import com.profiler.common.util.RowKeyUtils;
import com.profiler.common.util.TimeUtils;
import com.profiler.server.dao.AgentInfoDao;
/**
*
*/
public class HbaseAgentInfoDao implements AgentInfoDao {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private HbaseOperations2 hbaseTemplate;
@Override
public void insert(AgentInfo agentInfo) {
if (logger.isDebugEnabled()) {
logger.debug("insert agent info. {}", agentInfo);
}
byte[] agentId = Bytes.toBytes(agentInfo.getAgentId());
long reverseKey = TimeUtils.reverseCurrentTimeMillis(agentInfo.getTimestamp());
byte[] rowKey = RowKeyUtils.concatFixedByteAndLong(agentId, HBaseTables.AGENT_NAME_MAX_LEN, reverseKey);
Put put = new Put(rowKey);
// 추가 agent 정보를 넣어야 됨. 일단 sqlMetaData에 필요한 starttime만 넣음.
put.add(HBaseTables.AGENTINFO_CF_INFO, null, null);
hbaseTemplate.put(HBaseTables.AGENTINFO, put);
}
} | UTF-8 | Java | 1,350 | java | HbaseAgentInfoDao.java | Java | [] | null | [] | package com.profiler.server.dao.hbase;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.util.Bytes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import com.profiler.common.dto.thrift.AgentInfo;
import com.profiler.common.hbase.HBaseTables;
import com.profiler.common.hbase.HbaseOperations2;
import com.profiler.common.util.RowKeyUtils;
import com.profiler.common.util.TimeUtils;
import com.profiler.server.dao.AgentInfoDao;
/**
*
*/
public class HbaseAgentInfoDao implements AgentInfoDao {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private HbaseOperations2 hbaseTemplate;
@Override
public void insert(AgentInfo agentInfo) {
if (logger.isDebugEnabled()) {
logger.debug("insert agent info. {}", agentInfo);
}
byte[] agentId = Bytes.toBytes(agentInfo.getAgentId());
long reverseKey = TimeUtils.reverseCurrentTimeMillis(agentInfo.getTimestamp());
byte[] rowKey = RowKeyUtils.concatFixedByteAndLong(agentId, HBaseTables.AGENT_NAME_MAX_LEN, reverseKey);
Put put = new Put(rowKey);
// 추가 agent 정보를 넣어야 됨. 일단 sqlMetaData에 필요한 starttime만 넣음.
put.add(HBaseTables.AGENTINFO_CF_INFO, null, null);
hbaseTemplate.put(HBaseTables.AGENTINFO, put);
}
} | 1,350 | 0.782344 | 0.7793 | 42 | 30.309525 | 26.871376 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.285714 | false | false | 15 |
d703de566b183375524dff10480ceb4f4faa37ce | 18,846,316,560,493 | 13e716fb43e8c1603ff0a4d8044367dd5fb3b3ae | /src/main/java/com/darwin/common/utils/SolrUtils.java | 88f1f846128acd33f36c6bdce294ff7d2bd6d4b0 | [] | no_license | DarewinWang/MySolr | https://github.com/DarewinWang/MySolr | b025324e136211ddfbc28cfc876ca82c138469a4 | 811b72443e0da80da2ea4572e91919857d354ca4 | refs/heads/master | 2020-03-25T15:38:20.037000 | 2018-09-09T12:01:05 | 2018-09-09T12:01:05 | 143,893,922 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.darwin.common.utils;
/**
* @类描述:solr查询工具类
* @项目名称:MySolr
* @包名: com.darwin.common.utils
* @类名称:SolrUtils
* @创建人:WangDong
* @创建时间:2018年7月23日上午2:28:03
* @修改人:WangDong
* @修改时间:2018年7月23日上午2:28:03
* @修改备注:
* @version v1.0
* @see
* @bug
* @Copyright
* @mail *@qq.com
*/
public class SolrUtils {
}
| UTF-8 | Java | 433 | java | SolrUtils.java | Java | [
{
"context": "com.darwin.common.utils\n * @类名称:SolrUtils\n * @创建人:WangDong\n * @创建时间:2018年7月23日上午2:28:03\n * @修改人:WangDong\n * ",
"end": 139,
"score": 0.9993140697479248,
"start": 131,
"tag": "NAME",
"value": "WangDong"
},
{
"context": "创建人:WangDong\n * @创建时间:2018年7月23日上午2:28:03\n * @修改人:WangDong\n * @修改时间:2018年7月23日上午2:28:03\n * @修改备注:\n * @versio",
"end": 185,
"score": 0.9988435506820679,
"start": 177,
"tag": "NAME",
"value": "WangDong"
},
{
"context": " v1.0\n * @see \n * @bug \n * @Copyright \n * @mail *@qq.com\n */\npublic class SolrUtils {\n\n}\n",
"end": 292,
"score": 0.7022557258605957,
"start": 286,
"tag": "EMAIL",
"value": "qq.com"
}
] | null | [] | package com.darwin.common.utils;
/**
* @类描述:solr查询工具类
* @项目名称:MySolr
* @包名: com.darwin.common.utils
* @类名称:SolrUtils
* @创建人:WangDong
* @创建时间:2018年7月23日上午2:28:03
* @修改人:WangDong
* @修改时间:2018年7月23日上午2:28:03
* @修改备注:
* @version v1.0
* @see
* @bug
* @Copyright
* @mail *@<EMAIL>
*/
public class SolrUtils {
}
| 434 | 0.630769 | 0.550769 | 22 | 13.772727 | 10.090193 | 32 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.045455 | false | false | 15 |
67495c7fe2d56217e401e2a92ade273e2d967bcb | 29,042,568,908,691 | 1d901790f236b49831964975cd7035170f9764de | /app/src/main/java/com/ecole/heuresuppl/MainActivity.java | e842a1008a7397686ba4d7e808a43507d600ec50 | [] | no_license | Iando24/android | https://github.com/Iando24/android | 6ed6cb2d9f620753bc40cfd456ca91f52ecb744c | 09afbccad5a2ecfeeef1a69d52b26b76e183140e | refs/heads/master | 2023-05-01T23:41:55.694000 | 2021-05-06T12:09:36 | 2021-05-06T12:09:36 | 364,894,547 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ecole.heuresuppl;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button professeur_btn = (Button)findViewById(R.id.professeur_btn);
Button matiere_btn = (Button)findViewById(R.id.matiere_btn);
Button volumehoraire = (Button)findViewById(R.id.volumehoraire_btn3);
Button heureComp = (Button)findViewById(R.id.heureComp);
professeur_btn.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
professeurActivity();
}
});
matiere_btn.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
matiereActivity();
}
});
volumehoraire.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
volumehoraireActivity();
}
});
heureComp.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
try {
heurCompActivity();
} catch (ExecutionException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
}
public void professeurActivity(){
Intent intent = new Intent(this, professeur_activity.class);
startActivity(intent);
}
public void matiereActivity(){
Intent intent = new Intent(this, MatiereActivity.class);
startActivity(intent);
}
public void volumehoraireActivity(){
Intent intent = new Intent(this, VolumehoraireActivity.class);
startActivity(intent);
}
public void heurCompActivity() throws ExecutionException, InterruptedException {
Intent intent = new Intent(this, HeureCompActivity.class);
HeureComple h = new HeureComple();
String heurecomm = h.execute().get();
intent.putExtra("heurecomp",heurecomm);
startActivity(intent);
}
private class HeureComple extends AsyncTask<Void, Void, String> {
OkHttpClient client = new OkHttpClient();
String ress = null;
@Override
protected String doInBackground(Void... voids) {
Request request = new Request.Builder()
.url("http://10.0.2.2/volumehoraire/")
.build();
try {
Response response = client.newCall(request).execute();
ress = response.body().string();
} catch (IOException e) {
e.printStackTrace();
}
return ress;
}
}
} | UTF-8 | Java | 3,307 | java | MainActivity.java | Java | [] | null | [] | package com.ecole.heuresuppl;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button professeur_btn = (Button)findViewById(R.id.professeur_btn);
Button matiere_btn = (Button)findViewById(R.id.matiere_btn);
Button volumehoraire = (Button)findViewById(R.id.volumehoraire_btn3);
Button heureComp = (Button)findViewById(R.id.heureComp);
professeur_btn.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
professeurActivity();
}
});
matiere_btn.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
matiereActivity();
}
});
volumehoraire.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
volumehoraireActivity();
}
});
heureComp.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
try {
heurCompActivity();
} catch (ExecutionException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
}
public void professeurActivity(){
Intent intent = new Intent(this, professeur_activity.class);
startActivity(intent);
}
public void matiereActivity(){
Intent intent = new Intent(this, MatiereActivity.class);
startActivity(intent);
}
public void volumehoraireActivity(){
Intent intent = new Intent(this, VolumehoraireActivity.class);
startActivity(intent);
}
public void heurCompActivity() throws ExecutionException, InterruptedException {
Intent intent = new Intent(this, HeureCompActivity.class);
HeureComple h = new HeureComple();
String heurecomm = h.execute().get();
intent.putExtra("heurecomp",heurecomm);
startActivity(intent);
}
private class HeureComple extends AsyncTask<Void, Void, String> {
OkHttpClient client = new OkHttpClient();
String ress = null;
@Override
protected String doInBackground(Void... voids) {
Request request = new Request.Builder()
.url("http://10.0.2.2/volumehoraire/")
.build();
try {
Response response = client.newCall(request).execute();
ress = response.body().string();
} catch (IOException e) {
e.printStackTrace();
}
return ress;
}
}
} | 3,307 | 0.600242 | 0.59752 | 115 | 27.765217 | 23.455168 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.469565 | false | false | 15 |
c6b3134bcfaf24a5dfc5433ffb84f1d25c8e0e41 | 27,762,668,661,408 | 6ebd3c4133370be3015c1787cbad196a4f06ecbf | /src/com/nhpcc506/lion/client/MsgSenderThread.java | d69b899549a14aea61245628ef70b60a3f2cef64 | [] | no_license | zhaocong89/Lion | https://github.com/zhaocong89/Lion | 5811e56b999a3956ce62eefdd4925bb0aa332369 | 5516f66404ecb03ca1866b42986a9b4a4110b9ac | refs/heads/master | 2016-08-07T12:41:14.421000 | 2013-05-22T03:19:54 | 2013-05-22T03:19:54 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.nhpcc506.lion.client;
import java.util.concurrent.LinkedBlockingQueue;
import com.nhpcc506.lion.network.ClientTransceiver;
public class MsgSenderThread extends Thread {
static private MsgSenderThread instance;
private LinkedBlockingQueue<Object> msgQueue;
static public MsgSenderThread GetInstance(LinkedBlockingQueue<Object> msgQueue){
if(instance == null){
instance = new MsgSenderThread(msgQueue);
}
return instance;
}
private MsgSenderThread(LinkedBlockingQueue<Object> msgQueue){
this.msgQueue = msgQueue;
}
@Override
public void run(){
while(true){
try{
Object msg = msgQueue.take();
if(msg instanceof StopThreadFlag){
break;
}
ClientTransceiver transceiver = ClientTransceiver.GetInstance();
transceiver.send(msg);
}
catch(InterruptedException e){
e.printStackTrace();
}
}
}
}
| UTF-8 | Java | 870 | java | MsgSenderThread.java | Java | [] | null | [] | package com.nhpcc506.lion.client;
import java.util.concurrent.LinkedBlockingQueue;
import com.nhpcc506.lion.network.ClientTransceiver;
public class MsgSenderThread extends Thread {
static private MsgSenderThread instance;
private LinkedBlockingQueue<Object> msgQueue;
static public MsgSenderThread GetInstance(LinkedBlockingQueue<Object> msgQueue){
if(instance == null){
instance = new MsgSenderThread(msgQueue);
}
return instance;
}
private MsgSenderThread(LinkedBlockingQueue<Object> msgQueue){
this.msgQueue = msgQueue;
}
@Override
public void run(){
while(true){
try{
Object msg = msgQueue.take();
if(msg instanceof StopThreadFlag){
break;
}
ClientTransceiver transceiver = ClientTransceiver.GetInstance();
transceiver.send(msg);
}
catch(InterruptedException e){
e.printStackTrace();
}
}
}
}
| 870 | 0.73908 | 0.732184 | 38 | 21.894737 | 21.802691 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.131579 | false | false | 15 |
686984f90ab995dfb975a863a93e6908c8ee8684 | 14,259,291,476,388 | b1f230d197780b5f1b2f42feded4998fa56a46fc | /src/me/assist/lazertag/game/StopReason.java | 2cd7306c91d77b3e697e1a29c423717ffc0aa0ca | [] | no_license | PZTeam/LazerTag | https://github.com/PZTeam/LazerTag | 3cb9476e1125cdc68bd2e049931b73b174dcfe08 | 1160dcffe70b16545a708cff0308ac163b846267 | refs/heads/master | 2016-09-05T18:59:46.394000 | 2014-04-01T11:57:19 | 2014-04-01T11:57:19 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package me.assist.lazertag.game;
public enum StopReason {
SCORE_LIMIT_REACHED,
TIME_LIMIT_REACHED,
FORCE;
}
| UTF-8 | Java | 121 | java | StopReason.java | Java | [] | null | [] | package me.assist.lazertag.game;
public enum StopReason {
SCORE_LIMIT_REACHED,
TIME_LIMIT_REACHED,
FORCE;
}
| 121 | 0.702479 | 0.702479 | 8 | 13.125 | 11.794464 | 32 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.875 | false | false | 15 |
c9dbe0eb3ad3dc6b5cd6d74610f6bac90de1e36f | 5,394,478,988,991 | 7a00040801bd9cc80494794991549c39990fc672 | /src/main/java/알고리즘스터디/베스트앨범.java | 4ec3212908af2de84451c356f1936a67b310142b | [] | no_license | gisungPark/Algorithm-study | https://github.com/gisungPark/Algorithm-study | 9d5ff7ca1561de4b485474de28bc135fecb2e72b | b237ee1bc7f11e8019619740882d34aba3f03fb8 | refs/heads/master | 2023-09-01T21:55:12.891000 | 2021-10-06T12:33:08 | 2021-10-06T12:33:08 | 320,826,615 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package 알고리즘스터디;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeSet;
public class 베스트앨범 {
public static class Song implements Comparable<Song> {
int seq; // 고유번호
int plays; // 플레이 횟수
public Song(int seq, int plays) {
this.seq = seq;
this.plays = plays;
}
@Override
public int compareTo(Song o) {
if(this.plays == o.plays) return this.seq - o.seq;
else return o.plays - this.plays;
}
}
public static int[] solution(String[] genres, int[] plays) {
Map<String, Integer> playByGenre = new HashMap<>(); // <장르, 장르별 플레이 횟수>
Map<String, List<Song>> map = new HashMap<>(); // <장르, 해당 장르별 곡 정보(List)>
List<Song> list = null;
// 1. 장르별로 플레이 횟수를 계산
for(int i=0; i<genres.length; i++){
// 해당 장르가 map에 없다면,
if(!playByGenre.containsKey(genres[i])){
playByGenre.put(genres[i], plays[i]); // 장르별 플레이 횟수
// 2. 해당장르별 곡 정보를 List를 이용해 관리
list = new ArrayList<>();
list.add(new Song(i, plays[i]));
map.put(genres[i], list);
}else{
int cnt = playByGenre.get(genres[i]);
playByGenre.put(genres[i], cnt+plays[i]);
list = map.get(genres[i]);
list.add(new Song(i, plays[i]));
}
}
// Map에 저장된 장르별 플레이횟수를
// 내림차순 정렬하기 위해 TreeSet 자료구조 선언
TreeSet<Integer> set = new TreeSet<>(new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
return o2-o1;
}
});
for(Integer i: playByGenre.values()) {
set.add(i);
}
// 베스트 앨범 정보를 저장한 ans List
List<Integer> ans = new ArrayList<>();
for(Integer i: set) {
// 3. TreeSet에서 내림차순으로 뽑힌 장르의
// 곡정보를 찾는다.
for(String genre : playByGenre.keySet()) {
if(playByGenre.get(genre) == i) {
list = map.get(genre);
Collections.sort(list);
// 4. 해당 장르 곡정보가 2개 미만이라면, 하나만 베스트 앨범에 담는다.
if(list.size()>1) {
ans.add(list.get(0).seq);
ans.add(list.get(1).seq);
}else {
ans.add(list.get(0).seq);
}
}
}
}
int[] answer = new int[ans.size()];
for(int i=0; i<ans.size(); i++) {
answer[i] = ans.get(i);
}
return answer;
}
public static void main(String[] args) {
int[] ans = solution(
new String[] {"classic", "pop", "classic", "classic", "pop"},
new int[] {500,600,150,800,2500}
);
for(int i : ans) {
System.out.println(i);
}
}
}
| UTF-8 | Java | 3,264 | java | 베스트앨범.java | Java | [] | null | [] | package 알고리즘스터디;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeSet;
public class 베스트앨범 {
public static class Song implements Comparable<Song> {
int seq; // 고유번호
int plays; // 플레이 횟수
public Song(int seq, int plays) {
this.seq = seq;
this.plays = plays;
}
@Override
public int compareTo(Song o) {
if(this.plays == o.plays) return this.seq - o.seq;
else return o.plays - this.plays;
}
}
public static int[] solution(String[] genres, int[] plays) {
Map<String, Integer> playByGenre = new HashMap<>(); // <장르, 장르별 플레이 횟수>
Map<String, List<Song>> map = new HashMap<>(); // <장르, 해당 장르별 곡 정보(List)>
List<Song> list = null;
// 1. 장르별로 플레이 횟수를 계산
for(int i=0; i<genres.length; i++){
// 해당 장르가 map에 없다면,
if(!playByGenre.containsKey(genres[i])){
playByGenre.put(genres[i], plays[i]); // 장르별 플레이 횟수
// 2. 해당장르별 곡 정보를 List를 이용해 관리
list = new ArrayList<>();
list.add(new Song(i, plays[i]));
map.put(genres[i], list);
}else{
int cnt = playByGenre.get(genres[i]);
playByGenre.put(genres[i], cnt+plays[i]);
list = map.get(genres[i]);
list.add(new Song(i, plays[i]));
}
}
// Map에 저장된 장르별 플레이횟수를
// 내림차순 정렬하기 위해 TreeSet 자료구조 선언
TreeSet<Integer> set = new TreeSet<>(new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
return o2-o1;
}
});
for(Integer i: playByGenre.values()) {
set.add(i);
}
// 베스트 앨범 정보를 저장한 ans List
List<Integer> ans = new ArrayList<>();
for(Integer i: set) {
// 3. TreeSet에서 내림차순으로 뽑힌 장르의
// 곡정보를 찾는다.
for(String genre : playByGenre.keySet()) {
if(playByGenre.get(genre) == i) {
list = map.get(genre);
Collections.sort(list);
// 4. 해당 장르 곡정보가 2개 미만이라면, 하나만 베스트 앨범에 담는다.
if(list.size()>1) {
ans.add(list.get(0).seq);
ans.add(list.get(1).seq);
}else {
ans.add(list.get(0).seq);
}
}
}
}
int[] answer = new int[ans.size()];
for(int i=0; i<ans.size(); i++) {
answer[i] = ans.get(i);
}
return answer;
}
public static void main(String[] args) {
int[] ans = solution(
new String[] {"classic", "pop", "classic", "classic", "pop"},
new int[] {500,600,150,800,2500}
);
for(int i : ans) {
System.out.println(i);
}
}
}
| 3,264 | 0.497947 | 0.487337 | 110 | 25.563637 | 19.468168 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.709091 | false | false | 15 |
9a76af3d3b5ffee65171f9a98aa3b5cc3772c0ba | 9,543,417,334,020 | 4327fba73d821aa8e4d150e3411cc3b90e929f16 | /src/main/MIB.java | a333ea8e60517b53fac2d539f78acf36a5fa9077 | [] | no_license | jrmncos/prog2-2s2021 | https://github.com/jrmncos/prog2-2s2021 | 4ca393e130f2d0086ce859cb6345ca05f72cf31b | 474491cf5071fc4635cb4aae86a3e94d725a4b81 | refs/heads/main | 2023-08-24T00:15:30.577000 | 2021-11-02T14:59:17 | 2021-11-02T14:59:17 | 402,466,612 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package main;
import java.util.HashSet;
public class MIB{
private HashSet<Coordenada> _valoresT;
public boolean leer(int i, int j) {
return _valoresT.contains(new Coordenada(i,j));
}
public void escribir(int i, int j, boolean valor){
if(leer(i, j)) {
if(!valor){
_valoresT.remove(new Coordenada(i,j));
}
}
else {
if(valor)
_valoresT.add(new Coordenada(i,j));
}
}
}
//Estructura de datos inicial, no funciona
//private Boolean [][] mat;
//
//estrategia: almacenar solo los valores definidos/ o verdaderos
//¿que hacemos si nos preguntan un valor no definido?
// si almaceno todo
//Map<<Coordenada>, Boolean>
//// si almaceno solo los T
//HashSet<Coordenada>
// Coordenada deberia implementar la funcion de hash
//ArrayList<Coordenada> y controlan la repeticion a mano, vamos bien
//MIB m = new MIB(44444,2000)
//m.escribir(25555552,2555555552,false) // viola el irep
//Class MIB
//Int _ancho
//Int _alto
//HashSet<Coordenada> _valoresT
//
//IREP:
//// estamos en rango
//para toda coordenada en _valoreT la coordenada entra en _ancho y _largo
//// todas las coordendas representan valores true
//MIB(int ancho, int alto)
// _ancho = ancho
// _alto = alto
| UTF-8 | Java | 1,222 | java | MIB.java | Java | [] | null | [] | package main;
import java.util.HashSet;
public class MIB{
private HashSet<Coordenada> _valoresT;
public boolean leer(int i, int j) {
return _valoresT.contains(new Coordenada(i,j));
}
public void escribir(int i, int j, boolean valor){
if(leer(i, j)) {
if(!valor){
_valoresT.remove(new Coordenada(i,j));
}
}
else {
if(valor)
_valoresT.add(new Coordenada(i,j));
}
}
}
//Estructura de datos inicial, no funciona
//private Boolean [][] mat;
//
//estrategia: almacenar solo los valores definidos/ o verdaderos
//¿que hacemos si nos preguntan un valor no definido?
// si almaceno todo
//Map<<Coordenada>, Boolean>
//// si almaceno solo los T
//HashSet<Coordenada>
// Coordenada deberia implementar la funcion de hash
//ArrayList<Coordenada> y controlan la repeticion a mano, vamos bien
//MIB m = new MIB(44444,2000)
//m.escribir(25555552,2555555552,false) // viola el irep
//Class MIB
//Int _ancho
//Int _alto
//HashSet<Coordenada> _valoresT
//
//IREP:
//// estamos en rango
//para toda coordenada en _valoreT la coordenada entra en _ancho y _largo
//// todas las coordendas representan valores true
//MIB(int ancho, int alto)
// _ancho = ancho
// _alto = alto
| 1,222 | 0.681409 | 0.659296 | 60 | 19.216667 | 20.539467 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 15 |
e60db59fe3606ae13956946072f517dadf50de1f | 30,073,361,008,048 | 93af5a984be16dcc66493c252219504e6e186b28 | /src/test/java/utils/MimeTypeTest.java | 05a39a4e3259dcadd510c11c3638355087862380 | [
"MIT"
] | permissive | iamfreee/isel-ls | https://github.com/iamfreee/isel-ls | f3c6f006a5d9804ce36eb7f8be9cd7ad6e84b52b | b04f669f73235b158820154925708ca274fa5572 | refs/heads/master | 2021-01-12T16:53:13.358000 | 2016-10-20T12:44:44 | 2016-10-20T12:44:44 | 71,462,150 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package utils;
import org.junit.Test;
import static org.junit.Assert.*;
public class MimeTypeTest {
@Test
public void testConstructWithoutParameters() {
MimeType mime = new MimeType("text/html");
assertEquals("text", mime.getType());
assertEquals("html", mime.getSubType());
assertTrue(mime.getParams().isEmpty());
}
@Test
public void testConstructWithParameters() {
MimeType mime = new MimeType("text/html;q=0.8");
assertEquals("text", mime.getType());
assertEquals("html", mime.getSubType());
assertFalse(mime.getParams().isEmpty());
assertEquals("0.8", mime.getParam("q"));
}
@Test
public void testEqualsWithTwoValidMimes() throws Exception {
MimeType mime = new MimeType("text/html;q=0.8");
MimeType mime2 = new MimeType("text/html;q=0.1");
assertTrue( mime.equals(mime2) );
}
@Test
public void testEqualsWithTwoInValidMimes() throws Exception {
MimeType mime = new MimeType("text/plain");
MimeType mime2 = new MimeType("text/html;q=0.1");
assertFalse( mime.equals(mime2) );
}
@Test
public void testEqualsWithTwoValidMimesOneIsString() throws Exception {
MimeType mime = new MimeType("text/plain");
assertTrue( mime.equals("text/plain") );
}
} | UTF-8 | Java | 1,357 | java | MimeTypeTest.java | Java | [] | null | [] | package utils;
import org.junit.Test;
import static org.junit.Assert.*;
public class MimeTypeTest {
@Test
public void testConstructWithoutParameters() {
MimeType mime = new MimeType("text/html");
assertEquals("text", mime.getType());
assertEquals("html", mime.getSubType());
assertTrue(mime.getParams().isEmpty());
}
@Test
public void testConstructWithParameters() {
MimeType mime = new MimeType("text/html;q=0.8");
assertEquals("text", mime.getType());
assertEquals("html", mime.getSubType());
assertFalse(mime.getParams().isEmpty());
assertEquals("0.8", mime.getParam("q"));
}
@Test
public void testEqualsWithTwoValidMimes() throws Exception {
MimeType mime = new MimeType("text/html;q=0.8");
MimeType mime2 = new MimeType("text/html;q=0.1");
assertTrue( mime.equals(mime2) );
}
@Test
public void testEqualsWithTwoInValidMimes() throws Exception {
MimeType mime = new MimeType("text/plain");
MimeType mime2 = new MimeType("text/html;q=0.1");
assertFalse( mime.equals(mime2) );
}
@Test
public void testEqualsWithTwoValidMimesOneIsString() throws Exception {
MimeType mime = new MimeType("text/plain");
assertTrue( mime.equals("text/plain") );
}
} | 1,357 | 0.633751 | 0.623434 | 51 | 25.627451 | 24.259998 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.568627 | false | false | 15 |
cf5e61e4436862ad8530b07df5e94b1ab5b4d115 | 8,254,927,147,827 | abe3bb3c9ef27be92a54f1880800daae71a27f67 | /src/main/java/com/denismo/jackrabbit/oak/dynamodb/NodeStore.java | 93434ac1268b5d3f44a2375bdf612d2ce902a7c1 | [] | no_license | denismo/dynamodb-node-store | https://github.com/denismo/dynamodb-node-store | 657f6e4ce305563f1f93857f3560dd03337a36d3 | 36d999631ed85c956c5b20250e183648b79f13d0 | refs/heads/master | 2020-04-07T11:41:03.190000 | 2014-11-12T12:08:41 | 2014-11-12T12:08:41 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.denismo.jackrabbit.oak.dynamodb;
import org.apache.jackrabbit.oak.api.Blob;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.spi.commit.CommitHook;
import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import org.apache.jackrabbit.oak.spi.state.NodeState;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.io.InputStream;
/**
* User: Denis Mikhalkin
* Date: 12/11/2014
* Time: 11:00 PM
*/
public class NodeStore implements org.apache.jackrabbit.oak.spi.state.NodeStore {
@Nonnull
@Override
public NodeState getRoot() {
return null;
}
@Nonnull
@Override
public NodeState merge(@Nonnull NodeBuilder nodeBuilder, @Nonnull CommitHook commitHook, @Nonnull CommitInfo commitInfo) throws CommitFailedException {
return null;
}
@Nonnull
@Override
public NodeState rebase(@Nonnull NodeBuilder nodeBuilder) {
return null;
}
@Override
public NodeState reset(@Nonnull NodeBuilder nodeBuilder) {
return null;
}
@Nonnull
@Override
public Blob createBlob(InputStream inputStream) throws IOException {
return null;
}
@Override
public Blob getBlob(@Nonnull String s) {
return null;
}
@Nonnull
@Override
public String checkpoint(long l) {
return null;
}
@Override
public NodeState retrieve(@Nonnull String s) {
return null;
}
@Override
public boolean release(@Nonnull String s) {
return false;
}
}
| UTF-8 | Java | 1,632 | java | NodeStore.java | Java | [
{
"context": "ception;\nimport java.io.InputStream;\n\n/**\n * User: Denis Mikhalkin\n * Date: 12/11/2014\n * Time: 11:00 PM\n */\npublic ",
"end": 490,
"score": 0.9998801350593567,
"start": 475,
"tag": "NAME",
"value": "Denis Mikhalkin"
}
] | null | [] | package com.denismo.jackrabbit.oak.dynamodb;
import org.apache.jackrabbit.oak.api.Blob;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.spi.commit.CommitHook;
import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import org.apache.jackrabbit.oak.spi.state.NodeState;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.io.InputStream;
/**
* User: <NAME>
* Date: 12/11/2014
* Time: 11:00 PM
*/
public class NodeStore implements org.apache.jackrabbit.oak.spi.state.NodeStore {
@Nonnull
@Override
public NodeState getRoot() {
return null;
}
@Nonnull
@Override
public NodeState merge(@Nonnull NodeBuilder nodeBuilder, @Nonnull CommitHook commitHook, @Nonnull CommitInfo commitInfo) throws CommitFailedException {
return null;
}
@Nonnull
@Override
public NodeState rebase(@Nonnull NodeBuilder nodeBuilder) {
return null;
}
@Override
public NodeState reset(@Nonnull NodeBuilder nodeBuilder) {
return null;
}
@Nonnull
@Override
public Blob createBlob(InputStream inputStream) throws IOException {
return null;
}
@Override
public Blob getBlob(@Nonnull String s) {
return null;
}
@Nonnull
@Override
public String checkpoint(long l) {
return null;
}
@Override
public NodeState retrieve(@Nonnull String s) {
return null;
}
@Override
public boolean release(@Nonnull String s) {
return false;
}
}
| 1,623 | 0.693015 | 0.685662 | 69 | 22.652174 | 25.87306 | 155 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.304348 | false | false | 15 |
4e3e79d69f8ed41a3890c345ccfd453eda616bab | 13,821,204,774,512 | b6ab33dc141b1621ef865b5b4038db642d0d8630 | /src/lk/edu/ijse/view/UpdateCourse.java | 0515d0a87931210f744ea04cdcc296c1ac0bdaea | [] | no_license | DulshanKanishka/IJSE-Payroll | https://github.com/DulshanKanishka/IJSE-Payroll | 44a33cbeda4d47c6073de4d551ab2fdb2c19627a | 408e2839c2da3478da3aad0d9f154904d0cd6935 | refs/heads/master | 2020-05-28T09:48:20.183000 | 2019-05-28T05:46:14 | 2019-05-28T05:46:14 | 188,961,410 | 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 lk.edu.ijse.view;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import lk.edu.ijse.controller.ControllerFactory;
import lk.edu.ijse.controller.custom.BatchController;
import lk.edu.ijse.controller.custom.CourseController;
import lk.edu.ijse.dto.BatchDTO;
import lk.edu.ijse.dto.CourseDTO;
/**
*
* @author epc
*/
public class UpdateCourse extends javax.swing.JDialog {
private CourseController courseController;
static String id;
static String name;
static String Duration;
static String TaxRate;
/**
* Creates new form NewJDialog
*/
public UpdateCourse(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
courseController = (CourseController) ControllerFactory.getIntense().getServices(ControllerFactory.getServicesType.COURSE);
setDate();
setTime();
TxtCourseUpdateId.setText("" + id);
TxtCourseUpdateNme.setText("" + name);
TxtCourseUpdateDuration.setText("" + Duration);
TxtCourseUpdateTaxRate.setText("" + TaxRate);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel3 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
HOME_TIME1 = new javax.swing.JLabel();
HOME_TIME = new javax.swing.JLabel();
jPanel5 = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
TxtCourseUpdateId = new javax.swing.JTextField();
TxtCourseUpdateNme = new javax.swing.JTextField();
TxtCourseUpdateDuration = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
TxtCourseUpdateTaxRate = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
jLabel26 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setBackground(java.awt.Color.gray);
jPanel3.setBackground(java.awt.Color.darkGray);
jLabel2.setBackground(new java.awt.Color(255, 255, 255));
jLabel2.setFont(new java.awt.Font("Rockwell Extra Bold", 0, 48)); // NOI18N
jLabel2.setForeground(new java.awt.Color(204, 204, 204));
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel2.setText("UPDATE CORSES");
HOME_TIME1.setFont(new java.awt.Font("sansserif", 0, 36)); // NOI18N
HOME_TIME1.setForeground(new java.awt.Color(255, 255, 255));
HOME_TIME.setFont(new java.awt.Font("sansserif", 0, 36)); // NOI18N
HOME_TIME.setForeground(new java.awt.Color(255, 255, 255));
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(HOME_TIME1, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel2)
.addGap(18, 18, 18)
.addComponent(HOME_TIME, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(209, 209, 209))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(HOME_TIME1, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(HOME_TIME, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel5.setBackground(new java.awt.Color(255, 255, 255));
jPanel5.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel3.setFont(new java.awt.Font("sansserif", 0, 14)); // NOI18N
jLabel3.setText("Corse Id");
jPanel5.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 10, -1, -1));
jLabel6.setFont(new java.awt.Font("sansserif", 0, 14)); // NOI18N
jLabel6.setText("Duration");
jPanel5.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 98, -1, -1));
jLabel8.setFont(new java.awt.Font("sansserif", 0, 14)); // NOI18N
jLabel8.setText("Course Name");
jPanel5.add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 56, -1, -1));
TxtCourseUpdateId.setEditable(false);
TxtCourseUpdateId.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
TxtCourseUpdateIdActionPerformed(evt);
}
});
jPanel5.add(TxtCourseUpdateId, new org.netbeans.lib.awtextra.AbsoluteConstraints(123, 6, 715, -1));
TxtCourseUpdateNme.setMinimumSize(new java.awt.Dimension(6, 30));
jPanel5.add(TxtCourseUpdateNme, new org.netbeans.lib.awtextra.AbsoluteConstraints(123, 52, 715, -1));
TxtCourseUpdateDuration.setMinimumSize(new java.awt.Dimension(6, 30));
jPanel5.add(TxtCourseUpdateDuration, new org.netbeans.lib.awtextra.AbsoluteConstraints(125, 98, 710, -1));
jButton1.setBackground(new java.awt.Color(153, 204, 255));
jButton1.setFont(new java.awt.Font("sansserif", 0, 18)); // NOI18N
jButton1.setText("Cancel");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jPanel5.add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(618, 184, 98, 45));
jButton2.setBackground(new java.awt.Color(153, 204, 255));
jButton2.setFont(new java.awt.Font("sansserif", 0, 18)); // NOI18N
jButton2.setText("Update");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jPanel5.add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(734, 184, 109, 45));
TxtCourseUpdateTaxRate.setMinimumSize(new java.awt.Dimension(6, 30));
jPanel5.add(TxtCourseUpdateTaxRate, new org.netbeans.lib.awtextra.AbsoluteConstraints(125, 144, 710, -1));
jLabel7.setFont(new java.awt.Font("sansserif", 0, 14)); // NOI18N
jLabel7.setText("Tax rate");
jPanel5.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 144, -1, -1));
jLabel26.setIcon(new javax.swing.ImageIcon(getClass().getResource("/lk/edu/ijse/Images/seamless-white-pattern-background-vector-id508007780.jpg"))); // NOI18N
jLabel26.setText("jLabel14");
jPanel5.add(jLabel26, new org.netbeans.lib.awtextra.AbsoluteConstraints(610, 0, 270, 250));
jLabel15.setIcon(new javax.swing.ImageIcon(getClass().getResource("/lk/edu/ijse/Images/seamless-white-pattern-background-vector-id508007780.jpg"))); // NOI18N
jLabel15.setText("jLabel14");
jPanel5.add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 610, 250));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(0, 6, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void TxtCourseUpdateIdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TxtCourseUpdateIdActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_TxtCourseUpdateIdActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
ManageCourse manageCourse = new ManageCourse();
manageCourse.setVisible(true);
this.dispose(); // TODO add your handling code here:
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
try {
CourseDTO course = new CourseDTO(TxtCourseUpdateId.getText(), TxtCourseUpdateNme.getText(), TxtCourseUpdateDuration.getText(), TxtCourseUpdateTaxRate.getText());
System.out.println(course.getCid());
boolean Update = courseController.Update(course);
if (Update) {
JOptionPane.showMessageDialog(null, "Update Ok");
} else {
JOptionPane.showMessageDialog(null, "Not Update");
}
} catch (Exception ex) {
Logger.getLogger(UpdateCourse.class.getName()).log(Level.SEVERE, null, ex);
} // TODO add your handling code here:
}//GEN-LAST:event_jButton2ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(UpdateCourse.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(UpdateCourse.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(UpdateCourse.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(UpdateCourse.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
UpdateCourse dialog = new UpdateCourse(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel HOME_TIME;
private javax.swing.JLabel HOME_TIME1;
private javax.swing.JTextField TxtCourseUpdateDuration;
private javax.swing.JTextField TxtCourseUpdateId;
private javax.swing.JTextField TxtCourseUpdateNme;
private javax.swing.JTextField TxtCourseUpdateTaxRate;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel26;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel5;
// End of variables declaration//GEN-END:variables
private void setTime() {
new Thread(new Runnable() {
@Override
public void run() {
while (true) {
Date date = new Date();
String currentdate = new SimpleDateFormat("hh:mm:aa").format(date);
HOME_TIME.setText(currentdate);
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
}
}
}
}).start();
}
private void setDate() {
Date d = new Date();
SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd");
HOME_TIME1.setText(s.format(d));
}
}
| UTF-8 | Java | 15,253 | java | UpdateCourse.java | Java | [
{
"context": "port lk.edu.ijse.dto.CourseDTO;\n\n/**\n *\n * @author epc\n */\npublic class UpdateCourse extends javax.swing",
"end": 614,
"score": 0.9996446371078491,
"start": 611,
"tag": "USERNAME",
"value": "epc"
}
] | 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 lk.edu.ijse.view;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import lk.edu.ijse.controller.ControllerFactory;
import lk.edu.ijse.controller.custom.BatchController;
import lk.edu.ijse.controller.custom.CourseController;
import lk.edu.ijse.dto.BatchDTO;
import lk.edu.ijse.dto.CourseDTO;
/**
*
* @author epc
*/
public class UpdateCourse extends javax.swing.JDialog {
private CourseController courseController;
static String id;
static String name;
static String Duration;
static String TaxRate;
/**
* Creates new form NewJDialog
*/
public UpdateCourse(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
courseController = (CourseController) ControllerFactory.getIntense().getServices(ControllerFactory.getServicesType.COURSE);
setDate();
setTime();
TxtCourseUpdateId.setText("" + id);
TxtCourseUpdateNme.setText("" + name);
TxtCourseUpdateDuration.setText("" + Duration);
TxtCourseUpdateTaxRate.setText("" + TaxRate);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel3 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
HOME_TIME1 = new javax.swing.JLabel();
HOME_TIME = new javax.swing.JLabel();
jPanel5 = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
TxtCourseUpdateId = new javax.swing.JTextField();
TxtCourseUpdateNme = new javax.swing.JTextField();
TxtCourseUpdateDuration = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
TxtCourseUpdateTaxRate = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
jLabel26 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setBackground(java.awt.Color.gray);
jPanel3.setBackground(java.awt.Color.darkGray);
jLabel2.setBackground(new java.awt.Color(255, 255, 255));
jLabel2.setFont(new java.awt.Font("Rockwell Extra Bold", 0, 48)); // NOI18N
jLabel2.setForeground(new java.awt.Color(204, 204, 204));
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel2.setText("UPDATE CORSES");
HOME_TIME1.setFont(new java.awt.Font("sansserif", 0, 36)); // NOI18N
HOME_TIME1.setForeground(new java.awt.Color(255, 255, 255));
HOME_TIME.setFont(new java.awt.Font("sansserif", 0, 36)); // NOI18N
HOME_TIME.setForeground(new java.awt.Color(255, 255, 255));
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(HOME_TIME1, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel2)
.addGap(18, 18, 18)
.addComponent(HOME_TIME, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(209, 209, 209))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(HOME_TIME1, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(HOME_TIME, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel5.setBackground(new java.awt.Color(255, 255, 255));
jPanel5.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel3.setFont(new java.awt.Font("sansserif", 0, 14)); // NOI18N
jLabel3.setText("Corse Id");
jPanel5.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 10, -1, -1));
jLabel6.setFont(new java.awt.Font("sansserif", 0, 14)); // NOI18N
jLabel6.setText("Duration");
jPanel5.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 98, -1, -1));
jLabel8.setFont(new java.awt.Font("sansserif", 0, 14)); // NOI18N
jLabel8.setText("Course Name");
jPanel5.add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 56, -1, -1));
TxtCourseUpdateId.setEditable(false);
TxtCourseUpdateId.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
TxtCourseUpdateIdActionPerformed(evt);
}
});
jPanel5.add(TxtCourseUpdateId, new org.netbeans.lib.awtextra.AbsoluteConstraints(123, 6, 715, -1));
TxtCourseUpdateNme.setMinimumSize(new java.awt.Dimension(6, 30));
jPanel5.add(TxtCourseUpdateNme, new org.netbeans.lib.awtextra.AbsoluteConstraints(123, 52, 715, -1));
TxtCourseUpdateDuration.setMinimumSize(new java.awt.Dimension(6, 30));
jPanel5.add(TxtCourseUpdateDuration, new org.netbeans.lib.awtextra.AbsoluteConstraints(125, 98, 710, -1));
jButton1.setBackground(new java.awt.Color(153, 204, 255));
jButton1.setFont(new java.awt.Font("sansserif", 0, 18)); // NOI18N
jButton1.setText("Cancel");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jPanel5.add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(618, 184, 98, 45));
jButton2.setBackground(new java.awt.Color(153, 204, 255));
jButton2.setFont(new java.awt.Font("sansserif", 0, 18)); // NOI18N
jButton2.setText("Update");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jPanel5.add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(734, 184, 109, 45));
TxtCourseUpdateTaxRate.setMinimumSize(new java.awt.Dimension(6, 30));
jPanel5.add(TxtCourseUpdateTaxRate, new org.netbeans.lib.awtextra.AbsoluteConstraints(125, 144, 710, -1));
jLabel7.setFont(new java.awt.Font("sansserif", 0, 14)); // NOI18N
jLabel7.setText("Tax rate");
jPanel5.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 144, -1, -1));
jLabel26.setIcon(new javax.swing.ImageIcon(getClass().getResource("/lk/edu/ijse/Images/seamless-white-pattern-background-vector-id508007780.jpg"))); // NOI18N
jLabel26.setText("jLabel14");
jPanel5.add(jLabel26, new org.netbeans.lib.awtextra.AbsoluteConstraints(610, 0, 270, 250));
jLabel15.setIcon(new javax.swing.ImageIcon(getClass().getResource("/lk/edu/ijse/Images/seamless-white-pattern-background-vector-id508007780.jpg"))); // NOI18N
jLabel15.setText("jLabel14");
jPanel5.add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 610, 250));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(0, 6, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void TxtCourseUpdateIdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TxtCourseUpdateIdActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_TxtCourseUpdateIdActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
ManageCourse manageCourse = new ManageCourse();
manageCourse.setVisible(true);
this.dispose(); // TODO add your handling code here:
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
try {
CourseDTO course = new CourseDTO(TxtCourseUpdateId.getText(), TxtCourseUpdateNme.getText(), TxtCourseUpdateDuration.getText(), TxtCourseUpdateTaxRate.getText());
System.out.println(course.getCid());
boolean Update = courseController.Update(course);
if (Update) {
JOptionPane.showMessageDialog(null, "Update Ok");
} else {
JOptionPane.showMessageDialog(null, "Not Update");
}
} catch (Exception ex) {
Logger.getLogger(UpdateCourse.class.getName()).log(Level.SEVERE, null, ex);
} // TODO add your handling code here:
}//GEN-LAST:event_jButton2ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(UpdateCourse.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(UpdateCourse.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(UpdateCourse.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(UpdateCourse.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
UpdateCourse dialog = new UpdateCourse(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel HOME_TIME;
private javax.swing.JLabel HOME_TIME1;
private javax.swing.JTextField TxtCourseUpdateDuration;
private javax.swing.JTextField TxtCourseUpdateId;
private javax.swing.JTextField TxtCourseUpdateNme;
private javax.swing.JTextField TxtCourseUpdateTaxRate;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel26;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel5;
// End of variables declaration//GEN-END:variables
private void setTime() {
new Thread(new Runnable() {
@Override
public void run() {
while (true) {
Date date = new Date();
String currentdate = new SimpleDateFormat("hh:mm:aa").format(date);
HOME_TIME.setText(currentdate);
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
}
}
}
}).start();
}
private void setDate() {
Date d = new Date();
SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd");
HOME_TIME1.setText(s.format(d));
}
}
| 15,253 | 0.658756 | 0.633384 | 319 | 46.815048 | 36.267902 | 173 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.918495 | false | false | 15 |
e98f155624329e534656d78bfdfabba9ee40b34f | 20,650,202,796,453 | eaba39dc7b2a63e2a28f1fcb605635e7b3fa9e35 | /EncodeandDecodeTinyURL/EncodeandDecodeTinyURL.java | e57ca30f769f1878408508252c79fab9ebf39433 | [] | no_license | Yu-Liu666/Leetcode-Questions | https://github.com/Yu-Liu666/Leetcode-Questions | 9fd418897b3a559c385ce3b896b03a485ea1bfc5 | bea40c25751952dae7b8f9c5a7fd266d97a4290d | refs/heads/master | 2020-04-06T08:55:41.507000 | 2018-11-13T04:57:51 | 2018-11-13T04:57:51 | 157,322,115 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package EncodeandDecodeTinyURL;
import java.util.HashMap;
public class EncodeandDecodeTinyURL {
// Encodes a URL to a shortened URL.
HashMap<String,String> map1=new HashMap<>();
HashMap<String,String> map2=new HashMap<>();
int index=0;
public String encode(String longUrl) {
map1.put(longUrl,index+"");
map2.put(index+"",longUrl);
index++;
return index-1+"";
}
// Decodes a shortened URL to its original URL.
public String decode(String shortUrl) {
return map2.get(shortUrl);
}
}
| UTF-8 | Java | 547 | java | EncodeandDecodeTinyURL.java | Java | [] | null | [] | package EncodeandDecodeTinyURL;
import java.util.HashMap;
public class EncodeandDecodeTinyURL {
// Encodes a URL to a shortened URL.
HashMap<String,String> map1=new HashMap<>();
HashMap<String,String> map2=new HashMap<>();
int index=0;
public String encode(String longUrl) {
map1.put(longUrl,index+"");
map2.put(index+"",longUrl);
index++;
return index-1+"";
}
// Decodes a shortened URL to its original URL.
public String decode(String shortUrl) {
return map2.get(shortUrl);
}
}
| 547 | 0.656307 | 0.64351 | 22 | 23.863636 | 17.617903 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.772727 | false | false | 15 |
978763d9b29f226a684921b5272b812cbdb5bf8e | 20,650,202,794,942 | d3a7f181dceddf9a4bf473912527cb196ab178f9 | /java practise/my java/src/practiseproblems/PerfectNumber.java | 7608ddbc0ee1d9c4e0b827ea8745ef05292cb0fa | [] | no_license | karthik-0909/myrepo | https://github.com/karthik-0909/myrepo | 06126c6bc81b27174a4051b231bcc14d78da20f7 | 5892089627d47303faa8a517a3ad87e82bee5379 | refs/heads/master | 2023-07-10T11:23:44.465000 | 2021-08-23T16:49:49 | 2021-08-23T16:49:49 | 390,661,834 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package practiseproblems;
import java.util.Scanner;
public class PerfectNumber {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int N=sc.nextInt();
System.out.println(CheckIfPerfect(N));
}
public static boolean CheckIfPerfect(int N) {
int sum=0;
boolean b=false;
for (int i=1;i<N;i++) {
if (N%i==0)
sum+=i;
}
if(sum==N)
b=true;
return b;
}
}
//page2 | UTF-8 | Java | 412 | java | PerfectNumber.java | Java | [] | null | [] | package practiseproblems;
import java.util.Scanner;
public class PerfectNumber {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int N=sc.nextInt();
System.out.println(CheckIfPerfect(N));
}
public static boolean CheckIfPerfect(int N) {
int sum=0;
boolean b=false;
for (int i=1;i<N;i++) {
if (N%i==0)
sum+=i;
}
if(sum==N)
b=true;
return b;
}
}
//page2 | 412 | 0.652913 | 0.643204 | 23 | 16.956522 | 13.826497 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.869565 | false | false | 15 |
a2831a5e1c9899b4d68c0cca6d89ae9d5f33deeb | 10,763,188,093,979 | 56ac1ccdabe763118e0066d5024f35af821a85db | /Training/URI/categoria-Iniciante/java/1789.java | aee84e95336ab311ec224bb9d374635b568319fb | [] | no_license | lucioleandro/Maratona-de-Programacao | https://github.com/lucioleandro/Maratona-de-Programacao | 5508fe464d99ede67bdb0ccbf82ef24fd960dc4c | 5b24b02385786d763c4f6034adb6758f5b7820ef | refs/heads/master | 2022-01-11T19:10:43.204000 | 2019-05-28T00:27:55 | 2019-05-28T00:27:55 | 103,598,372 | 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 scanner = new Scanner(System.in);
int qtdCasos;
int n = 0;
int aux;
while(scanner.hasNext()) {
qtdCasos = scanner.nextInt();
for(int i = 0; i < qtdCasos; i++) {
aux = scanner.nextInt();
if(aux > n) {
n = aux;
}
}
if(n < 10) {
System.out.println("1");
} else if( n >= 10 && n < 20) {
System.out.println("2");
} else {
System.out.println("3");
}
n = 0;
}
}
}
| UTF-8 | Java | 527 | java | 1789.java | Java | [] | null | [] |
import java.util.Scanner;;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int qtdCasos;
int n = 0;
int aux;
while(scanner.hasNext()) {
qtdCasos = scanner.nextInt();
for(int i = 0; i < qtdCasos; i++) {
aux = scanner.nextInt();
if(aux > n) {
n = aux;
}
}
if(n < 10) {
System.out.println("1");
} else if( n >= 10 && n < 20) {
System.out.println("2");
} else {
System.out.println("3");
}
n = 0;
}
}
}
| 527 | 0.531309 | 0.508539 | 32 | 15.4375 | 13.589834 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.5625 | false | false | 15 |
9d6f6b519810baae714df7fd5b51d84c5a6a1a0a | 10,763,188,093,897 | e4d336c7ba393d83d63116fbfadf27616918c516 | /app/src/main/java/com/gzrijing/workassistant/adapter/SafetyInspectTaskAdapter.java | cb54e363ad61a1b5c14d3cc209d786ada6934a99 | [] | no_license | GZRJ2525/WorkAssistant | https://github.com/GZRJ2525/WorkAssistant | fea81b415fc7b2fd28ed2d9f06b3dd5afcebe1cc | c60c86e23d79c6301b78b5743b41a57101c80407 | refs/heads/master | 2021-01-01T05:28:05.602000 | 2016-05-16T03:58:45 | 2016-05-16T03:58:45 | 56,556,292 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gzrijing.workassistant.adapter;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.TextView;
import com.gzrijing.workassistant.R;
import com.gzrijing.workassistant.entity.SafetyInspectTask;
import com.gzrijing.workassistant.view.SafetyInspectFormActivity;
import com.gzrijing.workassistant.view.SafetyInspectHistoryRecordActivity;
import com.gzrijing.workassistant.view.SafetyInspectHistoryRecordItemActivity;
import com.gzrijing.workassistant.view.SafetyInspectMapActivity;
import com.gzrijing.workassistant.view.SafetyInspectRecordActivity;
import com.gzrijing.workassistant.view.SafetyInspectUploadImageActivity;
import java.util.ArrayList;
public class SafetyInspectTaskAdapter extends BaseAdapter {
private Context context;
private LayoutInflater listContainer;
private ArrayList<SafetyInspectTask> list;
public SafetyInspectTaskAdapter(Context context, ArrayList<SafetyInspectTask> list) {
this.context = context;
listContainer = LayoutInflater.from(context);
this.list = list;
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int position) {
return list.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder v = null;
if (convertView == null) {
v = new ViewHolder();
convertView = listContainer.inflate(
R.layout.listview_item_safety_inspect_task, parent, false);
v.id = (TextView) convertView.findViewById(R.id.listview_item_safety_inspect_task_id_tv);
v.name = (TextView) convertView.findViewById(R.id.listview_item_safety_inspect_task_name_tv);
v.type = (TextView) convertView.findViewById(R.id.listview_item_safety_inspect_task_type_tv);
v.inspect = (Button) convertView.findViewById(R.id.listview_item_safety_inspect_task_inspect_btn);
v.location = (Button) convertView.findViewById(R.id.listview_item_safety_inspect_task_location_btn);
v.record = (Button) convertView.findViewById(R.id.listview_item_safety_inspect_task_record_btn);
v.upload = (Button) convertView.findViewById(R.id.listview_item_safety_inspect_task_upload_pic_btn);
v.historyRecord = (Button) convertView.findViewById(R.id.listview_item_safety_inspect_task_history_record_btn);
convertView.setTag(v);
} else {
v = (ViewHolder) convertView.getTag();
}
v.id.setText(list.get(position).getId());
v.name.setText(list.get(position).getName());
v.type.setText(list.get(position).getType());
v.inspect.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, SafetyInspectFormActivity.class);
intent.putExtra("orderId", list.get(position).getId());
context.startActivity(intent);
}
});
v.location.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, SafetyInspectMapActivity.class);
intent.putExtra("longitude", list.get(position).getLongitude());
intent.putExtra("latitude", list.get(position).getLatitude());
context.startActivity(intent);
}
});
v.record.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, SafetyInspectRecordActivity.class);
intent.putExtra("orderId", list.get(position).getId());
context.startActivity(intent);
}
});
v.upload.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, SafetyInspectUploadImageActivity.class);
intent.putExtra("orderId", list.get(position).getId());
context.startActivity(intent);
}
});
v.historyRecord.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, SafetyInspectHistoryRecordItemActivity.class);
intent.putExtra("orderId", list.get(position).getId());
context.startActivity(intent);
}
});
return convertView;
}
class ViewHolder {
private TextView id;
private TextView name;
private TextView type;
private Button inspect;
private Button location;
private Button record;
private Button upload;
private Button historyRecord;
}
}
| UTF-8 | Java | 5,230 | java | SafetyInspectTaskAdapter.java | Java | [] | null | [] | package com.gzrijing.workassistant.adapter;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.TextView;
import com.gzrijing.workassistant.R;
import com.gzrijing.workassistant.entity.SafetyInspectTask;
import com.gzrijing.workassistant.view.SafetyInspectFormActivity;
import com.gzrijing.workassistant.view.SafetyInspectHistoryRecordActivity;
import com.gzrijing.workassistant.view.SafetyInspectHistoryRecordItemActivity;
import com.gzrijing.workassistant.view.SafetyInspectMapActivity;
import com.gzrijing.workassistant.view.SafetyInspectRecordActivity;
import com.gzrijing.workassistant.view.SafetyInspectUploadImageActivity;
import java.util.ArrayList;
public class SafetyInspectTaskAdapter extends BaseAdapter {
private Context context;
private LayoutInflater listContainer;
private ArrayList<SafetyInspectTask> list;
public SafetyInspectTaskAdapter(Context context, ArrayList<SafetyInspectTask> list) {
this.context = context;
listContainer = LayoutInflater.from(context);
this.list = list;
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int position) {
return list.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder v = null;
if (convertView == null) {
v = new ViewHolder();
convertView = listContainer.inflate(
R.layout.listview_item_safety_inspect_task, parent, false);
v.id = (TextView) convertView.findViewById(R.id.listview_item_safety_inspect_task_id_tv);
v.name = (TextView) convertView.findViewById(R.id.listview_item_safety_inspect_task_name_tv);
v.type = (TextView) convertView.findViewById(R.id.listview_item_safety_inspect_task_type_tv);
v.inspect = (Button) convertView.findViewById(R.id.listview_item_safety_inspect_task_inspect_btn);
v.location = (Button) convertView.findViewById(R.id.listview_item_safety_inspect_task_location_btn);
v.record = (Button) convertView.findViewById(R.id.listview_item_safety_inspect_task_record_btn);
v.upload = (Button) convertView.findViewById(R.id.listview_item_safety_inspect_task_upload_pic_btn);
v.historyRecord = (Button) convertView.findViewById(R.id.listview_item_safety_inspect_task_history_record_btn);
convertView.setTag(v);
} else {
v = (ViewHolder) convertView.getTag();
}
v.id.setText(list.get(position).getId());
v.name.setText(list.get(position).getName());
v.type.setText(list.get(position).getType());
v.inspect.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, SafetyInspectFormActivity.class);
intent.putExtra("orderId", list.get(position).getId());
context.startActivity(intent);
}
});
v.location.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, SafetyInspectMapActivity.class);
intent.putExtra("longitude", list.get(position).getLongitude());
intent.putExtra("latitude", list.get(position).getLatitude());
context.startActivity(intent);
}
});
v.record.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, SafetyInspectRecordActivity.class);
intent.putExtra("orderId", list.get(position).getId());
context.startActivity(intent);
}
});
v.upload.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, SafetyInspectUploadImageActivity.class);
intent.putExtra("orderId", list.get(position).getId());
context.startActivity(intent);
}
});
v.historyRecord.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, SafetyInspectHistoryRecordItemActivity.class);
intent.putExtra("orderId", list.get(position).getId());
context.startActivity(intent);
}
});
return convertView;
}
class ViewHolder {
private TextView id;
private TextView name;
private TextView type;
private Button inspect;
private Button location;
private Button record;
private Button upload;
private Button historyRecord;
}
}
| 5,230 | 0.657361 | 0.657361 | 133 | 38.323307 | 31.173912 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.669173 | false | false | 15 |
67aee3331dde27f35e09f3e9912419bad3f3f13e | 7,121,055,839,230 | 5d77864a8ebea927b1b8f92711e21aa6fb448c57 | /src/main/java/pl/craftgames/communityplugin/cdtp/scoreboard/SidebarData.java | bdaab562f99320dd918ebde65ea4f3664f1025a3 | [
"Apache-2.0"
] | permissive | grzegorz2047/CommunityDrivenPlugin | https://github.com/grzegorz2047/CommunityDrivenPlugin | 0c03c7f5d93747af7f23466f8ce9d1120621a697 | d9bc6ac76f1fa60c943e173acab8aa3c0f302bed | refs/heads/master | 2020-12-31T05:24:16.731000 | 2017-03-26T09:46:14 | 2017-03-26T09:46:14 | 56,437,961 | 2 | 1 | null | false | 2016-04-25T21:58:43 | 2016-04-17T13:30:48 | 2016-04-17T13:54:31 | 2016-04-25T21:58:42 | 77 | 0 | 1 | 2 | Java | null | null | package pl.craftgames.communityplugin.cdtp.scoreboard;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.*;
import pl.craftgames.communityplugin.cdtp.CDTP;
import pl.craftgames.communityplugin.cdtp.user.User;
/**
* Created by s416045 on 2016-04-19.
*/
public class SidebarData {
private final CDTP plugin;
private String killLabel = "§7Zabojstwa:§6§l";
private String deathLabel = "§7Smierci:§6§l";
private String moneyLabel = "§7Monety:§6§l";
private String logoutLabel = "§7§lLogout§7§l:";
public SidebarData(CDTP plugin) {
this.plugin = plugin;
}
public void createScoreboard(Player p) {
Scoreboard scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
Objective objective = scoreboard.registerNewObjective("sidebar", "dummy");
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
objective.setDisplayName("§6» §6§lSandbox §6«");
Objective healthObj = scoreboard.registerNewObjective("showhealth", "health");
healthObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
healthObj.setDisplayName(" §c❤");
p.setHealth(p.getHealth());
User user = plugin.getUserManager().getUsersstats().get(p.getName());
addEntry(scoreboard, objective, logoutLabel, "§a§l✔", 6);
addEntry(scoreboard, objective, "", "", 5);
addEntry(scoreboard, objective, killLabel, user.getKills(), 4);
addEntry(scoreboard, objective, deathLabel, user.getDeaths(), 3);
addEntry(scoreboard, objective, moneyLabel, user.getMoney(), 2);
p.setScoreboard(scoreboard);
}
public void refreshScoreboard(Player p) {
User user = plugin.getUserManager().getUsersstats().get(p.getName());
Scoreboard scoreboard = p.getScoreboard();
String canLogout = user.canLogout() ? "§a§l✔" : "§c✖";
updateEntry(scoreboard, logoutLabel, canLogout);
updateEntry(scoreboard, deathLabel, user.getDeaths());
updateEntry(scoreboard, killLabel, user.getKills());
updateEntry(scoreboard, moneyLabel, user.getMoney());
p.setScoreboard(scoreboard);
}
private void addEntry(Scoreboard scoreboard, Objective objective, String name, String value, int position) {
Team t = scoreboard.registerNewTeam(name);
t.addEntry(name);
t.setSuffix(" " + value);
Score score = objective.getScore(name);
score.setScore(position);
}
private void addEntry(Scoreboard scoreboard, Objective objective, String name, int value, int position) {
Team t = scoreboard.registerNewTeam(name);
t.addEntry(name);
t.setSuffix(" " + value);
Score score = objective.getScore(name);
score.setScore(position);
}
private void updateEntry(Scoreboard scoreboard, String name, int value) {
Team t = scoreboard.getTeam(name);
t.setSuffix(" " + value);
}
private void updateEntry(Scoreboard scoreboard, String name, String value) {
Team t = scoreboard.getTeam(name);
t.setSuffix(" " + value);
}
}
| UTF-8 | Java | 3,151 | java | SidebarData.java | Java | [
{
"context": "communityplugin.cdtp.user.User;\n\n/**\n * Created by s416045 on 2016-04-19.\n */\npublic class SidebarData {\n\n ",
"end": 274,
"score": 0.9994176030158997,
"start": 267,
"tag": "USERNAME",
"value": "s416045"
}
] | null | [] | package pl.craftgames.communityplugin.cdtp.scoreboard;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.*;
import pl.craftgames.communityplugin.cdtp.CDTP;
import pl.craftgames.communityplugin.cdtp.user.User;
/**
* Created by s416045 on 2016-04-19.
*/
public class SidebarData {
private final CDTP plugin;
private String killLabel = "§7Zabojstwa:§6§l";
private String deathLabel = "§7Smierci:§6§l";
private String moneyLabel = "§7Monety:§6§l";
private String logoutLabel = "§7§lLogout§7§l:";
public SidebarData(CDTP plugin) {
this.plugin = plugin;
}
public void createScoreboard(Player p) {
Scoreboard scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
Objective objective = scoreboard.registerNewObjective("sidebar", "dummy");
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
objective.setDisplayName("§6» §6§lSandbox §6«");
Objective healthObj = scoreboard.registerNewObjective("showhealth", "health");
healthObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
healthObj.setDisplayName(" §c❤");
p.setHealth(p.getHealth());
User user = plugin.getUserManager().getUsersstats().get(p.getName());
addEntry(scoreboard, objective, logoutLabel, "§a§l✔", 6);
addEntry(scoreboard, objective, "", "", 5);
addEntry(scoreboard, objective, killLabel, user.getKills(), 4);
addEntry(scoreboard, objective, deathLabel, user.getDeaths(), 3);
addEntry(scoreboard, objective, moneyLabel, user.getMoney(), 2);
p.setScoreboard(scoreboard);
}
public void refreshScoreboard(Player p) {
User user = plugin.getUserManager().getUsersstats().get(p.getName());
Scoreboard scoreboard = p.getScoreboard();
String canLogout = user.canLogout() ? "§a§l✔" : "§c✖";
updateEntry(scoreboard, logoutLabel, canLogout);
updateEntry(scoreboard, deathLabel, user.getDeaths());
updateEntry(scoreboard, killLabel, user.getKills());
updateEntry(scoreboard, moneyLabel, user.getMoney());
p.setScoreboard(scoreboard);
}
private void addEntry(Scoreboard scoreboard, Objective objective, String name, String value, int position) {
Team t = scoreboard.registerNewTeam(name);
t.addEntry(name);
t.setSuffix(" " + value);
Score score = objective.getScore(name);
score.setScore(position);
}
private void addEntry(Scoreboard scoreboard, Objective objective, String name, int value, int position) {
Team t = scoreboard.registerNewTeam(name);
t.addEntry(name);
t.setSuffix(" " + value);
Score score = objective.getScore(name);
score.setScore(position);
}
private void updateEntry(Scoreboard scoreboard, String name, int value) {
Team t = scoreboard.getTeam(name);
t.setSuffix(" " + value);
}
private void updateEntry(Scoreboard scoreboard, String name, String value) {
Team t = scoreboard.getTeam(name);
t.setSuffix(" " + value);
}
}
| 3,151 | 0.667736 | 0.658114 | 85 | 35.682354 | 28.513037 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.070588 | false | false | 15 |
309f4df999e0db53e33712c3ef2e026ca6b6c0fc | 9,234,179,749,119 | 90dea0ade353e87567f49a3e157d6cb2afb5edaf | /APP-Scenes/src/com/app/empire/scene/service/warField/helper/NotifyCallNearHelper.java | d86e88f12579a9c6a6bf770901c95ac6eeee888f | [] | no_license | huangwei2wei/app | https://github.com/huangwei2wei/app | 1f13925d5171b96a63c50ab536a9da74deb6a1e0 | a06ed33c48ccda03095bb709870494d5842d38d5 | refs/heads/master | 2020-12-21T00:38:23.494000 | 2017-02-13T10:14:24 | 2017-02-13T10:14:24 | 56,054,605 | 1 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.app.empire.scene.service.warField.helper;
import java.util.Set;
import com.app.empire.protocol.Protocol;
import com.app.empire.protocol.pb.player.PlayerAttSnapProto.PlayerAttSnapMsg;
import com.app.empire.protocol.pb.scene.PlayerCallMoveReqProto.PlayerCallMoveReqMsg;
import com.app.empire.protocol.pb.scene.PlayerLeaveGridProto.PlayerLeaveGridMsg;
import com.app.empire.protocol.pb.scene.PlayerMoveBoardcastProto.PlayerMoveBoardcastMsg;
import com.app.empire.scene.service.role.objects.Living;
import com.app.empire.scene.util.BroadUtil;
import com.app.empire.scene.util.Vector3BuilderHelper;
public class NotifyCallNearHelper {
/**
* 通知附近玩家移动
*
* @param living
* @param nears
* @param moveMsg
*/
public static void notifyMove(Living living, Set<Integer> nears, PlayerCallMoveReqMsg moveMsg) {
PlayerMoveBoardcastMsg.Builder msg = PlayerMoveBoardcastMsg.newBuilder();
msg.setId(living.getId());
msg.setCur(Vector3BuilderHelper.build(moveMsg.getCur()));
msg.setTar(Vector3BuilderHelper.build(moveMsg.getTar()));
msg.setPreArriveTargetServerTime(System.currentTimeMillis());
BroadUtil.sendBroadcastPacket(nears, Protocol.MAIN_BATTLE, Protocol.BATTLE_Move, msg.build());
// System.out.println("通知玩家" + nears + "召唤物" + living.getId() + "移动");
}
/**
* 通知附近玩家的快照(进入
*/
public static void notifyAttSnap(Living l, Set<Integer> nears) {
PlayerAttSnapMsg msg = l.getAttSnapMsg().build();
BroadUtil.sendBroadcastPacket(nears, Protocol.MAIN_BATTLE, Protocol.BATTLE_Enter, msg);
// System.out.println("通知玩家" + nears + "召唤物" + l.getId() + "进入");
}
/**
* 通知玩家离开广播表
*/
public static void notifyLeaveGrid(Living l, Set<Integer> nears) {
PlayerLeaveGridMsg.Builder msg = PlayerLeaveGridMsg.newBuilder();
msg.setId(l.getId());
BroadUtil.sendBroadcastPacket(nears, Protocol.MAIN_BATTLE, Protocol.BATTLE_Leave, msg.build());
// System.out.println("通知玩家" + nears + "召唤物" + l.getId() + "离开");
}
}
| UTF-8 | Java | 2,065 | java | NotifyCallNearHelper.java | Java | [] | null | [] | package com.app.empire.scene.service.warField.helper;
import java.util.Set;
import com.app.empire.protocol.Protocol;
import com.app.empire.protocol.pb.player.PlayerAttSnapProto.PlayerAttSnapMsg;
import com.app.empire.protocol.pb.scene.PlayerCallMoveReqProto.PlayerCallMoveReqMsg;
import com.app.empire.protocol.pb.scene.PlayerLeaveGridProto.PlayerLeaveGridMsg;
import com.app.empire.protocol.pb.scene.PlayerMoveBoardcastProto.PlayerMoveBoardcastMsg;
import com.app.empire.scene.service.role.objects.Living;
import com.app.empire.scene.util.BroadUtil;
import com.app.empire.scene.util.Vector3BuilderHelper;
public class NotifyCallNearHelper {
/**
* 通知附近玩家移动
*
* @param living
* @param nears
* @param moveMsg
*/
public static void notifyMove(Living living, Set<Integer> nears, PlayerCallMoveReqMsg moveMsg) {
PlayerMoveBoardcastMsg.Builder msg = PlayerMoveBoardcastMsg.newBuilder();
msg.setId(living.getId());
msg.setCur(Vector3BuilderHelper.build(moveMsg.getCur()));
msg.setTar(Vector3BuilderHelper.build(moveMsg.getTar()));
msg.setPreArriveTargetServerTime(System.currentTimeMillis());
BroadUtil.sendBroadcastPacket(nears, Protocol.MAIN_BATTLE, Protocol.BATTLE_Move, msg.build());
// System.out.println("通知玩家" + nears + "召唤物" + living.getId() + "移动");
}
/**
* 通知附近玩家的快照(进入
*/
public static void notifyAttSnap(Living l, Set<Integer> nears) {
PlayerAttSnapMsg msg = l.getAttSnapMsg().build();
BroadUtil.sendBroadcastPacket(nears, Protocol.MAIN_BATTLE, Protocol.BATTLE_Enter, msg);
// System.out.println("通知玩家" + nears + "召唤物" + l.getId() + "进入");
}
/**
* 通知玩家离开广播表
*/
public static void notifyLeaveGrid(Living l, Set<Integer> nears) {
PlayerLeaveGridMsg.Builder msg = PlayerLeaveGridMsg.newBuilder();
msg.setId(l.getId());
BroadUtil.sendBroadcastPacket(nears, Protocol.MAIN_BATTLE, Protocol.BATTLE_Leave, msg.build());
// System.out.println("通知玩家" + nears + "召唤物" + l.getId() + "离开");
}
}
| 2,065 | 0.754476 | 0.752941 | 55 | 34.545456 | 33.254292 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.527273 | false | false | 15 |
be4b17e11c4a1f26e6d564b35dc454671abf8dc6 | 3,401,614,125,180 | 6d471aeb75faab34a52b21994053e42ce8a1f2a6 | /motordigitalizacion/src/main/java/pe/bbva/aso/servicios/motordigitalizacion/dto/OptionsClientes.java | 5a3de3d75d868f0ac4463a5486ee18e7c3409f25 | [] | no_license | lennindavila/aso-client-services | https://github.com/lennindavila/aso-client-services | 1341e6f96c0a72c7b346a62bb8ef8f9ef2991ac3 | 2af4e76c223083ba614944f067984885ae050d87 | refs/heads/master | 2022-01-12T07:02:56.869000 | 2019-03-14T07:29:01 | 2019-03-14T07:29:01 | 161,132,305 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pe.bbva.aso.servicios.motordigitalizacion.dto;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
public class OptionsClientes {
@JsonInclude(JsonInclude.Include.NON_EMPTY)
protected String codigoCentral;
public String getCodigoCentral() { return codigoCentral; }
public void setCodigoCentral(String codigoCentral) { this.codigoCentral = codigoCentral; }
@JsonInclude(JsonInclude.Include.NON_EMPTY)
protected String tipoDocumento;
public String getTipoDocumento() { return tipoDocumento; }
public void setTipoDocumento(String tipoDocumento) { this.tipoDocumento = tipoDocumento; }
@JsonInclude(JsonInclude.Include.NON_EMPTY)
protected String nroDocumento;
public String getNroDocumento() { return nroDocumento; }
public void setNroDocumento(String nroDocumento) { this.nroDocumento = nroDocumento; }
@JsonInclude(JsonInclude.Include.NON_EMPTY)
protected String email;
public String getEmail() { return email; }
public void setEmail(String email) { this.email = email; }
@JsonInclude(JsonInclude.Include.NON_EMPTY)
protected String tipo;
public String getTipo() { return tipo; }
public void setTipo(String tipo) { this.tipo = tipo; }
@JsonInclude(JsonInclude.Include.NON_EMPTY)
protected String idTrxHuellaDigital;
public String getIdTrxHuellaDigital() { return idTrxHuellaDigital; }
public void setIdTrxHuellaDigital(String idTrxHuellaDigital) { this.idTrxHuellaDigital = idTrxHuellaDigital; }
@JsonInclude(JsonInclude.Include.NON_EMPTY)
protected String nombreApellido;
public String getNombreApellido() { return nombreApellido; }
public void setNombreApellido(String nombreApellido) { this.nombreApellido = nombreApellido; }
@JsonInclude(JsonInclude.Include.NON_EMPTY)
protected List<OptionsItems> listaItems;
public List<OptionsItems> getListaItems() { return listaItems; }
public void setListaItems(List<OptionsItems> listaItems) { this.listaItems = listaItems; }
} | UTF-8 | Java | 1,956 | java | OptionsClientes.java | Java | [] | null | [] | package pe.bbva.aso.servicios.motordigitalizacion.dto;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
public class OptionsClientes {
@JsonInclude(JsonInclude.Include.NON_EMPTY)
protected String codigoCentral;
public String getCodigoCentral() { return codigoCentral; }
public void setCodigoCentral(String codigoCentral) { this.codigoCentral = codigoCentral; }
@JsonInclude(JsonInclude.Include.NON_EMPTY)
protected String tipoDocumento;
public String getTipoDocumento() { return tipoDocumento; }
public void setTipoDocumento(String tipoDocumento) { this.tipoDocumento = tipoDocumento; }
@JsonInclude(JsonInclude.Include.NON_EMPTY)
protected String nroDocumento;
public String getNroDocumento() { return nroDocumento; }
public void setNroDocumento(String nroDocumento) { this.nroDocumento = nroDocumento; }
@JsonInclude(JsonInclude.Include.NON_EMPTY)
protected String email;
public String getEmail() { return email; }
public void setEmail(String email) { this.email = email; }
@JsonInclude(JsonInclude.Include.NON_EMPTY)
protected String tipo;
public String getTipo() { return tipo; }
public void setTipo(String tipo) { this.tipo = tipo; }
@JsonInclude(JsonInclude.Include.NON_EMPTY)
protected String idTrxHuellaDigital;
public String getIdTrxHuellaDigital() { return idTrxHuellaDigital; }
public void setIdTrxHuellaDigital(String idTrxHuellaDigital) { this.idTrxHuellaDigital = idTrxHuellaDigital; }
@JsonInclude(JsonInclude.Include.NON_EMPTY)
protected String nombreApellido;
public String getNombreApellido() { return nombreApellido; }
public void setNombreApellido(String nombreApellido) { this.nombreApellido = nombreApellido; }
@JsonInclude(JsonInclude.Include.NON_EMPTY)
protected List<OptionsItems> listaItems;
public List<OptionsItems> getListaItems() { return listaItems; }
public void setListaItems(List<OptionsItems> listaItems) { this.listaItems = listaItems; }
} | 1,956 | 0.796524 | 0.796524 | 49 | 38.938774 | 29.773573 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.387755 | false | false | 15 |
c766d1e28a0421d33b56ab75ee5075b62e1379e1 | 24,103,356,509,112 | 7f3c8e58e96fb2def838221eaf541355c976ba90 | /ReferenceLibrary/src/test/java/referencelibrary/util/FileUtilTest.java | ae0b391f89d2c1209566808af91c1d361241822e | [
"MIT"
] | permissive | Mahtimursut/ohtu | https://github.com/Mahtimursut/ohtu | ac19ba9411681b82dfc526d105da4965ab8ae421 | 15870aa6e87cf03c9fa5778904ecc37c3aedc5ef | refs/heads/master | 2021-01-10T17:01:58.876000 | 2016-05-08T09:43:21 | 2016-05-08T09:43:21 | 55,685,519 | 0 | 5 | null | false | 2016-05-08T09:43:22 | 2016-04-07T10:25:43 | 2016-04-07T11:05:28 | 2016-05-08T09:43:22 | 408 | 0 | 3 | 1 | Java | 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 referencelibrary.util;
import java.io.File;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author rimi
*/
public class FileUtilTest {
private static final String TESTFILENAME_STRING = "test_file.txt";
public FileUtilTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
new File(TESTFILENAME_STRING).delete();
}
@Before
public void setUp() {
new File(TESTFILENAME_STRING).delete();
}
@After
public void tearDown() {
}
@Test
public void constructClass() {
assertNotNull(new FileUtil());
}
@Test
public void readNonexistingFile() {
assertNull(FileUtil.read(TESTFILENAME_STRING));
}
@Test
public void writeAndReadFile() {
String content = "my\ncontent";
FileUtil.write(TESTFILENAME_STRING, content);
assertEquals(content, FileUtil.read(TESTFILENAME_STRING));
}
@Test
public void writeInvalidFile() {
String filename = "invalid/filename";
FileUtil.write(filename, "");
}
}
| UTF-8 | Java | 1,440 | java | FileUtilTest.java | Java | [
{
"context": "port static org.junit.Assert.*;\n\n/**\n *\n * @author rimi\n */\npublic class FileUtilTest {\n\n private stat",
"end": 427,
"score": 0.9983052015304565,
"start": 423,
"tag": "USERNAME",
"value": "rimi"
}
] | 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 referencelibrary.util;
import java.io.File;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author rimi
*/
public class FileUtilTest {
private static final String TESTFILENAME_STRING = "test_file.txt";
public FileUtilTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
new File(TESTFILENAME_STRING).delete();
}
@Before
public void setUp() {
new File(TESTFILENAME_STRING).delete();
}
@After
public void tearDown() {
}
@Test
public void constructClass() {
assertNotNull(new FileUtil());
}
@Test
public void readNonexistingFile() {
assertNull(FileUtil.read(TESTFILENAME_STRING));
}
@Test
public void writeAndReadFile() {
String content = "my\ncontent";
FileUtil.write(TESTFILENAME_STRING, content);
assertEquals(content, FileUtil.read(TESTFILENAME_STRING));
}
@Test
public void writeInvalidFile() {
String filename = "invalid/filename";
FileUtil.write(filename, "");
}
}
| 1,440 | 0.654861 | 0.654861 | 68 | 20.17647 | 20.079212 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.352941 | false | false | 15 |
97e0adbd5901c41de772ccdf6959596abeff2bfe | 24,103,356,508,260 | 7033f44ac1086a2030702b6e08d7297ce8dcccbd | /Components/components-core/src/test/groovy/pl/subtelny/components/core/listDependency/genericListDependencies/FirstGenericDependency.java | 3d57ff7d7881bbb6415773e740b75098a7e3cb77 | [] | no_license | Subtelny/DGCraft | https://github.com/Subtelny/DGCraft | 1f29e3d8be90cccbad342f34d6194d32523c60da | 69570217541321fcac2b4e4e0895a5100637ceff | refs/heads/master | 2023-08-04T00:46:50.820000 | 2021-09-14T20:15:08 | 2021-09-14T20:15:08 | 226,193,642 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pl.subtelny.components.core.listDependency.genericListDependencies;
import pl.subtelny.components.core.api.Component;
@Component
public class FirstGenericDependency implements GenericDependency<FirstGenericType> {
}
| UTF-8 | Java | 226 | java | FirstGenericDependency.java | Java | [] | null | [] | package pl.subtelny.components.core.listDependency.genericListDependencies;
import pl.subtelny.components.core.api.Component;
@Component
public class FirstGenericDependency implements GenericDependency<FirstGenericType> {
}
| 226 | 0.862832 | 0.862832 | 7 | 31.285715 | 34.499336 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 15 |
dc66a8043ab734035eb329a64f2cb43f625f3402 | 25,890,062,902,842 | e15c6fac2d96aa98ed570b6bcf7fd0d9218666fa | /NewBoston/UserInputAge.java | 05891d1176f423e627c6a512352c3394e156582c | [] | no_license | iWanjugu/Java | https://github.com/iWanjugu/Java | 9909501d9dd7a452dc3e71292eb9da87b0134734 | c0139a66a9a8595746ca8bdf680c0017027dee02 | refs/heads/master | 2020-06-09T06:09:08.738000 | 2015-09-22T10:00:58 | 2015-09-22T10:00:58 | 42,501,616 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Scanner;
public class UserInputAge {
public static void main (String args []) {
Scanner input = new Scanner(System.in);
int age = 0;
System.out.println ("Enter your age?");
age = input.nextInt();
System.out.printf ("You are " + age + " years of age.");
}
}
| UTF-8 | Java | 293 | java | UserInputAge.java | Java | [] | null | [] | import java.util.Scanner;
public class UserInputAge {
public static void main (String args []) {
Scanner input = new Scanner(System.in);
int age = 0;
System.out.println ("Enter your age?");
age = input.nextInt();
System.out.printf ("You are " + age + " years of age.");
}
}
| 293 | 0.641638 | 0.638225 | 17 | 16.235294 | 19.135828 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.058824 | false | false | 15 |
f1480900e8f5b3f7fa31af07b348f7e1abedd382 | 14,611,478,765,844 | 4faf6c5fa9cd3df2b3dc176ab461cc7a304be1c2 | /heixiu/src/main/java/com/remair/heixiu/activity/MineHeidouActivity.java | 2192fd4a050fe5569959f3188cabc3d780e15db7 | [] | no_license | weikeshidai/android | https://github.com/weikeshidai/android | a7f13b5e0c850ea8ef837b6721412859fac3dc53 | 0e3001044604d2a8f2ac0d6318e9303972bb8c76 | refs/heads/master | 2016-09-21T20:12:53.713000 | 2016-09-09T02:43:47 | 2016-09-09T02:43:47 | 67,759,580 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.remair.heixiu.activity;
import android.content.Context;
import android.content.Intent;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.remair.heixiu.EventConstants;
import com.remair.heixiu.HXApp;
import com.remair.heixiu.R;
import com.remair.heixiu.activity.base.HXBaseActivity;
import com.remair.heixiu.adapters.MyFragmentPagerAdapter;
import com.remair.heixiu.bean.Dimaondex;
import com.remair.heixiu.bean.ExchageDimo;
import com.remair.heixiu.bean.UserInfo;
import com.remair.heixiu.net.HXHttpUtil;
import com.remair.heixiu.net.HttpSubscriber;
import com.remair.heixiu.utils.RxViewUtil;
import com.remair.heixiu.view.ShowDialog;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.simple.eventbus.Subscriber;
import rx.functions.Action1;
import studio.archangel.toolkitv2.util.text.Notifier;
public class MineHeidouActivity extends HXBaseActivity {
@BindView(R.id.text_balanceview) TextView mTextBalanceview;
@BindView(R.id.text_balance) TextView mTextBalance;
@BindView(R.id.rl_background) RelativeLayout mRlBackground;
@BindView(R.id.tv_title) TextView mTvTitle;
@BindView(R.id.Imagediamondexchange) ImageView mImagediamondexchange;
@BindView(R.id.tv_title2) TextView mTvTitle2;
@BindView(R.id.Imagediamondexchange2) ImageView mImagediamondexchange2;
@BindView(R.id.iv_mark) ImageView mIvMark;
@BindView(R.id.iv_mark2) ImageView mIvMark2;
@BindView(R.id.radiobutton) ImageView mRadiobutton;
@BindView(R.id.textconvertible) TextView mTextconvertible;
@BindView(R.id.viewpager) ViewPager mViewpager;
List<View> listViews;
@BindView(R.id.relat_diamondexchange) RelativeLayout mRelatDiamondexchange;
@BindView(R.id.relat_diamondexchange2)
RelativeLayout mRelatDiamondexchange2;
@BindView(R.id.title_txt) TextView mTitleTxt;
@BindView(R.id.title_left_image) ImageButton mTitleLeftImage;
@BindView(R.id.title_right_text) TextView mTitleRightText;
@Override
protected void initUI() {
setContentView(R.layout.activity_frag_mine_newcopy);
ButterKnife.bind(this);
context = MineHeidouActivity.this;
mSelfUserInfo = ((HXApp) getApplication()).getUserInfo();
mTitleTxt.setText("我的嘿豆");
mTitleRightText.setVisibility(View.VISIBLE);
mTitleRightText.setText("兑换记录");
RxViewUtil.viewBindClick(mTitleRightText, new Action1<Void>() {
@Override
public void call(Void aVoid) {
Intent intent = new Intent(context, CaseHistryActivity.class);
intent.putExtra("type", 1);
startActivity(intent);
}
});
}
MyFragmentPagerAdapter mAdapter;
@Override
protected void initData() {
mTextBalanceview.setText("嘿豆余额");
mTextBalance.setText(mSelfUserInfo.heidou_amount + "");//余额
mTvTitle.setText("钻石兑换");
mTvTitle2.setText("存在感兑换");
mImagediamondexchange2.setImageResource(R.drawable.cunzaigandjdjx);
mAdapter = new MyFragmentPagerAdapter(getSupportFragmentManager(), 2);
mViewpager.setAdapter(mAdapter);
mViewpager.setCurrentItem(0);
mIvMark2.setVisibility(View.GONE);
mRadiobutton.setVisibility(View.GONE);
mTextconvertible
.setText("可兑换钻石:" + mSelfUserInfo.virtual_currency_amount);
RxViewUtil
.viewBindClick(mRelatDiamondexchange, new View.OnClickListener() {
@Override
public void onClick(View v) {
mViewpager.setCurrentItem(MinediamondActivity.PAGE_ONE);
position0();
}
});
RxViewUtil
.viewBindClick(mRelatDiamondexchange2, new View.OnClickListener() {
@Override
public void onClick(View v) {
mViewpager.setCurrentItem(MinediamondActivity.PAGE_TWO);
position1();
}
});
mViewpager
.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
public void onPageSelected(int position) {
//当viewPager发生改变时,同时改变tabhost上面的currentTab
if (position == 0) {
position0();
} else {
position1();
}
}
public void onPageScrolled(int arg0, float arg1, int arg2) {
}
public void onPageScrollStateChanged(int arg0) {
}
});
}
public void position0() {
mIvMark2.setVisibility(View.GONE);
mIvMark.setVisibility(View.VISIBLE);
mTextconvertible
.setText("可兑换钻石:" + mSelfUserInfo.virtual_currency_amount);
mRadiobutton.setVisibility(View.GONE);
}
public void position1() {
mIvMark2.setVisibility(View.VISIBLE);
mIvMark.setVisibility(View.GONE);
mTextconvertible.setText("可兑换存在感:" +
mSelfUserInfo.income_charm_value + "");
mRadiobutton.setVisibility(View.GONE);
}
Context context = null;
UserInfo mSelfUserInfo;
boolean b;
ShowDialog DialognewPerCard;
@Subscriber(tag = EventConstants.DIANMONDVOIDCHECK)
public void setOnhidouLiseten(final Dimaondex dimaondex) {
DialognewPerCard = new ShowDialog(context,
"确定要兑换" + dimaondex.number_value +
"嘿豆吗?", "确定", "取消");
DialognewPerCard
.setClicklistener(new ShowDialog.ClickListenerInterface() {
@Override
public void doConfirm() {
if (dimaondex.type == 3) {
Map<String, String> jo = new HashMap<String, String>();
if (mSelfUserInfo.virtual_currency_amount <
dimaondex.number) {
Notifier.showLongMsg(context, "兑换失败可兑换的钻石不足!");
return;
}
jo.put("user_id", mSelfUserInfo.user_id + "");
jo.put("charm_diamond", dimaondex.number + "");
jo.put("type", "0");
HXHttpUtil.getInstance().newExchange(jo)
.subscribe(new HttpSubscriber<ExchageDimo>() {
@Override
public void onNext(ExchageDimo exchageDimo) {
mSelfUserInfo.heidou_amount = exchageDimo.heidou_amount;
mSelfUserInfo.virtual_currency_amount = exchageDimo.charm_diamond_valid;
HXApp.getInstance()
.setUserInfo(mSelfUserInfo);
mTextBalance.setText(
mSelfUserInfo.heidou_amount +
"");
mTextconvertible.setText(
"可兑换钻石:" +
mSelfUserInfo.virtual_currency_amount);
}
});
} else if (dimaondex.type == 4) {
Map<String, String> jo = new HashMap<String, String>();
if (mSelfUserInfo.income_charm_value <
dimaondex.number) {
Notifier.showLongMsg(context,
"兑换失败可兑换的存在感不足!");
return;
}
jo.put("user_id", mSelfUserInfo.user_id + "");
jo.put("charm_diamond", dimaondex.number + "");
jo.put("type", "1");
HXHttpUtil.getInstance().newExchange(jo)
.subscribe(new HttpSubscriber<ExchageDimo>() {
@Override
public void onNext(ExchageDimo exchageDimo) {
mSelfUserInfo.heidou_amount = exchageDimo.heidou_amount;
mSelfUserInfo.income_charm_value = exchageDimo.charm_diamond_valid;
HXApp.getInstance()
.setUserInfo(mSelfUserInfo);
mTextBalance.setText(
mSelfUserInfo.heidou_amount +
"");
mTextconvertible
.setText("可兑换存在感:" +
mSelfUserInfo.income_charm_value +
"");
}
});
}
DialognewPerCard.dismiss();
}
@Override
public void doCancel() {
DialognewPerCard.dismiss();
}
});
DialognewPerCard.show();
}
}
| UTF-8 | Java | 10,563 | java | MineHeidouActivity.java | Java | [] | null | [] | package com.remair.heixiu.activity;
import android.content.Context;
import android.content.Intent;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.remair.heixiu.EventConstants;
import com.remair.heixiu.HXApp;
import com.remair.heixiu.R;
import com.remair.heixiu.activity.base.HXBaseActivity;
import com.remair.heixiu.adapters.MyFragmentPagerAdapter;
import com.remair.heixiu.bean.Dimaondex;
import com.remair.heixiu.bean.ExchageDimo;
import com.remair.heixiu.bean.UserInfo;
import com.remair.heixiu.net.HXHttpUtil;
import com.remair.heixiu.net.HttpSubscriber;
import com.remair.heixiu.utils.RxViewUtil;
import com.remair.heixiu.view.ShowDialog;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.simple.eventbus.Subscriber;
import rx.functions.Action1;
import studio.archangel.toolkitv2.util.text.Notifier;
public class MineHeidouActivity extends HXBaseActivity {
@BindView(R.id.text_balanceview) TextView mTextBalanceview;
@BindView(R.id.text_balance) TextView mTextBalance;
@BindView(R.id.rl_background) RelativeLayout mRlBackground;
@BindView(R.id.tv_title) TextView mTvTitle;
@BindView(R.id.Imagediamondexchange) ImageView mImagediamondexchange;
@BindView(R.id.tv_title2) TextView mTvTitle2;
@BindView(R.id.Imagediamondexchange2) ImageView mImagediamondexchange2;
@BindView(R.id.iv_mark) ImageView mIvMark;
@BindView(R.id.iv_mark2) ImageView mIvMark2;
@BindView(R.id.radiobutton) ImageView mRadiobutton;
@BindView(R.id.textconvertible) TextView mTextconvertible;
@BindView(R.id.viewpager) ViewPager mViewpager;
List<View> listViews;
@BindView(R.id.relat_diamondexchange) RelativeLayout mRelatDiamondexchange;
@BindView(R.id.relat_diamondexchange2)
RelativeLayout mRelatDiamondexchange2;
@BindView(R.id.title_txt) TextView mTitleTxt;
@BindView(R.id.title_left_image) ImageButton mTitleLeftImage;
@BindView(R.id.title_right_text) TextView mTitleRightText;
@Override
protected void initUI() {
setContentView(R.layout.activity_frag_mine_newcopy);
ButterKnife.bind(this);
context = MineHeidouActivity.this;
mSelfUserInfo = ((HXApp) getApplication()).getUserInfo();
mTitleTxt.setText("我的嘿豆");
mTitleRightText.setVisibility(View.VISIBLE);
mTitleRightText.setText("兑换记录");
RxViewUtil.viewBindClick(mTitleRightText, new Action1<Void>() {
@Override
public void call(Void aVoid) {
Intent intent = new Intent(context, CaseHistryActivity.class);
intent.putExtra("type", 1);
startActivity(intent);
}
});
}
MyFragmentPagerAdapter mAdapter;
@Override
protected void initData() {
mTextBalanceview.setText("嘿豆余额");
mTextBalance.setText(mSelfUserInfo.heidou_amount + "");//余额
mTvTitle.setText("钻石兑换");
mTvTitle2.setText("存在感兑换");
mImagediamondexchange2.setImageResource(R.drawable.cunzaigandjdjx);
mAdapter = new MyFragmentPagerAdapter(getSupportFragmentManager(), 2);
mViewpager.setAdapter(mAdapter);
mViewpager.setCurrentItem(0);
mIvMark2.setVisibility(View.GONE);
mRadiobutton.setVisibility(View.GONE);
mTextconvertible
.setText("可兑换钻石:" + mSelfUserInfo.virtual_currency_amount);
RxViewUtil
.viewBindClick(mRelatDiamondexchange, new View.OnClickListener() {
@Override
public void onClick(View v) {
mViewpager.setCurrentItem(MinediamondActivity.PAGE_ONE);
position0();
}
});
RxViewUtil
.viewBindClick(mRelatDiamondexchange2, new View.OnClickListener() {
@Override
public void onClick(View v) {
mViewpager.setCurrentItem(MinediamondActivity.PAGE_TWO);
position1();
}
});
mViewpager
.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
public void onPageSelected(int position) {
//当viewPager发生改变时,同时改变tabhost上面的currentTab
if (position == 0) {
position0();
} else {
position1();
}
}
public void onPageScrolled(int arg0, float arg1, int arg2) {
}
public void onPageScrollStateChanged(int arg0) {
}
});
}
public void position0() {
mIvMark2.setVisibility(View.GONE);
mIvMark.setVisibility(View.VISIBLE);
mTextconvertible
.setText("可兑换钻石:" + mSelfUserInfo.virtual_currency_amount);
mRadiobutton.setVisibility(View.GONE);
}
public void position1() {
mIvMark2.setVisibility(View.VISIBLE);
mIvMark.setVisibility(View.GONE);
mTextconvertible.setText("可兑换存在感:" +
mSelfUserInfo.income_charm_value + "");
mRadiobutton.setVisibility(View.GONE);
}
Context context = null;
UserInfo mSelfUserInfo;
boolean b;
ShowDialog DialognewPerCard;
@Subscriber(tag = EventConstants.DIANMONDVOIDCHECK)
public void setOnhidouLiseten(final Dimaondex dimaondex) {
DialognewPerCard = new ShowDialog(context,
"确定要兑换" + dimaondex.number_value +
"嘿豆吗?", "确定", "取消");
DialognewPerCard
.setClicklistener(new ShowDialog.ClickListenerInterface() {
@Override
public void doConfirm() {
if (dimaondex.type == 3) {
Map<String, String> jo = new HashMap<String, String>();
if (mSelfUserInfo.virtual_currency_amount <
dimaondex.number) {
Notifier.showLongMsg(context, "兑换失败可兑换的钻石不足!");
return;
}
jo.put("user_id", mSelfUserInfo.user_id + "");
jo.put("charm_diamond", dimaondex.number + "");
jo.put("type", "0");
HXHttpUtil.getInstance().newExchange(jo)
.subscribe(new HttpSubscriber<ExchageDimo>() {
@Override
public void onNext(ExchageDimo exchageDimo) {
mSelfUserInfo.heidou_amount = exchageDimo.heidou_amount;
mSelfUserInfo.virtual_currency_amount = exchageDimo.charm_diamond_valid;
HXApp.getInstance()
.setUserInfo(mSelfUserInfo);
mTextBalance.setText(
mSelfUserInfo.heidou_amount +
"");
mTextconvertible.setText(
"可兑换钻石:" +
mSelfUserInfo.virtual_currency_amount);
}
});
} else if (dimaondex.type == 4) {
Map<String, String> jo = new HashMap<String, String>();
if (mSelfUserInfo.income_charm_value <
dimaondex.number) {
Notifier.showLongMsg(context,
"兑换失败可兑换的存在感不足!");
return;
}
jo.put("user_id", mSelfUserInfo.user_id + "");
jo.put("charm_diamond", dimaondex.number + "");
jo.put("type", "1");
HXHttpUtil.getInstance().newExchange(jo)
.subscribe(new HttpSubscriber<ExchageDimo>() {
@Override
public void onNext(ExchageDimo exchageDimo) {
mSelfUserInfo.heidou_amount = exchageDimo.heidou_amount;
mSelfUserInfo.income_charm_value = exchageDimo.charm_diamond_valid;
HXApp.getInstance()
.setUserInfo(mSelfUserInfo);
mTextBalance.setText(
mSelfUserInfo.heidou_amount +
"");
mTextconvertible
.setText("可兑换存在感:" +
mSelfUserInfo.income_charm_value +
"");
}
});
}
DialognewPerCard.dismiss();
}
@Override
public void doCancel() {
DialognewPerCard.dismiss();
}
});
DialognewPerCard.show();
}
}
| 10,563 | 0.499855 | 0.496376 | 242 | 40.764462 | 27.058674 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.590909 | false | false | 15 |
3aaa3be69edfaa66927c5b83acbaa9a76d489c27 | 1,348,619,745,637 | bace1e323cc07d43b10aab9c767a113ecf7c6b58 | /src/Algo_Home1/A2_14.java | 8e4febc5968aadb88641693eaa7e0265cce44630 | [] | no_license | cong25825933/Alogrithms | https://github.com/cong25825933/Alogrithms | 481cfe6cbd2ccc45dd8f79ef13f985b8c7b5f13a | 35c99963a7849b1d067b3f726c289c987944958c | refs/heads/master | 2021-01-10T13:13:56.642000 | 2016-03-05T13:54:34 | 2016-03-05T13:54:34 | 53,203,680 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Algo_Home1;
import java.util.Arrays;
/**
* Created by Yc on 2015/9/21.
* 问:n个元素的数组,数组中有元素是重复的,设计一个复杂度为O(nlogn)的算法 去掉重复的元素
* 答:问题需解决重复元素的查找,类比归并排序与快速排序方法想到如下算法
*/
public class A2_14 {
private static int[] sort(int[] arr, int low, int high) {
int[] t=null;
if (low < high) {
int mid = (low + high) / 2;
sort(arr, low, mid);
sort(arr, mid + 1, high);
t=merge(arr, low, mid, high);
}
return t;
}
//有序arr[low-mid] arr[mid+1-high]合并
private static int[] merge(int[] arr, int low, int mid, int high) {
int[] temp = new int[high - low + 1];
int i = low;
int j = mid + 1;
int k = 0,same=0;
while (i <= mid && j <= high) {
if(arr[i]==arr[j]) {
temp[k++] = arr[i++];
j++;same++;
}else if(arr[i]<arr[j])
temp[k++]=arr[i++];
else
temp[k++]=arr[j++];
// temp[k++] = (arr[i] < arr[j]) ? arr[i++] : arr[j++];
}
while (i <= mid)
temp[k++] = arr[i++];
while (j <= high)
temp[k++] = arr[j++];
if(same!=0) {
int[] out = new int[temp.length - same];
for (int k2 = 0; k2 < temp.length-same; k2++) {
out[k2] = temp[k2];
}
return out;
}
return temp;
}
public static int[] MergeSort(int[] arr) {
return sort(arr, 0, arr.length - 1);
}
public static void main(String[] args) {
int[] a = new int[]{-1, 8, -4, -4, 8, -4, 3, 1};
System.out.println(Arrays.toString(MergeSort(a)));
}
}
| UTF-8 | Java | 1,853 | java | A2_14.java | Java | [
{
"context": "ome1;\n\nimport java.util.Arrays;\n\n/**\n * Created by Yc on 2015/9/21.\n * 问:n个元素的数组,数组中有元素是重复的,设计一个复杂度为O(n",
"end": 67,
"score": 0.9981350898742676,
"start": 65,
"tag": "USERNAME",
"value": "Yc"
}
] | null | [] | package Algo_Home1;
import java.util.Arrays;
/**
* Created by Yc on 2015/9/21.
* 问:n个元素的数组,数组中有元素是重复的,设计一个复杂度为O(nlogn)的算法 去掉重复的元素
* 答:问题需解决重复元素的查找,类比归并排序与快速排序方法想到如下算法
*/
public class A2_14 {
private static int[] sort(int[] arr, int low, int high) {
int[] t=null;
if (low < high) {
int mid = (low + high) / 2;
sort(arr, low, mid);
sort(arr, mid + 1, high);
t=merge(arr, low, mid, high);
}
return t;
}
//有序arr[low-mid] arr[mid+1-high]合并
private static int[] merge(int[] arr, int low, int mid, int high) {
int[] temp = new int[high - low + 1];
int i = low;
int j = mid + 1;
int k = 0,same=0;
while (i <= mid && j <= high) {
if(arr[i]==arr[j]) {
temp[k++] = arr[i++];
j++;same++;
}else if(arr[i]<arr[j])
temp[k++]=arr[i++];
else
temp[k++]=arr[j++];
// temp[k++] = (arr[i] < arr[j]) ? arr[i++] : arr[j++];
}
while (i <= mid)
temp[k++] = arr[i++];
while (j <= high)
temp[k++] = arr[j++];
if(same!=0) {
int[] out = new int[temp.length - same];
for (int k2 = 0; k2 < temp.length-same; k2++) {
out[k2] = temp[k2];
}
return out;
}
return temp;
}
public static int[] MergeSort(int[] arr) {
return sort(arr, 0, arr.length - 1);
}
public static void main(String[] args) {
int[] a = new int[]{-1, 8, -4, -4, 8, -4, 3, 1};
System.out.println(Arrays.toString(MergeSort(a)));
}
}
| 1,853 | 0.440329 | 0.419753 | 62 | 26.435484 | 18.738111 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.822581 | false | false | 15 |
a9381ec41eb57682204b9ebdec8f69298c1ddb2a | 9,972,914,096,928 | 4b178b6c6c91d3b489d4baa12cefedbb83699afa | /chapter06/02-spring-jdbc-annotation/src/main/java/com/codve/prospring/ch06/UpdateUserUpdate.java | e3ed674b88f0cdd80b0c4243f100e203fa762b62 | [] | no_license | jiangyuwise/spring-training | https://github.com/jiangyuwise/spring-training | 152bc07bcbee778ec4fd19d25c7a1713eea6bfcb | 7aab520279c1b5640193c85f5cb6cf884bae3d2b | refs/heads/master | 2020-08-13T20:29:06.487000 | 2019-10-25T09:58:17 | 2019-10-25T09:58:17 | 215,032,901 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.codve.prospring.ch06;
import org.springframework.jdbc.core.SqlParameter;
import org.springframework.jdbc.object.SqlUpdate;
import javax.sql.DataSource;
import java.sql.Types;
/**
* @author admin
* @date 2019/10/24 19:03
*/
public class UpdateUserUpdate extends SqlUpdate {
private static final String SQL =
"update `user` set `user_name` = :name, `user_birthday` = :birthday" +
" where `user_id` = :id";
public UpdateUserUpdate(DataSource dataSource) {
super(dataSource, SQL);
super.declareParameter(new SqlParameter("name", Types.VARCHAR));
super.declareParameter(new SqlParameter("birthday", Types.BIGINT));
super.declareParameter(new SqlParameter("id", Types.BIGINT));
}
}
| UTF-8 | Java | 771 | java | UpdateUserUpdate.java | Java | [
{
"context": "DataSource;\nimport java.sql.Types;\n\n/**\n * @author admin\n * @date 2019/10/24 19:03\n */\npublic class Update",
"end": 210,
"score": 0.9981867671012878,
"start": 205,
"tag": "USERNAME",
"value": "admin"
}
] | null | [] | package com.codve.prospring.ch06;
import org.springframework.jdbc.core.SqlParameter;
import org.springframework.jdbc.object.SqlUpdate;
import javax.sql.DataSource;
import java.sql.Types;
/**
* @author admin
* @date 2019/10/24 19:03
*/
public class UpdateUserUpdate extends SqlUpdate {
private static final String SQL =
"update `user` set `user_name` = :name, `user_birthday` = :birthday" +
" where `user_id` = :id";
public UpdateUserUpdate(DataSource dataSource) {
super(dataSource, SQL);
super.declareParameter(new SqlParameter("name", Types.VARCHAR));
super.declareParameter(new SqlParameter("birthday", Types.BIGINT));
super.declareParameter(new SqlParameter("id", Types.BIGINT));
}
}
| 771 | 0.684825 | 0.666667 | 24 | 31.125 | 26.368088 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.625 | false | false | 15 |
76266584766c638b00b849ec748bba9121677540 | 24,455,543,809,761 | 2e98d6408eb1f79b546fa7c41af4f2e3bfaba334 | /src/main/java/lv/javaguru/java2/Constants.java | e648fe62ae054782cea94431785c736d7e44aef2 | [] | no_license | Olena1415/java2 | https://github.com/Olena1415/java2 | d5cd47e27b4e12a1eb79f8cf36c0cd540f87ca37 | c3616390843f5431770c594517d9224e8aeef215 | refs/heads/master | 2021-09-09T16:08:59.969000 | 2018-03-17T19:15:26 | 2018-03-17T19:15:26 | 124,658,213 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package lv.javaguru.java2;
public interface Constants {
enum userActions {
PRINT_MESSAGE,
EMPTY_MESSAGE,
CHANGE_NICK,
BAD_COMMAND,
REFRESH_CONSOLE,
QUIT
}
}
| UTF-8 | Java | 214 | java | Constants.java | Java | [] | null | [] | package lv.javaguru.java2;
public interface Constants {
enum userActions {
PRINT_MESSAGE,
EMPTY_MESSAGE,
CHANGE_NICK,
BAD_COMMAND,
REFRESH_CONSOLE,
QUIT
}
}
| 214 | 0.574766 | 0.570093 | 12 | 16.833334 | 9.388231 | 28 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 15 |
40946485fb566c86c0c75d4ee977fe3ba7e758a0 | 5,282,809,809,603 | a8c5b7b04eace88b19b5a41a45f1fb030df393e3 | /projects/analytics/src/main/java/com/opengamma/analytics/financial/provider/calculator/sabrswaption/ImpliedVolatilitySABRSwaptionCalculator.java | be65db19339d25311019a785c63be5f27a931fde | [
"Apache-2.0"
] | permissive | McLeodMoores/starling | https://github.com/McLeodMoores/starling | 3f6cfe89cacfd4332bad4861f6c5d4648046519c | 7ae0689e06704f78fd9497f8ddb57ee82974a9c8 | refs/heads/master | 2022-12-04T14:02:00.480000 | 2020-04-28T17:22:44 | 2020-04-28T17:22:44 | 46,577,620 | 4 | 4 | Apache-2.0 | false | 2022-11-24T07:26:39 | 2015-11-20T17:48:10 | 2022-11-15T07:46:39 | 2022-11-24T07:26:38 | 299,457 | 3 | 4 | 45 | Java | false | false | /**
* Copyright (C) 2014 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.analytics.financial.provider.calculator.sabrswaption;
import com.opengamma.analytics.financial.interestrate.InstrumentDerivativeVisitorAdapter;
import com.opengamma.analytics.financial.interestrate.swaption.derivative.SwaptionCashFixedIbor;
import com.opengamma.analytics.financial.interestrate.swaption.derivative.SwaptionPhysicalFixedIbor;
import com.opengamma.analytics.financial.interestrate.swaption.provider.SwaptionCashFixedIborSABRMethod;
import com.opengamma.analytics.financial.interestrate.swaption.provider.SwaptionPhysicalFixedIborSABRMethod;
import com.opengamma.analytics.financial.provider.description.interestrate.SABRSwaptionProviderInterface;
/**
* Interpolates, for interest rate instruments using SABR model, and returns the implied volatility required.
*/
public final class ImpliedVolatilitySABRSwaptionCalculator extends InstrumentDerivativeVisitorAdapter<SABRSwaptionProviderInterface, Double> {
/**
* The method unique instance.
*/
private static final ImpliedVolatilitySABRSwaptionCalculator INSTANCE = new ImpliedVolatilitySABRSwaptionCalculator();
/**
* Return the unique instance of the class.
* @return The instance.
*/
public static ImpliedVolatilitySABRSwaptionCalculator getInstance() {
return INSTANCE;
}
/** Private Constructor */
private ImpliedVolatilitySABRSwaptionCalculator() {
}
// The Pricing Methods
/** The implied volatility calculator for physically-settled swaptions */
private static final SwaptionPhysicalFixedIborSABRMethod METHOD_SWAPTION_PHYSICAL = SwaptionPhysicalFixedIborSABRMethod.getInstance();
/** The implied volatility calculator for cash-settled swaptions */
private static final SwaptionCashFixedIborSABRMethod METHOD_SWAPTION_CASH = SwaptionCashFixedIborSABRMethod.getInstance();
@Override
public Double visitSwaptionPhysicalFixedIbor(final SwaptionPhysicalFixedIbor swaption, final SABRSwaptionProviderInterface curves) {
return METHOD_SWAPTION_PHYSICAL.impliedVolatility(swaption, curves);
}
@Override
public Double visitSwaptionCashFixedIbor(final SwaptionCashFixedIbor swaption, final SABRSwaptionProviderInterface curves) {
return METHOD_SWAPTION_CASH.impliedVolatility(swaption, curves);
}
}
| UTF-8 | Java | 2,409 | java | ImpliedVolatilitySABRSwaptionCalculator.java | Java | [] | null | [] | /**
* Copyright (C) 2014 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.analytics.financial.provider.calculator.sabrswaption;
import com.opengamma.analytics.financial.interestrate.InstrumentDerivativeVisitorAdapter;
import com.opengamma.analytics.financial.interestrate.swaption.derivative.SwaptionCashFixedIbor;
import com.opengamma.analytics.financial.interestrate.swaption.derivative.SwaptionPhysicalFixedIbor;
import com.opengamma.analytics.financial.interestrate.swaption.provider.SwaptionCashFixedIborSABRMethod;
import com.opengamma.analytics.financial.interestrate.swaption.provider.SwaptionPhysicalFixedIborSABRMethod;
import com.opengamma.analytics.financial.provider.description.interestrate.SABRSwaptionProviderInterface;
/**
* Interpolates, for interest rate instruments using SABR model, and returns the implied volatility required.
*/
public final class ImpliedVolatilitySABRSwaptionCalculator extends InstrumentDerivativeVisitorAdapter<SABRSwaptionProviderInterface, Double> {
/**
* The method unique instance.
*/
private static final ImpliedVolatilitySABRSwaptionCalculator INSTANCE = new ImpliedVolatilitySABRSwaptionCalculator();
/**
* Return the unique instance of the class.
* @return The instance.
*/
public static ImpliedVolatilitySABRSwaptionCalculator getInstance() {
return INSTANCE;
}
/** Private Constructor */
private ImpliedVolatilitySABRSwaptionCalculator() {
}
// The Pricing Methods
/** The implied volatility calculator for physically-settled swaptions */
private static final SwaptionPhysicalFixedIborSABRMethod METHOD_SWAPTION_PHYSICAL = SwaptionPhysicalFixedIborSABRMethod.getInstance();
/** The implied volatility calculator for cash-settled swaptions */
private static final SwaptionCashFixedIborSABRMethod METHOD_SWAPTION_CASH = SwaptionCashFixedIborSABRMethod.getInstance();
@Override
public Double visitSwaptionPhysicalFixedIbor(final SwaptionPhysicalFixedIbor swaption, final SABRSwaptionProviderInterface curves) {
return METHOD_SWAPTION_PHYSICAL.impliedVolatility(swaption, curves);
}
@Override
public Double visitSwaptionCashFixedIbor(final SwaptionCashFixedIbor swaption, final SABRSwaptionProviderInterface curves) {
return METHOD_SWAPTION_CASH.impliedVolatility(swaption, curves);
}
}
| 2,409 | 0.820257 | 0.818597 | 54 | 43.611111 | 47.354618 | 142 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.37037 | false | false | 15 |
9bbf35bef2df87fc1b2ad4240981a64790d53058 | 15,152,644,657,341 | 9d31d7ec5a4252e1619f711ce7632b7e10a7836e | /main/java/home/search/model/SearchDao.java | 237e293152a61e191bed29bc0df578eb54802eba | [] | no_license | JLin115/belle_rever | https://github.com/JLin115/belle_rever | 87ef32989883b7a4f43d9333379440c03e281907 | 9a2380376caed13ff2a5dac51d20176b466d8488 | refs/heads/master | 2021-05-10T13:16:12.022000 | 2018-04-08T07:29:05 | 2018-04-08T07:29:05 | 118,469,163 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package home.search.model;
import java.util.List;
import home.purchase.model.CouponBean;
import manager.analysis.model.MonthAnalysis;
import manager.analysis.model.SingleMonthandItem;
import manager.itemManager.model.ItemBean;
import member.model.FeedBackBean;
public interface SearchDao {
public List<ItemBean> searchItem(String itemheader);
public int getTotalPageSearch();
public int getTotalPageCoupon();
public void setItemheader(String itemheader);
public void setPageNow(int pageNow);
public int getPageNow() ;
public int getTotalPageFeedBack(Integer itid);
public List<FeedBackBean> getFeedBack(Integer itid);
public void deleteFeedBack(Integer itemId , String mid,Integer fbkey );
public List<CouponBean> showCoupon();
public int deleteCoupon(String cpid );
public CouponBean getSingCP(String cpid);
public int checkMember(String mId);
public int modifyCoupon(CouponBean cb,String oldCpid);
public int insertCoupon(CouponBean cb);
public List<MonthAnalysis> getMonthAna(String year);
public List<String> getAllYear();
public List<SingleMonthandItem> getSingleMon(String year,String mon);
}
| UTF-8 | Java | 1,131 | java | SearchDao.java | Java | [] | null | [] | package home.search.model;
import java.util.List;
import home.purchase.model.CouponBean;
import manager.analysis.model.MonthAnalysis;
import manager.analysis.model.SingleMonthandItem;
import manager.itemManager.model.ItemBean;
import member.model.FeedBackBean;
public interface SearchDao {
public List<ItemBean> searchItem(String itemheader);
public int getTotalPageSearch();
public int getTotalPageCoupon();
public void setItemheader(String itemheader);
public void setPageNow(int pageNow);
public int getPageNow() ;
public int getTotalPageFeedBack(Integer itid);
public List<FeedBackBean> getFeedBack(Integer itid);
public void deleteFeedBack(Integer itemId , String mid,Integer fbkey );
public List<CouponBean> showCoupon();
public int deleteCoupon(String cpid );
public CouponBean getSingCP(String cpid);
public int checkMember(String mId);
public int modifyCoupon(CouponBean cb,String oldCpid);
public int insertCoupon(CouponBean cb);
public List<MonthAnalysis> getMonthAna(String year);
public List<String> getAllYear();
public List<SingleMonthandItem> getSingleMon(String year,String mon);
}
| 1,131 | 0.801945 | 0.801945 | 33 | 33.18182 | 20.083847 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.484848 | false | false | 15 |
8b9f4bc2e4c5e5e0a601459c96da18bd513fa0d7 | 26,980,984,594,325 | bdcd7db8bdad9077fe243e2b7a2dbc448f8ffa38 | /src/wpsr/parsers/rdf/predicates/CardinalityPredicate.java | e6f3f4c6509e565be9e781fa005fbb55fa87afbc | [] | no_license | ditho/WPSR | https://github.com/ditho/WPSR | 882c13f13b51b6f7ce18190c1eb60ca7d2ec6613 | d445ddd9d4e73151eeb5293270744f8928222512 | refs/heads/master | 2021-01-10T21:10:23.819000 | 2012-09-12T16:26:40 | 2012-09-12T16:26:40 | 2,431,315 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package wpsr.parsers.rdf.predicates;
import java.util.ArrayList;
import org.apache.log4j.Logger;
import wpsr.parsers.dom.DOMCandidateManager;
import wpsr.parsers.dom.DOMProcessor;
import wpsr.parsers.dom.IDOMCandidate;
import wpsr.parsers.rdf.query.IRDFResource;
import wpsr.parsers.rdf.query.IRDFStatement;
public class CardinalityPredicate extends Predicate {
static Logger logger = Logger.getLogger(CardinalityPredicate.class.getName());
/**
* TODO: this class is not implemented right, because the presence of a
* cardinality does not raise the score in a careless way. The statements
* have to be processed if the right cardinality is given by the candidate
* or not.
*
* @param domProcessor
*/
public CardinalityPredicate(DOMProcessor proc) {
super(proc);
}
@Override
public void analyze(IRDFStatement stmt, IRDFResource root, DOMCandidateManager manager) {
logger.debug("[subject=" + stmt.getSubject()
+ ",predicate=" + stmt.getPredicate()
+ ",object=" + stmt.getObject() + "]");
final ArrayList<IDOMCandidate> candidateList = manager.get(stmt.getSubject().toString());
ArrayList<IDOMCandidate> analyzedList = new ArrayList<IDOMCandidate>();
if (candidateList == null) {
return;
}
for (IDOMCandidate candidate : candidateList) {
if (candidate == null) {
continue;
}
candidate.featureSearched();
candidate.matchedPosFeature();
analyzedList.add(candidate);
}
manager.put(stmt.getSubject().toString(), analyzedList);
}
}
| UTF-8 | Java | 1,734 | java | CardinalityPredicate.java | Java | [] | null | [] | package wpsr.parsers.rdf.predicates;
import java.util.ArrayList;
import org.apache.log4j.Logger;
import wpsr.parsers.dom.DOMCandidateManager;
import wpsr.parsers.dom.DOMProcessor;
import wpsr.parsers.dom.IDOMCandidate;
import wpsr.parsers.rdf.query.IRDFResource;
import wpsr.parsers.rdf.query.IRDFStatement;
public class CardinalityPredicate extends Predicate {
static Logger logger = Logger.getLogger(CardinalityPredicate.class.getName());
/**
* TODO: this class is not implemented right, because the presence of a
* cardinality does not raise the score in a careless way. The statements
* have to be processed if the right cardinality is given by the candidate
* or not.
*
* @param domProcessor
*/
public CardinalityPredicate(DOMProcessor proc) {
super(proc);
}
@Override
public void analyze(IRDFStatement stmt, IRDFResource root, DOMCandidateManager manager) {
logger.debug("[subject=" + stmt.getSubject()
+ ",predicate=" + stmt.getPredicate()
+ ",object=" + stmt.getObject() + "]");
final ArrayList<IDOMCandidate> candidateList = manager.get(stmt.getSubject().toString());
ArrayList<IDOMCandidate> analyzedList = new ArrayList<IDOMCandidate>();
if (candidateList == null) {
return;
}
for (IDOMCandidate candidate : candidateList) {
if (candidate == null) {
continue;
}
candidate.featureSearched();
candidate.matchedPosFeature();
analyzedList.add(candidate);
}
manager.put(stmt.getSubject().toString(), analyzedList);
}
}
| 1,734 | 0.640715 | 0.640138 | 48 | 34.125 | 27.369101 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.520833 | false | false | 15 |
503909c4a9866a67d9e55c00a68ccbdea760e25d | 30,004,641,560,323 | 1f9154b85be84f3f0656aa66630ecdc036c34fbd | /src/main/java/com/fabriccommunity/spookytime/doomtree/treeheart/DoomTreeTracker.java | f1bf0563c48c75c8f5bcde1390e1eac649aa0537 | [
"MIT"
] | permissive | grondag/spooky-time | https://github.com/grondag/spooky-time | 543252f205205a374991be387b249eded9c70025 | 8a4ac7660efca110f2cc5980f20ab6aceeed84bc | refs/heads/master | 2020-08-04T18:16:18.570000 | 2019-10-18T04:05:04 | 2019-10-18T04:05:04 | 212,234,061 | 0 | 0 | MIT | true | 2019-10-02T01:41:40 | 2019-10-02T01:41:39 | 2019-10-02T00:45:06 | 2019-10-02T01:41:15 | 839 | 0 | 0 | 0 | null | false | false | package com.fabriccommunity.spookytime.doomtree.treeheart;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public final class DoomTreeTracker {
private DoomTreeTracker() {}
private static class TreeData {
private final int dimId;
private final long packedPos;
private final int x;
private final int z;
private final BlockPos pos;
TreeData(int dimId, BlockPos pos) {
this.dimId = dimId;
this.pos = pos;
this.packedPos = pos.asLong();
this.x = pos.getX();
this.z = pos.getZ();
}
boolean isNear(BlockPos pos) {
return horizontalDistance(pos) <= LIMIT;
}
int horizontalDistance(BlockPos pos) {
final int dx = pos.getX() - x;
final int dz = pos.getZ() - z;
return dx * dx + dz * dz;
}
}
static final int LIMIT = TreeDesigner.RADIUS * TreeDesigner.RADIUS;
static final int GROW_LIMIT = LIMIT * 4;
// TODO: make configurable
static final int MAX_TREES = 3;
static final ObjectArrayList<TreeData> TREES = new ObjectArrayList<>(MAX_TREES);
public static void clear() {
TREES.clear();
}
static void track(World world, BlockPos pos) {
if (!world.isClient && get(world, pos) == null) {
TREES.add(new TreeData(world.dimension.getType().getRawId(), pos));
}
}
static void untrack(World world, BlockPos pos) {
if (!world.isClient) {
TreeData tree = get(world, pos);
if (tree != null) {
TREES.remove(tree);
}
}
}
private static TreeData get(World world, BlockPos pos) {
final int dim = world.dimension.getType().getRawId();
final long p = pos.asLong();
for (TreeData t : TREES) {
if (t.dimId == dim && t.packedPos == p) {
return t;
}
}
return null;
}
private static TreeData getNear(World world, BlockPos pos) {
final int dim = world.dimension.getType().getRawId();
for (TreeData t : TREES) {
if (t.dimId == dim && t.isNear(pos)) {
return t;
}
}
return null;
}
public static void reportBreak(World world, BlockPos pos, boolean isLog) {
if (world.isClient) return;
TreeData t = getNear(world, pos);
if (t != null) {
BlockEntity be = world.getBlockEntity(t.pos);
if (be != null && be instanceof DoomHeartBlockEntity) {
((DoomHeartBlockEntity) be).reportBreak(pos, isLog);
}
}
}
public static boolean canGrow(World world, BlockPos pos) {
if (TREES.size() >= MAX_TREES || (255 - pos.getY()) < 64) return false;
final int dim = world.dimension.getType().getRawId();
for (TreeData t : TREES) {
if (t.dimId == dim && t.horizontalDistance(pos) < GROW_LIMIT) {
return false;
}
}
return true;
}
}
| UTF-8 | Java | 2,707 | java | DoomTreeTracker.java | Java | [] | null | [] | package com.fabriccommunity.spookytime.doomtree.treeheart;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public final class DoomTreeTracker {
private DoomTreeTracker() {}
private static class TreeData {
private final int dimId;
private final long packedPos;
private final int x;
private final int z;
private final BlockPos pos;
TreeData(int dimId, BlockPos pos) {
this.dimId = dimId;
this.pos = pos;
this.packedPos = pos.asLong();
this.x = pos.getX();
this.z = pos.getZ();
}
boolean isNear(BlockPos pos) {
return horizontalDistance(pos) <= LIMIT;
}
int horizontalDistance(BlockPos pos) {
final int dx = pos.getX() - x;
final int dz = pos.getZ() - z;
return dx * dx + dz * dz;
}
}
static final int LIMIT = TreeDesigner.RADIUS * TreeDesigner.RADIUS;
static final int GROW_LIMIT = LIMIT * 4;
// TODO: make configurable
static final int MAX_TREES = 3;
static final ObjectArrayList<TreeData> TREES = new ObjectArrayList<>(MAX_TREES);
public static void clear() {
TREES.clear();
}
static void track(World world, BlockPos pos) {
if (!world.isClient && get(world, pos) == null) {
TREES.add(new TreeData(world.dimension.getType().getRawId(), pos));
}
}
static void untrack(World world, BlockPos pos) {
if (!world.isClient) {
TreeData tree = get(world, pos);
if (tree != null) {
TREES.remove(tree);
}
}
}
private static TreeData get(World world, BlockPos pos) {
final int dim = world.dimension.getType().getRawId();
final long p = pos.asLong();
for (TreeData t : TREES) {
if (t.dimId == dim && t.packedPos == p) {
return t;
}
}
return null;
}
private static TreeData getNear(World world, BlockPos pos) {
final int dim = world.dimension.getType().getRawId();
for (TreeData t : TREES) {
if (t.dimId == dim && t.isNear(pos)) {
return t;
}
}
return null;
}
public static void reportBreak(World world, BlockPos pos, boolean isLog) {
if (world.isClient) return;
TreeData t = getNear(world, pos);
if (t != null) {
BlockEntity be = world.getBlockEntity(t.pos);
if (be != null && be instanceof DoomHeartBlockEntity) {
((DoomHeartBlockEntity) be).reportBreak(pos, isLog);
}
}
}
public static boolean canGrow(World world, BlockPos pos) {
if (TREES.size() >= MAX_TREES || (255 - pos.getY()) < 64) return false;
final int dim = world.dimension.getType().getRawId();
for (TreeData t : TREES) {
if (t.dimId == dim && t.horizontalDistance(pos) < GROW_LIMIT) {
return false;
}
}
return true;
}
}
| 2,707 | 0.663835 | 0.661249 | 121 | 21.371901 | 22.102739 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.92562 | false | false | 15 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.