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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1e5100ac5c307221df46ddc0178f259c72caa667 | 3,461,743,664,937 | a2efcc5decabcc8f5de5c952779b45dfb0867ef3 | /src/TextOper.java | 56e074e6d7f68d3821720ad92102f3922c4845db | [] | no_license | prubach/CP_summer_2017 | https://github.com/prubach/CP_summer_2017 | 2df981ea8d303f100d0529ed039e37ddfed98ab7 | 065f0ff04c37a9e182c9da480b5d152b87b14f32 | refs/heads/master | 2021-01-18T12:32:53.759000 | 2017-05-31T16:43:48 | 2017-05-31T16:43:48 | 84,332,360 | 0 | 21 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Created by prubac on 3/8/2017.
*/
public class TextOper {
public static void main(String[] args) {
String s1 = "abc";
String s2 = "def";
String s3 = s1 + s2;
int posBC = s3.lastIndexOf("ab");
String s4 = s3.substring(2, 4);
s4 = s3.replace("ab", "AB");
s4 = s4.toUpperCase();
int s4len = s4.length();
System.out.println(s3);
System.out.println(posBC);
System.out.println(s4);
System.out.println(s4len);
char c1 = s4.charAt(4);
System.out.println(c1);
// && - AND
// || - OR
if (s4.contains("F") && (s4.length() < 7)) {
System.out.println("s4 contains F");
} else {
System.out.println("s4 doesn't contain F");
}
}
}
| UTF-8 | Java | 823 | java | TextOper.java | Java | [
{
"context": "/**\n * Created by prubac on 3/8/2017.\n */\npublic class TextOper {\n\n pub",
"end": 24,
"score": 0.9985337853431702,
"start": 18,
"tag": "USERNAME",
"value": "prubac"
}
] | null | [] | /**
* Created by prubac on 3/8/2017.
*/
public class TextOper {
public static void main(String[] args) {
String s1 = "abc";
String s2 = "def";
String s3 = s1 + s2;
int posBC = s3.lastIndexOf("ab");
String s4 = s3.substring(2, 4);
s4 = s3.replace("ab", "AB");
s4 = s4.toUpperCase();
int s4len = s4.length();
System.out.println(s3);
System.out.println(posBC);
System.out.println(s4);
System.out.println(s4len);
char c1 = s4.charAt(4);
System.out.println(c1);
// && - AND
// || - OR
if (s4.contains("F") && (s4.length() < 7)) {
System.out.println("s4 contains F");
} else {
System.out.println("s4 doesn't contain F");
}
}
}
| 823 | 0.482382 | 0.441069 | 42 | 18.595238 | 17.539152 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.47619 | false | false | 9 |
61797569648cb855a7fabf6efcc7c730089b8154 | 8,478,265,458,439 | 602716d84ca5a59e4d3b2cc6edf400cfe5c7845f | /src/main/java/com/woniuxy/oas/util/TimeUtils.java | e3b8aec076aeaa758151736020d9b8be5116da94 | [] | no_license | shihaoH/woniuoas | https://github.com/shihaoH/woniuoas | 8c24d37a5f17c7b2dc10cdb8bc56a1cd12fdaa94 | 951466d03d662d619d7c0587140e453e0427b03c | refs/heads/master | 2021-06-20T22:45:35.256000 | 2021-04-25T11:09:50 | 2021-04-25T11:09:50 | 208,551,284 | 0 | 0 | null | false | 2021-04-25T11:09:51 | 2019-09-15T06:20:39 | 2019-09-17T04:12:20 | 2021-04-25T11:09:50 | 6,192 | 0 | 0 | 0 | Java | false | false | package com.woniuxy.oas.util;
import java.util.Date;
public class TimeUtils {
private static final long ONE_DAY_MILL = 24 * 60 * 60 * 1000;
private static final long ONE_HOUR_MILL = 60 * 60 * 1000L;
private static final String DATE_RANGE_REG = "^\\d{4}(\\-|\\/|.)\\d{1,2}\\1\\d{1,2} - \\d{4}(\\-|\\/|.)\\d{1,2}\\1\\d{1,2}$";
public static boolean inDateScope(Date nowTime, Date beginTime) {
if(nowTime == null || beginTime == null)
return false;
long start = beginTime.getTime() - ONE_HOUR_MILL;
long end = beginTime.getTime() + ONE_HOUR_MILL;
long now = nowTime.getTime() % ONE_DAY_MILL;
return now >= start && now <= end;
}
public static int getHours(Date beginTime, Date endTime){
if (beginTime == null || endTime == null || !beginTime.before(endTime))
return -1;
long begin = beginTime.getTime();
long end = endTime.getTime();
long diffMill = end - begin;
long hour = diffMill / ONE_HOUR_MILL;
return (int) hour;
}
public static boolean isLayout(String dateRange){
if (dateRange == null || dateRange == "")
return false;
return dateRange.matches(DATE_RANGE_REG);
}
}
| UTF-8 | Java | 1,258 | java | TimeUtils.java | Java | [] | null | [] | package com.woniuxy.oas.util;
import java.util.Date;
public class TimeUtils {
private static final long ONE_DAY_MILL = 24 * 60 * 60 * 1000;
private static final long ONE_HOUR_MILL = 60 * 60 * 1000L;
private static final String DATE_RANGE_REG = "^\\d{4}(\\-|\\/|.)\\d{1,2}\\1\\d{1,2} - \\d{4}(\\-|\\/|.)\\d{1,2}\\1\\d{1,2}$";
public static boolean inDateScope(Date nowTime, Date beginTime) {
if(nowTime == null || beginTime == null)
return false;
long start = beginTime.getTime() - ONE_HOUR_MILL;
long end = beginTime.getTime() + ONE_HOUR_MILL;
long now = nowTime.getTime() % ONE_DAY_MILL;
return now >= start && now <= end;
}
public static int getHours(Date beginTime, Date endTime){
if (beginTime == null || endTime == null || !beginTime.before(endTime))
return -1;
long begin = beginTime.getTime();
long end = endTime.getTime();
long diffMill = end - begin;
long hour = diffMill / ONE_HOUR_MILL;
return (int) hour;
}
public static boolean isLayout(String dateRange){
if (dateRange == null || dateRange == "")
return false;
return dateRange.matches(DATE_RANGE_REG);
}
}
| 1,258 | 0.581081 | 0.556439 | 36 | 33.944443 | 28.56955 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 9 |
cbba2245a58ec283702c7c696826a8e71cb685ca | 7,808,250,571,401 | 6235d3b43a49a6d7fea4344300874e8e6853f020 | /src/main/java/com/mapbox/api/geocoding/v5/models/h.java | e3dd11301a98fd0ca15fb745a027022d1630c5eb | [] | no_license | junges521/src_awe | https://github.com/junges521/src_awe | a12bcfeb6c62bd55afba7147b83f4e3df8797019 | cff4a5e230f3346f493df79744e6f2a6f20a47e2 | refs/heads/master | 2020-07-13T19:37:36.253000 | 2019-08-29T10:47:51 | 2019-08-29T10:47:51 | 205,140,726 | 0 | 0 | null | true | 2019-08-29T10:41:58 | 2019-08-29T10:41:58 | 2019-08-29T08:24:29 | 2019-08-23T11:31:27 | 177,015 | 0 | 0 | 0 | null | false | false | package com.mapbox.api.geocoding.v5.models;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.google.auto.value.AutoValue;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.SerializedName;
import com.mapbox.api.geocoding.v5.models.b;
import com.mapbox.api.geocoding.v5.models.e;
import com.mapbox.geojson.BoundingBox;
import com.mapbox.geojson.GeoJson;
import com.mapbox.geojson.Geometry;
import com.mapbox.geojson.Point;
import com.mapbox.geojson.gson.BoundingBoxDeserializer;
import com.mapbox.geojson.gson.BoundingBoxSerializer;
import com.mapbox.geojson.gson.GeometryDeserializer;
import com.mapbox.geojson.gson.GeometryTypeAdapter;
import com.mapbox.geojson.gson.PointDeserializer;
import java.io.Serializable;
import java.lang.reflect.Type;
import java.util.List;
@AutoValue
public abstract class h implements GeoJson, Serializable {
@AutoValue.Builder
public static abstract class a {
public abstract a a(@Nullable JsonObject jsonObject);
public abstract h a();
}
/* access modifiers changed from: package-private */
@Nullable
@SerializedName("center")
public abstract double[] a();
@Nullable
public abstract String address();
@Nullable
public abstract BoundingBox bbox();
@Nullable
public abstract List<g> context();
@Nullable
public abstract Geometry geometry();
@Nullable
public abstract String id();
@Nullable
public abstract String language();
@Nullable
@SerializedName("matching_place_name")
public abstract String matchingPlaceName();
@Nullable
@SerializedName("matching_text")
public abstract String matchingText();
@Nullable
@SerializedName("place_name")
public abstract String placeName();
@Nullable
@SerializedName("place_type")
public abstract List<String> placeType();
@Nullable
public abstract JsonObject properties();
@Nullable
public abstract Double relevance();
@Nullable
public abstract String text();
public abstract a toBuilder();
@SerializedName("type")
@NonNull
public abstract String type();
@NonNull
public static a builder() {
b.a aVar = new b.a();
aVar.f26304a = "Feature";
return aVar.a(new JsonObject());
}
@Nullable
public Point center() {
double[] a2 = a();
if (a2 == null || a2.length != 2) {
return null;
}
return Point.fromLngLat(a2[0], a2[1]);
}
public String toJson() {
h hVar;
Gson create = new GsonBuilder().registerTypeAdapter(Geometry.class, new GeometryTypeAdapter()).registerTypeAdapter(BoundingBox.class, new BoundingBoxSerializer()).registerTypeAdapterFactory(GeocodingAdapterFactory.a()).create();
if (properties() == null || properties().size() != 0) {
hVar = this;
} else {
hVar = toBuilder().a(null).a();
}
return create.toJson((Object) hVar, (Type) h.class);
}
public static TypeAdapter<h> typeAdapter(Gson gson) {
return new e.a(gson);
}
@NonNull
public static h fromJson(@NonNull String str) {
h hVar = (h) new GsonBuilder().registerTypeAdapter(Point.class, new PointDeserializer()).registerTypeAdapter(Geometry.class, new GeometryDeserializer()).registerTypeAdapter(BoundingBox.class, new BoundingBoxDeserializer()).registerTypeAdapterFactory(GeocodingAdapterFactory.a()).create().fromJson(str, h.class);
if (hVar.properties() == null) {
return hVar.toBuilder().a(new JsonObject()).a();
}
return hVar;
}
}
| UTF-8 | Java | 3,782 | java | h.java | Java | [] | null | [] | package com.mapbox.api.geocoding.v5.models;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.google.auto.value.AutoValue;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.SerializedName;
import com.mapbox.api.geocoding.v5.models.b;
import com.mapbox.api.geocoding.v5.models.e;
import com.mapbox.geojson.BoundingBox;
import com.mapbox.geojson.GeoJson;
import com.mapbox.geojson.Geometry;
import com.mapbox.geojson.Point;
import com.mapbox.geojson.gson.BoundingBoxDeserializer;
import com.mapbox.geojson.gson.BoundingBoxSerializer;
import com.mapbox.geojson.gson.GeometryDeserializer;
import com.mapbox.geojson.gson.GeometryTypeAdapter;
import com.mapbox.geojson.gson.PointDeserializer;
import java.io.Serializable;
import java.lang.reflect.Type;
import java.util.List;
@AutoValue
public abstract class h implements GeoJson, Serializable {
@AutoValue.Builder
public static abstract class a {
public abstract a a(@Nullable JsonObject jsonObject);
public abstract h a();
}
/* access modifiers changed from: package-private */
@Nullable
@SerializedName("center")
public abstract double[] a();
@Nullable
public abstract String address();
@Nullable
public abstract BoundingBox bbox();
@Nullable
public abstract List<g> context();
@Nullable
public abstract Geometry geometry();
@Nullable
public abstract String id();
@Nullable
public abstract String language();
@Nullable
@SerializedName("matching_place_name")
public abstract String matchingPlaceName();
@Nullable
@SerializedName("matching_text")
public abstract String matchingText();
@Nullable
@SerializedName("place_name")
public abstract String placeName();
@Nullable
@SerializedName("place_type")
public abstract List<String> placeType();
@Nullable
public abstract JsonObject properties();
@Nullable
public abstract Double relevance();
@Nullable
public abstract String text();
public abstract a toBuilder();
@SerializedName("type")
@NonNull
public abstract String type();
@NonNull
public static a builder() {
b.a aVar = new b.a();
aVar.f26304a = "Feature";
return aVar.a(new JsonObject());
}
@Nullable
public Point center() {
double[] a2 = a();
if (a2 == null || a2.length != 2) {
return null;
}
return Point.fromLngLat(a2[0], a2[1]);
}
public String toJson() {
h hVar;
Gson create = new GsonBuilder().registerTypeAdapter(Geometry.class, new GeometryTypeAdapter()).registerTypeAdapter(BoundingBox.class, new BoundingBoxSerializer()).registerTypeAdapterFactory(GeocodingAdapterFactory.a()).create();
if (properties() == null || properties().size() != 0) {
hVar = this;
} else {
hVar = toBuilder().a(null).a();
}
return create.toJson((Object) hVar, (Type) h.class);
}
public static TypeAdapter<h> typeAdapter(Gson gson) {
return new e.a(gson);
}
@NonNull
public static h fromJson(@NonNull String str) {
h hVar = (h) new GsonBuilder().registerTypeAdapter(Point.class, new PointDeserializer()).registerTypeAdapter(Geometry.class, new GeometryDeserializer()).registerTypeAdapter(BoundingBox.class, new BoundingBoxDeserializer()).registerTypeAdapterFactory(GeocodingAdapterFactory.a()).create().fromJson(str, h.class);
if (hVar.properties() == null) {
return hVar.toBuilder().a(new JsonObject()).a();
}
return hVar;
}
}
| 3,782 | 0.688789 | 0.684294 | 129 | 28.317829 | 36.663773 | 319 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.534884 | false | false | 9 |
fdb3820cb1609ea7bc43f2bfeb2509e178b2f487 | 14,096,082,698,524 | 9edc28892e6ca4f047f7a69fe84cd5a839985f3f | /OpenLibrary/src/DTO/UserBookComment.java | 562f59b83c483adb2639779e72bcb637c47f7d19 | [] | no_license | bhvora123/Open-Library | https://github.com/bhvora123/Open-Library | dfc74878685cab319957581d548078e8fc0b6c62 | c52846d0a3e8f47560aea41e4079794485bec3ad | refs/heads/master | 2022-04-15T10:52:12.370000 | 2020-03-26T14:07:23 | 2020-03-26T14:07:23 | 250,275,508 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package DTO;
import javax.persistence.Embeddable;
@Embeddable
public class UserBookComment {
private int user;
private int book;
public int getUser() {
return user;
}
public void setUser(int user) {
this.user = user;
}
public int getBook() {
return book;
}
public void setBook(int book) {
this.book = book;
}
}
| UTF-8 | Java | 342 | java | UserBookComment.java | Java | [] | null | [] | package DTO;
import javax.persistence.Embeddable;
@Embeddable
public class UserBookComment {
private int user;
private int book;
public int getUser() {
return user;
}
public void setUser(int user) {
this.user = user;
}
public int getBook() {
return book;
}
public void setBook(int book) {
this.book = book;
}
}
| 342 | 0.672515 | 0.672515 | 29 | 10.793103 | 11.701398 | 36 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 9 |
8975cfae13b4756d8aed98cb68b91484fdab6e77 | 26,001,732,040,763 | 4c0c1b97bf6437ea38ca8eac2a69e9f8247783ee | /Biblioteca/src/java/com/biblioteca/servlets/cms/cmsdeletebook.java | 714da76c17a369c111d11fd59f105ef3443aafda | [] | no_license | vassea3/Project_OnlineLibrary_JSP_Servlet | https://github.com/vassea3/Project_OnlineLibrary_JSP_Servlet | 4820993b6cc1f5451a7c89bf15a4acc959b9869e | cc7eb2c5a6cffc6d98355afd1c6931bd82b4baca | refs/heads/master | 2021-01-17T04:55:05.030000 | 2017-02-24T11:45:12 | 2017-02-24T11:45:12 | 83,036,648 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.biblioteca.servlets.cms;
import com.biblioteca.dao.impl.DeleteFile;
import com.biblioteca.dao.impl.MyBookDaoImpl;
import com.biblioteca.dao.intf.MyBookDaoIntf;
import com.biblioteca.entitati.MyBook;
import java.io.File;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
@WebServlet(name = "cmsdeletebook", urlPatterns = {"/cmsdeletebook"})
public class cmsdeletebook extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String page = null;
if (request.getSession().getAttribute("ONLINEUSER") == null) {
page = "/cmsshowlogin";
} else {
page = "cmslistabooks";
DataSource ds = (DataSource) request.getServletContext().getAttribute("dataSource");
MyBookDaoIntf bookDao = new MyBookDaoImpl(ds);
int bookId = Integer.parseInt(request.getParameter("bookId"));
MyBook book = bookDao.findById(bookId);
if (book != null) {
File imageFile = new File("C:\\Users\\Taniusha\\Documents\\NetBeansProjects\\Biblioteca\\web\\resources\\images/" + book.getBookImageName());
DeleteFile.DeleteFile(imageFile);
File bookFile = new File("C:\\Users\\Taniusha\\Documents\\NetBeansProjects\\Biblioteca\\web\\resources\\bookFiles/" + book.getFileName());
DeleteFile.DeleteFile(bookFile);
bookDao.delete(book);
}
request.setAttribute("bookName", book.getBookName() + " was deleted");
}
RequestDispatcher rd= request.getRequestDispatcher(page);
rd.forward(request, response);
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| UTF-8 | Java | 3,277 | java | cmsdeletebook.java | Java | [] | null | [] | package com.biblioteca.servlets.cms;
import com.biblioteca.dao.impl.DeleteFile;
import com.biblioteca.dao.impl.MyBookDaoImpl;
import com.biblioteca.dao.intf.MyBookDaoIntf;
import com.biblioteca.entitati.MyBook;
import java.io.File;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
@WebServlet(name = "cmsdeletebook", urlPatterns = {"/cmsdeletebook"})
public class cmsdeletebook extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String page = null;
if (request.getSession().getAttribute("ONLINEUSER") == null) {
page = "/cmsshowlogin";
} else {
page = "cmslistabooks";
DataSource ds = (DataSource) request.getServletContext().getAttribute("dataSource");
MyBookDaoIntf bookDao = new MyBookDaoImpl(ds);
int bookId = Integer.parseInt(request.getParameter("bookId"));
MyBook book = bookDao.findById(bookId);
if (book != null) {
File imageFile = new File("C:\\Users\\Taniusha\\Documents\\NetBeansProjects\\Biblioteca\\web\\resources\\images/" + book.getBookImageName());
DeleteFile.DeleteFile(imageFile);
File bookFile = new File("C:\\Users\\Taniusha\\Documents\\NetBeansProjects\\Biblioteca\\web\\resources\\bookFiles/" + book.getFileName());
DeleteFile.DeleteFile(bookFile);
bookDao.delete(book);
}
request.setAttribute("bookName", book.getBookName() + " was deleted");
}
RequestDispatcher rd= request.getRequestDispatcher(page);
rd.forward(request, response);
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| 3,277 | 0.67867 | 0.67867 | 82 | 38.963413 | 31.606747 | 157 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.52439 | false | false | 9 |
4a36470e43cfb23f6c7b68b593edd77cb2296172 | 30,657,476,588,434 | 78db8c48d9435ef82afa1a375e9f0b400467fc52 | /src/com/github/beisser/challenges/array/MineSweeper.java | 212d878f38a4d1c46fc3a4cc32237f1e1779ec9f | [] | no_license | beisser/clean_code_java | https://github.com/beisser/clean_code_java | 10dc7c4bcb7085225df320a9d9d56ca399aeb096 | a1c05889e6add2b2075ffa3a23d90c420f9a409e | refs/heads/master | 2020-03-22T14:40:48.500000 | 2018-12-01T11:18:50 | 2018-12-01T11:18:50 | 140,196,881 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.github.beisser.challenges.array;
// Gegeben: Mine Sweeper Feld (zweidimensionales Array) und Bomben-Orte
// Ziel: Bomben Orte in das 2D Array packen und Felder um die Bombe entsprechend kennzeichnen
// Default Feld-Wert: 0, Bomben-Feld -1, An Bombe angrenzendes Feld 1
class MineSweeper {
public static void main(String[] args) {
int[][] bombs1 = {{0, 2}, {2, 0}};
int[][] field = mineSweeper(bombs1, 5, 5);
for(int i = 0; i < 5; i++) {
StringBuilder stringBuilder = new StringBuilder();
for(int j = 0; j < 5; j++) {
stringBuilder.append(field[i][j] + " ");
}
System.out.println(stringBuilder.toString());
}
}
private static int[][] mineSweeper(int[][] bombs, int rows, int columns) {
int[][] field = new int[rows][columns];
for(int[] bomb: bombs) {
int bombRowIndex = bomb[0];
int bombColIndex = bomb[1];
field[bombRowIndex][bombColIndex] = -1;
for(int i = bombRowIndex -1; i < bombRowIndex + 2; i++) {
for(int j = bombColIndex -1; j < bombColIndex + 2; j++) {
if(i >= 0 && i < rows && j >= 0 && j < columns && field[i][j] != -1) {
field[i][j] = 1;
}
}
}
}
return field;
}
}
| UTF-8 | Java | 1,403 | java | MineSweeper.java | Java | [] | null | [] | package com.github.beisser.challenges.array;
// Gegeben: Mine Sweeper Feld (zweidimensionales Array) und Bomben-Orte
// Ziel: Bomben Orte in das 2D Array packen und Felder um die Bombe entsprechend kennzeichnen
// Default Feld-Wert: 0, Bomben-Feld -1, An Bombe angrenzendes Feld 1
class MineSweeper {
public static void main(String[] args) {
int[][] bombs1 = {{0, 2}, {2, 0}};
int[][] field = mineSweeper(bombs1, 5, 5);
for(int i = 0; i < 5; i++) {
StringBuilder stringBuilder = new StringBuilder();
for(int j = 0; j < 5; j++) {
stringBuilder.append(field[i][j] + " ");
}
System.out.println(stringBuilder.toString());
}
}
private static int[][] mineSweeper(int[][] bombs, int rows, int columns) {
int[][] field = new int[rows][columns];
for(int[] bomb: bombs) {
int bombRowIndex = bomb[0];
int bombColIndex = bomb[1];
field[bombRowIndex][bombColIndex] = -1;
for(int i = bombRowIndex -1; i < bombRowIndex + 2; i++) {
for(int j = bombColIndex -1; j < bombColIndex + 2; j++) {
if(i >= 0 && i < rows && j >= 0 && j < columns && field[i][j] != -1) {
field[i][j] = 1;
}
}
}
}
return field;
}
}
| 1,403 | 0.507484 | 0.488239 | 48 | 28.229166 | 28.245382 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.604167 | false | false | 9 |
2b0826e3cccfcaaf6af96f897fb3ce4b95152a4b | 13,116,830,160,413 | 2b931f6e591c1c2889fb4ad3d862814e3f5fb048 | /src/main/java/com/example/rgbk/old_service/impl/ProjectServiceImplSetterInjection.java | b394f032f8e05a0fdd42514d97647668e6388d2a | [] | no_license | rgbk21/Spring-Basics | https://github.com/rgbk21/Spring-Basics | 47145b88b2cb10c95f61282655cb907b673e02fd | 9390a8d67d5fc85028ac082eba200c393449a36b | refs/heads/master | 2023-01-04T16:40:42.806000 | 2020-10-31T13:51:41 | 2020-10-31T13:51:41 | 305,106,853 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.rgbk.old_service.impl;
import com.example.rgbk.persistence.model.Project;
import com.example.rgbk.persistence.old_repository.IProjectRepository;
import com.example.rgbk.old_service.IProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import java.util.Optional;
@Service
public class ProjectServiceImplSetterInjection implements IProjectService {
private IProjectRepository projectRepository;
@Autowired
@Qualifier("projectRepositoryImpl")
public void setProjectRepository(IProjectRepository projectRepository) {
this.projectRepository = projectRepository;
}
@Override
public Optional<Project> findById(Long id) {
return projectRepository.findById(id);
}
@Override
public Project save(Project project) {
return projectRepository.save(project);
}
}
| UTF-8 | Java | 981 | java | ProjectServiceImplSetterInjection.java | Java | [] | null | [] | package com.example.rgbk.old_service.impl;
import com.example.rgbk.persistence.model.Project;
import com.example.rgbk.persistence.old_repository.IProjectRepository;
import com.example.rgbk.old_service.IProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import java.util.Optional;
@Service
public class ProjectServiceImplSetterInjection implements IProjectService {
private IProjectRepository projectRepository;
@Autowired
@Qualifier("projectRepositoryImpl")
public void setProjectRepository(IProjectRepository projectRepository) {
this.projectRepository = projectRepository;
}
@Override
public Optional<Project> findById(Long id) {
return projectRepository.findById(id);
}
@Override
public Project save(Project project) {
return projectRepository.save(project);
}
}
| 981 | 0.781855 | 0.781855 | 33 | 28.69697 | 25.915346 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false | 9 |
b570f75c426a7a581e64c40710cfff9f7dc909e3 | 9,113,920,646,360 | 22502f87cab3a49a993b7ba3566d223b3fbaea54 | /app/src/main/java/com/jack/demo/webviewdemo/cloud/bean/dr/AccountCommon.java | a3969e52bd404fd9eb24cf7e013c0b3d844cc679 | [] | no_license | Jaky88/WebViewDemo | https://github.com/Jaky88/WebViewDemo | fe8c9401b59b2e3180ca5b7d0fff1306fb907f6e | fbabb618e5dba87be1cefeecf812001dcc4adc49 | refs/heads/master | 2021-05-04T14:30:42.758000 | 2018-02-12T09:10:37 | 2018-02-12T09:10:37 | 120,203,004 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jack.demo.webviewdemo.cloud.bean.dr;
/**
* Created by jaky on 2018/2/12 0012.
*/
public class AccountCommon {
public String name;
}
| UTF-8 | Java | 152 | java | AccountCommon.java | Java | [
{
"context": "demo.webviewdemo.cloud.bean.dr;\n\n/**\n * Created by jaky on 2018/2/12 0012.\n */\n\npublic class AccountCommo",
"end": 72,
"score": 0.9996650218963623,
"start": 68,
"tag": "USERNAME",
"value": "jaky"
}
] | null | [] | package com.jack.demo.webviewdemo.cloud.bean.dr;
/**
* Created by jaky on 2018/2/12 0012.
*/
public class AccountCommon {
public String name;
}
| 152 | 0.697368 | 0.625 | 9 | 15.888889 | 17.42568 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.222222 | false | false | 9 |
ddf9d94464b4feadfc79b107ea4dbab107d4e181 | 3,178,275,840,836 | 4b53fc17162eb0f24fbc17c5eca65ff2c4a97711 | /TestA.java | cb05908566702270fe237ba5133c71f74c2e2d9e | [] | no_license | RisKakaN/LeetCodePractice | https://github.com/RisKakaN/LeetCodePractice | 9076e025e5a7953145ad1f6d699d16e17836f6f3 | ab1431fab91b3e40b859c1dd6c2db540093e3a65 | refs/heads/master | 2022-11-07T20:51:51.026000 | 2020-06-23T15:12:30 | 2020-06-23T15:12:30 | 274,431,321 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Scanner;
public class TestA {
// ==================================================
// Sample test:
// 3
// ATCCGCTTAGAGGGATT
// GTCCGTTTAGAAGGTTT
// *....*.....*..*..
// abcdefghijklmnopqrstuvwxyz
// bcdefghijklmnopqrstuvwxyza
// **************************
// abcdefghijklmnopqrstuvwxyz0123456789
// abcdefghijklmnopqrstuvwxyz0123456789
// ....................................
// ==================================================
// Loop through the strings together and compare with eachother at same indices.
public String problemA(String s1, String s2) {
// String for storing result.
String result = "";
// Loop through s1 and s2, based on length of one of them. Length is the same so
// it doesn't matter which one to use.
for (int i = 0; i < s1.length(); i++) {
// Make use of charAt in order to check specific character at given index.
// If s1 and s2 characters are the same at same index, append "*" to result.
// Else, append "." to result.
if ((s1.charAt(i) != (s2.charAt(i)))) {
result += "*";
} else {
result += ".";
}
}
return result;
}
public static void main(String[] args) {
TestA test = new TestA();
Scanner sc = new Scanner(System.in);
while (sc.hasNextLine()) {
int testCases = sc.nextInt();
// Make use of String array to store test strings.
String[] testStrings = new String[testCases * 2];
for (int i = 0; i < testStrings.length; i++) {
testStrings[i] = sc.next();
}
// Loop through test strings stored in the array.
// Make sure to increment by two, since the test strings come in pair.
// E.g. Test case 1: Use s1 and s2, which are at indices 0 and 1.
for (int i = 0; i < testStrings.length; i += 2) {
System.out.println(testStrings[i]);
System.out.println(testStrings[i + 1]);
System.out.println(test.problemA(testStrings[i], testStrings[i + 1]));
System.out.println();
}
break;
}
// Close after finished with given input.
sc.close();
}
}
| UTF-8 | Java | 2,384 | java | TestA.java | Java | [] | null | [] | import java.util.Scanner;
public class TestA {
// ==================================================
// Sample test:
// 3
// ATCCGCTTAGAGGGATT
// GTCCGTTTAGAAGGTTT
// *....*.....*..*..
// abcdefghijklmnopqrstuvwxyz
// bcdefghijklmnopqrstuvwxyza
// **************************
// abcdefghijklmnopqrstuvwxyz0123456789
// abcdefghijklmnopqrstuvwxyz0123456789
// ....................................
// ==================================================
// Loop through the strings together and compare with eachother at same indices.
public String problemA(String s1, String s2) {
// String for storing result.
String result = "";
// Loop through s1 and s2, based on length of one of them. Length is the same so
// it doesn't matter which one to use.
for (int i = 0; i < s1.length(); i++) {
// Make use of charAt in order to check specific character at given index.
// If s1 and s2 characters are the same at same index, append "*" to result.
// Else, append "." to result.
if ((s1.charAt(i) != (s2.charAt(i)))) {
result += "*";
} else {
result += ".";
}
}
return result;
}
public static void main(String[] args) {
TestA test = new TestA();
Scanner sc = new Scanner(System.in);
while (sc.hasNextLine()) {
int testCases = sc.nextInt();
// Make use of String array to store test strings.
String[] testStrings = new String[testCases * 2];
for (int i = 0; i < testStrings.length; i++) {
testStrings[i] = sc.next();
}
// Loop through test strings stored in the array.
// Make sure to increment by two, since the test strings come in pair.
// E.g. Test case 1: Use s1 and s2, which are at indices 0 and 1.
for (int i = 0; i < testStrings.length; i += 2) {
System.out.println(testStrings[i]);
System.out.println(testStrings[i + 1]);
System.out.println(test.problemA(testStrings[i], testStrings[i + 1]));
System.out.println();
}
break;
}
// Close after finished with given input.
sc.close();
}
}
| 2,384 | 0.497903 | 0.480285 | 66 | 35.121212 | 25.183878 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.439394 | false | false | 9 |
53db6c56dec77b4a585a66db65b53578fb5239f8 | 12,635,793,828,688 | 174b2e63106970baea851c3739ea282dbe782e40 | /src/edu/rit/bsg/helium/util/HeliumConfig.java | 19670da858e5b7085f840b021fb52bb357d369ec | [] | no_license | lihebi/JHelium | https://github.com/lihebi/JHelium | d74090fb0657d3cf54656fc9e342619af7e7bf9c | 1a07f7a4177586b9fea82aedb538b245275824fe | refs/heads/master | 2019-01-19T23:27:43.230000 | 2015-07-09T22:36:56 | 2015-07-09T22:36:56 | 36,016,606 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* @author Nate Levesque <ngl3477@rit.edu>
* @since Aug 7, 2013
*/
package edu.rit.bsg.helium.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
import java.io.PrintStream;
import java.io.FileOutputStream;
/**
* @author nate
*
*/
public class HeliumConfig {
private static Properties properties;
private static Properties propertiesBak;
private static HeliumConfig instance;
private static String topDirectory = System.getProperty("user.home") + File.separator + ".helium";
public static synchronized HeliumConfig getInstance(){
if ( instance == null ){
instance = new HeliumConfig();
}
return instance;
}
/**
* Initializes the class using an alternate location
* of the configuration file
*
* @param filename - the location of the file
*/
public HeliumConfig( String filename ) {
this.initialize(filename);
properties.put("user-storage", topDirectory);
backup();
}
/**
* Initializes the class using the default
* location of the configuration file
*/
public HeliumConfig(){
this.initialize("");
properties.put("user-storage", topDirectory);
backup();
}
private void backup() {
try {
File f = ResourceManager.getInstance().create("helium_config_backup.conf");
properties.store(new FileOutputStream(f), "");
} catch (IOException e) {
e.printStackTrace();
}
}
public void restore() {
try {
File f = ResourceManager.getInstance().load("helium_config_backup.conf");
properties.load(new FileInputStream(f));
} catch (IOException e) {
e.printStackTrace();
}
}
private void initialize( String filename ){
File f = new File( filename );
if ( ! f.exists() ){
filename = topDirectory + File.separator + "he.conf" ;
}
properties = new Properties();
try {
properties.load(new FileInputStream(filename));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
properties.setProperty("working_files", topDirectory + File.separator + "IntermediaryFiles");
}
public void list(PrintStream out) {
this.properties.list(out);
}
/**
* Returns the compiler that compiles the selected language
* @param language - the language
* @return
*/
public String getCompiler( String language ){
return properties.getProperty(language.toLowerCase());
}
/**
* Returns the utility that provides
* the requested functionality name
* @param name - the name of the functionality
* @return
*/
public String getUtility( String name ){
return properties.getProperty(name.toLowerCase());
}
public String getProperty( String name ){
return properties.getProperty(name.toLowerCase());
}
public void update(String name, String value) {
properties.setProperty(name, value);
}
}
| UTF-8 | Java | 3,089 | java | HeliumConfig.java | Java | [
{
"context": "/**\r\n * @author Nate Levesque <ngl3477@rit.edu>\r\n * @since Aug 7, 2013\r\n */\r\npa",
"end": 29,
"score": 0.9998752474784851,
"start": 16,
"tag": "NAME",
"value": "Nate Levesque"
},
{
"context": "/**\r\n * @author Nate Levesque <ngl3477@rit.edu>\r\n * @since Aug 7, 2013\r\n */\r\npackage edu.rit.bsg",
"end": 46,
"score": 0.9999282956123352,
"start": 31,
"tag": "EMAIL",
"value": "ngl3477@rit.edu"
},
{
"context": "mport java.io.FileOutputStream;\r\n\r\n/**\r\n * @author nate\r\n *\r\n */\r\npublic class HeliumConfig {\r\n\r\n\tprivate",
"end": 355,
"score": 0.9984786510467529,
"start": 351,
"tag": "USERNAME",
"value": "nate"
}
] | null | [] | /**
* @author <NAME> <<EMAIL>>
* @since Aug 7, 2013
*/
package edu.rit.bsg.helium.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
import java.io.PrintStream;
import java.io.FileOutputStream;
/**
* @author nate
*
*/
public class HeliumConfig {
private static Properties properties;
private static Properties propertiesBak;
private static HeliumConfig instance;
private static String topDirectory = System.getProperty("user.home") + File.separator + ".helium";
public static synchronized HeliumConfig getInstance(){
if ( instance == null ){
instance = new HeliumConfig();
}
return instance;
}
/**
* Initializes the class using an alternate location
* of the configuration file
*
* @param filename - the location of the file
*/
public HeliumConfig( String filename ) {
this.initialize(filename);
properties.put("user-storage", topDirectory);
backup();
}
/**
* Initializes the class using the default
* location of the configuration file
*/
public HeliumConfig(){
this.initialize("");
properties.put("user-storage", topDirectory);
backup();
}
private void backup() {
try {
File f = ResourceManager.getInstance().create("helium_config_backup.conf");
properties.store(new FileOutputStream(f), "");
} catch (IOException e) {
e.printStackTrace();
}
}
public void restore() {
try {
File f = ResourceManager.getInstance().load("helium_config_backup.conf");
properties.load(new FileInputStream(f));
} catch (IOException e) {
e.printStackTrace();
}
}
private void initialize( String filename ){
File f = new File( filename );
if ( ! f.exists() ){
filename = topDirectory + File.separator + "he.conf" ;
}
properties = new Properties();
try {
properties.load(new FileInputStream(filename));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
properties.setProperty("working_files", topDirectory + File.separator + "IntermediaryFiles");
}
public void list(PrintStream out) {
this.properties.list(out);
}
/**
* Returns the compiler that compiles the selected language
* @param language - the language
* @return
*/
public String getCompiler( String language ){
return properties.getProperty(language.toLowerCase());
}
/**
* Returns the utility that provides
* the requested functionality name
* @param name - the name of the functionality
* @return
*/
public String getUtility( String name ){
return properties.getProperty(name.toLowerCase());
}
public String getProperty( String name ){
return properties.getProperty(name.toLowerCase());
}
public void update(String name, String value) {
properties.setProperty(name, value);
}
}
| 3,074 | 0.671091 | 0.668177 | 135 | 20.881481 | 21.62442 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.4 | false | false | 9 |
d27495c1374658603a8f5425d6834bed945eea79 | 26,018,911,884,565 | 5957535824d463db27bd334c7dcc30e89e858fbd | /src/main/java/com/roxx/learning/servicemix/service/UserService.java | e699dbec2bcf123b462bc57c58b00af79c8273e9 | [] | no_license | jmoutsinga/servicemixdiscovery | https://github.com/jmoutsinga/servicemixdiscovery | eec030512170f456fd70bca1fab92e7678ca369e | 6ebd1b5fde520a1460cad036dcfc03afbf1503ca | refs/heads/master | 2021-01-20T20:53:35.852000 | 2016-07-18T20:59:53 | 2016-07-18T20:59:53 | 63,636,115 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.roxx.learning.servicemix.service;
import java.util.List;
import com.roxx.learning.servicemix.domain.User;
/**
* @author julien
*
*/
public interface UserService {
public User getUserByExactName(String name) throws NoUserMatchingException;
public User getUserById(Long userId) throws UserNotExistException;
public List<User> findUsersByName(String name);
}
| UTF-8 | Java | 381 | java | UserService.java | Java | [
{
"context": "x.learning.servicemix.domain.User;\n\n/**\n * @author julien\n *\n */\npublic interface UserService {\n\n\tpublic Us",
"end": 142,
"score": 0.9956970810890198,
"start": 136,
"tag": "USERNAME",
"value": "julien"
}
] | null | [] | package com.roxx.learning.servicemix.service;
import java.util.List;
import com.roxx.learning.servicemix.domain.User;
/**
* @author julien
*
*/
public interface UserService {
public User getUserByExactName(String name) throws NoUserMatchingException;
public User getUserById(Long userId) throws UserNotExistException;
public List<User> findUsersByName(String name);
}
| 381 | 0.787402 | 0.787402 | 19 | 19.052631 | 24.811869 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.473684 | false | false | 9 |
07573623e45629baad3a05f20f9f67cd63c104a7 | 12,412,455,523,355 | 6d8578834fc7d538a2c3cfc474473996a6c80ed3 | /rpc-core/src/main/java/com/zyx/rpc/RpcServer.java | b9212a6375d5bf8a9b007b73e8fb69b6d4e76de6 | [] | no_license | zyxplus/RPCframe | https://github.com/zyxplus/RPCframe | b2b10bd1b80ac69b9f11eb3c7e7e3cce4e61e429 | 9f262d01f914c324b66d732a20e19b35aecf7f08 | refs/heads/master | 2023-01-24T13:25:41.816000 | 2020-12-07T14:43:37 | 2020-12-07T14:43:37 | 319,207,336 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.zyx.rpc;
import com.zyx.rpc.serializer.CommonSerializer;
public interface RpcServer {
void start(int port);
void setSerializer(CommonSerializer serializer);
}
| UTF-8 | Java | 182 | java | RpcServer.java | Java | [] | null | [] | package com.zyx.rpc;
import com.zyx.rpc.serializer.CommonSerializer;
public interface RpcServer {
void start(int port);
void setSerializer(CommonSerializer serializer);
}
| 182 | 0.769231 | 0.769231 | 9 | 19.222221 | 19.429518 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 9 |
939385ed88352a099e13fd34bfa05185d6e9dfd3 | 33,311,766,392,908 | 86a042a0879c73a2f175bc2fd7b9797c81cabf0a | /Modulo 1/Aritmetica.java | 118f11732f4e7f278466ddea0435f90b458a1c5d | [] | no_license | JoJDev/Curso_Java_Uaemex | https://github.com/JoJDev/Curso_Java_Uaemex | c34c2c25602e682b4796d288205f7a1c4ec79a9c | f6492016225168525eb637a183a074b1074728ea | refs/heads/master | 2022-03-27T08:28:03.180000 | 2020-01-20T15:27:26 | 2020-01-20T15:27:26 | 233,323,182 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | //Aritmetica.java
//Programa que muestras algunas de las operaiones aritmeticas
import java.util.Scanner;
public class Aritmetica{
public static void main(String[] args) {
int i, j, suma, resta, mult, div, mod;
Scanner input = new Scanner(System.in);
System.out.println("Ingresa el primer numero: ");
i = input.nextInt();
System.out.println("Ingresa el segundo numero: ");
j = input.nextInt();
suma = i + j;
resta = i - j;
mult = i * j;
div = i / j;
mod = i % j;
System.out.println("El resultado de la suma es: " + suma);
System.out.println("El resultado de la resta es: " + resta);
System.out.println("El resultado de la multiplicacion es: " + mult);
System.out.println("El resultado de la divicion es: " + div);
System.out.println("El residuo de la divicion es: " + mod);
}
} | UTF-8 | Java | 846 | java | Aritmetica.java | Java | [] | null | [] | //Aritmetica.java
//Programa que muestras algunas de las operaiones aritmeticas
import java.util.Scanner;
public class Aritmetica{
public static void main(String[] args) {
int i, j, suma, resta, mult, div, mod;
Scanner input = new Scanner(System.in);
System.out.println("Ingresa el primer numero: ");
i = input.nextInt();
System.out.println("Ingresa el segundo numero: ");
j = input.nextInt();
suma = i + j;
resta = i - j;
mult = i * j;
div = i / j;
mod = i % j;
System.out.println("El resultado de la suma es: " + suma);
System.out.println("El resultado de la resta es: " + resta);
System.out.println("El resultado de la multiplicacion es: " + mult);
System.out.println("El resultado de la divicion es: " + div);
System.out.println("El residuo de la divicion es: " + mod);
}
} | 846 | 0.641844 | 0.641844 | 29 | 27.241379 | 23.555738 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.965517 | false | false | 9 |
c122e43b0d07858416e5838335c05ace67aa0b30 | 12,378,095,787,973 | 4f9e893cedd8f25557239f939edee6bcb1246715 | /jinghua/dmm_personal/src/main/java/cn/gilight/personal/student/course/dao/CourseDao.java | 2390a7ba81f4e2c2fb6403781b966d17e5c42e61 | [] | no_license | yangtie34/projects | https://github.com/yangtie34/projects | cc9ba22c1fd235dadfe18509bc6951e21e9d3be4 | 5a3a86116e385db1086f8f6e9eb07198432fec27 | refs/heads/master | 2020-06-29T11:04:26.615000 | 2017-07-25T03:28:15 | 2017-07-25T03:28:15 | 74,436,105 | 1 | 4 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.gilight.personal.student.course.dao;
import java.util.List;
import java.util.Map;
public interface CourseDao {
/**
* 查今日课程
* @param stu_id
* @param school_year
* @param term_code
* @param zc
* @param week
* @return
*/
public List<Map<String, Object>> getTodayCourse(String stu_id,String school_year,String term_code,int zc,int week);
/**
* 查课程表
* @param stu_id
* @param school_year
* @param term_code
* @param zc
* @param jc
* @return
*/
public List<Map<String, Object>> getSchedule(String stu_id,String school_year,String term_code,int zc,int jc);
/**
* 查空教室
* @param school_year
* @param term_code
* @param zc
* @param week
* @param period_start
* @param period_end
* @return
*/
public List<Map<String,Object>> getEmptyClassroom(String school_year,String term_code,int zc,int week,int period_start,int period_end);
}
| UTF-8 | Java | 919 | java | CourseDao.java | Java | [] | null | [] | package cn.gilight.personal.student.course.dao;
import java.util.List;
import java.util.Map;
public interface CourseDao {
/**
* 查今日课程
* @param stu_id
* @param school_year
* @param term_code
* @param zc
* @param week
* @return
*/
public List<Map<String, Object>> getTodayCourse(String stu_id,String school_year,String term_code,int zc,int week);
/**
* 查课程表
* @param stu_id
* @param school_year
* @param term_code
* @param zc
* @param jc
* @return
*/
public List<Map<String, Object>> getSchedule(String stu_id,String school_year,String term_code,int zc,int jc);
/**
* 查空教室
* @param school_year
* @param term_code
* @param zc
* @param week
* @param period_start
* @param period_end
* @return
*/
public List<Map<String,Object>> getEmptyClassroom(String school_year,String term_code,int zc,int week,int period_start,int period_end);
}
| 919 | 0.670773 | 0.670773 | 42 | 20.261906 | 29.658421 | 136 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.285714 | false | false | 9 |
2f9bacd40eb4fcc86a125699d8913061044efd4a | 32,126,355,412,771 | 1f742409cbab86f55d310ab282359fccf5f907c0 | /shoppingapplication/model/UsersInfoDTO.java | 9d4fcf9e6e6eb5157556e0ecf1e14de52b933539 | [] | no_license | sriramselvaraj21/Java | https://github.com/sriramselvaraj21/Java | fc675550a4476b9e5975c69db7218253ae920897 | 6b9df408fcc439308148c54a5b4cad55adafe5af | refs/heads/main | 2023-04-25T10:48:30.105000 | 2021-04-27T05:35:35 | 2021-04-27T05:35:35 | 353,292,828 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package shoppingapplication.model;
import java.io.Serializable;
public class UsersInfoDTO implements Serializable {
public UsersInfoDTO() {
// TODO Auto-generated constructor stub
}
public UsersInfoDTO(int customerNumber, String customerUsername, String customerPassword, int customerFlag) {
this.customerNumber = customerNumber;
this.customerUsername = customerUsername;
this.customerPassword = customerPassword;
this.customerFlag = customerFlag;
}
private static final long serialVersionUID = 1L;
private int customerNumber;
private String customerUsername;
private String customerPassword;
private int customerFlag;
public int getCustomerNumber() {
return customerNumber;
}
public void setCustomerNumber(int customerNumber) {
this.customerNumber = customerNumber;
}
public String getCustomerUsername() {
return customerUsername;
}
public void setCustomerUsername(String customerUsername) {
this.customerUsername = customerUsername;
}
public String getCustomerPassword() {
return customerPassword;
}
public void setCustomerPassword(String customerPassword) {
this.customerPassword = customerPassword;
}
public int getCustomerFlag() {
return customerFlag;
}
public void setCustomerFlag(int customerFlag) {
this.customerFlag = customerFlag;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
@Override
public String toString() {
return "UsersInfoDTO [customerNumber=" + customerNumber + ", customerUsername=" + customerUsername
+ ", customerPassword=" + customerPassword + ", customerFlag=" + customerFlag + "]";
}
}
| UTF-8 | Java | 1,619 | java | UsersInfoDTO.java | Java | [
{
"context": "Number = customerNumber;\n\t\tthis.customerUsername = customerUsername;\n\t\tthis.customerPassword = customerPassword;\n\t\tth",
"end": 384,
"score": 0.9959844350814819,
"start": 368,
"tag": "USERNAME",
"value": "customerUsername"
},
{
"context": "name = customerUsername;\n\t\tthis.customerPassword = customerPassword;\n\t\tthis.customerFlag = customerFlag;\n\n\t}\n\n\tprivat",
"end": 428,
"score": 0.9863081574440002,
"start": 412,
"tag": "PASSWORD",
"value": "customerPassword"
},
{
"context": "}\n\n\tpublic String getCustomerUsername() {\n\t\treturn customerUsername;\n\t}\n\n\tpublic void setCustomerUsername(String cust",
"end": 870,
"score": 0.9550015330314636,
"start": 854,
"tag": "USERNAME",
"value": "customerUsername"
},
{
"context": "rname;\n\t}\n\n\tpublic void setCustomerUsername(String customerUsername) {\n\t\tthis.customerUsername = customerUser",
"end": 924,
"score": 0.8106608986854553,
"start": 916,
"tag": "USERNAME",
"value": "customer"
},
{
"context": "ustomerUsername(String customerUsername) {\n\t\tthis.customerUsername = customerUsername;\n\t}\n\n\tpublic String ge",
"end": 951,
"score": 0.5376676917076111,
"start": 943,
"tag": "USERNAME",
"value": "customer"
},
{
"context": "ring customerUsername) {\n\t\tthis.customerUsername = customerUsername;\n\t}\n\n\tpublic String getCustomerPassword() {\n\t\tret",
"end": 978,
"score": 0.9653072357177734,
"start": 962,
"tag": "USERNAME",
"value": "customerUsername"
},
{
"context": "ring customerPassword) {\n\t\tthis.customerPassword = customerPassword;\n\t}\n\n\tpublic int getCustomerFlag() {\n\t\treturn cus",
"end": 1156,
"score": 0.9947800636291504,
"start": 1140,
"tag": "PASSWORD",
"value": "customerPassword"
},
{
"context": "umber=\" + customerNumber + \", customerUsername=\" + customerUsername\n\t\t\t\t+ \", customerPassword=\" + customerPassword + ",
"end": 1524,
"score": 0.954457700252533,
"start": 1508,
"tag": "USERNAME",
"value": "customerUsername"
}
] | null | [] | package shoppingapplication.model;
import java.io.Serializable;
public class UsersInfoDTO implements Serializable {
public UsersInfoDTO() {
// TODO Auto-generated constructor stub
}
public UsersInfoDTO(int customerNumber, String customerUsername, String customerPassword, int customerFlag) {
this.customerNumber = customerNumber;
this.customerUsername = customerUsername;
this.customerPassword = <PASSWORD>;
this.customerFlag = customerFlag;
}
private static final long serialVersionUID = 1L;
private int customerNumber;
private String customerUsername;
private String customerPassword;
private int customerFlag;
public int getCustomerNumber() {
return customerNumber;
}
public void setCustomerNumber(int customerNumber) {
this.customerNumber = customerNumber;
}
public String getCustomerUsername() {
return customerUsername;
}
public void setCustomerUsername(String customerUsername) {
this.customerUsername = customerUsername;
}
public String getCustomerPassword() {
return customerPassword;
}
public void setCustomerPassword(String customerPassword) {
this.customerPassword = <PASSWORD>;
}
public int getCustomerFlag() {
return customerFlag;
}
public void setCustomerFlag(int customerFlag) {
this.customerFlag = customerFlag;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
@Override
public String toString() {
return "UsersInfoDTO [customerNumber=" + customerNumber + ", customerUsername=" + customerUsername
+ ", customerPassword=" + customerPassword + ", customerFlag=" + customerFlag + "]";
}
}
| 1,607 | 0.772699 | 0.772082 | 66 | 23.530304 | 25.151192 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.393939 | false | false | 9 |
8837ca57ba0c29755222cb4e1f862127aee81e76 | 25,950,192,471,524 | ebb430108171922d03af3699b99d79b911dbad41 | /app/src/main/java/local/portal/android/tasks/LoginTask.java | f4b015a7b08f0a981fc8e282971a5f8a790d9bb2 | [] | no_license | salex009/Android | https://github.com/salex009/Android | 97b88ae5797c8a1f06fedb999d42af36f15a9101 | 40298c447ce20b3b982e2a9794d6d500b66e3a1b | refs/heads/master | 2020-02-29T16:23:11.893000 | 2016-10-14T15:30:57 | 2016-10-14T15:30:57 | 70,057,131 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package local.portal.android.tasks;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
import android.preference.PreferenceManager;
import android.util.Log;
import android.widget.Toast;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.UUID;
import local.portal.android.Contact;
import local.portal.android.interfaces.AsyncResponseContact;
/**
* Адаптер для логина
* Created by salex009@gmail.com on 29.09.2016.
*/
public class LoginTask extends AsyncTask<String, Void, Contact> {
private static final String TAG = "LOGIN_TASK";
private static final String URL_DEFAULT = "http://odinremont.ru";
private static final String URL_ACTION = "login";
private AsyncResponseContact delegate = null;
private Contact contact;
private String hash;
private final ProgressDialog progressDialog;
private final Context context;
public LoginTask(Context context, AsyncResponseContact delegate) {
this.context = context;
this.delegate = delegate;
progressDialog = new ProgressDialog(context);
progressDialog.setCancelable(false);
progressDialog.setTitle("Загрузка");
progressDialog.setMessage("Подождите...");
}
private String getLoginLink() {
String s = PreferenceManager.getDefaultSharedPreferences(context).getString("remoteHostPref", URL_DEFAULT);
if (s.endsWith("/")) {
s = s.substring(0, s.length() - 1);
}
return s + "/android/" + URL_ACTION + "/";
}
@Override
protected Contact doInBackground(String... params) {
//String sim = params[0];
String sim = "8970199141081244492";
MessageDigest m = null;
try {
m = MessageDigest.getInstance("MD5");
m.update(sim.getBytes(),0,sim.length());
hash = new BigInteger(1,m.digest()).toString(16);
} catch (NoSuchAlgorithmException e) {
hash = UUID.randomUUID().toString();
}
//String sim = "8970199141142208650";
String link = getLoginLink();
String data = null;
try {
data = URLEncoder.encode("sim", "UTF-8") + "=" + URLEncoder.encode(sim, "UTF-8") + "&" + URLEncoder.encode("hash", "UTF-8") + "=" + URLEncoder.encode(hash, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
InputStream inputStream;
HttpURLConnection httpURLConnection;
Integer result = 0;
URL url;
try {
url = new URL(link);
httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setDoOutput(true);
assert data != null;
httpURLConnection.setChunkedStreamingMode(data.getBytes().length);
OutputStream out = new BufferedOutputStream(httpURLConnection.getOutputStream());
out.write(data.getBytes("UTF-8"));
out.flush();
httpURLConnection.connect();
int statusCode = httpURLConnection.getResponseCode();
if (statusCode == HttpURLConnection.HTTP_OK) {
inputStream = new BufferedInputStream(httpURLConnection.getInputStream());
String response = convertInputStreamToString(inputStream);
parseResult(response);
} else {
Toast.makeText(context, "Сервер не доступен. Код ответа: " + statusCode, Toast.LENGTH_SHORT).show();
Log.e(TAG, "Сервер не доступен. Код ответа: " + statusCode);
}
} catch (Exception e) {
Log.d(TAG, e.getLocalizedMessage());
}
return contact;
}
@Override
protected void onPostExecute(Contact result) {
progressDialog.dismiss();
delegate.processFinish(result);
}
/**
* Конвертирование ответа сервера в строку
*
* @param inputStream Входящий поток данных с сервреа
* @return String Поток, перекодированный в строку
* @throws IOException
*/
private String convertInputStreamToString(InputStream inputStream) throws IOException {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
String line;
String result = "";
while ((line = bufferedReader.readLine()) != null) {
result += line;
}
inputStream.close();
return result;
}
/**
* Парсер результата сервера
* @param result Ответ сервера
*/
private void parseResult(String result) {
try {
JSONObject response = new JSONObject(result);
String type = response.optString("type", "");
Integer success = response.optInt("success", 0);
String error = response.optString("error", "");
if (type.equals(URL_ACTION)) {
if (success.equals(1)) {
JSONObject data = response.optJSONObject("data");
Log.e(TAG, data.toString());
int id = data.optInt("id", 0);
String name = data.optString("name", "");
Boolean admin = data.optBoolean("admin", false);
String login = data.optString("login", "");
String password = data.optString("password", "");
String image = data.optString("image", "");
String role_name = data.optString("role_name", "");
int group_id = data.optInt("group_id", 0);
int gender_id = data.optInt("gender_id", 0);
int view = data.optInt("view_id", 0);
contact = new Contact(id, name, admin, hash, login, password, image, role_name, group_id, gender_id, view);
JSONArray jsonPhones = data.getJSONArray("phones");
for (int k = 0; k < jsonPhones.length(); k++) {
contact.addPhone(jsonPhones.getString(k));
}
//Log.e(TAG, jsonPhones.toString());
JSONArray jsonFavorites = data.getJSONArray("favorites");
for (int h = 0; h < jsonFavorites.length(); h++) {
contact.addFavorite(jsonFavorites.getInt(h));
}
//Log.e(TAG, jsonFavorites.toString());
} else {
Log.e(TAG, error);
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
| UTF-8 | Java | 7,317 | java | LoginTask.java | Java | [
{
"context": "eContact;\n\n/**\n * Адаптер для логина\n * Created by salex009@gmail.com on 29.09.2016.\n */\n\npublic class LoginTask extend",
"end": 965,
"score": 0.9999102354049683,
"start": 947,
"tag": "EMAIL",
"value": "salex009@gmail.com"
}
] | null | [] | package local.portal.android.tasks;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
import android.preference.PreferenceManager;
import android.util.Log;
import android.widget.Toast;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.UUID;
import local.portal.android.Contact;
import local.portal.android.interfaces.AsyncResponseContact;
/**
* Адаптер для логина
* Created by <EMAIL> on 29.09.2016.
*/
public class LoginTask extends AsyncTask<String, Void, Contact> {
private static final String TAG = "LOGIN_TASK";
private static final String URL_DEFAULT = "http://odinremont.ru";
private static final String URL_ACTION = "login";
private AsyncResponseContact delegate = null;
private Contact contact;
private String hash;
private final ProgressDialog progressDialog;
private final Context context;
public LoginTask(Context context, AsyncResponseContact delegate) {
this.context = context;
this.delegate = delegate;
progressDialog = new ProgressDialog(context);
progressDialog.setCancelable(false);
progressDialog.setTitle("Загрузка");
progressDialog.setMessage("Подождите...");
}
private String getLoginLink() {
String s = PreferenceManager.getDefaultSharedPreferences(context).getString("remoteHostPref", URL_DEFAULT);
if (s.endsWith("/")) {
s = s.substring(0, s.length() - 1);
}
return s + "/android/" + URL_ACTION + "/";
}
@Override
protected Contact doInBackground(String... params) {
//String sim = params[0];
String sim = "8970199141081244492";
MessageDigest m = null;
try {
m = MessageDigest.getInstance("MD5");
m.update(sim.getBytes(),0,sim.length());
hash = new BigInteger(1,m.digest()).toString(16);
} catch (NoSuchAlgorithmException e) {
hash = UUID.randomUUID().toString();
}
//String sim = "8970199141142208650";
String link = getLoginLink();
String data = null;
try {
data = URLEncoder.encode("sim", "UTF-8") + "=" + URLEncoder.encode(sim, "UTF-8") + "&" + URLEncoder.encode("hash", "UTF-8") + "=" + URLEncoder.encode(hash, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
InputStream inputStream;
HttpURLConnection httpURLConnection;
Integer result = 0;
URL url;
try {
url = new URL(link);
httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setDoOutput(true);
assert data != null;
httpURLConnection.setChunkedStreamingMode(data.getBytes().length);
OutputStream out = new BufferedOutputStream(httpURLConnection.getOutputStream());
out.write(data.getBytes("UTF-8"));
out.flush();
httpURLConnection.connect();
int statusCode = httpURLConnection.getResponseCode();
if (statusCode == HttpURLConnection.HTTP_OK) {
inputStream = new BufferedInputStream(httpURLConnection.getInputStream());
String response = convertInputStreamToString(inputStream);
parseResult(response);
} else {
Toast.makeText(context, "Сервер не доступен. Код ответа: " + statusCode, Toast.LENGTH_SHORT).show();
Log.e(TAG, "Сервер не доступен. Код ответа: " + statusCode);
}
} catch (Exception e) {
Log.d(TAG, e.getLocalizedMessage());
}
return contact;
}
@Override
protected void onPostExecute(Contact result) {
progressDialog.dismiss();
delegate.processFinish(result);
}
/**
* Конвертирование ответа сервера в строку
*
* @param inputStream Входящий поток данных с сервреа
* @return String Поток, перекодированный в строку
* @throws IOException
*/
private String convertInputStreamToString(InputStream inputStream) throws IOException {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
String line;
String result = "";
while ((line = bufferedReader.readLine()) != null) {
result += line;
}
inputStream.close();
return result;
}
/**
* Парсер результата сервера
* @param result Ответ сервера
*/
private void parseResult(String result) {
try {
JSONObject response = new JSONObject(result);
String type = response.optString("type", "");
Integer success = response.optInt("success", 0);
String error = response.optString("error", "");
if (type.equals(URL_ACTION)) {
if (success.equals(1)) {
JSONObject data = response.optJSONObject("data");
Log.e(TAG, data.toString());
int id = data.optInt("id", 0);
String name = data.optString("name", "");
Boolean admin = data.optBoolean("admin", false);
String login = data.optString("login", "");
String password = data.optString("password", "");
String image = data.optString("image", "");
String role_name = data.optString("role_name", "");
int group_id = data.optInt("group_id", 0);
int gender_id = data.optInt("gender_id", 0);
int view = data.optInt("view_id", 0);
contact = new Contact(id, name, admin, hash, login, password, image, role_name, group_id, gender_id, view);
JSONArray jsonPhones = data.getJSONArray("phones");
for (int k = 0; k < jsonPhones.length(); k++) {
contact.addPhone(jsonPhones.getString(k));
}
//Log.e(TAG, jsonPhones.toString());
JSONArray jsonFavorites = data.getJSONArray("favorites");
for (int h = 0; h < jsonFavorites.length(); h++) {
contact.addFavorite(jsonFavorites.getInt(h));
}
//Log.e(TAG, jsonFavorites.toString());
} else {
Log.e(TAG, error);
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
| 7,306 | 0.598396 | 0.588409 | 207 | 33.342995 | 28.186632 | 177 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.763285 | false | false | 9 |
d8308ba1a9ff820dbed9f3d46dd410d284c83aa9 | 25,958,782,338,031 | 6fa9885b2bfe4cb5baf561cfd099a83f82935f19 | /ch6-2/zoy-springcloud-learning-zuul/src/main/java/com/zoy/springcloud/config/SwaggerConfig.java | 7e14b591754290c650909985d52be34c2a4e77cb | [] | no_license | zoy2control/springcloud-learning | https://github.com/zoy2control/springcloud-learning | 2c1d7103d4916772eb6d9a46761d0be62cec9450 | b74762957173859af367457a644ab97b2d35e877 | refs/heads/master | 2020-04-23T01:53:31.201000 | 2019-02-28T02:11:46 | 2019-02-28T02:11:46 | 170,827,728 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.zoy.springcloud.config;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import springfox.documentation.swagger.web.SwaggerResource;
import springfox.documentation.swagger.web.SwaggerResourcesProvider;
import java.util.ArrayList;
import java.util.List;
/**
* Created by zouzp on 2019/2/21.
*/
@Component
@Primary
public class SwaggerConfig implements SwaggerResourcesProvider{
@Override
public List<SwaggerResource> get() {
List swaggerList = new ArrayList();
// ·通过 SwaggerResource添加多个文档来源
swaggerList.add(assembleSwaggerResource("service-a", "/swagger-service-a/v2/api-docs", "2.0"));
swaggerList.add(assembleSwaggerResource("service-b", "/swagger-service-b/v2/api-docs", "2.0"));
/*网关上Swagger会通过访问/swagger-service-a/v2/api-docs和swagger-service-b/v2/api-docs来加载两个文档内容,同时由于当前应用是Zuul构建的API网关,
这两个请求会被转发到swagger-service-a和swagger-service-b服务上的/v2/api-docs接口获得到Swagger的JSON文档,从而实现汇总加载内容。*/
return swaggerList;
}
/**
* ·封装SwaggerResource
* @param name
* @param location
* @param version
* @return
*/
private SwaggerResource assembleSwaggerResource(String name, String location, String version) {
SwaggerResource swaggerResource = new SwaggerResource();
swaggerResource.setName(name);
swaggerResource.setLocation(location);
swaggerResource.setSwaggerVersion(version);
return swaggerResource;
}
}
| UTF-8 | Java | 1,681 | java | SwaggerConfig.java | Java | [
{
"context": "rayList;\nimport java.util.List;\n\n/**\n * Created by zouzp on 2019/2/21.\n */\n@Component\n@Primary\npublic clas",
"end": 347,
"score": 0.999636173248291,
"start": 342,
"tag": "USERNAME",
"value": "zouzp"
}
] | null | [] | package com.zoy.springcloud.config;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import springfox.documentation.swagger.web.SwaggerResource;
import springfox.documentation.swagger.web.SwaggerResourcesProvider;
import java.util.ArrayList;
import java.util.List;
/**
* Created by zouzp on 2019/2/21.
*/
@Component
@Primary
public class SwaggerConfig implements SwaggerResourcesProvider{
@Override
public List<SwaggerResource> get() {
List swaggerList = new ArrayList();
// ·通过 SwaggerResource添加多个文档来源
swaggerList.add(assembleSwaggerResource("service-a", "/swagger-service-a/v2/api-docs", "2.0"));
swaggerList.add(assembleSwaggerResource("service-b", "/swagger-service-b/v2/api-docs", "2.0"));
/*网关上Swagger会通过访问/swagger-service-a/v2/api-docs和swagger-service-b/v2/api-docs来加载两个文档内容,同时由于当前应用是Zuul构建的API网关,
这两个请求会被转发到swagger-service-a和swagger-service-b服务上的/v2/api-docs接口获得到Swagger的JSON文档,从而实现汇总加载内容。*/
return swaggerList;
}
/**
* ·封装SwaggerResource
* @param name
* @param location
* @param version
* @return
*/
private SwaggerResource assembleSwaggerResource(String name, String location, String version) {
SwaggerResource swaggerResource = new SwaggerResource();
swaggerResource.setName(name);
swaggerResource.setLocation(location);
swaggerResource.setSwaggerVersion(version);
return swaggerResource;
}
}
| 1,681 | 0.728411 | 0.717864 | 44 | 33.477272 | 32.344376 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 9 |
e7059d41079a4c2e4135d1f07cce3269f3a2352f | 3,298,534,921,198 | 270beea6151ed2fc23e3296bed91c90866b001fc | /src/test/java/DirectorTest.java | 40203038bad890b1f7af9f01ce8e418245f2c6a9 | [] | no_license | RobbieDumbrell/week6-day-4-Inheritance | https://github.com/RobbieDumbrell/week6-day-4-Inheritance | 3842dfd8e3895404f39412232f786341f2ca9cd4 | 64188fab6c3c3453a600e92ae4330b1b97cb1d02 | refs/heads/master | 2020-03-25T02:55:28.895000 | 2018-08-02T15:32:07 | 2018-08-02T15:32:07 | 143,313,731 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | import Management.Director;
import Management.Manager;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class DirectorTest {
Director director;
@Before
public void before(){
director = new Director("Melinda", 555, 60000, "Sales", 100000);
}
@Test
public void hasName(){
assertEquals("Melinda", director.getName());
}
@Test
public void hasNiNumber(){
assertEquals(555, director.getNiNumber());
}
@Test
public void hasSalary(){
assertEquals(60000, director.getSalary(), 0);
}
@Test
public void hasDeptName(){
assertEquals("Sales", director.getDeptName());
}
@Test
public void canRaiseSalary(){
director.raiseSalary(5000);
assertEquals(65000, director.getSalary(), 0);
}
@Test
public void canNotDecreaseSalary(){
director.raiseSalary(-5000);
assertEquals(60000, director.getSalary(), 0);
}
@Test
public void canPayBonus(){
double bonus = director.payBonus();
assertEquals(1200, bonus, 0);
}
@Test
public void hasBudget(){
assertEquals(100000, director.getBudget(), 0);
}
}
| UTF-8 | Java | 1,241 | java | DirectorTest.java | Java | [
{
"context": "c void before(){\n director = new Director(\"Melinda\", 555, 60000, \"Sales\", 100000);\n }\n\n @Test\n",
"end": 281,
"score": 0.9998171329498291,
"start": 274,
"tag": "NAME",
"value": "Melinda"
},
{
"context": "\n public void hasName(){\n assertEquals(\"Melinda\", director.getName());\n }\n\n @Test\n publi",
"end": 387,
"score": 0.9997972249984741,
"start": 380,
"tag": "NAME",
"value": "Melinda"
}
] | null | [] | import Management.Director;
import Management.Manager;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class DirectorTest {
Director director;
@Before
public void before(){
director = new Director("Melinda", 555, 60000, "Sales", 100000);
}
@Test
public void hasName(){
assertEquals("Melinda", director.getName());
}
@Test
public void hasNiNumber(){
assertEquals(555, director.getNiNumber());
}
@Test
public void hasSalary(){
assertEquals(60000, director.getSalary(), 0);
}
@Test
public void hasDeptName(){
assertEquals("Sales", director.getDeptName());
}
@Test
public void canRaiseSalary(){
director.raiseSalary(5000);
assertEquals(65000, director.getSalary(), 0);
}
@Test
public void canNotDecreaseSalary(){
director.raiseSalary(-5000);
assertEquals(60000, director.getSalary(), 0);
}
@Test
public void canPayBonus(){
double bonus = director.payBonus();
assertEquals(1200, bonus, 0);
}
@Test
public void hasBudget(){
assertEquals(100000, director.getBudget(), 0);
}
}
| 1,241 | 0.622885 | 0.578566 | 59 | 20.033897 | 19.086748 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.59322 | false | false | 9 |
6ff5e0410676830230235552963236fdbe886286 | 31,275,951,889,184 | 613f12cf441451efee4f0cc0d2d46258386bc2a3 | /College/Main.java | c71b47c21a6ec2ad609ef0c2a6f036d0c411f24a | [] | no_license | kaustubhxd/Playground | https://github.com/kaustubhxd/Playground | 0e2f4e3976d9821bf4981985e788da05877ea0a5 | 988f3d8a48e476379b0748fb33b29ccc34f20cf5 | refs/heads/master | 2022-12-28T21:55:43.947000 | 2020-10-18T00:38:27 | 2020-10-18T00:38:27 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | #include<iostream>
using namespace std;
struct details{
char name[30];
char city[30];
int est;
float per;
};
int main()
{
int n;
cout<<"Enter the number of colleges";
cin>>n;
details s[n];
for(int i=0;i<n;i++)
{
cout<<"\nEnter the details of college "<<i+1;
cout<<"\nEnter name\nEnter city\nEnter year of establishment\nEnter pass percentage";
cin>>s[i].name;
cin>>s[i].city;
cin>>s[i].est;
cin>>s[i].per;
}
cout<<"\nDetails of colleges";
for(int i=0;i<n;i++)
{
cout<<"\nCollege:"<<i+1<<"\nName:"<<s[i].name<<"\nCity:"<<s[i].city;
cout<<"\nYear of establishment:"<<s[i].est;
cout<<"\nPass percentage:"<<s[i].per;
}
}
| UTF-8 | Java | 691 | java | Main.java | Java | [] | null | [] | #include<iostream>
using namespace std;
struct details{
char name[30];
char city[30];
int est;
float per;
};
int main()
{
int n;
cout<<"Enter the number of colleges";
cin>>n;
details s[n];
for(int i=0;i<n;i++)
{
cout<<"\nEnter the details of college "<<i+1;
cout<<"\nEnter name\nEnter city\nEnter year of establishment\nEnter pass percentage";
cin>>s[i].name;
cin>>s[i].city;
cin>>s[i].est;
cin>>s[i].per;
}
cout<<"\nDetails of colleges";
for(int i=0;i<n;i++)
{
cout<<"\nCollege:"<<i+1<<"\nName:"<<s[i].name<<"\nCity:"<<s[i].city;
cout<<"\nYear of establishment:"<<s[i].est;
cout<<"\nPass percentage:"<<s[i].per;
}
}
| 691 | 0.575977 | 0.564399 | 36 | 18.138889 | 19.810425 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false | 9 |
cb50ab4f1b2095b85b736ed379617f737bd30234 | 32,968,169,015,336 | d0f2ade1f39d9d4b49df8b3c52c29701112b3c1a | /src/main/java/com/nstrct/nstrct/Argument.java | 13ffb3215de7b03fd7fc67ecf29acb88dae4552f | [
"MIT"
] | permissive | nstrct/nstrct-java | https://github.com/nstrct/nstrct-java | 7f18f5b8c5fe6d029551ab43f4e48f532b8ece2e | 2c577c4fb84209c8b1c18f3ea2247284455e8779 | refs/heads/master | 2016-09-05T22:33:04.243000 | 2014-01-13T20:22:00 | 2014-01-13T20:22:00 | 15,293,023 | 0 | 0 | null | false | 2014-01-13T20:22:00 | 2013-12-18T20:06:13 | 2014-01-13T20:22:00 | 2014-01-13T20:22:00 | 156 | 1 | 0 | 0 | Java | null | null | package com.nstrct.nstrct;
import java.nio.ByteBuffer;
import java.util.ArrayList;
public class Argument {
public static Argument parse(ByteBuffer buffer) {
Argument argument = new Argument();
argument.datatype = Value.datatypeFromInt((int)buffer.get());
if(argument.datatype == Value.Datatype.Array) {
argument.elementDatatype = Value.datatypeFromInt((int)buffer.get());
byte numElements = buffer.get();
for(int i=0; i<numElements; i++) {
argument.values.add(Value.parse(argument.elementDatatype, buffer));
}
} else {
argument.values.add(Value.parse(argument.datatype, buffer));
}
return argument;
}
public Value.Datatype datatype;
public Value.Datatype elementDatatype;
public ArrayList<Value> values;
public Argument(Value.Datatype datatype, boolean asArrray, Value ... values) {
this.values = new ArrayList<Value>();
if(asArrray) {
this.datatype = Value.Datatype.Array;
this.elementDatatype = datatype;
for(int i=0; i<values.length; i++) {
this.values.add(values[i]);
}
} else {
this.datatype = datatype;
this.elementDatatype = Value.Datatype.Unset;
this.values.add(values[0]);
}
}
public Argument() {
this.datatype = Value.Datatype.Unset;
this.elementDatatype = Value.Datatype.Unset;
this.values = new ArrayList<Value>();
}
public boolean isArray() {
return this.datatype == Value.Datatype.Array;
}
public int length() {
int counter = 1;
if(this.isArray()) {
counter += 2;
for(Value value : this.values) {
counter += value.length(this.elementDatatype);
}
} else {
counter += this.values.get(0).length(this.datatype);
}
return counter;
}
public void pack(ByteBuffer buffer) {
buffer.put((byte)this.datatype.getValue());
if (this.isArray()) {
buffer.put((byte)this.elementDatatype.getValue());
buffer.put((byte)this.values.size());
for(Value value : this.values) {
value.pack(this.elementDatatype, buffer);
}
} else {
this.values.get(0).pack(this.datatype, buffer);
}
}
@Override
public String toString() {
return "<#Argument datatype="+this.datatype.toString()+" elementDatatype="+this.elementDatatype.toString()+" values="+values.toString()+">";
}
}
| UTF-8 | Java | 2,358 | java | Argument.java | Java | [] | null | [] | package com.nstrct.nstrct;
import java.nio.ByteBuffer;
import java.util.ArrayList;
public class Argument {
public static Argument parse(ByteBuffer buffer) {
Argument argument = new Argument();
argument.datatype = Value.datatypeFromInt((int)buffer.get());
if(argument.datatype == Value.Datatype.Array) {
argument.elementDatatype = Value.datatypeFromInt((int)buffer.get());
byte numElements = buffer.get();
for(int i=0; i<numElements; i++) {
argument.values.add(Value.parse(argument.elementDatatype, buffer));
}
} else {
argument.values.add(Value.parse(argument.datatype, buffer));
}
return argument;
}
public Value.Datatype datatype;
public Value.Datatype elementDatatype;
public ArrayList<Value> values;
public Argument(Value.Datatype datatype, boolean asArrray, Value ... values) {
this.values = new ArrayList<Value>();
if(asArrray) {
this.datatype = Value.Datatype.Array;
this.elementDatatype = datatype;
for(int i=0; i<values.length; i++) {
this.values.add(values[i]);
}
} else {
this.datatype = datatype;
this.elementDatatype = Value.Datatype.Unset;
this.values.add(values[0]);
}
}
public Argument() {
this.datatype = Value.Datatype.Unset;
this.elementDatatype = Value.Datatype.Unset;
this.values = new ArrayList<Value>();
}
public boolean isArray() {
return this.datatype == Value.Datatype.Array;
}
public int length() {
int counter = 1;
if(this.isArray()) {
counter += 2;
for(Value value : this.values) {
counter += value.length(this.elementDatatype);
}
} else {
counter += this.values.get(0).length(this.datatype);
}
return counter;
}
public void pack(ByteBuffer buffer) {
buffer.put((byte)this.datatype.getValue());
if (this.isArray()) {
buffer.put((byte)this.elementDatatype.getValue());
buffer.put((byte)this.values.size());
for(Value value : this.values) {
value.pack(this.elementDatatype, buffer);
}
} else {
this.values.get(0).pack(this.datatype, buffer);
}
}
@Override
public String toString() {
return "<#Argument datatype="+this.datatype.toString()+" elementDatatype="+this.elementDatatype.toString()+" values="+values.toString()+">";
}
}
| 2,358 | 0.647159 | 0.64419 | 85 | 26.741177 | 24.866302 | 144 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.529412 | false | false | 9 |
780c9a7338728961217d402fb876da23ff06e8de | 13,864,154,471,309 | d8e3fdf4308647675617ac2c4393cda632ea39ba | /src/main/java/com/hs/yourfit/domain/user/exception/UserNotFoundException.java | 0d47d8ac783926ddf4e703919012c1c35a12a464 | [] | no_license | gan-ta/your-fit | https://github.com/gan-ta/your-fit | 2debfc8b4c554e34e28c1f6f696e31b1fca1127f | 4121325f92ea48d3032da763a45324b7ca553b00 | refs/heads/master | 2023-02-27T07:11:40.394000 | 2021-02-01T16:46:37 | 2021-02-01T16:46:37 | 303,065,018 | 0 | 0 | null | false | 2020-12-28T15:22:32 | 2020-10-11T07:21:49 | 2020-12-20T06:40:18 | 2020-12-28T15:22:31 | 131 | 0 | 0 | 1 | Java | false | false | package com.hs.yourfit.domain.user.exception;
import com.hs.yourfit.core.error.exception.BusinessLogicException;
import com.hs.yourfit.core.error.enums.ErrorCode;
public class UserNotFoundException extends BusinessLogicException {
public UserNotFoundException(){super(ErrorCode.USER_NOT_FOUND);}
}
| UTF-8 | Java | 304 | java | UserNotFoundException.java | Java | [] | null | [] | package com.hs.yourfit.domain.user.exception;
import com.hs.yourfit.core.error.exception.BusinessLogicException;
import com.hs.yourfit.core.error.enums.ErrorCode;
public class UserNotFoundException extends BusinessLogicException {
public UserNotFoundException(){super(ErrorCode.USER_NOT_FOUND);}
}
| 304 | 0.825658 | 0.825658 | 8 | 37 | 29.46184 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 9 |
93c910c0e0300dd2b2a3eab4684b341bf8641fc7 | 18,562,848,693,910 | dec6bd85db1d028edbbd3bd18fe0ca628eda012e | /netbeans-projects/Colecoes/src/Fila/Fila.java | d6ec52fa14ffcb6432fa7aa5ebec2802b58751af | [] | no_license | MatheusGrenfell/java-projects | https://github.com/MatheusGrenfell/java-projects | 21b961697e2c0c6a79389c96b588e142c3f70634 | 93c7bfa2e4f73a232ffde2d38f30a27f2a816061 | refs/heads/master | 2022-12-29T12:55:00.014000 | 2020-10-16T00:54:30 | 2020-10-16T00:54:30 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Fila;
import java.util.PriorityQueue;
import java.util.Queue;
public class Fila {
public Fila() {
Queue<Double> fila = new PriorityQueue<Double>();
fila.offer(3.2);//offer(Double e) insere um elemento do tipo double na posição apropiada com base na ordem de prioridade
fila.offer(9.8);
fila.offer(5.4);
fila.offer(55.4);
fila.offer(4.0);
fila.offer(4.0);
fila.offer(5.3);
fila.offer(8.3);
imprimirFila(fila);
fila.offer(6.8);
fila.offer(8.9);
fila.offer(1.5);
fila.offer(4.7);
imprimirFila(fila);
fila.remove();//remove o elemento de maior prioridade da fila de prioridade
imprimirFila(fila);
fila.remove();
imprimirFila(fila);
fila.remove(4.7);//Se houver remove o elemento da fila
imprimirFila(fila);
fila.poll();
imprimirFila(fila);//remove o elemento de maior prioridade da fila de
fila.clear();//limpa a fila
imprimirFila(fila);
fila.offer(7.4);
fila.offer(3.4);
fila.offer(2.3);
imprimirFila(fila);
ImprimeRemoveTodosFila(fila);
imprimirFila(fila);
}
private void imprimirFila(Queue<Double> fila) {
if (fila.isEmpty()) {//verifica se pilha está vazia
System.out.print("Fila está vazia\n\n");
} else {
System.out.print("Conteúdo da Fila: ");
for (Number number : fila) {
System.out.printf("%s ", number);
}
System.out.println();
}
}
private void ImprimeRemoveTodosFila(Queue<Double> fila) {
System.out.print("Polling from queue: ");
while (fila.size() > 0) {//size() obtem o numero de elementos da fila
System.out.printf("%.1f ", fila.peek());//peek() obtem uma referencia ao elemento de mais alta prioridade da fila de prioridade (sem remover o elemento)
fila.poll();//poll() remove o elemento de mais alta prioridade da fila de prioridade
}
System.out.println();
}
public static void main(String[] args) {
new Fila();
}
}
| UTF-8 | Java | 2,192 | java | Fila.java | Java | [] | null | [] | package Fila;
import java.util.PriorityQueue;
import java.util.Queue;
public class Fila {
public Fila() {
Queue<Double> fila = new PriorityQueue<Double>();
fila.offer(3.2);//offer(Double e) insere um elemento do tipo double na posição apropiada com base na ordem de prioridade
fila.offer(9.8);
fila.offer(5.4);
fila.offer(55.4);
fila.offer(4.0);
fila.offer(4.0);
fila.offer(5.3);
fila.offer(8.3);
imprimirFila(fila);
fila.offer(6.8);
fila.offer(8.9);
fila.offer(1.5);
fila.offer(4.7);
imprimirFila(fila);
fila.remove();//remove o elemento de maior prioridade da fila de prioridade
imprimirFila(fila);
fila.remove();
imprimirFila(fila);
fila.remove(4.7);//Se houver remove o elemento da fila
imprimirFila(fila);
fila.poll();
imprimirFila(fila);//remove o elemento de maior prioridade da fila de
fila.clear();//limpa a fila
imprimirFila(fila);
fila.offer(7.4);
fila.offer(3.4);
fila.offer(2.3);
imprimirFila(fila);
ImprimeRemoveTodosFila(fila);
imprimirFila(fila);
}
private void imprimirFila(Queue<Double> fila) {
if (fila.isEmpty()) {//verifica se pilha está vazia
System.out.print("Fila está vazia\n\n");
} else {
System.out.print("Conteúdo da Fila: ");
for (Number number : fila) {
System.out.printf("%s ", number);
}
System.out.println();
}
}
private void ImprimeRemoveTodosFila(Queue<Double> fila) {
System.out.print("Polling from queue: ");
while (fila.size() > 0) {//size() obtem o numero de elementos da fila
System.out.printf("%.1f ", fila.peek());//peek() obtem uma referencia ao elemento de mais alta prioridade da fila de prioridade (sem remover o elemento)
fila.poll();//poll() remove o elemento de mais alta prioridade da fila de prioridade
}
System.out.println();
}
public static void main(String[] args) {
new Fila();
}
}
| 2,192 | 0.579332 | 0.563329 | 66 | 32.136364 | 29.233587 | 164 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.681818 | false | false | 9 |
408d8fcfc1ccd616b6737784001f5fb52eb141ba | 18,562,848,692,288 | d5acc11fe67f1923ffe7b892da1a1a6a6d606aa3 | /src/net/sourcewalker/olv/messages/calls/MenuItem.java | 78ace5d922cbb1fdb544d1f0a4c8fd317916ca17 | [
"Apache-2.0"
] | permissive | shortcolin/OpenLiveView | https://github.com/shortcolin/OpenLiveView | ed70b5b5988795e114cf6dfc0ee3f1e4dbdb34bc | b27b18f7c7f440a943ee236cc8342340a77bfd2a | refs/heads/master | 2021-01-15T15:58:05.931000 | 2011-09-19T17:59:18 | 2011-09-19T17:59:18 | 2,415,512 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.sourcewalker.olv.messages.calls;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import net.sourcewalker.olv.messages.LiveViewCall;
import net.sourcewalker.olv.messages.MessageConstants;
import net.sourcewalker.olv.messages.UShort;
public class MenuItem extends LiveViewCall {
private byte itemId;
private boolean alertItem;
private UShort unreadCount;
private String text;
private byte[] image;
public MenuItem(byte itemId, boolean alertItem, UShort unreadCount,
String text, byte[] image) {
super(MessageConstants.MSG_GETMENUITEM_RESP);
this.itemId = itemId;
this.alertItem = alertItem;
this.unreadCount = unreadCount;
this.text = text;
this.image = image;
}
/*
* (non-Javadoc)
* @see net.sourcewalker.olv.messages.LiveViewRequest#getPayload()
*/
@Override
protected byte[] getPayload() {
try {
byte[] textArray = text.getBytes("iso-8859-1");
int size = 15 + textArray.length + image.length;
ByteBuffer buffer = ByteBuffer.allocate(size);
buffer.put((byte) (alertItem ? 0 : 1));
buffer.putShort((short) 0);
buffer.putShort(unreadCount.getValue());
buffer.putShort((short) 0);
buffer.put((byte) (itemId + 3));
buffer.put((byte) 0); // 0 is for plaintext vs bitmapimage (1) strings
buffer.putShort((short) 0);
buffer.putShort((short) 0);
buffer.putShort((short) textArray.length);
buffer.put(textArray);
buffer.put(image);
return buffer.array();
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Encoding not found: " + e.getMessage(),
e);
}
}
}
| UTF-8 | Java | 1,865 | java | MenuItem.java | Java | [] | null | [] | package net.sourcewalker.olv.messages.calls;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import net.sourcewalker.olv.messages.LiveViewCall;
import net.sourcewalker.olv.messages.MessageConstants;
import net.sourcewalker.olv.messages.UShort;
public class MenuItem extends LiveViewCall {
private byte itemId;
private boolean alertItem;
private UShort unreadCount;
private String text;
private byte[] image;
public MenuItem(byte itemId, boolean alertItem, UShort unreadCount,
String text, byte[] image) {
super(MessageConstants.MSG_GETMENUITEM_RESP);
this.itemId = itemId;
this.alertItem = alertItem;
this.unreadCount = unreadCount;
this.text = text;
this.image = image;
}
/*
* (non-Javadoc)
* @see net.sourcewalker.olv.messages.LiveViewRequest#getPayload()
*/
@Override
protected byte[] getPayload() {
try {
byte[] textArray = text.getBytes("iso-8859-1");
int size = 15 + textArray.length + image.length;
ByteBuffer buffer = ByteBuffer.allocate(size);
buffer.put((byte) (alertItem ? 0 : 1));
buffer.putShort((short) 0);
buffer.putShort(unreadCount.getValue());
buffer.putShort((short) 0);
buffer.put((byte) (itemId + 3));
buffer.put((byte) 0); // 0 is for plaintext vs bitmapimage (1) strings
buffer.putShort((short) 0);
buffer.putShort((short) 0);
buffer.putShort((short) textArray.length);
buffer.put(textArray);
buffer.put(image);
return buffer.array();
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Encoding not found: " + e.getMessage(),
e);
}
}
}
| 1,865 | 0.617158 | 0.608043 | 55 | 32.909092 | 21.458012 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.690909 | false | false | 9 |
bfb12d5928c2d39125d57c5cc8db0dbc8f197ace | 19,387,482,415,156 | a3d9e474df1f980b347e91a439fdaaf289455369 | /src/main/java/com/leocaliban/loja/api/services/validators/ClienteUpdateValidator.java | 7dfe8509751036377b5a08002d082bf872d16f66 | [] | no_license | leocaliban/spring-ionic-loja-api | https://github.com/leocaliban/spring-ionic-loja-api | 2b1295fb907a63ef90865474dee258c61391a80c | cd1f8b57d44c1b0ed293a9e469875b7af2e3a48e | refs/heads/master | 2020-03-23T23:57:04.563000 | 2018-08-14T07:15:47 | 2018-08-14T07:15:47 | 142,265,289 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.leocaliban.loja.api.services.validators;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.HandlerMapping;
import com.leocaliban.loja.api.domain.Cliente;
import com.leocaliban.loja.api.dto.ClienteDTO;
import com.leocaliban.loja.api.repositories.ClienteRepository;
import com.leocaliban.loja.api.resources.exceptions.MensagemDoCampo;
public class ClienteUpdateValidator implements ConstraintValidator<ClienteUpdate, ClienteDTO> {
@Autowired
private HttpServletRequest request;
@Autowired
private ClienteRepository repository;
@Override
public void initialize(ClienteUpdate anotacao) {
}
@Override
public boolean isValid(ClienteDTO objetoDTO, ConstraintValidatorContext context) {
//para obter o parametro da uri e recuperar o id do item que será atualizado
@SuppressWarnings("unchecked")
Map<String, String> map = (Map<String, String>) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
Integer uriId = Integer.parseInt(map.get("id"));
List<MensagemDoCampo> lista = new ArrayList<>();
// inclua os testes aqui, inserindo erros na lista
Cliente clienteComEmail = repository.findByEmail(objetoDTO.getEmail());
if(clienteComEmail != null && !clienteComEmail.getId().equals(uriId)) {
lista.add(new MensagemDoCampo("email", "O E-mail informado já existe."));
}
//Percorrer a lista para capturar os erros e enviá-las ao validador do framework - método validador do handler.
for (MensagemDoCampo erro : lista) {
context.disableDefaultConstraintViolation();
context.buildConstraintViolationWithTemplate(erro.getMensagem()).addPropertyNode(erro.getNomeDoCampo())
.addConstraintViolation();
}
return lista.isEmpty();
}
}
| UTF-8 | Java | 1,993 | java | ClienteUpdateValidator.java | Java | [] | null | [] | package com.leocaliban.loja.api.services.validators;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.HandlerMapping;
import com.leocaliban.loja.api.domain.Cliente;
import com.leocaliban.loja.api.dto.ClienteDTO;
import com.leocaliban.loja.api.repositories.ClienteRepository;
import com.leocaliban.loja.api.resources.exceptions.MensagemDoCampo;
public class ClienteUpdateValidator implements ConstraintValidator<ClienteUpdate, ClienteDTO> {
@Autowired
private HttpServletRequest request;
@Autowired
private ClienteRepository repository;
@Override
public void initialize(ClienteUpdate anotacao) {
}
@Override
public boolean isValid(ClienteDTO objetoDTO, ConstraintValidatorContext context) {
//para obter o parametro da uri e recuperar o id do item que será atualizado
@SuppressWarnings("unchecked")
Map<String, String> map = (Map<String, String>) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
Integer uriId = Integer.parseInt(map.get("id"));
List<MensagemDoCampo> lista = new ArrayList<>();
// inclua os testes aqui, inserindo erros na lista
Cliente clienteComEmail = repository.findByEmail(objetoDTO.getEmail());
if(clienteComEmail != null && !clienteComEmail.getId().equals(uriId)) {
lista.add(new MensagemDoCampo("email", "O E-mail informado já existe."));
}
//Percorrer a lista para capturar os erros e enviá-las ao validador do framework - método validador do handler.
for (MensagemDoCampo erro : lista) {
context.disableDefaultConstraintViolation();
context.buildConstraintViolationWithTemplate(erro.getMensagem()).addPropertyNode(erro.getNomeDoCampo())
.addConstraintViolation();
}
return lista.isEmpty();
}
}
| 1,993 | 0.787833 | 0.787833 | 56 | 34.5 | 32.834 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.660714 | false | false | 9 |
a15986edf5abdb392449ac072fb642bd712af096 | 20,727,512,211,436 | 34de58f7410b97978bacb85c1c87f87be52e0687 | /src/repository/BookRepository.java | 7bdd40f123d23ef73876b03940cfe15f083cace4 | [] | no_license | Naufalazmi48/Perpustakaan | https://github.com/Naufalazmi48/Perpustakaan | 13e0ed8ad7ef4facb12eda14c6383f5174a2dd30 | de5c6d452c869ddf17f4a7ce0de7be4e5fb9bb3a | refs/heads/master | 2023-04-14T14:17:09.763000 | 2021-04-24T01:47:01 | 2021-04-24T01:47:01 | 323,784,055 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package repository;
import model.Admin;
import model.Book;
import repository.local.ConnectionDatabase;
import javax.swing.*;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
public class BookRepository implements IQueryRepository<Book>{
private final ConnectionDatabase db;
private PreparedStatement ps;
private ResultSet rs;
public BookRepository(ConnectionDatabase db) {
this.db = db;
}
@Override
public List<Book> readAll() {
List<Book> listBook = new ArrayList<>();
String query = "SELECT * FROM book";
try {
Statement s = db.getConection().createStatement();
rs = s.executeQuery(query);
while (rs.next()) {
Book book = new Book();
book.setId(rs.getInt("id"));
book.setTitle(rs.getString("title"));
book.setYear(rs.getInt("year"));
book.setPublisher(rs.getString("publisher"));
book.setAuthor(rs.getString("author"));
book.setStock(rs.getInt("stock"));
listBook.add(book);
}
return listBook;
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, e);
} finally {
db.closeConnection();
}
return null;
}
@Override
public List<Book> searchUserBook(int nim) {
String query = "SELECT * FROM userwithbook JOIN book ON (userwithbook.book_id = book.id) WHERE user_nim = ?";
ArrayList<Book> listBook = new ArrayList<>();
try {
ps = db.getConection().prepareStatement(query);
ps.setInt(1, nim);
rs = ps.executeQuery();
while (rs.next()) {
Book book = new Book();
book.setId(rs.getInt("book.id"));
book.setTitle(rs.getString("title"));
book.setYear(rs.getInt("year"));
book.setPublisher(rs.getString("publisher"));
book.setAuthor(rs.getString("author"));
listBook.add(book);
}
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, e);
} finally {
db.closeConnection();
}
return listBook;
}
@Override
public boolean borrowBook(int nim, List<Book> idBook) {
String query = "INSERT INTO `userwithbook` (admin_id,user_nim,book_id,date,expired) VALUES (?, ?, ?, NOW(), (NOW() + INTERVAL 7 DAY))";
try {
for (Book idBook1 : idBook) {
ps = db.getConection().prepareStatement(query);
ps.setInt(1, new Admin().getADMIN_ID());
ps.setInt(2, nim);
ps.setInt(3, idBook1.getId());
ps.executeUpdate();
}
JOptionPane.showMessageDialog(null, "Berhasil meminjam");
return true;
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, e);
return false;
} finally {
db.closeConnection();
}
}
@Override
public boolean returnBookBorrowed(int nim, List<Integer> idBook) {
String query = "DELETE FROM `userwithbook` WHERE user_nim = ? AND book_id = ?";
try {
for (Integer idBook1 : idBook) {
ps = db.getConection().prepareStatement(query);
ps.setInt(1, nim);
ps.setInt(2, idBook1);
ps.executeUpdate();
}
JOptionPane.showMessageDialog(null, "Buku berhasil dikembalikan!");
return true;
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, e);
return false;
} finally {
db.closeConnection();
}
}
@Override
public Book search(int id) {
String query = "SELECT * FROM `book` WHERE id = ?";
try {
ps = db.getConection().prepareStatement(query);
ps.setInt(1, id);
rs = ps.executeQuery();
if (rs.next()) {
Book book = new Book();
book.setId(rs.getInt("id"));
book.setTitle(rs.getString("title"));
book.setYear(rs.getInt("year"));
book.setPublisher(rs.getString("publisher"));
book.setAuthor(rs.getString("author"));
book.setStock(rs.getInt("stock"));
return book;
}
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, "Buku tidak ditemukan");
} finally {
db.closeConnection();
}
return null;
}
@Override
public boolean create(Book data) {
String query = "INSERT INTO `book` (title,author,year,publisher,stock) VALUES (?, ?, ?, ?,?)";
try {
ps = db.getConection().prepareStatement(query);
ps.setString(1, data.getTitle());
ps.setString(2, data.getAuthor());
ps.setInt(3, data.getYear());
ps.setString(4, data.getPublisher());
ps.setInt(5, data.getStock());
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "Data buku berhasil ditambahkan!");
return true;
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, e);
return false;
} finally {
db.closeConnection();
}
}
@Override
public boolean update(Book book, int oldId) {
String query = "UPDATE `book` SET title = ?,author = ?,year = ?,publisher = ?, stock = ? WHERE id = ?";
try {
ps = db.getConection().prepareStatement(query);
ps.setString(1, book.getTitle());
ps.setString(2, book.getAuthor());
ps.setInt(3, book.getYear());
ps.setString(4, book.getPublisher());
ps.setInt(5, book.getStock());
ps.setInt(6, oldId);
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "Data berhasil diperbarui!");
return true;
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, "Data gagal diperbarui");
} finally {
db.closeConnection();
}
return false;
}
@Override
public boolean delete(int id) {
String query = "DELETE FROM `book` WHERE id = ?";
try {
ps = db.getConection().prepareStatement(query);
ps.setInt(1, id);
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "Data berhasil dihapus!");
return true;
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, "Data gagal dihapus");
return false;
} finally {
db.closeConnection();
}
}
@Override
public Book search(String data) {
String query = "SELECT * FROM `book` WHERE title = ?";
try {
ps = db.getConection().prepareStatement(query);
ps.setString(1, data);
rs = ps.executeQuery();
if (rs.next()) {
Book book = new Book();
book.setId(rs.getInt("id"));
book.setTitle(rs.getString("title"));
book.setYear(rs.getInt("year"));
book.setPublisher(rs.getString("publisher"));
book.setAuthor(rs.getString("author"));
book.setStock(rs.getInt("stock"));
return book;
}
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, "Data tidak ditemukan");
} finally {
db.closeConnection();
}
return null;
}
@Override
public boolean login(String username, String password) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public long countTimeLate(int nim, int idBook) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
| UTF-8 | Java | 8,290 | java | BookRepository.java | Java | [] | null | [] | package repository;
import model.Admin;
import model.Book;
import repository.local.ConnectionDatabase;
import javax.swing.*;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
public class BookRepository implements IQueryRepository<Book>{
private final ConnectionDatabase db;
private PreparedStatement ps;
private ResultSet rs;
public BookRepository(ConnectionDatabase db) {
this.db = db;
}
@Override
public List<Book> readAll() {
List<Book> listBook = new ArrayList<>();
String query = "SELECT * FROM book";
try {
Statement s = db.getConection().createStatement();
rs = s.executeQuery(query);
while (rs.next()) {
Book book = new Book();
book.setId(rs.getInt("id"));
book.setTitle(rs.getString("title"));
book.setYear(rs.getInt("year"));
book.setPublisher(rs.getString("publisher"));
book.setAuthor(rs.getString("author"));
book.setStock(rs.getInt("stock"));
listBook.add(book);
}
return listBook;
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, e);
} finally {
db.closeConnection();
}
return null;
}
@Override
public List<Book> searchUserBook(int nim) {
String query = "SELECT * FROM userwithbook JOIN book ON (userwithbook.book_id = book.id) WHERE user_nim = ?";
ArrayList<Book> listBook = new ArrayList<>();
try {
ps = db.getConection().prepareStatement(query);
ps.setInt(1, nim);
rs = ps.executeQuery();
while (rs.next()) {
Book book = new Book();
book.setId(rs.getInt("book.id"));
book.setTitle(rs.getString("title"));
book.setYear(rs.getInt("year"));
book.setPublisher(rs.getString("publisher"));
book.setAuthor(rs.getString("author"));
listBook.add(book);
}
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, e);
} finally {
db.closeConnection();
}
return listBook;
}
@Override
public boolean borrowBook(int nim, List<Book> idBook) {
String query = "INSERT INTO `userwithbook` (admin_id,user_nim,book_id,date,expired) VALUES (?, ?, ?, NOW(), (NOW() + INTERVAL 7 DAY))";
try {
for (Book idBook1 : idBook) {
ps = db.getConection().prepareStatement(query);
ps.setInt(1, new Admin().getADMIN_ID());
ps.setInt(2, nim);
ps.setInt(3, idBook1.getId());
ps.executeUpdate();
}
JOptionPane.showMessageDialog(null, "Berhasil meminjam");
return true;
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, e);
return false;
} finally {
db.closeConnection();
}
}
@Override
public boolean returnBookBorrowed(int nim, List<Integer> idBook) {
String query = "DELETE FROM `userwithbook` WHERE user_nim = ? AND book_id = ?";
try {
for (Integer idBook1 : idBook) {
ps = db.getConection().prepareStatement(query);
ps.setInt(1, nim);
ps.setInt(2, idBook1);
ps.executeUpdate();
}
JOptionPane.showMessageDialog(null, "Buku berhasil dikembalikan!");
return true;
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, e);
return false;
} finally {
db.closeConnection();
}
}
@Override
public Book search(int id) {
String query = "SELECT * FROM `book` WHERE id = ?";
try {
ps = db.getConection().prepareStatement(query);
ps.setInt(1, id);
rs = ps.executeQuery();
if (rs.next()) {
Book book = new Book();
book.setId(rs.getInt("id"));
book.setTitle(rs.getString("title"));
book.setYear(rs.getInt("year"));
book.setPublisher(rs.getString("publisher"));
book.setAuthor(rs.getString("author"));
book.setStock(rs.getInt("stock"));
return book;
}
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, "Buku tidak ditemukan");
} finally {
db.closeConnection();
}
return null;
}
@Override
public boolean create(Book data) {
String query = "INSERT INTO `book` (title,author,year,publisher,stock) VALUES (?, ?, ?, ?,?)";
try {
ps = db.getConection().prepareStatement(query);
ps.setString(1, data.getTitle());
ps.setString(2, data.getAuthor());
ps.setInt(3, data.getYear());
ps.setString(4, data.getPublisher());
ps.setInt(5, data.getStock());
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "Data buku berhasil ditambahkan!");
return true;
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, e);
return false;
} finally {
db.closeConnection();
}
}
@Override
public boolean update(Book book, int oldId) {
String query = "UPDATE `book` SET title = ?,author = ?,year = ?,publisher = ?, stock = ? WHERE id = ?";
try {
ps = db.getConection().prepareStatement(query);
ps.setString(1, book.getTitle());
ps.setString(2, book.getAuthor());
ps.setInt(3, book.getYear());
ps.setString(4, book.getPublisher());
ps.setInt(5, book.getStock());
ps.setInt(6, oldId);
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "Data berhasil diperbarui!");
return true;
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, "Data gagal diperbarui");
} finally {
db.closeConnection();
}
return false;
}
@Override
public boolean delete(int id) {
String query = "DELETE FROM `book` WHERE id = ?";
try {
ps = db.getConection().prepareStatement(query);
ps.setInt(1, id);
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "Data berhasil dihapus!");
return true;
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, "Data gagal dihapus");
return false;
} finally {
db.closeConnection();
}
}
@Override
public Book search(String data) {
String query = "SELECT * FROM `book` WHERE title = ?";
try {
ps = db.getConection().prepareStatement(query);
ps.setString(1, data);
rs = ps.executeQuery();
if (rs.next()) {
Book book = new Book();
book.setId(rs.getInt("id"));
book.setTitle(rs.getString("title"));
book.setYear(rs.getInt("year"));
book.setPublisher(rs.getString("publisher"));
book.setAuthor(rs.getString("author"));
book.setStock(rs.getInt("stock"));
return book;
}
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, "Data tidak ditemukan");
} finally {
db.closeConnection();
}
return null;
}
@Override
public boolean login(String username, String password) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public long countTimeLate(int nim, int idBook) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
| 8,290 | 0.541496 | 0.53848 | 238 | 33.831932 | 24.851261 | 143 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.831933 | false | false | 9 |
b7e5d652e2b03dbb53958a6603332e137ea7179e | 16,690,242,962,965 | d385ded2a850ca9155256d6faaa59171483b5311 | /core/src/com/vt/gameobjects/actionqueue/QueueableAction.java | e198672ed6b5986a23b8cc2977411cc0f277799b | [] | no_license | binary-machinery/VT | https://github.com/binary-machinery/VT | d5df2331747e199718b6ad23dd99ac216c990ecf | f0f1fb04b25e19514294bad77e0d7626f18d5ae7 | refs/heads/master | 2021-06-14T18:47:36.823000 | 2017-03-22T12:24:49 | 2017-03-22T12:24:49 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.vt.gameobjects.actionqueue;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
/**
* Created by Fck.r.sns on 22.08.2015.
*/
public interface QueueableAction {
class Flags {
public boolean CHANGE_MOVE_PTR = false;
public boolean CHANGE_VIEW_PTR = false;
}
enum State {
Ready,
Running,
Finished
}
State getState();
Flags getFlags();
void draw(SpriteBatch batch);
void onAdd(Context ctx);
void onRemove(Context ctx);
// this methods will return true when action finish it's task and queue can fetch next one
boolean start(Context ctx);
boolean stop(Context ctx);
boolean execute(Context ctx); // called every frame between start and stop
}
| UTF-8 | Java | 749 | java | QueueableAction.java | Java | [
{
"context": "c.gdx.graphics.g2d.SpriteBatch;\n\n/**\n * Created by Fck.r.sns on 22.08.2015.\n */\n\npublic interface QueueableAct",
"end": 119,
"score": 0.7996926307678223,
"start": 110,
"tag": "NAME",
"value": "Fck.r.sns"
}
] | null | [] | package com.vt.gameobjects.actionqueue;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
/**
* Created by Fck.r.sns on 22.08.2015.
*/
public interface QueueableAction {
class Flags {
public boolean CHANGE_MOVE_PTR = false;
public boolean CHANGE_VIEW_PTR = false;
}
enum State {
Ready,
Running,
Finished
}
State getState();
Flags getFlags();
void draw(SpriteBatch batch);
void onAdd(Context ctx);
void onRemove(Context ctx);
// this methods will return true when action finish it's task and queue can fetch next one
boolean start(Context ctx);
boolean stop(Context ctx);
boolean execute(Context ctx); // called every frame between start and stop
}
| 749 | 0.663551 | 0.651535 | 32 | 22.40625 | 22.840286 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4375 | false | false | 9 |
1d86377a31cc9e3099413393ee4ef6a8dcbc72f9 | 17,961,553,270,343 | 2d092a778d45050aef0e0cdfc0b4167fa64848fe | /contactsbook/moduleA/src/main/java/com/itechart/maleiko/contact_book/business/command/GetContactList.java | 8b411da858d79f67cd76dda8a64902d9acaa33be | [] | no_license | AlexMaleyko/project | https://github.com/AlexMaleyko/project | 33ddec3eb599b9b7ca1d4377c9b55d490b5ec6f5 | 012d4a6c4cbb7d2ae4caf58f834bb1e72fd341bd | refs/heads/master | 2021-01-23T01:08:43.913000 | 2017-05-22T14:12:53 | 2017-05-22T14:12:53 | 85,881,649 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.itechart.maleiko.contact_book.business.command;
import com.itechart.maleiko.contact_book.business.model.ContactDTO;
import org.apache.commons.lang3.StringUtils;
import com.itechart.maleiko.contact_book.business.service.ContactController;
import com.itechart.maleiko.contact_book.business.service.TemplateMessage;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.Connection;
import java.util.List;
public class GetContactList implements Command {
private ContactController controller;
private Connection conn;
public GetContactList(Connection conn){
this.conn=conn;
controller = new ContactController();
}
private static final org.slf4j.Logger LOGGER=
org.slf4j.LoggerFactory.getLogger(SaveContact.class);
@Override
public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
LOGGER.info("method: execute");
controller= new ContactController();
int currentPage = 0;
int clickedPage = 0;
int skipTotal = 0;
int clientLimit = 10;
if(StringUtils.isNotBlank(request.getParameter("currentPage"))) {
currentPage = Integer.parseInt(request.getParameter("currentPage"));
}
if(StringUtils.isNotBlank(request.getParameter("clickedPage"))) {
clickedPage = Integer.parseInt(request.getParameter("clickedPage"));
}
if(StringUtils.isNotBlank(request.getParameter("skipTotal"))) {
skipTotal = Integer.parseInt(request.getParameter("skipTotal"));
}
if(StringUtils.isNotBlank(request.getParameter("clientLimit"))){
clientLimit = Integer.parseInt(request.getParameter("clientLimit"));
}
if(currentPage != clickedPage){
skipTotal += clientLimit * (clickedPage - currentPage);
if(skipTotal < 0){
skipTotal = 0;
}
}
int numberOfContacts = controller.getNumberOfContacts(conn);
int pageTotal = (numberOfContacts-skipTotal)/clientLimit + skipTotal/clientLimit;
if(numberOfContacts%clientLimit > 0){
pageTotal+=1;
}
if(skipTotal%clientLimit > 0){
pageTotal+=1;
}
request.setAttribute("skipTotal", skipTotal);
request.setAttribute("currentPage", clickedPage);
request.setAttribute("clientLimit", clientLimit);
request.setAttribute("pageTotal", pageTotal);
request.setAttribute("msgTmpl", TemplateMessage.getAllTemplates());
List<ContactDTO> contacts =controller.getAllContactDTO(conn, skipTotal, clientLimit);
request.setAttribute("paginationFormAction", "ContactList");
request.setAttribute("contacts",contacts);
RequestDispatcher dispatcher = request.getRequestDispatcher("/index.jsp");
dispatcher.forward(request, response);
}
}
| UTF-8 | Java | 3,090 | java | GetContactList.java | Java | [] | null | [] | package com.itechart.maleiko.contact_book.business.command;
import com.itechart.maleiko.contact_book.business.model.ContactDTO;
import org.apache.commons.lang3.StringUtils;
import com.itechart.maleiko.contact_book.business.service.ContactController;
import com.itechart.maleiko.contact_book.business.service.TemplateMessage;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.Connection;
import java.util.List;
public class GetContactList implements Command {
private ContactController controller;
private Connection conn;
public GetContactList(Connection conn){
this.conn=conn;
controller = new ContactController();
}
private static final org.slf4j.Logger LOGGER=
org.slf4j.LoggerFactory.getLogger(SaveContact.class);
@Override
public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
LOGGER.info("method: execute");
controller= new ContactController();
int currentPage = 0;
int clickedPage = 0;
int skipTotal = 0;
int clientLimit = 10;
if(StringUtils.isNotBlank(request.getParameter("currentPage"))) {
currentPage = Integer.parseInt(request.getParameter("currentPage"));
}
if(StringUtils.isNotBlank(request.getParameter("clickedPage"))) {
clickedPage = Integer.parseInt(request.getParameter("clickedPage"));
}
if(StringUtils.isNotBlank(request.getParameter("skipTotal"))) {
skipTotal = Integer.parseInt(request.getParameter("skipTotal"));
}
if(StringUtils.isNotBlank(request.getParameter("clientLimit"))){
clientLimit = Integer.parseInt(request.getParameter("clientLimit"));
}
if(currentPage != clickedPage){
skipTotal += clientLimit * (clickedPage - currentPage);
if(skipTotal < 0){
skipTotal = 0;
}
}
int numberOfContacts = controller.getNumberOfContacts(conn);
int pageTotal = (numberOfContacts-skipTotal)/clientLimit + skipTotal/clientLimit;
if(numberOfContacts%clientLimit > 0){
pageTotal+=1;
}
if(skipTotal%clientLimit > 0){
pageTotal+=1;
}
request.setAttribute("skipTotal", skipTotal);
request.setAttribute("currentPage", clickedPage);
request.setAttribute("clientLimit", clientLimit);
request.setAttribute("pageTotal", pageTotal);
request.setAttribute("msgTmpl", TemplateMessage.getAllTemplates());
List<ContactDTO> contacts =controller.getAllContactDTO(conn, skipTotal, clientLimit);
request.setAttribute("paginationFormAction", "ContactList");
request.setAttribute("contacts",contacts);
RequestDispatcher dispatcher = request.getRequestDispatcher("/index.jsp");
dispatcher.forward(request, response);
}
}
| 3,090 | 0.694498 | 0.689968 | 75 | 40.200001 | 28.280972 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.733333 | false | false | 9 |
edc7954de37ab7cd0106f257f162cdfc147507bc | 17,961,553,274,240 | fd38a054c24d53b81d9ba7e70eee60fb7f5cc2b7 | /app/src/main/java/com/waysideutilities/waysidetruckfreights/Profile/TripDetails.java | 1768ec41fa914cb614a3ae928385163302fc6c91 | [] | no_license | srinivasudadi9000/Freight | https://github.com/srinivasudadi9000/Freight | aab6574a0a146d9a9b1f1fe3a25286682ec1baaa | 7f909aabb6b2dd1e0b780b80c7b1c996df8b05c5 | refs/heads/master | 2020-03-17T01:31:29.394000 | 2018-05-12T15:05:12 | 2018-05-12T15:05:12 | 133,156,558 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.waysideutilities.waysidetruckfreights.Profile;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.StrictMode;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.waysideutilities.waysidetruckfreights.MapsTruckActivity;
import com.waysideutilities.waysidetruckfreights.R;
import com.waysideutilities.waysidetruckfreights.helper.FrightUtils;
import com.waysideutilities.waysidetruckfreights.helper.HTTPhelper;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import static com.waysideutilities.waysidetruckfreights.helper.Constants.MY_PREFS_NAME;
/**
* Created by Archana on 8/29/2016.
*/
public class TripDetails extends AppCompatActivity {
private String language, load_booked_by_id, stringFrom, stringTo, truck_id, load_id, post_truckId;
private Toolbar toolbar;
private Bundle bundle;
private ProgressDialog progressDialog;
private Button btnStartTrip;
private TextView txtLoadId, txtDate, txtFrom, txtLoaderNumber, txtDriverName, txtTo, txtTruckRegNumber, txtLoadCategory, txtTruckType, txtWeight, txtLoadFlt, txtDescription,txtTruckDriverNo, txtLoadDesc;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
language = getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE).getString("LANGUAGE", null);
if (language != null)
FrightUtils.SetChoosenLanguage(language, this.getApplicationContext());
setContentView(R.layout.activity_trip_details);
init();
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle(getResources().getString(R.string.MyTrips_Details));
bundle = getIntent().getBundleExtra("BUNDLE");
if (!(bundle.getString("BOOK_BY_ID").equals("0"))) {
load_booked_by_id = bundle.getString("BOOK_BY_ID");
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectNetwork().detectAll().build());
new GetMyTripDetails(load_booked_by_id).execute();
} else {
finish();
}
}
private void init() {
toolbar = (Toolbar) findViewById(R.id.toolbar);
txtLoadId = (TextView) findViewById(R.id.txtLoadId);
txtDate = (TextView) findViewById(R.id.txtDate);
txtDriverName = (TextView) findViewById(R.id.txtDriverName);
txtLoaderNumber = (TextView) findViewById(R.id.txtLoaderNumber);
txtFrom = (TextView) findViewById(R.id.txtFrom);
txtTo = (TextView) findViewById(R.id.txtTo);
txtTruckRegNumber = (TextView) findViewById(R.id.txtTruckRegNumber);
txtLoadCategory = (TextView) findViewById(R.id.txtLoadCategory);
txtTruckType = (TextView) findViewById(R.id.txtTruckType);
txtWeight = (TextView) findViewById(R.id.txtWeight);
txtLoadFlt = (TextView) findViewById(R.id.txtLoadFlt);
txtTruckDriverNo = (TextView)findViewById(R.id.txtTruckDriverNo);
txtDescription = (TextView)findViewById(R.id.txtDescription);
//txtTotalCash = (TextView) findViewById(R.id.txtTotalCash);
btnStartTrip = (Button) findViewById(R.id.btnStartTrip);
btnStartTrip.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!(btnStartTrip.getText().toString()).equals("Completed")) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectNetwork().detectAll().build());
new UpdateTripStatus("1").execute();
}
}
});
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private class GetMyTripDetails extends AsyncTask<Void, Void, InputStream> {
private String load_id;
public GetMyTripDetails(String load_booked_by_id) {
this.load_id = load_booked_by_id;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = new ProgressDialog(TripDetails.this);
progressDialog.setMessage(getResources().getString(R.string.wait));
progressDialog.setCancelable(false);
progressDialog.show();
}
@Override
protected InputStream doInBackground(Void... params) {
HTTPhelper helper = new HTTPhelper();
InputStream inputStream = null;
try {
String newString = String.format("truck_booked_by_id=%s", this.load_id);
inputStream = helper.makeHttpRequest("http://www.waysideutilities.com/api/trip_details.php", "GET", newString);
} catch (JSONException e) {
e.printStackTrace();
}
return inputStream;
}
@Override
protected void onPostExecute(InputStream inputStream) {
super.onPostExecute(inputStream);
progressDialog.dismiss();
if (inputStream != null) {
StringBuilder builder = new StringBuilder();
InputStreamReader streamReader = new InputStreamReader(inputStream);
BufferedReader reader = new BufferedReader(streamReader);
String line = null;
try {
while ((line = reader.readLine()) != null) {
builder.append(line);
}
} catch (IOException e) {
e.printStackTrace();
}
String stringResult = builder.toString();
Log.e("Order Details : ", stringResult);
try {
JSONObject jsonObject = new JSONObject(stringResult);
String success = jsonObject.getString("success");
if (success.equals("1")) {
getSetValueFromBundle(bundle, jsonObject);
}
} catch (JSONException e) {
e.printStackTrace();
}
} else {
Toast.makeText(TripDetails.this, R.string.networkError, Toast.LENGTH_SHORT).show();
}
}
}
private void getSetValueFromBundle(Bundle bundle, JSONObject jsonObject) {
if (bundle.getString("BOOK_STATUS") != null) {
if (bundle.getString("BOOK_STATUS").equals("1")) {
if (bundle.getString("TRIP_STATUS").equals("2")) {
btnStartTrip.setText(R.string.completed);
} else if (bundle.getString("TRIP_STATUS").equals("0")) {
btnStartTrip.setText(R.string.start_trip);
} else {
btnStartTrip.setText(R.string.running);
}
}
}
try {
load_id = jsonObject.getString("loadid");
txtLoaderNumber.setText("Cargo provider number : " + jsonObject.getString("mobile_no"));
stringFrom = jsonObject.getString("from_street_name").concat(",").concat(jsonObject.getString("from_landmark")).concat(",").concat(jsonObject.getString("from_city")).concat(",").concat(jsonObject.getString("from_state")).concat(",").concat(jsonObject.getString("from_pincode"));
stringTo = jsonObject.getString("to_street_name").concat(",").concat(jsonObject.getString("to_landmark")).concat(",").concat(jsonObject.getString("to_city")).concat(",").concat(jsonObject.getString("to_state")).concat(",").concat(jsonObject.getString("to_pincode"));
txtFrom.setText("From : " + stringFrom);
txtTo.setText("To :" + stringTo);
txtTruckRegNumber.setText("Truck registration number : "+bundle.getString("TRUCK_REG_NUMBER"));
//if(bundle.getString("TRUCK_NO") != null)
//txtTruckNo.setText("Truck Number : "+bundle.getString("TRUCK_NO"));
if(bundle.getString("DESCRIPTION")!=null )
txtDescription.setText("Description : "+bundle.getString("DESCRIPTION"));
} catch (JSONException e) {
e.printStackTrace();
}
if (bundle.getString("TRUCKID") != null) {
truck_id = bundle.getString("TRUCKID");
}
if (bundle.getString("POSTTRUCKID") != null) {
post_truckId = bundle.getString("POSTTRUCKID");
txtLoadId.setText("Id : " + bundle.getString("POSTTRUCKID"));
}
if (bundle.getString("DATE") != null)
txtDate.setText("Date : " + FrightUtils.getFormattedDate("yyyy-MM-dd", "dd/MM/yyyy", bundle.getString("DATE"), null));
txtTruckDriverNo.setText("Driver Number : " + bundle.getString("DRIVER_NO"));
txtDriverName.setText("Driver Name : " + bundle.getString("DRIVER_NAME"));
if (bundle.getString("CATEGORY") != null)
txtLoadCategory.setText("Load category : " + bundle.getString("CATEGORY"));
if (bundle.getString("TRUCK_TYPE") != null)
txtTruckType.setText("Type of truck : " + bundle.getString("TRUCK_TYPE"));
if (bundle.getString("WEIGHT") != null)
txtWeight.setText("Capacity(in tons) : " + bundle.getString("WEIGHT"));
if (bundle.getString("FTL_LTL") != null)
txtLoadFlt.setText("FTL/LTL : " + bundle.getString("FTL_LTL"));
}
@Override
protected void onDestroy() {
super.onDestroy();
if (progressDialog != null) {
progressDialog.dismiss();
}
}
private class UpdateTripStatus extends AsyncTask<Void, Void, InputStream> {
private String status;
public UpdateTripStatus(String trip_status) {
this.status = trip_status;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = new ProgressDialog(TripDetails.this);
progressDialog.setMessage(getResources().getString(R.string.wait));
progressDialog.setCancelable(false);
progressDialog.show();
}
@Override
protected InputStream doInBackground(Void... params) {
HTTPhelper helper = new HTTPhelper();
InputStream inputStream = null;
try {
String newString = String.format("load_id=%s&posttruck_id=%s&trip_status=%S", load_id, post_truckId, status);
inputStream = helper.makeHttpRequest("http://www.waysideutilities.com/api/upload_trip_status.php", "GET", newString);
} catch (JSONException e) {
e.printStackTrace();
}
return inputStream;
}
@Override
protected void onPostExecute(InputStream inputStream) {
super.onPostExecute(inputStream);
progressDialog.dismiss();
if (inputStream != null) {
StringBuilder builder = new StringBuilder();
InputStreamReader streamReader = new InputStreamReader(inputStream);
BufferedReader reader = new BufferedReader(streamReader);
String line = null;
try {
while ((line = reader.readLine()) != null) {
builder.append(line);
}
} catch (IOException e) {
e.printStackTrace();
}
String stringResult = builder.toString();
Log.e("Update Trip Status : ", stringResult);
try {
JSONObject jsonObject = new JSONObject(stringResult);
String success = jsonObject.getString("success");
if (success.equals("1")) {
if (!(btnStartTrip.getText().toString()).equals("Completed")) {
Bundle bundle = new Bundle();
bundle.putString("ORIGIN", stringFrom);
bundle.putString("DEST", stringTo);
bundle.putString("TRUCK_ID", post_truckId);
bundle.putString("LOAD_ID", load_id);
Intent intent = new Intent(TripDetails.this, MapsTruckActivity.class);
intent.putExtra("BUNDLE", bundle);
startActivity(intent);
finish();
}
}
} catch (JSONException e) {
e.printStackTrace();
}
} else {
Toast.makeText(TripDetails.this, R.string.networkError, Toast.LENGTH_SHORT).show();
}
}
}
}
| UTF-8 | Java | 13,281 | java | TripDetails.java | Java | [
{
"context": "helper.Constants.MY_PREFS_NAME;\n\n/**\n * Created by Archana on 8/29/2016.\n */\npublic class TripDetails extend",
"end": 1029,
"score": 0.9987413883209229,
"start": 1022,
"tag": "NAME",
"value": "Archana"
}
] | null | [] | package com.waysideutilities.waysidetruckfreights.Profile;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.StrictMode;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.waysideutilities.waysidetruckfreights.MapsTruckActivity;
import com.waysideutilities.waysidetruckfreights.R;
import com.waysideutilities.waysidetruckfreights.helper.FrightUtils;
import com.waysideutilities.waysidetruckfreights.helper.HTTPhelper;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import static com.waysideutilities.waysidetruckfreights.helper.Constants.MY_PREFS_NAME;
/**
* Created by Archana on 8/29/2016.
*/
public class TripDetails extends AppCompatActivity {
private String language, load_booked_by_id, stringFrom, stringTo, truck_id, load_id, post_truckId;
private Toolbar toolbar;
private Bundle bundle;
private ProgressDialog progressDialog;
private Button btnStartTrip;
private TextView txtLoadId, txtDate, txtFrom, txtLoaderNumber, txtDriverName, txtTo, txtTruckRegNumber, txtLoadCategory, txtTruckType, txtWeight, txtLoadFlt, txtDescription,txtTruckDriverNo, txtLoadDesc;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
language = getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE).getString("LANGUAGE", null);
if (language != null)
FrightUtils.SetChoosenLanguage(language, this.getApplicationContext());
setContentView(R.layout.activity_trip_details);
init();
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle(getResources().getString(R.string.MyTrips_Details));
bundle = getIntent().getBundleExtra("BUNDLE");
if (!(bundle.getString("BOOK_BY_ID").equals("0"))) {
load_booked_by_id = bundle.getString("BOOK_BY_ID");
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectNetwork().detectAll().build());
new GetMyTripDetails(load_booked_by_id).execute();
} else {
finish();
}
}
private void init() {
toolbar = (Toolbar) findViewById(R.id.toolbar);
txtLoadId = (TextView) findViewById(R.id.txtLoadId);
txtDate = (TextView) findViewById(R.id.txtDate);
txtDriverName = (TextView) findViewById(R.id.txtDriverName);
txtLoaderNumber = (TextView) findViewById(R.id.txtLoaderNumber);
txtFrom = (TextView) findViewById(R.id.txtFrom);
txtTo = (TextView) findViewById(R.id.txtTo);
txtTruckRegNumber = (TextView) findViewById(R.id.txtTruckRegNumber);
txtLoadCategory = (TextView) findViewById(R.id.txtLoadCategory);
txtTruckType = (TextView) findViewById(R.id.txtTruckType);
txtWeight = (TextView) findViewById(R.id.txtWeight);
txtLoadFlt = (TextView) findViewById(R.id.txtLoadFlt);
txtTruckDriverNo = (TextView)findViewById(R.id.txtTruckDriverNo);
txtDescription = (TextView)findViewById(R.id.txtDescription);
//txtTotalCash = (TextView) findViewById(R.id.txtTotalCash);
btnStartTrip = (Button) findViewById(R.id.btnStartTrip);
btnStartTrip.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!(btnStartTrip.getText().toString()).equals("Completed")) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectNetwork().detectAll().build());
new UpdateTripStatus("1").execute();
}
}
});
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private class GetMyTripDetails extends AsyncTask<Void, Void, InputStream> {
private String load_id;
public GetMyTripDetails(String load_booked_by_id) {
this.load_id = load_booked_by_id;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = new ProgressDialog(TripDetails.this);
progressDialog.setMessage(getResources().getString(R.string.wait));
progressDialog.setCancelable(false);
progressDialog.show();
}
@Override
protected InputStream doInBackground(Void... params) {
HTTPhelper helper = new HTTPhelper();
InputStream inputStream = null;
try {
String newString = String.format("truck_booked_by_id=%s", this.load_id);
inputStream = helper.makeHttpRequest("http://www.waysideutilities.com/api/trip_details.php", "GET", newString);
} catch (JSONException e) {
e.printStackTrace();
}
return inputStream;
}
@Override
protected void onPostExecute(InputStream inputStream) {
super.onPostExecute(inputStream);
progressDialog.dismiss();
if (inputStream != null) {
StringBuilder builder = new StringBuilder();
InputStreamReader streamReader = new InputStreamReader(inputStream);
BufferedReader reader = new BufferedReader(streamReader);
String line = null;
try {
while ((line = reader.readLine()) != null) {
builder.append(line);
}
} catch (IOException e) {
e.printStackTrace();
}
String stringResult = builder.toString();
Log.e("Order Details : ", stringResult);
try {
JSONObject jsonObject = new JSONObject(stringResult);
String success = jsonObject.getString("success");
if (success.equals("1")) {
getSetValueFromBundle(bundle, jsonObject);
}
} catch (JSONException e) {
e.printStackTrace();
}
} else {
Toast.makeText(TripDetails.this, R.string.networkError, Toast.LENGTH_SHORT).show();
}
}
}
private void getSetValueFromBundle(Bundle bundle, JSONObject jsonObject) {
if (bundle.getString("BOOK_STATUS") != null) {
if (bundle.getString("BOOK_STATUS").equals("1")) {
if (bundle.getString("TRIP_STATUS").equals("2")) {
btnStartTrip.setText(R.string.completed);
} else if (bundle.getString("TRIP_STATUS").equals("0")) {
btnStartTrip.setText(R.string.start_trip);
} else {
btnStartTrip.setText(R.string.running);
}
}
}
try {
load_id = jsonObject.getString("loadid");
txtLoaderNumber.setText("Cargo provider number : " + jsonObject.getString("mobile_no"));
stringFrom = jsonObject.getString("from_street_name").concat(",").concat(jsonObject.getString("from_landmark")).concat(",").concat(jsonObject.getString("from_city")).concat(",").concat(jsonObject.getString("from_state")).concat(",").concat(jsonObject.getString("from_pincode"));
stringTo = jsonObject.getString("to_street_name").concat(",").concat(jsonObject.getString("to_landmark")).concat(",").concat(jsonObject.getString("to_city")).concat(",").concat(jsonObject.getString("to_state")).concat(",").concat(jsonObject.getString("to_pincode"));
txtFrom.setText("From : " + stringFrom);
txtTo.setText("To :" + stringTo);
txtTruckRegNumber.setText("Truck registration number : "+bundle.getString("TRUCK_REG_NUMBER"));
//if(bundle.getString("TRUCK_NO") != null)
//txtTruckNo.setText("Truck Number : "+bundle.getString("TRUCK_NO"));
if(bundle.getString("DESCRIPTION")!=null )
txtDescription.setText("Description : "+bundle.getString("DESCRIPTION"));
} catch (JSONException e) {
e.printStackTrace();
}
if (bundle.getString("TRUCKID") != null) {
truck_id = bundle.getString("TRUCKID");
}
if (bundle.getString("POSTTRUCKID") != null) {
post_truckId = bundle.getString("POSTTRUCKID");
txtLoadId.setText("Id : " + bundle.getString("POSTTRUCKID"));
}
if (bundle.getString("DATE") != null)
txtDate.setText("Date : " + FrightUtils.getFormattedDate("yyyy-MM-dd", "dd/MM/yyyy", bundle.getString("DATE"), null));
txtTruckDriverNo.setText("Driver Number : " + bundle.getString("DRIVER_NO"));
txtDriverName.setText("Driver Name : " + bundle.getString("DRIVER_NAME"));
if (bundle.getString("CATEGORY") != null)
txtLoadCategory.setText("Load category : " + bundle.getString("CATEGORY"));
if (bundle.getString("TRUCK_TYPE") != null)
txtTruckType.setText("Type of truck : " + bundle.getString("TRUCK_TYPE"));
if (bundle.getString("WEIGHT") != null)
txtWeight.setText("Capacity(in tons) : " + bundle.getString("WEIGHT"));
if (bundle.getString("FTL_LTL") != null)
txtLoadFlt.setText("FTL/LTL : " + bundle.getString("FTL_LTL"));
}
@Override
protected void onDestroy() {
super.onDestroy();
if (progressDialog != null) {
progressDialog.dismiss();
}
}
private class UpdateTripStatus extends AsyncTask<Void, Void, InputStream> {
private String status;
public UpdateTripStatus(String trip_status) {
this.status = trip_status;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = new ProgressDialog(TripDetails.this);
progressDialog.setMessage(getResources().getString(R.string.wait));
progressDialog.setCancelable(false);
progressDialog.show();
}
@Override
protected InputStream doInBackground(Void... params) {
HTTPhelper helper = new HTTPhelper();
InputStream inputStream = null;
try {
String newString = String.format("load_id=%s&posttruck_id=%s&trip_status=%S", load_id, post_truckId, status);
inputStream = helper.makeHttpRequest("http://www.waysideutilities.com/api/upload_trip_status.php", "GET", newString);
} catch (JSONException e) {
e.printStackTrace();
}
return inputStream;
}
@Override
protected void onPostExecute(InputStream inputStream) {
super.onPostExecute(inputStream);
progressDialog.dismiss();
if (inputStream != null) {
StringBuilder builder = new StringBuilder();
InputStreamReader streamReader = new InputStreamReader(inputStream);
BufferedReader reader = new BufferedReader(streamReader);
String line = null;
try {
while ((line = reader.readLine()) != null) {
builder.append(line);
}
} catch (IOException e) {
e.printStackTrace();
}
String stringResult = builder.toString();
Log.e("Update Trip Status : ", stringResult);
try {
JSONObject jsonObject = new JSONObject(stringResult);
String success = jsonObject.getString("success");
if (success.equals("1")) {
if (!(btnStartTrip.getText().toString()).equals("Completed")) {
Bundle bundle = new Bundle();
bundle.putString("ORIGIN", stringFrom);
bundle.putString("DEST", stringTo);
bundle.putString("TRUCK_ID", post_truckId);
bundle.putString("LOAD_ID", load_id);
Intent intent = new Intent(TripDetails.this, MapsTruckActivity.class);
intent.putExtra("BUNDLE", bundle);
startActivity(intent);
finish();
}
}
} catch (JSONException e) {
e.printStackTrace();
}
} else {
Toast.makeText(TripDetails.this, R.string.networkError, Toast.LENGTH_SHORT).show();
}
}
}
}
| 13,281 | 0.596642 | 0.595437 | 298 | 43.567116 | 36.204823 | 290 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.718121 | false | false | 9 |
ebd7cd1ad633e48dab007bcad79cbe28ff7cb639 | 5,961,414,658,455 | 75fcebb3837574fc83a9df164b25a68415aa0d2c | /src/entities/Depart.java | 0fd89741eda2c0017c2a456e8cb8daef6efe088a | [] | no_license | deadBlueShark/employee-rank | https://github.com/deadBlueShark/employee-rank | bd1a38f28d96daa43657a85b8d6a740fa4494c47 | 6c6c42623eaf31f93196358fc0d7104103204e59 | refs/heads/master | 2021-07-02T22:11:38.656000 | 2017-09-20T00:34:53 | 2017-09-20T00:34:53 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package entities;
// Generated Apr 26, 2017 3:11:57 PM by Hibernate Tools 5.2.1.Final
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.validator.constraints.NotBlank;
/**
* Depart generated by hbm2java
*/
@Entity
@Table(name = "depart", catalog = "personal")
public class Depart implements java.io.Serializable {
@NotBlank(message = "You must fill out this field")
private String departId;
@NotBlank(message = "You must fill out this field")
private String name;
private Set<Staff> staffs = new HashSet<Staff>(0);
public Depart() {
}
public Depart(String departId, String name) {
this.departId = departId;
this.name = name;
}
public Depart(String departId, String name, Set<Staff> staffs) {
this.departId = departId;
this.name = name;
this.staffs = staffs;
}
@Id
@Column(name = "DepartId", unique = true, nullable = false, length = 10)
public String getDepartId() {
return this.departId;
}
public void setDepartId(String departId) {
this.departId = departId;
}
@Column(name = "Name", nullable = false, length = 50)
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "depart")
public Set<Staff> getStaffs() {
return this.staffs;
}
public void setStaffs(Set<Staff> staffs) {
this.staffs = staffs;
}
}
| UTF-8 | Java | 1,585 | java | Depart.java | Java | [] | null | [] | package entities;
// Generated Apr 26, 2017 3:11:57 PM by Hibernate Tools 5.2.1.Final
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.validator.constraints.NotBlank;
/**
* Depart generated by hbm2java
*/
@Entity
@Table(name = "depart", catalog = "personal")
public class Depart implements java.io.Serializable {
@NotBlank(message = "You must fill out this field")
private String departId;
@NotBlank(message = "You must fill out this field")
private String name;
private Set<Staff> staffs = new HashSet<Staff>(0);
public Depart() {
}
public Depart(String departId, String name) {
this.departId = departId;
this.name = name;
}
public Depart(String departId, String name, Set<Staff> staffs) {
this.departId = departId;
this.name = name;
this.staffs = staffs;
}
@Id
@Column(name = "DepartId", unique = true, nullable = false, length = 10)
public String getDepartId() {
return this.departId;
}
public void setDepartId(String departId) {
this.departId = departId;
}
@Column(name = "Name", nullable = false, length = 50)
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "depart")
public Set<Staff> getStaffs() {
return this.staffs;
}
public void setStaffs(Set<Staff> staffs) {
this.staffs = staffs;
}
}
| 1,585 | 0.716088 | 0.70347 | 74 | 20.418919 | 20.187637 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.162162 | false | false | 9 |
f77d00f6d16476235ef11d133364dc0208645606 | 7,292,854,510,777 | a3e5b90e168c2856448a80b5012bc463da1db03c | /T1/src/Array/easy/q278/Solution.java | 7843a1b456130621a01552c9d0d08e06668478fb | [] | no_license | Vik1ang/LeetWithJava | https://github.com/Vik1ang/LeetWithJava | 9ef28990cec3a954bcb0ddf4a62c5ff195f473b6 | 07440c9b7cc39cf1f8fb787824fe74f71d165251 | refs/heads/master | 2023-07-30T10:19:46.148000 | 2021-09-15T01:04:17 | 2021-09-15T01:04:17 | 327,828,819 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Array.easy.q278;
/**
* @author Vikiang
* @URL
*/
public class Solution extends VersionControl {
public int firstBadVersion(int n) {
return 0;
}
}
| UTF-8 | Java | 175 | java | Solution.java | Java | [
{
"context": "package Array.easy.q278;\n\n/**\n * @author Vikiang\n * @URL\n */\npublic class Solution extends Version",
"end": 48,
"score": 0.9997038245201111,
"start": 41,
"tag": "NAME",
"value": "Vikiang"
}
] | null | [] | package Array.easy.q278;
/**
* @author Vikiang
* @URL
*/
public class Solution extends VersionControl {
public int firstBadVersion(int n) {
return 0;
}
}
| 175 | 0.634286 | 0.611429 | 11 | 14.818182 | 15.086527 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | false | false | 9 |
3e251e80157f73ba7e57eda130a2bfe372ba0b37 | 7,172,595,423,587 | 2d6a5d29e1c67e6845dd87c7a93a9c3fcbe5ef5d | /src/main/java/com/prateek/army/Service/OwnersService.java | fdee552bfaaeab7044e726a32daab38a1ccf6b9e | [] | no_license | prateekmaurya10/Complain_Portal_Back | https://github.com/prateekmaurya10/Complain_Portal_Back | f3db5bd84116a5bf48a790e8c130eabf6f2c541d | 26417d285c8705f92baa1877724ea2d2e25698c3 | refs/heads/master | 2021-04-27T18:23:58.480000 | 2018-04-14T00:37:07 | 2018-04-14T00:37:07 | 122,338,436 | 0 | 1 | null | false | 2018-04-25T20:43:38 | 2018-02-21T13:14:53 | 2018-04-14T00:37:19 | 2018-04-25T20:41:47 | 1,529 | 0 | 1 | 1 | Java | false | null | package com.prateek.army.Service;
import com.prateek.army.model.Owners;
import java.util.List;
public interface OwnersService {
void addOwner(Owners owner);
List<Owners> findOwners();
int getOwnerId(Owners owner);
Owners findOwnerById(int id);
}
| UTF-8 | Java | 269 | java | OwnersService.java | Java | [] | null | [] | package com.prateek.army.Service;
import com.prateek.army.model.Owners;
import java.util.List;
public interface OwnersService {
void addOwner(Owners owner);
List<Owners> findOwners();
int getOwnerId(Owners owner);
Owners findOwnerById(int id);
}
| 269 | 0.728625 | 0.728625 | 16 | 15.8125 | 15.946076 | 37 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4375 | false | false | 9 |
825bb3987fd93d4d96b515558cfbee779c762c9b | 31,628,139,212,611 | df13db4cabfaf130613ee7a3ca64bb1a5b7f44a3 | /src/main/java/com/moonsworth/lunar/client/util/ColorUtil.java | c0ac5180207c2edeaf70a1741c17340938c00521 | [] | no_license | 1onely-lucas/LunarClient | https://github.com/1onely-lucas/LunarClient | 8425ba152e388023fdbba6889af132e32e207921 | aa2e05705c43bb0481b16036a97b874a9b6de24b | refs/heads/main | 2023-08-04T20:19:28.563000 | 2021-09-24T18:13:19 | 2021-09-24T18:13:19 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.moonsworth.lunar.client.util;
public final class ColorUtil {
public static float lIlIlIlIlIIlIIlIIllIIIIIl(int n) {
return (float)ColorUtil.IlllIIIIIIlllIlIIlllIlIIl(n) / 255.0f;
}
public static int IlllIIIIIIlllIlIIlllIlIIl(int n) {
return n >> 16 & 0xFF;
}
public static float lIllIlIIIlIIIIIIIlllIlIll(int n) {
return (float)ColorUtil.llIlllIIIllllIIlllIllIIIl(n) / 255.0f;
}
public static int llIlllIIIllllIIlllIllIIIl(int n) {
return n >> 8 & 0xFF;
}
public static float llllIIlIIlIIlIIllIIlIIllI(int n) {
return (float)ColorUtil.IlIlIlllllIlIIlIlIlllIlIl(n) / 255.0f;
}
public static int IlIlIlllllIlIIlIlIlllIlIl(int n) {
return n >> 0 & 0xFF;
}
public static float llIIIIIIIllIIllIlIllIIIIl(int n) {
return (float)ColorUtil.lIIIllIllIIllIlllIlIIlllI(n) / 255.0f;
}
public static int lIIIllIllIIllIlllIlIIlllI(int n) {
return n >> 24 & 0xFF;
}
public static int lIlIlIlIlIIlIIlIIllIIIIIl(int n, int n2, int n3, int n4) {
return (n4 & 0xFF) << 24 | (n & 0xFF) << 16 | (n2 & 0xFF) << 8 | n3 & 0xFF;
}
public static int lIlIlIlIlIIlIIlIIllIIIIIl(float f, float f2, float f3, float f4) {
return ColorUtil.lIlIlIlIlIIlIIlIIllIIIIIl((int)((double)(f * 255.0f) + 0.5), (int)((double)(f2 * 255.0f) + 0.5), (int)((double)(f3 * 255.0f) + 0.5), (int)((double)(f4 * 255.0f) + 0.5));
}
public static int lIlIlIlIlIIlIIlIIllIIIIIl(int n, float f) {
int n2 = (int)((float)ColorUtil.lIIIllIllIIllIlllIlIIlllI(n) * f);
return n2 << 24 | n & 0xFFFFFF;
}
public ColorUtil() {
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
}
} | UTF-8 | Java | 1,786 | java | ColorUtil.java | Java | [] | null | [] | package com.moonsworth.lunar.client.util;
public final class ColorUtil {
public static float lIlIlIlIlIIlIIlIIllIIIIIl(int n) {
return (float)ColorUtil.IlllIIIIIIlllIlIIlllIlIIl(n) / 255.0f;
}
public static int IlllIIIIIIlllIlIIlllIlIIl(int n) {
return n >> 16 & 0xFF;
}
public static float lIllIlIIIlIIIIIIIlllIlIll(int n) {
return (float)ColorUtil.llIlllIIIllllIIlllIllIIIl(n) / 255.0f;
}
public static int llIlllIIIllllIIlllIllIIIl(int n) {
return n >> 8 & 0xFF;
}
public static float llllIIlIIlIIlIIllIIlIIllI(int n) {
return (float)ColorUtil.IlIlIlllllIlIIlIlIlllIlIl(n) / 255.0f;
}
public static int IlIlIlllllIlIIlIlIlllIlIl(int n) {
return n >> 0 & 0xFF;
}
public static float llIIIIIIIllIIllIlIllIIIIl(int n) {
return (float)ColorUtil.lIIIllIllIIllIlllIlIIlllI(n) / 255.0f;
}
public static int lIIIllIllIIllIlllIlIIlllI(int n) {
return n >> 24 & 0xFF;
}
public static int lIlIlIlIlIIlIIlIIllIIIIIl(int n, int n2, int n3, int n4) {
return (n4 & 0xFF) << 24 | (n & 0xFF) << 16 | (n2 & 0xFF) << 8 | n3 & 0xFF;
}
public static int lIlIlIlIlIIlIIlIIllIIIIIl(float f, float f2, float f3, float f4) {
return ColorUtil.lIlIlIlIlIIlIIlIIllIIIIIl((int)((double)(f * 255.0f) + 0.5), (int)((double)(f2 * 255.0f) + 0.5), (int)((double)(f3 * 255.0f) + 0.5), (int)((double)(f4 * 255.0f) + 0.5));
}
public static int lIlIlIlIlIIlIIlIIllIIIIIl(int n, float f) {
int n2 = (int)((float)ColorUtil.lIIIllIllIIllIlllIlIIlllI(n) * f);
return n2 << 24 | n & 0xFFFFFF;
}
public ColorUtil() {
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
}
} | 1,786 | 0.647816 | 0.605263 | 52 | 33.365383 | 37.964066 | 194 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.538462 | false | false | 9 |
15660d9cb22078348e5681287ff0a6d62eaa6652 | 9,062,381,042,317 | 6c89f1797bd4162498f7db9129fe4ac5ba9c5bdc | /src/main/java/com/qm/model/IUnit.java | d0ef2a3b169442c6ef9f6a2a05ed704140384794 | [] | no_license | janhavi07/QuantityAPI | https://github.com/janhavi07/QuantityAPI | 43ba7ccf318f1e81bf979bfb54ea6a46c3ee1b03 | 8d4e95aee585c75cbe072bb19d7c4941d0685751 | refs/heads/master | 2020-12-10T09:38:22.630000 | 2020-01-13T09:28:28 | 2020-01-13T09:28:28 | 233,558,347 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.qm.model;
public interface IUnit {
Double conversion();
}
| UTF-8 | Java | 75 | java | IUnit.java | Java | [] | null | [] | package com.qm.model;
public interface IUnit {
Double conversion();
}
| 75 | 0.706667 | 0.706667 | 5 | 14 | 11.081516 | 24 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 9 |
1da19c66dec06383deed16a5ca6fe48a88aea21c | 21,096,879,406,175 | d8c31d2f3bd8a878fead45607db17653cdb7f025 | /backstage-service/src/main/java/com/zhancheng/backstage/service/CouponService.java | 0d8de551741e41d389f294999ff58f45883a3a6f | [] | no_license | qunniao/zc_program | https://github.com/qunniao/zc_program | 9225dfbe359d2110f74564cd0a7adba34b5d5f6c | 38c2fc0d5435f70682a7b2ac8733e20c9e156ca8 | refs/heads/master | 2022-06-22T12:54:12.449000 | 2020-04-24T20:09:42 | 2020-04-24T20:09:42 | 258,612,834 | 0 | 0 | null | false | 2022-06-17T03:09:07 | 2020-04-24T20:07:16 | 2020-04-24T20:10:03 | 2022-06-17T03:09:07 | 150 | 0 | 0 | 1 | Java | false | false | package com.zhancheng.backstage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhancheng.core.entity.Coupon;
/**
* <p>
* 商家发布的优惠券 服务类
* </p>
*
* @author tangchao
* @since 2019-08-16
*/
public interface CouponService extends IService<Coupon> {
}
| UTF-8 | Java | 326 | java | CouponService.java | Java | [
{
"context": "\r\n * <p>\r\n * 商家发布的优惠券 服务类\r\n * </p>\r\n *\r\n * @author tangchao\r\n * @since 2019-08-16\r\n */\r\npublic interface Coup",
"end": 211,
"score": 0.9996347427368164,
"start": 203,
"tag": "USERNAME",
"value": "tangchao"
}
] | null | [] | package com.zhancheng.backstage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhancheng.core.entity.Coupon;
/**
* <p>
* 商家发布的优惠券 服务类
* </p>
*
* @author tangchao
* @since 2019-08-16
*/
public interface CouponService extends IService<Coupon> {
}
| 326 | 0.690789 | 0.664474 | 16 | 17 | 20 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.1875 | false | false | 9 |
0ee44e57ef999c42a08404b6e05713b6568bf636 | 28,346,784,210,525 | 1998c2bde8ec9f9f42ff898088138386f55816af | /src/main/java/br/com/alura/controller/HoraLancadaController.java | fb6e98f2d6095acc4f47c498c0ba74a64010a468 | [] | no_license | FernandoMarcheti/vraptor-jpa | https://github.com/FernandoMarcheti/vraptor-jpa | 55a041e88c7d006e4575d02303db9204e196a1bc | b17de7960b994549de2ac06cb48130ff7832bd14 | refs/heads/master | 2020-12-02T19:17:46.327000 | 2017-07-05T12:58:41 | 2017-07-05T12:58:41 | 96,319,494 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.alura.controller;
import java.util.List;
import javax.inject.Inject;
import javax.validation.Valid;
import br.com.alura.dao.HoraLancadaDAO;
import br.com.alura.modelo.HoraLancada;
import br.com.alura.modelo.UsuarioLogado;
import br.com.caelum.vraptor.Controller;
import br.com.caelum.vraptor.Path;
import br.com.caelum.vraptor.Post;
import br.com.caelum.vraptor.Result;
import br.com.caelum.vraptor.interceptor.IncludeParameters;
import br.com.caelum.vraptor.validator.Validator;
@Controller
@Path(value="/horalancada")
public class HoraLancadaController {
private HoraLancadaDAO dao;
private Result result;
private Validator validator;
private UsuarioLogado logado;
public HoraLancadaController() {
}
@Inject
public HoraLancadaController(HoraLancadaDAO dao, Result result,
Validator validator, UsuarioLogado logado) {
this.dao = dao;
this.result = result;
this.validator = validator;
this.logado = logado;
}
public void form(){}
public void lista(){
result.include("horas", dao.lista());
}
@Post @IncludeParameters
public void salva(@Valid HoraLancada horaLancada){
validator.onErrorRedirectTo(this).form();
horaLancada.setUsuario(logado.getUsuario());
dao.salva(horaLancada);
result.redirectTo(this).lista();
}
public void relatorioDeHoras(){
List<HoraLancada> horasPorUsuario = dao.getRelatorioDeHoras(logado.getUsuario());
RelatorioDeHoras relatorioDeHoras = new RelatorioDeHoras(horasPorUsuario);
result.include("relatorio", relatorioDeHoras.getHorasPorDia());
}
}
| UTF-8 | Java | 1,544 | java | HoraLancadaController.java | Java | [] | null | [] | package br.com.alura.controller;
import java.util.List;
import javax.inject.Inject;
import javax.validation.Valid;
import br.com.alura.dao.HoraLancadaDAO;
import br.com.alura.modelo.HoraLancada;
import br.com.alura.modelo.UsuarioLogado;
import br.com.caelum.vraptor.Controller;
import br.com.caelum.vraptor.Path;
import br.com.caelum.vraptor.Post;
import br.com.caelum.vraptor.Result;
import br.com.caelum.vraptor.interceptor.IncludeParameters;
import br.com.caelum.vraptor.validator.Validator;
@Controller
@Path(value="/horalancada")
public class HoraLancadaController {
private HoraLancadaDAO dao;
private Result result;
private Validator validator;
private UsuarioLogado logado;
public HoraLancadaController() {
}
@Inject
public HoraLancadaController(HoraLancadaDAO dao, Result result,
Validator validator, UsuarioLogado logado) {
this.dao = dao;
this.result = result;
this.validator = validator;
this.logado = logado;
}
public void form(){}
public void lista(){
result.include("horas", dao.lista());
}
@Post @IncludeParameters
public void salva(@Valid HoraLancada horaLancada){
validator.onErrorRedirectTo(this).form();
horaLancada.setUsuario(logado.getUsuario());
dao.salva(horaLancada);
result.redirectTo(this).lista();
}
public void relatorioDeHoras(){
List<HoraLancada> horasPorUsuario = dao.getRelatorioDeHoras(logado.getUsuario());
RelatorioDeHoras relatorioDeHoras = new RelatorioDeHoras(horasPorUsuario);
result.include("relatorio", relatorioDeHoras.getHorasPorDia());
}
}
| 1,544 | 0.777202 | 0.777202 | 58 | 25.620689 | 20.777 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.413793 | false | false | 9 |
701433428bb1f6af88fc9cf8df01de6b10c6dfa6 | 25,546,465,521,072 | 6aaa879f7e1cc2b1d977115867fc8a0f500e3827 | /health/src/main/java/com/develop/recruitmentstatics/controllers/HealthController.java | 5d2d314c7a8d7a60de94dcd884b0a16a27aa5481 | [] | no_license | shivamalpha/Health | https://github.com/shivamalpha/Health | 719a162fa10e3f43b4f2f171e46a0d76ed41d6ff | 61e1d554e502d0ca70a6fc53a2a9260d9af59452 | refs/heads/main | 2023-08-02T04:44:03.047000 | 2021-09-20T09:23:54 | 2021-09-20T09:23:54 | 408,158,378 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.develop.recruitmentstatics.controllers;
import com.develop.recruitmentstatics.request.*;
import com.develop.recruitmentstatics.response.*;
import com.develop.recruitmentstatics.service.HealthService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@Slf4j
@RestController
@CrossOrigin(origins = "*")
@RequestMapping(value = "/health/v1")
public class HealthController {
@Autowired
private HealthService healthService;
@RequestMapping(value = "/registerUser", method = RequestMethod.POST)
public RegisterUserResponse registerUser(@Valid @RequestBody RegisterUserRequest registerUserRequest) throws Exception {
return healthService.registerUser(registerUserRequest);
}
@RequestMapping(value = "/registerAdmin", method = RequestMethod.POST)
public RegisterAdminResponse registerAdmin(@Valid @RequestBody RegisterAdminRequest registerAdminRequest) throws Exception {
return healthService.registerAdmin(registerAdminRequest);
}
@RequestMapping(value = "/calculateRisk", method = RequestMethod.POST)
public SelfAssessmentResponse calculateRisk(@Valid @RequestBody SelfAssessmentRequest selfAssessmentRequest) throws Exception {
return healthService.riskCalculator(selfAssessmentRequest);
}
@RequestMapping(value = "/updateCovidResult", method = RequestMethod.POST)
public UpdateCovidResponse updateCovidResult(@Valid @RequestBody UpdateCovidRequest updateCovidRequest) throws Exception {
return healthService.updateCovidResult(updateCovidRequest);
}
@RequestMapping(value = "/getZoneInfo", method = RequestMethod.POST)
public GetZoneInfoResponse getZoneInfo(@Valid @RequestBody GetZoneInfo getZoneInfo) throws Exception {
return healthService.getZoneInfo(getZoneInfo);
}
}
| UTF-8 | Java | 1,932 | java | HealthController.java | Java | [] | null | [] | package com.develop.recruitmentstatics.controllers;
import com.develop.recruitmentstatics.request.*;
import com.develop.recruitmentstatics.response.*;
import com.develop.recruitmentstatics.service.HealthService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@Slf4j
@RestController
@CrossOrigin(origins = "*")
@RequestMapping(value = "/health/v1")
public class HealthController {
@Autowired
private HealthService healthService;
@RequestMapping(value = "/registerUser", method = RequestMethod.POST)
public RegisterUserResponse registerUser(@Valid @RequestBody RegisterUserRequest registerUserRequest) throws Exception {
return healthService.registerUser(registerUserRequest);
}
@RequestMapping(value = "/registerAdmin", method = RequestMethod.POST)
public RegisterAdminResponse registerAdmin(@Valid @RequestBody RegisterAdminRequest registerAdminRequest) throws Exception {
return healthService.registerAdmin(registerAdminRequest);
}
@RequestMapping(value = "/calculateRisk", method = RequestMethod.POST)
public SelfAssessmentResponse calculateRisk(@Valid @RequestBody SelfAssessmentRequest selfAssessmentRequest) throws Exception {
return healthService.riskCalculator(selfAssessmentRequest);
}
@RequestMapping(value = "/updateCovidResult", method = RequestMethod.POST)
public UpdateCovidResponse updateCovidResult(@Valid @RequestBody UpdateCovidRequest updateCovidRequest) throws Exception {
return healthService.updateCovidResult(updateCovidRequest);
}
@RequestMapping(value = "/getZoneInfo", method = RequestMethod.POST)
public GetZoneInfoResponse getZoneInfo(@Valid @RequestBody GetZoneInfo getZoneInfo) throws Exception {
return healthService.getZoneInfo(getZoneInfo);
}
}
| 1,932 | 0.788302 | 0.786232 | 49 | 38.42857 | 39.491669 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.387755 | false | false | 9 |
07fa7828a87fd7917b1b94dc3b6186cc96e869a3 | 17,609,365,955,921 | 64642b1e00b3000e5b68a908b3ce62801d270d79 | /src/main/java/javaBase/RuntimeConstantOOM.java | dec56eaea4cb2c67baa2b64655d0b9367714b103 | [] | no_license | toFindMore/Algorithm | https://github.com/toFindMore/Algorithm | a473f1f1792d10bc74d74d0d76566b3d10ad5641 | 39d2e30583c43c3246bfe00d2ffb652fcb919f8a | refs/heads/master | 2021-06-08T18:20:25.338000 | 2019-07-14T04:05:21 | 2019-07-14T04:05:21 | 152,101,644 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package javaBase;
public class RuntimeConstantOOM {
public static void main(String[] args) {
String str1 = new StringBuilder("计算机").append("软件").toString();
String str11 = "计算机软件";
System.out.println(str11 == str1);
System.out.println(str1.intern() == str1);
String str2 = new StringBuilder("By").append("te").toString();
System.out.println(str2.intern() == str2);
}
} | UTF-8 | Java | 452 | java | RuntimeConstantOOM.java | Java | [] | null | [] | package javaBase;
public class RuntimeConstantOOM {
public static void main(String[] args) {
String str1 = new StringBuilder("计算机").append("软件").toString();
String str11 = "计算机软件";
System.out.println(str11 == str1);
System.out.println(str1.intern() == str1);
String str2 = new StringBuilder("By").append("te").toString();
System.out.println(str2.intern() == str2);
}
} | 452 | 0.611111 | 0.585648 | 19 | 21.789474 | 25.115688 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.368421 | false | false | 9 |
126f2562d793d253a2d7b3a9f7098a61c7c60f75 | 5,196,910,428,488 | b1c81b8caa41978c662c5e978b67741f6e1acbcd | /java/Tuples/SequenceDiffs.java | 067f7a4394e40e6f22318fe1d77c5af15a265f09 | [] | no_license | mmammel/projects | https://github.com/mmammel/projects | 6e254444664d13a3f8fbd9c01037d37c6e3c010b | f78c8fc7f00ad4fdbd458afa890f5d271a7d9b1d | refs/heads/master | 2023-09-03T22:52:55.198000 | 2023-08-16T18:24:29 | 2023-08-16T18:24:29 | 5,439,201 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public class SequenceDiffs
{
public void dumpDiffs( int [] array )
{
int [] diffArray = new int [ array.length - 1 ];;
this.printArray( array );
if( array.length == 1 ) return;
for( int i = 1; i < array.length; i++ )
{
diffArray[ i - 1 ] = Math.abs(array[i] - array[i-1]);
}
dumpDiffs( diffArray );
}
private void printArray( int [] array )
{
for( int i = 0; i < array.length; i++ )
{
System.out.print( "[" + array[i] + "]" );
}
System.out.print( "\n" );
}
public static void main( String [] args )
{
String [] inputs = args[0].split(",");
int [] initial = new int [ inputs.length ];
for( int i = 0; i < inputs.length; i++ )
{
initial[i] = Integer.parseInt(inputs[i]);
}
SequenceDiffs SD = new SequenceDiffs();
SD.dumpDiffs( initial );
}
}
| UTF-8 | Java | 854 | java | SequenceDiffs.java | Java | [] | null | [] | public class SequenceDiffs
{
public void dumpDiffs( int [] array )
{
int [] diffArray = new int [ array.length - 1 ];;
this.printArray( array );
if( array.length == 1 ) return;
for( int i = 1; i < array.length; i++ )
{
diffArray[ i - 1 ] = Math.abs(array[i] - array[i-1]);
}
dumpDiffs( diffArray );
}
private void printArray( int [] array )
{
for( int i = 0; i < array.length; i++ )
{
System.out.print( "[" + array[i] + "]" );
}
System.out.print( "\n" );
}
public static void main( String [] args )
{
String [] inputs = args[0].split(",");
int [] initial = new int [ inputs.length ];
for( int i = 0; i < inputs.length; i++ )
{
initial[i] = Integer.parseInt(inputs[i]);
}
SequenceDiffs SD = new SequenceDiffs();
SD.dumpDiffs( initial );
}
}
| 854 | 0.533958 | 0.52459 | 38 | 21.473684 | 19.900723 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.526316 | false | false | 9 |
f4ec7c985f8d3d9bdef67fa8501fbd6d0cf558cc | 5,196,910,432,680 | 022bc1e7c9f509c9f40cbacc7e0a5823650035d3 | /day10/day10/Demo-Day10-Homework/helloworld-consumer/src/main/java/microservice/demo/training21days/provider/service/HelloServiceReactive.java | f2d59b1b2c020518c06a0726848fd0f9e40391cd | [] | no_license | LnkSaber/HUAWEI-Microservice-demo | https://github.com/LnkSaber/HUAWEI-Microservice-demo | 02e7e853a819edf466504a2145d60d949fa74e4b | b149fa21f4f8a4654ec7efe977b9f4be6f318e8c | refs/heads/master | 2022-01-19T14:37:18.121000 | 2019-04-02T01:33:13 | 2019-04-02T01:33:13 | 176,182,838 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package microservice.demo.training21days.provider.service;
import java.util.concurrent.CompletableFuture;
public interface HelloServiceReactive {
CompletableFuture<String> sayHello(String name);
}
| UTF-8 | Java | 201 | java | HelloServiceReactive.java | Java | [] | null | [] | package microservice.demo.training21days.provider.service;
import java.util.concurrent.CompletableFuture;
public interface HelloServiceReactive {
CompletableFuture<String> sayHello(String name);
}
| 201 | 0.840796 | 0.830846 | 7 | 27.714285 | 24.276468 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 9 |
b5a33396e911053e98237d15cfca49193352a7e6 | 5,196,910,431,533 | f112672437a9429d1630a8fdee443c8b2cf3e53a | /src/HammingDistance/Test.java | e452858b16b43b6dd0ad02fb1798af9e1deac43f | [] | no_license | shichaohao/LeetCodeUsingJava | https://github.com/shichaohao/LeetCodeUsingJava | 09d6a47769f86f4b808b6aa794bcb2eceeaf8360 | 34c1708ce0e9e5592dba2b3ce6a1a6c238c8415c | refs/heads/master | 2020-04-12T06:44:00.602000 | 2017-09-02T07:09:40 | 2017-09-02T07:09:40 | 62,051,832 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package HammingDistance;
/**
* Created by Think on 12/23/16.
*/
public class Test {
public static void main(String[] args) {
Solution solution = new Solution();
System.out.println(solution.hammingDistance(1, 4));
}
}
| UTF-8 | Java | 244 | java | Test.java | Java | [
{
"context": "package HammingDistance;\n\n/**\n * Created by Think on 12/23/16.\n */\npublic class Test {\n public s",
"end": 49,
"score": 0.7282853722572327,
"start": 44,
"tag": "USERNAME",
"value": "Think"
}
] | null | [] | package HammingDistance;
/**
* Created by Think on 12/23/16.
*/
public class Test {
public static void main(String[] args) {
Solution solution = new Solution();
System.out.println(solution.hammingDistance(1, 4));
}
}
| 244 | 0.643443 | 0.610656 | 11 | 21.181818 | 19.85318 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false | 9 |
a58e016e664d07612955d1444278ae559f0c0cce | 21,303,037,842,890 | 022cb37222ca9ebea0bfbbe6e0813b5e7786650c | /Soru_1/src/Soru_1/Calculator.java | d6cf22d50d3cb94d7e4ff7108a24123bb4275676 | [
"Apache-2.0"
] | permissive | frknbrbr/Simple-Interpreter | https://github.com/frknbrbr/Simple-Interpreter | c0b0fecc58a2644737cd773ba38ef305f857b307 | edfa1e45e821a689dc975cc5d2c9748d42436061 | refs/heads/master | 2020-04-13T01:16:04.370000 | 2019-02-22T17:49:43 | 2019-02-22T17:49:43 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Soru_1;
public class Calculator {
private Parser parser = new Parser();
/**
* private calculate method for turning a number sign to negative
*
* @param operator
* @param number
* @return a double value
*/
private double calculate(Operator operator, double number) {
if (operator.geType().equals(Type.MINUS)) {
return number * -1;
} else
return number;
}
/**
* calculate method for handling operations(with 2 number and 1 operator)
*
* @param operator
* @param number1
* @param number2
* @return returns result double number
*/
private double calculate(Operator operator, double number1, double number2) {
if (operator.geType().equals(Type.PLUS)) {
return number1 + number2;
} else if (operator.geType().equals(Type.MINUS)) {
return number1 - number2;
} else if (operator.geType().equals(Type.TIMES)) {
return number1 * number2;
} else if (operator.geType().equals(Type.DIVIDE)) {
return number1 / number2;
}
return -1;
}
public void calculateHelper(Operator operator, Double number1, Double number2) {
if (parser.getOperatorStack().peek().geType() == Type.MINUS) {
number2 = number2 * -1;
double newNumber = calculate(operator, number2, number1) * -1;
parser.getNumberStack().push(newNumber);
} else {
double newNumber = calculate(operator, number2, number1);
parser.getNumberStack().push(newNumber);
}
}
/**
* calculator method to calculate whole expression
*
* @param infix
*/
public void calculator(String infix) {
parser.parse(infix);
while (!parser.getOperatorStack().isEmpty()) {
Operator operator1 = parser.getOperatorStack().pop();
Double number1 = parser.getNumberStack().pop();
if (!parser.getNumberStack().isEmpty()) {
Double number2 = parser.getNumberStack().pop();
if (!parser.getOperatorStack().isEmpty()) {
calculateHelper(operator1, number1, number2);
} else {
double newNumber = calculate(operator1, number2, number1);
parser.getNumberStack().push(newNumber);
}
} else {
double newNumber = calculate(operator1, number1);
parser.getNumberStack().push(newNumber);
}
}
}
/**
* getter method for accessing parser object
*
* @return parser object
*/
public Parser getParser() {
return parser;
}
}
| UTF-8 | Java | 2,398 | java | Calculator.java | Java | [] | null | [] | package Soru_1;
public class Calculator {
private Parser parser = new Parser();
/**
* private calculate method for turning a number sign to negative
*
* @param operator
* @param number
* @return a double value
*/
private double calculate(Operator operator, double number) {
if (operator.geType().equals(Type.MINUS)) {
return number * -1;
} else
return number;
}
/**
* calculate method for handling operations(with 2 number and 1 operator)
*
* @param operator
* @param number1
* @param number2
* @return returns result double number
*/
private double calculate(Operator operator, double number1, double number2) {
if (operator.geType().equals(Type.PLUS)) {
return number1 + number2;
} else if (operator.geType().equals(Type.MINUS)) {
return number1 - number2;
} else if (operator.geType().equals(Type.TIMES)) {
return number1 * number2;
} else if (operator.geType().equals(Type.DIVIDE)) {
return number1 / number2;
}
return -1;
}
public void calculateHelper(Operator operator, Double number1, Double number2) {
if (parser.getOperatorStack().peek().geType() == Type.MINUS) {
number2 = number2 * -1;
double newNumber = calculate(operator, number2, number1) * -1;
parser.getNumberStack().push(newNumber);
} else {
double newNumber = calculate(operator, number2, number1);
parser.getNumberStack().push(newNumber);
}
}
/**
* calculator method to calculate whole expression
*
* @param infix
*/
public void calculator(String infix) {
parser.parse(infix);
while (!parser.getOperatorStack().isEmpty()) {
Operator operator1 = parser.getOperatorStack().pop();
Double number1 = parser.getNumberStack().pop();
if (!parser.getNumberStack().isEmpty()) {
Double number2 = parser.getNumberStack().pop();
if (!parser.getOperatorStack().isEmpty()) {
calculateHelper(operator1, number1, number2);
} else {
double newNumber = calculate(operator1, number2, number1);
parser.getNumberStack().push(newNumber);
}
} else {
double newNumber = calculate(operator1, number1);
parser.getNumberStack().push(newNumber);
}
}
}
/**
* getter method for accessing parser object
*
* @return parser object
*/
public Parser getParser() {
return parser;
}
}
| 2,398 | 0.650959 | 0.635113 | 91 | 24.351648 | 23.009016 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.098901 | false | false | 9 |
14a78da1ecd24e61c87a6de154a703e3cd72f72a | 9,423,158,304,253 | eb5a5cdc0ba9aedb8efb3539de1791812de0e32d | /src/main/java/base_examples/multi_array/LessonNine.java | 8ab937b192b936adbd8b8d51ba19bf8995323f2a | [] | no_license | andriyanov-roman/base_1 | https://github.com/andriyanov-roman/base_1 | 5247a0523f171d193b35138a562d2bb64be99606 | f10175c89399d317fa0a639382c4606d28f2c4b8 | refs/heads/master | 2020-12-24T15:41:21.923000 | 2015-10-27T12:30:17 | 2015-10-27T12:30:17 | 31,550,728 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package base_examples.multi_array;
public class LessonNine {
public static void main(String[] args) {
int a = 1, b = 3, c = 3;
findMax(a, b, c);
int[] array = {4, 2, 5, 2, 56};
for (int i : array) {
System.out.print(array[i] + " ");
}
System.out.println();
}
public static int[] summArr(int[] arrOne, int[] arrTwo) {
int[] summArr = new int[arrOne.length + arrTwo.length];
int index = 0;
for (int i = 0; i < summArr.length; i++) {
if (i < arrOne.length) {
summArr[i] = arrOne[i];
} else {
summArr[i] = arrTwo[index];
index++;
}
}
return summArr;
}
public static void findMax(int a, int b, int c) {
if (a > b) {
if (a > c) {
System.out.println("a is max");
} else if (a == c) {
System.out.println("a=c & they're max");
} else {
System.out.println("c is max");
}
} else {
if (a == b) {
if (b > c) {
System.out.println("a=b & they're max");
} else if (b == c) {
System.out.println("they're all equal");
} else {
System.out.println("c is max");
}
} else if (b > c) {
System.out.println("b is max");
} else if (b == c) {
System.out.println("b=c & they're max");
}
}
System.out.println("\n");
}
public static int[] returnArray(int[] arrayOne, int[] arrayTwo) {
int[] resultArray = new int[arrayOne.length + arrayTwo.length];
for (int i = 0; i < resultArray.length; i++) {
if (i < arrayOne.length) {
resultArray[i] = arrayOne[i];
} else {
resultArray[i] = arrayTwo[i - arrayOne.length];
}
}
for (int i = 0; i < resultArray.length; i++) {
System.out.print(" " + resultArray[i]);
}
return resultArray;
}
}
| UTF-8 | Java | 2,181 | java | LessonNine.java | Java | [] | null | [] | package base_examples.multi_array;
public class LessonNine {
public static void main(String[] args) {
int a = 1, b = 3, c = 3;
findMax(a, b, c);
int[] array = {4, 2, 5, 2, 56};
for (int i : array) {
System.out.print(array[i] + " ");
}
System.out.println();
}
public static int[] summArr(int[] arrOne, int[] arrTwo) {
int[] summArr = new int[arrOne.length + arrTwo.length];
int index = 0;
for (int i = 0; i < summArr.length; i++) {
if (i < arrOne.length) {
summArr[i] = arrOne[i];
} else {
summArr[i] = arrTwo[index];
index++;
}
}
return summArr;
}
public static void findMax(int a, int b, int c) {
if (a > b) {
if (a > c) {
System.out.println("a is max");
} else if (a == c) {
System.out.println("a=c & they're max");
} else {
System.out.println("c is max");
}
} else {
if (a == b) {
if (b > c) {
System.out.println("a=b & they're max");
} else if (b == c) {
System.out.println("they're all equal");
} else {
System.out.println("c is max");
}
} else if (b > c) {
System.out.println("b is max");
} else if (b == c) {
System.out.println("b=c & they're max");
}
}
System.out.println("\n");
}
public static int[] returnArray(int[] arrayOne, int[] arrayTwo) {
int[] resultArray = new int[arrayOne.length + arrayTwo.length];
for (int i = 0; i < resultArray.length; i++) {
if (i < arrayOne.length) {
resultArray[i] = arrayOne[i];
} else {
resultArray[i] = arrayTwo[i - arrayOne.length];
}
}
for (int i = 0; i < resultArray.length; i++) {
System.out.print(" " + resultArray[i]);
}
return resultArray;
}
}
| 2,181 | 0.424117 | 0.418157 | 73 | 28.876713 | 20.054682 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.60274 | false | false | 9 |
654e4090377f47cf41dd1419bdc8c58213e75efd | 32,590,211,869,213 | 78545d626ac8117899989bc93d586de6180321d3 | /app/src/main/java/com/ignovate/lectrefymob/model/LoginReqModel.java | 32da5ef15838b0dc648de5a62168ddfe81a84110 | [] | no_license | rajalakshmicogniseer/MobileApp | https://github.com/rajalakshmicogniseer/MobileApp | 7b6b04dfe1b7682dd13e9902d6026855662b5fc5 | 0197db78e5927f6bed6063369cf998dd98c9f882 | refs/heads/master | 2020-04-04T05:17:33.783000 | 2018-11-01T15:08:21 | 2018-11-01T15:08:21 | 155,740,513 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ignovate.lectrefymob.model;
import com.google.gson.annotations.SerializedName;
public class LoginReqModel {
@SerializedName("email")
public String login_id;
@SerializedName("password")
public String password;
public String getlogin_id() {
return login_id;
}
public void setlogin_id(String login_id) {
this.login_id = login_id;
}
public String getpassword() {
return password;
}
public void setpassword(String password) {
this.password = password;
}
}
| UTF-8 | Java | 556 | java | LoginReqModel.java | Java | [
{
"context": "assword(String password) {\n this.password = password;\n }\n\n\n}\n",
"end": 544,
"score": 0.9339958429336548,
"start": 536,
"tag": "PASSWORD",
"value": "password"
}
] | null | [] | package com.ignovate.lectrefymob.model;
import com.google.gson.annotations.SerializedName;
public class LoginReqModel {
@SerializedName("email")
public String login_id;
@SerializedName("password")
public String password;
public String getlogin_id() {
return login_id;
}
public void setlogin_id(String login_id) {
this.login_id = login_id;
}
public String getpassword() {
return password;
}
public void setpassword(String password) {
this.password = <PASSWORD>;
}
}
| 558 | 0.647482 | 0.647482 | 33 | 15.848485 | 17.020702 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.242424 | false | false | 9 |
d947c77eada895c46d4ab3e3f10c15b5608491da | 6,708,738,971,908 | 04d599e02131af134c18d8377a4f20e266f54f77 | /algo/SWEA/D2/200729_2001_파리퇴치.java | f36be732f21c5693af0b956fcaa8f04be560e4e4 | [] | no_license | hyemz/TIL | https://github.com/hyemz/TIL | 6a293d5cfeffbb6c51a18672d96f8e53aa122fe8 | 87578cfeac92465ec2c637fd9d1e5d425ce58f23 | refs/heads/develop | 2022-05-09T01:08:05.058000 | 2022-04-25T14:25:25 | 2022-04-25T14:25:25 | 234,567,009 | 0 | 0 | null | false | 2022-04-25T14:25:26 | 2020-01-17T14:38:47 | 2021-11-02T16:16:09 | 2022-04-25T14:25:25 | 134 | 0 | 0 | 0 | Java | false | false | import java.util.Scanner;
public class flyKill {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for (int test_case = 1; test_case <= T; test_case++) {
int N = sc.nextInt(); // 배열 크기
int M = sc.nextInt(); // 파리채 크기
int count = 0;
int max = 0;
int[][] kill = new int[N][N];
// 배열에 값 넣기
for (int i = 0; i < kill.length; i++) {
for (int j = 0; j < kill.length; j++) {
kill[i][j] = sc.nextInt();
}
}
for (int x = 0; x < kill.length-M+1; x++) {
for (int y = 0; y < kill.length-M+1; y++) {
for (int i = 0; i < M; i++) {
for (int j = 0; j < M; j++) {
if (x+i < 0 && x+i >= N || y+j < 0 && y+j >= N) break;
count += kill[x+i][y+j];
}
}
if(max < count) max = count;
count = 0;
}
}
System.out.println("#" + test_case+ " " + max);
}
}
}
| UTF-8 | Java | 974 | java | 200729_2001_파리퇴치.java | Java | [] | null | [] | import java.util.Scanner;
public class flyKill {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for (int test_case = 1; test_case <= T; test_case++) {
int N = sc.nextInt(); // 배열 크기
int M = sc.nextInt(); // 파리채 크기
int count = 0;
int max = 0;
int[][] kill = new int[N][N];
// 배열에 값 넣기
for (int i = 0; i < kill.length; i++) {
for (int j = 0; j < kill.length; j++) {
kill[i][j] = sc.nextInt();
}
}
for (int x = 0; x < kill.length-M+1; x++) {
for (int y = 0; y < kill.length-M+1; y++) {
for (int i = 0; i < M; i++) {
for (int j = 0; j < M; j++) {
if (x+i < 0 && x+i >= N || y+j < 0 && y+j >= N) break;
count += kill[x+i][y+j];
}
}
if(max < count) max = count;
count = 0;
}
}
System.out.println("#" + test_case+ " " + max);
}
}
}
| 974 | 0.470339 | 0.455508 | 42 | 21.476191 | 18.139982 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.642857 | false | false | 9 |
887586c41e50c9fe738fe0a28c277264bd2e76de | 18,708,877,591,728 | f4a0ee92c90078fa5c0af270873cc8e49ded911e | /web/org.eclipse.xtext.web/src/main/xtend-gen/org/eclipse/xtext/web/server/occurrences/OccurrencesResult.java | 9ffb0748f4bf76ffc247639676aae9ecfb84399d | [
"LicenseRef-scancode-generic-cla"
] | no_license | stoll-it/xtext | https://github.com/stoll-it/xtext | e4985fb1c219a25d421d3186599abb7d20594b6d | 64b22d2eea1038fa2fe1a81ca0b920f657ea4e31 | refs/heads/master | 2021-01-23T22:52:39.202000 | 2015-07-13T15:15:02 | 2015-07-13T15:15:02 | 38,067,171 | 0 | 0 | null | true | 2015-06-25T18:40:42 | 2015-06-25T18:40:42 | 2015-06-24T03:46:46 | 2015-06-25T15:07:47 | 667,959 | 0 | 0 | 0 | null | null | null | package org.eclipse.xtext.web.server.occurrences;
import com.google.common.collect.Iterables;
import java.util.ArrayList;
import org.eclipse.xtend.lib.annotations.Data;
import org.eclipse.xtend.lib.annotations.ToString;
import org.eclipse.xtext.util.ITextRegion;
import org.eclipse.xtext.web.server.IServiceResult;
import org.eclipse.xtext.xbase.lib.Pure;
import org.eclipse.xtext.xbase.lib.util.ToStringBuilder;
@Data
@ToString(skipNulls = true)
@SuppressWarnings("all")
public class OccurrencesResult implements IServiceResult {
private final String stateId;
private final ArrayList<ITextRegion> writeRegions = new ArrayList<ITextRegion>();
private final ArrayList<ITextRegion> readRegions = new ArrayList<ITextRegion>();
public OccurrencesResult(final String stateId, final Iterable<ITextRegion> readRegions, final Iterable<ITextRegion> writeRegions) {
this.stateId = stateId;
Iterables.<ITextRegion>addAll(this.readRegions, readRegions);
Iterables.<ITextRegion>addAll(this.writeRegions, writeRegions);
}
@Override
@Pure
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((this.stateId== null) ? 0 : this.stateId.hashCode());
result = prime * result + ((this.writeRegions== null) ? 0 : this.writeRegions.hashCode());
result = prime * result + ((this.readRegions== null) ? 0 : this.readRegions.hashCode());
return result;
}
@Override
@Pure
public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
OccurrencesResult other = (OccurrencesResult) obj;
if (this.stateId == null) {
if (other.stateId != null)
return false;
} else if (!this.stateId.equals(other.stateId))
return false;
if (this.writeRegions == null) {
if (other.writeRegions != null)
return false;
} else if (!this.writeRegions.equals(other.writeRegions))
return false;
if (this.readRegions == null) {
if (other.readRegions != null)
return false;
} else if (!this.readRegions.equals(other.readRegions))
return false;
return true;
}
@Override
@Pure
public String toString() {
ToStringBuilder b = new ToStringBuilder(this);
b.skipNulls();
b.add("stateId", this.stateId);
b.add("writeRegions", this.writeRegions);
b.add("readRegions", this.readRegions);
return b.toString();
}
@Pure
public String getStateId() {
return this.stateId;
}
@Pure
public ArrayList<ITextRegion> getWriteRegions() {
return this.writeRegions;
}
@Pure
public ArrayList<ITextRegion> getReadRegions() {
return this.readRegions;
}
}
| UTF-8 | Java | 2,769 | java | OccurrencesResult.java | Java | [] | null | [] | package org.eclipse.xtext.web.server.occurrences;
import com.google.common.collect.Iterables;
import java.util.ArrayList;
import org.eclipse.xtend.lib.annotations.Data;
import org.eclipse.xtend.lib.annotations.ToString;
import org.eclipse.xtext.util.ITextRegion;
import org.eclipse.xtext.web.server.IServiceResult;
import org.eclipse.xtext.xbase.lib.Pure;
import org.eclipse.xtext.xbase.lib.util.ToStringBuilder;
@Data
@ToString(skipNulls = true)
@SuppressWarnings("all")
public class OccurrencesResult implements IServiceResult {
private final String stateId;
private final ArrayList<ITextRegion> writeRegions = new ArrayList<ITextRegion>();
private final ArrayList<ITextRegion> readRegions = new ArrayList<ITextRegion>();
public OccurrencesResult(final String stateId, final Iterable<ITextRegion> readRegions, final Iterable<ITextRegion> writeRegions) {
this.stateId = stateId;
Iterables.<ITextRegion>addAll(this.readRegions, readRegions);
Iterables.<ITextRegion>addAll(this.writeRegions, writeRegions);
}
@Override
@Pure
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((this.stateId== null) ? 0 : this.stateId.hashCode());
result = prime * result + ((this.writeRegions== null) ? 0 : this.writeRegions.hashCode());
result = prime * result + ((this.readRegions== null) ? 0 : this.readRegions.hashCode());
return result;
}
@Override
@Pure
public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
OccurrencesResult other = (OccurrencesResult) obj;
if (this.stateId == null) {
if (other.stateId != null)
return false;
} else if (!this.stateId.equals(other.stateId))
return false;
if (this.writeRegions == null) {
if (other.writeRegions != null)
return false;
} else if (!this.writeRegions.equals(other.writeRegions))
return false;
if (this.readRegions == null) {
if (other.readRegions != null)
return false;
} else if (!this.readRegions.equals(other.readRegions))
return false;
return true;
}
@Override
@Pure
public String toString() {
ToStringBuilder b = new ToStringBuilder(this);
b.skipNulls();
b.add("stateId", this.stateId);
b.add("writeRegions", this.writeRegions);
b.add("readRegions", this.readRegions);
return b.toString();
}
@Pure
public String getStateId() {
return this.stateId;
}
@Pure
public ArrayList<ITextRegion> getWriteRegions() {
return this.writeRegions;
}
@Pure
public ArrayList<ITextRegion> getReadRegions() {
return this.readRegions;
}
}
| 2,769 | 0.689419 | 0.687252 | 92 | 29.097826 | 25.399015 | 133 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.521739 | false | false | 9 |
efc598c354558721e78a1a4b213c3eb83d4b2a25 | 1,872,605,797,568 | a6f4729e863bc3d68fba4a73b00ca9f4c75b8af0 | /universal-application-tool-0.0.1/app/services/program/BlockDefinition.java | 0af9ac275a89998e7f867fdfd616009e3cf2a38d | [
"Apache-2.0",
"CC0-1.0"
] | permissive | sowmyanarayananSoma/civiform | https://github.com/sowmyanarayananSoma/civiform | 4fbef9a514ac9f72b31d723ac9083bbceb1a5d0a | 1f5cab8da94a2d17de081340e48552f894d40d41 | refs/heads/main | 2023-04-15T09:46:12.874000 | 2021-04-28T20:31:37 | 2021-04-28T20:31:37 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package services.program;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.auto.value.AutoValue;
import com.google.auto.value.extension.memoized.Memoized;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import java.util.Optional;
import services.Path;
import services.question.types.QuestionDefinition;
import services.question.types.QuestionType;
import services.question.types.ScalarType;
/**
* Defines a single program block, which contains a list of questions and data about the block.
* Blocks are displayed to applicants one per-page, and are the primary means by which applicants
* navigate within a program form.
*/
@JsonDeserialize(builder = AutoValue_BlockDefinition.Builder.class)
@AutoValue
public abstract class BlockDefinition {
public static Builder builder() {
return new AutoValue_BlockDefinition.Builder();
}
/**
* A block identifier. Only unique between current blocks within a {@link ProgramDefinition}.
*
* <p>Blocks from one ProgramDefinition may have the same Ids as blocks from another
* ProgramDefinition. Blocks that are deleted from a ProgramDefinition may have its Id reused.
*/
@JsonProperty("id")
public abstract long id();
/**
* Name of a Block used to identify it to the admin. The name is only visible to the admin so is
* not localized.
*/
@JsonProperty("name")
public abstract String name();
/**
* A human readable description of the Block. The description is only visible to the admin so is
* not localized.
*/
@JsonProperty("description")
public abstract String description();
/**
* A repeater block definition is a block definition that contains a {@link QuestionDefinition}
* that is of type {@code QuestionType.REPEATER}. Repeater questions provide a variable list of
* user-defined identifiers for some repeated entity. Examples of repeated entities could be
* household members, vehicles, jobs, etc.
*
* <p>A repeater block can only have one question, and it must be {@link QuestionType#REPEATER}.
*
* @return true if this block definition is a repeater.
*/
@JsonIgnore
@Memoized
public boolean isRepeater() {
// Though `anyMatch` is used here, repeater block definitions should only ever have a single
// question, which is a repeater question.
return programQuestionDefinitions().stream()
.map(ProgramQuestionDefinition::getQuestionDefinition)
.map(QuestionDefinition::getQuestionType)
.anyMatch(questionType -> questionType.equals(QuestionType.REPEATER));
}
/**
* A repeated block definition references a repeater block definition that determines the entities
* the repeated block definition asks questions for. If a block definition does not have a
* repeaterId, it is not repeated.
*
* @return the BlockDefinition ID for this block definitions repeater, if it exists
*/
@JsonProperty("repeaterId")
public abstract Optional<Long> repeaterId();
/**
* See {@link #repeaterId()}.
*
* @return true if this block definition is for a repeated block.
*/
@JsonIgnore
public boolean isRepeated() {
return repeaterId().isPresent();
}
/** A {@link Predicate} that determines whether this is hidden or shown. */
@JsonProperty("hidePredicate")
public abstract Optional<Predicate> hidePredicate();
/** A {@link Predicate} that determines whether this is optional or required. */
@JsonProperty("optionalPredicate")
public abstract Optional<Predicate> optionalPredicate();
/** The list of {@link ProgramQuestionDefinition}s that make up this block. */
@JsonProperty("questionDefinitions")
public abstract ImmutableList<ProgramQuestionDefinition> programQuestionDefinitions();
public abstract Builder toBuilder();
/** Returns the {@link QuestionDefinition} at the specified index. */
@JsonIgnore
public QuestionDefinition getQuestionDefinition(int questionIndex) {
return programQuestionDefinitions().get(questionIndex).getQuestionDefinition();
}
@JsonIgnore
@Memoized
public int getQuestionCount() {
return programQuestionDefinitions().size();
}
@JsonIgnore
@Memoized
public ImmutableMap<Path, ScalarType> scalarTypes() {
ImmutableMap.Builder<Path, ScalarType> scalarTypesBuilder = ImmutableMap.builder();
programQuestionDefinitions().stream()
.map(ProgramQuestionDefinition::getQuestionDefinition)
.map(QuestionDefinition::getScalars)
.forEach(scalarTypesBuilder::putAll);
return scalarTypesBuilder.build();
}
@JsonIgnore
@Memoized
public ImmutableSet<Path> scalarPaths() {
return scalarTypes().keySet();
}
/**
* For multi-select questions (like checkbox), we must append {@code []} to the field name so that
* the Play framework allows multiple form keys with the same value. When updates are passed in
* the request, they are of the format {@code path.selection[index]}. However, the scalar path
* does not end in {@code []}, so we remove the array element information here before checking the
* type.
*/
@JsonIgnore
public Optional<ScalarType> getScalarType(Path path) {
if (path.isArrayElement()) {
path = path.withoutArrayReference();
}
return Optional.ofNullable(scalarTypes().get(path));
}
@JsonIgnore
public boolean hasSameId(BlockDefinition other) {
return other.id() == id();
}
@AutoValue.Builder
public abstract static class Builder {
@JsonProperty("id")
public abstract Builder setId(long id);
@JsonProperty("name")
public abstract Builder setName(String value);
@JsonProperty("description")
public abstract Builder setDescription(String value);
@JsonProperty("repeaterId")
public abstract Builder setRepeaterId(Optional<Long> repeaterId);
@JsonProperty("hidePredicate")
public abstract Builder setHidePredicate(Optional<Predicate> hide);
public Builder setHidePredicate(Predicate hide) {
return this.setHidePredicate(Optional.of(hide));
}
@JsonProperty("optionalPredicate")
public abstract Builder setOptionalPredicate(Optional<Predicate> optional);
public Builder setOptionalPredicate(Predicate optional) {
return this.setOptionalPredicate(Optional.of(optional));
}
@JsonProperty("questionDefinitions")
public abstract Builder setProgramQuestionDefinitions(
ImmutableList<ProgramQuestionDefinition> programQuestionDefinitions);
public abstract ImmutableList.Builder<ProgramQuestionDefinition>
programQuestionDefinitionsBuilder();
public abstract BlockDefinition build();
public Builder addQuestion(ProgramQuestionDefinition question) {
programQuestionDefinitionsBuilder().add(question);
return this;
}
}
}
| UTF-8 | Java | 6,991 | java | BlockDefinition.java | Java | [] | null | [] | package services.program;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.auto.value.AutoValue;
import com.google.auto.value.extension.memoized.Memoized;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import java.util.Optional;
import services.Path;
import services.question.types.QuestionDefinition;
import services.question.types.QuestionType;
import services.question.types.ScalarType;
/**
* Defines a single program block, which contains a list of questions and data about the block.
* Blocks are displayed to applicants one per-page, and are the primary means by which applicants
* navigate within a program form.
*/
@JsonDeserialize(builder = AutoValue_BlockDefinition.Builder.class)
@AutoValue
public abstract class BlockDefinition {
public static Builder builder() {
return new AutoValue_BlockDefinition.Builder();
}
/**
* A block identifier. Only unique between current blocks within a {@link ProgramDefinition}.
*
* <p>Blocks from one ProgramDefinition may have the same Ids as blocks from another
* ProgramDefinition. Blocks that are deleted from a ProgramDefinition may have its Id reused.
*/
@JsonProperty("id")
public abstract long id();
/**
* Name of a Block used to identify it to the admin. The name is only visible to the admin so is
* not localized.
*/
@JsonProperty("name")
public abstract String name();
/**
* A human readable description of the Block. The description is only visible to the admin so is
* not localized.
*/
@JsonProperty("description")
public abstract String description();
/**
* A repeater block definition is a block definition that contains a {@link QuestionDefinition}
* that is of type {@code QuestionType.REPEATER}. Repeater questions provide a variable list of
* user-defined identifiers for some repeated entity. Examples of repeated entities could be
* household members, vehicles, jobs, etc.
*
* <p>A repeater block can only have one question, and it must be {@link QuestionType#REPEATER}.
*
* @return true if this block definition is a repeater.
*/
@JsonIgnore
@Memoized
public boolean isRepeater() {
// Though `anyMatch` is used here, repeater block definitions should only ever have a single
// question, which is a repeater question.
return programQuestionDefinitions().stream()
.map(ProgramQuestionDefinition::getQuestionDefinition)
.map(QuestionDefinition::getQuestionType)
.anyMatch(questionType -> questionType.equals(QuestionType.REPEATER));
}
/**
* A repeated block definition references a repeater block definition that determines the entities
* the repeated block definition asks questions for. If a block definition does not have a
* repeaterId, it is not repeated.
*
* @return the BlockDefinition ID for this block definitions repeater, if it exists
*/
@JsonProperty("repeaterId")
public abstract Optional<Long> repeaterId();
/**
* See {@link #repeaterId()}.
*
* @return true if this block definition is for a repeated block.
*/
@JsonIgnore
public boolean isRepeated() {
return repeaterId().isPresent();
}
/** A {@link Predicate} that determines whether this is hidden or shown. */
@JsonProperty("hidePredicate")
public abstract Optional<Predicate> hidePredicate();
/** A {@link Predicate} that determines whether this is optional or required. */
@JsonProperty("optionalPredicate")
public abstract Optional<Predicate> optionalPredicate();
/** The list of {@link ProgramQuestionDefinition}s that make up this block. */
@JsonProperty("questionDefinitions")
public abstract ImmutableList<ProgramQuestionDefinition> programQuestionDefinitions();
public abstract Builder toBuilder();
/** Returns the {@link QuestionDefinition} at the specified index. */
@JsonIgnore
public QuestionDefinition getQuestionDefinition(int questionIndex) {
return programQuestionDefinitions().get(questionIndex).getQuestionDefinition();
}
@JsonIgnore
@Memoized
public int getQuestionCount() {
return programQuestionDefinitions().size();
}
@JsonIgnore
@Memoized
public ImmutableMap<Path, ScalarType> scalarTypes() {
ImmutableMap.Builder<Path, ScalarType> scalarTypesBuilder = ImmutableMap.builder();
programQuestionDefinitions().stream()
.map(ProgramQuestionDefinition::getQuestionDefinition)
.map(QuestionDefinition::getScalars)
.forEach(scalarTypesBuilder::putAll);
return scalarTypesBuilder.build();
}
@JsonIgnore
@Memoized
public ImmutableSet<Path> scalarPaths() {
return scalarTypes().keySet();
}
/**
* For multi-select questions (like checkbox), we must append {@code []} to the field name so that
* the Play framework allows multiple form keys with the same value. When updates are passed in
* the request, they are of the format {@code path.selection[index]}. However, the scalar path
* does not end in {@code []}, so we remove the array element information here before checking the
* type.
*/
@JsonIgnore
public Optional<ScalarType> getScalarType(Path path) {
if (path.isArrayElement()) {
path = path.withoutArrayReference();
}
return Optional.ofNullable(scalarTypes().get(path));
}
@JsonIgnore
public boolean hasSameId(BlockDefinition other) {
return other.id() == id();
}
@AutoValue.Builder
public abstract static class Builder {
@JsonProperty("id")
public abstract Builder setId(long id);
@JsonProperty("name")
public abstract Builder setName(String value);
@JsonProperty("description")
public abstract Builder setDescription(String value);
@JsonProperty("repeaterId")
public abstract Builder setRepeaterId(Optional<Long> repeaterId);
@JsonProperty("hidePredicate")
public abstract Builder setHidePredicate(Optional<Predicate> hide);
public Builder setHidePredicate(Predicate hide) {
return this.setHidePredicate(Optional.of(hide));
}
@JsonProperty("optionalPredicate")
public abstract Builder setOptionalPredicate(Optional<Predicate> optional);
public Builder setOptionalPredicate(Predicate optional) {
return this.setOptionalPredicate(Optional.of(optional));
}
@JsonProperty("questionDefinitions")
public abstract Builder setProgramQuestionDefinitions(
ImmutableList<ProgramQuestionDefinition> programQuestionDefinitions);
public abstract ImmutableList.Builder<ProgramQuestionDefinition>
programQuestionDefinitionsBuilder();
public abstract BlockDefinition build();
public Builder addQuestion(ProgramQuestionDefinition question) {
programQuestionDefinitionsBuilder().add(question);
return this;
}
}
}
| 6,991 | 0.74038 | 0.74038 | 201 | 33.781094 | 31.192738 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.313433 | false | false | 9 |
0fd07251752f95f29aecdac987c252c8e66eb3dc | 1,872,605,793,432 | 1aa35ddf5e7f05d263d95c3292ce6d96b57c6455 | /src/service/converter/ICoverter.java | fa4756765d7e365e4bfca6b6252e0c17e3fd239e | [] | no_license | ErickCohen08/OfiPagos | https://github.com/ErickCohen08/OfiPagos | 9662e6287d9b87f8d72cad3e9e62fa9496168b38 | 8dc6dfa8b549de8e9b2f522305f7eeb96e2e8e6f | refs/heads/master | 2019-07-18T17:15:51.118000 | 2016-07-11T15:50:39 | 2016-07-11T15:50:39 | 62,151,553 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package service.converter;
import export.FieldDescExportaFiles;
public interface ICoverter
{
public String convert(String value, FieldDescExportaFiles descExportaFiles);
}
| UTF-8 | Java | 184 | java | ICoverter.java | Java | [] | null | [] | package service.converter;
import export.FieldDescExportaFiles;
public interface ICoverter
{
public String convert(String value, FieldDescExportaFiles descExportaFiles);
}
| 184 | 0.798913 | 0.798913 | 8 | 21 | 25.258661 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.625 | false | false | 9 |
e8c6016b0ba78eb3903b1114b313233529a0a2e1 | 30,803,505,503,258 | 788f040e24672a9fdb264ef0acf3a05a0c4357c0 | /hl7_cpinfo/src/test/java/test/testPatient.java | ea4925be22e35e46390157567956e8f28ca5b2e3 | [
"Apache-2.0"
] | permissive | JesseHu1520/GitDepository | https://github.com/JesseHu1520/GitDepository | 822eb491695fd545ca8fceb30b82b4461f997b9f | 9738e1ba3aee0ddcc81580db630319302a3cedb1 | refs/heads/master | 2018-02-16T00:14:16.797000 | 2016-12-04T06:16:35 | 2016-12-04T06:16:35 | 62,888,703 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.junit.Before;
import org.junit.Test;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.ExtensionDt;
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
import ca.uhn.fhir.model.base.resource.ResourceMetadataMap;
import ca.uhn.fhir.model.dstu2.composite.AddressDt;
import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt;
import ca.uhn.fhir.model.dstu2.composite.CodingDt;
import ca.uhn.fhir.model.dstu2.composite.ContactPointDt;
import ca.uhn.fhir.model.dstu2.composite.HumanNameDt;
import ca.uhn.fhir.model.dstu2.composite.IdentifierDt;
import ca.uhn.fhir.model.dstu2.resource.Patient;
import ca.uhn.fhir.model.dstu2.valueset.AddressUseEnum;
import ca.uhn.fhir.model.dstu2.valueset.AdministrativeGenderEnum;
import ca.uhn.fhir.model.dstu2.valueset.ContactPointSystemEnum;
import ca.uhn.fhir.model.dstu2.valueset.ContactPointUseEnum;
import ca.uhn.fhir.model.primitive.DateDt;
import ca.uhn.fhir.model.primitive.DateTimeDt;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.StringDt;
import oracle.sql.TIMESTAMP;
public class testPatient {
private static FhirContext ctx = FhirContext.forDstu2();
Patient p = new Patient();
//@Before
public void testSetPatient(){
p.setId(new IdDt().setValue("1001"));
p.setActive(true);
ResourceMetadataMap map = new ResourceMetadataMap();
map.put(ResourceMetadataKeyEnum.VERSION, new TIMESTAMP().toString());
p.setResourceMetadata(map);
List<HumanNameDt> list = new ArrayList<HumanNameDt>();
HumanNameDt namedt = new HumanNameDt();
namedt.setText("刘康");
list.add(namedt);
p.setName(list);
List<IdentifierDt> idList= new ArrayList<IdentifierDt>();
idList.add(new IdentifierDt("2.16.840.1.113883.2.23.1.9.1", "110101200301120019"));
idList.add(new IdentifierDt("2.16.840.1.113883.2.23.1.9.2", "100000000000"));
p.setIdentifier(idList);
List<ContactPointDt> teList = new ArrayList<ContactPointDt>();
ContactPointDt cd = new ContactPointDt().setUse(ContactPointUseEnum.MOBILE).setSystem(ContactPointSystemEnum.PHONE).setValue("13800138000");
teList.add(cd);
p.setTelecom(teList);
p.setGender(AdministrativeGenderEnum.MALE);
DateDt ddt = new DateDt("2003-01-12");
ddt.addUndeclaredExtension(new ExtensionDt().setUrl("http://hl7.org/fhir/StructureDefinition/patient-birthTime").setValue(new DateTimeDt("2003-01-12T09:12:35+08:00")));
p.setBirthDate(ddt);
List<AddressDt> addrDt = new ArrayList<AddressDt>();
List<StringDt> strDt = new ArrayList<StringDt>();
strDt.add(new StringDt("景山前街4号"));
AddressDt adt = new AddressDt().setUse(AddressUseEnum.HOME).setState("北京").setDistrict("东城区").setCity("北京市").setLine(strDt).setPostalCode("100010");
addrDt.add(adt);
p.setAddress(addrDt);
List<Patient.Contact> contactList = new ArrayList<Patient.Contact>();
Patient.Contact pct = new Patient.Contact();
pct.setName(new HumanNameDt().setText("刘勇")).setGender(AdministrativeGenderEnum.MALE);
List<ContactPointDt> ctaList = new ArrayList<ContactPointDt>();
ctaList.add(new ContactPointDt().setSystem(ContactPointSystemEnum.PHONE).setValue("13012345678"));
pct.setTelecom(ctaList);
List<CodeableConceptDt> relList = new ArrayList<CodeableConceptDt>();
List<CodingDt> codingdt = new ArrayList<CodingDt>();
codingdt.add(new CodingDt().setCode("parent").setSystem("http://hl7.org/fhir/patient-contact-relationship"));
relList.add(new CodeableConceptDt().setCoding(codingdt));
pct.setRelationship(relList);
contactList.add(pct);
p.setContact(contactList);
String patientXML = ctx.newJsonParser().encodeResourceToString(p);
System.out.println(patientXML);
System.out.println(p.getName().get(0).getText());
}
@Test
public void testGetPatient(){
String id = p.getId().getValueAsString();
String version = p.getResourceMetadata().get(ResourceMetadataKeyEnum.VERSION).toString();
String idcard = p.getIdentifier().get(0).getSystem()+"-"+p.getIdentifier().get(0).getValue();
String ssid = p.getIdentifier().get(1).getSystem()+"-"+p.getIdentifier().get(1).getValue();
String name = p.getName().get(0).getText();
String gender = p.getGender();
String birthdate = p.getBirthDate().toString();
String phone = p.getTelecom().get(0).getValue();
AddressDt adt = p.getAddress().get(0);
String address = adt.getUse()+"-"+adt.getState()+"-"+adt.getDistrict()+"-"+adt.getCity()+"-"+adt.getLine().get(0).getValue()+"-"+adt.getPostalCode();
Patient.Contact cat = p.getContact().get(0);
String contact = cat.getRelationship().get(0).getCoding().get(0).getCode()+"-"+cat.getName().getText()+"-"+cat.getGender()+"-"+cat.getTelecomFirstRep().getValue();
String active = p.getActive().toString();
Map<String,String> map = new HashMap<String, String>();
map.put("id", id);
map.put("version",version);
map.put("idcard", idcard);
map.put("ssid", ssid);
map.put("name", name);
map.put("gender", gender);
map.put("birthdate", birthdate);
map.put("phone", phone);
map.put("address", address);
map.put("contact", contact);
map.put("active",active);
map.entrySet();
for(Entry<String,String> ent:map.entrySet()){
System.out.println(ent.getKey()+":"+ent.getValue());
}
}
@Test
public void test(){
String str = "";
}
}
| GB18030 | Java | 5,611 | java | testPatient.java | Java | [
{
"context": "Dt namedt = new HumanNameDt();\r\n\t\tnamedt.setText(\"刘康\");\r\n\t\tlist.add(namedt);\r\n\t\tp.setName(list);\r\n\t\t\r\n",
"end": 1772,
"score": 0.9998467564582825,
"start": 1770,
"tag": "NAME",
"value": "刘康"
},
{
"context": "tact();\r\n\t\tpct.setName(new HumanNameDt().setText(\"刘勇\")).setGender(AdministrativeGenderEnum.MALE);\r\n\t\tL",
"end": 3150,
"score": 0.9998528957366943,
"start": 3148,
"tag": "NAME",
"value": "刘勇"
}
] | null | [] | package test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.junit.Before;
import org.junit.Test;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.ExtensionDt;
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
import ca.uhn.fhir.model.base.resource.ResourceMetadataMap;
import ca.uhn.fhir.model.dstu2.composite.AddressDt;
import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt;
import ca.uhn.fhir.model.dstu2.composite.CodingDt;
import ca.uhn.fhir.model.dstu2.composite.ContactPointDt;
import ca.uhn.fhir.model.dstu2.composite.HumanNameDt;
import ca.uhn.fhir.model.dstu2.composite.IdentifierDt;
import ca.uhn.fhir.model.dstu2.resource.Patient;
import ca.uhn.fhir.model.dstu2.valueset.AddressUseEnum;
import ca.uhn.fhir.model.dstu2.valueset.AdministrativeGenderEnum;
import ca.uhn.fhir.model.dstu2.valueset.ContactPointSystemEnum;
import ca.uhn.fhir.model.dstu2.valueset.ContactPointUseEnum;
import ca.uhn.fhir.model.primitive.DateDt;
import ca.uhn.fhir.model.primitive.DateTimeDt;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.StringDt;
import oracle.sql.TIMESTAMP;
public class testPatient {
private static FhirContext ctx = FhirContext.forDstu2();
Patient p = new Patient();
//@Before
public void testSetPatient(){
p.setId(new IdDt().setValue("1001"));
p.setActive(true);
ResourceMetadataMap map = new ResourceMetadataMap();
map.put(ResourceMetadataKeyEnum.VERSION, new TIMESTAMP().toString());
p.setResourceMetadata(map);
List<HumanNameDt> list = new ArrayList<HumanNameDt>();
HumanNameDt namedt = new HumanNameDt();
namedt.setText("刘康");
list.add(namedt);
p.setName(list);
List<IdentifierDt> idList= new ArrayList<IdentifierDt>();
idList.add(new IdentifierDt("2.16.840.1.113883.2.23.1.9.1", "110101200301120019"));
idList.add(new IdentifierDt("2.16.840.1.113883.2.23.1.9.2", "100000000000"));
p.setIdentifier(idList);
List<ContactPointDt> teList = new ArrayList<ContactPointDt>();
ContactPointDt cd = new ContactPointDt().setUse(ContactPointUseEnum.MOBILE).setSystem(ContactPointSystemEnum.PHONE).setValue("13800138000");
teList.add(cd);
p.setTelecom(teList);
p.setGender(AdministrativeGenderEnum.MALE);
DateDt ddt = new DateDt("2003-01-12");
ddt.addUndeclaredExtension(new ExtensionDt().setUrl("http://hl7.org/fhir/StructureDefinition/patient-birthTime").setValue(new DateTimeDt("2003-01-12T09:12:35+08:00")));
p.setBirthDate(ddt);
List<AddressDt> addrDt = new ArrayList<AddressDt>();
List<StringDt> strDt = new ArrayList<StringDt>();
strDt.add(new StringDt("景山前街4号"));
AddressDt adt = new AddressDt().setUse(AddressUseEnum.HOME).setState("北京").setDistrict("东城区").setCity("北京市").setLine(strDt).setPostalCode("100010");
addrDt.add(adt);
p.setAddress(addrDt);
List<Patient.Contact> contactList = new ArrayList<Patient.Contact>();
Patient.Contact pct = new Patient.Contact();
pct.setName(new HumanNameDt().setText("刘勇")).setGender(AdministrativeGenderEnum.MALE);
List<ContactPointDt> ctaList = new ArrayList<ContactPointDt>();
ctaList.add(new ContactPointDt().setSystem(ContactPointSystemEnum.PHONE).setValue("13012345678"));
pct.setTelecom(ctaList);
List<CodeableConceptDt> relList = new ArrayList<CodeableConceptDt>();
List<CodingDt> codingdt = new ArrayList<CodingDt>();
codingdt.add(new CodingDt().setCode("parent").setSystem("http://hl7.org/fhir/patient-contact-relationship"));
relList.add(new CodeableConceptDt().setCoding(codingdt));
pct.setRelationship(relList);
contactList.add(pct);
p.setContact(contactList);
String patientXML = ctx.newJsonParser().encodeResourceToString(p);
System.out.println(patientXML);
System.out.println(p.getName().get(0).getText());
}
@Test
public void testGetPatient(){
String id = p.getId().getValueAsString();
String version = p.getResourceMetadata().get(ResourceMetadataKeyEnum.VERSION).toString();
String idcard = p.getIdentifier().get(0).getSystem()+"-"+p.getIdentifier().get(0).getValue();
String ssid = p.getIdentifier().get(1).getSystem()+"-"+p.getIdentifier().get(1).getValue();
String name = p.getName().get(0).getText();
String gender = p.getGender();
String birthdate = p.getBirthDate().toString();
String phone = p.getTelecom().get(0).getValue();
AddressDt adt = p.getAddress().get(0);
String address = adt.getUse()+"-"+adt.getState()+"-"+adt.getDistrict()+"-"+adt.getCity()+"-"+adt.getLine().get(0).getValue()+"-"+adt.getPostalCode();
Patient.Contact cat = p.getContact().get(0);
String contact = cat.getRelationship().get(0).getCoding().get(0).getCode()+"-"+cat.getName().getText()+"-"+cat.getGender()+"-"+cat.getTelecomFirstRep().getValue();
String active = p.getActive().toString();
Map<String,String> map = new HashMap<String, String>();
map.put("id", id);
map.put("version",version);
map.put("idcard", idcard);
map.put("ssid", ssid);
map.put("name", name);
map.put("gender", gender);
map.put("birthdate", birthdate);
map.put("phone", phone);
map.put("address", address);
map.put("contact", contact);
map.put("active",active);
map.entrySet();
for(Entry<String,String> ent:map.entrySet()){
System.out.println(ent.getKey()+":"+ent.getValue());
}
}
@Test
public void test(){
String str = "";
}
}
| 5,611 | 0.712569 | 0.685135 | 143 | 37 | 33.82803 | 170 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.244755 | false | false | 9 |
a5dcb42a4b98d1f4b688e5ecf6b82defb4e34b8c | 16,200,616,700,124 | 007cc2783c488ccbc61da2c068d0cfa002e2169f | /Factory/src/main/java/au/edu/swin/ict/road/composite/exceptions/MessageDelivererException.java | a5d408805afebadb22e9eb2728e67246a7e5aefc | [] | no_license | road-framework/SDSN | https://github.com/road-framework/SDSN | cdc9806a3948b800191187d3ecb09c1f00ad58b3 | ad3fbb5c6bc67c6afba6dff9bd909e2c2967bd72 | refs/heads/master | 2021-01-11T07:46:37.383000 | 2019-02-25T15:24:19 | 2019-02-25T15:24:19 | 68,914,667 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package au.edu.swin.ict.road.composite.exceptions;
/**
* MessageDelivererException is thrown if a problem occurs with one
* of the MessageDeliverers moving messages about the composite.
*
* @author The ROAD team, Swinburne University of Technology
*/
@SuppressWarnings("serial")
public class MessageDelivererException extends Exception {
/**
* The default MessageDelivererException constructor. Throws
* the exception with a default message.
*/
public MessageDelivererException() {
super();
}
/**
* This constructor allows a custom message to be passed.
*
* @param msg the custom message.
*/
public MessageDelivererException(String msg) {
super(msg);
}
}
| UTF-8 | Java | 766 | java | MessageDelivererException.java | Java | [] | null | [] | package au.edu.swin.ict.road.composite.exceptions;
/**
* MessageDelivererException is thrown if a problem occurs with one
* of the MessageDeliverers moving messages about the composite.
*
* @author The ROAD team, Swinburne University of Technology
*/
@SuppressWarnings("serial")
public class MessageDelivererException extends Exception {
/**
* The default MessageDelivererException constructor. Throws
* the exception with a default message.
*/
public MessageDelivererException() {
super();
}
/**
* This constructor allows a custom message to be passed.
*
* @param msg the custom message.
*/
public MessageDelivererException(String msg) {
super(msg);
}
}
| 766 | 0.664491 | 0.664491 | 28 | 25.357143 | 24.581081 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | false | false | 9 |
60a10cbca54195b42a2be3870f83ee586a479ab8 | 23,742,579,228,105 | 06b529186163a7d6e2633783e363cbdeda3aef25 | /PortalKitClient/src/main/java/org/etp/portalKit/client/logic/MenuItemElement.java | 785ab22eeab36cddb6fb4487d5239d6c38f0ae3c | [] | no_license | etp-work/ThePower | https://github.com/etp-work/ThePower | 20ae85385d241b3a3c492de716afdf2a13844495 | dd4dce4dd2330ee52180d5a297c4196acab8ce1d | refs/heads/master | 2021-01-23T22:38:36.219000 | 2014-02-20T13:27:43 | 2014-02-20T13:27:43 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.etp.portalKit.client.logic;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
/**
* The purpose of this class is to provide source controller to
* MenuItem
*/
public class MenuItemElement {
private String MenuItemText;
private MenuItem menuItem;
private Menu dropDown;
private String parentText;
/**
* @return dropDown menu of current MenuItem if it is a top
* MenuItem. Otherwise null
*/
public Menu getDropDown() {
return dropDown;
}
/**
* @param dropDown
*/
public void setDropDown(Menu dropDown) {
this.dropDown = dropDown;
}
/**
* @return text of current MenuItem
*/
public String getMenuItemText() {
return MenuItemText;
}
/**
* @param menuItemText
*/
public void setMenuItemText(String menuItemText) {
MenuItemText = menuItemText;
}
/**
* @return instance of current MenuItem
*/
public MenuItem getMenuItem() {
return menuItem;
}
/**
* @param menuItem
*/
public void setMenuItem(MenuItem menuItem) {
this.menuItem = menuItem;
}
/**
* @return text of current MenuItem's parent
*/
public String getParentText() {
return parentText;
}
/**
* @param parentText
*/
public void setParentText(String parentText) {
this.parentText = parentText;
}
}
| UTF-8 | Java | 1,469 | java | MenuItemElement.java | Java | [] | null | [] | package org.etp.portalKit.client.logic;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
/**
* The purpose of this class is to provide source controller to
* MenuItem
*/
public class MenuItemElement {
private String MenuItemText;
private MenuItem menuItem;
private Menu dropDown;
private String parentText;
/**
* @return dropDown menu of current MenuItem if it is a top
* MenuItem. Otherwise null
*/
public Menu getDropDown() {
return dropDown;
}
/**
* @param dropDown
*/
public void setDropDown(Menu dropDown) {
this.dropDown = dropDown;
}
/**
* @return text of current MenuItem
*/
public String getMenuItemText() {
return MenuItemText;
}
/**
* @param menuItemText
*/
public void setMenuItemText(String menuItemText) {
MenuItemText = menuItemText;
}
/**
* @return instance of current MenuItem
*/
public MenuItem getMenuItem() {
return menuItem;
}
/**
* @param menuItem
*/
public void setMenuItem(MenuItem menuItem) {
this.menuItem = menuItem;
}
/**
* @return text of current MenuItem's parent
*/
public String getParentText() {
return parentText;
}
/**
* @param parentText
*/
public void setParentText(String parentText) {
this.parentText = parentText;
}
}
| 1,469 | 0.603812 | 0.603812 | 72 | 19.402779 | 17.511631 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.208333 | false | false | 9 |
b8fbedd046f6756a16cdf2ec7f85854b60e9d90a | 22,359,599,793,299 | 9d7e4dde2f4f3bbebc5a8012d9c1bd472e446d8f | /myshop/src/com/qfedu/myshop/dao/ItermDao.java | a928534daac3afc667737ca8b3aeb8c33df84f65 | [] | no_license | lzc981106650/caonima | https://github.com/lzc981106650/caonima | 1a97613ca683eb309d08cd740bcebedc0a69ca5f | 39395afb51ff982843fd461d77d28f8a43779113 | refs/heads/master | 2023-02-22T09:08:24.869000 | 2021-01-30T12:21:10 | 2021-01-30T12:21:10 | 334,406,199 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.qfedu.myshop.dao;
import com.qfedu.myshop.entity.Cart;
import com.qfedu.myshop.entity.Item;
import java.sql.SQLException;
import java.util.List;
public interface ItermDao {
int addIterm(List<Cart> carts, String oid) throws SQLException;
List<Item> detail(String oid) throws SQLException;
}
| UTF-8 | Java | 314 | java | ItermDao.java | Java | [] | null | [] | package com.qfedu.myshop.dao;
import com.qfedu.myshop.entity.Cart;
import com.qfedu.myshop.entity.Item;
import java.sql.SQLException;
import java.util.List;
public interface ItermDao {
int addIterm(List<Cart> carts, String oid) throws SQLException;
List<Item> detail(String oid) throws SQLException;
}
| 314 | 0.770701 | 0.770701 | 13 | 23.153847 | 21.346395 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.615385 | false | false | 9 |
df1e79005212cf1b3624be1bd0469cc25f95d5ee | 25,649,544,714,804 | 16e71102f2e51eefc6b12b9d5761307fa4857ab6 | /src/main/java/com/srum/repository/MistakeRepository.java | 7066e60532d0b2567dddb642e4ca5977ad133be8 | [] | no_license | sanglthe140466/SRUM | https://github.com/sanglthe140466/SRUM | 8d0fc06e58b38cb89e7d724bb722ff57a7de3ed2 | 62cf4fae75a17c1c9a55e151c55b702b33fae9db | refs/heads/main | 2023-08-19T00:51:06.134000 | 2021-09-26T09:27:28 | 2021-09-26T09:30:26 | 410,498,400 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.srum.repository;
import com.srum.entity.Mistake;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author ThoNN1
*/
@Repository
public interface MistakeRepository extends CrudRepository<Mistake, Long> {
Mistake findMistakeById(Long mistakeId);
void deleteById(Long id);
}
| UTF-8 | Java | 387 | java | MistakeRepository.java | Java | [
{
"context": "epository;\n\nimport java.util.List;\n\n/**\n * @author ThoNN1\n */\n@Repository\npublic interface MistakeRepositor",
"end": 217,
"score": 0.9996692538261414,
"start": 211,
"tag": "USERNAME",
"value": "ThoNN1"
}
] | null | [] | package com.srum.repository;
import com.srum.entity.Mistake;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author ThoNN1
*/
@Repository
public interface MistakeRepository extends CrudRepository<Mistake, Long> {
Mistake findMistakeById(Long mistakeId);
void deleteById(Long id);
}
| 387 | 0.788114 | 0.78553 | 17 | 21.764706 | 22.521961 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.470588 | false | false | 9 |
af5efb737175b42e1bed0f77356a2b9dca60dcfd | 23,493,471,131,208 | 3cec9b50be837d33e7822afdf79196da44c71436 | /src/main/java/com/ray/jstl/models/City.java | 349af1de82701810254eff05ea676ec705d45fc7 | [] | no_license | lekyvong09/public_JavaEE_WebComponent_4_JSTL | https://github.com/lekyvong09/public_JavaEE_WebComponent_4_JSTL | dcc39eb623023d024c6de23c80c91bfce70bfb56 | 2ef522dc7e245f81aee95c923516ea8057179d0e | refs/heads/master | 2023-08-18T10:11:51.866000 | 2021-09-29T14:30:14 | 2021-09-29T14:30:14 | 399,123,312 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ray.jstl.models;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
public class City {
private int id;
@Length(min=3, max=100)
private String name;
@NotEmpty
private String countryCode;
@NotEmpty
private String country;
@Min(1)
private int population;
private String imageUrl;
public City() { }
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 getCountryCode() {
return countryCode;
}
public void setCountryCode(String countryCode) {
this.countryCode = countryCode;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public int getPopulation() {
return population;
}
public void setPopulation(int population) {
this.population = population;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
@Override
public String toString() {
return "City{" +
"name='" + name + '\'' +
", countryCode='" + countryCode + '\'' +
", country='" + country + '\'' +
", population=" + population +
'}';
}
}
| UTF-8 | Java | 1,619 | java | City.java | Java | [] | null | [] | package com.ray.jstl.models;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
public class City {
private int id;
@Length(min=3, max=100)
private String name;
@NotEmpty
private String countryCode;
@NotEmpty
private String country;
@Min(1)
private int population;
private String imageUrl;
public City() { }
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 getCountryCode() {
return countryCode;
}
public void setCountryCode(String countryCode) {
this.countryCode = countryCode;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public int getPopulation() {
return population;
}
public void setPopulation(int population) {
this.population = population;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
@Override
public String toString() {
return "City{" +
"name='" + name + '\'' +
", countryCode='" + countryCode + '\'' +
", country='" + country + '\'' +
", population=" + population +
'}';
}
}
| 1,619 | 0.570105 | 0.567017 | 85 | 18.047058 | 16.571348 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.317647 | false | false | 9 |
f8b139e8ff0100e43e664ee92b717338f293e511 | 31,774,168,056,976 | bff8730f479a5bcbea6b0dfefa8e233f724d87bf | /Desafios DIO - Java/CombinacaoDeStrings.java | 62847b70c09682e4524569f79a90cd99582725cf | [
"MIT"
] | permissive | saintravi/DesafiosDIO | https://github.com/saintravi/DesafiosDIO | e051b8d5c3c9ae0e987b0e0351b664c436181404 | 165702205c7d358dde933cfbfcfe53924a5a7538 | refs/heads/master | 2023-05-14T13:34:23.296000 | 2022-05-12T14:30:34 | 2022-05-12T14:30:34 | 347,722,685 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Combinação de Strings
*
* Desafio:
* - Crie um algoritmo que receba dois inputs que sejam strings e combine-as
* alternando as letras de cada string.
*
* - Deve começar pela primeira letra da primeira string, seguido pela primeira
* letra da segunda string, em seguida pela segunda letra da primeira string e
* continuar dessa forma sucessivamente.
*
* - As letras restantes da cadeia mais longa devem ser adicionadas ao fim da
* string resultante e retornada.
*
* Entrada:
* - A entrada contém vários casos de teste. A primeira linha contém um inteiro
* N que indica a quantidade de casos de teste que vem a seguir. Cada caso de teste
* é composto por uma linha que contém duas cadeias de caracteres, cada cadeia de
* caracteres contém entre 1 e 50 caracteres inclusive.
*
* Saída:
* - Combine as duas cadeias de caracteres da entrada como mostrado no exemplo abaixo
* e exiba a cadeia resultante.
*/
import java.util.Scanner;
public class CombinacaoDeStrings {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int casos = Integer.parseInt(scan.nextLine());
for(int i = 1; i <= casos; i++) {
StringBuilder analise = new StringBuilder();
String[] palavras = scan.nextLine().split(" ");
int maxSize = Math.max (
palavras[0].length(),
palavras[1].length());
for(int dados = 0; dados < maxSize; dados++) {
if(dados < palavras[0].length()) {
analise.append(palavras[0].charAt(dados));
}
if(dados < palavras[1].length()) {
analise.append(palavras[1].charAt(dados));
}
}
System.out.println(analise.toString());
}
}
} | UTF-8 | Java | 2,056 | java | CombinacaoDeStrings.java | Java | [] | null | [] | /**
* Combinação de Strings
*
* Desafio:
* - Crie um algoritmo que receba dois inputs que sejam strings e combine-as
* alternando as letras de cada string.
*
* - Deve começar pela primeira letra da primeira string, seguido pela primeira
* letra da segunda string, em seguida pela segunda letra da primeira string e
* continuar dessa forma sucessivamente.
*
* - As letras restantes da cadeia mais longa devem ser adicionadas ao fim da
* string resultante e retornada.
*
* Entrada:
* - A entrada contém vários casos de teste. A primeira linha contém um inteiro
* N que indica a quantidade de casos de teste que vem a seguir. Cada caso de teste
* é composto por uma linha que contém duas cadeias de caracteres, cada cadeia de
* caracteres contém entre 1 e 50 caracteres inclusive.
*
* Saída:
* - Combine as duas cadeias de caracteres da entrada como mostrado no exemplo abaixo
* e exiba a cadeia resultante.
*/
import java.util.Scanner;
public class CombinacaoDeStrings {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int casos = Integer.parseInt(scan.nextLine());
for(int i = 1; i <= casos; i++) {
StringBuilder analise = new StringBuilder();
String[] palavras = scan.nextLine().split(" ");
int maxSize = Math.max (
palavras[0].length(),
palavras[1].length());
for(int dados = 0; dados < maxSize; dados++) {
if(dados < palavras[0].length()) {
analise.append(palavras[0].charAt(dados));
}
if(dados < palavras[1].length()) {
analise.append(palavras[1].charAt(dados));
}
}
System.out.println(analise.toString());
}
}
} | 2,056 | 0.556207 | 0.550831 | 66 | 30.015152 | 26.449776 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.257576 | false | false | 9 |
d74cde755d24e942f302a6bad13fa137dec16a8e | 21,096,879,423,987 | 7487866f1213e08fd103e4ce0291aa6d2a37cbd4 | /app/src/main/java/com/ileja/aidlsample/DataService.java | 8ef8d79ed0fc1dd33c77710ce486e4b558ad57c6 | [] | no_license | fingerMask/AIDLCallbackSample | https://github.com/fingerMask/AIDLCallbackSample | 13a994b34011a0e4b379c1301dd6ee88b7cbc83a | 5928b76821562ac46f79cec35985e6918b0dcad1 | refs/heads/master | 2016-09-13T22:16:41.551000 | 2016-05-24T03:30:59 | 2016-05-24T03:30:59 | 59,537,478 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ileja.aidlsample;
import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
public class DataService extends Service {
private RemoteCallbackList<IHudCallback> callbackList = new RemoteCallbackList<>();
private static final int MSG_CALL = 0x01;
public DataService() {
}
@Override
public IBinder onBind(Intent intent) {
// TODO: Return the communication channel to the service.
return remoteBinder;
}
/**
* 分发消息
*/
private void dispatchProcessingCallback(final String message) {
final int N = callbackList.beginBroadcast();
try {
for(int i = 0; i < N; i++) {
IHudCallback cb = callbackList.getBroadcastItem(i);
if(cb == null){
continue;
}
cb.onMessage(message);
}
} catch (RemoteException e) {
}
callbackList.finishBroadcast();
}
@Override
public void onDestroy() {
mHandler.removeMessages(0);
callbackList.kill();
super.onDestroy();
}
@Override
public boolean onUnbind(Intent intent) {
return super.onUnbind(intent);
}
@Override
public void onRebind(Intent intent) {
super.onRebind(intent);
}
private IHudServer.Stub remoteBinder = new IHudServer.Stub() {
@Override
public void sendMessage(String message) throws RemoteException {
Message msg = mHandler.obtainMessage(MSG_CALL);
msg.obj = hanleMessage(message);
mHandler.sendMessage(msg);
}
@Override
public void registerCallback(IHudCallback cb) throws RemoteException {
if(cb != null){
callbackList.register(cb);
}
}
@Override
public void unregisterCallback(IHudCallback cb) throws RemoteException {
if(cb != null){
callbackList.unregister(cb);
}
}
private String hanleMessage(String message){
return message+" is handled!!!";
}
};
private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
dispatchProcessingCallback((String)msg.obj);
super.handleMessage(msg);
}
};
}
| UTF-8 | Java | 2,520 | java | DataService.java | Java | [] | null | [] | package com.ileja.aidlsample;
import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
public class DataService extends Service {
private RemoteCallbackList<IHudCallback> callbackList = new RemoteCallbackList<>();
private static final int MSG_CALL = 0x01;
public DataService() {
}
@Override
public IBinder onBind(Intent intent) {
// TODO: Return the communication channel to the service.
return remoteBinder;
}
/**
* 分发消息
*/
private void dispatchProcessingCallback(final String message) {
final int N = callbackList.beginBroadcast();
try {
for(int i = 0; i < N; i++) {
IHudCallback cb = callbackList.getBroadcastItem(i);
if(cb == null){
continue;
}
cb.onMessage(message);
}
} catch (RemoteException e) {
}
callbackList.finishBroadcast();
}
@Override
public void onDestroy() {
mHandler.removeMessages(0);
callbackList.kill();
super.onDestroy();
}
@Override
public boolean onUnbind(Intent intent) {
return super.onUnbind(intent);
}
@Override
public void onRebind(Intent intent) {
super.onRebind(intent);
}
private IHudServer.Stub remoteBinder = new IHudServer.Stub() {
@Override
public void sendMessage(String message) throws RemoteException {
Message msg = mHandler.obtainMessage(MSG_CALL);
msg.obj = hanleMessage(message);
mHandler.sendMessage(msg);
}
@Override
public void registerCallback(IHudCallback cb) throws RemoteException {
if(cb != null){
callbackList.register(cb);
}
}
@Override
public void unregisterCallback(IHudCallback cb) throws RemoteException {
if(cb != null){
callbackList.unregister(cb);
}
}
private String hanleMessage(String message){
return message+" is handled!!!";
}
};
private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
dispatchProcessingCallback((String)msg.obj);
super.handleMessage(msg);
}
};
}
| 2,520 | 0.592357 | 0.590366 | 99 | 24.373737 | 21.861633 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 9 |
8175a28cee87171ec9300229b67de86f8ee92ba1 | 10,849,087,458,485 | b639977e84c152553dd9c74bda1ead2d8d0875e9 | /src/main/java/mx/com/gseguros/ws/autosgs/infovehiculo/service/impl/InfoVehiculoServiceImpl.java | d4687eecbf0651d8fc838e9088caee0869e6b944 | [] | no_license | BiosnetTCS/ice_all | https://github.com/BiosnetTCS/ice_all | a41e6deba3c947e369855ab68cb1c9442a4c6077 | d47f6d9a0f10dd5382b5a8fa6c6072db62cda276 | HEAD | 2018-04-07T16:10:49.031000 | 2017-05-02T15:47:17 | 2017-05-02T15:47:17 | 89,630,581 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package mx.com.gseguros.ws.autosgs.infovehiculo.service.impl;
import mx.com.gseguros.exception.WSException;
import mx.com.gseguros.ws.autosgs.infovehiculo.client.axis2.VehiculoWSServiceStub;
import mx.com.gseguros.ws.autosgs.infovehiculo.client.axis2.VehiculoWSServiceStub.ObtenerValorComercial;
import mx.com.gseguros.ws.autosgs.infovehiculo.client.axis2.VehiculoWSServiceStub.ObtenerValorComercialE;
import mx.com.gseguros.ws.autosgs.infovehiculo.client.axis2.VehiculoWSServiceStub.ObtenerValorComercialResponseE;
import mx.com.gseguros.ws.autosgs.infovehiculo.client.axis2.VehiculoWSServiceStub.ResponseValor;
import mx.com.gseguros.ws.autosgs.infovehiculo.service.InfoVehiculoService;
import mx.com.gseguros.ws.model.WrapperResultadosWS;
import org.apache.axis2.AxisFault;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@Service
public class InfoVehiculoServiceImpl implements InfoVehiculoService {
private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(InfoVehiculoServiceImpl.class);
private static final long WS_TIMEOUT = 20000;
@Value("${ws.info.valor.auto.url}")
private String endpoint;
public ResponseValor obtieneDatosVehiculoGS(int claveGS, int modelo){
logger.debug(">>>>> Entrando a metodo WS validarPolizaTractoCamion");
ResponseValor resVal = null;
if(claveGS > 0 && modelo > 0){
try{
WrapperResultadosWS resultWS = this.ejecutaObtieneDatosVehiculoGS(claveGS, modelo);
logger.info(
new StringBuilder()
.append("\n@@@@@@@@@@@@@@@@@@@@@@@@")
.append("\n@@@@@@ WEBSERVICE @@@@@@")
.append("\n@@@@@@ cdtipsit= ").append(resultWS)
);
resVal = (ResponseValor) resultWS.getResultadoWS();
logger.info(
new StringBuilder()
.append("\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
.append("\n@@@@@@ WEBSERVICE @@@@@@")
.append("\n@@@@@@ cdtipsit=").append(resVal)
);
if( resVal != null && resVal.getExito()){
logger.debug("Respuesta de WS ejecutaObtieneDatosVehiculoGS Codigo(): " + resVal.getExito());
logger.debug("Respuesta de WS ejecutaObtieneDatosVehiculoGS Mensaje(): " +resVal.getMensaje());
}else{
logger.error("WS ejecutaObtieneDatosVehiculoGS, Resultado devuelto nulo o no existoso.");
}
} catch(WSException wse){
logger.error("Error en WS ejecutaObtieneDatosVehiculoGS, xml enviado: " + wse.getPayload(), wse);
} catch (Exception e){
logger.error("Error en WS ejecutaObtieneDatosVehiculoGS: " + e.getMessage(),e);
}
}else{
logger.error("Error en WS ejecutaObtieneDatosVehiculoGS datos en cero!");
}
return resVal;
}
private WrapperResultadosWS ejecutaObtieneDatosVehiculoGS(int claveGS, int modelo) throws Exception{
WrapperResultadosWS resultWS = new WrapperResultadosWS();
VehiculoWSServiceStub stubGS = null;
try {
logger.info(new StringBuffer("endpoint a invocar=").append(endpoint));
stubGS = new VehiculoWSServiceStub(endpoint);
stubGS._getServiceClient().getOptions().setTimeOutInMilliSeconds(WS_TIMEOUT);
} catch (AxisFault e) {
logger.error(e);
throw new Exception("Error de preparacion de Axis2: " + e.getMessage());
}
ObtenerValorComercial obtenerValorComercial = new ObtenerValorComercial();
obtenerValorComercial.setCve_gs(claveGS);
obtenerValorComercial.setModelo(modelo);
ObtenerValorComercialE obtenerValorComercialE = new ObtenerValorComercialE();
obtenerValorComercialE.setObtenerValorComercial(obtenerValorComercial);
try {
ObtenerValorComercialResponseE responseE = stubGS.obtenerValorComercial(obtenerValorComercialE);
ResponseValor resVal = responseE.getObtenerValorComercialResponse().get_return();
resultWS.setResultadoWS(resVal);
resultWS.setXmlIn(stubGS._getServiceClient().getLastOperationContext().getMessageContext("Out").getEnvelope().toString());
logger.debug("Xml enviado para ejecutavalidarPolizaTractoCamion: " + stubGS._getServiceClient().getLastOperationContext().getMessageContext("Out").getEnvelope().toString());
} catch (Exception re) {
throw new WSException("Error de conexion ejecutavalidarPolizaTractoCamion: " + re.getMessage(), re, stubGS._getServiceClient().getLastOperationContext().getMessageContext("Out").getEnvelope().toString());
}
return resultWS;
}
public void setEndpoint(String endpoint) {
this.endpoint = endpoint;
}
} | UTF-8 | Java | 4,468 | java | InfoVehiculoServiceImpl.java | Java | [] | null | [] | package mx.com.gseguros.ws.autosgs.infovehiculo.service.impl;
import mx.com.gseguros.exception.WSException;
import mx.com.gseguros.ws.autosgs.infovehiculo.client.axis2.VehiculoWSServiceStub;
import mx.com.gseguros.ws.autosgs.infovehiculo.client.axis2.VehiculoWSServiceStub.ObtenerValorComercial;
import mx.com.gseguros.ws.autosgs.infovehiculo.client.axis2.VehiculoWSServiceStub.ObtenerValorComercialE;
import mx.com.gseguros.ws.autosgs.infovehiculo.client.axis2.VehiculoWSServiceStub.ObtenerValorComercialResponseE;
import mx.com.gseguros.ws.autosgs.infovehiculo.client.axis2.VehiculoWSServiceStub.ResponseValor;
import mx.com.gseguros.ws.autosgs.infovehiculo.service.InfoVehiculoService;
import mx.com.gseguros.ws.model.WrapperResultadosWS;
import org.apache.axis2.AxisFault;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@Service
public class InfoVehiculoServiceImpl implements InfoVehiculoService {
private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(InfoVehiculoServiceImpl.class);
private static final long WS_TIMEOUT = 20000;
@Value("${ws.info.valor.auto.url}")
private String endpoint;
public ResponseValor obtieneDatosVehiculoGS(int claveGS, int modelo){
logger.debug(">>>>> Entrando a metodo WS validarPolizaTractoCamion");
ResponseValor resVal = null;
if(claveGS > 0 && modelo > 0){
try{
WrapperResultadosWS resultWS = this.ejecutaObtieneDatosVehiculoGS(claveGS, modelo);
logger.info(
new StringBuilder()
.append("\n@@@@@@@@@@@@@@@@@@@@@@@@")
.append("\n@@@@@@ WEBSERVICE @@@@@@")
.append("\n@@@@@@ cdtipsit= ").append(resultWS)
);
resVal = (ResponseValor) resultWS.getResultadoWS();
logger.info(
new StringBuilder()
.append("\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
.append("\n@@@@@@ WEBSERVICE @@@@@@")
.append("\n@@@@@@ cdtipsit=").append(resVal)
);
if( resVal != null && resVal.getExito()){
logger.debug("Respuesta de WS ejecutaObtieneDatosVehiculoGS Codigo(): " + resVal.getExito());
logger.debug("Respuesta de WS ejecutaObtieneDatosVehiculoGS Mensaje(): " +resVal.getMensaje());
}else{
logger.error("WS ejecutaObtieneDatosVehiculoGS, Resultado devuelto nulo o no existoso.");
}
} catch(WSException wse){
logger.error("Error en WS ejecutaObtieneDatosVehiculoGS, xml enviado: " + wse.getPayload(), wse);
} catch (Exception e){
logger.error("Error en WS ejecutaObtieneDatosVehiculoGS: " + e.getMessage(),e);
}
}else{
logger.error("Error en WS ejecutaObtieneDatosVehiculoGS datos en cero!");
}
return resVal;
}
private WrapperResultadosWS ejecutaObtieneDatosVehiculoGS(int claveGS, int modelo) throws Exception{
WrapperResultadosWS resultWS = new WrapperResultadosWS();
VehiculoWSServiceStub stubGS = null;
try {
logger.info(new StringBuffer("endpoint a invocar=").append(endpoint));
stubGS = new VehiculoWSServiceStub(endpoint);
stubGS._getServiceClient().getOptions().setTimeOutInMilliSeconds(WS_TIMEOUT);
} catch (AxisFault e) {
logger.error(e);
throw new Exception("Error de preparacion de Axis2: " + e.getMessage());
}
ObtenerValorComercial obtenerValorComercial = new ObtenerValorComercial();
obtenerValorComercial.setCve_gs(claveGS);
obtenerValorComercial.setModelo(modelo);
ObtenerValorComercialE obtenerValorComercialE = new ObtenerValorComercialE();
obtenerValorComercialE.setObtenerValorComercial(obtenerValorComercial);
try {
ObtenerValorComercialResponseE responseE = stubGS.obtenerValorComercial(obtenerValorComercialE);
ResponseValor resVal = responseE.getObtenerValorComercialResponse().get_return();
resultWS.setResultadoWS(resVal);
resultWS.setXmlIn(stubGS._getServiceClient().getLastOperationContext().getMessageContext("Out").getEnvelope().toString());
logger.debug("Xml enviado para ejecutavalidarPolizaTractoCamion: " + stubGS._getServiceClient().getLastOperationContext().getMessageContext("Out").getEnvelope().toString());
} catch (Exception re) {
throw new WSException("Error de conexion ejecutavalidarPolizaTractoCamion: " + re.getMessage(), re, stubGS._getServiceClient().getLastOperationContext().getMessageContext("Out").getEnvelope().toString());
}
return resultWS;
}
public void setEndpoint(String endpoint) {
this.endpoint = endpoint;
}
} | 4,468 | 0.739033 | 0.735452 | 113 | 38.548672 | 40.694412 | 207 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.840708 | false | false | 9 |
d15233a4c9d2bea872a8f789cf102e8ee469dfeb | 13,597,866,519,951 | f6be000ca4fe75119a7a7f374ca2fb6e27ae9233 | /SmsSafe/src/com/softmo/smssafe2/views/CMHelperBaseActivity.java | 139cc3d3c1ac5a700ef8f0b9b8082fb5e27e9e11 | [] | no_license | rusmonster/PocketSafe | https://github.com/rusmonster/PocketSafe | 6157085514a1cf7daa6096ce4c7ae5a67075ee36 | 48b0c392237f941a3420e86205ebdf175d9839df | refs/heads/master | 2020-06-03T20:19:04.083000 | 2014-05-31T20:38:40 | 2014-05-31T20:38:40 | 2,808,545 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.softmo.smssafe2.views;
import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.support.v4.app.NavUtils;
import android.support.v4.app.TaskStackBuilder;
import android.util.Log;
import android.view.MenuItem;
import android.widget.Toast;
import com.softmo.smssafe2.R;
import com.softmo.smssafe2.R.string;
import com.softmo.smssafe2.dbengine.IMSetting;
import com.softmo.smssafe2.dbengine.IMDbQuerySetting.TTypSetting;
import com.softmo.smssafe2.main.IMEvent;
import com.softmo.smssafe2.main.IMEventErr;
import com.softmo.smssafe2.main.IMEventSimpleID;
import com.softmo.smssafe2.main.IMListener;
import com.softmo.smssafe2.main.IMMain;
import com.softmo.smssafe2.main.IMMain.TMainState;
import com.softmo.smssafe2.main.TTypEvent;
import com.softmo.smssafe2.safeservice.CMSafeService;
import com.softmo.smssafe2.utils.CMLocator;
import com.softmo.smssafe2.utils.IMLocator;
import com.softmo.smssafe2.utils.MyException;
import com.softmo.smssafe2.utils.MyException.TTypMyException;
public class CMHelperBaseActivity implements IMBaseActivity, IMListener {
private static final int SET_PASS_RESULT = 1003;
private static final int ENTER_PASS_RESULT = 1004;
private static final int IDD_GENERATE = 50;
private static final int IDD_IMPORT = 51;
public static final String KILL_ACTION = "com.softmo.smssafe2.CMHelperBaseActivity.KILL_ACTION";
private Activity mOwner;
private IMLocator mLocator;
private IMMain mMain;
private String mSettedPass;
private String mEnteredPass;
private ProgressDialog mDlg;
private KillReceiver mKillReceiver;
private boolean mKillReceived = false;
private final class KillReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.d("!!!", "Kill recv: " + mOwner.toString());
mKillReceived = true;
mOwner.finish();
}
}
private ServiceConnection serviceConncetion = new ServiceConnection() {
public void onServiceConnected(ComponentName name, IBinder service) {
CMHelperBaseActivity.this.mMain = ((CMSafeService.MyBinder) service).getMain();
try {
getMain().Dispatcher().addListener(CMHelperBaseActivity.this);
onMainBind();
} catch (MyException e) {
ErrorDisplayer.displayError(mOwner, e.getId().getValue());
}
}
public void onServiceDisconnected(ComponentName name) {
CMHelperBaseActivity.this.mMain = null;
Log.d("!!!", "Service disconnected " + this.toString());
}
};
public IMLocator getLocator() {
return mLocator;
}
public IMMain getMain() throws MyException {
if (mMain == null) {
Log.w("!!!", "mMain == null");
throw new MyException(TTypMyException.EErrServiceNotBinded);
}
return mMain;
}
private boolean checkPassSet() throws MyException {
IMSetting set = mLocator.createSetting();
getMain().DbReader().QuerySetting().getById(set, TTypSetting.ERsaPub);
if (set.getStrVal().length() > 0)
return true;
if (mSettedPass != null) {
String pass = mSettedPass;
mSettedPass = null;
try {
getMain().changePass(null, pass);
} catch (MyException e) {
Log.e("!!!", "Error in getMain().changePass:" + e.getId());
ErrorDisplayer.displayError(mOwner, e.getId().getValue());
Intent i = new Intent(mOwner, SetPassActivity.class);
i.putExtra(SetPassActivity.MODE, SetPassActivity.TMode.ESetPass);
mOwner.startActivityForResult(i, SET_PASS_RESULT);
return false;
}
return true;
}
Intent i = new Intent(mOwner, SetPassActivity.class);
i.putExtra(SetPassActivity.MODE, SetPassActivity.TMode.ESetPass);
mOwner.startActivityForResult(i, SET_PASS_RESULT);
return false;
}
private boolean checkPassActual() throws MyException {
if (getMain().isPassValid())
return true;
if (mEnteredPass != null) {
String pass = mEnteredPass;
mEnteredPass = null;
try {
getMain().enterPass(pass);
} catch (MyException e) {
Log.e("!!!", "Error in getMain().enterPass:" + e.getId());
ErrorDisplayer.displayError(mOwner, e.getId().getValue());
Intent i = new Intent(mOwner, EnterPassActivity.class);
mOwner.startActivityForResult(i, ENTER_PASS_RESULT);
return false;
}
return true;
}
ErrorDisplayer.displayError(mOwner, TTypMyException.EPassExpired.getValue());
Intent i = new Intent(mOwner, EnterPassActivity.class);
mOwner.startActivityForResult(i, ENTER_PASS_RESULT);
return false;
}
private Handler mHandler = new Handler();
private Runnable mRunVisible = new Runnable() {
public void run() {
try {
mOwner.setVisible(true);
} catch (Exception e) {
Log.e("!!!", "Error in mRunVisible: " + e.getMessage());
e.printStackTrace();
}
}
};
private boolean internalMainBind() throws MyException {
if (mKillReceived) {
mKillReceived = false;
return false;
}
if (!checkPassSet())
return false;
if (!checkPassActual())
return false;
getMain().guiResume();
/*********************try fix NullPointerException bug********************************/
try {
mOwner.setVisible(true);
} catch (Exception e) {
Log.e("!!!", "Error in mOwner.setVisible(true): " + e.getMessage());
mHandler.postDelayed(mRunVisible, 1000);
}
/*************************************************************************************/
if (getMain().getState() == TMainState.EImport) {
mOwner.showDialog(IDD_IMPORT);
}
return true;
}
protected void onMainBind() throws MyException {
Log.d("!!!", "Service connected " + mOwner.toString());
try {
if (!internalMainBind()) return;
if (mOwner instanceof IMHelperBaseActivityObserver) {
IMHelperBaseActivityObserver ba = (IMHelperBaseActivityObserver) mOwner;
ba.onMainBind();
}
} catch (MyException e) {
ErrorDisplayer.displayError(mOwner, e.getId().getValue());
}
}
public CMHelperBaseActivity(Activity owner) {
mOwner = owner;
mLocator = new CMLocator();
}
public void onCreate(Bundle savedInstanceState) {
Log.d("!!!", "onCreate " + mOwner.toString());
mKillReceiver = new KillReceiver();
mOwner.registerReceiver(mKillReceiver, new IntentFilter(KILL_ACTION));
}
public void onDestroy() {
Log.d("!!!", "onDestroy " + mOwner.toString());
mOwner.unregisterReceiver(mKillReceiver);
}
public void onStart() {
Log.d("!!!", "onStart " + mOwner.toString());
}
public void onStop() {
Log.d("!!!", "onStop " + mOwner.toString());
}
public void onResume() {
Log.d("!!!", "onResume " + mOwner.toString());
Intent stIntent = new Intent(mOwner, CMSafeService.class);
mOwner.startService(stIntent);
mOwner.bindService(stIntent, serviceConncetion, Activity.BIND_AUTO_CREATE);
}
public void onPause() {
Log.d("!!!", "onPause " + mOwner.toString());
if (mDlg != null) mDlg.dismiss();
mDlg = null;
mOwner.setVisible(false); //for disable moment show activity before passEnter
try {
getMain().guiPause();
getMain().Dispatcher().delListener(this);
} catch (MyException e) {
e.printStackTrace();
}
mMain = null;
mOwner.unbindService(serviceConncetion);
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK) {
switch (requestCode) {
case SET_PASS_RESULT:
mSettedPass = data.getStringExtra(SetPassActivity.PASS);
break;
case ENTER_PASS_RESULT:
mEnteredPass = data.getStringExtra(EnterPassActivity.PASS);
break;
}
} else if (resultCode == Activity.RESULT_CANCELED) {
switch (requestCode) {
case SET_PASS_RESULT:
case ENTER_PASS_RESULT:
//mOwner.finish();
Intent i = new Intent(CMHelperBaseActivity.KILL_ACTION);
mOwner.sendBroadcast(i);
break;
}
} else {
Log.w("!!!", "Unknown result code: " + resultCode);
}
}
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
// Respond to the action bar's Up/Home button
case android.R.id.home:
Intent upIntent = NavUtils.getParentActivityIntent(mOwner);
if (NavUtils.shouldUpRecreateTask(mOwner, upIntent)) {
// This activity is NOT part of this app's task, so create a new task
// when navigating up, with a synthesized back stack.
TaskStackBuilder.create(mOwner)
// Add all of this activity's parents to the back stack
.addNextIntentWithParentStack(upIntent)
// Navigate up to the closest parent
.startActivities();
} else {
// This activity is part of this app's task, so simply
// navigate up to the logical parent activity.
NavUtils.navigateUpTo(mOwner, upIntent);
}
return true;
}
return false;
}
public void listenerEvent(IMEvent event) throws Exception {
TTypEvent typ = event.getTyp();
Log.d("!!!", "listenerEvent: " + typ);
switch (typ) {
case ERsaKeyPairGenerateStart:
mOwner.showDialog(IDD_GENERATE);
Log.d("!!!", "showDialog: " + IDD_GENERATE);
break;
case ERsaKeyPairGenerated:
if (mDlg != null) mDlg.dismiss();
mDlg = null;
break;
case ERsaKeyPairGenerateError:
IMEventErr evErr = (IMEventErr) event;
if (mDlg != null) mDlg.dismiss();
mDlg = null;
ErrorDisplayer.displayError(mOwner, evErr.getErr());
break;
case EPassExpired:
Log.d("!!!", "EPassExpired received");
checkPassActual();
break;
case EImportStart:
mOwner.showDialog(IDD_IMPORT);
break;
case EImportFinish:
if (mDlg != null) mDlg.dismiss();
mDlg = null;
Toast.makeText(mOwner, R.string.importfinish, Toast.LENGTH_SHORT).show();
break;
case EImportError:
if (mDlg != null) mDlg.dismiss();
mDlg = null;
ErrorDisplayer.displayError(mOwner, ((IMEventErr) event).getErr());
break;
case EImportProgress:
if (mDlg != null) {
int p = ((IMEventSimpleID) event).getId();
mDlg.setProgress(p);
Log.d("!!!", "listenerEvent: setProgress");
}
break;
}
if (mOwner instanceof IMListener) {
((IMListener) mOwner).listenerEvent(event);
}
}
public Dialog onCreateDialog(int id) {
Log.d("!!!", "Helper onCreateDialog: " + id);
Dialog dlg = null;
switch (id) {
case IDD_GENERATE:
mDlg = new ProgressDialog(mOwner);
mDlg.setProgressStyle(ProgressDialog.STYLE_SPINNER);
mDlg.setCancelable(false);
mDlg.setMessage(mOwner.getResources().getString(R.string.rsa_generate));
dlg = mDlg;
break;
case IDD_IMPORT:
mDlg = new ProgressDialog(mOwner);
mDlg.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mDlg.setCancelable(false);
mDlg.setMessage(mOwner.getResources().getString(R.string.dlg_import));
mDlg.setButton(mOwner.getResources().getString(android.R.string.cancel),
new android.content.DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
try {
Log.d("!!!", "CancelImport pressed");
getMain().importSmsCancel();
} catch (MyException e) {
e.printStackTrace();
}
}
}
);
dlg = mDlg;
break;
}
Log.d("!!!", "dlg created: " + dlg);
return dlg;
}
public void lockNow() {
try {
getMain().lockNow();
mOwner.sendBroadcast(new Intent(CMHelperBaseActivity.KILL_ACTION));
} catch (MyException e) {
e.printStackTrace();
ErrorDisplayer.displayError(mOwner, e);
}
}
public void importSms() {
try {
getMain().importSms();
} catch (MyException e) {
ErrorDisplayer.displayError(mOwner, e);
}
}
public void onPrepareDialog(int id, Dialog dialog) {
Log.d("!!!", "Helper onPrepareDialog: " + id);
switch (id) {
case IDD_GENERATE:
case IDD_IMPORT:
if (mDlg != null) mDlg.dismiss();
mDlg = (ProgressDialog) dialog;
break;
}
}
}
| UTF-8 | Java | 12,065 | java | CMHelperBaseActivity.java | Java | [] | null | [] | package com.softmo.smssafe2.views;
import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.support.v4.app.NavUtils;
import android.support.v4.app.TaskStackBuilder;
import android.util.Log;
import android.view.MenuItem;
import android.widget.Toast;
import com.softmo.smssafe2.R;
import com.softmo.smssafe2.R.string;
import com.softmo.smssafe2.dbengine.IMSetting;
import com.softmo.smssafe2.dbengine.IMDbQuerySetting.TTypSetting;
import com.softmo.smssafe2.main.IMEvent;
import com.softmo.smssafe2.main.IMEventErr;
import com.softmo.smssafe2.main.IMEventSimpleID;
import com.softmo.smssafe2.main.IMListener;
import com.softmo.smssafe2.main.IMMain;
import com.softmo.smssafe2.main.IMMain.TMainState;
import com.softmo.smssafe2.main.TTypEvent;
import com.softmo.smssafe2.safeservice.CMSafeService;
import com.softmo.smssafe2.utils.CMLocator;
import com.softmo.smssafe2.utils.IMLocator;
import com.softmo.smssafe2.utils.MyException;
import com.softmo.smssafe2.utils.MyException.TTypMyException;
public class CMHelperBaseActivity implements IMBaseActivity, IMListener {
private static final int SET_PASS_RESULT = 1003;
private static final int ENTER_PASS_RESULT = 1004;
private static final int IDD_GENERATE = 50;
private static final int IDD_IMPORT = 51;
public static final String KILL_ACTION = "com.softmo.smssafe2.CMHelperBaseActivity.KILL_ACTION";
private Activity mOwner;
private IMLocator mLocator;
private IMMain mMain;
private String mSettedPass;
private String mEnteredPass;
private ProgressDialog mDlg;
private KillReceiver mKillReceiver;
private boolean mKillReceived = false;
private final class KillReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.d("!!!", "Kill recv: " + mOwner.toString());
mKillReceived = true;
mOwner.finish();
}
}
private ServiceConnection serviceConncetion = new ServiceConnection() {
public void onServiceConnected(ComponentName name, IBinder service) {
CMHelperBaseActivity.this.mMain = ((CMSafeService.MyBinder) service).getMain();
try {
getMain().Dispatcher().addListener(CMHelperBaseActivity.this);
onMainBind();
} catch (MyException e) {
ErrorDisplayer.displayError(mOwner, e.getId().getValue());
}
}
public void onServiceDisconnected(ComponentName name) {
CMHelperBaseActivity.this.mMain = null;
Log.d("!!!", "Service disconnected " + this.toString());
}
};
public IMLocator getLocator() {
return mLocator;
}
public IMMain getMain() throws MyException {
if (mMain == null) {
Log.w("!!!", "mMain == null");
throw new MyException(TTypMyException.EErrServiceNotBinded);
}
return mMain;
}
private boolean checkPassSet() throws MyException {
IMSetting set = mLocator.createSetting();
getMain().DbReader().QuerySetting().getById(set, TTypSetting.ERsaPub);
if (set.getStrVal().length() > 0)
return true;
if (mSettedPass != null) {
String pass = mSettedPass;
mSettedPass = null;
try {
getMain().changePass(null, pass);
} catch (MyException e) {
Log.e("!!!", "Error in getMain().changePass:" + e.getId());
ErrorDisplayer.displayError(mOwner, e.getId().getValue());
Intent i = new Intent(mOwner, SetPassActivity.class);
i.putExtra(SetPassActivity.MODE, SetPassActivity.TMode.ESetPass);
mOwner.startActivityForResult(i, SET_PASS_RESULT);
return false;
}
return true;
}
Intent i = new Intent(mOwner, SetPassActivity.class);
i.putExtra(SetPassActivity.MODE, SetPassActivity.TMode.ESetPass);
mOwner.startActivityForResult(i, SET_PASS_RESULT);
return false;
}
private boolean checkPassActual() throws MyException {
if (getMain().isPassValid())
return true;
if (mEnteredPass != null) {
String pass = mEnteredPass;
mEnteredPass = null;
try {
getMain().enterPass(pass);
} catch (MyException e) {
Log.e("!!!", "Error in getMain().enterPass:" + e.getId());
ErrorDisplayer.displayError(mOwner, e.getId().getValue());
Intent i = new Intent(mOwner, EnterPassActivity.class);
mOwner.startActivityForResult(i, ENTER_PASS_RESULT);
return false;
}
return true;
}
ErrorDisplayer.displayError(mOwner, TTypMyException.EPassExpired.getValue());
Intent i = new Intent(mOwner, EnterPassActivity.class);
mOwner.startActivityForResult(i, ENTER_PASS_RESULT);
return false;
}
private Handler mHandler = new Handler();
private Runnable mRunVisible = new Runnable() {
public void run() {
try {
mOwner.setVisible(true);
} catch (Exception e) {
Log.e("!!!", "Error in mRunVisible: " + e.getMessage());
e.printStackTrace();
}
}
};
private boolean internalMainBind() throws MyException {
if (mKillReceived) {
mKillReceived = false;
return false;
}
if (!checkPassSet())
return false;
if (!checkPassActual())
return false;
getMain().guiResume();
/*********************try fix NullPointerException bug********************************/
try {
mOwner.setVisible(true);
} catch (Exception e) {
Log.e("!!!", "Error in mOwner.setVisible(true): " + e.getMessage());
mHandler.postDelayed(mRunVisible, 1000);
}
/*************************************************************************************/
if (getMain().getState() == TMainState.EImport) {
mOwner.showDialog(IDD_IMPORT);
}
return true;
}
protected void onMainBind() throws MyException {
Log.d("!!!", "Service connected " + mOwner.toString());
try {
if (!internalMainBind()) return;
if (mOwner instanceof IMHelperBaseActivityObserver) {
IMHelperBaseActivityObserver ba = (IMHelperBaseActivityObserver) mOwner;
ba.onMainBind();
}
} catch (MyException e) {
ErrorDisplayer.displayError(mOwner, e.getId().getValue());
}
}
public CMHelperBaseActivity(Activity owner) {
mOwner = owner;
mLocator = new CMLocator();
}
public void onCreate(Bundle savedInstanceState) {
Log.d("!!!", "onCreate " + mOwner.toString());
mKillReceiver = new KillReceiver();
mOwner.registerReceiver(mKillReceiver, new IntentFilter(KILL_ACTION));
}
public void onDestroy() {
Log.d("!!!", "onDestroy " + mOwner.toString());
mOwner.unregisterReceiver(mKillReceiver);
}
public void onStart() {
Log.d("!!!", "onStart " + mOwner.toString());
}
public void onStop() {
Log.d("!!!", "onStop " + mOwner.toString());
}
public void onResume() {
Log.d("!!!", "onResume " + mOwner.toString());
Intent stIntent = new Intent(mOwner, CMSafeService.class);
mOwner.startService(stIntent);
mOwner.bindService(stIntent, serviceConncetion, Activity.BIND_AUTO_CREATE);
}
public void onPause() {
Log.d("!!!", "onPause " + mOwner.toString());
if (mDlg != null) mDlg.dismiss();
mDlg = null;
mOwner.setVisible(false); //for disable moment show activity before passEnter
try {
getMain().guiPause();
getMain().Dispatcher().delListener(this);
} catch (MyException e) {
e.printStackTrace();
}
mMain = null;
mOwner.unbindService(serviceConncetion);
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK) {
switch (requestCode) {
case SET_PASS_RESULT:
mSettedPass = data.getStringExtra(SetPassActivity.PASS);
break;
case ENTER_PASS_RESULT:
mEnteredPass = data.getStringExtra(EnterPassActivity.PASS);
break;
}
} else if (resultCode == Activity.RESULT_CANCELED) {
switch (requestCode) {
case SET_PASS_RESULT:
case ENTER_PASS_RESULT:
//mOwner.finish();
Intent i = new Intent(CMHelperBaseActivity.KILL_ACTION);
mOwner.sendBroadcast(i);
break;
}
} else {
Log.w("!!!", "Unknown result code: " + resultCode);
}
}
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
// Respond to the action bar's Up/Home button
case android.R.id.home:
Intent upIntent = NavUtils.getParentActivityIntent(mOwner);
if (NavUtils.shouldUpRecreateTask(mOwner, upIntent)) {
// This activity is NOT part of this app's task, so create a new task
// when navigating up, with a synthesized back stack.
TaskStackBuilder.create(mOwner)
// Add all of this activity's parents to the back stack
.addNextIntentWithParentStack(upIntent)
// Navigate up to the closest parent
.startActivities();
} else {
// This activity is part of this app's task, so simply
// navigate up to the logical parent activity.
NavUtils.navigateUpTo(mOwner, upIntent);
}
return true;
}
return false;
}
public void listenerEvent(IMEvent event) throws Exception {
TTypEvent typ = event.getTyp();
Log.d("!!!", "listenerEvent: " + typ);
switch (typ) {
case ERsaKeyPairGenerateStart:
mOwner.showDialog(IDD_GENERATE);
Log.d("!!!", "showDialog: " + IDD_GENERATE);
break;
case ERsaKeyPairGenerated:
if (mDlg != null) mDlg.dismiss();
mDlg = null;
break;
case ERsaKeyPairGenerateError:
IMEventErr evErr = (IMEventErr) event;
if (mDlg != null) mDlg.dismiss();
mDlg = null;
ErrorDisplayer.displayError(mOwner, evErr.getErr());
break;
case EPassExpired:
Log.d("!!!", "EPassExpired received");
checkPassActual();
break;
case EImportStart:
mOwner.showDialog(IDD_IMPORT);
break;
case EImportFinish:
if (mDlg != null) mDlg.dismiss();
mDlg = null;
Toast.makeText(mOwner, R.string.importfinish, Toast.LENGTH_SHORT).show();
break;
case EImportError:
if (mDlg != null) mDlg.dismiss();
mDlg = null;
ErrorDisplayer.displayError(mOwner, ((IMEventErr) event).getErr());
break;
case EImportProgress:
if (mDlg != null) {
int p = ((IMEventSimpleID) event).getId();
mDlg.setProgress(p);
Log.d("!!!", "listenerEvent: setProgress");
}
break;
}
if (mOwner instanceof IMListener) {
((IMListener) mOwner).listenerEvent(event);
}
}
public Dialog onCreateDialog(int id) {
Log.d("!!!", "Helper onCreateDialog: " + id);
Dialog dlg = null;
switch (id) {
case IDD_GENERATE:
mDlg = new ProgressDialog(mOwner);
mDlg.setProgressStyle(ProgressDialog.STYLE_SPINNER);
mDlg.setCancelable(false);
mDlg.setMessage(mOwner.getResources().getString(R.string.rsa_generate));
dlg = mDlg;
break;
case IDD_IMPORT:
mDlg = new ProgressDialog(mOwner);
mDlg.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mDlg.setCancelable(false);
mDlg.setMessage(mOwner.getResources().getString(R.string.dlg_import));
mDlg.setButton(mOwner.getResources().getString(android.R.string.cancel),
new android.content.DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
try {
Log.d("!!!", "CancelImport pressed");
getMain().importSmsCancel();
} catch (MyException e) {
e.printStackTrace();
}
}
}
);
dlg = mDlg;
break;
}
Log.d("!!!", "dlg created: " + dlg);
return dlg;
}
public void lockNow() {
try {
getMain().lockNow();
mOwner.sendBroadcast(new Intent(CMHelperBaseActivity.KILL_ACTION));
} catch (MyException e) {
e.printStackTrace();
ErrorDisplayer.displayError(mOwner, e);
}
}
public void importSms() {
try {
getMain().importSms();
} catch (MyException e) {
ErrorDisplayer.displayError(mOwner, e);
}
}
public void onPrepareDialog(int id, Dialog dialog) {
Log.d("!!!", "Helper onPrepareDialog: " + id);
switch (id) {
case IDD_GENERATE:
case IDD_IMPORT:
if (mDlg != null) mDlg.dismiss();
mDlg = (ProgressDialog) dialog;
break;
}
}
}
| 12,065 | 0.685288 | 0.682221 | 434 | 26.79954 | 22.764147 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.813364 | false | false | 9 |
35643ea907bfd816b3cd66402b195662983eb590 | 13,597,866,516,953 | 34550053d523908e37d03e2fd0166765ef1b1bb4 | /org.eclipse.emf.eson.parent/org.eclipse.emf.eson/src/org/eclipse/emf/eson/EFactoryRuntimeModule.java | d4c4405dba28dbf7a8aa8aa1b30b29be13997a6b | [] | no_license | RBirdwatcher/efbt | https://github.com/RBirdwatcher/efbt | 77831b224936ee2afd729dd96fd0e7b70e72bb65 | 8ba8d7e70234abf578f28a397c5c1de72b6da094 | refs/heads/master | 2021-04-23T23:52:09.180000 | 2020-10-08T09:12:39 | 2020-10-08T09:12:39 | 250,036,536 | 0 | 0 | null | true | 2020-03-25T16:49:14 | 2020-03-25T16:49:13 | 2020-03-08T20:16:58 | 2020-03-25T16:45:48 | 6,455 | 0 | 0 | 0 | null | false | false | /*
* #%L
* org.eclipse.emf.eson
* %%
* Copyright (C) 2009 - 2014 Sebastian Benz & Michael Vorburger
* %%
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* #L%
*/
package org.eclipse.emf.eson;
import org.apache.log4j.Logger;
import org.eclipse.emf.eson.conversion.DATEValueConverter;
import org.eclipse.emf.eson.conversion.TerminalConverters;
import org.eclipse.emf.eson.generators.DelegatingGenerator;
import org.eclipse.emf.eson.generators.EFactoryFileExtensionRegistry;
import org.eclipse.emf.eson.resource.EFactoryDerivedStateComputer;
import org.eclipse.emf.eson.resource.EFactoryEncodingProvider;
import org.eclipse.emf.eson.resource.EFactoryLocationInFileProvider;
import org.eclipse.emf.eson.resource.EFactoryResourceFactory;
import org.eclipse.emf.eson.resource.EFactoryResourceServiceProvider;
import org.eclipse.emf.eson.scoping.EFactoryQualifiedNameProvider;
import org.eclipse.emf.eson.scoping.ESONLinkingService;
import org.eclipse.emf.eson.scoping.ExtendedImportedNamespaceAwareLocalScopeProvider;
import org.eclipse.emf.eson.scoping.WarningErrorHandlerWithoutNoSuchMethodException;
import org.eclipse.emf.eson.validation.ESONDiagnosticConverter;
import org.eclipse.emf.eson.validation.ESONLinkingDiagnosticMessageProvider;
import org.eclipse.emf.eson.xtextbackpatch.FasterResourceSetBasedAllContainersStateProvider;
import org.eclipse.xtext.Constants;
import org.eclipse.xtext.generator.IGenerator;
import org.eclipse.xtext.linking.ILinkingDiagnosticMessageProvider;
import org.eclipse.xtext.linking.ILinkingService;
import org.eclipse.xtext.naming.IQualifiedNameProvider;
import org.eclipse.xtext.parser.IEncodingProvider;
import org.eclipse.xtext.parser.antlr.IReferableElementsUnloader;
import org.eclipse.xtext.parser.antlr.IReferableElementsUnloader.GenericUnloader;
import org.eclipse.xtext.resource.IDerivedStateComputer;
import org.eclipse.xtext.resource.ILocationInFileProvider;
import org.eclipse.xtext.resource.IResourceFactory;
import org.eclipse.xtext.resource.IResourceServiceProvider;
import org.eclipse.xtext.scoping.IScope;
import org.eclipse.xtext.scoping.IScopeProvider;
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
import org.eclipse.xtext.service.DispatchingProvider;
import org.eclipse.xtext.util.PolymorphicDispatcher;
import org.eclipse.xtext.validation.IDiagnosticConverter;
import org.eclipse.xtext.validation.IResourceValidator;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import com.google.inject.Binder;
import com.google.inject.TypeLiteral;
import com.google.inject.name.Names;
/**
* Use this class to register components to be used within the IDE.
*/
public class EFactoryRuntimeModule extends AbstractEFactoryRuntimeModule {
@Override
public void configure(Binder binder) {
super.configure(binder);
binder.bind(String.class)
.annotatedWith(Names.named(DATEValueConverter.DATE_FORMAT_KEY))
.toInstance("MM.dd.yyyy");
binder.bind(IReferableElementsUnloader.class).to(GenericUnloader.class);
}
@Override
public Class<? extends org.eclipse.xtext.conversion.IValueConverterService> bindIValueConverterService() {
return TerminalConverters.class;
}
@Override
public Class<? extends IResourceFactory> bindIResourceFactory() {
return EFactoryResourceFactory.class;
}
public Class<? extends IDiagnosticConverter> bindIDiagnosticConverter() {
return ESONDiagnosticConverter.class;
}
// NO @Override
public Class<? extends IDerivedStateComputer> bindIDerivedStateComputer() {
return EFactoryDerivedStateComputer.class;
}
// http://www.eclipse.org/forums/index.php/m/759778/
public void configureErrorHandler(Binder binder) {
Logger logger = Logger.getLogger(PolymorphicDispatcher.class);
PolymorphicDispatcher.ErrorHandler<IScope> handler = new WarningErrorHandlerWithoutNoSuchMethodException<IScope>(
logger);
binder.bind(
new TypeLiteral<PolymorphicDispatcher.ErrorHandler<IScope>>() {
})
.annotatedWith(
Names.named(AbstractDeclarativeScopeProvider.NAMED_ERROR_HANDLER))
.toInstance(handler);
}
@Override
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
return EFactoryLocationInFileProvider.class;
}
public Class<? extends org.eclipse.xtext.resource.IResourceDescription.Manager> bindIResourceDescription$Manager() {
return org.eclipse.xtext.resource.DerivedStateAwareResourceDescriptionManager.class;
}
@SuppressWarnings("restriction")
public Class<? extends IResourceValidator> bindIResourceValidator() {
return org.eclipse.xtext.xbase.annotations.validation.DerivedStateAwareResourceValidator.class;
}
public Class<? extends IGenerator> bindIGenerator() {
return DelegatingGenerator.class;
}
public Class<? extends IResourceServiceProvider> bindIResourceServiceProvider() {
return EFactoryResourceServiceProvider.class;
}
@Override
public Class<? extends IQualifiedNameProvider> bindIQualifiedNameProvider() {
return EFactoryQualifiedNameProvider.class;
}
public Class<? extends ILinkingDiagnosticMessageProvider> bindILinkingDiagnosticMessageProvider() {
return ESONLinkingDiagnosticMessageProvider.class;
}
@Override
public void configureIScopeProviderDelegate(com.google.inject.Binder binder) {
binder.bind(IScopeProvider.class)
.annotatedWith(
Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE))
.to(ExtendedImportedNamespaceAwareLocalScopeProvider.class);
}
@Override
public Class<? extends ILinkingService> bindILinkingService() {
return ESONLinkingService.class;
}
@Override
public void configureRuntimeEncodingProvider(Binder binder) {
binder.bind(IEncodingProvider.class)
.annotatedWith(DispatchingProvider.Runtime.class)
.to(EFactoryEncodingProvider.class);
}
@Override
// TODO Remove once ESON is migrated to support only Xtext 2.9.0 and no
// 2.8.x anymore
public Class<? extends org.eclipse.xtext.resource.containers.IAllContainersState.Provider> bindIAllContainersState$Provider() {
return FasterResourceSetBasedAllContainersStateProvider.class;
}
@Override
public void configureFileExtensions(Binder binder) {
if (properties == null
|| properties.getProperty(Constants.FILE_EXTENSIONS) == null) {
binder.bind(String.class)
.annotatedWith(Names.named(Constants.FILE_EXTENSIONS))
.toInstance(
IterableExtensions
.join(EFactoryFileExtensionRegistry
.getRegistry()
.getAssociateFileExtensionsWithDefaults(),
","));
}
}
}
| UTF-8 | Java | 6,878 | java | EFactoryRuntimeModule.java | Java | [
{
"context": "ipse.emf.eson\r\n * %%\r\n * Copyright (C) 2009 - 2014 Sebastian Benz & Michael Vorburger\r\n * %%\r\n * All rights reserve",
"end": 87,
"score": 0.9998596906661987,
"start": 73,
"tag": "NAME",
"value": "Sebastian Benz"
},
{
"context": " %%\r\n * Copyright (C) 2009 - 2014 Sebastian Benz & Michael Vorburger\r\n * %%\r\n * All rights reserved. This program and ",
"end": 107,
"score": 0.9998669624328613,
"start": 90,
"tag": "NAME",
"value": "Michael Vorburger"
}
] | null | [] | /*
* #%L
* org.eclipse.emf.eson
* %%
* Copyright (C) 2009 - 2014 <NAME> & <NAME>
* %%
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* #L%
*/
package org.eclipse.emf.eson;
import org.apache.log4j.Logger;
import org.eclipse.emf.eson.conversion.DATEValueConverter;
import org.eclipse.emf.eson.conversion.TerminalConverters;
import org.eclipse.emf.eson.generators.DelegatingGenerator;
import org.eclipse.emf.eson.generators.EFactoryFileExtensionRegistry;
import org.eclipse.emf.eson.resource.EFactoryDerivedStateComputer;
import org.eclipse.emf.eson.resource.EFactoryEncodingProvider;
import org.eclipse.emf.eson.resource.EFactoryLocationInFileProvider;
import org.eclipse.emf.eson.resource.EFactoryResourceFactory;
import org.eclipse.emf.eson.resource.EFactoryResourceServiceProvider;
import org.eclipse.emf.eson.scoping.EFactoryQualifiedNameProvider;
import org.eclipse.emf.eson.scoping.ESONLinkingService;
import org.eclipse.emf.eson.scoping.ExtendedImportedNamespaceAwareLocalScopeProvider;
import org.eclipse.emf.eson.scoping.WarningErrorHandlerWithoutNoSuchMethodException;
import org.eclipse.emf.eson.validation.ESONDiagnosticConverter;
import org.eclipse.emf.eson.validation.ESONLinkingDiagnosticMessageProvider;
import org.eclipse.emf.eson.xtextbackpatch.FasterResourceSetBasedAllContainersStateProvider;
import org.eclipse.xtext.Constants;
import org.eclipse.xtext.generator.IGenerator;
import org.eclipse.xtext.linking.ILinkingDiagnosticMessageProvider;
import org.eclipse.xtext.linking.ILinkingService;
import org.eclipse.xtext.naming.IQualifiedNameProvider;
import org.eclipse.xtext.parser.IEncodingProvider;
import org.eclipse.xtext.parser.antlr.IReferableElementsUnloader;
import org.eclipse.xtext.parser.antlr.IReferableElementsUnloader.GenericUnloader;
import org.eclipse.xtext.resource.IDerivedStateComputer;
import org.eclipse.xtext.resource.ILocationInFileProvider;
import org.eclipse.xtext.resource.IResourceFactory;
import org.eclipse.xtext.resource.IResourceServiceProvider;
import org.eclipse.xtext.scoping.IScope;
import org.eclipse.xtext.scoping.IScopeProvider;
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
import org.eclipse.xtext.service.DispatchingProvider;
import org.eclipse.xtext.util.PolymorphicDispatcher;
import org.eclipse.xtext.validation.IDiagnosticConverter;
import org.eclipse.xtext.validation.IResourceValidator;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import com.google.inject.Binder;
import com.google.inject.TypeLiteral;
import com.google.inject.name.Names;
/**
* Use this class to register components to be used within the IDE.
*/
public class EFactoryRuntimeModule extends AbstractEFactoryRuntimeModule {
@Override
public void configure(Binder binder) {
super.configure(binder);
binder.bind(String.class)
.annotatedWith(Names.named(DATEValueConverter.DATE_FORMAT_KEY))
.toInstance("MM.dd.yyyy");
binder.bind(IReferableElementsUnloader.class).to(GenericUnloader.class);
}
@Override
public Class<? extends org.eclipse.xtext.conversion.IValueConverterService> bindIValueConverterService() {
return TerminalConverters.class;
}
@Override
public Class<? extends IResourceFactory> bindIResourceFactory() {
return EFactoryResourceFactory.class;
}
public Class<? extends IDiagnosticConverter> bindIDiagnosticConverter() {
return ESONDiagnosticConverter.class;
}
// NO @Override
public Class<? extends IDerivedStateComputer> bindIDerivedStateComputer() {
return EFactoryDerivedStateComputer.class;
}
// http://www.eclipse.org/forums/index.php/m/759778/
public void configureErrorHandler(Binder binder) {
Logger logger = Logger.getLogger(PolymorphicDispatcher.class);
PolymorphicDispatcher.ErrorHandler<IScope> handler = new WarningErrorHandlerWithoutNoSuchMethodException<IScope>(
logger);
binder.bind(
new TypeLiteral<PolymorphicDispatcher.ErrorHandler<IScope>>() {
})
.annotatedWith(
Names.named(AbstractDeclarativeScopeProvider.NAMED_ERROR_HANDLER))
.toInstance(handler);
}
@Override
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
return EFactoryLocationInFileProvider.class;
}
public Class<? extends org.eclipse.xtext.resource.IResourceDescription.Manager> bindIResourceDescription$Manager() {
return org.eclipse.xtext.resource.DerivedStateAwareResourceDescriptionManager.class;
}
@SuppressWarnings("restriction")
public Class<? extends IResourceValidator> bindIResourceValidator() {
return org.eclipse.xtext.xbase.annotations.validation.DerivedStateAwareResourceValidator.class;
}
public Class<? extends IGenerator> bindIGenerator() {
return DelegatingGenerator.class;
}
public Class<? extends IResourceServiceProvider> bindIResourceServiceProvider() {
return EFactoryResourceServiceProvider.class;
}
@Override
public Class<? extends IQualifiedNameProvider> bindIQualifiedNameProvider() {
return EFactoryQualifiedNameProvider.class;
}
public Class<? extends ILinkingDiagnosticMessageProvider> bindILinkingDiagnosticMessageProvider() {
return ESONLinkingDiagnosticMessageProvider.class;
}
@Override
public void configureIScopeProviderDelegate(com.google.inject.Binder binder) {
binder.bind(IScopeProvider.class)
.annotatedWith(
Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE))
.to(ExtendedImportedNamespaceAwareLocalScopeProvider.class);
}
@Override
public Class<? extends ILinkingService> bindILinkingService() {
return ESONLinkingService.class;
}
@Override
public void configureRuntimeEncodingProvider(Binder binder) {
binder.bind(IEncodingProvider.class)
.annotatedWith(DispatchingProvider.Runtime.class)
.to(EFactoryEncodingProvider.class);
}
@Override
// TODO Remove once ESON is migrated to support only Xtext 2.9.0 and no
// 2.8.x anymore
public Class<? extends org.eclipse.xtext.resource.containers.IAllContainersState.Provider> bindIAllContainersState$Provider() {
return FasterResourceSetBasedAllContainersStateProvider.class;
}
@Override
public void configureFileExtensions(Binder binder) {
if (properties == null
|| properties.getProperty(Constants.FILE_EXTENSIONS) == null) {
binder.bind(String.class)
.annotatedWith(Names.named(Constants.FILE_EXTENSIONS))
.toInstance(
IterableExtensions
.join(EFactoryFileExtensionRegistry
.getRegistry()
.getAssociateFileExtensionsWithDefaults(),
","));
}
}
}
| 6,859 | 0.78991 | 0.78642 | 176 | 37.079544 | 30.999714 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.630682 | false | false | 9 |
a3072fde5de881fbabf80d67cdd6f1b7b62c9fbf | 5,360,119,249,577 | 2f3bc56781a38bb3f3ad06897d27febde51fa968 | /server/src/main/java/com/example/server/Activities/repository/SchoolYearRepository.java | ec20dec6411f8137ff35ecc992a7141227c9a634 | [] | no_license | sut62/team08 | https://github.com/sut62/team08 | e4e44c14a668128b2cb8ab338adbc2651b8b5c06 | 040dc9813fb88749c3715ff25264fd1d2805cca3 | refs/heads/master | 2023-01-09T01:04:38.599000 | 2020-03-05T03:57:19 | 2020-03-05T03:57:19 | 223,877,313 | 3 | 0 | null | false | 2023-01-04T13:56:24 | 2019-11-25T06:30:28 | 2020-03-05T03:57:41 | 2023-01-04T13:56:24 | 3,503 | 3 | 0 | 59 | Java | false | false | package com.example.server.Activities.repository;
import com.example.server.Activities.entity.SchoolYear;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.web.bind.annotation.CrossOrigin;
@RepositoryRestResource
@CrossOrigin(origins = "http://localhost:8081")
public interface SchoolYearRepository extends JpaRepository <SchoolYear, Long> {
SchoolYear findById(long yearid);
}
| UTF-8 | Java | 512 | java | SchoolYearRepository.java | Java | [] | null | [] | package com.example.server.Activities.repository;
import com.example.server.Activities.entity.SchoolYear;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.web.bind.annotation.CrossOrigin;
@RepositoryRestResource
@CrossOrigin(origins = "http://localhost:8081")
public interface SchoolYearRepository extends JpaRepository <SchoolYear, Long> {
SchoolYear findById(long yearid);
}
| 512 | 0.818359 | 0.810547 | 12 | 40.666668 | 27.487371 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.583333 | false | false | 9 |
2caedfe6ee504ac978fb64d1a9ac7300789902d3 | 7,945,689,555,042 | 93da970fe747061bec11ec425507c2816386da81 | /FishLib/src/main/java/com/fish/lib/fishlib/util/system/net/WifiStateUtil.java | 36d8812a3fde6c554daf99db16041392051bde71 | [] | no_license | chefish/FishProject | https://github.com/chefish/FishProject | a958633e18ce132511bddc1949720bb1ba394faa | d011b37234b4df85e2ecd9e4e872e01ecb4ce129 | refs/heads/master | 2020-04-23T22:19:36.556000 | 2019-02-19T15:26:11 | 2019-02-19T15:26:11 | 171,497,920 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.fish.lib.fishlib.util.system.net;
/**
* @author xmyu
* @createTime 2015-3-9 下午4:43:04
*/
public class WifiStateUtil {
/**
* 将广播得到的int值转化为字符串
*
* @param ws
* @return
*/
public static String wifistate2Str(int ws) {
switch (ws) {
case 0:
return "WIFI_STATE_DISABLING";
case 1:
return "WIFI_STATE_DISABLED";
case 2:
return "WIFI_STATE_ENABLING";
case 3:
return "WIFI_STATE_ENABLED";
case 4:
return "WIFI_STATE_UNKNOWN";
default:
return " wifistate error";
}
}
}
| UTF-8 | Java | 726 | java | WifiStateUtil.java | Java | [
{
"context": "m.fish.lib.fishlib.util.system.net;\n/**\n * @author xmyu\n * @createTime 2015-3-9 下午4:43:04\n */\npublic clas",
"end": 65,
"score": 0.9995458722114563,
"start": 61,
"tag": "USERNAME",
"value": "xmyu"
}
] | null | [] | package com.fish.lib.fishlib.util.system.net;
/**
* @author xmyu
* @createTime 2015-3-9 下午4:43:04
*/
public class WifiStateUtil {
/**
* 将广播得到的int值转化为字符串
*
* @param ws
* @return
*/
public static String wifistate2Str(int ws) {
switch (ws) {
case 0:
return "WIFI_STATE_DISABLING";
case 1:
return "WIFI_STATE_DISABLED";
case 2:
return "WIFI_STATE_ENABLING";
case 3:
return "WIFI_STATE_ENABLED";
case 4:
return "WIFI_STATE_UNKNOWN";
default:
return " wifistate error";
}
}
}
| 726 | 0.478448 | 0.454023 | 29 | 22.965517 | 15.349902 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.241379 | false | false | 9 |
c0fd8fefb854efbc5cb0c8219b8c1c8f01e5578b | 24,249,385,418,327 | d2934c9e1dd795a92ae24f373f1d1ecf9a2d60bd | /src/main/java/aa/df.java | 0ff4c850fa75b2f361623da274ac4f3ef98455f5 | [] | no_license | wokaowokao/javaSpring | https://github.com/wokaowokao/javaSpring | 72e7f6852f7c094c0bbc4fc17fc4a36f4886870a | 542fc8376b6de65ef26f41a21ac6e0456dfd0f91 | refs/heads/master | 2022-12-26T19:14:17.888000 | 2020-04-27T02:32:16 | 2020-07-21T01:59:59 | 92,391,043 | 0 | 0 | null | false | 2022-12-16T05:29:28 | 2017-05-25T10:09:57 | 2020-07-21T02:00:23 | 2022-12-16T05:29:26 | 53 | 0 | 0 | 4 | Java | false | false | package aa;
import java.util.ArrayList;
import java.util.List;
/**
* @author zhangyawei Created on 2020/6/2.
*/
public class df {
public static void main(String[] args) {
List<? extends Father> list = new ArrayList<>();
List<? super Father> list1 = new ArrayList<>();
list1.add(new Father());
}
static void add(Father a){
}
}
| UTF-8 | Java | 372 | java | df.java | Java | [
{
"context": ".ArrayList;\nimport java.util.List;\n\n/**\n * @author zhangyawei Created on 2020/6/2.\n */\npublic class df {\n pu",
"end": 90,
"score": 0.9349910020828247,
"start": 80,
"tag": "USERNAME",
"value": "zhangyawei"
}
] | null | [] | package aa;
import java.util.ArrayList;
import java.util.List;
/**
* @author zhangyawei Created on 2020/6/2.
*/
public class df {
public static void main(String[] args) {
List<? extends Father> list = new ArrayList<>();
List<? super Father> list1 = new ArrayList<>();
list1.add(new Father());
}
static void add(Father a){
}
}
| 372 | 0.607527 | 0.586021 | 19 | 18.578947 | 19.082413 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.315789 | false | false | 9 |
09048a78d91307bf95ac2d4375c0a44af45190b3 | 30,906,584,718,906 | 16a2a266403b463c1702fa57c5661c6f3e61f9f5 | /Time/Time.java | 6c2458a764dcdb70801f84563714800ebbed97c0 | [] | no_license | haticeozdilek/object-oriented-programming | https://github.com/haticeozdilek/object-oriented-programming | dfbffed0e0e3f5059414ee21cdbd57a044db21cc | 2603e14e5cf1bbd1c1d5bb572720332f628dda02 | refs/heads/master | 2020-09-07T15:18:57.019000 | 2019-12-24T18:18:47 | 2019-12-24T18:18:47 | 220,825,286 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.lang.Exception;
public class Time {
private int hour,min,sec;
public void setTime(int h,int m,int s)throws Exception {
if((h>=0 && h<24) && (m>=0 && m<60) && (s>=0 && s<60)) {
hour=h;
min=m;
sec=s;
}
else
throw new IllegalAccessException("\n Hatali giris.");
}
public Time() {
}
public Time(int h, int m, int s)throws Exception{
setTime(h,m,s);
}
public String toUniversalString() {
return String.format("%d , %d , %d " , hour , min , sec);
}
public String toString() {
return String.format("\n%d , %d , %d , %s " , ( (hour==0 || hour==12) ? 12 : hour % 12 ) , min , sec , (hour<12 ? "a.m." : "p.m.") );
}
}
| UTF-8 | Java | 736 | java | Time.java | Java | [] | null | [] | import java.lang.Exception;
public class Time {
private int hour,min,sec;
public void setTime(int h,int m,int s)throws Exception {
if((h>=0 && h<24) && (m>=0 && m<60) && (s>=0 && s<60)) {
hour=h;
min=m;
sec=s;
}
else
throw new IllegalAccessException("\n Hatali giris.");
}
public Time() {
}
public Time(int h, int m, int s)throws Exception{
setTime(h,m,s);
}
public String toUniversalString() {
return String.format("%d , %d , %d " , hour , min , sec);
}
public String toString() {
return String.format("\n%d , %d , %d , %s " , ( (hour==0 || hour==12) ? 12 : hour % 12 ) , min , sec , (hour<12 ? "a.m." : "p.m.") );
}
}
| 736 | 0.506793 | 0.482337 | 36 | 18.277779 | 27.726452 | 136 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.194444 | false | false | 9 |
f772fa9d58c0e5f6ac027fd59785e590829124bd | 30,906,584,723,259 | 794473ff2ba2749db9c0782f5d281b00dd785a95 | /braches_20171122/qiubaotong-server/qbt-data-migration/src/main/java/com/qbt/data/migration/pgsql/entity/UserWeixin.java | 0ccd9fe4c3b0de0920b7eb362ef590a81d33db8a | [] | no_license | hexilei/qbt | https://github.com/hexilei/qbt | a0fbc9c1870da1bf1ec24bba0f508841ca1b9750 | 040e5fcc9fbb27d52712cc1678d71693b5c85cce | refs/heads/master | 2021-05-05T23:03:20.377000 | 2018-01-12T03:33:12 | 2018-01-12T03:33:12 | 116,363,833 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.qbt.data.migration.pgsql.entity;
public class UserWeixin {
private Integer id;
private Short sex;
private String openid;
private String nickname;
private String head_img_url;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Short getSex() {
return sex;
}
public void setSex(Short sex) {
this.sex = sex;
}
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid == null ? null : openid.trim();
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname == null ? null : nickname.trim();
}
public String getHead_img_url() {
return head_img_url;
}
public void setHead_img_url(String head_img_url) {
this.head_img_url = head_img_url == null ? null : head_img_url.trim();
}
} | UTF-8 | Java | 1,030 | java | UserWeixin.java | Java | [] | null | [] | package com.qbt.data.migration.pgsql.entity;
public class UserWeixin {
private Integer id;
private Short sex;
private String openid;
private String nickname;
private String head_img_url;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Short getSex() {
return sex;
}
public void setSex(Short sex) {
this.sex = sex;
}
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid == null ? null : openid.trim();
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname == null ? null : nickname.trim();
}
public String getHead_img_url() {
return head_img_url;
}
public void setHead_img_url(String head_img_url) {
this.head_img_url = head_img_url == null ? null : head_img_url.trim();
}
} | 1,030 | 0.58835 | 0.58835 | 53 | 18.452829 | 19.415581 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.301887 | false | false | 9 |
30487a92577b7d33a8a13ae2694f2b004a481611 | 11,742,440,588,239 | b2b2ed69e3ae1579c5747951003a96a9d5743d48 | /appDemo/src/main/java/com/umbrella/demo/mock/subjects/service/BradleyServiceImpl.java | a6839261e390cac30e61faab9015c0af662a8e4f | [] | no_license | land012/IdeaTestJdk7 | https://github.com/land012/IdeaTestJdk7 | 3db2497df64e5581e8d25be4fcefdb19d1fb8b89 | fc56d712424cce8767e87a81dba1ebc44dfc058d | refs/heads/master | 2022-02-22T22:21:38.808000 | 2020-06-24T15:46:12 | 2020-06-24T15:46:12 | 60,146,281 | 0 | 2 | null | false | 2022-03-31T20:55:27 | 2016-06-01T04:51:11 | 2020-06-24T15:50:03 | 2022-03-31T20:55:27 | 1,208 | 0 | 4 | 17 | Java | false | false | package com.umbrella.demo.mock.subjects.service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
/**
* Created by xudazhou on 2017/1/4.
*/
@Service("bradleyService")
public class BradleyServiceImpl implements BradleyService {
private static Logger log = LoggerFactory.getLogger(BradleyServiceImpl.class);
@Override
public void hello() {
log.info("I am Leah Dizon");
log.info(SusanooService.hello("jim"));
}
}
| UTF-8 | Java | 503 | java | BradleyServiceImpl.java | Java | [
{
"context": "ngframework.stereotype.Service;\n\n/**\n * Created by xudazhou on 2017/1/4.\n */\n@Service(\"bradleyService\")\npubli",
"end": 181,
"score": 0.9997115731239319,
"start": 173,
"tag": "USERNAME",
"value": "xudazhou"
},
{
"context": "e\n public void hello() {\n log.info(\"I am Leah Dizon\");\n log.info(SusanooService.hello(\"jim\"));",
"end": 444,
"score": 0.9998199343681335,
"start": 434,
"tag": "NAME",
"value": "Leah Dizon"
}
] | null | [] | package com.umbrella.demo.mock.subjects.service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
/**
* Created by xudazhou on 2017/1/4.
*/
@Service("bradleyService")
public class BradleyServiceImpl implements BradleyService {
private static Logger log = LoggerFactory.getLogger(BradleyServiceImpl.class);
@Override
public void hello() {
log.info("I am <NAME>");
log.info(SusanooService.hello("jim"));
}
}
| 499 | 0.727634 | 0.71173 | 20 | 24.15 | 23.07439 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.35 | false | false | 9 |
5c6f0d8cf0970c3261b02e4d16e0eede7ec83427 | 28,518,582,912,982 | a7267b7d05ca70b18ad279a53e660434edb0145b | /src/test/java/com/kodekonveyor/work_request/offer/OfferEntityRepositoryStubs.java | 5e6674b32c0bbedf67f12108a2f5dfbd0f0c30fa | [] | no_license | kode-konveyor/tidy-up | https://github.com/kode-konveyor/tidy-up | 6215e56a44ffc4329965618d9d9e91d8e2572eb5 | ffb95403decf6c1f76a203d9f11e1a7a9439de4a | refs/heads/develop | 2022-09-28T19:07:10.287000 | 2020-06-26T11:18:50 | 2020-06-26T11:18:50 | 204,216,340 | 0 | 60 | null | false | 2022-09-08T01:03:31 | 2019-08-24T21:48:15 | 2020-06-26T11:18:55 | 2022-09-08T01:03:29 | 529 | 0 | 46 | 2 | Java | false | false | package com.kodekonveyor.work_request.offer;
import java.util.Optional;
import org.mockito.Mockito;
public class OfferEntityRepositoryStubs {
public static void
behaviour(final OfferEntityRepository offerEntityRepository) {
Mockito.doReturn(Optional.of(OfferEntityTestData.getWorkRequestPosted()))
.when(offerEntityRepository).findById(OfferDTOTestData.get().getId());
}
}
| UTF-8 | Java | 400 | java | OfferEntityRepositoryStubs.java | Java | [] | null | [] | package com.kodekonveyor.work_request.offer;
import java.util.Optional;
import org.mockito.Mockito;
public class OfferEntityRepositoryStubs {
public static void
behaviour(final OfferEntityRepository offerEntityRepository) {
Mockito.doReturn(Optional.of(OfferEntityTestData.getWorkRequestPosted()))
.when(offerEntityRepository).findById(OfferDTOTestData.get().getId());
}
}
| 400 | 0.7825 | 0.7825 | 15 | 25.666666 | 28.50419 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.266667 | false | false | 9 |
f9eb10d735e00e93b94e87cc76c0f2bd5a0efd67 | 15,247,133,912,819 | 4aa303b0595d2d2903a9bb67291a4037a708d974 | /src/main/java/com/gregpalacios/gesticole/service/impl/NivelServiceImpl.java | 42268fc6427c133005f07c693a059e610cd64efb | [] | no_license | gpalacios26/gesticole-backend | https://github.com/gpalacios26/gesticole-backend | 0b571ceacb937cc8277595eb572ade0b8756baf5 | cc12a34523c630e21134a6f5a275a5043314fb43 | refs/heads/main | 2023-08-01T05:35:01.340000 | 2021-09-22T15:46:13 | 2021-09-22T15:46:13 | 387,537,190 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gregpalacios.gesticole.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gregpalacios.gesticole.model.Nivel;
import com.gregpalacios.gesticole.repo.IGenericRepo;
import com.gregpalacios.gesticole.repo.INivelRepo;
import com.gregpalacios.gesticole.service.INivelService;
@Service
public class NivelServiceImpl extends CRUDImpl<Nivel, Integer> implements INivelService {
@Autowired
private INivelRepo repo;
@Override
protected IGenericRepo<Nivel, Integer> getRepo() {
return repo;
}
}
| UTF-8 | Java | 594 | java | NivelServiceImpl.java | Java | [] | null | [] | package com.gregpalacios.gesticole.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gregpalacios.gesticole.model.Nivel;
import com.gregpalacios.gesticole.repo.IGenericRepo;
import com.gregpalacios.gesticole.repo.INivelRepo;
import com.gregpalacios.gesticole.service.INivelService;
@Service
public class NivelServiceImpl extends CRUDImpl<Nivel, Integer> implements INivelService {
@Autowired
private INivelRepo repo;
@Override
protected IGenericRepo<Nivel, Integer> getRepo() {
return repo;
}
}
| 594 | 0.824916 | 0.824916 | 22 | 26 | 26.527859 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.863636 | false | false | 9 |
949be6d16cd17a74d3a0e66386f942427318e901 | 10,075,993,279,145 | 0450213968ee34d830f69b8167ec5095bd7b4c97 | /acquirer-service/src/main/java/org/sep/acquirerservice/model/Transaction.java | a1b49bbf05ea4ab13a915e8ea9d3ed838ff6d028 | [] | no_license | tayduivn/PaymentHub | https://github.com/tayduivn/PaymentHub | 1c7ffaeb510d903304d93c28dada82d84532d576 | fd1b3481e87ee2e3767f007c90bdbae466b3c880 | refs/heads/master | 2022-03-31T16:26:29.020000 | 2020-01-31T19:28:40 | 2020-01-31T19:28:40 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.sep.acquirerservice.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDate;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Transaction {
private String id;
private String item;
private Double amount;
private String description;
private LocalDate timestamp;
}
| UTF-8 | Java | 403 | java | Transaction.java | Java | [] | null | [] | package org.sep.acquirerservice.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDate;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Transaction {
private String id;
private String item;
private Double amount;
private String description;
private LocalDate timestamp;
}
| 403 | 0.789082 | 0.789082 | 20 | 19.15 | 12.183083 | 38 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.55 | false | false | 9 |
4e4b643cc84e57b7387f920eae2efadf0a0cbde4 | 3,667,902,072,207 | a50c77a98f7f52e31ed6478858ff8a0e1e1d7c02 | /Selenium/src/com/practiceActiTime/testcase/FlipkartCaptureNoOfProducts.java | 514c0751efedf6a31a63855bac30a62131b68c8a | [] | no_license | SeleniumPracticeProject1/SeleniumPractice | https://github.com/SeleniumPracticeProject1/SeleniumPractice | 9583e182fb12855b606f829b2455a4084f87d88f | f7627be027fd453b42ea1293736d280f8b4c196e | refs/heads/master | 2020-03-19T12:04:05.081000 | 2018-06-07T15:07:22 | 2018-06-07T15:07:22 | 136,493,275 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.practiceActiTime.testcase;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
/**
*
* @author Namitha
*
*/
public class FlipkartCaptureNoOfProducts {
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.get("https://www.flipkart.com");
driver.findElement(By.xpath("//button[text()='✕']")).click();
driver.findElement(By.name("q")).sendKeys("apple mobile", Keys.ENTER);
String res = driver.findElement(By.xpath("//span[contains(text(),'Showing ')]")).getText();
driver.close();
String[] arr = res.split(" ");
String noOfProductsString = arr[5];
System.out.println(noOfProductsString);
int noOfProductsInt = Integer.parseInt(noOfProductsString);
System.out.println(noOfProductsInt-5);
}
}
| UTF-8 | Java | 1,090 | java | FlipkartCaptureNoOfProducts.java | Java | [
{
"context": "ium.firefox.FirefoxDriver;\r\n\r\n/**\r\n * \r\n * @author Namitha\r\n *\r\n */\r\npublic class FlipkartCaptureNoOfProduct",
"end": 269,
"score": 0.999765157699585,
"start": 262,
"tag": "NAME",
"value": "Namitha"
}
] | null | [] | package com.practiceActiTime.testcase;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
/**
*
* @author Namitha
*
*/
public class FlipkartCaptureNoOfProducts {
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.get("https://www.flipkart.com");
driver.findElement(By.xpath("//button[text()='✕']")).click();
driver.findElement(By.name("q")).sendKeys("apple mobile", Keys.ENTER);
String res = driver.findElement(By.xpath("//span[contains(text(),'Showing ')]")).getText();
driver.close();
String[] arr = res.split(" ");
String noOfProductsString = arr[5];
System.out.println(noOfProductsString);
int noOfProductsInt = Integer.parseInt(noOfProductsString);
System.out.println(noOfProductsInt-5);
}
}
| 1,090 | 0.67739 | 0.673713 | 44 | 22.727272 | 24.435781 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.590909 | false | false | 9 |
c655447cf69b8fd156938d552461b69943c46eff | 2,345,052,162,450 | e2712ccf9998dd7d457cd47ae2e77c4ed5192fb0 | /src/main/java/com/simpragma/management/controller/TradeController.java | f08f749705562c3f81855e2234cbb3987974c1a2 | [] | no_license | swagatikadd1995/TradesManagement | https://github.com/swagatikadd1995/TradesManagement | 9ba5403f0fffd502bd2b19a9086c20d435afd429 | ec2e5421c48cb0775bd46994b6a1d830379b3ba0 | refs/heads/master | 2022-11-11T18:10:02.828000 | 2020-07-04T17:24:53 | 2020-07-04T17:24:53 | 277,052,671 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.simpragma.management.controller;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.simpragma.management.dto.TradeDto;
import com.simpragma.management.exception.InputValidationException;
import com.simpragma.management.service.TradeService;
import com.simpragma.management.util.ValidationUtils;
@RestController
@RequestMapping("/trade")
public class TradeController {
private static final Logger log = LoggerFactory.getLogger(TradeService.class);
@Autowired
TradeService tradeservice;
@GetMapping
public ResponseEntity<List<TradeDto>> getAllTrade() {
log.info("Entering into TradeController.getAllTrade() ");
return new ResponseEntity<List<TradeDto>>(tradeservice.getAllTrade(), HttpStatus.OK);
}
@GetMapping("/users/{userID}")
public ResponseEntity<List<TradeDto>> getTradeByUserId(@PathVariable("userID") int userID) {
log.info("Entering into TradeController.getTradeById() ");
if(userID < 1) throw new InputValidationException("User ID can't be -ve number");
return new ResponseEntity<List<TradeDto>>(tradeservice.getTradeByUserId(userID), HttpStatus.OK);
}
@PostMapping
public ResponseEntity<TradeDto> createTrade(@RequestBody TradeDto tradeDto) {
log.info("Entering into TradeController.createTrade() ");
ValidationUtils.validate(tradeDto);
return new ResponseEntity<TradeDto>(tradeservice.createTrade(tradeDto), HttpStatus.OK);
}
@DeleteMapping
public ResponseEntity<String> deleteTrade() {
log.info("Entering into TradeController.deleteTrade() ");
return new ResponseEntity<String>(tradeservice.deleteTrade(), HttpStatus.OK);
}
}
| UTF-8 | Java | 2,238 | java | TradeController.java | Java | [] | null | [] | package com.simpragma.management.controller;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.simpragma.management.dto.TradeDto;
import com.simpragma.management.exception.InputValidationException;
import com.simpragma.management.service.TradeService;
import com.simpragma.management.util.ValidationUtils;
@RestController
@RequestMapping("/trade")
public class TradeController {
private static final Logger log = LoggerFactory.getLogger(TradeService.class);
@Autowired
TradeService tradeservice;
@GetMapping
public ResponseEntity<List<TradeDto>> getAllTrade() {
log.info("Entering into TradeController.getAllTrade() ");
return new ResponseEntity<List<TradeDto>>(tradeservice.getAllTrade(), HttpStatus.OK);
}
@GetMapping("/users/{userID}")
public ResponseEntity<List<TradeDto>> getTradeByUserId(@PathVariable("userID") int userID) {
log.info("Entering into TradeController.getTradeById() ");
if(userID < 1) throw new InputValidationException("User ID can't be -ve number");
return new ResponseEntity<List<TradeDto>>(tradeservice.getTradeByUserId(userID), HttpStatus.OK);
}
@PostMapping
public ResponseEntity<TradeDto> createTrade(@RequestBody TradeDto tradeDto) {
log.info("Entering into TradeController.createTrade() ");
ValidationUtils.validate(tradeDto);
return new ResponseEntity<TradeDto>(tradeservice.createTrade(tradeDto), HttpStatus.OK);
}
@DeleteMapping
public ResponseEntity<String> deleteTrade() {
log.info("Entering into TradeController.deleteTrade() ");
return new ResponseEntity<String>(tradeservice.deleteTrade(), HttpStatus.OK);
}
}
| 2,238 | 0.804736 | 0.803396 | 65 | 33.430771 | 30.498407 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.261539 | false | false | 9 |
7ff919b86e41c7f4aec369a6cdad11b1326b74c0 | 20,401,094,724,759 | 639bbf89239c68c9368c0afe9e8b0a374d7eed21 | /app/src/main/java/space/weme/remix/Constants.java | 447fbea02fdf91aa5128bccddd276882c9e72ea8 | [] | no_license | signalall/WeMe | https://github.com/signalall/WeMe | ce2963c2dd67b8de10871849d9e99b5c29ebe150 | fb753da34a074d6ffa3c76665535b14fb072f94a | refs/heads/master | 2021-04-29T10:50:30.380000 | 2017-01-15T09:28:05 | 2017-01-15T09:28:05 | 77,834,116 | 2 | 1 | null | true | 2017-01-15T08:51:16 | 2017-01-02T13:08:10 | 2017-01-15T08:51:03 | 2017-01-15T08:51:16 | 4,150 | 2 | 0 | 0 | Java | null | null | package space.weme.remix;
/**
* Created by Joyce on 2017/1/3.
*/
public class Constants {
// Post
public static final String GET_POST_LIST = "getpostlist";
public static final String GET_POST_DETAIL = "getpostdetail";
public static final String LIKE_POST_URL = "likepost";
public static final String UNLIKE_POST_URL = "unlikepost";
public static final String PUBLISH_POST_URL = "publishpost";
public static final String COMMENT_TO_POST_URL = "commenttopost";
public static final String GET_POST_COMMENT = "getpostcomment";
public static final String COMMENT_TO_COMMENT_URL = "commenttocomment";
public static final String DELETE_POST_URL = "deletepost";
public static final String LIKE_COMMENT_URL = "likecomment";
public static final String UNLIKE_COMMENT_URL = "unlikecomment";
public static final String GET_TOPIC_INFO = "gettopicslogan";
public static final String GET_TOPIC_LIST = "gettopiclist";
public static final String TOP_BROAD_URL = "topofficial";
// Activity
public static final String SEARCH_ACTIVITY = "searchactivity";
public static final String GET_ACTIVITY_INFO_URL = "getactivityinformation";
public static final String GET_PUBLISH_ACTIVITY = "getpublishactivity";
public static final String GET_REGISTER_ACTIVITY = "getattentactivity";
public static final String GET_LIKE_ACTIVITY = "getlikeactivity";
public static final String GET_ACTIVITY_DETAIL_URL = "getactivitydetail";
public static final String LIKE_ACTIVITY = "likeactivity";
public static final String SIGN_ACTIVITY = "signup";
public static final String DEL_SIGN_ACTIVITY = "deletesignup";
public static final String PUBLISH_ACTIVITY = "publishactivity";
public static final String UNLIKE_ACTIVITY = "unlikeactivity";
public static final String GET_TOP_ACTIVITY_URL = "activitytopofficial";
// Food
public static final String GET_RECOMMEND_FOOD = "getfoodcard";
public static final String LIKE_FOOD_URL = "likefoodcard";
public static final String UNLIKE_FOOD_URL = "unlikefoodcard";
public static final String PUBLISH_CARD = "publishcard";
// User
public static final String SEND_SMS_CODE = "sendsmscode";
public static final String REGISTER_PHONE = "registerphone";
public static final String GET_PROFILE_BY_ID = "getprofilebyid";
public static final String GET_PROFILE = "getprofile";
public static final String EDIT_PROFILE_URL = "editprofileinfo";
public static final String LOGIN_URL = "login";
public static final String RESET_PASSWORD = "resetpassword";
public static final String FOLLOW_USER = "follow";
public static final String UNFOLLOW_USER = "unfollow";
public static final String GET_UNREAD_MESSAGE_URL = "unreadmessagenum";
// find
public static final String GET_RECOMMEND_USER = "getrecommenduser";
public static final String STATE_SUCCESSFUL = "successful";
}
| UTF-8 | Java | 2,963 | java | Constants.java | Java | [
{
"context": "package space.weme.remix;\n\n/**\n * Created by Joyce on 2017/1/3.\n */\n\npublic class Constants {\n\n /",
"end": 50,
"score": 0.9983622431755066,
"start": 45,
"tag": "USERNAME",
"value": "Joyce"
},
{
"context": "\n public static final String RESET_PASSWORD = \"resetpassword\";\n public static final String FOLLOW_USER = \"f",
"end": 2617,
"score": 0.9970452189445496,
"start": 2604,
"tag": "PASSWORD",
"value": "resetpassword"
}
] | null | [] | package space.weme.remix;
/**
* Created by Joyce on 2017/1/3.
*/
public class Constants {
// Post
public static final String GET_POST_LIST = "getpostlist";
public static final String GET_POST_DETAIL = "getpostdetail";
public static final String LIKE_POST_URL = "likepost";
public static final String UNLIKE_POST_URL = "unlikepost";
public static final String PUBLISH_POST_URL = "publishpost";
public static final String COMMENT_TO_POST_URL = "commenttopost";
public static final String GET_POST_COMMENT = "getpostcomment";
public static final String COMMENT_TO_COMMENT_URL = "commenttocomment";
public static final String DELETE_POST_URL = "deletepost";
public static final String LIKE_COMMENT_URL = "likecomment";
public static final String UNLIKE_COMMENT_URL = "unlikecomment";
public static final String GET_TOPIC_INFO = "gettopicslogan";
public static final String GET_TOPIC_LIST = "gettopiclist";
public static final String TOP_BROAD_URL = "topofficial";
// Activity
public static final String SEARCH_ACTIVITY = "searchactivity";
public static final String GET_ACTIVITY_INFO_URL = "getactivityinformation";
public static final String GET_PUBLISH_ACTIVITY = "getpublishactivity";
public static final String GET_REGISTER_ACTIVITY = "getattentactivity";
public static final String GET_LIKE_ACTIVITY = "getlikeactivity";
public static final String GET_ACTIVITY_DETAIL_URL = "getactivitydetail";
public static final String LIKE_ACTIVITY = "likeactivity";
public static final String SIGN_ACTIVITY = "signup";
public static final String DEL_SIGN_ACTIVITY = "deletesignup";
public static final String PUBLISH_ACTIVITY = "publishactivity";
public static final String UNLIKE_ACTIVITY = "unlikeactivity";
public static final String GET_TOP_ACTIVITY_URL = "activitytopofficial";
// Food
public static final String GET_RECOMMEND_FOOD = "getfoodcard";
public static final String LIKE_FOOD_URL = "likefoodcard";
public static final String UNLIKE_FOOD_URL = "unlikefoodcard";
public static final String PUBLISH_CARD = "publishcard";
// User
public static final String SEND_SMS_CODE = "sendsmscode";
public static final String REGISTER_PHONE = "registerphone";
public static final String GET_PROFILE_BY_ID = "getprofilebyid";
public static final String GET_PROFILE = "getprofile";
public static final String EDIT_PROFILE_URL = "editprofileinfo";
public static final String LOGIN_URL = "login";
public static final String RESET_PASSWORD = "<PASSWORD>";
public static final String FOLLOW_USER = "follow";
public static final String UNFOLLOW_USER = "unfollow";
public static final String GET_UNREAD_MESSAGE_URL = "unreadmessagenum";
// find
public static final String GET_RECOMMEND_USER = "getrecommenduser";
public static final String STATE_SUCCESSFUL = "successful";
}
| 2,960 | 0.732366 | 0.730341 | 67 | 43.223881 | 29.766665 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.641791 | false | false | 9 |
6c14f4b6a69d8c4023aad1716acb79a62be125b4 | 12,232,066,859,728 | ea093432b4c1ae70f452aa3675f30e1d0572e759 | /src/main/java/com/mt/country/service/CountryService.java | e8c5883fdef7f5359d9faa78b38a33200e6c6391 | [] | no_license | draco-malfoy/country-be | https://github.com/draco-malfoy/country-be | 468f16bf5af35350a3007e7ec83156c43e73c463 | 05a5397a1afe4d8a2fcd9f48606bcaa1377b29fd | refs/heads/master | 2023-04-23T01:14:25.666000 | 2021-05-04T10:08:55 | 2021-05-04T10:08:55 | 364,191,718 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mt.country.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mt.country.exception.CountryNotFoundException;
import com.mt.country.model.Country;
import com.mt.country.repository.CountryRepo;
@Service
public class CountryService {
private CountryRepo countryRepo;
@Autowired
public CountryService(CountryRepo cr) {
countryRepo = cr;
}
public Country addCountry(Country country) {
return countryRepo.save(country);
}
public List<Country> findAllCountries() {
return countryRepo.findAll();
}
public Country findCountryById(Integer id) {
return countryRepo.findById(id)
.orElseThrow(() -> new CountryNotFoundException("The entered country is not found"));
}
public void deleteCountry(Integer id) {
countryRepo.deleteById(id);
}
public Country updateCountry(Country country) {
return countryRepo.save(country);
}
}
| UTF-8 | Java | 966 | java | CountryService.java | Java | [] | null | [] | package com.mt.country.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mt.country.exception.CountryNotFoundException;
import com.mt.country.model.Country;
import com.mt.country.repository.CountryRepo;
@Service
public class CountryService {
private CountryRepo countryRepo;
@Autowired
public CountryService(CountryRepo cr) {
countryRepo = cr;
}
public Country addCountry(Country country) {
return countryRepo.save(country);
}
public List<Country> findAllCountries() {
return countryRepo.findAll();
}
public Country findCountryById(Integer id) {
return countryRepo.findById(id)
.orElseThrow(() -> new CountryNotFoundException("The entered country is not found"));
}
public void deleteCountry(Integer id) {
countryRepo.deleteById(id);
}
public Country updateCountry(Country country) {
return countryRepo.save(country);
}
}
| 966 | 0.776398 | 0.776398 | 42 | 22 | 22.215395 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.047619 | false | false | 9 |
03c5d4b42968199b7e81e17513c573965f1a7e23 | 15,934,328,675,770 | e3af7a4520fbec3612f8e60a7552820354f2c4c6 | /AndroidStudioProjects/SHAKIL/app/src/main/java/com/example/shakil/shakil/UPBUTTONACTIVITY.java | 71a9275ba35abbfd2667a8daf06e1a527bbe67fe | [] | no_license | shakil102030/Multiple-Quiz | https://github.com/shakil102030/Multiple-Quiz | 6c420a8dfa2b0c79ed0438b0dcf0c87a5ff582f5 | 82d570e52df1829c17ecb9e0275b1f8bd79587db | refs/heads/master | 2020-05-03T22:18:54.041000 | 2019-04-03T10:44:19 | 2019-04-03T10:44:19 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.shakil.shakil;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
public class UPBUTTONACTIVITY extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_upbuttonactivity);
getSupportActionBar().setDefaultDisplayHomeAsUpEnabled(true);
}
public void openA(View view){
Intent intent = new Intent(this,ActivityA.class);
startActivity(intent);
}
}
| UTF-8 | Java | 613 | java | UPBUTTONACTIVITY.java | Java | [] | null | [] | package com.example.shakil.shakil;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
public class UPBUTTONACTIVITY extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_upbuttonactivity);
getSupportActionBar().setDefaultDisplayHomeAsUpEnabled(true);
}
public void openA(View view){
Intent intent = new Intent(this,ActivityA.class);
startActivity(intent);
}
}
| 613 | 0.742251 | 0.74062 | 23 | 25.652174 | 23.22781 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.478261 | false | false | 9 |
a6a5d8a676bf1ebe50d17a886c25740c27cfe22c | 2,714,419,357,313 | 5d049f588d4b711bace235b50dfc709abfdb1cf1 | /Composite/Client.java | 15cedcfd678e59ab32dd7d2ee6f6f5f36cb7ca03 | [] | no_license | rameshkumartdp/Hibernate_Advanced | https://github.com/rameshkumartdp/Hibernate_Advanced | c3e7ef686653b3ecc29753f7daa59f03db4e7c1e | 7fbb558f1538d7ab9c05dee38d6d1e241b79dc8f | refs/heads/master | 2023-06-02T16:41:13.764000 | 2021-06-27T10:21:45 | 2021-06-27T10:21:45 | 366,709,361 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import org.hibernate.*;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.*;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.criterion.*;
import org.hibernate.Criteria;
import java.util.*;
public class Client {
public static void main(String hh[]){
try
{
Session sess=HibernateUtil.currentSession();
Transaction tr=sess.beginTransaction();
Account ac=new Account();
AccountPK accPK=new AccountPK();
accPK.setAccount_id(101);
accPK.setCustomer_id("451");
ac.setAccPK(accPK);
ac.setAccount_type("Savings");
ac.setAmount(45000.00);
sess.save(ac);
tr.commit();
sess.close();
}
catch(Exception e){
System.out.println(e);
}
}
} | UTF-8 | Java | 743 | java | Client.java | Java | [] | null | [] | import org.hibernate.*;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.*;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.criterion.*;
import org.hibernate.Criteria;
import java.util.*;
public class Client {
public static void main(String hh[]){
try
{
Session sess=HibernateUtil.currentSession();
Transaction tr=sess.beginTransaction();
Account ac=new Account();
AccountPK accPK=new AccountPK();
accPK.setAccount_id(101);
accPK.setCustomer_id("451");
ac.setAccPK(accPK);
ac.setAccount_type("Savings");
ac.setAmount(45000.00);
sess.save(ac);
tr.commit();
sess.close();
}
catch(Exception e){
System.out.println(e);
}
}
} | 743 | 0.734859 | 0.717362 | 50 | 13.88 | 14.695087 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.74 | false | false | 9 |
ade75717722c82528234a91a13e26cdd5122cef9 | 29,274,497,092,736 | 7a682dcc4e284bced37d02b31a3cd15af125f18f | /bitcamp-java-basic/src/main/java/ch13/a/Test01.java | 560326927f2726a9f6e4b67d55000e5e04859de8 | [] | no_license | eomjinyoung/bitcamp-java-20190527 | https://github.com/eomjinyoung/bitcamp-java-20190527 | a415314b74954f14989042c475a4bf36b7311a8c | 09f1b677587225310250078c4371ed94fe428a35 | refs/heads/master | 2022-03-15T04:33:15.248000 | 2019-11-11T03:33:58 | 2019-11-11T03:33:58 | 194,775,330 | 4 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null | // 기능 확장 - 방법1) 기존 코드를 가져와서 새 기능을 추가하기
package ch13.a;
public class Test01 {
public static void main(String[] args) {
Calculator2 c1 = new Calculator2();
c1.plus(5);
c1.multiple(2);
c1.minus(2);
c1.divide(4);
System.out.println(c1.getResult());
}
}
/*
# 기능 추가하기
1) 기존 클래스 파일에 추가하는 방법
- 기존 코드를 변경하게 되면 원래 되던 기능도 오류가 발생할 수 있는 위험이 있다.
- 그래서 원래 코드를 손대는 것은 매우 위험한 일이다.
- 기존에 잘 되던 기능까지 동작이 안되는 문제가 발생할 수 있기 때문이다.
2) 기존 코드를 복사하여 새 클래스를 만드는 방법
- 장점
- 기존 코드를 손대지 않기 때문에 문제가 발생할 가능성은 줄인다.
- 단점
- 기존 코드의 크기가 큰 경우에는 복사 붙여넣기가 어렵다.
- 기존 클래스의 소스가 없는 경우에는 이 방법이 불가능하다.
엥? 다른 개발자가 배포한 라이브러리만 있는 경우를 말한다.
소스가 없는 다른 개발자가 만든 클래스에 기능을 덧 붙일 때는 이 방법이 불가능하다.
- 기존 코드에 버그가 있을 때 복사 붙여넣기 해서 만든 클래스도 영향을 받는다.
- 기존 코드를 변경했을 때 복사 붙여넣기 한 모든 클래스를 찾아 변경해야 한다.
3) 기존 코드를 상속 받아 기능을 추가하는 방법
- 장점
- 기존 클래스의 소스 코드가 필요 없다.
- 간단한 선언으로 상속 받겠다고 표시한 후 새 기능만 추가하면 된다.
- 단점
- 일부 기능만 상속 받을 수 없다.
- 쓰든 안쓰든 모든 기능을 상속 받는다.
*/
| UTF-8 | Java | 1,850 | java | Test01.java | Java | [] | null | [] | // 기능 확장 - 방법1) 기존 코드를 가져와서 새 기능을 추가하기
package ch13.a;
public class Test01 {
public static void main(String[] args) {
Calculator2 c1 = new Calculator2();
c1.plus(5);
c1.multiple(2);
c1.minus(2);
c1.divide(4);
System.out.println(c1.getResult());
}
}
/*
# 기능 추가하기
1) 기존 클래스 파일에 추가하는 방법
- 기존 코드를 변경하게 되면 원래 되던 기능도 오류가 발생할 수 있는 위험이 있다.
- 그래서 원래 코드를 손대는 것은 매우 위험한 일이다.
- 기존에 잘 되던 기능까지 동작이 안되는 문제가 발생할 수 있기 때문이다.
2) 기존 코드를 복사하여 새 클래스를 만드는 방법
- 장점
- 기존 코드를 손대지 않기 때문에 문제가 발생할 가능성은 줄인다.
- 단점
- 기존 코드의 크기가 큰 경우에는 복사 붙여넣기가 어렵다.
- 기존 클래스의 소스가 없는 경우에는 이 방법이 불가능하다.
엥? 다른 개발자가 배포한 라이브러리만 있는 경우를 말한다.
소스가 없는 다른 개발자가 만든 클래스에 기능을 덧 붙일 때는 이 방법이 불가능하다.
- 기존 코드에 버그가 있을 때 복사 붙여넣기 해서 만든 클래스도 영향을 받는다.
- 기존 코드를 변경했을 때 복사 붙여넣기 한 모든 클래스를 찾아 변경해야 한다.
3) 기존 코드를 상속 받아 기능을 추가하는 방법
- 장점
- 기존 클래스의 소스 코드가 필요 없다.
- 간단한 선언으로 상속 받겠다고 표시한 후 새 기능만 추가하면 된다.
- 단점
- 일부 기능만 상속 받을 수 없다.
- 쓰든 안쓰든 모든 기능을 상속 받는다.
*/
| 1,850 | 0.592292 | 0.572008 | 39 | 24 | 16.665642 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.179487 | false | false | 9 |
890603ea42b7184e8b387744ba5ba34923820085 | 19,318,762,928,452 | a2fa6ca271c2d9edf1d9c1b2145320e405bb8519 | /Project2/src/com/sanju/bean/GroupCustomerBean.java | 6fca250c13740cf4a51c22e30f19a6cb445be5d9 | [] | no_license | ramanaidu214/chitdemo1 | https://github.com/ramanaidu214/chitdemo1 | 4e7d3b42777f2a4c159e3fc4b018b6b8aba4dbad | a7f689e9255dc706693cd90373f94007210a7973 | refs/heads/master | 2021-04-06T11:35:52.294000 | 2018-03-14T17:22:16 | 2018-03-14T17:22:16 | 125,248,153 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sanju.bean;
public class GroupCustomerBean {
//group_id,customer_id,group_name,customer_name,credit_amount
private int groupId;
private int customerId;
private String groupName;
private String customerName;
private double creditAmount;
public int getGroupId() {
return groupId;
}
public void setGroupId(int groupId) {
this.groupId = groupId;
}
public int getCustomerId() {
return customerId;
}
public void setCustomerId(int customerId) {
this.customerId = customerId;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public double getCreditAmount() {
return creditAmount;
}
public void setCreditAmount(double creditAmount) {
this.creditAmount = creditAmount;
}
}
| UTF-8 | Java | 991 | java | GroupCustomerBean.java | Java | [] | null | [] | package com.sanju.bean;
public class GroupCustomerBean {
//group_id,customer_id,group_name,customer_name,credit_amount
private int groupId;
private int customerId;
private String groupName;
private String customerName;
private double creditAmount;
public int getGroupId() {
return groupId;
}
public void setGroupId(int groupId) {
this.groupId = groupId;
}
public int getCustomerId() {
return customerId;
}
public void setCustomerId(int customerId) {
this.customerId = customerId;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public double getCreditAmount() {
return creditAmount;
}
public void setCreditAmount(double creditAmount) {
this.creditAmount = creditAmount;
}
}
| 991 | 0.720484 | 0.720484 | 42 | 21.595238 | 16.561659 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.619048 | false | false | 9 |
3f908d7e38f7c783231e02455fd322eabeed02c5 | 10,325,101,395,285 | d50dd66328b506e1d4fc711ec1232068b3dc978d | /src/test/java/nl/trifork/tictactoe/board/BoardBuilder.java | 846f9b0de98a7cf94ad8cdd5ccc975441540fb83 | [] | no_license | Steaton/Tictactoe | https://github.com/Steaton/Tictactoe | 5065151645c32dd65c6c93d82d08f9cd77ae2a0b | 8b05634c16e1427c6525c6cbeafdf5cb465cb1bf | refs/heads/master | 2020-04-19T03:24:35.067000 | 2019-01-28T09:24:26 | 2019-01-28T09:24:26 | 167,933,487 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package nl.trifork.tictactoe.board;
/**
* Utility for simplifying test cases (non-standard builder pattern using inheritance).
*/
public class BoardBuilder extends Board {
public BoardBuilder() {
super();
}
public static BoardBuilder aBoard() {
return new BoardBuilder();
}
public BoardBuilder withRow(int y, String row) {
checkValidRow(y, row);
for (int x = 0; x < 3; x++) {
if ('X' == row.charAt(x)) {
boardLayout[x][y - 1] = Square.X;
} else if ('O' == row.charAt(x)) {
boardLayout[x][y - 1] = Square.O;
}
}
this.numberOfRemainingMoves = countEmptySquares();
return this;
}
private int countEmptySquares() {
int count = 0;
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
if (boardLayout[x][y] == Square.EMPTY) {
count++;
}
}
}
return count;
}
private void checkValidRow(int y, String row) {
if (y < 1 || y > 3)
throw new IllegalArgumentException("Must be a row number between 1 & 3");
if (row.length() != 3)
throw new IllegalArgumentException("Must be 3 characters e.g. XOO or -X- to represent a the contents of the row");
}
}
| UTF-8 | Java | 1,363 | java | BoardBuilder.java | Java | [] | null | [] | package nl.trifork.tictactoe.board;
/**
* Utility for simplifying test cases (non-standard builder pattern using inheritance).
*/
public class BoardBuilder extends Board {
public BoardBuilder() {
super();
}
public static BoardBuilder aBoard() {
return new BoardBuilder();
}
public BoardBuilder withRow(int y, String row) {
checkValidRow(y, row);
for (int x = 0; x < 3; x++) {
if ('X' == row.charAt(x)) {
boardLayout[x][y - 1] = Square.X;
} else if ('O' == row.charAt(x)) {
boardLayout[x][y - 1] = Square.O;
}
}
this.numberOfRemainingMoves = countEmptySquares();
return this;
}
private int countEmptySquares() {
int count = 0;
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
if (boardLayout[x][y] == Square.EMPTY) {
count++;
}
}
}
return count;
}
private void checkValidRow(int y, String row) {
if (y < 1 || y > 3)
throw new IllegalArgumentException("Must be a row number between 1 & 3");
if (row.length() != 3)
throw new IllegalArgumentException("Must be 3 characters e.g. XOO or -X- to represent a the contents of the row");
}
}
| 1,363 | 0.514307 | 0.503302 | 48 | 27.395834 | 26.210478 | 126 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 9 |
a9e55610a45c69d08c7f680b0dd0d91c61b4365e | 2,654,289,791,123 | 0659303f22a4fcc75b51315d35f1a1793facda73 | /src/main/java/com/hq/simpleblog/controller/ArticleTypeController.java | f9be043083497dbf8a6b7f55187648ba0d8c1e65 | [
"Apache-2.0"
] | permissive | HQ1228234037/simple-blog-server | https://github.com/HQ1228234037/simple-blog-server | 1e01e1d4d5b9906970efaf2618bb91ca3eef19fd | 65923a5645f6776d54e218559f46536134937e1a | refs/heads/master | 2022-06-23T18:38:48.283000 | 2020-05-03T13:01:15 | 2020-05-03T13:01:15 | 248,778,634 | 0 | 0 | Apache-2.0 | false | 2022-06-17T03:10:23 | 2020-03-20T14:42:03 | 2020-05-03T13:02:45 | 2022-06-17T03:10:23 | 46 | 0 | 0 | 1 | Java | false | false | package com.hq.simpleblog.controller;
import com.hq.simpleblog.dto.ArticleTypeDTO;
import com.hq.simpleblog.dto.ArticleTypeQueryDTO;
import com.hq.simpleblog.enums.Code;
import com.hq.simpleblog.service.ArticleTypeService;
import com.hq.simpleblog.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
/**
* (ArticleType)表控制层
*
* @author HQ
* @version v1.0
* @since 2020-04-23 22:07:31
*/
@RestController
@RequestMapping("/api/articleType")
public class ArticleTypeController {
@Autowired
private ArticleTypeService articleTypeService;
/**
* 根据主键获取数据
*
* @param articleTypeId 主键
* @author HQ
* @since 2020-04-23 22:07:31
**/
@GetMapping("/{articleTypeId}")
public ResultVO getById(@PathVariable Long articleTypeId) {
ResultVO resultVO = new ResultVO();
if (articleTypeId == null || articleTypeId < 1) {
resultVO.setCode(Code.RequestParamError);
return resultVO;
}
return articleTypeService.getById(articleTypeId);
}
/**
* 分页获取 ArticleType 列表
*
* @param articleTypeQueryDTO 查询条件
* @author HQ
* @since 2020-04-23 22:07:31
**/
@PostMapping("/getByPage")
public ResultVO getByPage(@RequestBody @Valid ArticleTypeQueryDTO articleTypeQueryDTO) {
return articleTypeService.getByPage(articleTypeQueryDTO);
}
/**
* 获取 ArticleType 所有数据
*
* @author HQ
* @since 2020-04-23 22:07:31
**/
@GetMapping("/getAll")
public ResultVO getAll() {
return articleTypeService.getAll();
}
/**
* 新增 ArticleType 数据
*
* @author HQ
* @since 2020-04-23 22:07:31
**/
@PostMapping("/")
public ResultVO insert(@RequestBody @Valid ArticleTypeDTO articleTypeDTO) {
return articleTypeService.insert(articleTypeDTO);
}
/**
* 修改 ArticleType 数据
*
* @author HQ
* @since 2020-04-23 22:07:31
**/
@PutMapping("/")
public ResultVO update(@RequestBody @Valid ArticleTypeDTO articleTypeDTO) {
return articleTypeService.update(articleTypeDTO);
}
/**
* 通过主键删除数据
*
* @author HQ
* @since 2020-04-23 22:07:31
**/
@DeleteMapping("/{articleTypeId}")
public ResultVO deleteById(@PathVariable Long articleTypeId) {
return articleTypeService.deleteById(articleTypeId);
}
} | UTF-8 | Java | 2,586 | java | ArticleTypeController.java | Java | [
{
"context": "ion.Valid;\n\n/**\n * (ArticleType)表控制层\n *\n * @author HQ\n * @version v1.0\n * @since 2020-04-23 22:07:31\n *",
"end": 449,
"score": 0.9838892221450806,
"start": 447,
"tag": "USERNAME",
"value": "HQ"
},
{
"context": " *\n * @param articleTypeId 主键\n * @author HQ\n * @since 2020-04-23 22:07:31\n **/\n @G",
"end": 737,
"score": 0.8524610996246338,
"start": 735,
"tag": "USERNAME",
"value": "HQ"
},
{
"context": " * @param articleTypeQueryDTO 查询条件\n * @author HQ\n * @since 2020-04-23 22:07:31\n **/\n @P",
"end": 1239,
"score": 0.7640538215637207,
"start": 1237,
"tag": "USERNAME",
"value": "HQ"
},
{
"context": "*\n * 获取 ArticleType 所有数据\n *\n * @author HQ\n * @since 2020-04-23 22:07:31\n **/\n @G",
"end": 1539,
"score": 0.8383444547653198,
"start": 1537,
"tag": "USERNAME",
"value": "HQ"
},
{
"context": "/**\n * 修改 ArticleType 数据\n *\n * @author HQ\n * @since 2020-04-23 22:07:31\n **/\n @P",
"end": 2017,
"score": 0.9990878105163574,
"start": 2015,
"tag": "USERNAME",
"value": "HQ"
},
{
"context": " }\n\n /**\n * 通过主键删除数据\n *\n * @author HQ\n * @since 2020-04-23 22:07:31\n **/\n @D",
"end": 2275,
"score": 0.9974212646484375,
"start": 2273,
"tag": "USERNAME",
"value": "HQ"
}
] | null | [] | package com.hq.simpleblog.controller;
import com.hq.simpleblog.dto.ArticleTypeDTO;
import com.hq.simpleblog.dto.ArticleTypeQueryDTO;
import com.hq.simpleblog.enums.Code;
import com.hq.simpleblog.service.ArticleTypeService;
import com.hq.simpleblog.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
/**
* (ArticleType)表控制层
*
* @author HQ
* @version v1.0
* @since 2020-04-23 22:07:31
*/
@RestController
@RequestMapping("/api/articleType")
public class ArticleTypeController {
@Autowired
private ArticleTypeService articleTypeService;
/**
* 根据主键获取数据
*
* @param articleTypeId 主键
* @author HQ
* @since 2020-04-23 22:07:31
**/
@GetMapping("/{articleTypeId}")
public ResultVO getById(@PathVariable Long articleTypeId) {
ResultVO resultVO = new ResultVO();
if (articleTypeId == null || articleTypeId < 1) {
resultVO.setCode(Code.RequestParamError);
return resultVO;
}
return articleTypeService.getById(articleTypeId);
}
/**
* 分页获取 ArticleType 列表
*
* @param articleTypeQueryDTO 查询条件
* @author HQ
* @since 2020-04-23 22:07:31
**/
@PostMapping("/getByPage")
public ResultVO getByPage(@RequestBody @Valid ArticleTypeQueryDTO articleTypeQueryDTO) {
return articleTypeService.getByPage(articleTypeQueryDTO);
}
/**
* 获取 ArticleType 所有数据
*
* @author HQ
* @since 2020-04-23 22:07:31
**/
@GetMapping("/getAll")
public ResultVO getAll() {
return articleTypeService.getAll();
}
/**
* 新增 ArticleType 数据
*
* @author HQ
* @since 2020-04-23 22:07:31
**/
@PostMapping("/")
public ResultVO insert(@RequestBody @Valid ArticleTypeDTO articleTypeDTO) {
return articleTypeService.insert(articleTypeDTO);
}
/**
* 修改 ArticleType 数据
*
* @author HQ
* @since 2020-04-23 22:07:31
**/
@PutMapping("/")
public ResultVO update(@RequestBody @Valid ArticleTypeDTO articleTypeDTO) {
return articleTypeService.update(articleTypeDTO);
}
/**
* 通过主键删除数据
*
* @author HQ
* @since 2020-04-23 22:07:31
**/
@DeleteMapping("/{articleTypeId}")
public ResultVO deleteById(@PathVariable Long articleTypeId) {
return articleTypeService.deleteById(articleTypeId);
}
} | 2,586 | 0.647554 | 0.607057 | 100 | 23.950001 | 21.459438 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.21 | false | false | 9 |
399735a557a638fab89b171fb08f721758eac42c | 20,100,447,007,737 | 5705d2d504023f8f3720b818a049600af1be2fa7 | /src/main/java/homework/lab_enums/SuccessHandler.java | f117d6771b28e733df1d64dedfafee5b9348ee90 | [] | no_license | Nastasia-Kvasnyak/Nastasia | https://github.com/Nastasia-Kvasnyak/Nastasia | c3763dcd8020adc7d850c409cb9763f4369d98d8 | aeccbc4f5041fcdb1070e3df4010ede67d4f6111 | refs/heads/master | 2023-07-18T07:40:27.119000 | 2021-09-05T22:14:35 | 2021-09-05T22:14:35 | 399,224,612 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package homework.lab_enums;
public class SuccessHandler implements HttpHandler{
@Override
public void handle(int httpCode) {
System.out.println(httpCode+" Success");
}
}
| UTF-8 | Java | 191 | java | SuccessHandler.java | Java | [] | null | [] | package homework.lab_enums;
public class SuccessHandler implements HttpHandler{
@Override
public void handle(int httpCode) {
System.out.println(httpCode+" Success");
}
}
| 191 | 0.706806 | 0.706806 | 8 | 22.875 | 19.643303 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 9 |
264aed0366689e572deecbc94839e114fc5174ed | 24,867,860,707,205 | 3ba019d5cb66d79a9d66cdc5f098711a5365f891 | /API/Rating/RatingWeb/src/main/java/com/estes/myestes/rating/dao/iface/RateHistoryDAO.java | c92530cf3a4426e2ca01e8e25d3230796f2b60ce | [] | no_license | meataur/estes-express.com | https://github.com/meataur/estes-express.com | d94e4d3d28abc2f3240c9ff27d2ffc38b28cbd39 | a71c6f2786edf677ad1c1a512bc8d54fa49484bf | refs/heads/master | 2022-03-02T01:32:07.356000 | 2019-09-12T19:18:49 | 2019-09-12T19:18:49 | 208,119,348 | 0 | 0 | null | false | 2022-03-02T05:34:49 | 2019-09-12T18:31:24 | 2019-09-12T19:19:05 | 2022-03-02T05:34:46 | 3,672 | 0 | 0 | 23 | Java | false | false | /**
* @author: Todd Allen
*
* Creation date: 02/27/2019
*/
package com.estes.myestes.rating.dao.iface;
import java.util.List;
import com.estes.dto.common.rest.Pageable;
import com.estes.myestes.rating.dto.RateSearch;
import com.estes.myestes.rating.dto.RateSummary;
import com.estes.myestes.rating.exception.RatingException;
/**
* Data access for rating services
*/
public interface RateHistoryDAO extends BaseDAO
{
/**
* Default error code for ReST service calls
*/
public static int MAX_HISTORY_ROWS = 500;
/**
* Get # rows found for rate quote history search
*
* @return Number of rows found
*/
public int getSearchTotal(RateSearch search);
/**
* Get all service levels for rate quote
*
* @param refNum Quote reference number
* @return List of {@link RateSummary} objects
*/
public List<RateSummary> getAllServiceLevels(int refNum) throws RatingException;
/**
* Search rate quote history or My Estes user
*
* @param pageable {@link Pageable}
* @param search {@link RateSearch}
* @return List of {@link RateSummary}
*/
public List<RateSummary> searchQuoteHistory(Pageable pageable, RateSearch search) throws RatingException;
public List<String> getAppsByRef(int ref);
}
| UTF-8 | Java | 1,232 | java | RateHistoryDAO.java | Java | [
{
"context": "/**\n * @author: Todd Allen\n *\n * Creation date: 02/27/2019\n */\n\npackage com.",
"end": 26,
"score": 0.9998149275779724,
"start": 16,
"tag": "NAME",
"value": "Todd Allen"
}
] | null | [] | /**
* @author: <NAME>
*
* Creation date: 02/27/2019
*/
package com.estes.myestes.rating.dao.iface;
import java.util.List;
import com.estes.dto.common.rest.Pageable;
import com.estes.myestes.rating.dto.RateSearch;
import com.estes.myestes.rating.dto.RateSummary;
import com.estes.myestes.rating.exception.RatingException;
/**
* Data access for rating services
*/
public interface RateHistoryDAO extends BaseDAO
{
/**
* Default error code for ReST service calls
*/
public static int MAX_HISTORY_ROWS = 500;
/**
* Get # rows found for rate quote history search
*
* @return Number of rows found
*/
public int getSearchTotal(RateSearch search);
/**
* Get all service levels for rate quote
*
* @param refNum Quote reference number
* @return List of {@link RateSummary} objects
*/
public List<RateSummary> getAllServiceLevels(int refNum) throws RatingException;
/**
* Search rate quote history or My Estes user
*
* @param pageable {@link Pageable}
* @param search {@link RateSearch}
* @return List of {@link RateSummary}
*/
public List<RateSummary> searchQuoteHistory(Pageable pageable, RateSearch search) throws RatingException;
public List<String> getAppsByRef(int ref);
}
| 1,228 | 0.727273 | 0.718344 | 51 | 23.156862 | 24.362759 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.745098 | false | false | 9 |
b01556d3af0c9a5a1217f645dc32351ccb66f70b | 8,881,992,390,573 | 6195edf7e2ead57ad09c81404d86c42358989b95 | /src/main/java/com/gustavokring/backendtest/repository/PaisRepository.java | 48179c049b81e3c8b5a7e6778fbe3da70f5fe76d | [] | no_license | gustavoktausend/backendtest | https://github.com/gustavoktausend/backendtest | 4c79d7ced1967cf8515740ce0d46deeef51336a6 | 6c3cbe74629e49f244b5c63322ae227088c2ce82 | refs/heads/main | 2023-01-13T21:57:48.110000 | 2020-11-18T22:48:36 | 2020-11-18T22:48:36 | 313,463,481 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gustavokring.backendtest.repository;
import com.gustavokring.backendtest.entities.Pais;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface PaisRepository extends JpaRepository<Pais, Long> {
@Query("SELECT obj FROM Pais obj WHERE lower(obj.nome) LIKE lower(concat('%', :nome, '%'))")
List<Pais>findByNome(String nome);
}
| UTF-8 | Java | 511 | java | PaisRepository.java | Java | [] | null | [] | package com.gustavokring.backendtest.repository;
import com.gustavokring.backendtest.entities.Pais;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface PaisRepository extends JpaRepository<Pais, Long> {
@Query("SELECT obj FROM Pais obj WHERE lower(obj.nome) LIKE lower(concat('%', :nome, '%'))")
List<Pais>findByNome(String nome);
}
| 511 | 0.792564 | 0.792564 | 15 | 33.066666 | 29.539728 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 9 |
e1a2ee53fd4206690ee3cfef676c4bc4647de996 | 24,094,766,544,660 | 7e83cbd10100f8c0a3bb73e27ce4ff6806003680 | /src/main/java/project/utils/Testlistener.java | db14a12ff55d74eb9cd8721d1af3c65d6cdcbba6 | [] | no_license | ExperientAutomation/DPAutomation | https://github.com/ExperientAutomation/DPAutomation | b0ef02a6b3ad16ab9e1b0500d003d7ace8735865 | f1d4666e9c25bef92887d1c844111c48c31b5262 | refs/heads/master | 2023-05-10T20:23:57.097000 | 2019-10-15T13:17:27 | 2019-10-15T13:17:27 | 215,305,544 | 0 | 0 | null | false | 2023-05-09T17:58:20 | 2019-10-15T13:26:51 | 2019-10-15T13:49:53 | 2023-05-09T17:58:16 | 10,758 | 0 | 0 | 1 | HTML | false | false | package project.utils;
import org.testng.ITestContext;
import org.testng.ITestResult;
import org.testng.internal.IResultListener;
import com.relevantcodes.extentreports.LogStatus;
import application.test.TCExecution;
import project.library.ApplicationMethods;
import project.library.CommonMethods;
public class Testlistener extends CommonMethods implements IResultListener{
public final int usernamecolumn = 5; // Column number for UserName
public static final int activitycol = 3;
public static final int expectedresultcol = 4;
@Override
public void onTestStart(ITestResult result) {
// System.out.println("TestCase started Row#-"+TCExecution.row+": " +ApplicationMethods.excelsheet.getCellData("DP Test Cases",activitycol,TCExecution.row));
logger = report.startTest(result.getMethod().getMethodName());
logger.log(LogStatus.INFO, ApplicationMethods.excelsheet.getCellData("DP Test Cases",activitycol,TCExecution.row));
logger.log(LogStatus.INFO, ApplicationMethods.excelsheet.getCellData("DP Test Cases",expectedresultcol,TCExecution.row));
}
@Override
public void onTestSuccess(ITestResult result) {
// System.out.println("TestCase Passed: " + result.getName());
ApplicationMethods.excelsheet.setCellData("DP Test Cases", usernamecolumn + 1, TCExecution.row, "Pass");
ApplicationMethods.excelsheet.setCellData("DP Test Cases", usernamecolumn, TCExecution.row,System.getProperty("user.name"));
// logger.log(LogStatus.PASS, "Pass " +result.getName());
}
@Override
public void onTestFailure(ITestResult result) {
captureScreenshot();
ApplicationMethods.excelsheet.setCellData("DP Test Cases", usernamecolumn + 1, TCExecution.row, "Fail");
ApplicationMethods.excelsheet.setCellData("DP Test Cases", usernamecolumn, TCExecution.row, System.getProperty("user.name"));
logger.log(LogStatus.FAIL, result.getName()+"- Failed");
System.out.println("Test Case Failed - Row#: " + TCExecution.row);
}
@Override
public void onFinish(ITestContext result) {
System.out.println("Testcases Executed");
report.endTest(logger);
report.flush();
/*if (((ITestResult) result).getStatus() == ITestResult.FAILURE) {
String screenshot_path = captureScreenshot(driver, result.getName());
String image = logger.addScreenCapture(screenshot_path);
logger.log(LogStatus.INFO, "Fail "+result.getName(), image);
}*/
}
@Override
public void onStart(ITestContext arg0) {
// TODO Auto-generated method stub
}
@Override
public void onTestFailedButWithinSuccessPercentage(ITestResult arg0) {
// TODO Auto-generated method stub
}
@Override
public void onTestSkipped(ITestResult result) {
ApplicationMethods.excelsheet.setCellData("DP Test Cases", usernamecolumn + 1, TCExecution.row, "NA");
ApplicationMethods.excelsheet.setCellData("DP Test Cases", usernamecolumn, TCExecution.row, System.getProperty("user.name"));
logger.log(LogStatus.SKIP,result.getName());
System.out.println("SKIPPED-"+TCExecution.row);
}
@Override
public void onConfigurationFailure(ITestResult arg0) {
// TODO Auto-generated method stub
}
@Override
public void onConfigurationSkip(ITestResult arg0) {
// TODO Auto-generated method stub
}
@Override
public void onConfigurationSuccess(ITestResult arg0) {
// TODO Auto-generated method stub
}
}
| UTF-8 | Java | 3,362 | java | Testlistener.java | Java | [] | null | [] | package project.utils;
import org.testng.ITestContext;
import org.testng.ITestResult;
import org.testng.internal.IResultListener;
import com.relevantcodes.extentreports.LogStatus;
import application.test.TCExecution;
import project.library.ApplicationMethods;
import project.library.CommonMethods;
public class Testlistener extends CommonMethods implements IResultListener{
public final int usernamecolumn = 5; // Column number for UserName
public static final int activitycol = 3;
public static final int expectedresultcol = 4;
@Override
public void onTestStart(ITestResult result) {
// System.out.println("TestCase started Row#-"+TCExecution.row+": " +ApplicationMethods.excelsheet.getCellData("DP Test Cases",activitycol,TCExecution.row));
logger = report.startTest(result.getMethod().getMethodName());
logger.log(LogStatus.INFO, ApplicationMethods.excelsheet.getCellData("DP Test Cases",activitycol,TCExecution.row));
logger.log(LogStatus.INFO, ApplicationMethods.excelsheet.getCellData("DP Test Cases",expectedresultcol,TCExecution.row));
}
@Override
public void onTestSuccess(ITestResult result) {
// System.out.println("TestCase Passed: " + result.getName());
ApplicationMethods.excelsheet.setCellData("DP Test Cases", usernamecolumn + 1, TCExecution.row, "Pass");
ApplicationMethods.excelsheet.setCellData("DP Test Cases", usernamecolumn, TCExecution.row,System.getProperty("user.name"));
// logger.log(LogStatus.PASS, "Pass " +result.getName());
}
@Override
public void onTestFailure(ITestResult result) {
captureScreenshot();
ApplicationMethods.excelsheet.setCellData("DP Test Cases", usernamecolumn + 1, TCExecution.row, "Fail");
ApplicationMethods.excelsheet.setCellData("DP Test Cases", usernamecolumn, TCExecution.row, System.getProperty("user.name"));
logger.log(LogStatus.FAIL, result.getName()+"- Failed");
System.out.println("Test Case Failed - Row#: " + TCExecution.row);
}
@Override
public void onFinish(ITestContext result) {
System.out.println("Testcases Executed");
report.endTest(logger);
report.flush();
/*if (((ITestResult) result).getStatus() == ITestResult.FAILURE) {
String screenshot_path = captureScreenshot(driver, result.getName());
String image = logger.addScreenCapture(screenshot_path);
logger.log(LogStatus.INFO, "Fail "+result.getName(), image);
}*/
}
@Override
public void onStart(ITestContext arg0) {
// TODO Auto-generated method stub
}
@Override
public void onTestFailedButWithinSuccessPercentage(ITestResult arg0) {
// TODO Auto-generated method stub
}
@Override
public void onTestSkipped(ITestResult result) {
ApplicationMethods.excelsheet.setCellData("DP Test Cases", usernamecolumn + 1, TCExecution.row, "NA");
ApplicationMethods.excelsheet.setCellData("DP Test Cases", usernamecolumn, TCExecution.row, System.getProperty("user.name"));
logger.log(LogStatus.SKIP,result.getName());
System.out.println("SKIPPED-"+TCExecution.row);
}
@Override
public void onConfigurationFailure(ITestResult arg0) {
// TODO Auto-generated method stub
}
@Override
public void onConfigurationSkip(ITestResult arg0) {
// TODO Auto-generated method stub
}
@Override
public void onConfigurationSuccess(ITestResult arg0) {
// TODO Auto-generated method stub
}
}
| 3,362 | 0.753421 | 0.750149 | 104 | 31.326923 | 36.549084 | 161 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.086539 | false | false | 9 |
f31977f6cb8ed03255f697ccd5111ca4521e86d5 | 33,079,838,115,206 | f62da05c540e6ed897e2c6805723606caa3e4e85 | /src/main/java/com/qa/clare/MercuryToursTest/Constant.java | 18a11a82f71f8a008c6cbee888b71fdc119ca000 | [] | no_license | ckirabo/MercuryTours | https://github.com/ckirabo/MercuryTours | 4d6c9017b9ed117c0b0a31d47fd73ee2c5c68a3a | 230ff38c0397ce50940d44e549ab39175357a56f | refs/heads/master | 2020-04-18T08:43:07.635000 | 2019-01-24T17:12:20 | 2019-01-24T17:12:20 | 167,405,634 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.qa.clare.MercuryToursTest;
public class Constant {
/*
* Attributes for the file location , name of file , driver location
*
* public static void final
*
*/
public static final String driverLocation = "C:\\\\\\\\Users\\\\\\\\Admin\\\\\\\\Downloads/chromedriver_win32/chromedriver.exe";
public static final String nameOfFile = "MecuryTours_Report.html";
public static final String reportLocation = "C:\\\\Users\\\\Admin\\\\Documents\\\\AutomatedTesting\\\\Reporting/"+ nameOfFile ;
public static final String URL = "http://newtours.demoaut.com/mercuryregister.php";
}
| UTF-8 | Java | 613 | java | Constant.java | Java | [] | null | [] | package com.qa.clare.MercuryToursTest;
public class Constant {
/*
* Attributes for the file location , name of file , driver location
*
* public static void final
*
*/
public static final String driverLocation = "C:\\\\\\\\Users\\\\\\\\Admin\\\\\\\\Downloads/chromedriver_win32/chromedriver.exe";
public static final String nameOfFile = "MecuryTours_Report.html";
public static final String reportLocation = "C:\\\\Users\\\\Admin\\\\Documents\\\\AutomatedTesting\\\\Reporting/"+ nameOfFile ;
public static final String URL = "http://newtours.demoaut.com/mercuryregister.php";
}
| 613 | 0.694943 | 0.69168 | 23 | 25.652174 | 40.190426 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.043478 | false | false | 9 |
52e4140002117d5ea74eee90eb0622ca79f98c96 | 4,320,737,145,753 | d826274ef6050b9be011abe3f93185d5640915f9 | /gameserver/src/i3k/gmap/StringChannelHandler.java | 5d8f9588a80598b74bc788013ba85e81c30f445a | [] | no_license | dzheming/javaText | https://github.com/dzheming/javaText | 5460e48f5a900de908b5a50093ab641eae7a06d0 | a5ade2b311b486c6e852fa9fc4598191000ab94d | refs/heads/master | 2021-01-18T11:07:43.621000 | 2019-03-26T08:26:17 | 2019-03-26T08:26:17 | 84,320,147 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | // modified by ket.kio.RPCGen at Sat May 06 15:19:06 CST 2017.
package i3k.gmap;
import ket.util.SStream;
import i3k.SBean;
import i3k.util.GVector3;
public class StringChannelHandler
{
public StringChannelHandler(MapServer ms)
{
this.ms = ms;
}
private boolean checkTimeOut(SBean.TimeTick timeTick)
{
if(timeTick == null)
return true;
// SBean.TimeTick curTimeTick = ms.getMapManager().getTimeTick();
// if(timeTick.tickLine > curTimeTick.tickLine)
// return true;
// else if(timeTick.tickLine == curTimeTick.tickLine && timeTick.outTick > curTimeTick.outTick)
// return true;
//
// if(curTimeTick.tickLine - timeTick.tickLine >= TIME_OUT_TICK_COUNT)
// {
// ms.getLogger().debug("timeout curTimeTick.tickLine " + curTimeTick.tickLine + " timeTick.tickLine " + timeTick.tickLine);
// return true;
// }
return false;
}
//// begin handlers.
public void onRecv_client_ping_start(MapRole role, SStream.IStreamable ipacket)
{
SBean.client_ping_start packet = (SBean.client_ping_start)ipacket;
role.onRecvPingStart(packet.timeTick, packet.ping);
}
public void onRecv_sync_server_ping(MapRole role, SStream.IStreamable ipacket)
{
SBean.sync_server_ping packet = (SBean.sync_server_ping)ipacket;
role.onRecvPingSync(packet.ping);
}
public void onRecv_set_monster_birthpos(MapRole role, SStream.IStreamable ipacket)
{
SBean.set_monster_birthpos packet = (SBean.set_monster_birthpos)ipacket;
role.setMonsterToBirthPos(packet.mid);
}
public void onRecv_role_ride_horse(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_ride_horse packet = (SBean.role_ride_horse)ipacket;
if(role.isDead())
return;
// role.roleRideHorse();
}
public void onRecv_role_unride_horse(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_unride_horse packet = (SBean.role_unride_horse)ipacket;
// role.roleUnRideHorse(false);
}
public void onRecv_role_adjust_serverpos(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_adjust_serverpos packet = (SBean.role_adjust_serverpos)ipacket;
if(role.isInPrivateMap())
return;
if(role.isDead())
return;
role.clientAdjustRolePos(packet.pos);
}
public void onRecv_pet_adjust_serverpos(MapRole role, SStream.IStreamable ipacket)
{
SBean.pet_adjust_serverpos packet = (SBean.pet_adjust_serverpos)ipacket;
if(role.isInPrivateMap())
return;
PetCluster cluster = role.curMap.getPetCluster(role.getID());
if(cluster == null)
return;
Pet pet = cluster.pets.get(packet.pid);
if(pet == null || pet.isDead() || !pet.active)
return;
pet.clientAdjustPetPos(packet.pos);
}
public void onRecv_role_move(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_move packet = (SBean.role_move)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
if(role.isDead() || role.checkState(Behavior.EBPREPAREFIGHT) || role.isInProtectTime())
return;
// role.onMoveMent( new GVector3(packet.pos), new GVector3(packet.target), packet.speed, packet.rotation, packet.timeTick);
role.onMoveMent(packet.speed, packet.rotation, new GVector3(packet.pos), new GVector3(packet.target), packet.timeTick);
}
public void onRecv_pet_move(MapRole role, SStream.IStreamable ipacket)
{
SBean.pet_move packet = (SBean.pet_move)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
PetCluster cluster = role.curMap.getPetCluster(role.getID());
if(cluster != null)
{
Pet pet = cluster.pets.get(packet.cfgid);
if(pet != null && !pet.isDead() && pet.active && !pet.isInProtectTime())
{
pet.onMoveMent(packet.speed, packet.rotation, new GVector3(packet.pos), new GVector3(packet.target), packet.timeTick);
// pet.onMoveMent(new GVector3(packet.pos), new GVector3(packet.target), packet.speed, packet.timeTick);
}
}
}
public void onRecv_escortcar_move(MapRole role, SStream.IStreamable ipacket)
{
SBean.escortcar_move packet = (SBean.escortcar_move)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
EscortCar car = ms.getMapManager().getMapCar(role.id);
if(car == null)
return;
car.onMoveMent(packet.speed, packet.rotation, new GVector3(packet.pos), new GVector3(packet.target), packet.timeTick);
}
public void onRecv_role_stopmove(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_stopmove packet = (SBean.role_stopmove)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
if(role.isDead() || role.checkState(Behavior.EBPREPAREFIGHT) || role.isInProtectTime())
return;
role.onStopMove(new GVector3(packet.pos), packet.timeTick, true);
}
public void onRecv_pet_stopmove(MapRole role, SStream.IStreamable ipacket)
{
SBean.pet_stopmove packet = (SBean.pet_stopmove)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
PetCluster cluster = role.curMap.getPetCluster(role.getID());
if(cluster != null)
{
Pet pet = cluster.pets.get(packet.cfgid);
if(pet != null && !pet.isDead() && pet.active && !pet.isInProtectTime())
pet.onStopMove(new GVector3(packet.pos), packet.timeTick, true);
}
}
public void onRecv_escortcar_stopmove(MapRole role, SStream.IStreamable ipacket)
{
SBean.escortcar_stopmove packet = (SBean.escortcar_stopmove)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
EscortCar car = ms.getMapManager().getMapCar(role.id);
if(car == null)
return;
car.onStopMove(new GVector3(packet.pos), packet.timeTick, true);
}
public void onRecv_query_roles_detail(MapRole role, SStream.IStreamable ipacket)
{
SBean.query_roles_detail packet = (SBean.query_roles_detail)ipacket;
if(role.isInPrivateMap() || packet.roles.isEmpty())
return;
role.onQueryRolesDetail(packet.roles);
}
public void onRecv_query_traps_detail(MapRole role, SStream.IStreamable ipacket)
{
SBean.query_traps_detail packet = (SBean.query_traps_detail)ipacket;
if(role.isInPrivateMap() || packet.traps.isEmpty())
return;
role.onQueryTrapsDetail(packet.traps);
}
public void onRecv_query_pets_detail(MapRole role, SStream.IStreamable ipacket)
{
SBean.query_pets_detail packet = (SBean.query_pets_detail)ipacket;
if(role.isInPrivateMap() || packet.pets.isEmpty())
return;
role.onQueryPetsDetail(packet.pets);
}
public void onRecv_query_forcewar_result(MapRole role, SStream.IStreamable ipacket)
{
SBean.query_forcewar_result packet = (SBean.query_forcewar_result)ipacket;
role.onQueryForceWarResult();
}
public void onRecv_query_forcewar_members_pos(MapRole role, SStream.IStreamable ipacket)
{
SBean.query_forcewar_members_pos packet = (SBean.query_forcewar_members_pos)ipacket;
role.onQueryForceWarMemberPos();
}
public void onRecv_role_usefollowskill(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_usefollowskill packet = (SBean.role_usefollowskill)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
if(role.isDead() || role.checkState(Behavior.EBPREPAREFIGHT))
return;
role.onUseFollowSkill(packet.skillID, packet.seq, packet.timeTick);
}
public void onRecv_role_socialaction(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_socialaction packet = (SBean.role_socialaction)ipacket;
if(role.isInPrivateMap())
return;
if(role.isDead() || role.checkState(Behavior.EBPREPAREFIGHT))
return;
role.roleSocailAction(packet.actionID);
}
public void onRecv_role_breakskill(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_breakskill packet = (SBean.role_breakskill)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
if(role.isDead() || role.checkState(Behavior.EBPREPAREFIGHT))
return;
role.breakSkill();
}
public void onRecv_role_useskill(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_useskill packet = (SBean.role_useskill)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
if(role.isDead() || role.checkState(Behavior.EBPREPAREFIGHT))
return;
if(!role.onUseSkill(packet.skillID, packet.pos, packet.rotation, packet.targetID, packet.targetType, packet.ownerID, packet.timeTick))
role.removeState(Behavior.EBATTACK);
}
public void onRecv_role_usemapskill(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_usemapskill packet = (SBean.role_usemapskill)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(!role.isInJusticeMap())
return;
if(role.isDead() || role.checkState(Behavior.EBPREPAREFIGHT))
return;
if(!role.onUseMapSkill(packet.skillID, packet.pos, packet.rotation, packet.targetID, packet.targetType, packet.ownerID, packet.timeTick))
role.removeState(Behavior.EBATTACK);
}
public void onRecv_pet_useskill(MapRole role, SStream.IStreamable ipacket)
{
SBean.pet_useskill packet = (SBean.pet_useskill)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
PetCluster cluster = role.curMap.getPetCluster(role.id);
if(cluster == null)
return;
Pet pet = cluster.pets.get(packet.cfgid);
if(pet == null)
return;
if(pet.isDead() || !pet.active)
return;
pet.onUseSkill(packet.skillID, packet.pos, packet.rotation, packet.targetID, packet.targetType, packet.ownerID, packet.timeTick);
}
public void onRecv_role_endskill(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_endskill packet = (SBean.role_endskill)ipacket;
if(role.isInPrivateMap())
return;
// role.onEndSkill(packet.skillID);
}
public void onRecv_pet_endskill(MapRole role, SStream.IStreamable ipacket)
{
SBean.pet_endskill packet = (SBean.pet_endskill)ipacket;
if(role.isInPrivateMap())
return;
PetCluster cluster = role.curMap.getPetCluster(role.getID());
if(cluster == null)
return;
Pet pet = cluster.pets.get(packet.cfgid);
if(pet == null || !pet.active)
return;
// pet.onEndSkill(packet.skillID);
}
public void onRecv_role_finishattack(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_finishattack packet = (SBean.role_finishattack)ipacket;
// role.onFinishAttack();
}
public void onRecv_pet_finishattack(MapRole role, SStream.IStreamable ipacket)
{
SBean.pet_finishattack packet = (SBean.pet_finishattack)ipacket;
PetCluster cluster = role.curMap.getPetCluster(role.getID());
if(cluster == null)
return;
Pet pet = cluster.pets.get(packet.cfgid);
if(pet == null)
return;
// pet.onFinishAttack();
}
public void onRecv_role_rushstart(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_rushstart packet = (SBean.role_rushstart)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
if(role.isDead() || role.checkState(Behavior.EBPREPAREFIGHT))
return;
role.onRushStart(packet.skillID, packet.endPos, packet.timeTick);
}
public void onRecv_pet_rushstart(MapRole role, SStream.IStreamable ipacket)
{
SBean.pet_rushstart packet = (SBean.pet_rushstart)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
PetCluster cluster = role.curMap.getPetCluster(role.getID());
if(cluster == null)
return;
Pet pet = cluster.pets.get(packet.cfgid);
if(pet == null)
return;
pet.onRushStart(packet.skillID, packet.endPos, packet.timeTick);
}
public void onRecv_mineral_quit(MapRole role, SStream.IStreamable ipacket)
{
if(role.isInPrivateMap())
return;
SBean.mineral_quit packet = (SBean.mineral_quit)ipacket;
role.onMineralQuit();
}
public void onRecv_trap_click(MapRole role, SStream.IStreamable ipacket)
{
if(role.isInPrivateMap())
return;
if(role.isDead())
return;
SBean.trap_click packet = (SBean.trap_click)ipacket;
int trapID = packet.trapID;
Trap t = role.curMap.getTrap(trapID);
if(t != null)
t.onClicked(role);
}
public void onRecv_role_shift_start(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_shift_start packet = (SBean.role_shift_start)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
if(role.isDead())
return;
role.onShiftStart(packet.skillID, packet.targetID, packet.targetType, packet.ownerID, new GVector3(packet.endpos), packet.timeTick);
}
public void onRecv_pet_shift_start(MapRole role, SStream.IStreamable ipacket)
{
SBean.pet_shift_start packet = (SBean.pet_shift_start)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
PetCluster cluster = role.curMap.getPetCluster(role.getID());
if(cluster == null)
return;
Pet pet = cluster.pets.get(packet.attackpid);
if(pet == null)
return;
if(pet.isDead())
return;
pet.onShiftStart(packet.skillID, packet.targetID, packet.targetType, packet.ownerID, new GVector3(packet.endpos), packet.timeTick);
}
public void onRecv_role_pickup_drops(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_pickup_drops packet = (SBean.role_pickup_drops)ipacket;
role.onPickUpDrops(packet.drops);
}
public void onRecv_role_pickup_mapbuff(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_pickup_mapbuff packet = (SBean.role_pickup_mapbuff)ipacket;
role.onPickUpMapBuff(packet.mapBuffID);
}
public void onRecv_role_motivate_weapon(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_motivate_weapon packet = (SBean.role_motivate_weapon)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isDead())
return;
role.onMotivateWeapon(packet.timeTick);
}
public void onRecv_privatemap_kill(MapRole role, SStream.IStreamable ipacket)
{
if(!role.isInPrivateMap())
return;
if(role.isDead())
return;
SBean.privatemap_kill packet = (SBean.privatemap_kill)ipacket;
role.onPrivateMapKill(packet.spawnPointID, packet.position, packet.weaponID > 0);
role.onPrivateMapSaveDamageRank(packet.damageRank);
}
public void onRecv_privatemap_damage_reward(MapRole role, SStream.IStreamable ipacket)
{
if(!role.isInPrivateMap())
return;
if(role.isDead())
return;
SBean.privatemap_damage_reward packet = (SBean.privatemap_damage_reward)ipacket;
role.onPrivateMapMonsterDamageDrop(packet.spawnPointID, packet.position, packet.index);
}
public void onRecv_privatemap_trap(MapRole role, SStream.IStreamable ipacket)
{
if(!role.isInPrivateMap())
return;
SBean.privatemap_trap packet = (SBean.privatemap_trap)ipacket;
int trapID = packet.trapID;
int state = packet.trapState;
role.onPrivateMapTrapTrig(trapID, state);
}
public void onRecv_privatemap_weapon_master(MapRole role, SStream.IStreamable ipacket)
{
SBean.privatemap_weapon_master packet = (SBean.privatemap_weapon_master)ipacket;
role.onPrivateMapWeaponMaster();
}
public void onRecv_privatemap_role_updatehp(MapRole role, SStream.IStreamable ipacket)
{
SBean.privatemap_role_updatehp packet = (SBean.privatemap_role_updatehp)ipacket;
if(!role.isInPrivateMap())
return;
int hp = packet.hp;
role.onPrivateMapUpdateHp(hp);
}
public void onRecv_privatemap_pet_updatehp(MapRole role, SStream.IStreamable ipacket)
{
SBean.privatemap_pet_updatehp packet = (SBean.privatemap_pet_updatehp)ipacket;
if(!role.isInPrivateMap())
return;
if(role.isDead())
return;
PetCluster cluster = role.curMap.getPetCluster(role.getID());
if(cluster == null)
return;
Pet pet = cluster.pets.get(packet.cfgID);
if(pet == null)
return;
pet.onPrivateMapUpdateHP(packet.hp);
}
public void onRecv_privatemap_durability(MapRole role, SStream.IStreamable ipacket)
{
if(!role.isInPrivateMap())
return;
SBean.privatemap_durability packet = (SBean.privatemap_durability)ipacket;
int wid = packet.wid;
role.onSyncPrivateMapDurability(wid);
}
public void onRecv_query_entity_nearby(MapRole role, SStream.IStreamable ipacket)
{
SBean.query_entity_nearby packet = (SBean.query_entity_nearby)ipacket;
role.queryEntityNearBy(packet.id, packet.type);
}
public void onRecv_send_towerdefence_alarm(MapRole role, SStream.IStreamable ipacket)
{
SBean.send_towerdefence_alarm packet = (SBean.send_towerdefence_alarm)ipacket;
role.sendTowerDefenceAlarm(packet.type);
}
public void onRecv_query_map_damage_rank(MapRole role, SStream.IStreamable ipacket)
{
SBean.query_map_damage_rank packet = (SBean.query_map_damage_rank)ipacket;
role.syncMapDamageRank();
}
public void onRecv_query_sect_map_cur_info(MapRole role, SStream.IStreamable ipacket)
{
SBean.query_sect_map_cur_info packet = (SBean.query_sect_map_cur_info)ipacket;
role.syncSectGroupMapInfo();
}
//// end handlers.
final MapServer ms;
private static final int TIME_OUT_TICK_COUNT = 30;
}
| UTF-8 | Java | 16,989 | java | StringChannelHandler.java | Java | [] | null | [] | // modified by ket.kio.RPCGen at Sat May 06 15:19:06 CST 2017.
package i3k.gmap;
import ket.util.SStream;
import i3k.SBean;
import i3k.util.GVector3;
public class StringChannelHandler
{
public StringChannelHandler(MapServer ms)
{
this.ms = ms;
}
private boolean checkTimeOut(SBean.TimeTick timeTick)
{
if(timeTick == null)
return true;
// SBean.TimeTick curTimeTick = ms.getMapManager().getTimeTick();
// if(timeTick.tickLine > curTimeTick.tickLine)
// return true;
// else if(timeTick.tickLine == curTimeTick.tickLine && timeTick.outTick > curTimeTick.outTick)
// return true;
//
// if(curTimeTick.tickLine - timeTick.tickLine >= TIME_OUT_TICK_COUNT)
// {
// ms.getLogger().debug("timeout curTimeTick.tickLine " + curTimeTick.tickLine + " timeTick.tickLine " + timeTick.tickLine);
// return true;
// }
return false;
}
//// begin handlers.
public void onRecv_client_ping_start(MapRole role, SStream.IStreamable ipacket)
{
SBean.client_ping_start packet = (SBean.client_ping_start)ipacket;
role.onRecvPingStart(packet.timeTick, packet.ping);
}
public void onRecv_sync_server_ping(MapRole role, SStream.IStreamable ipacket)
{
SBean.sync_server_ping packet = (SBean.sync_server_ping)ipacket;
role.onRecvPingSync(packet.ping);
}
public void onRecv_set_monster_birthpos(MapRole role, SStream.IStreamable ipacket)
{
SBean.set_monster_birthpos packet = (SBean.set_monster_birthpos)ipacket;
role.setMonsterToBirthPos(packet.mid);
}
public void onRecv_role_ride_horse(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_ride_horse packet = (SBean.role_ride_horse)ipacket;
if(role.isDead())
return;
// role.roleRideHorse();
}
public void onRecv_role_unride_horse(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_unride_horse packet = (SBean.role_unride_horse)ipacket;
// role.roleUnRideHorse(false);
}
public void onRecv_role_adjust_serverpos(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_adjust_serverpos packet = (SBean.role_adjust_serverpos)ipacket;
if(role.isInPrivateMap())
return;
if(role.isDead())
return;
role.clientAdjustRolePos(packet.pos);
}
public void onRecv_pet_adjust_serverpos(MapRole role, SStream.IStreamable ipacket)
{
SBean.pet_adjust_serverpos packet = (SBean.pet_adjust_serverpos)ipacket;
if(role.isInPrivateMap())
return;
PetCluster cluster = role.curMap.getPetCluster(role.getID());
if(cluster == null)
return;
Pet pet = cluster.pets.get(packet.pid);
if(pet == null || pet.isDead() || !pet.active)
return;
pet.clientAdjustPetPos(packet.pos);
}
public void onRecv_role_move(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_move packet = (SBean.role_move)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
if(role.isDead() || role.checkState(Behavior.EBPREPAREFIGHT) || role.isInProtectTime())
return;
// role.onMoveMent( new GVector3(packet.pos), new GVector3(packet.target), packet.speed, packet.rotation, packet.timeTick);
role.onMoveMent(packet.speed, packet.rotation, new GVector3(packet.pos), new GVector3(packet.target), packet.timeTick);
}
public void onRecv_pet_move(MapRole role, SStream.IStreamable ipacket)
{
SBean.pet_move packet = (SBean.pet_move)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
PetCluster cluster = role.curMap.getPetCluster(role.getID());
if(cluster != null)
{
Pet pet = cluster.pets.get(packet.cfgid);
if(pet != null && !pet.isDead() && pet.active && !pet.isInProtectTime())
{
pet.onMoveMent(packet.speed, packet.rotation, new GVector3(packet.pos), new GVector3(packet.target), packet.timeTick);
// pet.onMoveMent(new GVector3(packet.pos), new GVector3(packet.target), packet.speed, packet.timeTick);
}
}
}
public void onRecv_escortcar_move(MapRole role, SStream.IStreamable ipacket)
{
SBean.escortcar_move packet = (SBean.escortcar_move)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
EscortCar car = ms.getMapManager().getMapCar(role.id);
if(car == null)
return;
car.onMoveMent(packet.speed, packet.rotation, new GVector3(packet.pos), new GVector3(packet.target), packet.timeTick);
}
public void onRecv_role_stopmove(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_stopmove packet = (SBean.role_stopmove)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
if(role.isDead() || role.checkState(Behavior.EBPREPAREFIGHT) || role.isInProtectTime())
return;
role.onStopMove(new GVector3(packet.pos), packet.timeTick, true);
}
public void onRecv_pet_stopmove(MapRole role, SStream.IStreamable ipacket)
{
SBean.pet_stopmove packet = (SBean.pet_stopmove)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
PetCluster cluster = role.curMap.getPetCluster(role.getID());
if(cluster != null)
{
Pet pet = cluster.pets.get(packet.cfgid);
if(pet != null && !pet.isDead() && pet.active && !pet.isInProtectTime())
pet.onStopMove(new GVector3(packet.pos), packet.timeTick, true);
}
}
public void onRecv_escortcar_stopmove(MapRole role, SStream.IStreamable ipacket)
{
SBean.escortcar_stopmove packet = (SBean.escortcar_stopmove)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
EscortCar car = ms.getMapManager().getMapCar(role.id);
if(car == null)
return;
car.onStopMove(new GVector3(packet.pos), packet.timeTick, true);
}
public void onRecv_query_roles_detail(MapRole role, SStream.IStreamable ipacket)
{
SBean.query_roles_detail packet = (SBean.query_roles_detail)ipacket;
if(role.isInPrivateMap() || packet.roles.isEmpty())
return;
role.onQueryRolesDetail(packet.roles);
}
public void onRecv_query_traps_detail(MapRole role, SStream.IStreamable ipacket)
{
SBean.query_traps_detail packet = (SBean.query_traps_detail)ipacket;
if(role.isInPrivateMap() || packet.traps.isEmpty())
return;
role.onQueryTrapsDetail(packet.traps);
}
public void onRecv_query_pets_detail(MapRole role, SStream.IStreamable ipacket)
{
SBean.query_pets_detail packet = (SBean.query_pets_detail)ipacket;
if(role.isInPrivateMap() || packet.pets.isEmpty())
return;
role.onQueryPetsDetail(packet.pets);
}
public void onRecv_query_forcewar_result(MapRole role, SStream.IStreamable ipacket)
{
SBean.query_forcewar_result packet = (SBean.query_forcewar_result)ipacket;
role.onQueryForceWarResult();
}
public void onRecv_query_forcewar_members_pos(MapRole role, SStream.IStreamable ipacket)
{
SBean.query_forcewar_members_pos packet = (SBean.query_forcewar_members_pos)ipacket;
role.onQueryForceWarMemberPos();
}
public void onRecv_role_usefollowskill(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_usefollowskill packet = (SBean.role_usefollowskill)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
if(role.isDead() || role.checkState(Behavior.EBPREPAREFIGHT))
return;
role.onUseFollowSkill(packet.skillID, packet.seq, packet.timeTick);
}
public void onRecv_role_socialaction(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_socialaction packet = (SBean.role_socialaction)ipacket;
if(role.isInPrivateMap())
return;
if(role.isDead() || role.checkState(Behavior.EBPREPAREFIGHT))
return;
role.roleSocailAction(packet.actionID);
}
public void onRecv_role_breakskill(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_breakskill packet = (SBean.role_breakskill)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
if(role.isDead() || role.checkState(Behavior.EBPREPAREFIGHT))
return;
role.breakSkill();
}
public void onRecv_role_useskill(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_useskill packet = (SBean.role_useskill)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
if(role.isDead() || role.checkState(Behavior.EBPREPAREFIGHT))
return;
if(!role.onUseSkill(packet.skillID, packet.pos, packet.rotation, packet.targetID, packet.targetType, packet.ownerID, packet.timeTick))
role.removeState(Behavior.EBATTACK);
}
public void onRecv_role_usemapskill(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_usemapskill packet = (SBean.role_usemapskill)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(!role.isInJusticeMap())
return;
if(role.isDead() || role.checkState(Behavior.EBPREPAREFIGHT))
return;
if(!role.onUseMapSkill(packet.skillID, packet.pos, packet.rotation, packet.targetID, packet.targetType, packet.ownerID, packet.timeTick))
role.removeState(Behavior.EBATTACK);
}
public void onRecv_pet_useskill(MapRole role, SStream.IStreamable ipacket)
{
SBean.pet_useskill packet = (SBean.pet_useskill)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
PetCluster cluster = role.curMap.getPetCluster(role.id);
if(cluster == null)
return;
Pet pet = cluster.pets.get(packet.cfgid);
if(pet == null)
return;
if(pet.isDead() || !pet.active)
return;
pet.onUseSkill(packet.skillID, packet.pos, packet.rotation, packet.targetID, packet.targetType, packet.ownerID, packet.timeTick);
}
public void onRecv_role_endskill(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_endskill packet = (SBean.role_endskill)ipacket;
if(role.isInPrivateMap())
return;
// role.onEndSkill(packet.skillID);
}
public void onRecv_pet_endskill(MapRole role, SStream.IStreamable ipacket)
{
SBean.pet_endskill packet = (SBean.pet_endskill)ipacket;
if(role.isInPrivateMap())
return;
PetCluster cluster = role.curMap.getPetCluster(role.getID());
if(cluster == null)
return;
Pet pet = cluster.pets.get(packet.cfgid);
if(pet == null || !pet.active)
return;
// pet.onEndSkill(packet.skillID);
}
public void onRecv_role_finishattack(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_finishattack packet = (SBean.role_finishattack)ipacket;
// role.onFinishAttack();
}
public void onRecv_pet_finishattack(MapRole role, SStream.IStreamable ipacket)
{
SBean.pet_finishattack packet = (SBean.pet_finishattack)ipacket;
PetCluster cluster = role.curMap.getPetCluster(role.getID());
if(cluster == null)
return;
Pet pet = cluster.pets.get(packet.cfgid);
if(pet == null)
return;
// pet.onFinishAttack();
}
public void onRecv_role_rushstart(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_rushstart packet = (SBean.role_rushstart)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
if(role.isDead() || role.checkState(Behavior.EBPREPAREFIGHT))
return;
role.onRushStart(packet.skillID, packet.endPos, packet.timeTick);
}
public void onRecv_pet_rushstart(MapRole role, SStream.IStreamable ipacket)
{
SBean.pet_rushstart packet = (SBean.pet_rushstart)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
PetCluster cluster = role.curMap.getPetCluster(role.getID());
if(cluster == null)
return;
Pet pet = cluster.pets.get(packet.cfgid);
if(pet == null)
return;
pet.onRushStart(packet.skillID, packet.endPos, packet.timeTick);
}
public void onRecv_mineral_quit(MapRole role, SStream.IStreamable ipacket)
{
if(role.isInPrivateMap())
return;
SBean.mineral_quit packet = (SBean.mineral_quit)ipacket;
role.onMineralQuit();
}
public void onRecv_trap_click(MapRole role, SStream.IStreamable ipacket)
{
if(role.isInPrivateMap())
return;
if(role.isDead())
return;
SBean.trap_click packet = (SBean.trap_click)ipacket;
int trapID = packet.trapID;
Trap t = role.curMap.getTrap(trapID);
if(t != null)
t.onClicked(role);
}
public void onRecv_role_shift_start(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_shift_start packet = (SBean.role_shift_start)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
if(role.isDead())
return;
role.onShiftStart(packet.skillID, packet.targetID, packet.targetType, packet.ownerID, new GVector3(packet.endpos), packet.timeTick);
}
public void onRecv_pet_shift_start(MapRole role, SStream.IStreamable ipacket)
{
SBean.pet_shift_start packet = (SBean.pet_shift_start)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isInPrivateMap())
return;
PetCluster cluster = role.curMap.getPetCluster(role.getID());
if(cluster == null)
return;
Pet pet = cluster.pets.get(packet.attackpid);
if(pet == null)
return;
if(pet.isDead())
return;
pet.onShiftStart(packet.skillID, packet.targetID, packet.targetType, packet.ownerID, new GVector3(packet.endpos), packet.timeTick);
}
public void onRecv_role_pickup_drops(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_pickup_drops packet = (SBean.role_pickup_drops)ipacket;
role.onPickUpDrops(packet.drops);
}
public void onRecv_role_pickup_mapbuff(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_pickup_mapbuff packet = (SBean.role_pickup_mapbuff)ipacket;
role.onPickUpMapBuff(packet.mapBuffID);
}
public void onRecv_role_motivate_weapon(MapRole role, SStream.IStreamable ipacket)
{
SBean.role_motivate_weapon packet = (SBean.role_motivate_weapon)ipacket;
if(checkTimeOut(packet.timeTick))
return;
if(role.isDead())
return;
role.onMotivateWeapon(packet.timeTick);
}
public void onRecv_privatemap_kill(MapRole role, SStream.IStreamable ipacket)
{
if(!role.isInPrivateMap())
return;
if(role.isDead())
return;
SBean.privatemap_kill packet = (SBean.privatemap_kill)ipacket;
role.onPrivateMapKill(packet.spawnPointID, packet.position, packet.weaponID > 0);
role.onPrivateMapSaveDamageRank(packet.damageRank);
}
public void onRecv_privatemap_damage_reward(MapRole role, SStream.IStreamable ipacket)
{
if(!role.isInPrivateMap())
return;
if(role.isDead())
return;
SBean.privatemap_damage_reward packet = (SBean.privatemap_damage_reward)ipacket;
role.onPrivateMapMonsterDamageDrop(packet.spawnPointID, packet.position, packet.index);
}
public void onRecv_privatemap_trap(MapRole role, SStream.IStreamable ipacket)
{
if(!role.isInPrivateMap())
return;
SBean.privatemap_trap packet = (SBean.privatemap_trap)ipacket;
int trapID = packet.trapID;
int state = packet.trapState;
role.onPrivateMapTrapTrig(trapID, state);
}
public void onRecv_privatemap_weapon_master(MapRole role, SStream.IStreamable ipacket)
{
SBean.privatemap_weapon_master packet = (SBean.privatemap_weapon_master)ipacket;
role.onPrivateMapWeaponMaster();
}
public void onRecv_privatemap_role_updatehp(MapRole role, SStream.IStreamable ipacket)
{
SBean.privatemap_role_updatehp packet = (SBean.privatemap_role_updatehp)ipacket;
if(!role.isInPrivateMap())
return;
int hp = packet.hp;
role.onPrivateMapUpdateHp(hp);
}
public void onRecv_privatemap_pet_updatehp(MapRole role, SStream.IStreamable ipacket)
{
SBean.privatemap_pet_updatehp packet = (SBean.privatemap_pet_updatehp)ipacket;
if(!role.isInPrivateMap())
return;
if(role.isDead())
return;
PetCluster cluster = role.curMap.getPetCluster(role.getID());
if(cluster == null)
return;
Pet pet = cluster.pets.get(packet.cfgID);
if(pet == null)
return;
pet.onPrivateMapUpdateHP(packet.hp);
}
public void onRecv_privatemap_durability(MapRole role, SStream.IStreamable ipacket)
{
if(!role.isInPrivateMap())
return;
SBean.privatemap_durability packet = (SBean.privatemap_durability)ipacket;
int wid = packet.wid;
role.onSyncPrivateMapDurability(wid);
}
public void onRecv_query_entity_nearby(MapRole role, SStream.IStreamable ipacket)
{
SBean.query_entity_nearby packet = (SBean.query_entity_nearby)ipacket;
role.queryEntityNearBy(packet.id, packet.type);
}
public void onRecv_send_towerdefence_alarm(MapRole role, SStream.IStreamable ipacket)
{
SBean.send_towerdefence_alarm packet = (SBean.send_towerdefence_alarm)ipacket;
role.sendTowerDefenceAlarm(packet.type);
}
public void onRecv_query_map_damage_rank(MapRole role, SStream.IStreamable ipacket)
{
SBean.query_map_damage_rank packet = (SBean.query_map_damage_rank)ipacket;
role.syncMapDamageRank();
}
public void onRecv_query_sect_map_cur_info(MapRole role, SStream.IStreamable ipacket)
{
SBean.query_sect_map_cur_info packet = (SBean.query_sect_map_cur_info)ipacket;
role.syncSectGroupMapInfo();
}
//// end handlers.
final MapServer ms;
private static final int TIME_OUT_TICK_COUNT = 30;
}
| 16,989 | 0.728707 | 0.726705 | 621 | 26.357489 | 30.904003 | 139 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.302737 | false | false | 9 |
fb53d331e530b6e5c9ce12284edd59fe13322fc1 | 2,207,613,237,741 | ea8f29d6d5f04af4fcd6ce8977d0d5c560bcdf61 | /goldcommon/src/main/java/com/orange/goldgame/domain/PackagePropsExample.java | 9d59a004505815d8493e89ac3a7fd9d47436742a | [] | no_license | liushagit/goldgame | https://github.com/liushagit/goldgame | 9178f298cc23fd507070cce4b382991160a26813 | 36e4f659913bccf1a48f630cf04e88db41d586ef | refs/heads/master | 2020-04-07T13:56:01.201000 | 2015-05-11T03:28:01 | 2015-05-11T03:28:01 | 35,399,747 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.orange.goldgame.domain;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class PackagePropsExample {
/**
* This field was generated by Apache iBATIS ibator. This field corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
protected String orderByClause;
/**
* This field was generated by Apache iBATIS ibator. This field corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
protected List oredCriteria;
/**
* This method was generated by Apache iBATIS ibator. This method corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
public PackagePropsExample() {
oredCriteria = new ArrayList();
}
/**
* This method was generated by Apache iBATIS ibator. This method corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
protected PackagePropsExample(PackagePropsExample example) {
this.orderByClause = example.orderByClause;
this.oredCriteria = example.oredCriteria;
}
/**
* This method was generated by Apache iBATIS ibator. This method corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by Apache iBATIS ibator. This method corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by Apache iBATIS ibator. This method corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
public List getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by Apache iBATIS ibator. This method corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by Apache iBATIS ibator. This method corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by Apache iBATIS ibator. This method corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by Apache iBATIS ibator. This method corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
public void clear() {
oredCriteria.clear();
}
/**
* This class was generated by Apache iBATIS ibator. This class corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
public static class Criteria {
protected List criteriaWithoutValue;
protected List criteriaWithSingleValue;
protected List criteriaWithListValue;
protected List criteriaWithBetweenValue;
protected Criteria() {
super();
criteriaWithoutValue = new ArrayList();
criteriaWithSingleValue = new ArrayList();
criteriaWithListValue = new ArrayList();
criteriaWithBetweenValue = new ArrayList();
}
public boolean isValid() {
return criteriaWithoutValue.size() > 0
|| criteriaWithSingleValue.size() > 0
|| criteriaWithListValue.size() > 0
|| criteriaWithBetweenValue.size() > 0;
}
public List getCriteriaWithoutValue() {
return criteriaWithoutValue;
}
public List getCriteriaWithSingleValue() {
return criteriaWithSingleValue;
}
public List getCriteriaWithListValue() {
return criteriaWithListValue;
}
public List getCriteriaWithBetweenValue() {
return criteriaWithBetweenValue;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteriaWithoutValue.add(condition);
}
protected void addCriterion(String condition, Object value,
String property) {
if (value == null) {
throw new RuntimeException("Value for " + property
+ " cannot be null");
}
Map map = new HashMap();
map.put("condition", condition);
map.put("value", value);
criteriaWithSingleValue.add(map);
}
protected void addCriterion(String condition, List values,
String property) {
if (values == null || values.size() == 0) {
throw new RuntimeException("Value list for " + property
+ " cannot be null or empty");
}
Map map = new HashMap();
map.put("condition", condition);
map.put("values", values);
criteriaWithListValue.add(map);
}
protected void addCriterion(String condition, Object value1,
Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property
+ " cannot be null");
}
List list = new ArrayList();
list.add(value1);
list.add(value2);
Map map = new HashMap();
map.put("condition", condition);
map.put("values", list);
criteriaWithBetweenValue.add(map);
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return this;
}
public Criteria andIdIn(List values) {
addCriterion("id in", values, "id");
return this;
}
public Criteria andIdNotIn(List values) {
addCriterion("id not in", values, "id");
return this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return this;
}
public Criteria andPropsIdIsNull() {
addCriterion("props_Id is null");
return this;
}
public Criteria andPropsIdIsNotNull() {
addCriterion("props_Id is not null");
return this;
}
public Criteria andPropsIdEqualTo(Integer value) {
addCriterion("props_Id =", value, "propsId");
return this;
}
public Criteria andPropsIdNotEqualTo(Integer value) {
addCriterion("props_Id <>", value, "propsId");
return this;
}
public Criteria andPropsIdGreaterThan(Integer value) {
addCriterion("props_Id >", value, "propsId");
return this;
}
public Criteria andPropsIdGreaterThanOrEqualTo(Integer value) {
addCriterion("props_Id >=", value, "propsId");
return this;
}
public Criteria andPropsIdLessThan(Integer value) {
addCriterion("props_Id <", value, "propsId");
return this;
}
public Criteria andPropsIdLessThanOrEqualTo(Integer value) {
addCriterion("props_Id <=", value, "propsId");
return this;
}
public Criteria andPropsIdIn(List values) {
addCriterion("props_Id in", values, "propsId");
return this;
}
public Criteria andPropsIdNotIn(List values) {
addCriterion("props_Id not in", values, "propsId");
return this;
}
public Criteria andPropsIdBetween(Integer value1, Integer value2) {
addCriterion("props_Id between", value1, value2, "propsId");
return this;
}
public Criteria andPropsIdNotBetween(Integer value1, Integer value2) {
addCriterion("props_Id not between", value1, value2, "propsId");
return this;
}
public Criteria andPropsNumberIsNull() {
addCriterion("props_Number is null");
return this;
}
public Criteria andPropsNumberIsNotNull() {
addCriterion("props_Number is not null");
return this;
}
public Criteria andPropsNumberEqualTo(Integer value) {
addCriterion("props_Number =", value, "propsNumber");
return this;
}
public Criteria andPropsNumberNotEqualTo(Integer value) {
addCriterion("props_Number <>", value, "propsNumber");
return this;
}
public Criteria andPropsNumberGreaterThan(Integer value) {
addCriterion("props_Number >", value, "propsNumber");
return this;
}
public Criteria andPropsNumberGreaterThanOrEqualTo(Integer value) {
addCriterion("props_Number >=", value, "propsNumber");
return this;
}
public Criteria andPropsNumberLessThan(Integer value) {
addCriterion("props_Number <", value, "propsNumber");
return this;
}
public Criteria andPropsNumberLessThanOrEqualTo(Integer value) {
addCriterion("props_Number <=", value, "propsNumber");
return this;
}
public Criteria andPropsNumberIn(List values) {
addCriterion("props_Number in", values, "propsNumber");
return this;
}
public Criteria andPropsNumberNotIn(List values) {
addCriterion("props_Number not in", values, "propsNumber");
return this;
}
public Criteria andPropsNumberBetween(Integer value1, Integer value2) {
addCriterion("props_Number between", value1, value2, "propsNumber");
return this;
}
public Criteria andPropsNumberNotBetween(Integer value1, Integer value2) {
addCriterion("props_Number not between", value1, value2,
"propsNumber");
return this;
}
public Criteria andPropsMoneyIsNull() {
addCriterion("props_Money is null");
return this;
}
public Criteria andPropsMoneyIsNotNull() {
addCriterion("props_Money is not null");
return this;
}
public Criteria andPropsMoneyEqualTo(Integer value) {
addCriterion("props_Money =", value, "propsMoney");
return this;
}
public Criteria andPropsMoneyNotEqualTo(Integer value) {
addCriterion("props_Money <>", value, "propsMoney");
return this;
}
public Criteria andPropsMoneyGreaterThan(Integer value) {
addCriterion("props_Money >", value, "propsMoney");
return this;
}
public Criteria andPropsMoneyGreaterThanOrEqualTo(Integer value) {
addCriterion("props_Money >=", value, "propsMoney");
return this;
}
public Criteria andPropsMoneyLessThan(Integer value) {
addCriterion("props_Money <", value, "propsMoney");
return this;
}
public Criteria andPropsMoneyLessThanOrEqualTo(Integer value) {
addCriterion("props_Money <=", value, "propsMoney");
return this;
}
public Criteria andPropsMoneyIn(List values) {
addCriterion("props_Money in", values, "propsMoney");
return this;
}
public Criteria andPropsMoneyNotIn(List values) {
addCriterion("props_Money not in", values, "propsMoney");
return this;
}
public Criteria andPropsMoneyBetween(Integer value1, Integer value2) {
addCriterion("props_Money between", value1, value2, "propsMoney");
return this;
}
public Criteria andPropsMoneyNotBetween(Integer value1, Integer value2) {
addCriterion("props_Money not between", value1, value2,
"propsMoney");
return this;
}
public Criteria andPropsAwardIsNull() {
addCriterion("props_Award is null");
return this;
}
public Criteria andPropsAwardIsNotNull() {
addCriterion("props_Award is not null");
return this;
}
public Criteria andPropsAwardEqualTo(Integer value) {
addCriterion("props_Award =", value, "propsAward");
return this;
}
public Criteria andPropsAwardNotEqualTo(Integer value) {
addCriterion("props_Award <>", value, "propsAward");
return this;
}
public Criteria andPropsAwardGreaterThan(Integer value) {
addCriterion("props_Award >", value, "propsAward");
return this;
}
public Criteria andPropsAwardGreaterThanOrEqualTo(Integer value) {
addCriterion("props_Award >=", value, "propsAward");
return this;
}
public Criteria andPropsAwardLessThan(Integer value) {
addCriterion("props_Award <", value, "propsAward");
return this;
}
public Criteria andPropsAwardLessThanOrEqualTo(Integer value) {
addCriterion("props_Award <=", value, "propsAward");
return this;
}
public Criteria andPropsAwardIn(List values) {
addCriterion("props_Award in", values, "propsAward");
return this;
}
public Criteria andPropsAwardNotIn(List values) {
addCriterion("props_Award not in", values, "propsAward");
return this;
}
public Criteria andPropsAwardBetween(Integer value1, Integer value2) {
addCriterion("props_Award between", value1, value2, "propsAward");
return this;
}
public Criteria andPropsAwardNotBetween(Integer value1, Integer value2) {
addCriterion("props_Award not between", value1, value2,
"propsAward");
return this;
}
}
} | UTF-8 | Java | 13,338 | java | PackagePropsExample.java | Java | [] | null | [] | package com.orange.goldgame.domain;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class PackagePropsExample {
/**
* This field was generated by Apache iBATIS ibator. This field corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
protected String orderByClause;
/**
* This field was generated by Apache iBATIS ibator. This field corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
protected List oredCriteria;
/**
* This method was generated by Apache iBATIS ibator. This method corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
public PackagePropsExample() {
oredCriteria = new ArrayList();
}
/**
* This method was generated by Apache iBATIS ibator. This method corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
protected PackagePropsExample(PackagePropsExample example) {
this.orderByClause = example.orderByClause;
this.oredCriteria = example.oredCriteria;
}
/**
* This method was generated by Apache iBATIS ibator. This method corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by Apache iBATIS ibator. This method corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by Apache iBATIS ibator. This method corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
public List getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by Apache iBATIS ibator. This method corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by Apache iBATIS ibator. This method corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by Apache iBATIS ibator. This method corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by Apache iBATIS ibator. This method corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
public void clear() {
oredCriteria.clear();
}
/**
* This class was generated by Apache iBATIS ibator. This class corresponds to the database table package_props
* @ibatorgenerated Thu Jul 11 15:53:37 CST 2013
*/
public static class Criteria {
protected List criteriaWithoutValue;
protected List criteriaWithSingleValue;
protected List criteriaWithListValue;
protected List criteriaWithBetweenValue;
protected Criteria() {
super();
criteriaWithoutValue = new ArrayList();
criteriaWithSingleValue = new ArrayList();
criteriaWithListValue = new ArrayList();
criteriaWithBetweenValue = new ArrayList();
}
public boolean isValid() {
return criteriaWithoutValue.size() > 0
|| criteriaWithSingleValue.size() > 0
|| criteriaWithListValue.size() > 0
|| criteriaWithBetweenValue.size() > 0;
}
public List getCriteriaWithoutValue() {
return criteriaWithoutValue;
}
public List getCriteriaWithSingleValue() {
return criteriaWithSingleValue;
}
public List getCriteriaWithListValue() {
return criteriaWithListValue;
}
public List getCriteriaWithBetweenValue() {
return criteriaWithBetweenValue;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteriaWithoutValue.add(condition);
}
protected void addCriterion(String condition, Object value,
String property) {
if (value == null) {
throw new RuntimeException("Value for " + property
+ " cannot be null");
}
Map map = new HashMap();
map.put("condition", condition);
map.put("value", value);
criteriaWithSingleValue.add(map);
}
protected void addCriterion(String condition, List values,
String property) {
if (values == null || values.size() == 0) {
throw new RuntimeException("Value list for " + property
+ " cannot be null or empty");
}
Map map = new HashMap();
map.put("condition", condition);
map.put("values", values);
criteriaWithListValue.add(map);
}
protected void addCriterion(String condition, Object value1,
Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property
+ " cannot be null");
}
List list = new ArrayList();
list.add(value1);
list.add(value2);
Map map = new HashMap();
map.put("condition", condition);
map.put("values", list);
criteriaWithBetweenValue.add(map);
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return this;
}
public Criteria andIdIn(List values) {
addCriterion("id in", values, "id");
return this;
}
public Criteria andIdNotIn(List values) {
addCriterion("id not in", values, "id");
return this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return this;
}
public Criteria andPropsIdIsNull() {
addCriterion("props_Id is null");
return this;
}
public Criteria andPropsIdIsNotNull() {
addCriterion("props_Id is not null");
return this;
}
public Criteria andPropsIdEqualTo(Integer value) {
addCriterion("props_Id =", value, "propsId");
return this;
}
public Criteria andPropsIdNotEqualTo(Integer value) {
addCriterion("props_Id <>", value, "propsId");
return this;
}
public Criteria andPropsIdGreaterThan(Integer value) {
addCriterion("props_Id >", value, "propsId");
return this;
}
public Criteria andPropsIdGreaterThanOrEqualTo(Integer value) {
addCriterion("props_Id >=", value, "propsId");
return this;
}
public Criteria andPropsIdLessThan(Integer value) {
addCriterion("props_Id <", value, "propsId");
return this;
}
public Criteria andPropsIdLessThanOrEqualTo(Integer value) {
addCriterion("props_Id <=", value, "propsId");
return this;
}
public Criteria andPropsIdIn(List values) {
addCriterion("props_Id in", values, "propsId");
return this;
}
public Criteria andPropsIdNotIn(List values) {
addCriterion("props_Id not in", values, "propsId");
return this;
}
public Criteria andPropsIdBetween(Integer value1, Integer value2) {
addCriterion("props_Id between", value1, value2, "propsId");
return this;
}
public Criteria andPropsIdNotBetween(Integer value1, Integer value2) {
addCriterion("props_Id not between", value1, value2, "propsId");
return this;
}
public Criteria andPropsNumberIsNull() {
addCriterion("props_Number is null");
return this;
}
public Criteria andPropsNumberIsNotNull() {
addCriterion("props_Number is not null");
return this;
}
public Criteria andPropsNumberEqualTo(Integer value) {
addCriterion("props_Number =", value, "propsNumber");
return this;
}
public Criteria andPropsNumberNotEqualTo(Integer value) {
addCriterion("props_Number <>", value, "propsNumber");
return this;
}
public Criteria andPropsNumberGreaterThan(Integer value) {
addCriterion("props_Number >", value, "propsNumber");
return this;
}
public Criteria andPropsNumberGreaterThanOrEqualTo(Integer value) {
addCriterion("props_Number >=", value, "propsNumber");
return this;
}
public Criteria andPropsNumberLessThan(Integer value) {
addCriterion("props_Number <", value, "propsNumber");
return this;
}
public Criteria andPropsNumberLessThanOrEqualTo(Integer value) {
addCriterion("props_Number <=", value, "propsNumber");
return this;
}
public Criteria andPropsNumberIn(List values) {
addCriterion("props_Number in", values, "propsNumber");
return this;
}
public Criteria andPropsNumberNotIn(List values) {
addCriterion("props_Number not in", values, "propsNumber");
return this;
}
public Criteria andPropsNumberBetween(Integer value1, Integer value2) {
addCriterion("props_Number between", value1, value2, "propsNumber");
return this;
}
public Criteria andPropsNumberNotBetween(Integer value1, Integer value2) {
addCriterion("props_Number not between", value1, value2,
"propsNumber");
return this;
}
public Criteria andPropsMoneyIsNull() {
addCriterion("props_Money is null");
return this;
}
public Criteria andPropsMoneyIsNotNull() {
addCriterion("props_Money is not null");
return this;
}
public Criteria andPropsMoneyEqualTo(Integer value) {
addCriterion("props_Money =", value, "propsMoney");
return this;
}
public Criteria andPropsMoneyNotEqualTo(Integer value) {
addCriterion("props_Money <>", value, "propsMoney");
return this;
}
public Criteria andPropsMoneyGreaterThan(Integer value) {
addCriterion("props_Money >", value, "propsMoney");
return this;
}
public Criteria andPropsMoneyGreaterThanOrEqualTo(Integer value) {
addCriterion("props_Money >=", value, "propsMoney");
return this;
}
public Criteria andPropsMoneyLessThan(Integer value) {
addCriterion("props_Money <", value, "propsMoney");
return this;
}
public Criteria andPropsMoneyLessThanOrEqualTo(Integer value) {
addCriterion("props_Money <=", value, "propsMoney");
return this;
}
public Criteria andPropsMoneyIn(List values) {
addCriterion("props_Money in", values, "propsMoney");
return this;
}
public Criteria andPropsMoneyNotIn(List values) {
addCriterion("props_Money not in", values, "propsMoney");
return this;
}
public Criteria andPropsMoneyBetween(Integer value1, Integer value2) {
addCriterion("props_Money between", value1, value2, "propsMoney");
return this;
}
public Criteria andPropsMoneyNotBetween(Integer value1, Integer value2) {
addCriterion("props_Money not between", value1, value2,
"propsMoney");
return this;
}
public Criteria andPropsAwardIsNull() {
addCriterion("props_Award is null");
return this;
}
public Criteria andPropsAwardIsNotNull() {
addCriterion("props_Award is not null");
return this;
}
public Criteria andPropsAwardEqualTo(Integer value) {
addCriterion("props_Award =", value, "propsAward");
return this;
}
public Criteria andPropsAwardNotEqualTo(Integer value) {
addCriterion("props_Award <>", value, "propsAward");
return this;
}
public Criteria andPropsAwardGreaterThan(Integer value) {
addCriterion("props_Award >", value, "propsAward");
return this;
}
public Criteria andPropsAwardGreaterThanOrEqualTo(Integer value) {
addCriterion("props_Award >=", value, "propsAward");
return this;
}
public Criteria andPropsAwardLessThan(Integer value) {
addCriterion("props_Award <", value, "propsAward");
return this;
}
public Criteria andPropsAwardLessThanOrEqualTo(Integer value) {
addCriterion("props_Award <=", value, "propsAward");
return this;
}
public Criteria andPropsAwardIn(List values) {
addCriterion("props_Award in", values, "propsAward");
return this;
}
public Criteria andPropsAwardNotIn(List values) {
addCriterion("props_Award not in", values, "propsAward");
return this;
}
public Criteria andPropsAwardBetween(Integer value1, Integer value2) {
addCriterion("props_Award between", value1, value2, "propsAward");
return this;
}
public Criteria andPropsAwardNotBetween(Integer value1, Integer value2) {
addCriterion("props_Award not between", value1, value2,
"propsAward");
return this;
}
}
} | 13,338 | 0.708727 | 0.694032 | 489 | 26.278118 | 26.47027 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.543967 | false | false | 9 |
dd76907478387d64261f448634bdc9a798e1ce06 | 919,123,029,097 | 2ff1b5f988f137fcf3253c205854663438cac45e | /src/main/java/com/ex/BParse/Models/XmlHelpModels/Currency.java | 23ebf97d3929d8206aa919fe595af040ceca41ed | [] | no_license | yanyasha228/eparse | https://github.com/yanyasha228/eparse | 9414e9da7e2b832d3b7bd4eba9e2809ad9aed01b | c08d72dae737bd22906604359ff25e7ceac59aba | refs/heads/master | 2022-09-11T19:35:08.925000 | 2019-08-23T17:28:20 | 2019-08-23T17:28:20 | 204,042,427 | 0 | 0 | null | false | 2022-09-01T23:11:54 | 2019-08-23T17:29:51 | 2019-08-23T17:31:34 | 2022-09-01T23:11:50 | 47 | 0 | 0 | 4 | Java | false | false | package com.ex.BParse.Models.XmlHelpModels;
import com.ex.BParse.Models.Enums.MoneyCurrency;
import lombok.Data;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
@Data
@XmlRootElement(name = "currency")
@XmlAccessorType(XmlAccessType.FIELD)
public class Currency {
@XmlAttribute(name = "code")
private MoneyCurrency code;
@XmlAttribute(name = "rate")
private double rate;
}
| UTF-8 | Java | 540 | java | Currency.java | Java | [] | null | [] | package com.ex.BParse.Models.XmlHelpModels;
import com.ex.BParse.Models.Enums.MoneyCurrency;
import lombok.Data;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
@Data
@XmlRootElement(name = "currency")
@XmlAccessorType(XmlAccessType.FIELD)
public class Currency {
@XmlAttribute(name = "code")
private MoneyCurrency code;
@XmlAttribute(name = "rate")
private double rate;
}
| 540 | 0.783333 | 0.783333 | 21 | 24.714285 | 18.749331 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 9 |
c4e02a79350445ca53d09031b60fcd5a12b9fb6e | 4,741,643,912,670 | 5d0b74cf88b22ef3b5d7845f802b67beb0980178 | /shopping_back/src/main/java/hs/kr/shopping_back/Domain/Product.java | 33c04a7c61ccf0fa99db2de8f85f3b9073203752 | [] | no_license | nozomu03/shopping | https://github.com/nozomu03/shopping | 9c5e5bee5bb58c29ac37dc5e7a9c17e3e6772855 | 3faea11702d3266cedd35e2e14c61a59e8e3e485 | refs/heads/master | 2020-06-05T01:44:53.575000 | 2019-06-30T12:11:25 | 2019-06-30T12:11:25 | 192,270,033 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package hs.kr.shopping_back.Domain;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.CreationTimestamp;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.time.LocalDateTime;
@Entity
@Data
public class Product {
@Id
@GeneratedValue
private Long id;
private String name;
private String content;
private String inform;
private int price;
private int real_price;
private String category;
private String creater;
public void setCreater(String creater) {
this.creater = creater;
}
public Product(String name, String content, String inform, int price, int real_price, String category, String creater) {
this.name = name;
this.content = content;
this.inform = inform;
this.price = price;
this.real_price = real_price;
this.category = category;
this.creater = creater;
}
public Product(String name) {
this.name = name;
}
public Product() {
}
}
| UTF-8 | Java | 1,088 | java | Product.java | Java | [] | null | [] | package hs.kr.shopping_back.Domain;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.CreationTimestamp;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.time.LocalDateTime;
@Entity
@Data
public class Product {
@Id
@GeneratedValue
private Long id;
private String name;
private String content;
private String inform;
private int price;
private int real_price;
private String category;
private String creater;
public void setCreater(String creater) {
this.creater = creater;
}
public Product(String name, String content, String inform, int price, int real_price, String category, String creater) {
this.name = name;
this.content = content;
this.inform = inform;
this.price = price;
this.real_price = real_price;
this.category = category;
this.creater = creater;
}
public Product(String name) {
this.name = name;
}
public Product() {
}
}
| 1,088 | 0.67739 | 0.67739 | 46 | 22.652174 | 20.429323 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.673913 | false | false | 9 |
d1a2f1755a156c9b9b156949c719ce674936ee86 | 11,802,570,138,847 | f576053c06ddc09116bc02f327f28fadbea1ee41 | /Alkosto/src/main/java/co/com/alkosto/tasks/WaitToCloseAdvertisingPage.java | ac442c2d149af4882595203aed9d5ccccc6fe0bd | [] | no_license | Cleyly/Reto-Sophos | https://github.com/Cleyly/Reto-Sophos | 0d2cf183eee1dc16a7022e2c3a6c8024eb117b30 | 22d613ad75295c515454ed37e0a46f0584bca513 | refs/heads/master | 2020-04-28T23:05:14.244000 | 2019-03-14T15:44:38 | 2019-03-14T15:44:38 | 175,641,976 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package co.com.alkosto.tasks;
import static net.serenitybdd.screenplay.Tasks.instrumented;
import static net.serenitybdd.screenplay.matchers.WebElementStateMatchers.isVisible;
import co.com.alkosto.userinterfaces.AlkostoHomePage;
import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.screenplay.Task;
import net.serenitybdd.screenplay.waits.WaitUntil;
public class WaitToCloseAdvertisingPage implements Task {
@Override
public <T extends Actor> void performAs(T actor) {
actor.attemptsTo(WaitUntil.the(AlkostoHomePage.BUTTON_CLOSE_IMAGE, isVisible()));
}
public static WaitToCloseAdvertisingPage to() {
return instrumented(WaitToCloseAdvertisingPage.class);
}
}
| UTF-8 | Java | 700 | java | WaitToCloseAdvertisingPage.java | Java | [] | null | [] | package co.com.alkosto.tasks;
import static net.serenitybdd.screenplay.Tasks.instrumented;
import static net.serenitybdd.screenplay.matchers.WebElementStateMatchers.isVisible;
import co.com.alkosto.userinterfaces.AlkostoHomePage;
import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.screenplay.Task;
import net.serenitybdd.screenplay.waits.WaitUntil;
public class WaitToCloseAdvertisingPage implements Task {
@Override
public <T extends Actor> void performAs(T actor) {
actor.attemptsTo(WaitUntil.the(AlkostoHomePage.BUTTON_CLOSE_IMAGE, isVisible()));
}
public static WaitToCloseAdvertisingPage to() {
return instrumented(WaitToCloseAdvertisingPage.class);
}
}
| 700 | 0.808571 | 0.808571 | 27 | 24.925926 | 28.1266 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 9 |
4bcf37fc995ad75423435fc7746828d7b5a98391 | 32,521,492,387,435 | 784963998e78935b363b9b405c24afb0c295d82b | /app/src/main/java/fr/simona/smartlamp/device/repository/DeviceRepositoryImpl.java | dfcd198297238496aa71ad600ccd72c8c56c8b21 | [] | no_license | Amraneze/SmartLamp | https://github.com/Amraneze/SmartLamp | 9331932f1a5a267493ee4ab1e555f90818124c78 | 480da57ec6c30a0562034e57654417cacca38652 | refs/heads/master | 2021-03-24T12:11:36.059000 | 2018-01-23T22:30:20 | 2018-01-23T22:30:20 | 111,798,574 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package fr.simona.smartlamp.device.repository;
import java.util.ArrayList;
import java.util.List;
import io.realm.Realm;
import fr.simona.smartlamp.device.model.DeviceInfo;
import io.realm.RealmResults;
/**
* Created by Amrane Ait Zeouay on 26-Nov-17.
*/
public class DeviceRepositoryImpl implements DeviceRepository {
@Override
public void saveDevice(DeviceInfo device) {
Realm realm = Realm.getDefaultInstance();
realm.beginTransaction();
realm.copyToRealm(device);
realm.commitTransaction();
realm.close();
}
@Override
public List<DeviceInfo> getPairedDevices() {
ArrayList<DeviceInfo> pairedDevices = new ArrayList<>();
Realm realm = Realm.getDefaultInstance();
RealmResults<DeviceInfo> results = realm
.where(DeviceInfo.class)
.findAll();
DeviceInfo copy;
for(DeviceInfo measurement : results) {
copy = new DeviceInfo(measurement);
pairedDevices.add(copy);
}
realm.close();
return pairedDevices;
}
@Override
public void unpairDevice(DeviceInfo device) {
Realm realm = Realm.getDefaultInstance();
realm.beginTransaction();
RealmResults<DeviceInfo> results = realm
.where(DeviceInfo.class)
.equalTo(MAC_FIELD, device.getMac())
.findAll();
results.deleteAllFromRealm();
realm.commitTransaction();
realm.close();
}
} | UTF-8 | Java | 1,519 | java | DeviceRepositoryImpl.java | Java | [
{
"context": ";\nimport io.realm.RealmResults;\n\n/**\n * Created by Amrane Ait Zeouay on 26-Nov-17.\n */\n\npublic class DeviceRepositoryI",
"end": 241,
"score": 0.9998943209648132,
"start": 224,
"tag": "NAME",
"value": "Amrane Ait Zeouay"
}
] | null | [] | package fr.simona.smartlamp.device.repository;
import java.util.ArrayList;
import java.util.List;
import io.realm.Realm;
import fr.simona.smartlamp.device.model.DeviceInfo;
import io.realm.RealmResults;
/**
* Created by <NAME> on 26-Nov-17.
*/
public class DeviceRepositoryImpl implements DeviceRepository {
@Override
public void saveDevice(DeviceInfo device) {
Realm realm = Realm.getDefaultInstance();
realm.beginTransaction();
realm.copyToRealm(device);
realm.commitTransaction();
realm.close();
}
@Override
public List<DeviceInfo> getPairedDevices() {
ArrayList<DeviceInfo> pairedDevices = new ArrayList<>();
Realm realm = Realm.getDefaultInstance();
RealmResults<DeviceInfo> results = realm
.where(DeviceInfo.class)
.findAll();
DeviceInfo copy;
for(DeviceInfo measurement : results) {
copy = new DeviceInfo(measurement);
pairedDevices.add(copy);
}
realm.close();
return pairedDevices;
}
@Override
public void unpairDevice(DeviceInfo device) {
Realm realm = Realm.getDefaultInstance();
realm.beginTransaction();
RealmResults<DeviceInfo> results = realm
.where(DeviceInfo.class)
.equalTo(MAC_FIELD, device.getMac())
.findAll();
results.deleteAllFromRealm();
realm.commitTransaction();
realm.close();
}
} | 1,508 | 0.631336 | 0.628703 | 54 | 27.148148 | 19.203016 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.481481 | false | false | 9 |
bdb0fc19c60b0a14b2bbf7b2ccab147dd6f36580 | 23,347,442,258,700 | a0c5bbd09df3fb573cb9e4648bf5655a94182d28 | /src/main/java/com/rentancy/inventorygraphql/api/Agreement.java | f0f718b83ad3ea4d5b01d9c36e29ded6c65fe224 | [] | no_license | Programmer129/RentancyGraphQLExplorer | https://github.com/Programmer129/RentancyGraphQLExplorer | 002f689fac25e9dbd281786c5b8e5247f83ba404 | 8df79b8e775cd9273a5121ae5e2dffca0c6d7aa3 | refs/heads/master | 2021-01-02T20:50:58.276000 | 2020-03-07T19:12:11 | 2020-03-07T19:12:11 | 239,794,377 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.rentancy.inventorygraphql.api;
import lombok.Data;
import java.time.LocalDate;
@Data
public class Agreement {
private final long id;
private final String userId;
private final long propertyId;
private final boolean furnished;
private final LocalDate signedDate;
private final LocalDate contractStartDate;
private final LocalDate contractEndDate;
private final String deposit;
private final Inventory inventory;
@Data
public static class Inventory {
private final int wallsAndCeilings;
private final int floorCoverings;
private final int windows;
private final int doors;
private final int lights;
private final int furniture;
private final int skirting;
}
}
| UTF-8 | Java | 778 | java | Agreement.java | Java | [] | null | [] | package com.rentancy.inventorygraphql.api;
import lombok.Data;
import java.time.LocalDate;
@Data
public class Agreement {
private final long id;
private final String userId;
private final long propertyId;
private final boolean furnished;
private final LocalDate signedDate;
private final LocalDate contractStartDate;
private final LocalDate contractEndDate;
private final String deposit;
private final Inventory inventory;
@Data
public static class Inventory {
private final int wallsAndCeilings;
private final int floorCoverings;
private final int windows;
private final int doors;
private final int lights;
private final int furniture;
private final int skirting;
}
}
| 778 | 0.714653 | 0.714653 | 29 | 25.827587 | 15.558719 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.655172 | false | false | 9 |
ad379af63709bddb199061a9dee4e85415d98054 | 14,525,579,421,776 | 6806f9c5892613123f9f6305ab4458f3d5f2691a | /spring-boot-util-web/src/main/java/com/github/edgar615/util/spring/web/RequestLoggerFilter.java | 11197991c65d8e6639027579611c103d5400776b | [] | no_license | edgar615/microservice-scaffold | https://github.com/edgar615/microservice-scaffold | 19f3b1f3ece78347ee8f2d3505fcdae551243c89 | 8b52122d78b07103b338e3d8865a01081a49fc3b | refs/heads/master | 2018-10-10T11:25:43.943000 | 2018-10-08T01:15:01 | 2018-10-08T01:15:01 | 128,588,172 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.github.edgar615.util.spring.web;
import com.google.common.base.Joiner;
import com.google.common.base.Strings;
import com.google.common.collect.Iterators;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.web.filter.OncePerRequestFilter;
import org.springframework.web.util.ContentCachingRequestWrapper;
import org.springframework.web.util.ContentCachingResponseWrapper;
import org.springframework.web.util.WebUtils;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.*;
/**
* Doogies very cool HTTP request logging
* <p>
* There is also {@link org.springframework.web.filter.CommonsRequestLoggingFilter} but it
* cannot log request method
* And it cannot easily be extended.
* <p>
* https://mdeinum.wordpress.com/2015/07/01/spring-framework-hidden-gems/
* http://stackoverflow.com/questions/8933054/how-to-read-and-copy-the-http-servlet-response
* -output-stream-content-for-logging
*/
public class RequestLoggerFilter extends OncePerRequestFilter {
private static final Logger LOGGER = LoggerFactory.getLogger(RequestLoggerFilter.class);
// private boolean includeResponsePayload = true;
private final List<String> ignorePrefixes = new ArrayList<>();
private int maxPayloadLength = 1000;
private boolean logReqBody = true;
/**
* Log each request and respponse with full Request URI, content payload and duration of the
* request in ms.
*
* @param request the request
* @param response the response
* @param filterChain chain of filters
* @throws ServletException
* @throws IOException
*/
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
FilterChain filterChain) throws ServletException, IOException {
String url = request.getServletPath();
for (String prefix : ignorePrefixes) {
if (url.startsWith(prefix)) {
filterChain.doFilter(request, response);
return;
}
}
// //从请求头中取出X-Request-Id,用于全局跟踪ID,如果未找到,自动生成一个新的跟踪ID
String traceId = request.getHeader("X-Request-Id");
if (Strings.isNullOrEmpty(traceId)) {
traceId = UUID.randomUUID().toString();
}
MDC.put("x-request-id", traceId);
// ========= Log request and response payload ("body") ========
// We CANNOT simply read the request payload here, because then the InputStream would be
// consumed and cannot be read again by the actual processing/server.
// String reqBody = DoogiesUtil._stream2String(request.getInputStream()); // THIS WOULD
// NOT WORK!
// So we need to apply some stronger magic here :-)
ResettableStreamRequestWrapper wrappedRequest
= new ResettableStreamRequestWrapper(request);
ContentCachingResponseWrapper wrappedResponse = new ContentCachingResponseWrapper(response);
// I can only log the request's body AFTER the request has been made and
// ContentCachingRequestWrapper did its work.
String body = wrappedRequest.getRequestBody();
// [跟踪ID] [SR] [类型] [接口] [入参]...[入参] [调用方]
LOGGER.info("[{}] [SR] [HTTP] [{} {}] [{}] [{}] [{}] [{}]", traceId, request.getMethod(), request.getServletPath(),
headerString(request), paramString(request),
!logReqBody || Strings.isNullOrEmpty(body) ? "no body" : body,
getClientIp(request));
long startTime = System.currentTimeMillis();
filterChain.doFilter(wrappedRequest,
wrappedResponse); // ======== This performs the actual request!
wrappedResponse.addHeader("X-Request-Id", traceId);
//[跟踪ID] [SS] [类型] [结果] ... [结果] [耗时]
LOGGER.info("[{}] [SS] [HTTP] [{}] [{}] [{}bytes] [{}ms]", traceId,
response.getStatus(),
respHeaderString(response),
wrappedResponse.getContentAsByteArray().length,
System.currentTimeMillis() - startTime);
wrappedResponse
.copyBodyToResponse();
MDC.remove("x-request-id");
// IMPORTANT: copy content of response back into original response
}
public void addIgnorePrefix(String prefix) {
ignorePrefixes.add(prefix);
}
public void setLogReqBody(boolean logReqBody) {
this.logReqBody = logReqBody;
}
@Deprecated
private String getBody(ContentCachingRequestWrapper request) {
// wrap request to make sure we can read the body of the request (otherwise it will be consumed by the actual
// request handler)
ContentCachingRequestWrapper wrapper = WebUtils
.getNativeRequest(request, ContentCachingRequestWrapper.class);
if (wrapper != null) {
byte[] buf = wrapper.getContentAsByteArray();
if (buf.length > 0) {
String payload;
try {
payload = new String(buf, 0, buf.length, wrapper.getCharacterEncoding());
} catch (UnsupportedEncodingException ex) {
payload = "unknown";
}
return payload;
}
}
return "no body";
}
@Deprecated
private String getContentAsString(byte[] buf, int maxLength, String charsetName) {
if (buf == null || buf.length == 0) return "";
int length = Math.min(buf.length, this.maxPayloadLength);
try {
return new String(buf, 0, length, charsetName);
} catch (UnsupportedEncodingException ex) {
return "Unsupported Encoding";
}
}
private String headerString(HttpServletRequest request) {
StringBuilder sb = new StringBuilder();
Enumeration<String> headers = request.getHeaderNames();
while (headers.hasMoreElements()) {
String name = headers.nextElement();
Enumeration<String> value = request.getHeaders(name);
sb.append(name).append(":")
.append(Joiner.on(",").join(Iterators.forEnumeration(value)))
.append(";");
}
if (sb.length() == 0) {
return "no header";
}
return sb.toString();
}
private String paramString(HttpServletRequest request) {
StringBuilder sb = new StringBuilder();
Enumeration<String> names = request.getParameterNames();
while (names.hasMoreElements()) {
String name = names.nextElement();
String[] values = request.getParameterValues(name);
sb.append(name).append(":")
.append(Joiner.on(",").join(Iterators.forArray(values)))
.append(";");
}
if (sb.length() == 0) {
return "no param";
}
return sb.toString();
}
private String respHeaderString(HttpServletResponse response) {
StringBuilder sb = new StringBuilder();
Collection<String> headers = response.getHeaderNames();
for (String name : headers) {
sb.append(name).append(":")
.append(Joiner.on(",").join(response.getHeaders(name)))
.append(";");
}
if (sb.length() == 0) {
return "no header";
}
return sb.toString();
}
private String getClientIp(HttpServletRequest request) {
String ip = request.getHeader("X-Forwarded-For");
if (!Strings.isNullOrEmpty(ip) && !"unKnown".equalsIgnoreCase(ip)) {
//多次反向代理后会有多个ip值,第一个ip才是真实ip
int index = ip.indexOf(",");
if (index != -1) {
return ip.substring(0, index);
} else {
return ip;
}
}
ip = request.getHeader("X-Real-IP");
if (!Strings.isNullOrEmpty(ip) && !"unKnown".equalsIgnoreCase(ip)) {
return ip;
}
return request.getRemoteHost();
}
} | UTF-8 | Java | 7,771 | java | RequestLoggerFilter.java | Java | [
{
"context": "package com.github.edgar615.util.spring.web;\n\nimport com.google.common.base.J",
"end": 27,
"score": 0.9993091821670532,
"start": 19,
"tag": "USERNAME",
"value": "edgar615"
}
] | null | [] | package com.github.edgar615.util.spring.web;
import com.google.common.base.Joiner;
import com.google.common.base.Strings;
import com.google.common.collect.Iterators;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.web.filter.OncePerRequestFilter;
import org.springframework.web.util.ContentCachingRequestWrapper;
import org.springframework.web.util.ContentCachingResponseWrapper;
import org.springframework.web.util.WebUtils;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.*;
/**
* Doogies very cool HTTP request logging
* <p>
* There is also {@link org.springframework.web.filter.CommonsRequestLoggingFilter} but it
* cannot log request method
* And it cannot easily be extended.
* <p>
* https://mdeinum.wordpress.com/2015/07/01/spring-framework-hidden-gems/
* http://stackoverflow.com/questions/8933054/how-to-read-and-copy-the-http-servlet-response
* -output-stream-content-for-logging
*/
public class RequestLoggerFilter extends OncePerRequestFilter {
private static final Logger LOGGER = LoggerFactory.getLogger(RequestLoggerFilter.class);
// private boolean includeResponsePayload = true;
private final List<String> ignorePrefixes = new ArrayList<>();
private int maxPayloadLength = 1000;
private boolean logReqBody = true;
/**
* Log each request and respponse with full Request URI, content payload and duration of the
* request in ms.
*
* @param request the request
* @param response the response
* @param filterChain chain of filters
* @throws ServletException
* @throws IOException
*/
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
FilterChain filterChain) throws ServletException, IOException {
String url = request.getServletPath();
for (String prefix : ignorePrefixes) {
if (url.startsWith(prefix)) {
filterChain.doFilter(request, response);
return;
}
}
// //从请求头中取出X-Request-Id,用于全局跟踪ID,如果未找到,自动生成一个新的跟踪ID
String traceId = request.getHeader("X-Request-Id");
if (Strings.isNullOrEmpty(traceId)) {
traceId = UUID.randomUUID().toString();
}
MDC.put("x-request-id", traceId);
// ========= Log request and response payload ("body") ========
// We CANNOT simply read the request payload here, because then the InputStream would be
// consumed and cannot be read again by the actual processing/server.
// String reqBody = DoogiesUtil._stream2String(request.getInputStream()); // THIS WOULD
// NOT WORK!
// So we need to apply some stronger magic here :-)
ResettableStreamRequestWrapper wrappedRequest
= new ResettableStreamRequestWrapper(request);
ContentCachingResponseWrapper wrappedResponse = new ContentCachingResponseWrapper(response);
// I can only log the request's body AFTER the request has been made and
// ContentCachingRequestWrapper did its work.
String body = wrappedRequest.getRequestBody();
// [跟踪ID] [SR] [类型] [接口] [入参]...[入参] [调用方]
LOGGER.info("[{}] [SR] [HTTP] [{} {}] [{}] [{}] [{}] [{}]", traceId, request.getMethod(), request.getServletPath(),
headerString(request), paramString(request),
!logReqBody || Strings.isNullOrEmpty(body) ? "no body" : body,
getClientIp(request));
long startTime = System.currentTimeMillis();
filterChain.doFilter(wrappedRequest,
wrappedResponse); // ======== This performs the actual request!
wrappedResponse.addHeader("X-Request-Id", traceId);
//[跟踪ID] [SS] [类型] [结果] ... [结果] [耗时]
LOGGER.info("[{}] [SS] [HTTP] [{}] [{}] [{}bytes] [{}ms]", traceId,
response.getStatus(),
respHeaderString(response),
wrappedResponse.getContentAsByteArray().length,
System.currentTimeMillis() - startTime);
wrappedResponse
.copyBodyToResponse();
MDC.remove("x-request-id");
// IMPORTANT: copy content of response back into original response
}
public void addIgnorePrefix(String prefix) {
ignorePrefixes.add(prefix);
}
public void setLogReqBody(boolean logReqBody) {
this.logReqBody = logReqBody;
}
@Deprecated
private String getBody(ContentCachingRequestWrapper request) {
// wrap request to make sure we can read the body of the request (otherwise it will be consumed by the actual
// request handler)
ContentCachingRequestWrapper wrapper = WebUtils
.getNativeRequest(request, ContentCachingRequestWrapper.class);
if (wrapper != null) {
byte[] buf = wrapper.getContentAsByteArray();
if (buf.length > 0) {
String payload;
try {
payload = new String(buf, 0, buf.length, wrapper.getCharacterEncoding());
} catch (UnsupportedEncodingException ex) {
payload = "unknown";
}
return payload;
}
}
return "no body";
}
@Deprecated
private String getContentAsString(byte[] buf, int maxLength, String charsetName) {
if (buf == null || buf.length == 0) return "";
int length = Math.min(buf.length, this.maxPayloadLength);
try {
return new String(buf, 0, length, charsetName);
} catch (UnsupportedEncodingException ex) {
return "Unsupported Encoding";
}
}
private String headerString(HttpServletRequest request) {
StringBuilder sb = new StringBuilder();
Enumeration<String> headers = request.getHeaderNames();
while (headers.hasMoreElements()) {
String name = headers.nextElement();
Enumeration<String> value = request.getHeaders(name);
sb.append(name).append(":")
.append(Joiner.on(",").join(Iterators.forEnumeration(value)))
.append(";");
}
if (sb.length() == 0) {
return "no header";
}
return sb.toString();
}
private String paramString(HttpServletRequest request) {
StringBuilder sb = new StringBuilder();
Enumeration<String> names = request.getParameterNames();
while (names.hasMoreElements()) {
String name = names.nextElement();
String[] values = request.getParameterValues(name);
sb.append(name).append(":")
.append(Joiner.on(",").join(Iterators.forArray(values)))
.append(";");
}
if (sb.length() == 0) {
return "no param";
}
return sb.toString();
}
private String respHeaderString(HttpServletResponse response) {
StringBuilder sb = new StringBuilder();
Collection<String> headers = response.getHeaderNames();
for (String name : headers) {
sb.append(name).append(":")
.append(Joiner.on(",").join(response.getHeaders(name)))
.append(";");
}
if (sb.length() == 0) {
return "no header";
}
return sb.toString();
}
private String getClientIp(HttpServletRequest request) {
String ip = request.getHeader("X-Forwarded-For");
if (!Strings.isNullOrEmpty(ip) && !"unKnown".equalsIgnoreCase(ip)) {
//多次反向代理后会有多个ip值,第一个ip才是真实ip
int index = ip.indexOf(",");
if (index != -1) {
return ip.substring(0, index);
} else {
return ip;
}
}
ip = request.getHeader("X-Real-IP");
if (!Strings.isNullOrEmpty(ip) && !"unKnown".equalsIgnoreCase(ip)) {
return ip;
}
return request.getRemoteHost();
}
} | 7,771 | 0.668897 | 0.664305 | 215 | 34.460464 | 26.982803 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.567442 | false | false | 9 |
786c86ec3076ebcb56ea7b213bfd97f3189b4df8 | 32,856,499,877,938 | dc5a65a6ad41a5bd6caa95f27f65b5ab483b0ab2 | /src/main/java/com/acl/utils/util/UUIDUtils.java | 7f64961d8283599fb97f1ce32f096fd94a40538a | [] | no_license | longxionga/mingruida | https://github.com/longxionga/mingruida | 06b88b1bbf44853ffabade6923855c4b4c112bc5 | b776dae9f5292b848e18a3a3fe68b095bc3adebe | refs/heads/master | 2022-07-21T00:41:48.509000 | 2019-07-29T01:57:11 | 2019-07-29T01:57:11 | 199,159,948 | 0 | 0 | null | false | 2022-06-25T07:29:57 | 2019-07-27T12:07:06 | 2019-07-29T01:57:38 | 2022-06-25T07:29:56 | 11,992 | 0 | 0 | 3 | JavaScript | false | false | /*
package com.acl.utils.util;
import java.util.UUID;
*/
/**
* <b>模块描述 : </b>UUID处理工具类<br/>
* <b>使用描述 : </b><br/>
* <b>JDK版本 : </b>JDK 1.6<br/>
* <b>作者 : </b>辜家乐<br/>
* <b>创建日期 : </b>2009-01-01<br/>
* <b>创建版本 : </b>v1.0<br/>
* ###############修改记录###############<br/>
* …………v1.0<br/>
* 修改日期 : 2009-01-01<br/>
* 修改人 : 辜家乐<br/>
* 修改原因 : -<br/>
* 修改说明 : 初始建立<br/>
* 代码备注 : -<br/>
* ####################################<br/>
* @author 辜家乐
*//*
public final class UUIDUtils {
private UUIDUtils(){}
*/
/**
* 生成UUID
* @return String
*//*
public static String createUUId() {
UUID uuid = UUID.randomUUID();
return StringUtils.removeSameString(uuid.toString(), "-");
}
}
*/
| UTF-8 | Java | 836 | java | UUIDUtils.java | Java | [
{
"context": "/>\n * <b>JDK版本\t: </b>JDK 1.6<br/>\n * <b>作者\t\t: </b>辜家乐<br/>\n * <b>创建日期\t: </b>2009-01-01<br/>\n * <b>创建版",
"end": 166,
"score": 0.5967023968696594,
"start": 165,
"tag": "USERNAME",
"value": "辜"
},
{
"context": "/>\n * <b>JDK版本\t: </b>JDK 1.6<br/>\n * <b>作者\t\t: </b>辜家乐<br/>\n * <b>创建日期\t: </b>2009-01-01<br/>\n * <b>创建版",
"end": 166,
"score": 0.4360646903514862,
"start": 165,
"tag": "NAME",
"value": "辜"
},
{
"context": ">\n * <b>JDK版本\t: </b>JDK 1.6<br/>\n * <b>作者\t\t: </b>辜家乐<br/>\n * <b>创建日期\t: </b>2009-01-01<br/>\n * <b>创建版本\t",
"end": 168,
"score": 0.6753808856010437,
"start": 166,
"tag": "USERNAME",
"value": "家乐"
},
{
"context": "………v1.0<br/>\n * 修改日期\t: 2009-01-01<br/>\n * 修改人\t\t: 辜家乐<br/>\n * 修改原因\t: -<br/>\n * 修改说明\t: 初始建立<br/>\n * 代码备注",
"end": 333,
"score": 0.48072975873947144,
"start": 331,
"tag": "NAME",
"value": "家乐"
},
{
"context": "#################################<br/>\n * @author 辜家乐\n *//*\n\npublic final class UUIDUtils {\n\n\tprivate U",
"end": 452,
"score": 0.711820125579834,
"start": 449,
"tag": "NAME",
"value": "辜家乐"
}
] | null | [] | /*
package com.acl.utils.util;
import java.util.UUID;
*/
/**
* <b>模块描述 : </b>UUID处理工具类<br/>
* <b>使用描述 : </b><br/>
* <b>JDK版本 : </b>JDK 1.6<br/>
* <b>作者 : </b>辜家乐<br/>
* <b>创建日期 : </b>2009-01-01<br/>
* <b>创建版本 : </b>v1.0<br/>
* ###############修改记录###############<br/>
* …………v1.0<br/>
* 修改日期 : 2009-01-01<br/>
* 修改人 : 辜家乐<br/>
* 修改原因 : -<br/>
* 修改说明 : 初始建立<br/>
* 代码备注 : -<br/>
* ####################################<br/>
* @author 辜家乐
*//*
public final class UUIDUtils {
private UUIDUtils(){}
*/
/**
* 生成UUID
* @return String
*//*
public static String createUUId() {
UUID uuid = UUID.randomUUID();
return StringUtils.removeSameString(uuid.toString(), "-");
}
}
*/
| 836 | 0.477208 | 0.445869 | 40 | 16.549999 | 14.735926 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false | 9 |
cb5dcd0faaace9a6daa9abda11d4b075ffdfcb30 | 13,752,485,283,290 | ea502d84d8be6fb3d1e72ec296007d7e0fdb8875 | /jso-common/datamodel/src/es/model/SItem.java | 525a19e7b538e0f5bfad9c370e0e79ff17ceb127 | [] | no_license | wangwangduizuodalao/ai | https://github.com/wangwangduizuodalao/ai | 4603fa50f47337f6a27fb6bcd5d2d2bf881423c2 | 2142ed66976a49383d1ff24775097dc8c520a444 | refs/heads/master | 2023-03-31T05:05:51.670000 | 2016-11-09T06:14:29 | 2016-11-09T06:14:29 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package es.model;
import java.io.Serializable;
import bk.biz.memory.util.Cacheable;
import es.datamodel.ContentInfo;
public class SItem implements Serializable,Cacheable{
private long id;
private static final long serialVersionUID = 1L;
public SItem(){
}
public SItem(long _id){
id=_id;
}
public int getSize() {
// TODO Auto-generated method stub
return 0;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
}
| UTF-8 | Java | 504 | java | SItem.java | Java | [] | null | [] | package es.model;
import java.io.Serializable;
import bk.biz.memory.util.Cacheable;
import es.datamodel.ContentInfo;
public class SItem implements Serializable,Cacheable{
private long id;
private static final long serialVersionUID = 1L;
public SItem(){
}
public SItem(long _id){
id=_id;
}
public int getSize() {
// TODO Auto-generated method stub
return 0;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
}
| 504 | 0.654762 | 0.650794 | 31 | 14.258064 | 15.206042 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.129032 | false | false | 9 |
2f185f852b2f7b9f5c89327fffef21326f152660 | 1,786,706,420,650 | b313b4ef43fba4747fcdd9ceb4c5c66ca7ee2a24 | /br.ufes.inf.nemo.ontouml.ontoumlprime.tests/src-gen/br/ufes/inf/nemo/ontouml/PrimeOntoUML/tests/ComplexDataTypeTest.java | 24b05d58c8862763c820779e1aaaa3bd11ecf892 | [] | no_license | nemo-ufes/ontoumlprime | https://github.com/nemo-ufes/ontoumlprime | 0a70a085d83b2064d9b27f15f2965d06c6c2910a | 774bb861886f5621fcfd01d9255810f03569b067 | refs/heads/master | 2023-05-03T10:35:20.509000 | 2023-04-26T10:19:08 | 2023-04-26T10:19:08 | 6,246,310 | 2 | 1 | null | false | 2013-10-22T17:26:06 | 2012-10-16T15:07:33 | 2013-10-22T17:26:06 | 2013-10-22T17:26:06 | 958 | null | 1 | 0 | null | null | null | /**
*/
package br.ufes.inf.nemo.ontouml.PrimeOntoUML.tests;
import br.ufes.inf.nemo.ontouml.PrimeOntoUML.ComplexDataType;
import br.ufes.inf.nemo.ontouml.PrimeOntoUML.PrimeOntoUMLFactory;
import junit.textui.TestRunner;
/**
* <!-- begin-user-doc -->
* A test case for the model object '<em><b>Complex Data Type</b></em>'.
* <!-- end-user-doc -->
* @generated
*/
public class ComplexDataTypeTest extends UserDefinedDataTypeTest
{
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static void main(String[] args)
{
TestRunner.run(ComplexDataTypeTest.class);
}
/**
* Constructs a new Complex Data Type test case with the given name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ComplexDataTypeTest(String name)
{
super(name);
}
/**
* Returns the fixture for this Complex Data Type test case.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected ComplexDataType getFixture()
{
return (ComplexDataType)fixture;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see junit.framework.TestCase#setUp()
* @generated
*/
@Override
protected void setUp() throws Exception
{
setFixture(PrimeOntoUMLFactory.eINSTANCE.createComplexDataType());
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see junit.framework.TestCase#tearDown()
* @generated
*/
@Override
protected void tearDown() throws Exception
{
setFixture(null);
}
} //ComplexDataTypeTest
| UTF-8 | Java | 1,592 | java | ComplexDataTypeTest.java | Java | [] | null | [] | /**
*/
package br.ufes.inf.nemo.ontouml.PrimeOntoUML.tests;
import br.ufes.inf.nemo.ontouml.PrimeOntoUML.ComplexDataType;
import br.ufes.inf.nemo.ontouml.PrimeOntoUML.PrimeOntoUMLFactory;
import junit.textui.TestRunner;
/**
* <!-- begin-user-doc -->
* A test case for the model object '<em><b>Complex Data Type</b></em>'.
* <!-- end-user-doc -->
* @generated
*/
public class ComplexDataTypeTest extends UserDefinedDataTypeTest
{
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static void main(String[] args)
{
TestRunner.run(ComplexDataTypeTest.class);
}
/**
* Constructs a new Complex Data Type test case with the given name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ComplexDataTypeTest(String name)
{
super(name);
}
/**
* Returns the fixture for this Complex Data Type test case.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected ComplexDataType getFixture()
{
return (ComplexDataType)fixture;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see junit.framework.TestCase#setUp()
* @generated
*/
@Override
protected void setUp() throws Exception
{
setFixture(PrimeOntoUMLFactory.eINSTANCE.createComplexDataType());
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see junit.framework.TestCase#tearDown()
* @generated
*/
@Override
protected void tearDown() throws Exception
{
setFixture(null);
}
} //ComplexDataTypeTest
| 1,592 | 0.625 | 0.625 | 76 | 19.947369 | 20.457205 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.118421 | false | false | 9 |
e0dc435d545c9fe234fa7fedbe1421044c25cc9d | 15,401,752,747,136 | f160f7ffb750c12f1421b5107947003ed524a2f9 | /Yubotu.0.1/src/Posicio.java | 73c5ff3781bbe082d85c16b12e6d4dcbc7f576cf | [] | no_license | dtordera/miscelaneous | https://github.com/dtordera/miscelaneous | 8c49df86c4d3895c8056f4bc1e55fb1646765c57 | a01a86f07b494f370841be5f2f0eb4da0ed66a8d | refs/heads/master | 2021-01-24T18:58:24.074000 | 2017-03-25T13:20:25 | 2017-03-25T13:20:25 | 86,157,734 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class Posicio {
Index i;
boolean o;
public Posicio(int x,int y,boolean h){i=new Index(x,y);o=h;}
public Posicio(Index I, boolean h){i=new Index(I.x,I.y);o=h;}
public boolean e(Posicio p){return ei(p)&&eo(p);}
public boolean ei(Posicio p){return(p.i.x==i.x)&&(p.i.y==i.y);}
public boolean eo(Posicio p){return(p.o==o);}
public void p(int x,int y,boolean k){i.x=x;i.y=y;o=k;}
public void p(Index I,boolean k){p(I.x,I.y,k);}
public Index J(int l){return J(l,o);}
public Index J(int l,boolean h){return new Index(i.x+l*(h==k.h?1:0),i.y+l*(h==k.v?1:0));}
}
| UTF-8 | Java | 581 | java | Posicio.java | Java | [] | null | [] |
public class Posicio {
Index i;
boolean o;
public Posicio(int x,int y,boolean h){i=new Index(x,y);o=h;}
public Posicio(Index I, boolean h){i=new Index(I.x,I.y);o=h;}
public boolean e(Posicio p){return ei(p)&&eo(p);}
public boolean ei(Posicio p){return(p.i.x==i.x)&&(p.i.y==i.y);}
public boolean eo(Posicio p){return(p.o==o);}
public void p(int x,int y,boolean k){i.x=x;i.y=y;o=k;}
public void p(Index I,boolean k){p(I.x,I.y,k);}
public Index J(int l){return J(l,o);}
public Index J(int l,boolean h){return new Index(i.x+l*(h==k.h?1:0),i.y+l*(h==k.v?1:0));}
}
| 581 | 0.629948 | 0.623064 | 13 | 43.615383 | 24.981649 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.769231 | false | false | 9 |
ab87df719baabb80279333fcf7b4bf4d7bc43ef2 | 27,908,697,513,209 | cb2db5110d3aa6d11bb82d23ab9709a67971046d | /src/main/java/com/qad/db/config/EntityAuditAware.java | 3d892521c496d591b4a299eb7d6a1854743441cb | [
"MIT"
] | permissive | sandeepn26/leaguepanda-service | https://github.com/sandeepn26/leaguepanda-service | 4afe6e3a02a84cb59e268047a5022861f6ff42ea | 0e642c8eff366567fa69b8340bac8b5b02dc2c86 | refs/heads/master | 2020-04-13T10:06:04.158000 | 2019-08-16T06:16:22 | 2019-08-16T06:16:22 | 163,129,922 | 0 | 0 | MIT | false | 2020-07-01T22:20:29 | 2018-12-26T03:01:52 | 2019-08-16T06:16:53 | 2020-07-01T22:20:27 | 69 | 0 | 0 | 3 | Java | false | false | package com.qad.db.config;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.AuditorAware;
import org.springframework.stereotype.Component;
@Component(value = "entityAuditAware")
public class EntityAuditAware implements AuditorAware<Long> {
private static final Logger LOGGER = LoggerFactory.getLogger(EntityAuditAware.class);
@Override
public Optional<Long> getCurrentAuditor() {
LOGGER.info("");
return Optional.of(3L);
}
}
| UTF-8 | Java | 531 | java | EntityAuditAware.java | Java | [] | null | [] | package com.qad.db.config;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.AuditorAware;
import org.springframework.stereotype.Component;
@Component(value = "entityAuditAware")
public class EntityAuditAware implements AuditorAware<Long> {
private static final Logger LOGGER = LoggerFactory.getLogger(EntityAuditAware.class);
@Override
public Optional<Long> getCurrentAuditor() {
LOGGER.info("");
return Optional.of(3L);
}
}
| 531 | 0.764595 | 0.758945 | 19 | 25.947369 | 23.683157 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.947368 | false | false | 9 |
e5b3c32bbbe63edce342d73f28f3a6c2cfeeeea9 | 26,070,451,509,227 | df3604338f4fd806f6d4fa5918dd97af709a1d9b | /hw25/DLLNode.java | b9da121e0bba784ee4d28e9467043963af1cdaf4 | [] | no_license | woosuk3746/APCS2 | https://github.com/woosuk3746/APCS2 | db8cf4e38e9055cd93c1c5ac85d13f00d1372997 | 52c8c388a577bd026e2fe8d3e080f0d0cc7220a8 | refs/heads/master | 2018-09-23T07:53:15.967000 | 2018-06-06T20:52:44 | 2018-06-06T20:52:44 | 119,607,594 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /***********Generically typed version****************/
/*****************************************************
* class DLLNode
* Implements a doubly-linked node,
* for use in lists and other collection classes.
* Stores data of type String
*****************************************************/
public class DLLNode<T>
{
private T _cargo; //cargo may only be of type String
private DLLNode<T> _nextNode, _prevNode; //pointers to next, prev DLLNodes
//=====================CONSTRUCTOR==========================
public DLLNode( T str, DLLNode<T> before, DLLNode<T> after ){
_cargo = str;
_prevNode = before;
_nextNode = after;
}
//==========================================================
//================ACCESSORS=====================
public T getCargo() { return _cargo; }
public DLLNode<T> getPrev() { return _prevNode; }
public DLLNode<T> getNext() { return _nextNode; }
//==============================================
//================MUTATORS==================
public T setCargo( T newCargo ){
T retStr = getCargo();
_cargo = newCargo;
return retStr;
}
public DLLNode<T> setPrev( DLLNode<T> newNode ) {
DLLNode<T> retNode = getPrev();
_prevNode = newNode;
return retNode;
}
public DLLNode<T> setNext( DLLNode<T> newNode ) {
DLLNode<T> retNode = getNext();
_nextNode = newNode;
return retNode;
}
//==========================================
//toString method
public String toString(){ return _cargo.toString(); }
//main method for testing
public static void main( String[] args ){
DLLNode woo = new DLLNode("foo",null,null);
System.out.println( woo );
DLLNode boo = new DLLNode("moo",null,woo);
System.out.println( boo );
}
}//end class DLLNode
| UTF-8 | Java | 1,895 | java | DLLNode.java | Java | [] | null | [] | /***********Generically typed version****************/
/*****************************************************
* class DLLNode
* Implements a doubly-linked node,
* for use in lists and other collection classes.
* Stores data of type String
*****************************************************/
public class DLLNode<T>
{
private T _cargo; //cargo may only be of type String
private DLLNode<T> _nextNode, _prevNode; //pointers to next, prev DLLNodes
//=====================CONSTRUCTOR==========================
public DLLNode( T str, DLLNode<T> before, DLLNode<T> after ){
_cargo = str;
_prevNode = before;
_nextNode = after;
}
//==========================================================
//================ACCESSORS=====================
public T getCargo() { return _cargo; }
public DLLNode<T> getPrev() { return _prevNode; }
public DLLNode<T> getNext() { return _nextNode; }
//==============================================
//================MUTATORS==================
public T setCargo( T newCargo ){
T retStr = getCargo();
_cargo = newCargo;
return retStr;
}
public DLLNode<T> setPrev( DLLNode<T> newNode ) {
DLLNode<T> retNode = getPrev();
_prevNode = newNode;
return retNode;
}
public DLLNode<T> setNext( DLLNode<T> newNode ) {
DLLNode<T> retNode = getNext();
_nextNode = newNode;
return retNode;
}
//==========================================
//toString method
public String toString(){ return _cargo.toString(); }
//main method for testing
public static void main( String[] args ){
DLLNode woo = new DLLNode("foo",null,null);
System.out.println( woo );
DLLNode boo = new DLLNode("moo",null,woo);
System.out.println( boo );
}
}//end class DLLNode
| 1,895 | 0.47124 | 0.47124 | 61 | 30.065575 | 21.928249 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.508197 | false | false | 9 |
52c820138383a9a3faefd4ec2b7633a90286165e | 16,063,177,712,268 | 870ca8e9f72a209de29452a1751f424788fde376 | /src/test/java/utilities/ExtentListeners.java | 01e815e449fd12b42fae336ce1ee0e8e37de6861 | [] | no_license | JaishankarGitHub79/VideoGameProject | https://github.com/JaishankarGitHub79/VideoGameProject | 79bb08268863e163e065bc82a4ee2502705e784c | 2bfbe907372fc69425e34e4ce91d48dfd3dc588a | refs/heads/master | 2023-02-26T14:18:39.672000 | 2021-02-03T22:46:38 | 2021-02-03T22:46:38 | 330,491,201 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package utilities;
import java.util.Arrays;
import java.util.Date;
import org.testng.ITestContext;
import org.testng.ITestListener;
import org.testng.ITestResult;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.markuputils.ExtentColor;
import com.aventstack.extentreports.markuputils.Markup;
import com.aventstack.extentreports.markuputils.MarkupHelper;
public class ExtentListeners implements ITestListener {
static Date d = new Date();
static String fileName = "ExtentReport_" + d.toString().replace(":", "_").replace(" ", "_") + ".html";
private static ExtentReports extent = ExtentManager.createInstance(".\\reports\\" + fileName);
private static ExtentTest test;
public void onTestStart(ITestResult result) {
test = extent.createTest(result.getMethod().getMethodName());
}
public void onTestSuccess(ITestResult result) {
String testMethodName = result.getMethod().getMethodName();
String logMsg = "<b>" + "TestName: " + testMethodName.toUpperCase() + " PASSED" + "</b>";
Markup m = MarkupHelper.createLabel(logMsg, ExtentColor.GREEN);
test.pass(m);
}
public void onTestFailure(ITestResult result) {
String testMethodName = result.getMethod().getMethodName();
String logMsg = "<b>" + "TestName: " + testMethodName.toUpperCase() + " FAILED" + "</b>";
Markup m = MarkupHelper.createLabel(logMsg, ExtentColor.RED);
test.fail(m);
String exceptionMsg = Arrays.toString(result.getThrowable().getStackTrace());
test.fail("<details>" + "<summary>" + "<b>" + "<font color=" + "red>" + "Exception Occured:Click to view"
+ "</font>" + "</b>" + "</summary>" + exceptionMsg.replaceAll(",", "<br>") + "</details>");
/*
* try { ExtentManager.captureScreenshot(); test.fail("<b>" +
* "<font color=" + "red>" + "Screenshot of failure" + "</font>" +
* "</b>", MediaEntityBuilder.createScreenCaptureFromPath(ExtentManager.
* screenshotName) .build()); } catch (Exception e) { }
*/
}
public void onTestSkipped(ITestResult result) {
String testMethodName = result.getMethod().getMethodName();
String logMsg = "<b>" + "TestName: " + testMethodName.toUpperCase() + " SKIPPED" + "</b>";
Markup m = MarkupHelper.createLabel(logMsg, ExtentColor.AMBER);
test.skip(m);
}
public void onTestFailedButWithinSuccessPercentage(ITestResult result) {
}
public void onStart(ITestContext context) {
}
public void onFinish(ITestContext context) {
if (extent != null)
extent.flush();
}
}
| UTF-8 | Java | 2,538 | java | ExtentListeners.java | Java | [] | null | [] | package utilities;
import java.util.Arrays;
import java.util.Date;
import org.testng.ITestContext;
import org.testng.ITestListener;
import org.testng.ITestResult;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.markuputils.ExtentColor;
import com.aventstack.extentreports.markuputils.Markup;
import com.aventstack.extentreports.markuputils.MarkupHelper;
public class ExtentListeners implements ITestListener {
static Date d = new Date();
static String fileName = "ExtentReport_" + d.toString().replace(":", "_").replace(" ", "_") + ".html";
private static ExtentReports extent = ExtentManager.createInstance(".\\reports\\" + fileName);
private static ExtentTest test;
public void onTestStart(ITestResult result) {
test = extent.createTest(result.getMethod().getMethodName());
}
public void onTestSuccess(ITestResult result) {
String testMethodName = result.getMethod().getMethodName();
String logMsg = "<b>" + "TestName: " + testMethodName.toUpperCase() + " PASSED" + "</b>";
Markup m = MarkupHelper.createLabel(logMsg, ExtentColor.GREEN);
test.pass(m);
}
public void onTestFailure(ITestResult result) {
String testMethodName = result.getMethod().getMethodName();
String logMsg = "<b>" + "TestName: " + testMethodName.toUpperCase() + " FAILED" + "</b>";
Markup m = MarkupHelper.createLabel(logMsg, ExtentColor.RED);
test.fail(m);
String exceptionMsg = Arrays.toString(result.getThrowable().getStackTrace());
test.fail("<details>" + "<summary>" + "<b>" + "<font color=" + "red>" + "Exception Occured:Click to view"
+ "</font>" + "</b>" + "</summary>" + exceptionMsg.replaceAll(",", "<br>") + "</details>");
/*
* try { ExtentManager.captureScreenshot(); test.fail("<b>" +
* "<font color=" + "red>" + "Screenshot of failure" + "</font>" +
* "</b>", MediaEntityBuilder.createScreenCaptureFromPath(ExtentManager.
* screenshotName) .build()); } catch (Exception e) { }
*/
}
public void onTestSkipped(ITestResult result) {
String testMethodName = result.getMethod().getMethodName();
String logMsg = "<b>" + "TestName: " + testMethodName.toUpperCase() + " SKIPPED" + "</b>";
Markup m = MarkupHelper.createLabel(logMsg, ExtentColor.AMBER);
test.skip(m);
}
public void onTestFailedButWithinSuccessPercentage(ITestResult result) {
}
public void onStart(ITestContext context) {
}
public void onFinish(ITestContext context) {
if (extent != null)
extent.flush();
}
}
| 2,538 | 0.708038 | 0.708038 | 73 | 33.767124 | 32.708977 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.506849 | false | false | 9 |
3ad0970bb1a05d81830b70539ddb79f3e8541c6c | 10,952,166,657,868 | d3958de1d3c8dc3c15bc894552ef5e903850bdb3 | /Java on Eclipse/ch02/src/p217.java | 8253d891fbf193785114f9515eabfc30e1e249b7 | [] | no_license | champe0711/JavaFolder | https://github.com/champe0711/JavaFolder | acd44517a7b48feab6edb39431861c153af384af | 7b30ffc8eaf7400ffafb783245c379160ceb34f6 | refs/heads/master | 2020-12-02T06:40:05.910000 | 2017-07-11T10:22:55 | 2017-07-11T10:22:55 | 96,874,337 | 1 | 0 | null | false | 2017-07-18T13:37:39 | 2017-07-11T09:13:04 | 2017-07-11T18:04:41 | 2017-07-18T13:37:21 | 13,105 | 0 | 0 | 1 | Java | null | null |
import Misc.Car;
/**
* Name: carTester
* Programming Exercise: 17.
*
* Implement a class Car with the following properties. a car has a certain fuel efficiency (measured in miles/gallon or litter/km - pick one) and a certain amount of fuel in the gas tank. The efficiency is specified in the constructor, and the initial fuel level is 0. Supply a method drive that simulates driving the car for a certain distance, reducing the amount of gasoline in the fuel tank. Also supply methods getGasInTank, returning the current amount of gasoline in the fuel tank, and add Gas, to add gasoline to the fuel tank.
*
* You may assume that the drive method is never called with a distance that consumes more than the available gas. Supply a carTester class that tests all methods.
*/
public class p217 {
public static void main(String[] args) {
Car c = new Car(80.0);
c.addGas(50.0);
c.drive(100.0);
System.out.println("Gas Left = " + c.getGasTank());
}
}
| UTF-8 | Java | 1,031 | java | p217.java | Java | [
{
"context": "\nimport Misc.Car;\n\n/**\n * Name: carTester\n * Programming Exercise: 17.\n * \n * Implement a c",
"end": 41,
"score": 0.9988440871238708,
"start": 32,
"tag": "USERNAME",
"value": "carTester"
}
] | null | [] |
import Misc.Car;
/**
* Name: carTester
* Programming Exercise: 17.
*
* Implement a class Car with the following properties. a car has a certain fuel efficiency (measured in miles/gallon or litter/km - pick one) and a certain amount of fuel in the gas tank. The efficiency is specified in the constructor, and the initial fuel level is 0. Supply a method drive that simulates driving the car for a certain distance, reducing the amount of gasoline in the fuel tank. Also supply methods getGasInTank, returning the current amount of gasoline in the fuel tank, and add Gas, to add gasoline to the fuel tank.
*
* You may assume that the drive method is never called with a distance that consumes more than the available gas. Supply a carTester class that tests all methods.
*/
public class p217 {
public static void main(String[] args) {
Car c = new Car(80.0);
c.addGas(50.0);
c.drive(100.0);
System.out.println("Gas Left = " + c.getGasTank());
}
}
| 1,031 | 0.694471 | 0.678952 | 23 | 43.782608 | 110.551956 | 537 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.478261 | false | false | 9 |
051bdf826300dcd714b2b40ef0fac80ceae45dce | 5,093,831,249,493 | 78c7da546ec00f90167e1b8ba6e5df574f8a36bd | /src/main/java/com/zmh/dto/UserLoginDTO.java | 4ab1aa572c65b86edcf267da4cc4ef430f5904aa | [] | no_license | z573419235/MB_WXAPI | https://github.com/z573419235/MB_WXAPI | 106da7d0c8887ce322dd9564dba416f26c98fd11 | eeb72fc2bdb56a50edd8831aff8fe4f9ef7032b9 | refs/heads/master | 2020-03-29T14:19:48.609000 | 2018-10-25T14:47:35 | 2018-10-25T14:47:35 | 150,011,246 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.zmh.dto;
/**
* realms里查询数据库的数据
* */
public class UserLoginDTO {
private String SALESMANPHONE;
private int SALESMANSTATE=1;
public UserLoginDTO() {
}
public UserLoginDTO(String SALESMANPHONE) {
this.SALESMANPHONE = SALESMANPHONE;
}
public UserLoginDTO(String SALESMANPHONE, int SALESMANSTATE) {
this.SALESMANPHONE = SALESMANPHONE;
this.SALESMANSTATE = SALESMANSTATE;
}
public String getSALESMANPHONE() {
return SALESMANPHONE;
}
public void setSALESMANPHONE(String SALESMANPHONE) {
this.SALESMANPHONE = SALESMANPHONE;
}
public int getSALESMANSTATE() {
return SALESMANSTATE;
}
public void setSALESMANSTATE(int SALESMANSTATE) {
this.SALESMANSTATE = SALESMANSTATE;
}
}
| UTF-8 | Java | 823 | java | UserLoginDTO.java | Java | [] | null | [] | package com.zmh.dto;
/**
* realms里查询数据库的数据
* */
public class UserLoginDTO {
private String SALESMANPHONE;
private int SALESMANSTATE=1;
public UserLoginDTO() {
}
public UserLoginDTO(String SALESMANPHONE) {
this.SALESMANPHONE = SALESMANPHONE;
}
public UserLoginDTO(String SALESMANPHONE, int SALESMANSTATE) {
this.SALESMANPHONE = SALESMANPHONE;
this.SALESMANSTATE = SALESMANSTATE;
}
public String getSALESMANPHONE() {
return SALESMANPHONE;
}
public void setSALESMANPHONE(String SALESMANPHONE) {
this.SALESMANPHONE = SALESMANPHONE;
}
public int getSALESMANSTATE() {
return SALESMANSTATE;
}
public void setSALESMANSTATE(int SALESMANSTATE) {
this.SALESMANSTATE = SALESMANSTATE;
}
}
| 823 | 0.670807 | 0.669565 | 36 | 21.361111 | 19.849648 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.305556 | false | false | 9 |
0b227f9f20765aaf2fb5e9d8b0e4895677f651c2 | 30,305,289,245,775 | f67a5db5b453739132e458e8c049fd41bdcb4e61 | /io/src/main/java/com/leo/JavaImprove/nio/test/FileTest.java | 6f4eb459377a73701817ce0679a90cbf04ae0bf7 | [] | no_license | LeoWuxg/JavaImprove | https://github.com/LeoWuxg/JavaImprove | 6ce4567d693ca9b26e063e968643c157bc671ecf | d37d01b8e535ed4a41cd966b5a65e47520506e57 | refs/heads/master | 2020-02-04T02:35:35.913000 | 2019-04-10T02:45:43 | 2019-04-10T02:45:43 | 56,242,209 | 0 | 0 | null | false | 2020-04-14T03:27:59 | 2016-04-14T14:02:25 | 2020-04-14T03:27:37 | 2020-04-14T03:27:58 | 105 | 0 | 0 | 1 | Java | false | false | package com.leo.JavaImprove.nio.test;
import java.io.*;
/**
* @author xiangguang.wu
* @ClassName File
* @Description
* @Date 2018/10/22 14:56
* @since Jdk 1.7
*/
public class FileTest {
public static void main(String[] args) {
File file = new File("C:\\Users\\xiangguang.wu\\Desktop\\策略.txt");
InputStream inputStream = null;
try {
inputStream = new FileInputStream(file.getPath());
InputStreamReader isr = new InputStreamReader(inputStream, "utf-8");
FileReader fileReader = new FileReader(file);
} catch (UnsupportedEncodingException e) {
System.out.println("encoding exception...");
} catch (FileNotFoundException e) {
System.out.println("file not found...");
e.printStackTrace();
}
}
}
| UTF-8 | Java | 832 | java | FileTest.java | Java | [
{
"context": "prove.nio.test;\n\nimport java.io.*;\n\n/**\n * @author xiangguang.wu\n * @ClassName File\n * @Description\n * @Date 2018/",
"end": 86,
"score": 0.9943044781684875,
"start": 73,
"tag": "NAME",
"value": "xiangguang.wu"
},
{
"context": "rgs) {\n File file = new File(\"C:\\\\Users\\\\xiangguang.wu\\\\Desktop\\\\策略.txt\");\n InputStream inp",
"end": 287,
"score": 0.5927023887634277,
"start": 282,
"tag": "USERNAME",
"value": "anggu"
},
{
"context": " File file = new File(\"C:\\\\Users\\\\xiangguang.wu\\\\Desktop\\\\策略.txt\");\n InputStream inputStre",
"end": 293,
"score": 0.5834503769874573,
"start": 291,
"tag": "USERNAME",
"value": "wu"
}
] | null | [] | package com.leo.JavaImprove.nio.test;
import java.io.*;
/**
* @author xiangguang.wu
* @ClassName File
* @Description
* @Date 2018/10/22 14:56
* @since Jdk 1.7
*/
public class FileTest {
public static void main(String[] args) {
File file = new File("C:\\Users\\xiangguang.wu\\Desktop\\策略.txt");
InputStream inputStream = null;
try {
inputStream = new FileInputStream(file.getPath());
InputStreamReader isr = new InputStreamReader(inputStream, "utf-8");
FileReader fileReader = new FileReader(file);
} catch (UnsupportedEncodingException e) {
System.out.println("encoding exception...");
} catch (FileNotFoundException e) {
System.out.println("file not found...");
e.printStackTrace();
}
}
}
| 832 | 0.608696 | 0.59058 | 29 | 27.551723 | 23.595129 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.37931 | false | false | 9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.