blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
52bc6ddf62566e03eb6f492b22fe2bb013fc21d2
556b4f72f37287c47852628f823f22e1509e4b54
/src/main/java/com/example/mobileappdevelop/customadapterpractice/Team.java
90cecdccd857ed7236c40e0d7e1b3e48b7963afb
[]
no_license
jubayernil/CustomAdapter
03d4d453a398f1ab012dc23c30028081e38b64a1
fc8584ec27a55db50bc69ec813165fe87b13ea3c
refs/heads/master
2021-01-09T20:21:03.799524
2016-06-29T07:29:53
2016-06-29T07:29:53
62,205,170
0
0
null
null
null
null
UTF-8
Java
false
false
863
java
package com.example.mobileappdevelop.customadapterpractice; import java.util.ArrayList; /** * Created by Mobile App Develop on 29-6-16. */ public class Team { private String teamName; private int teamImageId; public String getTeamName() { return teamName; } public int getTeamImageId() { return teamImageId; } public Team(String teamName, int teamImageId) { this.teamImageId = teamImageId; this.teamName = teamName; } public Team() { } public ArrayList<Team> getAllTeam(){ ArrayList<Team> teams = new ArrayList<>(); teams.add(new Team("Australia",R.drawable.australia)); teams.add(new Team("Bangladesh", R.drawable.bangladesh)); teams.add(new Team("England", R.drawable.england)); return teams; } }
[ "noreply@github.com" ]
jubayernil.noreply@github.com
ffcd887a3f370a7c84cf0bea9d8aa96b20840493
b4bdffa180050efe41bef7800bb5df6d5d28cd71
/src/main/java/com/coffeepoweredcrew/interpreter/Permission.java
06808aef5f5f405d10bcc52a0fee94e220a6db52
[]
no_license
portnovtest/design-patterns-handson
9d7c75ea4cc6558f6d6141e7f1ac13dd88198300
fd628881d694f8aa2d680d2de20e447a3894801e
refs/heads/master
2022-12-23T08:10:41.080411
2020-09-27T19:30:45
2020-09-27T19:30:45
288,041,795
0
0
null
null
null
null
UTF-8
Java
false
false
467
java
package com.coffeepoweredcrew.interpreter; //Terminal expression public class Permission implements PermissionExpression { private final String permission; public Permission(String permission) { this.permission = permission.toLowerCase(); } @Override public boolean interpret(User user) { return user.getPermissions().contains(permission); } @Override public String toString() { return permission; } }
[ "phildolganov@yahoo.com" ]
phildolganov@yahoo.com
62a5cb4d04e995ff69060a24a005d98ae6cb89fc
71b388bbfa6771f078d714c0094dc60ff473297f
/src/com/unama/LetraE.java
c28d84c1a00272a8636fa684de043029f4a2c83c
[]
no_license
Luskalves/programacaoJAVA
812779a55449e31ecf267800799069a85db06054
9b863b67b52096b73ecdc20b23e9acda58194324
refs/heads/master
2020-07-12T03:35:55.737390
2019-11-19T12:55:55
2019-11-19T12:55:55
204,707,374
0
0
null
null
null
null
UTF-8
Java
false
false
402
java
package com.unama; import java.util.Scanner; public class LetraE { public static void main (String[] args){ double vendasT, comissao; Scanner sc = new Scanner(System.in); System.out.println("Informe o total de vendas: "); vendasT = sc.nextDouble(); comissao = vendasT * 0.1; System.out.println("A sua comissão é de: " + comissao); } }
[ "04046843@sempreunama.com.br" ]
04046843@sempreunama.com.br
b53a4dc1eadb4f9090a54a3006e72f5e764b71e4
3e1464ef822fe3f87b269ba8b13a3d4063b3bc77
/jsp/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/sungview/org/apache/jsp/input_005fok_jsp.java
fb508263d4afeb08940e4d2bed893e2848abc6ce
[]
no_license
Billy-Jin/jsp
3bd6007644e1669550885a628f59a4992af61d06
1089089de795ab7d144fd51f60bb901b92421a74
refs/heads/master
2023-03-25T01:58:18.893943
2021-03-18T09:34:46
2021-03-18T09:34:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,341
java
/* * Generated by the Jasper component of Apache Tomcat * Version: Apache Tomcat/9.0.40 * Generated at: 2020-12-07 08:36:58 UTC * Note: The last modified time of this file was set to * the last modified time of the source file after * generation to assist with modification tracking. */ package org.apache.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import java.sql.*; public final class input_005fok_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent, org.apache.jasper.runtime.JspSourceImports { private static final javax.servlet.jsp.JspFactory _jspxFactory = javax.servlet.jsp.JspFactory.getDefaultFactory(); private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants; private static final java.util.Set<java.lang.String> _jspx_imports_packages; private static final java.util.Set<java.lang.String> _jspx_imports_classes; static { _jspx_imports_packages = new java.util.HashSet<>(); _jspx_imports_packages.add("java.sql"); _jspx_imports_packages.add("javax.servlet"); _jspx_imports_packages.add("javax.servlet.http"); _jspx_imports_packages.add("javax.servlet.jsp"); _jspx_imports_classes = null; } private volatile javax.el.ExpressionFactory _el_expressionfactory; private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager; public java.util.Map<java.lang.String,java.lang.Long> getDependants() { return _jspx_dependants; } public java.util.Set<java.lang.String> getPackageImports() { return _jspx_imports_packages; } public java.util.Set<java.lang.String> getClassImports() { return _jspx_imports_classes; } public javax.el.ExpressionFactory _jsp_getExpressionFactory() { if (_el_expressionfactory == null) { synchronized (this) { if (_el_expressionfactory == null) { _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); } } } return _el_expressionfactory; } public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() { if (_jsp_instancemanager == null) { synchronized (this) { if (_jsp_instancemanager == null) { _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); } } } return _jsp_instancemanager; } public void _jspInit() { } public void _jspDestroy() { } public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { if (!javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) { final java.lang.String _jspx_method = request.getMethod(); if ("OPTIONS".equals(_jspx_method)) { response.setHeader("Allow","GET, HEAD, POST, OPTIONS"); return; } if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method)) { response.setHeader("Allow","GET, HEAD, POST, OPTIONS"); response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSP들은 오직 GET, POST 또는 HEAD 메소드만을 허용합니다. Jasper는 OPTIONS 메소드 또한 허용합니다."); return; } } final javax.servlet.jsp.PageContext pageContext; javax.servlet.http.HttpSession session = null; final javax.servlet.ServletContext application; final javax.servlet.ServletConfig config; javax.servlet.jsp.JspWriter out = null; final java.lang.Object page = this; javax.servlet.jsp.JspWriter _jspx_out = null; javax.servlet.jsp.PageContext _jspx_page_context = null; try { response.setContentType("text/html; charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\r\n"); out.write("\r\n"); // DB 연결 Class.forName("com.mysql.jdbc.Driver"); String db="jdbc:mysql://localhost:3306/pkc"; String userid="root"; String pw="1234"; Connection conn=DriverManager.getConnection(db,userid,pw); // db정보,아이디,비번 //request 값 request.setCharacterEncoding("utf-8"); String name=request.getParameter("name"); String kor=request.getParameter("kor"); String eng=request.getParameter("eng"); String mat=request.getParameter("mat"); String sci=request.getParameter("sci"); // 쿼리 생성 String sql="insert into score(name, kor, eng, mat, sci, writeday)"; sql=sql+" values(?,?,?,?,?,now())"; // 심부름꾼 생성 PreparedStatement pstmt=conn.prepareStatement(sql); pstmt.setString(1, name); pstmt.setString(2, kor); pstmt.setString(3, eng); pstmt.setString(4, mat); pstmt.setString(5, sci); // 쿼리 실행 pstmt.executeUpdate(); //이동 response.sendRedirect("sung_view.jsp"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("<!DOCTYPE html>\r\n"); out.write("<html>\r\n"); out.write("<head>\r\n"); out.write("<meta charset=\"UTF-8\">\r\n"); out.write("<title>Insert title here</title>\r\n"); out.write("</head>\r\n"); out.write("<body>\r\n"); out.write("\r\n"); out.write("</body>\r\n"); out.write("</html>"); } catch (java.lang.Throwable t) { if (!(t instanceof javax.servlet.jsp.SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { if (response.isCommitted()) { out.flush(); } else { out.clearBuffer(); } } catch (java.io.IOException e) {} if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } }
[ "uramjin@naver.com" ]
uramjin@naver.com
262644dc2ab2abc296504b843bf905cd26f37dd5
844e8cb251f741c99491f4ca0072135bf9d8c036
/app/src/main/java/com/example/duan/duan/DCZ_util/ActivityUtils.java
52b28aee43f8107521c75c4d30bb6894481d2e28
[]
no_license
duanchaozhong/Duan
d7a3bb53b01b8ebb0244809f57daace8c6d31e8e
86f16881a4f45b90314aa3bceb3e0f620e47eeb7
refs/heads/master
2021-01-21T18:10:16.874115
2017-07-18T07:37:52
2017-07-18T07:37:52
92,018,426
0
0
null
null
null
null
UTF-8
Java
false
false
3,181
java
package com.example.duan.duan.DCZ_util; import android.app.Activity; import android.app.ActivityManager; import android.content.ComponentName; import android.content.Context; import android.text.TextUtils; import com.example.duan.duan.DCZ_application.MyApplication; import java.util.List; import java.util.Stack; /** * activity 栈和堆 * */ public class ActivityUtils { private static Stack activityStack; private static ActivityUtils instance; private ActivityUtils() { } public void application(String key,String valus){ MyApplication.sf.edit().putString(key, valus).commit(); } public void application2(String key,Boolean valus){ MyApplication.sf.edit().putBoolean(key, valus).commit(); } public static ActivityUtils getInstance() { if (instance == null) { instance = new ActivityUtils(); } return instance; } /** * 将当前activity压入栈内 * * @param activity */ public void pushActivity(Activity activity) { if (activityStack == null) { activityStack = new Stack(); } activityStack.add(activity); } /** * 结束当前activity * * @return */ public void popActivity(Activity activity) { if (activity == null) { return; } activity.finish(); activityStack.remove(activity); activity = null; } /** * 获取当前activity * * @return */ public Activity getCurrentActivity() { return (Activity) activityStack.lastElement(); } /** * 获取指定位置的activity * * @param location * @return */ public Activity getActivity(int location) { return (Activity) activityStack.get(location); } /** * 结束所有的activity */ public void popAllActivities() { if (activityStack == null) { return; } while (!activityStack.empty()) { popActivity(getCurrentActivity()); } } /** * 在进程中去寻找当前APP的信息,判断是否在前台运行 */ public boolean isAppOnForeground(Context context) { ActivityManager activityManager =(ActivityManager) context.getApplicationContext().getSystemService( Context.ACTIVITY_SERVICE); String packageName =context.getApplicationContext().getPackageName(); List<ActivityManager.RunningAppProcessInfo> appProcesses = activityManager.getRunningAppProcesses(); if (appProcesses == null) return false; for (ActivityManager.RunningAppProcessInfo appProcess : appProcesses) { if (appProcess.processName.equals(packageName) && appProcess.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) { return true; } } return false; } /** * 判断某个界面是否在前台 * * @param context * @param className * 某个界面名称 */ public boolean isForeground(Context context, String className) { if (context == null || TextUtils.isEmpty(className)) { return false; } ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); List<ActivityManager.RunningTaskInfo> list = am.getRunningTasks(1); if (list != null && list.size() > 0) { ComponentName cpn = list.get(0).topActivity; if (className.equals(cpn.getClassName())) { return true; } } return false; } }
[ "857999639@qq.com" ]
857999639@qq.com
b2bd0eab994f36367c990d301adade2c41450f0b
a5f1e823ab0e6b6423c1e093fff8e21467fd5ce8
/src/main/java/com/rahmitufanglu/quickstart/courseapi/mongo_demo/Hotel.java
50d6147ba23dffb99a45a75ad40ab7f8a393b9bb
[]
no_license
RahmiTufanoglu/course-api
922fc0d51b18ca80e2900b2bdc815de736bc6295
0582c60c8d748711662a32bd7b3d4dda1ac4ab3c
refs/heads/master
2021-08-23T00:44:26.389100
2017-12-01T23:48:02
2017-12-01T23:48:02
112,753,017
0
0
null
null
null
null
UTF-8
Java
false
false
1,677
java
package com.rahmitufanglu.quickstart.courseapi.mongo_demo; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.index.IndexDirection; import org.springframework.data.mongodb.core.index.Indexed; import org.springframework.data.mongodb.core.mapping.Document; import java.util.ArrayList; import java.util.List; @Document(collection = "Hotels") public class Hotel { @Id private String id; // id in mongoDB is a String! private String name; @Indexed(direction = IndexDirection.ASCENDING) private int pricePerNight; private Address address; private List<Review> reviews; protected Hotel() { this.reviews = new ArrayList<>(); } public Hotel(String name, int pricePerNight, Address address, List<Review> reviews) { this.name = name; this.pricePerNight = pricePerNight; this.address = address; this.reviews = reviews; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getPricePerNight() { return pricePerNight; } public void setPricePerNight(int pricePerNight) { this.pricePerNight = pricePerNight; } public Address getAddress() { return address; } public void setAddress(Address address) { this.address = address; } public List<Review> getReviews() { return reviews; } public void setReviews(List<Review> reviews) { this.reviews = reviews; } }
[ "rahmi.tufanoglu@gmail.com" ]
rahmi.tufanoglu@gmail.com
4e52560d7bb8b6508238c5d9544d5aa6479a8725
fc9c427c5aee1144c1a8cee87c4eb07657a85cf9
/Android/Swimming-Belt/PokeSwim/app/src/main/java/com/example/lukile/pokeswim/programs/ProgramSpringActivity.java
3edd76d741fc481f6d5998d8f2b761c95006c718
[]
no_license
lukile/WaterDigitBuddy
a3e7db2401e33eb27b23aed989539a0ed3aaa28a
8e071dec1b941d65d3606e1a2844ef4b97e73fab
refs/heads/master
2023-01-14T08:04:03.066629
2019-07-24T10:03:27
2019-07-24T10:03:27
198,592,977
0
0
null
null
null
null
UTF-8
Java
false
false
998
java
package com.example.lukile.pokeswim.programs; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import com.example.lukile.pokeswim.R; import com.example.lukile.pokeswim.model.Performance; import butterknife.BindView; import butterknife.ButterKnife; public class ProgramSpringActivity extends AppCompatActivity { @BindView(R.id.btn_ok) Button _launchProgram; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_programspring); ButterKnife.bind(this); /*_launchProgram.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Performance performance = new Performance(); performance.setProgramType("SpringBody"); performance.setLengthType(25); } });*/ } }
[ "lucile.1988.ls@gmail.com" ]
lucile.1988.ls@gmail.com
362793c4044af11612ede8d55b438e47f4d15429
c92d2fdfc286ea871498a9966fd6bfe699c1d235
/BasicSQLite/app/src/main/java/com/example/reddyz/basicsqlite/MainActivity.java
97260f661a2088b45342174d8b59a19a34fc2eda
[]
no_license
reddykool/android-tutorials-thenewboston
918f880f37a94bec5e175784bdde9f8798e0ab9b
f4dc23de4024e91ec84fa385d5539d5b156ecc76
refs/heads/master
2021-01-13T01:08:09.470387
2017-02-09T05:45:36
2017-02-09T05:45:36
81,415,094
0
0
null
null
null
null
UTF-8
Java
false
false
1,199
java
package com.example.reddyz.basicsqlite; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends AppCompatActivity { EditText inputText; TextView outputText; MyDBHandler dbHandler; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); inputText = (EditText)findViewById(R.id.inputText); outputText = (TextView)findViewById(R.id.dbText); dbHandler = new MyDBHandler(this, null, null, 1); printDb(); } public void printDb() { String dbString = dbHandler.dbToString(); outputText.setText(dbString); inputText.setText(""); } public void addButtonClicked(View v) { Products prod = new Products(inputText.getText().toString()); dbHandler.addProduct(prod); printDb(); } public void deleteButtonClicked(View v) { String text = inputText.getText().toString(); dbHandler.deleteProduct(text); printDb(); } }
[ "reddykool@gmail.com" ]
reddykool@gmail.com
2f006eef8f9f01d6c7e660433f65af6493c69d0f
d23a15033f71d148dc05ce2ef364d82396397ebb
/src/main/java/ecosmart/services/IpLocation/GeoIPLocationServiceImpl.java
88fd86ed7109735ec87a044baa0d760b6e1575f7
[]
no_license
ysfse/ecosmart
4235fac77be10a1130493f9296c62f2af9e34e79
03dd68b9edade69a506d5c2f2a993d6d116921b6
refs/heads/master
2023-05-08T18:54:52.305542
2021-06-03T02:19:43
2021-06-03T02:19:43
361,094,748
0
0
null
null
null
null
UTF-8
Java
false
false
3,143
java
package ecosmart.services.IpLocation; import com.maxmind.geoip2.DatabaseReader; import com.maxmind.geoip2.exception.GeoIp2Exception; import com.maxmind.geoip2.model.CityResponse; import ecosmart.entities.GeoIP; import ecosmart.helpers.HttpReqRepsUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import ua_parser.Client; import ua_parser.Parser; import javax.servlet.http.HttpServletRequest; import java.io.IOException; import java.net.InetAddress; import static java.util.Objects.nonNull; @Service public class GeoIPLocationServiceImpl implements GeoIPLocationService { private final DatabaseReader databaseReader; private static final String UNKNOWN = "UNKNOWN"; public GeoIPLocationServiceImpl(DatabaseReader databaseReader) { this.databaseReader = databaseReader; } /** * Get device info by user agent * * @param userAgent user agent http device * @return Device info details * @throws IOException if not found */ private String getDeviceDetails(String userAgent) throws IOException { String deviceDetails = UNKNOWN; Parser parser = new Parser(); Client client = parser.parse(userAgent); if (nonNull(client)) { deviceDetails = client.userAgent.family + " " + client.userAgent.major + "." + client.userAgent.minor + " - " + client.os.family + " " + client.os.major + "." + client.os.minor; } return deviceDetails; } /** * get user position by ip address * * @param ip String ip address * @return UserPositionDTO model * @throws IOException if local database city not exist * @throws GeoIp2Exception if cannot get info by ip address */ @Override public GeoIP getIpLocation( HttpServletRequest request) throws IOException, GeoIp2Exception { GeoIP position = new GeoIP(); String location; String ip = HttpReqRepsUtils.getClientIpAddressIfServletRequestExist(); System.out.println(ip); InetAddress ipAddress = InetAddress.getByName(ip); CityResponse cityResponse = databaseReader.city(ipAddress); if (nonNull(cityResponse) && nonNull(cityResponse.getCity())) { String continent = (cityResponse.getContinent() != null) ? cityResponse.getContinent().getName() : ""; String country = (cityResponse.getCountry() != null) ? cityResponse.getCountry().getName() : ""; location = String.format("%s, %s, %s", continent, country, cityResponse.getCity().getName()); position.setCity(cityResponse.getCity().getName()); position.setFullLocation(location); position.setLatitude((cityResponse.getLocation() != null) ? cityResponse.getLocation().getLatitude() : 0); position.setLongitude((cityResponse.getLocation() != null) ? cityResponse.getLocation().getLongitude() : 0); position.setDevice(getDeviceDetails(request.getHeader("user-agent"))); position.setIpAddress(ip); } return position; } }
[ "youssefsirajeddine99@gmail.com" ]
youssefsirajeddine99@gmail.com
35112c5edf876f240dcf343e60390118b895fede
b99a7c637698097a59a3527c3a25cd511361925d
/src/main/java/com/stock/mvc/entities/LigneCommandeClient.java
8b0765ef7c212338e07a3c1a726bfae43f502e57
[]
no_license
khaledboussaba/gestion_stock_spring_mvc
549d49f6fb8f7c9ed8ad231eea3b7f762a172ef5
5a6227fa59eb0c59a34c854434131303d73735a6
refs/heads/master
2022-12-20T16:04:04.834258
2019-08-02T10:55:08
2019-08-02T10:55:08
195,778,343
0
0
null
2022-12-16T00:57:38
2019-07-08T09:18:17
CSS
UTF-8
Java
false
false
1,832
java
package com.stock.mvc.entities; import java.io.Serializable; import java.math.BigDecimal; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import org.codehaus.jackson.annotate.JsonIgnore; @Entity @Table(name = "ligne_commande_client") public class LigneCommandeClient implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue @Column(name = "id_ligne_commande_client") private Long idLigneCommandeClient; @ManyToOne @JoinColumn(name = "id_article") private Article article; @ManyToOne @JoinColumn(name = "id_commande_client") private CommandeClient commandeClient; private BigDecimal quantite; private BigDecimal prixUnitaire; public LigneCommandeClient() { } public Long getIdLigneCommandeClient() { return idLigneCommandeClient; } public void setIdLigneCommandeClient(Long idLigneCommandeClient) { this.idLigneCommandeClient = idLigneCommandeClient; } public Article getArticle() { return article; } public void setArticle(Article article) { this.article = article; } @JsonIgnore public CommandeClient getCommandeClient() { return commandeClient; } public void setCommandeClient(CommandeClient commandeClient) { this.commandeClient = commandeClient; } public BigDecimal getQuantite() { return quantite; } public void setQuantite(BigDecimal quantite) { this.quantite = quantite; } public BigDecimal getPrixUnitaire() { return prixUnitaire; } public void setPrixUnitaire(BigDecimal prixUnitaire) { this.prixUnitaire = prixUnitaire; } }
[ "khaledboussaba@gmail.com" ]
khaledboussaba@gmail.com
b8e11506761f16d7738642a9e8fc82350799ca63
707651417c404ece323c72d1613401fddd7d451c
/src/combaterpg/Adversarios.java
432f0a662222f0ed7c31884077e403a875e58b90
[]
no_license
caiquegiovannini/CombateRPG
3df2bc84177d51be9bbe3fd593adf255bba19546
b0a083452877c2f8310e569f27577f45b8413232
refs/heads/master
2020-05-16T14:27:02.617310
2019-10-17T20:24:13
2019-10-17T20:24:13
183,103,097
1
1
null
null
null
null
UTF-8
Java
false
false
3,817
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package combaterpg; /** * * @author caiqu */ public class Adversarios extends Lutador { private String primeiroNome[] = {"O Grande ", "O Incrível ", "O Especialista ", "O Imperdoável ", "O Ninja ", "O Poderoso ", "O Incontrolável "}; //[7] private String segundoNome[] = {"Esmagador-de-Crânios", "Destruidor-de-Famílias", "Quebra-Ossos", "Aleijador", "Chutador-de-Bundas", "Finalizador"}; //[6] public void gerarAdversario() { while (this.confirma != 1) { //Nome int nRandom = (int) (0 + Math.random() * (7 - 0)); int sRandom = (int) (0 + Math.random() * (6 - 0)); this.nome = this.primeiroNome[nRandom] + this.segundoNome[sRandom]; //Atributos this.setPontos(15); this.setHp(80); this.setForca(5); this.setAgilidade(5); this.setResistencia(5); while (this.pontos > 0 && this.pontos <= 15) { //Força int forRandom = (int) (0 + Math.random() * (this.pontos - 0)); this.forca += forRandom; this.pontos -= forRandom; if (this.pontos <= 0) { break; } //Agilidade int agiRandom = (int) (0 + Math.random() * (this.pontos - 0)); this.agilidade += agiRandom; this.pontos -= agiRandom; if (this.pontos <= 0) { break; } //Resistencia int resRandom = (int) (1 + Math.random() * (this.pontos - 1)); this.resistencia += resRandom; this.pontos -= resRandom; if (this.pontos <= 0) { break; } } this.hp += (this.forca + this.resistencia) / 2; System.out.println("Um novo adversário aparece!"); this.atributos(); System.out.print("Confirmar? [1]-Sim / [2]-Não: "); this.confirma = leitor.nextInt(); System.out.println(""); if (this.confirma > 2 || this.confirma < 1) { System.out.println("Opção inválida"); }else if (this.confirma == 2) { continue; } System.out.println(""); System.out.println("Prepare-se para lutar!"); System.out.println(""); } } public Adversarios() { } public String[] getPrimeiroNome() { return primeiroNome; } public void setPrimeiroNome(String[] n) { this.primeiroNome = n; } public String[] getSegundoNome() { return segundoNome; } public void setSegundoNome(String[] sn) { this.segundoNome = sn; } @Override public String getNome() { return nome; } @Override public void setNome(String n) { this.nome = n; } @Override public int getHp() { return hp; } @Override public void setHp(int hp) { this.hp = hp; } @Override public int getForca() { return forca; } @Override public void setForca(int f) { this.forca = f; } @Override public int getAgilidade() { return agilidade; } @Override public void setAgilidade(int a) { this.agilidade = a; } @Override public int getResistencia() { return resistencia; } @Override public void setResistencia(int r) { this.resistencia = r; } }
[ "caique_giovannini@hotmail.com" ]
caique_giovannini@hotmail.com
8c6e5d716979209092711ee48f8b8c5e82aff85a
1d12aeb07e4b3822c75627c49f14253fda80d141
/openeuler_user/src/main/java/com/openeuler/user/controller/UserController.java
27b6cdb90485cb6db54b0d267b87765b435ddb99
[]
no_license
AnneYang720/openeuler-maven
4dbfc33157d427b408007ea54ed7fca7c04d3fcb
c2204c86c9ae74d492caf9972864d699f8452097
refs/heads/master
2023-04-05T14:37:21.467185
2021-04-20T14:01:29
2021-04-20T14:01:29
352,998,634
0
0
null
null
null
null
UTF-8
Java
false
false
4,900
java
package com.openeuler.user.controller; import com.openeuler.user.pojo.RepoUser; import com.openeuler.user.pojo.User; import com.openeuler.user.service.UserService; import entity.Result; import entity.StatusCode; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import util.JwtUtil; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 控制器层 * @author AnneY * */ @RestController @CrossOrigin @RequestMapping("/user") public class UserController { @Autowired private UserService userService; @Autowired private JwtUtil jwtUtil; /** * 用户登录 * @param user * @return */ @PostMapping("/login") public Result login(@RequestBody User user) { user = userService.login(user); if (user == null) { return new Result(false, StatusCode.LOGINERROR, "登录失败"); } // 登录成功后的操作 String token = jwtUtil.createJWT(user.getId(), user.getEmail(), "user"); Map<String, Object> map = new HashMap<>(); map.put("token", token); return new Result(true, StatusCode.OK, "登录成功", map); } /** * 用户注册 * * @param user * @return */ @PostMapping("/register") public Result register(@RequestBody User user) { List<User> userList = userService.checkUser(user); if (userList == null || userList.isEmpty()) { userService.register(user); return new Result(true, StatusCode.OK, "注册成功"); } else { return new Result(false, StatusCode.ERROR, "注册失败,邮箱或用户名已经被使用"); } } /** * 当前用户获得本人信息 * * @return */ @RequestMapping(value = "/info", method = RequestMethod.GET) public Result getCurInfo(@RequestHeader(value="X-User-Id") String userId) { return new Result(true, StatusCode.OK, "查询成功", userService.getCurInfo(userId)); } /** * 当前登陆用户修改个人信息 * @param user */ @RequestMapping(value="/saveinfo", method= RequestMethod.PUT) public Result updateInfo(@RequestBody User user, @RequestHeader(value="X-User-Id") String userId){ // user.setId(parseToken(token)) userService.update(user,userId); return new Result(true, StatusCode.OK, "修改成功"); } /** * 根据UserID查询并返回用户 * * @param id * @return */ @RequestMapping(value = "/find/id", method = RequestMethod.POST) public User findUserById(@RequestBody String id) { return userService.findById(id); } /** * 当前用户增加分享,本人release仓库增加用户名和密码 * @return */ @RequestMapping(value = "/addshare", method = RequestMethod.POST) public String addShareUser(@RequestBody String id) { return userService.addRepoUser( id,"release"); } /** * 当前用户删除分享,本人release仓库删除相应的用户名和密码 * @return */ @RequestMapping(value = "/deleterepouser", method = RequestMethod.DELETE) public void deleteRepoUser(@RequestBody String id) { userService.deleteRepoUser(id); } /** * 根据RepoUserId返回该条RepoUser数据 * @return */ @RequestMapping(value = "/getrepoinfo/id", method = RequestMethod.POST) public RepoUser getRepoInfo(@RequestBody String id) { return userService.getRepoInfo(id); } /** * 返回当前用户本人仓库的RepoUser数据 * @return */ @RequestMapping(value = "/{repo}/getrepouserinfo", method = RequestMethod.GET) public Result getRepoInfoByRepo(@PathVariable String repo, @RequestHeader(value="X-User-Id") String userId) { User curUser = userService.findById(userId); // System.out.println(repo); String repoUserId = repo.equals("release")? curUser.getRepoUserReleaseId():curUser.getRepoUserSnapshotId(); return new Result(true, StatusCode.OK, "查询成功", userService.getRepoInfo(repoUserId)); } /** * 根据UserName查询用户 * * @param user * @return */ @RequestMapping(value = "/find/loginname", method = RequestMethod.POST) public User findByLoginName(@RequestBody User user) { System.out.println("findByLoginName: "+user.getLoginName()); return userService.findByLoginName(user.getLoginName()); } /** * RepoUser验证 * * @param repoUser * @return */ @RequestMapping(value = "/repouser/auth", method = RequestMethod.POST) public Result repoUserAuth(@RequestBody RepoUser repoUser) { return new Result(true, StatusCode.OK, "查询成功", userService.findRepoUser(repoUser)); } }
[ "evangelin-lun@foxmail.com" ]
evangelin-lun@foxmail.com
b80111206fa3cd0d427598e0f1cc1e64b28f6298
acf115f62dabc7e0608ad8fd44d76220e9430b0c
/src/main/java/com/labs/StudentWebService.java
02260e5e218961fa405c4d6102d29c04187b3350
[]
no_license
Yuntaichen/lab3_crud_ws_errors
0a431419f90d1a6b04dce5056f7973bcfddd5b86
dd5333bced8d7bef9e72ec615deba41a28b41875
refs/heads/main
2023-05-05T10:27:10.941747
2021-06-05T08:04:46
2021-06-05T08:04:46
373,832,247
0
0
null
null
null
null
UTF-8
Java
false
false
9,485
java
package com.labs; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebService; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import com.labs.errors.*; @WebService(serviceName = "CRUDService") public class StudentWebService { @WebMethod(operationName = "getStudentsByFields") public LinkedHashSet<Student> getStudentsByFields(@WebParam(name = "fieldValue") String[] searchArgs) { PostgreSQLDAO dao = new PostgreSQLDAO(); return dao.getStudentsByFields(searchArgs); } @WebMethod(operationName = "createStudent") public String createStudent(@WebParam(name = "studentName") String name, @WebParam(name = "studentSurname") String surname, @WebParam(name = "studentAge") String age, @WebParam(name = "studentId") String studentId, @WebParam(name = "studentMark") String mark) throws EmptyFieldException, CastToIntException, FieldValueException { String status; if (name != null && !name.trim().isEmpty() && surname != null && !surname.trim().isEmpty() && age != null && !age.trim().isEmpty() && studentId != null && !studentId.trim().isEmpty() && mark != null && !mark.trim().isEmpty()) { try { int ageInt = Integer.parseInt(age.trim()); int studentIdInt = Integer.parseInt(studentId.trim()); if (mark.equals("неудовлетворительно") || mark.equals("удовлетворительно") || mark.equals("хорошо") || mark.equals("отлично")) { PostgreSQLDAO dao = new PostgreSQLDAO(); status = dao.createStudent(name, surname, ageInt, studentIdInt, mark); } else { FieldValueFault fault = FieldValueFault.defaultInstance(); throw new FieldValueException("Error was occurred in class: " + StudentWebService.class.getName() + ", method - createStudent(). \n Field 'mark' has not one of " + "the required values: 'неудовлетворительно', 'удовлетворительно', 'хорошо', 'отлично'.", fault); } } catch (NumberFormatException ex) { CastToIntFault fault = CastToIntFault.defaultInstance(); throw new CastToIntException("Error was occurred in class: " + StudentWebService.class.getName() + ", method - createStudent(). \n We get 'NumberFormatException': " + ex + ", when trying convert studentAge and studentID to integers.", fault); } } else { EmptyFieldFault fault = EmptyFieldFault.defaultInstance(); throw new EmptyFieldException("Error was occurred in class " + StudentWebService.class.getName() + ", method createStudent().", fault); } return status; } @WebMethod(operationName = "deleteStudent") public String deleteStudent(@WebParam(name = "rowId") String rowId) throws CastToIntException, RowIsNotExistsException { String status; try { int rowIdInt = Integer.parseInt(rowId.trim()); PostgreSQLDAO dao = new PostgreSQLDAO(); status = dao.deleteStudent(rowIdInt); System.out.println(status); if (status.equals("0")) { RowIsNotExistsFault fault = RowIsNotExistsFault.defaultInstance(); throw new RowIsNotExistsException("Error was occurred in class: " + StudentWebService.class.getName() + ", method - deleteStudent(). \n We get 'status = 0' after deletion row in table in DB with rowId " + rowId, fault); } } catch (NumberFormatException ex) { CastToIntFault fault = CastToIntFault.defaultInstance(); throw new CastToIntException("Error was occurred in class: " + StudentWebService.class.getName() + ", method - deleteStudent(). \n We get 'NumberFormatException': " + ex + ", when trying convert rowId to int.", fault); } return status; } @WebMethod(operationName = "updateStudent") public String updateStudent(@WebParam(name = "rowId") String rowId, @WebParam(name = "studentName") String name, @WebParam(name = "studentSurname") String surname, @WebParam(name = "studentAge") String age, @WebParam(name = "studentId") String studentId, @WebParam(name = "studentMark") String mark) throws EmptyFieldException, RowIsNotExistsException, CastToIntException, FieldValueException { String status; try { int rowIdInt = Integer.parseInt(rowId.trim()); Integer.parseInt(age.trim()); Integer.parseInt(studentId.trim()); List<String> updateArgs = new ArrayList<>(); if (name != null && !name.trim().isEmpty()) updateArgs.add("name = '" + name + "'"); if (surname != null && !surname.trim().isEmpty()) updateArgs.add("surname = '" + surname + "'"); if (!age.trim().isEmpty()) { try { Integer.parseInt(age.trim()); updateArgs.add("age = '" + age + "'"); } catch (NumberFormatException ex) { CastToIntFault fault = CastToIntFault.defaultInstance(); throw new CastToIntException("Error was occurred in class: " + StudentWebService.class.getName() + ", method - updateStudent(). \n We get 'NumberFormatException': " + ex + ", when trying convert 'age' to int.", fault); } } if (!studentId.trim().isEmpty()) { try { Integer.parseInt(studentId.trim()); updateArgs.add("studentId = '" + studentId + "'"); } catch (NumberFormatException ex) { CastToIntFault fault = CastToIntFault.defaultInstance(); throw new CastToIntException("Error was occurred in class: " + StudentWebService.class.getName() + ", method - updateStudent(). \n We get 'NumberFormatException': " + ex + ", when trying convert 'studentId' to int.", fault); } } if (mark != null && !mark.trim().isEmpty()) { if (mark.equals("неудовлетворительно") || mark.equals("удовлетворительно") || mark.equals("хорошо") || mark.equals("отлично")) { updateArgs.add("mark = '" + mark + "'"); } else { FieldValueFault fault = FieldValueFault.defaultInstance(); throw new FieldValueException("Error was occurred in class: " + StudentWebService.class.getName() + ", method - updateStudent(). \n Field 'mark' has not one of " + "the required values: 'неудовлетворительно', 'удовлетворительно', 'хорошо', 'отлично'.", fault); } } int i = 0; for (String param : updateArgs) { if (param != null && !param.trim().isEmpty()) { i++; } } if (i > 0) { PostgreSQLDAO dao = new PostgreSQLDAO(); status = dao.updateStudent(rowIdInt, updateArgs); } else { EmptyFieldFault fault = EmptyFieldFault.defaultInstance(); fault.setMessage("All required parameters are empty. Please, input at least one of them."); throw new EmptyFieldException("Error was occurred in class " + StudentWebService.class.getName() + ", method updateStudent().", fault); } if (status.equals("0")) { RowIsNotExistsFault fault = RowIsNotExistsFault.defaultInstance(); throw new RowIsNotExistsException("Error was occurred in class: " + StudentWebService.class.getName() + ", method - updateStudent(). \n We get 'status = 0' after deletion row in table in DB with rowId " + rowId, fault); } } catch (NumberFormatException ex) { CastToIntFault fault = CastToIntFault.defaultInstance(); throw new CastToIntException("Error was occurred in class: " + StudentWebService.class.getName() + ", method - updateStudent(). \n We get 'NumberFormatException': " + ex + ", when trying convert rowId to int.", fault); } return status; } }
[ "yuntaichen1@gmail.com" ]
yuntaichen1@gmail.com
f8e3e333c54fd4ea4a6d26aee98317eb1ba1f895
64e8f7d9a6aa5461a7d9e19fd0dd88f005457473
/POUEX.diagram/src/POUEX/diagram/part/POUEXInitDiagramFileAction.java
2b2b63f35c1a3ca4438cbb44908e2296698e2157
[]
no_license
samuelmorenov/DMSS-POUEX
590a47709c291d5b9e7dd664bcc47c7e097be437
6202f5006be7c938da10c41fcb9104169deda335
refs/heads/master
2022-11-12T17:33:45.658328
2020-06-26T23:22:13
2020-06-26T23:22:13
275,010,848
0
0
null
null
null
null
UTF-8
Java
false
false
2,820
java
/* * */ package POUEX.diagram.part; import org.eclipse.core.resources.IFile; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.common.util.WrappedException; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory; import org.eclipse.jface.action.IAction; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.Wizard; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IObjectActionDelegate; import org.eclipse.ui.IWorkbenchPart; import POUEX.diagram.edit.parts.MascotaEditPart; /** * @generated */ public class POUEXInitDiagramFileAction implements IObjectActionDelegate { /** * @generated */ private IWorkbenchPart targetPart; /** * @generated */ private URI domainModelURI; /** * @generated */ public void setActivePart(IAction action, IWorkbenchPart targetPart) { this.targetPart = targetPart; } /** * @generated */ public void selectionChanged(IAction action, ISelection selection) { domainModelURI = null; action.setEnabled(false); if (selection instanceof IStructuredSelection == false || selection.isEmpty()) { return; } IFile file = (IFile) ((IStructuredSelection) selection) .getFirstElement(); domainModelURI = URI.createPlatformResourceURI(file.getFullPath() .toString(), true); action.setEnabled(true); } /** * @generated */ private Shell getShell() { return targetPart.getSite().getShell(); } /** * @generated */ public void run(IAction action) { TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE .createEditingDomain(); ResourceSet resourceSet = editingDomain.getResourceSet(); EObject diagramRoot = null; try { Resource resource = resourceSet.getResource(domainModelURI, true); diagramRoot = (EObject) resource.getContents().get(0); } catch (WrappedException ex) { POUEXDiagramEditorPlugin.getInstance().logError( "Unable to load resource: " + domainModelURI, ex); //$NON-NLS-1$ } if (diagramRoot == null) { MessageDialog.openError(getShell(), Messages.InitDiagramFile_ResourceErrorDialogTitle, Messages.InitDiagramFile_ResourceErrorDialogMessage); return; } Wizard wizard = new POUEXNewDiagramFileWizard(domainModelURI, diagramRoot, editingDomain); wizard.setWindowTitle(NLS.bind(Messages.InitDiagramFile_WizardTitle, MascotaEditPart.MODEL_ID)); POUEXDiagramEditorUtil.runWizard(getShell(), wizard, "InitDiagramFile"); //$NON-NLS-1$ } }
[ "UO266321@uniovi.es" ]
UO266321@uniovi.es
8e9c9bdd7bcbf43cd97e9a83f09bc61df4a054bc
3af5391bcc7efe35a90433c4c5a5f999543bc52a
/src/jogorodaroda/Classe/Main.java
a2dc89c9daa65ffad55db7cc6b24e22d10cfe197
[]
no_license
geovane1992/ProjetoRodaRoda
b2448267d9c767b8c8ee2f572807f6b6555d8c54
9b56f9ac10ddc5d938818b770376fd8d97c27c37
refs/heads/master
2021-01-10T11:19:05.454400
2016-02-11T00:41:32
2016-02-11T00:41:32
49,341,759
0
1
null
null
null
null
UTF-8
Java
false
false
565
java
package jogorodaroda.Classe; import jogorodaroda.Interface.TelaInicial; import java.io.IOException; import java.util.ArrayList; import java.util.Random; public class Main { public static void main(String args[]) throws IOException { TelaInicial telaInicial = new TelaInicial(); telaInicial.dispose(); telaInicial.setUndecorated(true); telaInicial.setVisible(true); telaInicial.setLocationRelativeTo(null); Metodos metodos = new Metodos(); metodos.audioInicial(); } }
[ "GAOliveira@GSA07.gsa.go" ]
GAOliveira@GSA07.gsa.go
da8d8ca5e3b547d68b2d54dd60caaab817b78c6f
ea4d145e30cd4e50216f82915f5bc8fc82412f5b
/src/main/java/com/example/alexander/robotcontroller/ArduinoDeviceArrayAdapter.java
a390b56d1e0a4b88d425363bc955d0a781c56ad6
[]
no_license
fedosov-alexander/RobotController
3c7eb7766dee33cf7328090c774058e4f2b6d54a
6e28c4352719a1259cc4038605f5d7051804201d
refs/heads/master
2021-01-17T00:42:54.794347
2016-06-08T06:21:05
2016-06-08T06:21:05
60,292,584
0
0
null
null
null
null
UTF-8
Java
false
false
1,190
java
package com.example.alexander.robotcontroller; import android.bluetooth.BluetoothDevice; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import java.util.ArrayList; /** * Created by Alexander on 24.05.2016. */ public class ArduinoDeviceArrayAdapter extends ArrayAdapter<ArduinoDevice> { public ArduinoDeviceArrayAdapter(Context context, ArrayList<ArduinoDevice> devices) { super(context, 0, devices); } @Override public View getView(int position, View convertView, ViewGroup parent) { ArduinoDevice device = getItem(position); if (convertView == null) { convertView = LayoutInflater.from(getContext()).inflate(R.layout.list_arduino_item_layout, parent, false); } TextView deviceName = (TextView) convertView.findViewById(R.id.arduinoDeviceName); TextView deviceAddres = (TextView) convertView.findViewById(R.id.arduinoDeviceMac); deviceName.setText(device.getName()); deviceAddres.setText(device.getAddress()); return convertView; } }
[ "alexander.s.fedosov@yandex.ru" ]
alexander.s.fedosov@yandex.ru
a28b752bd36879bf2058250c8c6c9e233e58c64e
321ae049d24af144f5aa442c7b781e42183c10f3
/app/src/main/java/com/example/juliamourac/p2_android_dev/SplashScreenActivity.java
15dc24040dba5682a28ed8b80cb807ec72600582
[]
no_license
juliamourac/P2_Android_Dev
9cf66baec598a0d5a8593487ac896a3e86428e7d
3eee8931dbc3a10280642b572764cb3ea86505c5
refs/heads/master
2021-08-31T04:06:21.449325
2017-12-20T09:25:38
2017-12-20T09:25:38
114,867,781
0
0
null
null
null
null
UTF-8
Java
false
false
595
java
package com.example.juliamourac.p2_android_dev; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import com.example.juliamourac.p2_android_dev.lista_acoes.ListaAcoesActivity; public class SplashScreenActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash_screen); Intent intent = new Intent(this, ListaAcoesActivity.class); startActivity(intent); finish(); } }
[ "juliamourac@hotmail.com" ]
juliamourac@hotmail.com
a03e7a873b587be9db4f8c74367ce89c2c386a73
6f6a9bbda2fdde0453daadbb55ec4b0a00cf2ef9
/src/main/java/com/arpnetworking/commons/jackson/databind/ObjectMapperFactory.java
2a49512324d625314e1262fb07f6005530d39dab
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
cybermaak/commons
66015c65ce468ded5f147bab1cda2cbe5ef4bc17
03013b21894d5e5d2f4fa669a612a25b4f391d39
refs/heads/master
2021-01-18T17:38:35.423641
2016-02-23T20:52:29
2016-02-23T22:20:03
52,389,592
0
0
null
2016-02-23T20:33:11
2016-02-23T20:33:11
null
UTF-8
Java
false
false
5,544
java
/** * Copyright 2014 Groupon.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.arpnetworking.commons.jackson.databind; import com.arpnetworking.steno.Logger; import com.arpnetworking.steno.LoggerFactory; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.Module; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.util.ISO8601DateFormat; import java.util.Optional; /** * Create a "standard" <code>ObjectMapper</code> instance. * * Dependencies: * <ul> * <li>com.fasterxml.jackson.core:jackson-core</li> * <li>com.fasterxml.jackson.core:jackson-databind</li> * <li>com.fasterxml.jackson.datatype:jackson-datatype-guava (Optional)</li> * <li>com.fasterxml.jackson.datatype:jackson-datatype-jdk7 (Optional)</li> * <li>com.fasterxml.jackson.datatype:jackson-datatype-jdk8 (Optional)</li> * <li>com.fasterxml.jackson.datatype:jackson-datatype-joda (Optional)</li> * <li>cglib:cglib (transitively through ImmutableObjectMapper)</li> * </ul> * * @author Ville Koskela (vkoskela at groupon dot com) */ public final class ObjectMapperFactory { /** * Create a new <code>ObjectMapper</code> configured with standard * settings. New instances can be safely customized by clients. * * @return New mutable <code>ObjectMapper</code> instance. */ public static ObjectMapper createInstance() { return createModifiableObjectMapper(); } /** * Create a new <code>ObjectMapper</code> configured with standard * settings. New instances can be safely customized by clients. * * @param jsonFactory Instance of <code>JsonFactory</code>. * @return New mutable <code>ObjectMapper</code> instance. */ public static ObjectMapper createInstance(final JsonFactory jsonFactory) { return createModifiableObjectMapper(new ObjectMapper(jsonFactory)); } /** * Get <code>ObjectMapper</code> instance configured with standard * settings. These instances are considered shared and are immutable. * * @return Shared immutable <code>ObjectMapper</code> instance. */ public static ObjectMapper getInstance() { return UNMODIFIABLE_OBJECT_MAPPER; } private static ObjectMapper createModifiableObjectMapper() { return createModifiableObjectMapper(new ObjectMapper()); } /* package private */ static ObjectMapper createModifiableObjectMapper(final ObjectMapper objectMapper) { registerModule(objectMapper, "com.fasterxml.jackson.datatype.guava.GuavaModule"); registerModule(objectMapper, "com.fasterxml.jackson.datatype.jdk7.Jdk7Module"); registerModule(objectMapper, "com.fasterxml.jackson.datatype.jdk8.Jdk8Module"); registerModule(objectMapper, "com.fasterxml.jackson.datatype.joda.JodaModule"); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); objectMapper.configure(DeserializationFeature.WRAP_EXCEPTIONS, false); objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); objectMapper.setDateFormat(new ISO8601DateFormat()); return objectMapper; } /* package private */ static void registerModule(final ObjectMapper objectMapper, final String className) { final Optional<Class<? extends Module>> moduleClass = getClass(className); if (moduleClass.isPresent()) { try { final Module module = moduleClass.get().newInstance(); objectMapper.registerModule(module); // CHECKSTYLE.OFF: IllegalCatch - Catch any exceptions thrown by reflection or the module constructor. } catch (final Exception e) { // CHECKSTYLE.ON: IllegalCatch LOGGER.warn() .setEvent("ObjectMapperFactory") .setMessage("Unable to instantiate module") .addData("module", moduleClass.get()) .setThrowable(e) .log(); } } } /* package private */ static <T> Optional<Class<? extends T>> getClass(final String className) { try { @SuppressWarnings("unchecked") final Optional<Class<? extends T>> clazz = Optional.<Class<? extends T>>of((Class<T>) Class.forName(className)); return clazz; } catch (final ClassNotFoundException e) { return Optional.empty(); } } private ObjectMapperFactory() {} private static final Logger LOGGER = LoggerFactory.getLogger(ObjectMapperFactory.class); private static final ObjectMapper UNMODIFIABLE_OBJECT_MAPPER = ImmutableObjectMapper.of( createModifiableObjectMapper()); }
[ "vkoskela@groupon.com" ]
vkoskela@groupon.com
95c92b73ea101d0f04fd5b66ac11aae815b6eefd
039c4eb980fd987ce03dde9dcd4f992812382215
/src/main/java/io/choerodon/wiki/api/dto/WikiSpaceListTreeDTO.java
18ea01eeb2f8e5a0951c237290c55a3c88e8b3c4
[ "Apache-2.0" ]
permissive
AndersIves/wiki-service
d05e121b42813e4f72a30e192e999f018e3abd7f
a2ce99c766fd8ca04d53f96e77cfef25afa1be02
refs/heads/master
2020-07-03T12:02:48.878827
2019-06-29T07:48:39
2019-06-29T07:48:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,251
java
package io.choerodon.wiki.api.dto; import java.util.List; import io.swagger.annotations.ApiModelProperty; /** * Created by Zenger on 2018/7/28. */ public class WikiSpaceListTreeDTO { @ApiModelProperty(value = "空间id") private Long id; @ApiModelProperty(value = "组织id/项目id") private Long resourceId; @ApiModelProperty(value = "空间类型") private String resourceType; @ApiModelProperty(value = "空间名称") private String name; @ApiModelProperty(value = "空间图标") private String icon; @ApiModelProperty(value = "空间路径") private String path; @ApiModelProperty(value = "空间状态") private String status; private Long objectVersionNumber; @ApiModelProperty(value = "组织或项目下的空间") private List<WikiSpaceResponseDTO> children; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getIcon() { return icon; } public void setIcon(String icon) { this.icon = icon; } public String getPath() { return path; } public void setPath(String path) { this.path = path; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public Long getObjectVersionNumber() { return objectVersionNumber; } public void setObjectVersionNumber(Long objectVersionNumber) { this.objectVersionNumber = objectVersionNumber; } public String getResourceType() { return resourceType; } public void setResourceType(String resourceType) { this.resourceType = resourceType; } public List<WikiSpaceResponseDTO> getChildren() { return children; } public void setChildren(List<WikiSpaceResponseDTO> children) { this.children = children; } public Long getResourceId() { return resourceId; } public void setResourceId(Long resourceId) { this.resourceId = resourceId; } }
[ "qinsheng.wang@hand-china.com" ]
qinsheng.wang@hand-china.com
cba323ade60a7d22426622b4750899f9d5c0f499
e4c22ea38a84eabd1fcbfb35301eff3f7a034da0
/Commons/src/main/java/nl/lakedigital/djfc/commons/json/JsonSoortSchade.java
c85de6f83fb8483744f19aa1641b3fd8ff39eedb
[]
no_license
pheidotting/symplex
36ae4a6ce61d172f622e703af4a47abb25608d87
3cafb5730f4d8c907f9f5b3c8388ab82b854f444
refs/heads/development
2021-07-13T07:44:54.437965
2018-12-11T18:11:34
2018-12-11T18:11:34
109,175,311
0
0
null
2018-12-11T18:47:25
2017-11-01T19:37:16
Java
UTF-8
Java
false
false
246
java
package nl.lakedigital.djfc.commons.json; public class JsonSoortSchade { private final String value; public JsonSoortSchade(String tekst) { this.value = tekst; } public String getValue() { return value; } }
[ "patrick@lakedigital.nl" ]
patrick@lakedigital.nl
811b79f8dbd8f107b331d0b9c616fe46605e66ca
e1ecaafbb0f560e95ad70808d7509efb44ba59fb
/Raven.Client.Java/src/main/java/net/ravendb/client/linq/RavenQueryProviderProcessor.java
56cdfe5208e735651e6032dbe2c9109c4ffc12f8
[ "BSD-3-Clause" ]
permissive
kamilaispl/jvm-client
0d5acff37a56c807ff53cc7b53ba350fd274cc34
5bd94cab39c4b81940a26d81076ef322fab76034
refs/heads/master
2021-01-16T21:32:08.841067
2015-01-23T12:50:58
2015-01-23T12:50:58
29,589,694
0
0
null
2015-01-21T13:02:40
2015-01-21T13:02:40
null
UTF-8
Java
false
false
46,623
java
package net.ravendb.client.linq; import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import net.ravendb.abstractions.LinqOps; import net.ravendb.abstractions.basic.Reference; import net.ravendb.abstractions.basic.Tuple; import net.ravendb.abstractions.closure.Action1; import net.ravendb.abstractions.data.Constants; import net.ravendb.abstractions.data.QueryResult; import net.ravendb.abstractions.json.linq.RavenJObject; import net.ravendb.abstractions.json.linq.RavenJToken; import net.ravendb.client.EscapeQueryOptions; import net.ravendb.client.IDocumentQuery; import net.ravendb.client.SearchOptions; import net.ravendb.client.SearchOptionsSet; import net.ravendb.client.WhereParams; import net.ravendb.client.document.DocumentQuery; import net.ravendb.client.document.DocumentQueryCustomization; import net.ravendb.client.document.DocumentQueryCustomizationFactory; import net.ravendb.client.document.IAbstractDocumentQuery; import net.ravendb.client.linq.LinqPathProvider.Result; import com.google.common.collect.Lists; import com.mysema.codegen.StringUtils; import com.mysema.query.support.Expressions; import com.mysema.query.types.Constant; import com.mysema.query.types.Expression; import com.mysema.query.types.Operation; import com.mysema.query.types.Ops; import com.mysema.query.types.Order; import com.mysema.query.types.OrderSpecifier; import com.mysema.query.types.ParamExpression; import com.mysema.query.types.Path; import com.mysema.query.types.PredicateOperation; import com.mysema.query.types.expr.BooleanOperation; import com.mysema.query.types.expr.Param; /** * Process a Linq expression to a Lucene query * * @param <T> */ public class RavenQueryProviderProcessor<T> { private Class<T> clazz; private final DocumentQueryCustomizationFactory customizeQuery; protected final IDocumentQueryGenerator queryGenerator; private final Action1<QueryResult> afterQueryExecuted; private boolean chanedWhere; private int insideWhere; private IAbstractDocumentQuery<T> documentQuery; private SpecialQueryType queryType = SpecialQueryType.NONE; private Class<?> newExpressionType; private String currentPath = ""; private int subClauseDepth; private String resultsTransformer; private final Map<String, RavenJToken> transformerParameters; private LinqPathProvider linqPathProvider; protected final String indexName; private Set<String> fieldsToFetch; private List<RenamedField> fieldsToRename; private boolean insideSelect = false; private final boolean isMapReduce; /** * @return the current path in the case of expressions within collections */ public String getCurrentPath() { return currentPath; } public RavenQueryProviderProcessor(Class<T> clazz, IDocumentQueryGenerator queryGenerator, DocumentQueryCustomizationFactory customizeQuery, Action1<QueryResult> afterQueryExecuted, String indexName, Set<String> fieldsToFetch, List<RenamedField> fieldsToRename, boolean isMapReduce, String resultsTransformer, Map<String, RavenJToken> transformerParameters) { this.clazz = clazz; this.fieldsToFetch = fieldsToFetch; this.fieldsToRename = fieldsToRename; newExpressionType = clazz; this.queryGenerator = queryGenerator; this.indexName = indexName; this.isMapReduce = isMapReduce; this.afterQueryExecuted = afterQueryExecuted; this.customizeQuery = customizeQuery; this.resultsTransformer = resultsTransformer; this.transformerParameters = transformerParameters; linqPathProvider = new LinqPathProvider(queryGenerator.getConventions()); } public Set<String> getFieldsToFetch() { return fieldsToFetch; } public void setFieldsToFetch(Set<String> fieldsToFetch) { this.fieldsToFetch = fieldsToFetch; } /** * @return list of fields to rename from one name to another */ public List<RenamedField> getFieldsToRename() { return fieldsToRename; } /** * Rename the fields from one name to another * @param fieldsToRename */ public void setFieldsToRename(List<RenamedField> fieldsToRename) { this.fieldsToRename = fieldsToRename; } /** * Visits the expression and generate the lucene query */ @SuppressWarnings("unchecked") protected void visitExpression(Expression<?> expression) { if (expression instanceof Operation) { if (expression instanceof BooleanOperation || expression instanceof PredicateOperation || expression.getType().equals(Boolean.class)) { visitBooleanOperation((Operation<Boolean>) expression); } else { visitOperation((Operation<?>)expression); } } else if (expression instanceof Constant) { if ("root".equals(((Constant<?>) expression).getConstant())) { // we have root node - just skip it return; } visitConstant((Constant<?>) expression, true); } else if (expression instanceof Path) { visitMemberAccess((Path<?>)expression, true); } else { throw new IllegalArgumentException("Expression is not supported:" + expression); } } private void visitMemberAccess(Path< ? > expression, boolean boolValue) { if (expression.getType().equals(Boolean.class)) { ExpressionInfo memberInfo = getMember(expression); WhereParams whereParams = new WhereParams(); whereParams.setFieldName(memberInfo.getPath()); whereParams.setValue(boolValue); whereParams.setAnalyzed(true); whereParams.setAllowWildcards(false); documentQuery.whereEquals(whereParams); } else { throw new IllegalStateException("Path type is not supported: " + expression + " " + expression.getType()); } } private void visitBooleanOperation(Operation<Boolean> expression) { if (expression.getOperator().equals(Ops.OR)) { visitOrElse(expression); } else if (expression.getOperator().equals(Ops.AND)) { visitAndAlso(expression); } else if (expression.getOperator().equals(Ops.NE)) { visitNotEquals(expression); } else if (expression.getOperator().equals(Ops.EQ)) { visitEquals(expression); } else if (expression.getOperator().equals(Ops.EQ_IGNORE_CASE)) { visitEqualsIgnoreCase(expression); } else if (expression.getOperator().equals(LinqOps.Ops.EQ_NOT_IGNORE_CASE)) { visitEqualsNotIgnoreCase(expression); } else if (expression.getOperator().equals(Ops.GT)) { visitGreatherThan(expression); } else if (expression.getOperator().equals(Ops.GOE)) { visitGreatherThanOrEqual(expression); } else if (expression.getOperator().equals(Ops.LT)) { visitLessThan(expression); } else if (expression.getOperator().equals(Ops.LOE)) { visitLessThanOrEqual(expression); } else if (expression.getOperator().equals(Ops.NOT)) { // try match NOT_COL_IS_EMPTY Expression< ? > subExpr1 = expression.getArg(0); if (subExpr1 instanceof Operation) { Operation<?> subOp1 = (Operation<?>) subExpr1; if (subOp1.getOperator().equals(Ops.COL_IS_EMPTY)) { visitCollectionEmpty(subOp1.getArg(0), false); return; } else if (subOp1.getOperator().equals(Ops.STRING_IS_EMPTY)) { visitStringEmpty(subOp1.getArg(0), true); return; } } else if (subExpr1 instanceof Path) { visitMemberAccess((Path< ? >) subExpr1, false); return; } documentQuery.openSubclause(); documentQuery.where("*:*"); documentQuery.andAlso(); documentQuery.negateNext(); visitExpression(expression.getArg(0)); documentQuery.closeSubclause(); } else if (expression.getOperator().equals(Ops.COL_IS_EMPTY)) { visitCollectionEmpty(expression.getArg(0), true); } else if (expression.getOperator().equals(Ops.IN)) { if (expression.getArg(0) instanceof Constant && expression.getArg(1) instanceof Path) { visitContains(expression); } else if (expression.getArg(0) instanceof Path && expression.getArg(1) instanceof Constant) { visitIn(expression); } else { throw new IllegalStateException("Unable to handle in/contains expression: " + expression); } } else if (expression.getOperator().equals(Ops.CONTAINS_KEY)) { visitContainsKey(expression); } else if (expression.getOperator().equals(Ops.CONTAINS_VALUE)) { visitContainsValue(expression); } else if (expression.getOperator().equals(LinqOps.Ops.CONTAINS_ALL)) { visitContainsAll(expression); } else if (expression.getOperator().equals(LinqOps.Ops.CONTAINS_ANY)) { visitContainsAny(expression); } else if (expression.getOperator().equals(Ops.IS_NULL)) { visitIsNull(expression); } else if (expression.getOperator().equals(Ops.STRING_IS_EMPTY)) { visitStringEmpty(expression.getArg(0), false); } else if (expression.getOperator().equals(Ops.STRING_CONTAINS)) { throw new IllegalStateException("Contains is not supported, doing a substring match over a text field is a" + " very slow operation, and is not allowed using the Linq API. The recommended method is to use full text search (mark the field as Analyzed and use the search() method to query it."); } else if (expression.getOperator().equals(Ops.STARTS_WITH)) { visitStartsWith(expression); } else if (expression.getOperator().equals(Ops.ENDS_WITH)) { visitEndsWith(expression); } else if (expression.getOperator().equals(LinqOps.Query.ANY)) { visitAny(expression); } else if (expression.getOperator().equals(LinqOps.Query.ANY_RESULT)) { visitAny(); } else { throw new IllegalArgumentException("Expression is not supported: " + expression.getOperator()); } } private void visitContainsAny(Operation<Boolean> expression) { ExpressionInfo memberInfo = getMember(expression.getArg(0)); Object objects = getValueFromExpression(expression.getArg(1), getMemberType(memberInfo)); documentQuery.containsAny(memberInfo.getPath(), (Collection<Object>)objects); } private void visitContainsAll(Operation<Boolean> expression) { ExpressionInfo memberInfo = getMember(expression.getArg(0)); Object objects = getValueFromExpression(expression.getArg(1), getMemberType(memberInfo)); documentQuery.containsAll(memberInfo.getPath(), (Collection<Object>)objects); } @SuppressWarnings("unchecked") private void visitIn(Operation<Boolean> expression) { ExpressionInfo memberInfo = getMember(expression.getArg(0)); Object objects = getValueFromExpression(expression.getArg(1), getMemberType(memberInfo)); documentQuery.whereIn(memberInfo.getPath(), (Collection<Object>)objects); } private void visitIsNull(Operation<Boolean> expression) { ExpressionInfo memberInfo = getMember(expression.getArg(0)); WhereParams whereParams = new WhereParams(); whereParams.setFieldName(memberInfo.getPath()); whereParams.setValue(null); whereParams.setAnalyzed(true); whereParams.setAllowWildcards(false); whereParams.setNestedPath(memberInfo.isNestedPath()); documentQuery.whereEquals(whereParams); } private void visitContainsValue(Operation<Boolean> expression) { ExpressionInfo memberInfo = getMember(expression.getArg(0)); String oldPath = currentPath; currentPath = memberInfo.getPath() + "_Value"; Expression< ? > keyArgument = expression.getArg(1); visitExpression(keyArgument); currentPath = oldPath; } private void visitContainsKey(Operation<Boolean> expression) { ExpressionInfo memberInfo = getMember(expression.getArg(0)); String oldPath = currentPath; currentPath = memberInfo.getPath() + "_Key"; Expression< ? > keyArgument = expression.getArg(1); visitExpression(keyArgument); currentPath = oldPath; } private void visitCollectionEmpty(Expression< ? > expression, boolean isNegated) { if (isNegated) { documentQuery.openSubclause(); documentQuery.where("*:*"); documentQuery.andAlso(); documentQuery.negateNext(); } ExpressionInfo memberInfo = getMember(expression); WhereParams whereParams = new WhereParams(); whereParams.setFieldName(memberInfo.getPath()); whereParams.setValue("*"); whereParams.setAllowWildcards(true); whereParams.setAnalyzed(true); whereParams.setNestedPath(memberInfo.isNestedPath()); documentQuery.whereEquals(whereParams); if (isNegated) { documentQuery.closeSubclause(); } } public void visitStringEmpty(Expression<?> expression, boolean isNegated) { if (isNegated) { documentQuery.openSubclause(); documentQuery.where("*:*"); documentQuery.andAlso(); documentQuery.negateNext(); } ExpressionInfo memberInfo = getMember(expression); documentQuery.openSubclause(); documentQuery.whereEquals(memberInfo.getPath(), Constants.NULL_VALUE, false); documentQuery.orElse(); documentQuery.whereEquals(memberInfo.getPath(), Constants.EMPTY_STRING, false); documentQuery.closeSubclause(); if (isNegated) { documentQuery.closeSubclause(); } } private void visitAndAlso(Operation<Boolean> andAlso) { if (tryHandleBetween(andAlso)) { return; } if (subClauseDepth > 0) { documentQuery.openSubclause(); } subClauseDepth++; visitExpression(andAlso.getArg(0)); documentQuery.andAlso(); visitExpression(andAlso.getArg(1)); subClauseDepth--; if (subClauseDepth > 0) { documentQuery.closeSubclause(); } } private boolean tryHandleBetween(Operation<Boolean> andAlso) { // x.Foo > 100 && x.Foo < 200 // x.Foo < 200 && x.Foo > 100 // 100 < x.Foo && 200 > x.Foo // 200 > x.Foo && 100 < x.Foo Expression< ? > leftExp = andAlso.getArg(0); Expression< ? > rightExp = andAlso.getArg(1); Operation<?> left = null; Operation<?> right = null; if (leftExp instanceof Operation) { left = (Operation< ? >) leftExp; } if (rightExp instanceof Operation) { right = (Operation< ? >) rightExp; } if (left == null || right == null) { return false; } boolean isPossibleBetween = (left.getOperator().equals(Ops.GT) && right.getOperator().equals(Ops.LT)) || (left.getOperator().equals(Ops.GOE) && right.getOperator().equals(Ops.LOE)) || (left.getOperator().equals(Ops.LT) && right.getOperator().equals(Ops.GT)) || (left.getOperator().equals(Ops.LOE) && right.getOperator().equals(Ops.GT)); if (!isPossibleBetween) { return false; } Tuple<ExpressionInfo, Object> leftMember = getMemberForBetween(left); Tuple<ExpressionInfo, Object> rightMember = getMemberForBetween(right); if (leftMember == null || rightMember == null) { return false; } // both must be on the same property if (!leftMember.getItem1().getPath().equals(rightMember.getItem1().getPath())) { return false; } Object min = (left.getOperator().equals(Ops.LT) || left.getOperator().equals(Ops.LOE)) ? rightMember.getItem2() : leftMember.getItem2(); Object max = (left.getOperator().equals(Ops.LT) || left.getOperator().equals(Ops.LOE)) ? leftMember.getItem2() : rightMember.getItem2(); if (left.getOperator().equals(Ops.GOE) || left.getOperator().equals(Ops.LOE)) { documentQuery.whereBetweenOrEqual(leftMember.getItem1().getPath(), min, max); } else { documentQuery.whereBetween(leftMember.getItem1().getPath(), min, max); } return true; } private Tuple<ExpressionInfo, Object> getMemberForBetween(Operation< ? > binaryExpression) { if (isMemberAccessForQuerySource(binaryExpression.getArg(0))) { ExpressionInfo expressionInfo = getMember(binaryExpression.getArg(0)); return Tuple.create(expressionInfo, getValueFromExpression(binaryExpression.getArg(1), expressionInfo.getClazz())); } if (isMemberAccessForQuerySource(binaryExpression.getArg(1))) { ExpressionInfo expressionInfo = getMember(binaryExpression.getArg(1)); return Tuple.create(expressionInfo, getValueFromExpression(binaryExpression.getArg(0), expressionInfo.getClazz())); } return null; } private Object getValueFromExpression(Expression< ? > expression, Class< ? > type) { return linqPathProvider.getValueFromExpression(expression, type); } private void visitOrElse(Operation<Boolean> orElse) { if (subClauseDepth > 0) { documentQuery.openSubclause(); } subClauseDepth++; visitExpression(orElse.getArg(0)); documentQuery.orElse(); visitExpression(orElse.getArg(1)); subClauseDepth--; if (subClauseDepth > 0) { documentQuery.closeSubclause(); } } private void visitEqualsIgnoreCase(Operation<Boolean> expression) { ExpressionInfo memberInfo = getMember(expression.getArg(0)); WhereParams whereParams = new WhereParams(); whereParams.setFieldName(memberInfo.getPath()); whereParams.setValue(getValueFromExpression(expression.getArg(1), getMemberType(memberInfo))); whereParams.setAnalyzed(true); whereParams.setAllowWildcards(false); documentQuery.whereEquals(whereParams); } private void visitEqualsNotIgnoreCase(Operation<Boolean> expression) { ExpressionInfo memberInfo = getMember(expression.getArg(0)); WhereParams whereParams = new WhereParams(); whereParams.setFieldName(memberInfo.getPath()); whereParams.setValue(getValueFromExpression(expression.getArg(1), getMemberType(memberInfo))); whereParams.setAnalyzed(false); whereParams.setAllowWildcards(false); documentQuery.whereEquals(whereParams); } private void visitEquals(Operation<Boolean> expression) { Constant<?> constantExpression = null; if (expression.getArg(1) instanceof Constant<?>) { constantExpression = (Constant< ? >) expression.getArg(1); } if (constantExpression != null && Boolean.TRUE.equals(constantExpression.getConstant())) { visitExpression(expression.getArg(0)); return ; } if (constantExpression != null && Boolean.FALSE.equals(constantExpression.getConstant()) && !(expression.getArg(0) instanceof Path)) { documentQuery.openSubclause(); documentQuery.where("*:*"); documentQuery.andAlso(); documentQuery.negateNext(); visitExpression(expression.getArg(0)); documentQuery.closeSubclause(); return; } if (!isMemberAccessForQuerySource(expression.getArg(0)) && isMemberAccessForQuerySource(expression.getArg(1))) { visitEquals((BooleanOperation) Expressions.booleanOperation(Ops.EQ, expression.getArg(1), expression.getArg(0))); return ; } ExpressionInfo memberInfo = getMember(expression.getArg(0)); WhereParams whereParams = new WhereParams(); whereParams.setFieldName(memberInfo.getPath()); whereParams.setValue(getValueFromExpression(expression.getArg(1), getMemberType(memberInfo))); whereParams.setAnalyzed(true); whereParams.setAllowWildcards(true); whereParams.setNestedPath(memberInfo.isNestedPath()); documentQuery.whereEquals(whereParams); } private boolean isMemberAccessForQuerySource(Expression< ? > arg) { if (!(arg instanceof Path<?>)) { return false; } return true; } private void visitNotEquals(Operation<Boolean> expression) { if (!isMemberAccessForQuerySource(expression.getArg(0)) && isMemberAccessForQuerySource(expression.getArg(1))) { visitEquals((BooleanOperation) Expressions.booleanOperation(Ops.NE, expression.getArg(1), expression.getArg(0))); return ; } ExpressionInfo memberInfo = getMember(expression.getArg(0)); documentQuery.openSubclause(); documentQuery.negateNext(); WhereParams whereParams = new WhereParams(); whereParams.setFieldName(memberInfo.getPath()); whereParams.setValue(getValueFromExpression(expression.getArg(1), getMemberType(memberInfo))); whereParams.setAnalyzed(true); whereParams.setAllowWildcards(false); documentQuery.whereEquals(whereParams); documentQuery.andAlso(); whereParams = new WhereParams(); whereParams.setFieldName(memberInfo.getPath()); whereParams.setValue("*"); whereParams.setAnalyzed(true); whereParams.setAllowWildcards(true); documentQuery.whereEquals(whereParams); documentQuery.closeSubclause(); } private Class<?> getMemberType(ExpressionInfo memberInfo) { return memberInfo.getClazz(); } /** * Gets member info for the specified expression and the path to that expression * @param expression * @return ExpressionInfo */ protected ExpressionInfo getMember(Expression<?> expression) { Param< ? > parameterExpression = getParameterExpressionIncludingConvertions(expression); if (parameterExpression != null) { if (currentPath.endsWith(",")) { currentPath = currentPath.substring(0, currentPath.length() -1); } ExpressionInfo expressionInfo = new ExpressionInfo(currentPath, parameterExpression.getType(), false); return expressionInfo; } return getMemberDirect(expression); } private ExpressionInfo getMemberDirect(Expression< ? > expression) { Result result = linqPathProvider.getPath(expression); //for standard queries, we take just the last part. But for dynamic queries, we take the whole part result.setPath(result.getPath().substring(result.getPath().indexOf('.') + 1)); String propertyName = indexName == null || indexName.toLowerCase().startsWith("dynamic/") ? queryGenerator.getConventions().getFindPropertyNameForDynamicIndex().find(clazz, indexName, currentPath, result.getPath()) : queryGenerator.getConventions().getFindPropertyNameForIndex().find(clazz, indexName, currentPath, result.getPath()); ExpressionInfo expressionInfo = new ExpressionInfo(propertyName, result.getMemberType(), result.isNestedPath()); expressionInfo.setMaybeProperty(result.getMaybeProperty()); return expressionInfo; } private static Param<?> getParameterExpressionIncludingConvertions(Expression<?> expression) { if (expression instanceof ParamExpression){ return (Param< ? >) expression; } else if (expression instanceof Path) { Path<?> path = (Path<?>) expression; if (path.getMetadata().getParent() == null) { return new Param<>(path.getType(), path.getMetadata().getName()); } } return null; } private void visitStartsWith(Operation<Boolean> operation) { Expression< ? > expression = operation.getArg(0); ExpressionInfo memberInfo = getMember(expression); documentQuery.whereStartsWith(memberInfo.getPath(), getValueFromExpression(operation.getArg(1), getMemberType(memberInfo))); } private void visitEndsWith(Operation<Boolean> operation) { Expression< ? > expression = operation.getArg(0); ExpressionInfo memberInfo = getMember(expression); documentQuery.whereEndsWith(memberInfo.getPath(), getValueFromExpression(operation.getArg(1), getMemberType(memberInfo))); } private void visitGreatherThan(Operation<Boolean> expression) { if (!isMemberAccessForQuerySource(expression.getArg(0)) && isMemberAccessForQuerySource(expression.getArg(1))) { visitLessThan((BooleanOperation) BooleanOperation.create(Ops.LT, expression.getArg(1), expression.getArg(0))); return; } ExpressionInfo memberInfo = getMember(expression.getArg(0)); Object value = getValueFromExpression(expression.getArg(1), getMemberType(memberInfo)); documentQuery.whereGreaterThan(getFieldNameForRangeQuery(memberInfo, value), value); } private void visitGreatherThanOrEqual(Operation<Boolean> expression) { if (!isMemberAccessForQuerySource(expression.getArg(0)) && isMemberAccessForQuerySource(expression.getArg(1))) { visitLessThan((BooleanOperation) BooleanOperation.create(Ops.LOE, expression.getArg(1), expression.getArg(0))); return; } ExpressionInfo memberInfo = getMember(expression.getArg(0)); Object value = getValueFromExpression(expression.getArg(1), getMemberType(memberInfo)); documentQuery.whereGreaterThanOrEqual(getFieldNameForRangeQuery(memberInfo, value), value); } private void visitLessThan(Operation<Boolean> expression) { if (!isMemberAccessForQuerySource(expression.getArg(0)) && isMemberAccessForQuerySource(expression.getArg(1))) { visitGreatherThan((BooleanOperation) BooleanOperation.create(Ops.GT, expression.getArg(1), expression.getArg(0))); return; } ExpressionInfo memberInfo = getMember(expression.getArg(0)); Object value = getValueFromExpression(expression.getArg(1), getMemberType(memberInfo)); documentQuery.whereLessThan(getFieldNameForRangeQuery(memberInfo, value), value); } private void visitLessThanOrEqual(Operation<Boolean> expression) { if (!isMemberAccessForQuerySource(expression.getArg(0)) && isMemberAccessForQuerySource(expression.getArg(1))) { visitGreatherThan((BooleanOperation) BooleanOperation.create(Ops.GOE, expression.getArg(1), expression.getArg(0))); return; } ExpressionInfo memberInfo = getMember(expression.getArg(0)); Object value = getValueFromExpression(expression.getArg(1), getMemberType(memberInfo)); documentQuery.whereLessThanOrEqual(getFieldNameForRangeQuery(memberInfo, value), value); } private void visitContains(Operation<Boolean> expression) { ExpressionInfo memberInfo = getMember(expression.getArg(1)); String oldPath = currentPath; currentPath = memberInfo.getPath() + ","; Expression< ? > containsArgument = expression.getArg(0); visitExpression(containsArgument); currentPath = oldPath; } private void visitConstant(Constant< ? > expression, boolean boolValue) { if (String.class.equals(expression.getType())) { if (currentPath.endsWith(",")) { currentPath = currentPath.substring(0, currentPath.length() - 1); } WhereParams whereParams = new WhereParams(); whereParams.setFieldName(currentPath); whereParams.setValue(expression.getConstant()); whereParams.setAnalyzed(true); whereParams.setAllowWildcards(false); whereParams.setNestedPath(false); documentQuery.whereEquals(whereParams); } else { throw new IllegalStateException("Unable to handle constant:" + expression.getConstant()); } } private void visitOperation(Operation<?> expression) { if (expression.getOperator().getId().startsWith(LinqOps.Query.QUERY_OPERATORS_PREFIX)) { visitQueryableMethodCall(expression); } else { throw new IllegalArgumentException("Expression is not supported:" + expression); } } @SuppressWarnings("unchecked") private void visitQueryableMethodCall(Operation< ? > expression) { String operatorId = expression.getOperator().getId(); if (operatorId.equals(LinqOps.Query.WHERE.getId())) { insideWhere++; visitExpression(expression.getArg(0)); if (chanedWhere) { documentQuery.andAlso(); documentQuery.openSubclause(); } if (chanedWhere == false && insideWhere > 1) { documentQuery.openSubclause(); } visitExpression(expression.getArg(1)); if (chanedWhere == false && insideWhere > 1) { documentQuery.closeSubclause(); } if (chanedWhere) { documentQuery.closeSubclause(); } chanedWhere = true; insideWhere--; } else if (operatorId.equals(LinqOps.Query.SKIP.getId())) { visitExpression(expression.getArg(0)); visitSkip((Constant<Integer>) expression.getArg(1)); } else if (operatorId.equals(LinqOps.Query.TAKE.getId())) { visitExpression(expression.getArg(0)); visitTake((Constant<Integer>) expression.getArg(1)); } else if (operatorId.equals(LinqOps.Query.DISTINCT.getId())) { documentQuery.distinct(); } else if (operatorId.equals(LinqOps.Query.FIRST_OR_DEFAULT.getId())) { visitExpression(expression.getArg(0)); visitFirstOrDefault(); } else if (operatorId.equals(LinqOps.Query.FIRST.getId())) { visitExpression(expression.getArg(0)); visitFirst(); } else if (operatorId.equals(LinqOps.Query.SINGLE.getId())) { visitExpression(expression.getArg(0)); visitSingle(); } else if (operatorId.equals(LinqOps.Query.SINGLE_OR_DEFAULT.getId())) { visitExpression(expression.getArg(0)); visitSingleOrDefault(); } else if (operatorId.equals(LinqOps.Query.COUNT.getId())) { visitExpression(expression.getArg(0)); visitCount(); } else if (operatorId.equals(LinqOps.Query.LONG_COUNT.getId())) { visitExpression(expression.getArg(0)); visitLongCount(); } else if (operatorId.equals(LinqOps.Query.ORDER_BY.getId())) { visitExpression(expression.getArg(0)); Expression< ? > orderSpecExpression = expression.getArg(1); if (orderSpecExpression instanceof Constant) { Object constant = ((Constant<?>) orderSpecExpression).getConstant(); visitOrderBy((OrderSpecifier<?>[])constant); } else { throw new IllegalStateException("Constant expected in: " + expression); } } else if (operatorId.equals(LinqOps.Query.SEARCH.getId())) { visitSearch(expression); } else if (operatorId.equals(LinqOps.Query.INTERSECT.getId())) { visitExpression(expression.getArg(0)); documentQuery.intersect(); chanedWhere = false; } else if (operatorId.equals(LinqOps.Query.SELECT.getId())) { Class<?> rootType = extractRootTypeForSelect(expression.getArg(1)); if (rootType != null) { documentQuery.addRootType((Class<T>) rootType); } visitExpression(expression.getArg(0)); visitSelect(expression); } else { throw new IllegalStateException("Unhandled expression: " + expression); } } private Class<?> extractRootTypeForSelect(Expression<?> expression) { if (expression instanceof Path) { Path<?> path = (Path<?>) expression; return path.getType(); } else if (expression instanceof Constant) { Constant<?> constant = (Constant<?>) expression; return (Class< ? >) constant.getConstant(); } else { throw new IllegalStateException("Don't know how to fetch root type for select: " + expression); } } private void visitSelect(Operation< ? > expression) { Expression< ? > projectionExpr = expression.getArg(1); if (projectionExpr instanceof Path) { // projection via x.someProperty Path<?> path = (Path<?>)projectionExpr; addToFieldsToFetch(getSelectPath(path), getSelectPath(path)); if (insideSelect == false) { Set<RenamedField> toDelete = new HashSet<>(); for (RenamedField renamedField : fieldsToRename) { if (renamedField.getOriginalField().equals(StringUtils.capitalize(path.getMetadata().getName()))) { toDelete.add(renamedField); } fieldsToRename.removeAll(toDelete); } RenamedField renamedField = new RenamedField(); renamedField.setNewField(null); renamedField.setOriginalField(StringUtils.capitalize(path.getMetadata().getName())); fieldsToRename.add(renamedField); } } else if (projectionExpr instanceof Constant) { // projection via Class<TProjection> Constant< ? > projectionClassConst = (Constant< ? >) expression.getArg(1); Class<?> projectionClass = (Class< ? >) projectionClassConst.getConstant(); int astArgCount = expression.getArgs().size(); String[] fields = null; String[] projections = null; switch (astArgCount) { case 2: // extract mappings using reflection List<String> fieldsList = new ArrayList<>(); try { for (PropertyDescriptor propertyDescriptor : Introspector.getBeanInfo(projectionClass).getPropertyDescriptors()) { if (propertyDescriptor.getWriteMethod() != null && propertyDescriptor.getReadMethod() != null) { fieldsList.add(StringUtils.capitalize(propertyDescriptor.getName())); } } } catch (IntrospectionException e) { throw new RuntimeException(e); } fields = fieldsList.toArray(new String[0]); projections = fieldsList.toArray(new String[0]); break; case 4: // we have already extracted projections fields = (String[]) ((Constant<?>)expression.getArg(2)).getConstant(); projections = (String[]) ((Constant<?>)expression.getArg(3)).getConstant(); break; default: throw new IllegalStateException("Unexpected number of nodes in select: " + expression); } for (int i = 0; i < fields.length; i++) { addToFieldsToFetch(fields[i], projections[i]); } } else { throw new IllegalStateException("Unhandled select expression: " + expression); } } private void addToFieldsToFetch(String docField, String renamedField) { Field identityProperty = documentQuery.getDocumentConvention().getIdentityProperty(clazz); if (identityProperty != null && identityProperty.getName().equals(docField)) { fieldsToFetch.add(Constants.DOCUMENT_ID_FIELD_NAME); if (!identityProperty.getName().equals(renamedField)) { docField = Constants.DOCUMENT_ID_FIELD_NAME; } } else { fieldsToFetch.add(docField); } if (renamedField != null && !docField.equals(renamedField)) { if (identityProperty == null) { String idPropName = documentQuery.getDocumentConvention().getFindIdentityPropertyNameFromEntityName().find(documentQuery.getDocumentConvention().getTypeTagName(clazz)); if (docField.equals(idPropName)) { RenamedField renamedField2 = new RenamedField(); renamedField2.setNewField(renamedField); renamedField2.setOriginalField(Constants.DOCUMENT_ID_FIELD_NAME); fieldsToRename.add(renamedField2); } } RenamedField renamedField3 = new RenamedField(); renamedField3.setNewField(renamedField); renamedField3.setOriginalField(docField); fieldsToRename.add(renamedField3); } } private String getSelectPath(Path<?> expression) { ExpressionInfo expressionInfo = getMember(expression); return expressionInfo.getPath(); } public void visitSearch(Operation<?> searchExpression) { List<Operation<?>> expressions = new ArrayList<>(); Operation<?> search = searchExpression; Expression<?> target = searchExpression.getArg(0); Reference<Object> valueRef = new Reference<>(); while (true) { expressions.add(search); if (!LinqPathProvider.getValueFromExpressionWithoutConversion(search.getArg(4), valueRef)) { throw new IllegalStateException("Could not extract value from " + searchExpression); } SearchOptionsSet queryOptions = (SearchOptionsSet) valueRef.value; if (!queryOptions.contains(SearchOptions.GUESS)) { break; } Expression< ? > maybeInnerOperation = search.getArg(0); if (maybeInnerOperation instanceof Operation) { search = (Operation< ? >) maybeInnerOperation; Operation<?> innerOperation = (Operation<?>) maybeInnerOperation; if (LinqOps.Query.SEARCH.getId().equals(innerOperation.getOperator().getId())) { target = search.getArg(0); continue; } } break; } visitExpression(target); if (expressions.size() > 1) { documentQuery.openSubclause(); } for (Operation<?> expression : Lists.reverse(expressions)) { ExpressionInfo expressionInfo = getMember(expression.getArg(1)); if (LinqPathProvider.getValueFromExpressionWithoutConversion(expression.getArg(2), valueRef) == false) { throw new IllegalArgumentException("Could not extract value from " + expression); } String searchTerms = (String) valueRef.value; if (LinqPathProvider.getValueFromExpressionWithoutConversion(expression.getArg(3), valueRef) == false) { throw new IllegalArgumentException("Could not extract value from " + expression); } Double boost = (Double) valueRef.value; if (LinqPathProvider.getValueFromExpressionWithoutConversion(expression.getArg(4), valueRef) == false) { throw new IllegalArgumentException("Could not extract value from " + expression); } SearchOptionsSet options = (SearchOptionsSet) valueRef.value; if (chanedWhere && options.contains(SearchOptions.AND)) { documentQuery.andAlso(); } if (options.contains(SearchOptions.NOT)) { documentQuery.openSubclause(); documentQuery.negateNext(); } if (LinqPathProvider.getValueFromExpressionWithoutConversion(expression.getArg(5), valueRef) == false) { throw new IllegalArgumentException("Could not extract value from " + expression); } EscapeQueryOptions queryOptions = (EscapeQueryOptions) valueRef.value; documentQuery.search(expressionInfo.getPath(), searchTerms, queryOptions); if (options.contains(SearchOptions.NOT)) { documentQuery.andAlso(); documentQuery.search(expressionInfo.getPath(), "*"); documentQuery.closeSubclause(); } documentQuery.boost(boost); if (options.contains(SearchOptions.AND)) { chanedWhere = true; } } if (expressions.size() > 1) { documentQuery.closeSubclause(); } if (LinqPathProvider.getValueFromExpressionWithoutConversion(searchExpression.getArg(4), valueRef) == false) { throw new IllegalArgumentException("Could not extract value from " + searchExpression); } SearchOptionsSet options = (SearchOptionsSet) valueRef.value; if (options.contains(SearchOptions.GUESS)) { chanedWhere = true; } } private void visitOrderBy(OrderSpecifier< ? >[] orderSpecs) { for (OrderSpecifier<?> orderSpec : orderSpecs) { ExpressionInfo result = getMemberDirect(orderSpec.getTarget()); Class<?> fieldType = result.getClazz(); String fieldName = result.getPath(); if (result.getMaybeProperty() != null && queryGenerator.getConventions().getFindIdentityProperty().find(result.getMaybeProperty())) { fieldName = Constants.DOCUMENT_ID_FIELD_NAME; fieldType = String.class; } if (queryGenerator.getConventions().usesRangeType(fieldType)) { fieldName += "_Range"; } documentQuery.addOrder(fieldName, orderSpec.getOrder() == Order.DESC, fieldType); } } private void visitSkip(Constant<Integer> constantExpression) { //Don't have to worry about the cast failing, the Skip() extension method only takes an int documentQuery.skip(constantExpression.getConstant()); } private void visitTake(Constant<Integer> constantExpression) { //Don't have to worry about the cast failing, the Take() extension method only takes an int documentQuery.take(constantExpression.getConstant()); } private void visitAny(Operation<?> exp) { ExpressionInfo memberInfo = getMember(exp.getArg(0)); String oldPath = currentPath; currentPath = memberInfo.getPath() + ","; visitExpression(exp.getArg(1)); currentPath = oldPath; } private void visitAny() { documentQuery.take(1); queryType = SpecialQueryType.ANY; } private void visitCount() { documentQuery.take(0); queryType = SpecialQueryType.COUNT; } private void visitLongCount() { documentQuery.take(0); queryType = SpecialQueryType.LONG_COUNT; } private void visitSingle() { documentQuery.take(2); queryType = SpecialQueryType.SINGLE; } private void visitSingleOrDefault() { documentQuery.take(2); queryType = SpecialQueryType.SINGLE_OR_DEFAULT; } private void visitFirst() { documentQuery.take(1); queryType = SpecialQueryType.FIRST; } private void visitFirstOrDefault() { documentQuery.take(1); queryType = SpecialQueryType.FIRST_OR_DEFAULT; } private String getFieldNameForRangeQuery(ExpressionInfo expression, Object value) { Field identityProperty = documentQuery.getDocumentConvention().getIdentityProperty(clazz); if (identityProperty != null && identityProperty.getName().equals(expression.getPath())) { Class<?> identityPropertyType = identityProperty.getType(); List<Class<?>> types = Arrays.<Class<?>>asList(Integer.class, Integer.TYPE, Long.class, Long.TYPE, Float.class, Float.TYPE, Double.class, Double.TYPE); if (types.contains(identityPropertyType)) { throw new IllegalArgumentException("You cannot issue range queries on a identity property that is of a numeric type.\n" + "RavenDB numeric ids are purely client side, on the server, they are always strings, " + "and aren't going to sort according to your expectations.\n" + "You can create a stand-in property to hold the numeric value, and do a range query on that."); } return Constants.DOCUMENT_ID_FIELD_NAME; } if (documentQuery.getDocumentConvention().usesRangeType(value) && !expression.getPath().endsWith("_Range")) { return expression.getPath() + "_Range"; } return expression.getPath(); } @SuppressWarnings("unchecked") public IDocumentQuery<T> getDocumentQueryFor(Expression<?> expression) { IDocumentQuery<T> q = queryGenerator.documentQuery(clazz, indexName, isMapReduce); q.setTransformerParameters(transformerParameters); documentQuery = (IAbstractDocumentQuery<T>) q; q.setResultTransformer(resultsTransformer); visitExpression(expression); if (customizeQuery != null) { customizeQuery.customize(new DocumentQueryCustomization((DocumentQuery< ? >) documentQuery)); } return q.selectFields(clazz, fieldsToFetch.toArray(new String[0])); } @SuppressWarnings("unchecked") public Object execute(Expression<?> expression) { chanedWhere = false; documentQuery = (IAbstractDocumentQuery<T>) getDocumentQueryFor(expression); if (newExpressionType.equals(clazz)) { return executeQuery(clazz); } else { throw new IllegalStateException("Don't know how to handle expression:" + expression); } } @SuppressWarnings("unchecked") private <TProjection> Object executeQuery(Class<TProjection> projectionClass) { List<String> renamedFields = new ArrayList<>(); outer: for (String field :fieldsToFetch) { for (RenamedField renamedField : fieldsToRename) { if (renamedField.getOriginalField().equals(field)) { renamedFields.add(renamedField.getNewField() != null ? renamedField.getNewField() : field); continue outer; } } renamedFields.add(field); } IDocumentQuery<TProjection> finalQuery = ((IDocumentQuery<T>)documentQuery).selectFields(projectionClass, fieldsToFetch.toArray(new String[0]), renamedFields.toArray(new String[0])); if (org.apache.commons.lang.StringUtils.isNotEmpty(resultsTransformer)) { finalQuery.setResultTransformer(this.resultsTransformer); } finalQuery.setTransformerParameters(this.transformerParameters); if (!fieldsToRename.isEmpty()) { finalQuery.afterQueryExecuted(new Action1<QueryResult>() { @Override public void apply(QueryResult result) { renameResults(result); } }); } Object executeQuery = getQueryResult(finalQuery); QueryResult queryResult = finalQuery.getQueryResult(); if (afterQueryExecuted != null) { afterQueryExecuted.apply(queryResult); } return executeQuery; } public void renameResults(QueryResult queryResult) { for (int index = 0; index < queryResult.getResults().size(); index++) { RavenJObject result = queryResult.getResults().get(index); RavenJObject safeToModify = result.createSnapshot(); boolean changed = false; Map<String, RavenJToken> values = new HashMap<>(); Set<String> renamedFieldSet = new HashSet<>(); for (RenamedField field : fieldsToRename) { renamedFieldSet.add(field.getOriginalField()); } for(String renamedField : renamedFieldSet) { Reference<RavenJToken> valueRef = new Reference<>(); if (safeToModify.tryGetValue(renamedField, valueRef) == false) { continue; } values.put(renamedField, valueRef.value); safeToModify.remove(renamedField); } for (RenamedField rename : fieldsToRename) { if (!values.containsKey(rename.getOriginalField())) { continue; } RavenJToken val = values.get(rename.getOriginalField()); changed = true; RavenJObject ravenJObject = (RavenJObject) ((val instanceof RavenJObject) ? val : null); if (rename.getNewField() == null && ravenJObject != null) { safeToModify = ravenJObject; } else if (rename.getNewField() != null) { safeToModify.set(rename.getNewField(), val); } else { safeToModify.set(rename.getOriginalField(), val); } } if (!changed) { continue; } safeToModify.ensureCannotBeChangeAndEnableShapshotting(); queryResult.getResults().set(index, safeToModify); } } private <TProjection> Object getQueryResult(IDocumentQuery<TProjection> finalQuery) { List<TProjection> list = null; switch (queryType) { case FIRST: return finalQuery.first(); case FIRST_OR_DEFAULT: return finalQuery.firstOrDefault(); case SINGLE: list = finalQuery.toList(); if (list.size() != 1) { throw new IllegalStateException("Expected one result. Got: " + list.size()); } return list.get(0); case SINGLE_OR_DEFAULT: list = finalQuery.toList(); if (list.size() > 1) { throw new IllegalStateException("Expected one result. Got: " + list.size()); } return list.isEmpty() ? null : list.get(0); case ANY: return finalQuery.any(); case COUNT: return finalQuery.getQueryResult().getTotalResults(); case LONG_COUNT: return (long)finalQuery.getQueryResult().getTotalResults(); default: return finalQuery; } } }
[ "marcin@ais.pl" ]
marcin@ais.pl
23ec7cefabaacb7de82753d27e6e3a5ba491ad39
f6b3fe195087abb03bc039caea943166afdf7d6a
/app/src/main/java/com/example/service/config/SwaggerConfig.java
4592e8ec52ac194bee926b583f0a7bf390e19bb1
[]
no_license
jhagestedt/peer-service
0ca96c2e4610c984fd53efeb4857cea49c472c61
7bf3eca263f96f20f92184e6de4440c2e7dc04ba
refs/heads/master
2020-04-12T02:56:30.567119
2019-01-04T13:58:40
2019-01-04T13:58:40
162,258,439
0
0
null
null
null
null
UTF-8
Java
false
false
1,218
java
package com.example.service.config; import lombok.Getter; import lombok.Setter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; @Getter @Setter @EnableSwagger2 @Configuration @ConfigurationProperties(prefix = "swagger") public class SwaggerConfig { private String title; private String description; private String include; @Bean @Autowired public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(new ApiInfoBuilder() .title(title) .description(description) .build()) .forCodeGeneration(true) .select() .paths(PathSelectors.regex(include)) .build(); } }
[ "julien.hagestedt@gmail.com" ]
julien.hagestedt@gmail.com
f8cfb0be07497df0927ddc37c3b3656216742a40
e1aec48c1c58e62130b74a7e9c857c74f7233513
/app/src/main/java/com/example/minimalistcalendar/Util/JSONUtil.java
5ba22c1779fc10118f6793cf149838bb9e24ca20
[]
no_license
thbelief/minimalistcalendar
2eeefea69adb37524f76b18b83be26ce2421dc30
5b7beffd7fa4def6bddc2220f2285c629916bcef
refs/heads/master
2023-04-30T03:42:40.752767
2021-05-06T05:01:04
2021-05-06T05:05:38
340,568,264
0
0
null
null
null
null
UTF-8
Java
false
false
2,361
java
package com.example.minimalistcalendar.Util; import com.example.minimalistcalendar.Bean.DataBean; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.List; /** * @ProjectName: MinimalistCalendar * @Package: com.example.minimalistcalendar.Util * @ClassName: JSONUtil * @Description: 作用 * @Author: 作者名 * @CreateDate: 2021/2/18 11:39 */ public class JSONUtil { //这个类用来将数据转化为json 方便和服务器交互 public static JsonArray toJSONArray(List<DataBean> lists,int userID) throws JSONException { //传入DataBean数组 返回JSON的数组 JsonArray jsonArray=new JsonArray(); for(int i=0;i<lists.size();i++){ JsonObject json= new JsonObject(); json.addProperty("userID",userID); json.addProperty("_id",lists.get(i).getId()); json.addProperty("title",lists.get(i).getTitle()); json.addProperty("degree",lists.get(i).getDegree()); json.addProperty("degreeColor",lists.get(i).getDegreeColor()); json.addProperty("year",lists.get(i).getYear()); json.addProperty("month",lists.get(i).getMonth()); json.addProperty("day",lists.get(i).getDay()); json.addProperty("isAlarm",lists.get(i).getIsAlarm()); json.addProperty("alarmRemind",lists.get(i).getAlarmRemind()); json.addProperty("description",lists.get(i).getDescription()); jsonArray.add(json); } return jsonArray; } //单个DataBean的转换 public static JSONObject toJSON(DataBean dataBean,String userID) throws JSONException { JSONObject json=new JSONObject(); json.put("userID",userID); json.put("_id",dataBean.getId()); json.put("title",dataBean.getTitle()); json.put("degree",dataBean.getDegree()); json.put("degreeColor",dataBean.getDegreeColor()); json.put("year",dataBean.getYear()); json.put("month",dataBean.getMonth()); json.put("day",dataBean.getDay()); json.put("isAlarm",dataBean.getIsAlarm()); json.put("alarmRemind",dataBean.getAlarmRemind()); json.put("description",dataBean.getDescription()); return json; } }
[ "38978160+thbelief@users.noreply.github.com" ]
38978160+thbelief@users.noreply.github.com
8ea0118f7f6d029bb179a4c5c14d262b99fd4e1f
b2a553415d2143a87cb8af2dfea5189def526c6d
/src/main/java/com/shihao/dao/MiaoshaUserDao.java
df25d6444e1c3f36238f1170ab684717b2c6c99c
[]
no_license
bw0411/miaosha
54925506846cf1abd308d80489fef2c8060d04f4
8ea867be0f6ac187cbb4e85eb84af27738ac5b81
refs/heads/master
2020-04-23T06:36:51.038615
2019-02-18T07:18:05
2019-02-18T07:18:05
170,979,231
0
0
null
null
null
null
UTF-8
Java
false
false
531
java
package com.shihao.dao; import com.shihao.domain.MiaoshaUser; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; @Mapper public interface MiaoshaUserDao { @Select("select * from miaosha_user where id = #{id}") public MiaoshaUser getById(@Param("id")Long id); @Update("update miaosha_user set password = #{password} where id = #{id}") public void updatePwd(MiaoshaUser updateUser); }
[ "zhangshc@yonyou.com" ]
zhangshc@yonyou.com
620845529f32d4b736ecccadcde9458221ce15a8
7d9fad28ef38ac40c8b16923f020bc39b2a6df40
/javaPrac/src/selenium/Ex3_Locators.java
6117624e41f0aedb7ee894299071abeec9fe85cb
[]
no_license
Mrninalini/mrinalini.selenium.java
19d636083fd2df64788636ec6bca162439777f1a
11c4a4bfa43bdc8cfa062fe9cefc1954ac887b9a
refs/heads/master
2022-12-12T13:06:08.915357
2020-09-05T12:26:39
2020-09-05T12:26:39
292,207,079
0
0
null
2020-09-05T12:13:10
2020-09-02T07:10:23
Java
UTF-8
Java
false
false
4,062
java
/* Locators: identify or locate a webelement using locator Types of locators: name*, id*, class*, link text, partial linktext , css, Xpath-> way of locating element -> (house no, society name etc) ex: driver.findElement(By.xpath("//input[@name='q']")); //tag [@attribute ='value'] //xpath = //input[@name ='firstname'] //xpath = //input[@class = "inputtext _58mg _5dba _2ph-"] //xpath = //input[@id ='u_0_r'] Xpath types: Absolute:1>2>3>4>5 (it start searching from begning) ex: /header/div[1]/div[2]/div[3] (it starts from stairs Single slash-> look at immediate child Relative: it start searching from recent tag. ex: //input[@name='firstname'] (it navigates like lift) double slash -> looks anywhere for all nested children xpath: //*[@id="tsf"]/div[2]/div[1]/div[1]/div/div[2]/input Full xpath: /html/body/div/div[2]/form/div[2]/div[1]/div[1]/div/div[2]/input chro path : //input[@name='q'] //tag[@contains (text(),'value') //tag [starts-with (attribute, 'value')] tagname-> types input, a ,div attribute: name, class, id Anchor tag : <a href = "http://abc.com"> (Links) findElement by id findElement by name findElement by class Different types of inputs? text feild button link radio button checkbox select dropdown waits: thread.wait(with exception handling) driver.close()->current or recent window close driver.quit() ->close all windows Waits: delay,hold,lag Implicit Wait: Wait at every location(Ex:Passenger train wait at every station->performance issue) driver.manage().timeouts().implicitlyWait(500, sec) Explicit Wait: Wait at particular location(Ex:Express train-> preferred method) WebDriverWait w = new WebDriverWait(driver,timeout in sec); WebDriverWait w = new WebDriverWait(driver,10); w.until(ExpectedCondition.visibilityofElementlocated(By.xpathexpression) Threads.sleep() (performance degrdation) */ package selenium; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.annotations.Test; public class Ex3_Locators { @Test public void fb() throws InterruptedException { String driverpath = "D:\\Selenium Drivers\\chromedriver.exe"; System.setProperty("webdriver.chrome.driver",driverpath); //WebDriver: It is an interface(What is interface)we are defining refrence variable "driver" whoose type is WebDriver. //now any object we assign to it must be an instance of class(ChromeDriver) that implements the interface. WebDriver driver = new ChromeDriver(); //Interface obj = new class(); driver.manage().window().maximize(); driver.get("https://www.facebook.com/r.php"); Thread.sleep(3000); //wait //locators //driver.findElement(By.name("firstname")).sendKeys("Mrinalini"); //firstname //Step 1: Enter first name driver.findElement(By.xpath("//input[@id='u_0_n']")).sendKeys("Mrinalini"); Thread.sleep(3000); //Step 2: enter last name //driver.findElement(By.name("lastname")).sendKeys("Chandola"); //lastname driver.findElement(By.xpath("//input[@id='u_0_p']")).sendKeys("Chandola"); Thread.sleep(3000); //Step 3: Enter email id //driver.findElement(By.name("reg_email__")).sendKeys("mrinalini@gmail.com"); //email driver.findElement(By.xpath("//input[@id='u_0_s']")).sendKeys("mrinalini@gmail.com"); //Step 4: Wait and Re-enter email id WebDriverWait wait = new WebDriverWait(driver,20); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//input[@id='u_0_v']"))); //Explicit wait driver.findElement(By.xpath("//input[@id='u_0_v']")).sendKeys("mrinalini@gmail.com"); //Step 5:Enter password driver.findElement(By.xpath("//input[@id = 'password_step_input']")).sendKeys("Test"); //Password Thread.sleep(3000); //driver.close(); //current or recent window close //driver.quit(); //close all windows } }
[ "ASUS@LAPTOP-PAB7HA8D" ]
ASUS@LAPTOP-PAB7HA8D
ff24b3bd70775cda2c6a1c6e7516c012075e76c2
7a708397acb62dd9cfbed6ea98e00e5416ccfdd6
/org/jempeg/nodestore/soup/AbstractTagPlaylistSoupLayer.java
8ee42b2f7a50863f22f75490a7f9c436d01d72a4
[]
no_license
lbt/jemplode
3e2053cd13ee6be1fc10c19e1131ba1f1de528e3
c1e1c8fe02e2367ec005584bff6138edb3e354bd
refs/heads/master
2021-01-22T09:05:20.590067
2010-12-19T13:38:44
2010-12-19T13:38:44
1,181,773
0
5
null
null
null
null
UTF-8
Java
false
false
2,672
java
package org.jempeg.nodestore.soup; import org.jempeg.nodestore.FIDPlaylist; import org.jempeg.nodestore.IFIDNode; import org.jempeg.nodestore.model.NodeTag; import com.inzyme.text.CollationKeyCache; import com.inzyme.text.ResourceBundleUtils; import com.inzyme.util.ReflectionUtils; public abstract class AbstractTagPlaylistSoupLayer implements IPlaylistSoupLayer { private NodeTag myTag; private CollationKeyCache mySortCache; private NodeTag mySortTag; private int myContainedType; public AbstractTagPlaylistSoupLayer(String _tagName, int _containedType, String _sortTag) { this(NodeTag.getNodeTag(_tagName), _containedType, NodeTag.getNodeTag(_sortTag)); } public AbstractTagPlaylistSoupLayer(NodeTag _tag, int _containedType, NodeTag _sortTag) { myTag = _tag; myContainedType = _containedType; mySortTag = _sortTag; mySortCache = CollationKeyCache.createDefaultCache(); } public int getType() { return myTag.getIconType(); } public NodeTag getSortTag() { return mySortTag; } public CollationKeyCache getSortCache() { return mySortCache; } public boolean isDependentOn(NodeTag _tag) { return myTag.isDerivedFrom(_tag); } public FIDPlaylist[] getPlaylists(FIDPlaylist _soupPlaylist, IFIDNode _node, boolean _createIfMissing) { String playlistName = getPlaylistName(_node); int playlistIndex = _soupPlaylist.getPlaylistIndex(playlistName, getType(), myContainedType, _node, false, _createIfMissing, mySortCache); FIDPlaylist[] playlists; if (playlistIndex < 0) { playlists = new FIDPlaylist[0]; } else { FIDPlaylist newPlaylist = _soupPlaylist.getPlaylistAt(playlistIndex); playlists = new FIDPlaylist[] { newPlaylist }; //newPlaylist.setSoup(true); } return playlists; } public boolean qualifies(IFIDNode _node) { boolean qualifies = _node.isIdentified() && !_node.isTransient() && !_node.isMarkedForDeletion() && !(_node instanceof FIDPlaylist); return qualifies; } protected String getPlaylistName(IFIDNode _node) { String value = myTag.getStringValue(_node).trim(); if (value.length() == 0) { value = ResourceBundleUtils.getUIString("soup.tagValueMissing"); } else { value = getPlaylistName(value); } return value; } protected abstract String getPlaylistName(String _value); public NodeTag getTag() { return myTag; } protected void setTag(NodeTag _tag) { myTag = _tag; } public String toString() { return ReflectionUtils.toString(this); } }
[ "david@dgreaves.com" ]
david@dgreaves.com
9d89b22f59f362a3bb0e3defc8b54b82eb11d184
5584163825ebfd5f70c937dd450440bb32b87082
/src/main/java/com/example/suanfa/levelone/class04/Code03_HashMapTreeMap.java
0df85fcab168125893c6ea988533867b2b25a675
[]
no_license
Elliot-Ji/Learndemo
430c10678f128ac6e8e09e59955330a2d8802598
ee2745e0deb3b1c1ffdd3bdb362d9e995c847516
refs/heads/master
2023-05-12T09:06:30.259174
2023-05-08T01:18:02
2023-05-08T01:18:02
250,484,356
1
0
null
2022-11-24T06:17:46
2020-03-27T08:48:44
Java
UTF-8
Java
false
false
763
java
package com.example.suanfa.levelone.class04; import java.util.HashMap; import java.util.TreeMap; /** * 哈希表与有序表 * 哈希表: 时间复杂度都是常数操作 * 按值传递: HashMap中的key : 如是String,Integer,Double等都是按值传递 * 按引用传递: HashMap中的key是引用类型,则是按引用传递 * 有序表: TreeMap, 会按照key排好序 * 按值传递 * 按引用传递 * @author: Elliot Ji * @createDate: 2022-04-26 **/ public class Code03_HashMapTreeMap { public static void main(String[] args) { HashMap<String,String> hashMap = new HashMap<>(); TreeMap<Integer,String> treeMap = new TreeMap<>(); } }
[ "jimz@baiten.cn" ]
jimz@baiten.cn
47bd28325b5cfb16fdd792b074d9dc547c1bcdbb
4634215f1c3bcdf21a3e78fbd2fc8e13f7c0e9f0
/src/main/java/com/appslandia/plum/base/POST.java
59292e28974e90ca4fa3e829adc0143640e05b48
[ "MIT" ]
permissive
wings20161230/appslandia-plum
df2c70a55f71c9d2f5135749eaa539813771ff17
9d11b5a684c84421c3b0a7c5c2841389a9a23123
refs/heads/master
2021-01-13T16:40:04.975365
2017-01-06T14:58:49
2017-01-06T14:58:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,580
java
// The MIT License (MIT) // Copyright © 2015 AppsLandia. All rights reserved. // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. package com.appslandia.plum.base; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * * @author <a href="mailto:haducloc13@gmail.com">Loc Ha</a> * */ @Target(value = { ElementType.METHOD }) @Retention(value = RetentionPolicy.RUNTIME) @Documented public @interface POST { }
[ "haducloc13@gmail.com" ]
haducloc13@gmail.com
59aa096eae44aaa0aa4d0ad52a4f09020460c3f5
76d180c4d8ea33945da5bb33d2d82df742772531
/project1021/src/poduct/Hero.java
30a4219e2c6d00e7d6ae381678cf1ee8336a4de5
[]
no_license
jenkwon92/Java_Workspace
308110655e66ada93fb325e7e0c1058147cc860a
bc35bea925bf750e60014fb96cca1530589dfb43
refs/heads/master
2023-01-20T10:22:32.941338
2020-11-29T13:35:45
2020-11-29T13:35:45
316,386,845
0
0
null
null
null
null
UHC
Java
false
false
808
java
public class Hero { int hp=10; boolean fly=false; String name="메가맨"; // has a 맞미만, 워낙 빈도수가 높으니, 그냥 일반자료형처럼 사용됨 Bullet bullet; //객체이므로 has a 관계 public void setHp(int hp) { //hp 값을 변경하고 싶다 --매개변수 이용 /자료형을 명시해야함 this.hp=hp; } public void setFly(boolean fly) {//fly 값을 변경하고 싶다 this.fly=fly; } public void setName(String name) {//name 값을 변경하고 싶다 this.name=name; } public void fire(Bullet bullet){//bullet 을 다른 무기로 변경하고 싶다 this.bullet=bullet; } public static void main(String[] args) { Hero hero = new Hero(); hero.setHp(500); hero.setFly(true); hero.setName("앤트맨"); hero.fire(new Bullet()); } }
[ "silverkay92@gmail.com" ]
silverkay92@gmail.com
dee3e1be31964f0e3beea1186cfac4f6c2a71293
4b5538b5a21394fb00a5d7f512feadbb7bc6302a
/src/pp/corleone/service/iautos/status/IautosStatusCallback.java
72801e1c33e53cfcb9d00a9e80349990f6e42a11
[]
no_license
535521469/shcfetcher4j
f0f7e65d17ca92aecb7f5b6d688bb1f84cff5cdc
f41c6693000ef88801c0876841a28fad73dafbfa
refs/heads/master
2021-03-12T23:42:53.976227
2013-11-09T11:16:07
2013-11-09T11:16:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,484
java
package pp.corleone.service.iautos.status; import java.util.Collection; import java.util.Date; import java.util.Map; import org.hibernate.Session; import org.hibernate.Transaction; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import pp.corleone.dao.DaoUtil; import pp.corleone.dao.iautos.IautosCarInfoDao; import pp.corleone.domain.iautos.IautosCarInfo; import pp.corleone.domain.iautos.IautosCarInfo.IautosStatusCode; import pp.corleone.service.Callback; import pp.corleone.service.iautos.IautosConstant; import pp.corleone.service.iautos.detail.IautosDetailExtractUtil; public class IautosStatusCallback extends Callback { private IautosCarInfoDao carDao; public IautosStatusCallback() { Session session = this.getSession(); this.setCarDao(new IautosCarInfoDao(session)); } public Session getSession() { return DaoUtil.getCurrentSession(); } public IautosCarInfoDao getCarDao() { return carDao; } public void setCarDao(IautosCarInfoDao carDao) { this.carDao = carDao; } @Override public Map<String, Collection<?>> call() throws Exception { Document doc = this.getResponseWrapper().getDoc(); IautosCarInfo ici = (IautosCarInfo) this.getResponseWrapper() .getContext().get(IautosConstant.CAR_INFO); if (IautosDetailExtractUtil.isDuringValidate(doc)) { getLogger().info( "body is blank:" + this.getResponseWrapper().getUrl()); return null; } Element detailDivTag = doc.select("#car_detail").first(); String priceLiteral = IautosDetailExtractUtil.getPriceLiteral(detailDivTag); String statusLiteral = IautosDetailExtractUtil.getStatusLiteral(detailDivTag); IautosStatusCode code = IautosDetailExtractUtil.getStatusCode(priceLiteral, statusLiteral); if (null == code) { throw new IllegalArgumentException("status type:" + statusLiteral + ";" + priceLiteral); } Transaction tx = this.getSession().beginTransaction(); try { IautosCarInfo exist_ici = this.getCarDao().getBySeqID( ici.getSeqID(), this.getSession()); Date now = new Date(); if (code.equals(IautosStatusCode.STATUS_TYPE_FOR_SALE)) { exist_ici.setLastActiveDate(now); this.getLogger() .info("for cycle check:" + exist_ici.getSeqID()); } else { exist_ici.setStatusType(code); exist_ici.setOfflineDate(now); getLogger().info("offline:" + exist_ici.getSeqID()); } tx.commit(); } catch (Exception e) { e.printStackTrace(); tx.rollback(); } return null; } }
[ "535521469@qq.com" ]
535521469@qq.com
4809483c1bb66a1f8a6d234d26394c922393df2b
c63cd79d55a1e262552943afb91a9e512e813fd5
/src/main/java/javastat/probability/HypergeometricDistribution.java
fc309a42a04e977de73ae0d345e39ca019c720eb
[]
no_license
albertoSoto/Lince
e1ee304950daf72c5ae0955f3c569f6d2b5fcae5
305f59e269e414e681c12a4cc0c1c1115ecb3136
refs/heads/master
2021-01-17T23:37:43.310964
2018-01-27T14:51:42
2018-01-27T14:51:42
29,438,526
0
0
null
2015-01-18T19:46:38
2015-01-18T19:46:37
null
UTF-8
Java
false
false
6,588
java
package javastat.probability; /** * <p>Title: javastat</p> * <p>Description: JAVA programs for statistical computations</p> * <p>Copyright: Copyright (c) 2009</p> * <p>Company: Tung Hai University</p> * @version 1.4 */ import static java.lang.Math.*; import javastat.util.*; import JSci.maths.statistics.*; /** * * <p>Calculates the density, probability, and percentile for a * hypergeometric distribution. </p> * <p> </p> * <br> Example: * <br> int N = 50; * <br> int r = 10; * <br> int n = 20; * <br> double hypergeometricPercentiles = 4.0; * <br> double hypergeometricX = 1.0; * <br> double hypergeometricProb = 0.90; * <br> * <br> HypergeometricDistribution testclass1 = * <br> &nbsp;&nbsp;&nbsp; new HypergeometricDistribution(N, r, n); * <br> double cumulative = testclass1.cumulative(hypergeometricPercentiles); * <br> double probability = testclass1.probability(hypergeometricX); * <br> double inverse = testclass1.inverse(hypergeometricProb); */ public class HypergeometricDistribution extends ProbabilityDistribution { /** * The total number of elements in two populations. */ public int N; /** * The number of elements in one population. */ public int r; /** * The number of elements taken from the two populations. */ public int n; /** * The cumulative distribution function (CDF). */ public double cumulative; /** * The probability density. */ public double probability; /** * The percentile. */ public double inverse; /** * The class contains the collections of some basic methods used in * statistical computations. */ private BasicStatistics basicStatistics = new BasicStatistics(); /** * Default HypergeometricDistribution constructor. */ public HypergeometricDistribution(){}; /** * The HypergeometricDistribution constructor with the specified parameters. * @param N the total number of elements in two populations. * @param r the number of elements in one population. * @param n the number of elements taken from the two populations. */ public HypergeometricDistribution(int N, int r, int n) { this.N = N; this.r = r; this.n = n; } /** * Calculates the cumulative distribution function (CDF) of a hypergeometric * random variable * @param N the total number of elements in two populations. * @param r the number of elements in one population. * @param n the number of elements taken from the two populations. * @param percentile the percentile. * @return the cumulative distribution function. */ public double cumulative(int N, int r, int n, double percentile) { this.N = N; this.r = r; this.n = n; cumulative = 0; int x = (int) floor(percentile); if (x >= 0 && N >= 0) { for (int i = max(r - N + n, 0); i <= x; i++) { cumulative = (basicStatistics.combination(r, i) * basicStatistics.combination(N - r, n - i)) / basicStatistics.combination(N, n) + cumulative; } } return cumulative; } /** * Calculates the cumulative distribution function (CDF) of a hypergeometric * random variable * @param percentile the percentile. * @return the cumulative distribution function. */ public double cumulative(double percentile) { return cumulative(N, r, n, percentile); } /** * Calculates the probability density for a hypergeometic random variable. * @param N the total number of elements in two populations. * @param r the number of elements in one population. * @param n the number of elements taken from the two populations. * @param percentile the percentile for computing the probability density. * @return the probability density. */ public double probability(int N, int r, int n, double percentile) { this.N = N; this.r = r; this.n = n; probability = 0.0; int numberOfBall = (int) rint(percentile); if (percentile >= 0 && N >= 0) { probability = (basicStatistics.combination(r, numberOfBall) * basicStatistics.combination(N - r, n - numberOfBall)) / basicStatistics.combination(N, n); } return probability; } /** * Calculates the probability density for a hypergeometic random variable. * @param percentile the percentile for computing the probability density. * @return the probability density. */ public double probability(double percentile) { return probability(N, r, n, percentile); } /** * Calculates the percentile for a hypergeometric random variable. * @param N the total number of elements in two populations. * @param r the number of elements in one population. * @param n the number of elements taken from the two populations. * @param probabilityArgument the cumulative probability for computing the * percentile. * @return the percentile. * @exception OutOfRangeException the argument is out of range. */ public double inverse(int N, int r, int n, double probabilityArgument) { this.N = N; this.r = r; this.n = n; checkRange(probabilityArgument); inverse = Math.floor(findRoot(probabilityArgument, n / 2.0, 0.0, n)); while (cumulative(inverse) < probabilityArgument) { inverse += 1.0; } return inverse; } /** * Calculates the percentile for a hypergeometric random variable. * @param probabilityArgument the cumulative probability for computing the * percentile. * @return the percentile. * @exception OutOfRangeException the argument is out of range. */ public double inverse(double probabilityArgument) { return inverse(N, r, n, probabilityArgument); } }
[ "alberto.soto@gmail.com" ]
alberto.soto@gmail.com
543f13214c5d9c7a50450958157dbb2f5fc44650
cef18c092bc73df0385ef398bdac30e80a6d2a81
/src/android/StartApplication.java
cb5c649b6d6e333f4d1c3c636801ed3ddecc6fa2
[]
no_license
bthomas312/tgfmSolutions
33026fd4bc9d3db188233ca95c3a236c537966e1
c97269db4f7447ed94d6496119c9ebf14eb026a5
refs/heads/master
2020-03-17T10:21:50.873696
2018-05-15T12:45:03
2018-05-15T12:45:03
133,509,625
0
0
null
null
null
null
UTF-8
Java
false
false
6,166
java
package android; import java.awt.Dimension; import java.io.File; import java.net.MalformedURLException; import java.net.URL; import java.util.concurrent.TimeUnit; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidKeyCode; import tgfm.Browser; import io.appium.java_client.PerformsTouchActions; import io.appium.java_client.PressesKeyCode; import io.appium.java_client.TouchAction; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; import android.actions.Base; import android.actions.Cart; import android.actions.Home; import android.actions.Login; import android.actions.OrderReview; import android.actions.PLV; import android.actions.Search; public class StartApplication { private static AndroidDriver driver; public static void main(String[] args) throws MalformedURLException, InterruptedException { /*File classpathRoot = new File(System.getProperty("user.dir")); File appDir = new File(classpathRoot, "/App/"); File app = new File(appDir, "app-staging.apk"); DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(CapabilityType.BROWSER_NAME, ""); capabilities.setCapability("deviceName", "Nexus 4"); capabilities.setCapability("platformVersion", "5.0.1"); capabilities.setCapability("platformName", "Android"); capabilities.setCapability("app", app.getAbsolutePath()); capabilities.setCapability("appPackage", "com.jet.jet.staging"); capabilities.setCapability("appActivity", "com.jet.baselib.activities.RootActivity"); driver = new AndroidDriver<WebElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS); */ // WebElement eCategories = driver.findElement(By.name("android.support.v7.widget.AppCompatImageButton")); Base menu = new Base(); menu = menu.setElements(); Login login = new Login(); login = login.setElements(); Search search = new Search(); search = search.setElements(); PLV plv = new PLV(); plv = plv.setElements(); Cart cart = new Cart(); cart = cart.setElements(); OrderReview orderReview = new OrderReview(); orderReview = orderReview.setElements(); Home home = new Home(); home = home.setElements(); Thread.sleep(1000L); TouchAction touchAction = new TouchAction((PerformsTouchActions) Browser.getBrowser()); touchAction .press(100, 100) .release() .perform(); Thread.sleep(1000L); Thread.sleep(1000L); org.openqa.selenium.Dimension size = Browser.getBrowser().manage().window().getSize(); touchAction .press(size.width-1, 200) .waitAction() .moveTo(size.width-400, 200) .release() .perform(); Thread.sleep(1000L); home.eQA.click(); Thread.sleep(1000L); touchAction .press(100, 100) .release() .perform(); Thread.sleep(1000L); menu.eAccount.click(); Thread.sleep(5000L); touchAction .press(100, 100) .release() .perform(); login.eEmail.sendKeys("qa.1@wildtest.com"); login.ePassword.sendKeys("Jet12345"); login.eLogin.click(); Thread.sleep(10000L); touchAction.press(100, 100).release().perform(); Thread.sleep(1000L); menu.eSearch.click(); search.eSearchBar.sendKeys("dog"); ((PressesKeyCode) Browser.getBrowser()).pressKeyCode(AndroidKeyCode.ENTER); plv.eAddToCart.click(); menu.eCart.click(); cart.eProceedToCheckout.click(); Thread.sleep(5000L); orderReview.ePlaceOrder.click(); // driver.quit(); } @org.testng.annotations.Test public static void newTest() {/* @id/recycler_view @id/recycler_view id="@id/pager" @id/categories_button @id/reorder_button @id/ar_card @id/right_nav_view id="@id/design_navigation_view" @id/design_menu_item_text text =QA text="Create Account" text="Login" @id/email_edit_text @id/password_edit_text @id/text_input_password_toggle @id/button_login @id/button_forgot_password @id/view_contact_follow_jet_and_terms @id/contact_jet_text_view @id/imageview_feedback @id/imageview_call @id/imageview_rate_us @id/imageview_email @id/imageview_facebook @id/imageview_twitter @id/imageview_linkedin @id/imageview_instagram @id/logout_button @id/textview_app_version createaccount @id/referral_banner @id/promo_banner @id/email_edit_text @id/password_edit_text @id/zip @id/checkbox_marketing @id/button_register @id/terms */ } /* public void swipFromRightOfScreen() throws InterruptedException { //Get the size of screen. org.openqa.selenium.Dimension size = driver.manage().window().getSize(); System.out.println(size); //Find swipe start and end point from screen's with and height. //Find startx point which is at right side of screen. int startx = (int) (size.width * 0.70); //Find endx point which is at left side of screen. int endx = (int) (size.width * 0.30); //Find vertical point where you wants to swipe. It is in middle of screen height. int starty = size.height / 2; System.out.println("startx = " + startx + " ,endx = " + endx + " , starty = " + starty); //Swipe from Right to Left. driver.swipe(startx, starty, endx, starty, 3000); //Thread.sleep(2000); //Swipe from Left to Right. //driver.swipe(endx, starty, startx, starty, 3000); //Thread.sleep(2000); }*/ }
[ "noreply@github.com" ]
bthomas312.noreply@github.com
44fae2d24b95f4c832bacfbb0730eaf993f1f3e3
2e1411deb5790461d8ea390fbbb8196b662dcf21
/Source Code/flyaway/src/main/java/com/dao/FlightDetailsDao.java
01b87dac2fa5c2d56cc63476e306c9834babbfbd
[]
no_license
akki1071993/FlyAway
149f03252b2614af8bd3c7bbc5472d3488888f5d
0e2c6a8a49568cd22afeef01354ae88993c65260
refs/heads/main
2023-08-10T16:45:53.839105
2021-10-03T05:55:29
2021-10-03T05:55:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
238
java
package com.dao; import java.util.List; import com.dto.FlightDetails; public interface FlightDetailsDao { public Integer addFlight(FlightDetails flight); public List<FlightDetails> searchFlights(String source, String destination); }
[ "golu.nikhil4u@gmail.com" ]
golu.nikhil4u@gmail.com
2bfd8910e558ddf7fadfffbf10b7ddaa3eead460
fa80092eddad11988c2e5085e90a7b191c6afbe9
/Tasks/src/com/epam/poliakov/task9/shop/controller/generator/generator/Generator.java
3f1b710f49d5d6358575494c441cfe2ccefdd24d
[]
no_license
Yaroslav97/epp
6f3e8935a5d0d49dfbda971009b6e5eb14a4b2dc
f0b2f84862df11d5d2994bb2874a4931b70dc7a7
refs/heads/master
2021-06-29T02:45:21.059827
2017-09-15T06:16:06
2017-09-15T06:16:06
103,621,155
0
0
null
null
null
null
UTF-8
Java
false
false
193
java
package com.epam.poliakov.task9.shop.controller.generator.generator; import com.epam.poliakov.task9.shop.entity.productEntity.Vehicle; public interface Generator { Vehicle generate(); }
[ "poliakov.yaroslav@gmail.com" ]
poliakov.yaroslav@gmail.com
48a8f6db8af3056564e619ea83dd0c53cdcc2e17
ea977224b6034c0bbe5cf1b4780133fa62a32991
/src/main/java/com/biblioteca/models/Endereco.java
8daa5ec9154e08d208cc72be5335fbbb395e0c2f
[]
no_license
ronaldFTZL/AvaliacaoP2
b09fb14935574489c2d6b6eb37d7b35113926641
795266a03c48e849f798346fff96c47efaea73ae
refs/heads/master
2020-09-20T00:05:28.715417
2019-11-27T23:33:33
2019-11-27T23:33:33
224,329,208
0
0
null
null
null
null
UTF-8
Java
false
false
483
java
package com.biblioteca.models; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import org.springframework.beans.factory.annotation.Autowired; @Entity public class Endereco { @Autowired @Id @GeneratedValue(strategy = GenerationType.AUTO) @OneToMany private String rua; private int numero; private String cep; }
[ "ronald.rodrigues@numenit.com" ]
ronald.rodrigues@numenit.com
3c67d2c1dd27c6ba0b41d9e2ba5e93005e6549e9
297967f3456fb50d7243fdce31f8a760cf036bdf
/Ch11/src/p273/ExceptionEx6.java
7d477b2c08f438f4d26112b97d68bff836acd15a
[]
no_license
mugong52/Java
62c17a5679dea16710c868e0d43225ca89caa988
fa415d82b2f83a3e92ba91379d8f79dfa04106ab
refs/heads/master
2023-04-18T02:28:30.285226
2021-05-04T04:00:16
2021-05-04T04:00:16
350,936,768
0
0
null
null
null
null
UHC
Java
false
false
526
java
// 메서드 선언부에 throws 키워드 사용해서 예외 선언하기 (처리해야 할 예외 여러개라면 콤마로 구분해서 적기) package p273; public class ExceptionEx6 { public static void main(String[] args) { try { first(); } catch (Exception e) { System.out.println(e.getMessage()); } } static void first() throws Exception { // throw(예외 발생) =/= throws(예외 처리) second(); } static void second() throws Exception { throw new Exception ("예외 발생"); } }
[ "mugong52@gmail.com" ]
mugong52@gmail.com
abee80531ee859025e65d4cd76ffe9b6cfb87e69
9dc581122f5afdd955bfdc26182295b4e1a4dfe2
/src/main/java/hu/preznyak/managedbeans/CreateWeddingMB.java
61bd1fe7909c71022ddbf755fd8617c0dd4c4524
[]
no_license
preznyak/WeddingAssistant
294df6e4bd63044c59541c0a9b9e4ba441cd8ce8
b84ca38599c5e9764a22a0527370e84448b18ece
refs/heads/master
2021-05-09T17:45:40.885197
2018-03-20T14:07:20
2018-03-20T14:07:20
119,146,440
0
0
null
null
null
null
UTF-8
Java
false
false
1,556
java
package hu.preznyak.managedbeans; import hu.preznyak.entities.User; import hu.preznyak.entities.WeddingEvent; import hu.preznyak.services.UserService; import hu.preznyak.services.WeddingService; import hu.preznyak.utils.SessionUtils; import javax.annotation.PostConstruct; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; import javax.servlet.http.HttpSession; import java.time.ZoneId; import java.util.Date; @ManagedBean(name = "CreateWeddingMB") @RequestScoped public class CreateWeddingMB { private WeddingEvent weddingEvent; private UserService userService; private Date eventDate; @PostConstruct public void init(){ userService = new UserService(); weddingEvent = new WeddingEvent(); } public String createWedding(){ HttpSession session = SessionUtils.getSession(); User user = userService.getUserById((Integer) session.getAttribute("userid")); weddingEvent.setEventDate(eventDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()); if(userService.addWeddingToUser(user, weddingEvent)){ return "/home"; } else { return "/createWedding"; } } public WeddingEvent getWeddingEvent() { return weddingEvent; } public void setWeddingEvent(WeddingEvent weddingEvent) { this.weddingEvent = weddingEvent; } public Date getEventDate() { return eventDate; } public void setEventDate(Date eventDate) { this.eventDate = eventDate; } }
[ "laszlopreznyak11@gmail.com" ]
laszlopreznyak11@gmail.com
df54688682af2b0a49ea6056cd4cdfd65ac4ec1a
fe5c21128307417f25aec91e34923f57c93e07cd
/MyBatis/src/main/java/com/mybatis/MybatisApplication.java
5cad9981ffe9412613e0df22186e91bc6d21185f
[]
no_license
RickUniverse/SpringBoot
60cb6e94d62720205cb1b7fc8773712831e127bd
c2d3784df3391bce2544eb56989f1ce59503566c
refs/heads/master
2023-02-16T04:07:42.602397
2021-01-10T13:37:01
2021-01-10T13:37:01
325,762,595
0
0
null
null
null
null
UTF-8
Java
false
false
499
java
package com.mybatis; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; /** * 指定mapper的地址 * 该包内的接口可以不必加@Mapper注解 */ @MapperScan(basePackages = "com.mybatis.mapper") @SpringBootApplication public class MybatisApplication { public static void main(String[] args) { SpringApplication.run(MybatisApplication.class, args); } }
[ "2388948195@qq.com" ]
2388948195@qq.com
fc4fb9dff940c282cf104ced7c28ae83d991e97c
aa3219c9a1c4404f2a9e28c42a53245e82f73014
/app/src/main/java/openfoodfacts/github/scrachx/openfood/views/adapters/PeriodAfterOpeningAutoCompleteAdapter.java
db00b2e95d4edf38973316cb1f278b930178dd16
[ "Apache-2.0" ]
permissive
EdNgulele/openfoodfacts-androidapp
9cf0b09263a826c1effc5bb7927058e8cb52ca4f
4df2a394d31761ead3defced9a9c5d7fc76251fb
refs/heads/master
2020-03-31T16:49:11.467598
2018-10-08T14:04:53
2018-10-08T14:04:53
152,393,307
1
0
Apache-2.0
2018-10-21T16:50:06
2018-10-10T08:57:38
Java
UTF-8
Java
false
false
3,175
java
package openfoodfacts.github.scrachx.openfood.views.adapters; import android.content.Context; import android.support.annotation.NonNull; import android.util.Log; import android.widget.ArrayAdapter; import android.widget.Filter; import android.widget.Filterable; import java.util.ArrayList; import io.reactivex.SingleObserver; import io.reactivex.disposables.Disposable; import openfoodfacts.github.scrachx.openfood.network.CommonApiManager; import openfoodfacts.github.scrachx.openfood.network.OpenFoodAPIService; public class PeriodAfterOpeningAutoCompleteAdapter extends ArrayAdapter<String> implements Filterable { private static OpenFoodAPIService client; private ArrayList<String> mPeriodsAfterOpeningList; public PeriodAfterOpeningAutoCompleteAdapter(Context context, int textViewResourceId) { super(context, textViewResourceId); mPeriodsAfterOpeningList = new ArrayList<>(); } @Override public int getCount() { return mPeriodsAfterOpeningList.size(); } @Override public String getItem(int position) { return mPeriodsAfterOpeningList.get(position); } @NonNull @Override public Filter getFilter() { Filter filter; filter = new Filter() { @Override protected FilterResults performFiltering(CharSequence constraint) { FilterResults filterResults = new FilterResults(); if (constraint != null) { // Retrieve the autocomplete results from server. client = CommonApiManager.getInstance().getOpenFoodApiService(); client.getPeriodAfterOpeningSuggestions(constraint.toString()) .subscribe(new SingleObserver<ArrayList<String>>() { @Override public void onSubscribe(Disposable d) { } @Override public void onSuccess(ArrayList<String> strings) { mPeriodsAfterOpeningList.clear(); mPeriodsAfterOpeningList.addAll(strings); } @Override public void onError(Throwable e) { Log.e(PeriodAfterOpeningAutoCompleteAdapter.class.getSimpleName(), e.getMessage()); } }); // Assign the data to the FilterResults filterResults.values = mPeriodsAfterOpeningList; filterResults.count = mPeriodsAfterOpeningList.size(); } return filterResults; } @Override protected void publishResults(CharSequence constraint, FilterResults results) { if (results != null && results.count > 0) { notifyDataSetChanged(); } else { notifyDataSetInvalidated(); } } }; return filter; } }
[ "teolemon@users.noreply.github.com" ]
teolemon@users.noreply.github.com
ec74405ba01e828e8d75b80717c0deafad07e7a6
d48f8bc48c8f56b555b7add65363a99130df5673
/Formula1/app/src/main/java/com/example/avenflar/formula1/com/example/formula1/RecyclerView/GetServices/GetDriversServices.java
a742d85fa7a80e05d5098dbb3faef66f4148ec4e
[]
no_license
AdamBouhastine/Projet_Programmation_Mobile_2018
df64737f9fc3e21d8b3e20633c1dcabca28afd6b
533b5aa453666940171e2cbd2ea6664ffc425c2e
refs/heads/master
2020-03-18T04:46:39.358919
2018-05-21T18:01:45
2018-05-21T18:01:45
134,305,806
0
0
null
null
null
null
UTF-8
Java
false
false
2,790
java
package com.example.avenflar.formula1.com.example.formula1.RecyclerView.GetServices; import android.app.IntentService; import android.content.Context; import android.content.Intent; import android.support.v4.content.LocalBroadcastManager; import android.util.Log; import com.example.avenflar.formula1.com.example.formula1.Activites.DriversActivity; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; public class GetDriversServices extends IntentService { private static final String TAG = GetDriversServices.class.getSimpleName(); public static final String Action_Drivers = "com.example.avenflar.formula1.action.DRIVERS2"; public GetDriversServices(){ super("GetDriversServices"); } public static void startActionDrivers(Context context){ Intent intent = new Intent(context,GetDriversServices.class); intent.setAction(Action_Drivers); context.startService(intent); } @Override protected void onHandleIntent(Intent intent) { if (intent != null) { final String action = intent.getAction(); if (Action_Drivers.equals(action)) { handleActionResults(); } } } private void handleActionResults() { Log.d(TAG,"Thread service name:" + Thread.currentThread().getName()); URL url = null; try{ url = new URL("https://raw.githubusercontent.com/AdamBouhastine/Donn-esProgrammationMobile/master/Tables%20Json/drivers.json"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.connect(); if(HttpURLConnection.HTTP_OK == conn.getResponseCode()){ copyInputStreamToFile(conn.getInputStream(), new File(getCacheDir(), "drivers2.json")); Log.d(TAG,"Results downloaded"); LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(DriversActivity.DRIVERS_UPDATE)); } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } private void copyInputStreamToFile(InputStream in, File file){ try{ OutputStream out = new FileOutputStream(file); byte[] buf = new byte[1024]; int len; while((len=in.read(buf))>0){ out.write(buf,0,len); } out.close(); in.close(); }catch(Exception e){ e.printStackTrace(); } } }
[ "artefacttt92@gmail.com" ]
artefacttt92@gmail.com
4bd241ebfb87c2db84296ed00d063d1483902f97
a399b250daa7ec7ca7235c30b2c8fa523fc88085
/src/main/java/co/com/sp/two/exception/ResourceNotFoundException.java
de6ddb424acb6645fb5b67c4b0700fe15af524b1
[]
no_license
jmps1126/spring-boot-2.0-dojo
44535d4f6c854e7dbaa667cc9e8e5384ce100781
728cbffdc3bbe906424ac161ffef9f1709564314
refs/heads/master
2022-12-19T13:12:02.352103
2020-09-24T12:27:09
2020-09-24T12:27:09
298,270,126
0
0
null
null
null
null
UTF-8
Java
false
false
334
java
package co.com.sp.two.exception; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(HttpStatus.NOT_FOUND) public class ResourceNotFoundException extends RuntimeException { public ResourceNotFoundException(String message) { super(message); } }
[ "jmps1126" ]
jmps1126
1df4e9c357cebd398380ef0e8753956dd1e06a19
52e426349b54503560913de964480e7b444e22bd
/mysql/src/test/java/com/github/sandor_balazs/nosql_java/web/rest/FundingResourceIntTest.java
65460bb7f8f7add8a3d52d05f7ccae573196f215
[ "BSD-2-Clause" ]
permissive
sandor-balazs/nosql-java
4c4012c7be3e55ef87ababd0d0cd5e978a55a078
417c04477a61cd1517091ce8b6b7c2aae3c329c4
refs/heads/master
2021-01-10T04:00:44.162983
2015-12-09T20:11:06
2015-12-09T20:11:06
47,703,147
2
0
null
null
null
null
UTF-8
Java
false
false
6,865
java
package com.github.sandor_balazs.nosql_java.web.rest; import com.github.sandor_balazs.nosql_java.Application; import com.github.sandor_balazs.nosql_java.domain.Funding; import com.github.sandor_balazs.nosql_java.repository.FundingRepository; import com.github.sandor_balazs.nosql_java.service.FundingService; import com.github.sandor_balazs.nosql_java.web.rest.dto.FundingDTO; import com.github.sandor_balazs.nosql_java.web.rest.mapper.FundingMapper; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import static org.hamcrest.Matchers.hasItem; import org.mockito.MockitoAnnotations; import org.springframework.boot.test.IntegrationTest; import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.util.ReflectionTestUtils; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.transaction.annotation.Transactional; import javax.annotation.PostConstruct; import javax.inject.Inject; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; /** * Test class for the FundingResource REST controller. * * @see FundingResource */ @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = Application.class) @WebAppConfiguration @IntegrationTest public class FundingResourceIntTest { private static final String DEFAULT_NAME = "AAAAA"; private static final String UPDATED_NAME = "BBBBB"; @Inject private FundingRepository fundingRepository; @Inject private FundingMapper fundingMapper; @Inject private FundingService fundingService; @Inject private MappingJackson2HttpMessageConverter jacksonMessageConverter; @Inject private PageableHandlerMethodArgumentResolver pageableArgumentResolver; private MockMvc restFundingMockMvc; private Funding funding; @PostConstruct public void setup() { MockitoAnnotations.initMocks(this); FundingResource fundingResource = new FundingResource(); ReflectionTestUtils.setField(fundingResource, "fundingService", fundingService); ReflectionTestUtils.setField(fundingResource, "fundingMapper", fundingMapper); this.restFundingMockMvc = MockMvcBuilders.standaloneSetup(fundingResource) .setCustomArgumentResolvers(pageableArgumentResolver) .setMessageConverters(jacksonMessageConverter).build(); } @Before public void initTest() { funding = new Funding(); funding.setName(DEFAULT_NAME); } @Test @Transactional public void createFunding() throws Exception { int databaseSizeBeforeCreate = fundingRepository.findAll().size(); // Create the Funding FundingDTO fundingDTO = fundingMapper.fundingToFundingDTO(funding); restFundingMockMvc.perform(post("/api/fundings") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(fundingDTO))) .andExpect(status().isCreated()); // Validate the Funding in the database List<Funding> fundings = fundingRepository.findAll(); assertThat(fundings).hasSize(databaseSizeBeforeCreate + 1); Funding testFunding = fundings.get(fundings.size() - 1); assertThat(testFunding.getName()).isEqualTo(DEFAULT_NAME); } @Test @Transactional public void getAllFundings() throws Exception { // Initialize the database fundingRepository.saveAndFlush(funding); // Get all the fundings restFundingMockMvc.perform(get("/api/fundings?sort=id,desc")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.[*].id").value(hasItem(funding.getId().intValue()))) .andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME.toString()))); } @Test @Transactional public void getFunding() throws Exception { // Initialize the database fundingRepository.saveAndFlush(funding); // Get the funding restFundingMockMvc.perform(get("/api/fundings/{id}", funding.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.id").value(funding.getId().intValue())) .andExpect(jsonPath("$.name").value(DEFAULT_NAME.toString())); } @Test @Transactional public void getNonExistingFunding() throws Exception { // Get the funding restFundingMockMvc.perform(get("/api/fundings/{id}", Long.MAX_VALUE)) .andExpect(status().isNotFound()); } @Test @Transactional public void updateFunding() throws Exception { // Initialize the database fundingRepository.saveAndFlush(funding); int databaseSizeBeforeUpdate = fundingRepository.findAll().size(); // Update the funding funding.setName(UPDATED_NAME); FundingDTO fundingDTO = fundingMapper.fundingToFundingDTO(funding); restFundingMockMvc.perform(put("/api/fundings") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(fundingDTO))) .andExpect(status().isOk()); // Validate the Funding in the database List<Funding> fundings = fundingRepository.findAll(); assertThat(fundings).hasSize(databaseSizeBeforeUpdate); Funding testFunding = fundings.get(fundings.size() - 1); assertThat(testFunding.getName()).isEqualTo(UPDATED_NAME); } @Test @Transactional public void deleteFunding() throws Exception { // Initialize the database fundingRepository.saveAndFlush(funding); int databaseSizeBeforeDelete = fundingRepository.findAll().size(); // Get the funding restFundingMockMvc.perform(delete("/api/fundings/{id}", funding.getId()) .accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); // Validate the database is empty List<Funding> fundings = fundingRepository.findAll(); assertThat(fundings).hasSize(databaseSizeBeforeDelete - 1); } }
[ "sandor.balazs@ymail.com" ]
sandor.balazs@ymail.com
e0a760639850a85d0fcba92b600adfd4ffc5f930
e95c28075d2c7defe797e3528dfc682ad4a2fba0
/src/main/java/com/alen/entity/config/DataflowJobConfig.java
e668dce1f93717ed35c4db62d9ec9c70981ce1c0
[]
no_license
xufeixianggithub/LIteJob
22b499f8154e1743efabde85f31748f3e54a34ee
90c94973cf9a2a4a084992be090f40ec5b5c1073
refs/heads/master
2020-03-25T09:44:03.188225
2018-08-06T04:09:33
2018-08-06T04:09:33
143,674,828
0
0
null
null
null
null
UTF-8
Java
false
false
2,634
java
package com.alen.entity.config; import com.alen.entity.job.dataflow.SpringDataflowJob; import com.dangdang.ddframe.job.api.dataflow.DataflowJob; import com.dangdang.ddframe.job.config.JobCoreConfiguration; import com.dangdang.ddframe.job.config.dataflow.DataflowJobConfiguration; import com.dangdang.ddframe.job.event.JobEventConfiguration; import com.dangdang.ddframe.job.lite.api.JobScheduler; import com.dangdang.ddframe.job.lite.config.LiteJobConfiguration; import com.dangdang.ddframe.job.lite.spring.api.SpringJobScheduler; import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import javax.annotation.Resource; /** * 流式任务配置 */ @Configuration public class DataflowJobConfig { // 注册中心配置 @Resource private ZookeeperRegistryCenter regCenter; //将作业运行的痕迹进行持久化到DB的操作配置 @Resource private JobEventConfiguration jobEventConfiguration; @Bean public DataflowJob dataflowJob() { return new SpringDataflowJob(); } @Bean(initMethod = "init") public JobScheduler dataflowJobScheduler(final DataflowJob dataflowJob, @Value("${dataflowJob.cron}") final String cron, @Value("${dataflowJob.shardingTotalCount}") final int shardingTotalCount, @Value("${dataflowJob.shardingItemParameters}") final String shardingItemParameters) { return new SpringJobScheduler(dataflowJob, regCenter, getLiteJobConfiguration(dataflowJob.getClass(), cron, shardingTotalCount, shardingItemParameters), jobEventConfiguration); } /* 作业配置 作业配置分为3级,分别是JobCoreConfiguration,JobTypeConfiguration和LiteJobConfiguration。 LiteJobConfiguration使用JobTypeConfiguration,JobTypeConfiguration使用JobCoreConfiguration,层层嵌套。 JobTypeConfiguration根据不同实现类型分为SimpleJobConfiguration,DataflowJobConfiguration和ScriptJobConfiguration。*/ private LiteJobConfiguration getLiteJobConfiguration(final Class<? extends DataflowJob> jobClass, final String cron, final int shardingTotalCount, final String shardingItemParameters) { return LiteJobConfiguration.newBuilder(new DataflowJobConfiguration(JobCoreConfiguration.newBuilder( jobClass.getName(), cron, shardingTotalCount).shardingItemParameters(shardingItemParameters).build(), jobClass.getCanonicalName(), true)).overwrite(true).build(); } }
[ "zude@seeapp.com" ]
zude@seeapp.com
598049af7ba28f262763b03edc1eccfc74c682b7
ba7ea2570d352f9baa0591803ae90105eea69098
/src/main/java/com/pbasco/lookify/ServletInitializer.java
390a00e64edb51b42fd5230db32bcfae08075728
[]
no_license
patrickmbasco/lookify
31757c24c733b841d3a894d10228a392f8213151
dedc670f8c2ab538e10daa0a5fd1ddd4e700013e
refs/heads/master
2022-04-26T10:55:56.323707
2020-04-25T05:47:44
2020-04-25T05:47:44
258,697,360
0
0
null
null
null
null
UTF-8
Java
false
false
409
java
package com.pbasco.lookify; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; public class ServletInitializer extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(LookifyApplication.class); } }
[ "patrickbasco@Patricks-MacBook-Air.local" ]
patrickbasco@Patricks-MacBook-Air.local
17ea95ec382d408542ece29dcc106006d4050dae
a813443d33c70239da11c0e967e04c6235d8d385
/src/main/java/ru/gb/springdata/services/CategoryService.java
c29a66b22fb57e2bc7af5e3f6d15f007b10a55ca
[]
no_license
petrovks/SpringData
e3bf855e40490b5f0ba631466e759765a481ca7e
b40585f05cb37f658d6eb4014a71334a7b3c84d7
refs/heads/master
2023-08-20T22:55:26.996009
2021-10-15T08:23:39
2021-10-25T08:30:38
410,801,047
0
0
null
null
null
null
UTF-8
Java
false
false
725
java
package ru.gb.springdata.services; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import ru.gb.springdata.repositories.CategoryRepository; import ru.gb.springdata.model.Category; import java.util.Optional; @Service @RequiredArgsConstructor public class CategoryService { private final CategoryRepository categoryRepository; public Optional<Category> findByTitle(String title) { return categoryRepository.findByTitle(title); } public Optional<Category> findById(Long id) { return categoryRepository.findById(id); } public Optional<Category> findByIdWithProducts(Long id) { return categoryRepository.findByIdWithProducts(id); } }
[ "konstantin.petrov.87@gmail.com" ]
konstantin.petrov.87@gmail.com
4ad9a46f6bbed45007869bfca88e552ba2b08015
69ee667ea6f8bcecbe9a45a213f9275a67d9dc30
/src/main/java/fr/unice/polytech/shop/stocks/StocksIngredient.java
c63ee583a5fdfacc0d0bf073ba073a83a8e639ea
[]
no_license
ClementPoueyto/SI4-ConceptionCookieFactory
3e7fea39fc867a23452fa9e44cfb9e2b0f08928c
0a0c6064d5310ce669535d3d5a7f26fbb75d2bf4
refs/heads/main
2023-03-14T10:45:54.085298
2021-02-18T23:13:17
2021-02-18T23:13:17
340,200,061
0
1
null
null
null
null
UTF-8
Java
false
false
3,751
java
package fr.unice.polytech.shop.stocks; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import fr.unice.polytech.exception.StockException; import fr.unice.polytech.order.Order; import fr.unice.polytech.order.OrderItem; import fr.unice.polytech.recipe.RecipeIngredient; import fr.unice.polytech.recipe.item.Dough; import fr.unice.polytech.recipe.item.Flavour; import fr.unice.polytech.recipe.item.Ingredient; import fr.unice.polytech.recipe.item.Topping; import fr.unice.polytech.recipe.item.Dough.DoughType; import fr.unice.polytech.recipe.item.Flavour.FlavourType; import fr.unice.polytech.recipe.item.Topping.ToppingType; import fr.unice.polytech.shop.ShopOrdersObserver; public class StocksIngredient extends HashMap<Ingredient,StockIngredient> implements ShopOrdersObserver { public StocksIngredient(int quantity) { Arrays.asList(DoughType.values()).forEach(type -> this.put(new Dough(type), new StockIngredient(new Dough(type), quantity))); Arrays.asList(FlavourType.values()).forEach(type -> this.put(new Flavour(type), new StockIngredient(new Flavour(type), quantity))); Arrays.asList(ToppingType.values()).forEach(type -> this.put(new Topping(type), new StockIngredient(new Topping(type), quantity))); } @Override public void update(Order order){ if(order != null){ HashMap<StockIngredient, Integer> stockAndQuantity = this.stockAndQuantity(order); stockAndQuantity.keySet().forEach(stockIngredient -> stockIngredient.update(stockAndQuantity.get(stockIngredient))); } } /** * Generate a HashMap with the stock of and ingredient and the quantity needed of this ingredient for the order * @param order * @return the stock ingredient associated to the quantity asked */ private HashMap<StockIngredient, Integer> stockAndQuantity(Order order) throws StockException { if(order != null){ HashMap<StockIngredient, Integer> stockAndQuantity = new HashMap<StockIngredient,Integer>(); for(OrderItem orderItem : order) { List<RecipeIngredient> ingredients = new ArrayList<>(); ingredients.add(orderItem.getCookie().getDough()); ingredients.add(orderItem.getCookie().getFlavour()); ingredients.addAll(orderItem.getCookie().getToppings()); ingredients.forEach(ingredient ->{ if(stockAndQuantity.containsKey(this.get(ingredient.getIngredient()))){ stockAndQuantity.put(this.get(ingredient.getIngredient()),stockAndQuantity.get(this.get(ingredient.getIngredient())) + orderItem.getCount()*orderItem.getCookie().getDose()); } else { stockAndQuantity.put(this.get(ingredient.getIngredient()), orderItem.getCount()*orderItem.getCookie().getDose()); } }); } return stockAndQuantity; } throw new StockException("Order is null"); } /** * Check if there is enough stock for the order * @param order * @return true if there is enough stock for the order, else false */ public boolean enoughStock(Order order){ if(order == null){ return false; } HashMap<StockIngredient, Integer> stockAndQuantity = this.stockAndQuantity(order); boolean enoughStock = true; for(StockIngredient sI : stockAndQuantity.keySet()){ enoughStock = enoughStock && sI.enoughQuantity(stockAndQuantity.get(sI))>=0; } return enoughStock; } }
[ "noreply@github.com" ]
ClementPoueyto.noreply@github.com
63a484df9b5911301d95419afb407b8dd2a38dd9
6408f59976c5ce138f7d392fc972792774c87a61
/Coding/Android/MMApp.Android/app/src/main/java/com/huawei/mm/app/encrypt/HMMD5Utils.java
6ab7fe95b5322d62746c85b94908a7e45d3ced44
[]
no_license
layerfsd/MMApp
fd100dde2b7b76a6208edc5ae0709f92df19d4b5
b58de7f92ef2173f72833498ce714f1aeb49f64a
refs/heads/master
2021-06-17T21:19:34.938828
2017-06-16T22:29:31
2017-06-16T22:29:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
672
java
package com.huawei.mm.app.encrypt; /** * @author Remind.jiang * date on 2017/3/13. */ public class HMMD5Utils { public static String MD5(String str) { try { java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5"); byte[] array = md.digest(str.getBytes()); StringBuffer sb = new StringBuffer(); for (int i = 0; i < array.length; ++i) { sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100).substring(1, 3)); } return sb.toString(); } catch (java.security.NoSuchAlgorithmException e) { } return null; } }
[ "1392830517@qq.com" ]
1392830517@qq.com
3a4f354eed7541b3991ab713b620c319703959ba
1640515aa350a50e1a8645591f537e5bd1900c52
/app/src/test/java/online/z0lk1n/android/photocollector/di/TestComponent.java
fa767e84e3bb9f8c44d395321f9d0237c75786ba
[]
no_license
z0lk1n/PhotoCollector
399e8a3717a614473d18b247565a37bb3b31c2d2
7c0586c411cc0046901017b0cda2589220b36e59
refs/heads/master
2020-03-26T12:35:11.293973
2018-10-30T17:21:40
2018-10-30T17:21:40
144,899,714
0
0
null
2018-10-30T17:21:42
2018-08-15T20:22:39
Java
UTF-8
Java
false
false
413
java
package online.z0lk1n.android.photocollector.di; import javax.inject.Singleton; import dagger.Component; import online.z0lk1n.android.photocollector.di.modules.TestPhotosModule; import online.z0lk1n.android.photocollector.presentation.presenters.bottomtab.NetworkPresenter; @Singleton @Component(modules = TestPhotosModule.class) public interface TestComponent { void inject(NetworkPresenter presenter); }
[ "al-not@ya.ru" ]
al-not@ya.ru
fae6eb136eba9dfaaf3d881cf57b2f081ce03080
a8c5b7b04eace88b19b5a41a45f1fb030df393e3
/projects/core-rest/src/test/java/com/opengamma/core/holiday/impl/DataHolidaySourceResourceTest.java
42f44a3a2d096a3ff0183f08e7d0d460ce58403a
[ "Apache-2.0" ]
permissive
McLeodMoores/starling
3f6cfe89cacfd4332bad4861f6c5d4648046519c
7ae0689e06704f78fd9497f8ddb57ee82974a9c8
refs/heads/master
2022-12-04T14:02:00.480211
2020-04-28T17:22:44
2020-04-28T17:22:44
46,577,620
4
4
Apache-2.0
2022-11-24T07:26:39
2015-11-20T17:48:10
Java
UTF-8
Java
false
false
2,699
java
/** * Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.core.holiday.impl; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertSame; import java.net.URI; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import org.threeten.bp.Instant; import com.opengamma.core.holiday.HolidaySource; import com.opengamma.core.holiday.HolidayType; import com.opengamma.id.ExternalId; import com.opengamma.id.ObjectId; import com.opengamma.id.UniqueId; import com.opengamma.id.VersionCorrection; import com.opengamma.util.test.TestGroup; import com.sun.jersey.api.client.ClientResponse.Status; /** * Tests DataHolidaySourceResource. */ @Test(groups = TestGroup.UNIT) public class DataHolidaySourceResourceTest { private static final ObjectId OID = ObjectId.of("Test", "A"); private static final UniqueId UID = OID.atVersion("B"); private static final VersionCorrection VC = VersionCorrection.LATEST.withLatestFixed(Instant.now()); private static final ExternalId EID = ExternalId.of("A", "B"); private HolidaySource _underlying; private UriInfo _uriInfo; private DataHolidaySourceResource _resource; @BeforeMethod public void setUp() { _underlying = mock(HolidaySource.class); _uriInfo = mock(UriInfo.class); when(_uriInfo.getBaseUri()).thenReturn(URI.create("testhost")); _resource = new DataHolidaySourceResource(_underlying); } //------------------------------------------------------------------------- @Test public void testGetHolidayByUid() { final SimpleHoliday target = new SimpleHoliday(); target.setType(HolidayType.BANK); target.setRegionExternalId(EID); when(_underlying.get(eq(UID))).thenReturn(target); Response test = _resource.get(OID.toString(), UID.getVersion(), "", ""); assertEquals(Status.OK.getStatusCode(), test.getStatus()); assertSame(target, test.getEntity()); } @Test public void testGetHolidayByOid() { final SimpleHoliday target = new SimpleHoliday(); target.setType(HolidayType.BANK); target.setRegionExternalId(EID); when(_underlying.get(eq(OID), eq(VC))).thenReturn(target); Response test = _resource.get(OID.toString(), null, VC.getVersionAsOfString(), VC.getCorrectedToString()); assertEquals(Status.OK.getStatusCode(), test.getStatus()); assertSame(target, test.getEntity()); } }
[ "jim.moores@gmail.com" ]
jim.moores@gmail.com
40842c542e9ba3c7a479731a3c0dbf18a0b46164
8fd46e13a75d648767338a49753b88086ca7609b
/numberone-system/src/main/java/com/numberone/system/service/ISysDeptService.java
ffe859c4177b741ad123a4dc47772bb6fbf21c75
[ "MIT" ]
permissive
wangrifeng/numberone-springboot
14198b57430ec4d0f110baeb17662052fbb5ba3c
82a6f913afe8034a88804d78160f4f22658d418b
refs/heads/master
2022-09-14T23:38:42.468813
2020-02-21T03:58:40
2020-02-21T03:58:40
238,162,726
1
1
MIT
2022-09-01T23:19:50
2020-02-04T08:57:55
Java
UTF-8
Java
false
false
1,962
java
package com.numberone.system.service; import java.util.List; import java.util.Map; import com.numberone.system.domain.SysDept; import com.numberone.system.domain.SysRole; /** * 部门管理 服务层 * * @author numberone */ public interface ISysDeptService { /** * 查询部门管理数据 * * @param dept 部门信息 * @return 部门信息集合 */ public List<SysDept> selectDeptList(SysDept dept); /** * 查询部门管理树 * * @param dept 部门信息 * @return 所有部门信息 */ public List<Map<String, Object>> selectDeptTree(SysDept dept); /** * 根据角色ID查询菜单 * * @param role 角色对象 * @return 菜单列表 */ public List<Map<String, Object>> roleDeptTreeData(SysRole role); /** * 查询部门人数 * * @param parentId 父部门ID * @return 结果 */ public int selectDeptCount(Long parentId); /** * 查询部门是否存在用户 * * @param deptId 部门ID * @return 结果 true 存在 false 不存在 */ public boolean checkDeptExistUser(Long deptId); /** * 删除部门管理信息 * * @param deptId 部门ID * @return 结果 */ public int deleteDeptById(Long deptId); /** * 新增保存部门信息 * * @param dept 部门信息 * @return 结果 */ public int insertDept(SysDept dept); /** * 修改保存部门信息 * * @param dept 部门信息 * @return 结果 */ public int updateDept(SysDept dept); /** * 根据部门ID查询信息 * * @param deptId 部门ID * @return 部门信息 */ public SysDept selectDeptById(Long deptId); /** * 校验部门名称是否唯一 * * @param dept 部门信息 * @return 结果 */ public String checkDeptNameUnique(SysDept dept); }
[ "1426878506@qq.com" ]
1426878506@qq.com
28d582764b18e20744b8d29c8cbaad3cf30409f2
7d1b25e3b875cf22e3bc283820d5df207452e4dd
/AlpineMinerSDK/src/com/alpine/datamining/api/impl/db/attribute/model/variable/AnalysisQuantileItemBinCategory.java
c16bc04e54af352f0dc1c885a4d8262afd00e91d
[]
no_license
thyferny/indwa-work
6e0aea9cbd7d8a11cc5f7333b4a1c3efeabb1ad0
53a3c7d9d831906837761465433e6bfd0278c94e
refs/heads/master
2020-05-20T01:26:56.593701
2015-12-28T05:40:29
2015-12-28T05:40:29
42,904,565
0
0
null
null
null
null
UTF-8
Java
false
false
2,418
java
/** * ClassName QuantileItemBinNumeric.java * * Version information: 1.00 * * Data: 2010-8-9 * * COPYRIGHT (C) 2010 Alpine Solutions. All Rights Reserved. **/ package com.alpine.datamining.api.impl.db.attribute.model.variable; import java.util.ArrayList; import java.util.List; import com.alpine.utility.common.ListUtility; /** category only support collection values * @author John Zhao * */ public class AnalysisQuantileItemBinCategory extends AbstractQuantileItemBin { public static final String TAG_NAME="QuantileItemBinCategory"; private List<String> values; /** * @param binIndex * @param binType * @param cloneStringList */ public AnalysisQuantileItemBinCategory(int binIndex, int binType, List<String> values) { this.values=values; super.setBinIndex(binIndex); super.setBinType(binType) ; } public AnalysisQuantileItemBinCategory(){ } public List<String> getValues() { return values; } public void setValues(List<String> values) { this.values = values; } public void addValue(String value){ if(values==null){ values= new ArrayList<String>(); } if(values.contains(value) ==false){ values.add(value); } } public boolean equals(Object obj) { if (this == obj){ return true; }else if (obj instanceof AnalysisQuantileItemBinCategory==false){ return false; }else{ AnalysisQuantileItemBinCategory qItem= (AnalysisQuantileItemBinCategory) obj; return ListUtility.equalsIgnoreOrder(values, qItem.getValues()) &&getBinIndex()==qItem.getBinIndex(); } } public String toString(){ StringBuffer sb = new StringBuffer(); if(getBinType()==BIN_TYPE_REST_VALUES){ return "Rest Values"; } if(values!=null){ for (int i = 0; i < values.size(); i++) { String value=values.get(i) ; if(i!=0){ sb=sb.append(","); } sb=sb.append("\"").append(value).append("\""); } } return sb.toString(); } /* (non-Javadoc) * @see com.alpine.datamining.api.impl.db.variable.QuantileItemBin#isValid() */ @Override public boolean isValid() { if(getBinType()==BIN_TYPE_COLLECTION){ return values!=null&&values.size()>0; }else{ return true; } } public AnalysisQuantileItemBinCategory clone(){ AnalysisQuantileItemBinCategory clone=new AnalysisQuantileItemBinCategory(getBinIndex(),getBinType(),ListUtility.cloneStringList(getValues())); return clone; } }
[ "thyferny@163.com" ]
thyferny@163.com
a6e7d2698d957bf91f41ee83981604eedcff094f
5ab82a027e3b8b53b46908e640e693c287f1a6ec
/src/Pairs.java
daad25789df2ec353b7109bc4cb769b8e29b0403
[ "MIT" ]
permissive
simonsaffer/CodeChallenges
ec9ab15d33ad849ec1add305962bcb9cd25e8064
14ddd1ab2e9126c414b12174bf49d6fcaf2243d2
refs/heads/master
2021-01-01T05:23:48.805664
2016-05-22T21:03:47
2016-05-22T21:03:47
59,433,551
0
0
null
null
null
null
UTF-8
Java
false
false
850
java
import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; import java.util.Scanner; /** * Created by simonsaffer on 2016-02-10. */ public class Pairs { private static boolean hasPairs(List<Integer> numbers, int N) { LinkedHashSet<Long> vals = new LinkedHashSet<Long>(); Collections.sort(numbers); for(Integer i : numbers) { if(i*2 != N && vals.contains(N-i)) { return true; } vals.add((long) i); } return false; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); List<Integer> numbers = new ArrayList<>(M); for (int i = 0; i < M; i++) { numbers.add(sc.nextInt()); } System.out.println(hasPairs(numbers, N) ? 1 : 0); } }
[ "ssaffer@richrelevance.com" ]
ssaffer@richrelevance.com
d37f41dd667c749719aff6e2dcaea835db6bc06f
af52568e402b50d1dbb4c2a470bf93f3f04fa48c
/LeetCode/src/Problems/twoSum1.java
45e64b9eea165e6b7575c1675927e876e76525c4
[]
no_license
adubashi/Leetcode
ccd8f6e34a423b9c4129404c5f8aab7629230437
14a829440a68b3a6f05a5206eff73e39d8c4c766
refs/heads/master
2020-12-24T05:21:31.526938
2019-05-14T07:45:54
2019-05-14T07:45:54
57,858,322
0
0
null
null
null
null
UTF-8
Java
false
false
667
java
package Problems; import java.util.*; public class twoSum1 { public static void main(String[] args) { } // Iterate the array, if the map contains the key, then we return the result; // If it doesn't, then add (target-numbers[i]),i to the map public static int[] twoSum(int[] numbers, int target) { HashMap<Integer,Integer> map = new HashMap<Integer,Integer>(); int[] result = new int[2]; for(int i = 0; i < numbers.length; i++){ if(map.containsKey(numbers[i])){ int index = map.get(numbers[i]); result[0] = index+1; result[1] = i + 1; break; } else { map.put(target - numbers[i], i); } } return result; } }
[ "adubashi@gmail.com" ]
adubashi@gmail.com
f1eb874d6943a1dbcf343f5d895e897ebfdd0ba8
0e7b30b22afd18f30c3e8f00dbae4729eea6e77a
/src/main/java/studio/spiderling/Commandler/CommandContext.java
03c91a518189b25eff9486a8e8017a8f5f8a8b65
[ "MIT" ]
permissive
Salmonllama/Commandler
e351fe6bf13a8575d07983ab096cfc78600fe19f
393406966db589292e3a1c018e0e5cbbbaf9b7ea
refs/heads/master
2020-04-10T10:08:42.306447
2019-07-06T00:03:41
2019-07-06T00:03:41
160,956,631
0
0
null
null
null
null
UTF-8
Java
false
false
751
java
package studio.spiderling.Commandler; import org.javacord.api.event.message.MessageCreateEvent; import org.javacord.core.event.message.MessageCreateEventImpl; public class CommandContext extends MessageCreateEventImpl { private final String command; private final String prefix; private final String[] args; public CommandContext(MessageCreateEvent event, String commandUsed, String prefixUsed, String[] argsGiven) { super(event.getMessage()); command = commandUsed; prefix = prefixUsed; args = argsGiven; } public String getCommand() { return command; } public String getPrefix() { return prefix; } public String[] getArgs() { return args; } }
[ "a.gryczewski999@gmail.com" ]
a.gryczewski999@gmail.com
0200c4554c13846a4cf31fc0622c9774a2d23b9f
de4fef8815346216edbd92653faa425d0113b383
/codigoBusiness/CentroDistribucionJSON.java
e761efe36a4644bc8d1d573d2e3edca5c8a5a03e
[]
no_license
Zefirot/Trabajo-Practico-3
fb46eecf7ebac0ef6e3135388d75d0364eac6f0e
b2147a9809e9e1a426510b9bd63a40e994d18404
refs/heads/master
2023-01-23T14:01:28.236957
2020-12-05T03:47:48
2020-12-05T03:47:48
312,908,965
1
0
null
null
null
null
UTF-8
Java
false
false
1,793
java
package codigoBusiness; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import com.google.gson.Gson; import com.google.gson.GsonBuilder; public class CentroDistribucionJSON { private ArrayList<CentroDistribucion> centros; public CentroDistribucionJSON() { this.centros = new ArrayList<CentroDistribucion>(); } public void agregarCentro(CentroDistribucion persona) { centros.add(persona); } public CentroDistribucion getCentro(int i) { return centros.get(i); } public int getCantidadCentros() { return centros.size(); } public ArrayList<CentroDistribucion> getTodosLosCentros(){ @SuppressWarnings("unchecked") ArrayList<CentroDistribucion> ret = (ArrayList<CentroDistribucion>) centros.clone(); return ret; } public String generarJSONBasico() { Gson gson = new GsonBuilder().create(); String json = gson.toJson(this); return json; } public String generarJSONPretty() { Gson gson = new GsonBuilder().setPrettyPrinting().create(); String json = gson.toJson(this); return json; } public void guardarJSON(String jsonParaGuardar, String archivoDestino) { try { FileWriter writer = new FileWriter(archivoDestino); writer.write(jsonParaGuardar); writer.close(); } catch (IOException e) { e.printStackTrace(); } } public CentroDistribucionJSON leerJSON(String archivo) { Gson gson = new Gson(); CentroDistribucionJSON ret = null; try { BufferedReader br = new BufferedReader(new FileReader(archivo)); ret = gson.fromJson(br, CentroDistribucionJSON.class); } catch (FileNotFoundException e) { e.printStackTrace(); } return ret; } }
[ "gaston.campos509@gmail.com" ]
gaston.campos509@gmail.com
ed60255cdda587743a29397707e1e8079e99974d
d48cfe7bb65c3169dea931f605d62b4340222d75
/freeway-parent/.svn/pristine/ed/ed60255cdda587743a29397707e1e8079e99974d.svn-base
e0f16994860d69c1221d59bd9bfc04ca6a0bdb3c
[]
no_license
a559927z/doc
7b65aeff1d4606bab1d7f71307d6163b010a226d
04e812838a5614ed78f8bbfa16a377e7398843fc
refs/heads/master
2022-12-23T12:09:32.360591
2019-07-15T17:52:54
2019-07-15T17:52:54
195,972,411
0
0
null
2022-12-16T07:47:50
2019-07-09T09:02:38
JavaScript
UTF-8
Java
false
false
8,825
package net.chinahrd.common.shiro; import lombok.extern.slf4j.Slf4j; import org.apache.shiro.authc.credential.HashedCredentialsMatcher; import org.apache.shiro.crypto.hash.Sha512Hash; import org.apache.shiro.mgt.SecurityManager; import org.apache.shiro.session.mgt.SessionManager; import org.apache.shiro.spring.LifecycleBeanPostProcessor; import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor; import org.apache.shiro.spring.web.ShiroFilterFactoryBean; import org.apache.shiro.web.filter.authc.UserFilter; import org.apache.shiro.web.mgt.DefaultWebSecurityManager; import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; import org.crazycake.shiro.RedisCacheManager; import org.crazycake.shiro.RedisManager; import org.crazycake.shiro.RedisSessionDAO; import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.DependsOn; import javax.annotation.Resource; import javax.servlet.Filter; import java.util.LinkedHashMap; import java.util.Map; /** * Shiro 配置类 * * @author wzmo */ @Slf4j @Configuration public class ShiroConfig { // 获取application.properties参数 @Value("${spring.redis.host}") private String host; @Value("${spring.redis.port}") private int port; @Value("${spring.redis.password}") private String password; @Value("${spring.redis.timeout}") private int timeout; //@Autowired @Resource private AuthcFilter authcFilter; @Bean public RedisSessionDAO redisSessionDAO() { RedisSessionDAO redisSessionDAO = new RedisSessionDAO(); redisSessionDAO.setRedisManager(redisManager()); return redisSessionDAO; } /** * shiro的拦截器 * * @return **/ @Bean public ShiroFilterFactoryBean shiroFilter() { ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean(); shiroFilterFactoryBean.setSecurityManager(securityManager()); Map<String, Filter> filters = shiroFilterFactoryBean.getFilters(); filters.put("authcUserFilter", authcUserFilter()); Map<String, String> filterChainDefinitionMap = new LinkedHashMap<>(); // 注意过滤器配置顺序 不能颠倒 // 配置不会被拦截的链接 顺序判断 filterChainDefinitionMap.put("/favicon.ico", "anon"); filterChainDefinitionMap.put("/favicon**", "anon"); filterChainDefinitionMap.put("/login", "anon"); filterChainDefinitionMap.put("/loginCheck", "anon"); filterChainDefinitionMap.put("/logout", "anon"); filterChainDefinitionMap.put("/test/**", "anon"); filterChainDefinitionMap.put("/login**", "anon"); filterChainDefinitionMap.put("/swagger-ui.html**", "anon"); filterChainDefinitionMap.put("/webjars/**", "anon"); filterChainDefinitionMap.put("/v2/**", "anon"); filterChainDefinitionMap.put("/files/**", "anon"); filterChainDefinitionMap.put("/swagger-resources/**", "anon"); // filterChainDefinitionMap.put("/api/**", "statelessAuthc"); // filterChainDefinitionMap.put("/**", "anon"); filterChainDefinitionMap.put("/ws/**", "anon"); filterChainDefinitionMap.put("/**", "authcUserFilter"); // 配置shiro默认登录界面地址,前后端分离中登录界面跳转应由前端路由控制,后台仅返回json数据 // shiroFilterFactoryBean.setLoginUrl("/user/unlogin"); // 登录成功后要跳转的链接 自行处理。不用shiro进行跳转 // shiroFilterFactoryBean.setSuccessUrl("user/index"); // 未授权界面; // shiroFilterFactoryBean.setUnauthorizedUrl("/user/unauth"); shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap); return shiroFilterFactoryBean; } /** * 凭证匹配器(由于我们的密码校验交给Shiro的SimpleAuthenticationInfo进行处理了) * * @return */ @Bean public HashedCredentialsMatcher hashedCredentialsMatcher() { HashedCredentialsMatcher hashedCredentialsMatcher = new HashedCredentialsMatcher(); hashedCredentialsMatcher.setHashAlgorithmName(Sha512Hash.ALGORITHM_NAME);// 散列算法:这里使用sha-512算法; hashedCredentialsMatcher.setHashIterations(1024);// 散列的次数,比如散列两次,相当于 // md5( md5("")); hashedCredentialsMatcher.setStoredCredentialsHexEncoded(false);// 默认是true,此时用的是密码加密用的是Hex编码;false时用Base64编码 return hashedCredentialsMatcher; } /** * 用shiro-redis插件 * * @return */ @Bean public RedisCacheManager redisCacheManager() { RedisCacheManager redisCacheManager = new RedisCacheManager(); redisCacheManager.setRedisManager(redisManager()); return redisCacheManager; } private RedisManager redisManager() { RedisManager redisManager = new RedisManager(); redisManager.setHost(host); redisManager.setPort(port); // redisManager.setExpire(1800);// 配置缓存过期时间 redisManager.setTimeout(timeout); redisManager.setPassword(password); return redisManager; } @Bean @DependsOn(value = {"lifecycleBeanPostProcessor", "redisCacheManager"}) public UserLoginRealm userLoginRealm() { UserLoginRealm shiroRealm = new UserLoginRealm(); shiroRealm.setCachingEnabled(true); shiroRealm.setCacheManager(redisCacheManager()); //// 设置认证密码算法及迭代复杂度 shiroRealm.setCredentialsMatcher(hashedCredentialsMatcher()); // 关闭登陆用户信息缓存 // shiroRealm.setAuthenticationCachingEnabled(false); // shiroRealm.setAuthorizationCachingEnabled(false); return shiroRealm; } /** * shiro 用户数据注入 * DefaultWebSecurityManager * * @return */ @Bean public SecurityManager securityManager() { DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); // 配置 SecurityManager securityManager.setRealm(userLoginRealm()); // 配置 缓存管理类 cacheManager,这个cacheManager必须要在前面执行 securityManager.setCacheManager(redisCacheManager()); // 配置 sessionManager securityManager.setSessionManager(sessionManager()); return securityManager; } @Bean public SessionManager sessionManager() { DefaultWebSessionManager sessionManager = new DefaultWebSessionManager(); // 设置SessionDao sessionManager.setSessionDAO(redisSessionDAO()); // 设置全局session超时时间 sessionManager.setGlobalSessionTimeout(30 * 60 * 1000); // 删除过期的session sessionManager.setDeleteInvalidSessions(true); // 加入缓存管理器 sessionManager.setCacheManager(redisCacheManager()); // 定时检查session sessionManager.setSessionValidationSchedulerEnabled(true);// 是否定时检查session return sessionManager; } @Bean @DependsOn({"lifecycleBeanPostProcessor"}) public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() { DefaultAdvisorAutoProxyCreator proxyCreator = new DefaultAdvisorAutoProxyCreator(); proxyCreator.setProxyTargetClass(true); return proxyCreator; } /** * 开启shiro aop注解支持. * 使用代理方式;所以需要开启代码支持; * * @param securityManager * @return */ @Bean public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager) { AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor(); authorizationAttributeSourceAdvisor.setSecurityManager(securityManager); return authorizationAttributeSourceAdvisor; } /** * Shiro生命周期处理器 */ @Bean public static LifecycleBeanPostProcessor lifecycleBeanPostProcessor() { return new LifecycleBeanPostProcessor(); } public UserFilter authcUserFilter() { UserFilter filter = authcFilter.getUserFilter(); return filter; } }
[ "a559927z@163.com" ]
a559927z@163.com
457d5fbb8ff03eff5f2ab359b10acd9bac3a08c1
143b525bd218245b8efb34143aa8ccf5ea9cb7f2
/src/Medium/SubarraySumEqualsK.java
aa094b8b949680c8f341b6c94eafc95fbc1f1725
[]
no_license
NotSoMadMax/PuzzlesForFun
f0943f03d16efef276db407e45932fcf341cec7d
21db1025a99dd773acf3660905f80611b5faba35
refs/heads/master
2023-01-11T06:06:30.948211
2023-01-08T22:25:36
2023-01-08T22:25:36
211,547,949
0
0
null
null
null
null
UTF-8
Java
false
false
552
java
package medium; import java.util.HashMap; import java.util.Map; public class SubarraySumEqualsK { public int subarraySum(int[] nums, int k) { if(nums.length < 1 || k < 1) return 0; Map<Integer, Integer> count = new HashMap<>(); count.put(0, 1); int ans = 0; int sum = 0; for(int n : nums) { sum += n; ans += count.getOrDefault(sum - k, 0); count.put(sum, count.getOrDefault(sum, 0) + 1); } return ans; } }
[ "swang656@gatech.edu" ]
swang656@gatech.edu
37b1bcd157ff659ee7337587125b38040360b646
4de6150f9e4d8ddef09f41f4a4902872b1c3aa3d
/java_practice/src/mi/practice/java/base/interfaces/ex/Ex4.java
8cf66cdcda88a62ff015df20fcf45b5987a8cb01
[]
no_license
yehaote/mi
91d47ca1fb42ba62c10b8ab862390ee891d4c3a9
d7835cfa0f38b128ea65f90b33d18e9946e554ea
refs/heads/master
2016-09-11T05:48:43.750926
2013-10-10T06:01:56
2013-10-10T06:01:56
3,130,168
0
0
null
null
null
null
UTF-8
Java
false
false
369
java
package mi.practice.java.base.interfaces.ex; abstract class Ex4Super{ abstract void print(); } class Ex4Sub extends Ex4Super{ void print(){ System.out.println("Ex4Sub.print()"); } } public class Ex4 { static void test(Ex4Super sp){ // ((Ex4Sub)sp).print(); sp.print(); } public static void main(String[] args){ Ex4Super sp = new Ex4Sub(); test(sp); } }
[ "yehaote@gmail.com" ]
yehaote@gmail.com
96d3a6f1165816b312d6564de84bce76d2e12b63
968b7fbc70a0d16161d3d75c651447e24307b4f0
/src/main/java/it/unipv/ingsw/pickuppoint/ProgettoM21Application.java
38768ec0fe68731dbe2d9d3f5479366752abe214
[]
no_license
francesco-mrz/Progetto-M21
b32bc896745d79a8735eeb091a51afeaf16b566c
3c4033ed4c28a742cbcbb940b42b13df9ce91691
refs/heads/main
2023-06-19T21:29:18.313699
2021-07-18T11:08:35
2021-07-18T11:08:35
383,931,313
0
0
null
2021-07-07T21:45:38
2021-07-07T21:45:37
null
UTF-8
Java
false
false
413
java
package it.unipv.ingsw.pickuppoint; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.scheduling.annotation.EnableScheduling; @SpringBootApplication @EnableScheduling public class ProgettoM21Application { public static void main(String[] args) { SpringApplication.run(ProgettoM21Application.class, args); } }
[ "francesco.marzullo01@universitadipavia.it" ]
francesco.marzullo01@universitadipavia.it
ad0bf4a12b7b7da81ec28c171f6579d578cd22ec
ac578e2c8936ca6fb11279f5623b4e54e0ab1838
/src/main/java/steve/test/ReadGeoTiff.java
cdde50068ba5824a2dc86678bacbc40807185f00
[]
no_license
paulyc/wct
3537c80d2e877355de0f43081f6ada6c312dea40
e3fb969b6e5984c344e413daf899a4c7911340d7
refs/heads/master
2022-12-14T04:42:23.659344
2020-09-15T15:52:25
2020-09-15T15:52:25
295,412,886
0
0
null
null
null
null
UTF-8
Java
false
false
946
java
package steve.test; import java.io.IOException; import java.io.StringWriter; import gov.noaa.ncdc.wct.WCTIospManager; import ucar.nc2.NCdumpW; import ucar.nc2.NetcdfFile; public class ReadGeoTiff { public static void main(String[] args) { String errors = ""; try { WCTIospManager.getInstance().registerIosp(ucar.nc2.iosp.geotiff.GeoTiffIOServiceProvider.class); } catch (Exception e) { e.printStackTrace(); errors += "Error registering ucar.nc2.iosp.geotiff.GeoTiffIOServiceProvider.class\n"; } try { String file = "D:\\work\\export\\goes\\GOES13_BAND_01_20130720_005518.tif"; NetcdfFile ncfile = NetcdfFile.open(file); StringWriter sw = new StringWriter(); NCdumpW.print(file, sw); System.out.println(sw); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
[ "paulyc@quetzalcoatl.us" ]
paulyc@quetzalcoatl.us
9d243050b070616f756e498e87818875b83a4f21
e270772e939a66085b48f6d470e9b0a354346a2f
/src/main/java/com/sourcecode/web/MailComponent.java
481e4cfced122a3c73bc87594577202ac790a72c
[]
no_license
toby941/SourceCode
e3f7479a6876a54b3ac7cf2f3bfbc39106e49aba
57e4c78fd6aa55a62df954ac69b45ab94488b000
refs/heads/master
2021-01-20T03:35:06.195352
2014-07-04T06:26:13
2014-07-04T06:26:13
2,785,426
0
1
null
null
null
null
UTF-8
Java
false
false
8,324
java
/* * Copyright 2011 Mitian Technology, Co., Ltd. All rights reserved. */ package com.sourcecode.web; import java.io.IOException; import java.io.StringWriter; import java.util.List; import javax.mail.internet.MimeMessage; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.exception.ExceptionUtils; import org.apache.log4j.Logger; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.Velocity; import org.apache.velocity.app.VelocityEngine; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.core.task.TaskExecutor; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.JavaMailSenderImpl; import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.mail.javamail.MimeMessagePreparator; import org.springframework.stereotype.Service; /** * MailComponent.java * * @author baojun */ @Service public class MailComponent { private final Logger logger = Logger.getLogger("mail_log"); @Autowired @Qualifier("mailSender") private JavaMailSenderImpl mailSender;// 注入Spring封装的javamail,Spring的ml中已让框架装配 @Autowired @Qualifier("taskExecutor") private TaskExecutor taskExecutor;// 注入Spring封装的异步执行器private Log log = // LogFactory.getLog(getClass()); public String merge(String path, String key, String value) { VelocityEngine ve = new VelocityEngine(); // 设置模板加载路径,这里设置的是class下 ve.setProperty(Velocity.RESOURCE_LOADER, "class"); ve.setProperty(Velocity.ENCODING_DEFAULT, "UTF-8"); ve.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); Velocity.init(); /* lets make a Context and put data into it */ VelocityContext context = new VelocityContext(); context.put(key, value); /* lets render a template */ StringWriter w = new StringWriter(); Template t = ve.getTemplate(path, "utf-8"); t.merge(context, w); return w.toString(); } @Autowired private VelocityEngine velocityEngine; public VelocityEngine getVelocityEngine() { if (velocityEngine == null) { java.util.Properties properties = new java.util.Properties(); java.util.Properties subProperties = new java.util.Properties(); subProperties.put("input.encoding", "UTF-8"); subProperties.put("output.encoding", "UTF-8"); properties.put("resourceLoaderPath", "classpath:/com/sourcecode/web"); properties.put("velocityProperties", subProperties); VelocityEngine engine = new VelocityEngine(properties); velocityEngine = engine; } return velocityEngine; } /** * @return the mailSender */ public JavaMailSender getMailSender() { if (mailSender == null) { mailSender = new JavaMailSenderImpl(); mailSender.setHost("mail.airad.com"); mailSender.setUsername("contact@airad.com"); mailSender.setPassword("contact-2011"); java.util.Properties properties = new java.util.Properties(); properties.put("mail.smtp.auth", "true"); properties.put("mail.smtp.timeout", "25000"); properties.put("mail.mime.charset", "UTF-8"); properties.put("mail.smtp.starttls.enable", "true"); mailSender.setJavaMailProperties(properties); } return mailSender; } /** * @return the taskExecutor */ public TaskExecutor getTaskExecutor() { return taskExecutor; } public void sendMail(List<Email> emails) throws IOException { if (CollectionUtils.isEmpty(emails)) { return; } if (emails.size() > 5) {// 收件人大于5封时,采用异步发送 sendMailByAsynchronousMode(emails); } else { sendMailBySynchronizationMode(emails); } } /** * 异步发送 * * @see com.zhangjihao.service.MailService#sendMailByAsynchronousMode(com.zhangjihao.bean.Email) */ public void sendMailByAsynchronousMode(final List<Email> emails) { taskExecutor.execute(new Runnable() { @Override public void run() { try { sendMailBySynchronizationMode(emails); } catch (Exception e) { logger.info("send AsynMail error ", e); } } }); } /** * 同步发送 * * @throws IOException * @see com.zhangjihao.service.MailServiceMode#sendMail(com.zhangjihao.bean.Email) */ public void sendMailBySynchronizationMode(List<Email> emails) throws IOException { for (final Email email : emails) { try { sendSingleMail(email); } catch (Exception e) { logger.error("sendMailBySynchronizationMode error,mail info" + email.toLogString(), e); } } } /** * 统一应用捕获运行时异常的邮件通知入口 * * @param e * @param subject * @param mailToAddress */ public void sendExceptionMail(Exception e, String subject, String mailToAddress) { Email email = new Email(mailToAddress, "contact@airad.com", subject, ExceptionUtils.getFullStackTrace(e), false); sendSingleMail(email); } /** * 统一应用捕获运行时异常的邮件通知入口 * * @param e * @param subject * @param mailToAddress * @param cc */ public void sendExceptionMail(Exception e, String subject, String mailToAddress, String cc) { Email email = new Email(mailToAddress, cc, "contact@airad.com", subject, ExceptionUtils.getFullStackTrace(e), false); sendSingleMail(email); } /** * 单封邮件同步发送 * * @param email */ public void sendSingleMail(final Email email) { MimeMessagePreparator preparator = new MimeMessagePreparator() { @Override public void prepare(MimeMessage mimeMessage) throws Exception { MimeMessageHelper message = new MimeMessageHelper(mimeMessage, "utf-8"); message.setSubject(email.getSubject()); message.setSentDate(email.getCreateTime()); message.setFrom(email.getFromAddress(), email.getPersonal()); if (StringUtils.isNotBlank(email.getCc())) { message.setCc(email.getCc()); } message.setTo(email.getToAddress()); // MimeUtility message.setText(email.getContent(), email.isHtml()); } }; getMailSender().send(preparator); } /** * 单封邮件异步发送 * * @param email */ public void sendSingleMailByAsynchronousMode(final Email email) { taskExecutor.execute(new Runnable() { @Override public void run() { try { sendSingleMail(email); } catch (Exception e) { logger.error("sendSingleMailByAsynchronousMode error ", e); } } }); } /** * @param mailSender the mailSender to set */ public void setMailSender(JavaMailSenderImpl mailSender) { this.mailSender = mailSender; } /** * @param taskExecutor the taskExecutor to set */ public void setTaskExecutor(TaskExecutor taskExecutor) { this.taskExecutor = taskExecutor; } }
[ "toby941@gmail.com" ]
toby941@gmail.com
b5b4b68505a7ef268229bae130c67d1c6ffa47c2
00f2699a1e616c43183a8b66401bd14cabc47b22
/src/test/java/Up2DataExamples.java
85dd933cba13b7debef6be99567d4bd20c0342fe
[ "Apache-2.0" ]
permissive
rportela/jports-bovespa
46584d07d18248eb3c5a50c5b3b0904b1413f17c
eff62ec5b0a16704aab921edb3b71642a52657e7
refs/heads/master
2022-05-06T20:30:01.025307
2020-02-28T13:20:48
2020-02-28T13:20:48
157,388,698
1
0
Apache-2.0
2022-03-08T21:20:13
2018-11-13T13:56:30
Java
UTF-8
Java
false
false
3,389
java
import java.io.File; import java.io.IOException; import java.util.List; import jports.GenericLogger; import jports.b3.up2data.EquityInstrument; import jports.b3.up2data.OptionOnEquitiesInstrument; import jports.b3.up2data.Up2DataSource; public class Up2DataExamples { /** * This is the root folder of the UP2DATA installation. */ private static final String UP2DATA_ROOT = "L:\\UP2DATA"; /** * Reads a list of equity instruments from the most recent file. * * @throws IOException */ public void readEquityInstruments() throws IOException { Up2DataSource<EquityInstrument> up2data = new Up2DataSource<>(UP2DATA_ROOT, EquityInstrument.class); List<File> allFiles = up2data.getAllFiles(); // This assumes that the files were written from oldest to newest. Optionally // you can sort the list by file name or date to make sure your're reading the // last one. File last = allFiles.get(allFiles.size() - 1); // Equities_EquityInstrumentFile_yyyyMMdd.txt System.out.println(last.getName()); // parses the file List<EquityInstrument> equities = up2data.parseFile(last); // just writes the first one as json so you can see how it looks like if (!equities.isEmpty()) { GenericLogger.info(getClass(), equities.get(0)); } /** * <pre> * { "report_date": "Dec 12, 2018, 12:00:00 AM", "ticker": "AALL34", "security_id": 200000224542, "security_source": 8, "exchange": "BVMF", "asset": "AALL", "asset_description": "AALL", "segment": "CASH", "market": "EQUITY-CASH", "description": "AMERICAN AIRDRN", "category": "BDR", "trade_start": "Nov 1, 2018, 12:00:00 AM", "trade_end": "Dec 31, 9999, 12:00:00 AM", "isin": "BRAALLBDR003", "cfi_code": "EDSXPR", "payment_type": "NETTING", "allocation_round_lot": 1, "currency": "BRL", "distribution": 110, "specification": "DRN", "company_name": "AMERICAN AIRLINES GROUP INC.", "price_factor": 1, "corporate_action_start": "Dec 31, 9999, 12:00:00 AM", "ex_distribution_number": 0, "custody_type": "FUNGIBLE", "market_cap": 4.92588818E8, "first_price": 160.8658302, "last_price": 160.8658302, "governance": "", "days_to_settlement": 3, "rights_issue_price": 0.0, "underlying_instrument_id": "", "asset_sub_type": "", "target_instrument_id": "" } * * </pre> */ } public void readOptionsOnEquitiesInstruments() throws IOException { Up2DataSource<OptionOnEquitiesInstrument> up2data = new Up2DataSource<>(UP2DATA_ROOT, OptionOnEquitiesInstrument.class); List<File> allFiles = up2data.getAllFiles(); // This assumes that the files were written from oldest to newest. Optionally // you can sort the list by file name or date to make sure your're reading the // last one. File last = allFiles.get(allFiles.size() - 1); // Equities_OptionOnEquitiesInstrumentFile__yyyyMMdd_1.txt System.out.println(last.getName()); // parses the file List<OptionOnEquitiesInstrument> options = up2data.parseFile(last); // just writes the first one as json so you can see how it looks like if (!options.isEmpty()) { if (!options.isEmpty()) { GenericLogger.info(getClass(), options.get(0)); } } } public static void main(String... args) { try { new Up2DataExamples().readOptionsOnEquitiesInstruments(); } catch (IOException e) { GenericLogger.error(Up2DataExamples.class, e); } } }
[ "rodrigo.portela@hotmail.com" ]
rodrigo.portela@hotmail.com
2a58fb471c50d981966c6ebd53c593e86444cc57
c84e5e01eb4661f084addea6afa1d61bda38ec4b
/src/main/java/com/musa1/controller/CursoController.java
6c10f6073cc89ea93802fb6f13890c575e8b76e7
[]
no_license
sistemasUPeU/musa1
ad31ad6bbc327ba6f3f107012121d967d57b4c3d
7e8e8a589f5a2a245701f6701af2c5cc9b0a147c
refs/heads/master
2021-06-26T18:30:34.087383
2019-12-02T00:17:06
2019-12-02T00:17:06
216,853,991
0
0
null
2021-03-31T22:27:04
2019-10-22T15:59:49
Java
UTF-8
Java
false
false
1,453
java
package com.musa1.controller; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; 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.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.musa1.entity.Curso; import com.musa1.service.CursoService; @CrossOrigin(origins = "*") @RestController @RequestMapping("/curso") public class CursoController { @Autowired private CursoService cursoService; @GetMapping("/") public Map<String, Object> get() { return cursoService.readAll(); } @PostMapping("/add") public int save(@RequestBody Curso curso) { return cursoService.create(curso); } @DeleteMapping("/{id}") public int delete(@PathVariable int id) { return cursoService.delete(id); } @GetMapping("/{id}") public Map<String, Object> read(@PathVariable int id) { return cursoService.read(id); } @PutMapping("/{id}") public int update(@RequestBody Curso cur, @PathVariable int id) { cur.setId_curso(id); return cursoService.edit(cur); } }
[ "gabrielcosi18@gmail.com" ]
gabrielcosi18@gmail.com
8eb4708c941ab9f6be3b64c3bdd9871d5bec624c
a2ae3cc2d2336f071714b25ca8714aff8fee8231
/src/main/java/io/femo/http/Authentication.java
ecd6ba34f283a471c759d7a84a48979293595741
[ "MIT" ]
permissive
femoio/http
20b7a982eb2c11e4706b886a09d4355967933306
05e175bd6addd79dca9574075c9f78cac69ab1cd
refs/heads/master
2020-04-06T07:01:50.359837
2016-08-29T17:55:33
2016-08-29T17:55:33
50,173,909
1
3
null
2016-08-29T17:55:34
2016-01-22T10:15:43
Java
UTF-8
Java
false
false
1,429
java
package io.femo.http; import io.femo.http.auth.DefaultBasicStrategy; import io.femo.http.auth.DefaultDigestStrategy; import org.jetbrains.annotations.Contract; import java.util.function.Supplier; /** * Created by felix on 6/21/16. */ public interface Authentication extends Driver { boolean isInitialized(); boolean matches(HttpRequest request); boolean supportsMulti(); boolean supportsDirect(); void init(HttpResponse response); String strategy(); void authenticate(HttpRequest request); default boolean supports(HttpResponse response) { String authenticate = response.header("WWW-Authenticate").value(); return authenticate.startsWith(strategy()); } @Contract("_, _ -> !null") static Authentication basic(Supplier<String> username, Supplier<String> password) { return new DefaultBasicStrategy(username, password); } @Contract("_, _ -> !null") static Authentication basic(String username, String password) { return new DefaultBasicStrategy(username, password); } @Contract("_, _ -> !null") static Authentication digest(String username, String password) { return new DefaultDigestStrategy(username, password); } @Contract("_, _ -> !null") static Authentication digest(Supplier<String> username, Supplier<String> password) { return new DefaultDigestStrategy(username, password); } }
[ "resch.felix@gmail.com" ]
resch.felix@gmail.com
00d62cf988a4f0e6fd8b5a0c5dd23e6dfa6f084c
a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb
/pds-20220301/src/main/java/com/aliyun/pds20220301/models/AuthorizeRequest.java
255465586fe1de325019f55230ef2ae9ed08c673
[ "Apache-2.0" ]
permissive
aliyun/alibabacloud-java-sdk
83a6036a33c7278bca6f1bafccb0180940d58b0b
008923f156adf2e4f4785a0419f60640273854ec
refs/heads/master
2023-09-01T04:10:33.640756
2023-09-01T02:40:45
2023-09-01T02:40:45
288,968,318
40
45
null
2023-06-13T02:47:13
2020-08-20T09:51:08
Java
UTF-8
Java
false
false
2,192
java
// This file is auto-generated, don't edit it. Thanks. package com.aliyun.pds20220301.models; import com.aliyun.tea.*; public class AuthorizeRequest extends TeaModel { @NameInMap("client_id") public String clientId; @NameInMap("hide_consent") public Boolean hideConsent; @NameInMap("login_type") public String loginType; @NameInMap("redirect_uri") public String redirectUri; @NameInMap("response_type") public String responseType; @NameInMap("scope") public java.util.List<String> scope; @NameInMap("state") public String state; public static AuthorizeRequest build(java.util.Map<String, ?> map) throws Exception { AuthorizeRequest self = new AuthorizeRequest(); return TeaModel.build(map, self); } public AuthorizeRequest setClientId(String clientId) { this.clientId = clientId; return this; } public String getClientId() { return this.clientId; } public AuthorizeRequest setHideConsent(Boolean hideConsent) { this.hideConsent = hideConsent; return this; } public Boolean getHideConsent() { return this.hideConsent; } public AuthorizeRequest setLoginType(String loginType) { this.loginType = loginType; return this; } public String getLoginType() { return this.loginType; } public AuthorizeRequest setRedirectUri(String redirectUri) { this.redirectUri = redirectUri; return this; } public String getRedirectUri() { return this.redirectUri; } public AuthorizeRequest setResponseType(String responseType) { this.responseType = responseType; return this; } public String getResponseType() { return this.responseType; } public AuthorizeRequest setScope(java.util.List<String> scope) { this.scope = scope; return this; } public java.util.List<String> getScope() { return this.scope; } public AuthorizeRequest setState(String state) { this.state = state; return this; } public String getState() { return this.state; } }
[ "sdk-team@alibabacloud.com" ]
sdk-team@alibabacloud.com
b899d73d328b6154b2aa1ea7996ff64be248825f
82cab779e826675e5c9298c2756cfa9270341cba
/Movie/Cinema.java
d86393a54044843c09f0649d0352bff4eb3ea288
[]
no_license
hanifahotelwala/Movie-Theater
b299dc78fe7a2e6e0a0fc0d05376e20d853549ca
8ac921cd65e04779415f789d8aad45459c414eb4
refs/heads/master
2020-03-14T18:26:18.981054
2018-05-01T17:26:41
2018-05-01T17:26:41
131,741,161
0
0
null
null
null
null
UTF-8
Java
false
false
1,104
java
/** * Contains multiple cinema theaters */ public class Cinema { Theater t1; Theater t2; Theater t3; Theater selected; /** * Constructor for objects of class Complex */ public Cinema(Theater t1, Theater t2, Theater t3) { this.t1 = t1; this.t2 = t2; this.t3 = t3; } public void display() { t1.display(); t2.display(); t3.display(); } public Theater getT1() { return t1; } public Theater getT2() { return t2; } public Theater getT3() { return t3; } public void getSelected(int select) { if (select <0 || select > 3) { System.out.println("Not possible, choose again"); System.exit(0); } else if(select ==1) { selected = t1; selected.display(); } else if(select ==2) { selected = t2; selected.display();} else { selected = t3; selected.display(); } } }
[ "noreply@github.com" ]
hanifahotelwala.noreply@github.com
b73505fa458f2bdb7faf3a488178a42234eb77d4
d1b89183b865218f64bad044114302ff0140af2f
/src/main/java/Main.java
c4eaad671b3d0b1add6be061ed886b73044c65a6
[]
no_license
popenyuk/Flower-Shop-Improved
c37f92aa8fdd235acfeb37f97d843e6d09c614ee
891a7509ccf71df8c6bfd5f67e74d992d1229537
refs/heads/master
2020-04-07T03:18:24.089967
2018-12-02T20:20:29
2018-12-02T20:20:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,886
java
import Config.RandomGenerator; import Payment.AndroidPay; import Payment.ApplePay; import Payment.GooglePay; import Payment.PayMethod; import discount.DiscountDecorator; import discount.NewYearDiscount; import discount.NoDiscount; import discount.RegularCustumerDiscount; import flowers.*; import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { System.out.println("Hello! This is a flower shop!"); System.out.println("We have an already formed bouquet or you can form it by yourself."); System.out.println("What type do you prefer?Input 1 if formed bouquet or 2 otherwise."); Scanner scan = new Scanner(System.in); String answer = scan.nextLine(); FlowerBouquet my_bouquet = new FlowerBouquet(); if (Integer.valueOf(answer) == 1) { ArrayList<ArrayList> bouquets = new ArrayList<ArrayList>(); RandomGenerator randomGenerator = new RandomGenerator(); ArrayList new_bouquet; for (int i = 1; i <= randomGenerator.getRandomInt(1, 10); i++) { FlowerBouquet flowerBouquet = new FlowerBouquet(); flowerBouquet.getRandomFlowerBouquet(); new_bouquet = new ArrayList(); new_bouquet.add(i); new_bouquet.add(flowerBouquet); bouquets.add(new_bouquet); } System.out.println("Currently available bouquets"); for (ArrayList flowerBouquet : bouquets) { System.out.println("Bucket number " + flowerBouquet.get(0) + " is\n" + flowerBouquet.get(1)); } System.out.println("Which bouquet do you want?"); answer = scan.nextLine(); for (ArrayList bouquet : bouquets) { if (bouquet.get(0) == Integer.valueOf(answer)) { my_bouquet = (FlowerBouquet) bouquet.get(1); } } } System.out.println("Do you want to add some flower to you bouquet?If yes input yes, if no input no."); answer = scan.nextLine(); Flower flower; while (answer.equals("yes")) { System.out.println("Which type of flowers do you want add?"); answer = scan.nextLine(); switch ((char) (answer.charAt(0))) { case 'C': flower = new Chamomile(); break; case 'R': flower = new Rosie(); break; case 'T': flower = new Tulip(); break; default: flower = new Flower(); System.out.println("There no flower with this type!"); } if (!flower.getClass().getSimpleName().equals("Flower")) { flower.getRandomConfig(); my_bouquet.addFlower(flower); } System.out.println("Do you want to add some flower to you bouquet?If yes input yes, if no input no."); answer = scan.nextLine(); } System.out.println("Do you have an allergic reaction to any kind of flowers?"); answer = scan.nextLine(); while (answer.equals("yes")) { System.out.println("Which type of flowers do you want remove from bouquet?"); answer = scan.nextLine(); my_bouquet.removeAllFlowersThisType(answer); System.out.println("Do you have an allergic reaction to any kind of flowers?"); answer = scan.nextLine(); } if (my_bouquet.getBucket().size() == 0) { System.out.println("You haven`t selected any bouquet"); } else { System.out.println("If you have any type of discount please input it type.\n"); System.out.println("Input 1 if you have New Year discount, 2 if regular custumer and 3 if no one.\n"); int method = Integer.valueOf(scan.nextLine()); DiscountDecorator discount; switch (method) { case 1: discount = new DiscountDecorator(new NewYearDiscount()); my_bouquet.setPrice(discount.new_price(my_bouquet.getPrice())); break; case 2: discount = new DiscountDecorator(new RegularCustumerDiscount()); my_bouquet.setPrice(discount.new_price(my_bouquet.getPrice())); break; case 3: discount = new DiscountDecorator(new NoDiscount()); my_bouquet.setPrice(discount.new_price(my_bouquet.getPrice())); break; default: discount = new DiscountDecorator(new NoDiscount()); my_bouquet.setPrice(discount.new_price(my_bouquet.getPrice())); System.out.println("Wrong data! You discount is 0!"); break; } System.out.println("if you want pay by GooglePay input 1, if AndroidPay 2 and if ApplePay 3"); method = Integer.valueOf(scan.nextLine()); PayMethod payMethod; switch (method) { case 1: payMethod = new PayMethod(new GooglePay()); payMethod.pay(my_bouquet); break; case 2: payMethod = new PayMethod(new AndroidPay()); payMethod.pay(my_bouquet); break; case 3: payMethod = new PayMethod(new ApplePay()); payMethod.pay(my_bouquet); break; default: System.out.println("Wrong data! Remake all!"); break; } } } }
[ "noreply@github.com" ]
popenyuk.noreply@github.com
1d8fd673d5d8b1b925b467ede55c4e8030165938
8d0ce285d6e4f8d3752b628c0d895e30a0e4c1f1
/src/main/java/sardine/Filter.java
23ea6eff7a19b301b0d548b65a3d1bfb956f5344
[ "MIT" ]
permissive
vincentpanqi/sardine
28cfad9ca568855dfc08dad59d3caa7e8ec0f4fa
f3ff1ba08c8e6fa5342df341597bd88d5091bb6b
refs/heads/master
2020-03-24T13:29:46.379417
2016-09-26T01:42:04
2016-09-26T01:42:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
946
java
package sardine; import java.util.Objects; /** * before / after filter * * @author bruce-sha */ @FunctionalInterface public interface Filter { void apply(Request request, Response response) throws Exception; /** * */ @FunctionalInterface /*public static */ interface VFilter { void apply() throws Exception; } /** * */ /*public*/ abstract class SardineFilter implements Filter { final private String path; final private String accept; SardineFilter(final String path, final String accept) { this.path = Objects.requireNonNull(path); this.accept = Objects.requireNonNull(accept); } public String getAccept() { return accept; } public String getPath() { return path; } public abstract void apply(Request request, Response response) throws Exception; } }
[ "bu.ru@qq.com" ]
bu.ru@qq.com
3614837c0eaf57af711c64d2a37eee30870fa2ea
083d4353f42b64a37ff523ea79fb97dfaa1bbe96
/src/Updater.java
22b224d15dcb8e180500e480d1234f0215326181
[]
no_license
skilbert/podio
002b5fb65fbdf4260709de54afdb3d6613305010
e2d4d335a9f391d6bcbd08fc677ea28b015077cf
refs/heads/master
2020-04-06T14:58:30.574354
2016-09-11T14:03:06
2016-09-11T14:03:06
55,480,240
0
0
null
null
null
null
UTF-8
Java
false
false
4,645
java
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.HashMap; import java.util.Map; /* * Class for updating the podcasts. We generate a versions.txt each time this is run, and we check it for changes. * To compare we have the orginal and create a tempVersions.txt which is later renamed and to versions.txt */ public class Updater { private Podcasts podcasts; private String tmpFilepath; private String filepath; private String[][] names; PrintWriter write; /* * Constructor gets a object of podcasts and the filepath for versions.txt * Then generates a new printWriter */ public Updater(Podcasts podcasts, String filepath){ this.podcasts = podcasts; this.tmpFilepath = filepath+"tmpVersion.txt"; this.filepath = filepath+"version.txt"; try{ write = new PrintWriter(new FileWriter(tmpFilepath, false)); }catch(Exception e){ System.out.println("Can not find path.... "+ e.getMessage()); } names = new String[10][10]; } /* * updates the podcasts if needed and cleans after it is done */ public void updateEverything(){ checkVersion(); clean(); } /* * We start by checking the versions. It starts by reading the document and storing what we need. * We then check this information with the information online. We use the XMLparser for this. This parses each URL from the Podcasts object and checks for changes against the document. */ private void checkVersion(){ //first we read the document with the current versions of podcasts String[][] versions = new String[10][10]; // supports 10 channels with 10 programs for each. Easy to change try(BufferedReader br = new BufferedReader(new FileReader(filepath))){ String line; int i = -1; int j = -1; while((line = br.readLine()) != null ){ if(line.startsWith("#")){ i++; }else if(line.startsWith("*")){ j++; }else if(line.startsWith("time: ")){ versions[i][j] = line.replace("time: ",""); } } br.close(); }catch(IOException e){ System.out.println("Something is wrong with the version file, or it is not present"); System.out.println(e.getMessage()); } //Then read the online information int i = -1; int j = -1; HashMap<String, Station> stationList = podcasts.getStations(); for(Map.Entry<String,Station> stationEntry : stationList.entrySet()){ i++; HashMap<String, String> programList = stationEntry.getValue().getPrograms(); write.println("#"+stationEntry.getKey()+"\n"); for(Map.Entry<String, String> programEntry : programList.entrySet()){ j++; XMLParser xmlParser = new XMLParser(programEntry.getValue(), 1); String pubDate = xmlParser.getPubDate()[0]; write.println("*"+programEntry.getKey()); if(versions[i][j] != null){ if(pubDate.equals(versions[i][j])){ System.out.println("we have the latest version of "+xmlParser.getTitle()[0]); }else{ System.out.println("Downloading the latest version of "+xmlParser.getTitle()[0]); download(xmlParser, programEntry.getKey()); } write.println("time: "+pubDate+"\n"); names[i][j] = programEntry.getKey(); } } } } /* * Downloads the file if we do not have the newest. * Adds TMP to the title because we want to download while we listen to the last version */ private void download(XMLParser xmlParser, String name){ //this could be done in seperate threads, but I don't see why we should String tmpName = "TMP"+name; new Downloader(xmlParser.getMp3()[0], tmpName).start(); } /* * This cleans after we are done. It swaps the TMPfile with the one we want so we have the newest version. It also does this for the versions.txt */ private void clean(){ write.close(); try{ File oldfile = new File(filepath); oldfile.delete(); File newName = new File(filepath); File file = new File(tmpFilepath); file.renameTo(newName); }catch(Exception e){ System.out.println(e.getMessage()); } try{ for(int i = 0; i < names.length; i++){ for(int j = 0; j < names[0].length; j++){ if(names[i][j] != null){ File file = new File("src/file/TMP"+names[i][j]+".mp3"); if(file.exists()){ File oldfile = new File("src/file/"+names[i][j]+".mp3"); oldfile.delete(); File newName = new File("src/file/"+names[i][j]+".mp3"); file.renameTo(newName); } }else{ break; } } } }catch(Exception e){ System.out.println(e.getMessage()); } System.out.println("cleaning is done"); } }
[ "jostein1993@hotmail.com" ]
jostein1993@hotmail.com
505ccb3d8b3cb65263ffae07bab2b04b122cb50a
f063204e9c33f8d2eaed5e5ad7bc272c9814d0fd
/app/src/androidTest/java/html/eduhollcs184assignmentsassignment1/ucsb/cs/httpwww/xsunxmlcolorswap/ExampleInstrumentedTest.java
4b3750f11a1c465b32e6dc5034b71142d2df2f9b
[]
no_license
9728627/XsunXMLColorSwap
2ed54ec47ec0d827ce4bc627228a3a57f8556eff
eb744341458518bbe8e8a1d895b5ab5dfdb7eaf9
refs/heads/master
2021-07-15T21:21:32.819436
2017-10-22T09:07:22
2017-10-22T09:07:22
107,851,573
0
0
null
null
null
null
UTF-8
Java
false
false
848
java
package html.eduhollcs184assignmentsassignment1.ucsb.cs.httpwww.xsunxmlcolorswap; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("html.eduhollcs184assignmentsassignment1.ucsb.cs.httpwww.xsunxmlcolorswap", appContext.getPackageName()); } }
[ "xiao_sun@umail.ucsb.edu" ]
xiao_sun@umail.ucsb.edu
fe0b9fff9474cbc3e2e14e57fe232bf3784de40e
e7ef536ca570613c11b6b006699e7c010c08ff00
/Massenger/src/com/mini/db/ClientUserDb.java
230582d8b68872404223b478498dc00767e1f33d
[]
no_license
whehtk22/MiniPRoject-re-
5284c89a07248a3e9918c9b97f9ce25fdbbd85bb
f568c7de8d83543ed2df1e7bf14c7e0510b0d032
refs/heads/master
2020-03-27T04:30:01.049526
2018-09-07T00:17:36
2018-09-07T00:17:36
145,945,641
0
0
null
2018-09-07T00:17:38
2018-08-24T05:19:01
Java
UTF-8
Java
false
false
965
java
package com.mini.db; import java.awt.image.BufferedImage; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.Serializable; import java.net.*; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; public class ClientUserDb implements Serializable{ private String password; private String user_name; public ClientUserDb() { super(); } public ClientUserDb( String password, String name) { this.setPassword(password); this.setUser_name(name); System.out.println(this.getUser_name()); } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getUser_name() { return user_name; } public void setUser_name(String user_name) { this.user_name = user_name; } }
[ "user@DESKTOP-7EQF3M8" ]
user@DESKTOP-7EQF3M8
5cbcd8e71add736528585e10fd63591c7bc31dba
48ad608e3502515447747fef5165dd5ddec2d9fd
/src/main/java/uk/co/thomasc/steamkit/base/generated/internal/MsgClientChatAction.java
c90c29524bf31c9b0bdd4e27c6e2052b1d6cf0e0
[ "MIT" ]
permissive
vitaxa/JaSteamKit
cda1360e72b89a2bba608500e201ac7674dca943
f55f55b2d20bae139492179643d2e4e12e66082f
refs/heads/master
2022-10-13T23:41:29.760245
2020-05-11T15:11:01
2020-05-11T15:11:01
191,310,767
2
2
MIT
2022-10-04T23:52:14
2019-06-11T06:47:36
Java
UTF-8
Java
false
false
1,932
java
package uk.co.thomasc.steamkit.base.generated.internal; import uk.co.thomasc.steamkit.base.ISteamSerializableMessage; import uk.co.thomasc.steamkit.base.generated.enums.EChatAction; import uk.co.thomasc.steamkit.base.generated.enums.EMsg; import uk.co.thomasc.steamkit.types.SteamID; import uk.co.thomasc.steamkit.util.stream.BinaryReader; import uk.co.thomasc.steamkit.util.stream.BinaryWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class MsgClientChatAction implements ISteamSerializableMessage { private long steamIdChat = 0L; private long steamIdUserToActOn = 0L; private EChatAction chatAction = EChatAction.from(0); @Override public EMsg getEMsg() { return EMsg.ClientChatAction; } public SteamID getSteamIdChat() { return new SteamID(this.steamIdChat); } public void setSteamIdChat(SteamID steamId) { this.steamIdChat = steamId.convertToUInt64(); } public SteamID getSteamIdUserToActOn() { return new SteamID(this.steamIdUserToActOn); } public void setSteamIdUserToActOn(SteamID steamId) { this.steamIdUserToActOn = steamId.convertToUInt64(); } public EChatAction getChatAction() { return this.chatAction; } public void setChatAction(EChatAction chatAction) { this.chatAction = chatAction; } @Override public void serialize(OutputStream stream) throws IOException { BinaryWriter bw = new BinaryWriter(stream); bw.writeLong(steamIdChat); bw.writeLong(steamIdUserToActOn); bw.writeInt(chatAction.code()); } @Override public void deserialize(InputStream stream) throws IOException { BinaryReader br = new BinaryReader(stream); steamIdChat = br.readLong(); steamIdUserToActOn = br.readLong(); chatAction = EChatAction.from(br.readInt()); } }
[ "vitaxa93gamebox@gmal.com" ]
vitaxa93gamebox@gmal.com
db0ec63560d7e85cad3998527e95e99936230252
b15937e0c69a0055e61b20b952498207308161e4
/src/tree/BinaryTreePathSumToTargetl.java
f9ad3d92cab28f87479b443ccc3ce3aad36bcc14
[]
no_license
wangkobe88/algorithms_in_java
461efbb383d723e1bc4f56f544ed5e34c9a97584
3e8d441e62ef33b81795fa305a7489858b164f6f
refs/heads/master
2020-03-31T08:35:25.370607
2018-12-15T10:17:30
2018-12-15T10:17:30
152,063,774
0
0
null
null
null
null
UTF-8
Java
false
false
828
java
package tree; /** * Created by kewang on 26/10/18. */ public class BinaryTreePathSumToTargetl { private void judgeIsExist(TreeNode root, int target, int currentSum, boolean[] isExist) { if(root == null) { return; } currentSum = (root.key + currentSum); if (root.left == null && root.right == null) { if (currentSum == target) { isExist[0] = true; } } judgeIsExist(root.left, target, currentSum, isExist); judgeIsExist(root.right, target, currentSum, isExist); } public boolean exist(TreeNode root, int target) { // Write your solution here boolean[] isExist = new boolean[1]; isExist[0] = false; judgeIsExist(root, target, 0, isExist); return isExist[0]; } }
[ "wangke@waqu.com" ]
wangke@waqu.com
79dd440a10faaf94135fbfb60237ab696c07cba3
316e116ed10b75c1086e0f943d4318902d825113
/prepare/20190716.java
7a4a731d078dd9d1b6ebda4f114035272cae1dd7
[]
no_license
CodeStudyTogether/FrontEnd-Base-Prepare
abd289377c82e62ac519d6484fd3aec57ca8e7a5
ccb8f6e123ce418b17150b4aaec4a14c03b84afe
refs/heads/master
2020-04-01T03:37:59.319753
2019-07-16T09:51:16
2019-07-16T09:51:16
152,829,724
0
0
null
null
null
null
UTF-8
Java
false
false
2,983
java
当我们线程创建过多时,容易引发内存溢出,因此我们就有必要使用线程池的技术了。 总体来说,线程池有如下的优势: (1)降低资源消耗。通过重复利用已创建的线程降低线程创建和销毁造成的消耗。 (2)提高响应速度。当任务到达时,任务可以不需要等到线程创建就能立即执行。 (3)提高线程的可管理性。线程是稀缺资源,如果无限制的创建,不仅会消耗系统资源,还会降低系统的稳定性,使用线程池可以进行统一的分配,调优和监控。 其实Executors已经为我们封装好了4种常见的功能线程池,如下: 定长线程池(FixedThreadPool) 定时线程池(ScheduledThreadPool ) 可缓存线程池(CachedThreadPool) 单线程化线程池(SingleThreadExecutor) https://juejin.im/post/5d2d6ad2e51d457759648795 为什么16ms一帧? 16ms是1000ms/60帧得到的结果,60帧对于人眼而言已经是很流畅的体验了。而最低的限度是33ms一帧,也就是1000ms/30帧得到的结果。如果时间再长一点的话,就有可能发生人眼可见的卡顿了。 view 和 presenter 是 一对一关系时,在我看来是过度设计。 虽然解耦,逻辑清晰等有点。。 但是。因为业务的关系。。经常一个activity带n个fragment,然后每个都带个Presenter, 有的需要网络请求,有的不需要。。。其实代码量还好,但是。。文件数量大大提升。。。总觉得还是很麻烦 MVP:Model 通知 Presenter 通知 View, Presenter 切断了 Model 和 View 的联系 架构师从来都不是看书看来的,需要长久的实践与累积。最好的方式就是在工作中累积。 首先,你得明确,你是在做产品,不是做项目。 其次,架构的前期需求分析与建模非常重要,多思考未来可能的扩展。 最后,最好有一定的代码规范甚至是洁癖。 View是Android中所有控件的基类,无论是TextView、ImageView还是Button、CheckBox都是继承自View,可以说我们的应用界面就是由各式各样的View组成的。 ViewGroup从名字就可以看出来表示一组View,它可以包含多个View。平时常用的LinearLayout、RelativeLayout、FrameLayout等都是继承自ViewGroup,并且ViewGroup也是继承自View。 EXACTLY模式下,父View为子View测量出所需要的大小,一般对应match_parent属性,强制大小充满父布局和父布局一样大,或者具体数值,比如100dp。 AT_MOST模式下,父View为子View提供一个最大的尺寸大小,子View大小可以任意由自己决定,但是最大不能超过这个尺寸,一般对应wrap_content属性,自适应大小。 Window是一个抽象的窗体的概念,每个Activity初始化默认会创建一个Window,界面上所有的View都会添加到这个Window上。Android中的Window类也是个抽象类,它的实现类是PhoneWindow。
[ "noreply@github.com" ]
CodeStudyTogether.noreply@github.com
782aaeb699d96c4668f0bda36f7d2f2d95905512
d0685d8955ff5628d79463a7f3faae9d02d6a4c5
/msa-sample-api/src/main/java/demo/msa/framework/registry/ServiceRegistryImpl.java
cb03f10e5720eb43d8de216fa6f4b8aadb86c44b
[]
no_license
CocaCola183/Microservices
87f778cab8130a112ab1feb49588b72b4fecf895
faef052fcb3664d94031692cb99844d4df96c4a1
refs/heads/master
2020-12-31T06:56:34.520062
2017-03-28T16:00:34
2017-03-28T16:00:34
86,592,414
0
0
null
2017-03-29T14:29:45
2017-03-29T14:29:45
null
UTF-8
Java
false
false
2,574
java
package demo.msa.framework.registry; import org.apache.zookeeper.*; import org.apache.zookeeper.data.Stat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import java.util.concurrent.CountDownLatch; /** * Created by wxh on 2017/3/26. */ @Component public class ServiceRegistryImpl implements ServiceRegistry, Watcher { private static Logger logger = LoggerFactory.getLogger(ServiceRegistryImpl.class); private static CountDownLatch latch = new CountDownLatch(1); private ZooKeeper zk; private static final String REGISTRY_PATH = "/registry"; private static final int SESSION_TIMEOUT = 5000; public ServiceRegistryImpl () { } public ServiceRegistryImpl (String zkServers) { try { zk = new ZooKeeper(zkServers, SESSION_TIMEOUT, this); latch.await(); logger.debug("connected to zookeeper"); } catch (Exception e) { logger.error("create zookerper client failure", e); } } @Override public void register(String serviceName, String serviceAddress) { try { //创建根节点 (持久节点) String registryPath = REGISTRY_PATH; Stat stat = zk.exists(registryPath, false); System.out.print("111" + zk.exists(registryPath, false)); if (zk.exists(registryPath, false) == null) { zk.create(registryPath, null, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); logger.debug("create registry node: {}", registryPath); } //创建服务节点 (持久节点) String servicePath = registryPath + "/" + serviceName; if (zk.exists(servicePath, false) == null) { zk.create(servicePath, null, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); logger.debug("create service node: {}" + servicePath); } //创建地址节点 (临时顺序节点) String addressPath = servicePath +"/address-0000"; String addressNode = zk.create(addressPath, serviceAddress.getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); logger.debug("create address node: {}", addressNode, serviceAddress); } catch (Exception e) { logger.error("create node failure", e); } } @Override public void process(WatchedEvent event) { if (event.getState() == Event.KeeperState.SyncConnected) { latch.countDown(); } } }
[ "wangxinhan1024@outlook.com" ]
wangxinhan1024@outlook.com
957cb6744d4bd7f13cffc5bc1831d5e5a06d1ade
4bccda1307f6d8eabeebcc194ea04d452555995e
/optaplanner standard/src/main/java/org/optaplanner/examples/thermokingplanning/domain/TaskType.java
e162ca0d6e407ab69613dff8a26945fde63e5009
[]
no_license
MisterHabbini1001/OptaPlanner-Eclipse
35ef278d62fc6ba53b54992a9db57c3541b913f9
e24a1d723882571e400a40eaa6e9834576eabe4a
refs/heads/master
2020-09-21T04:51:44.645559
2020-01-10T09:25:24
2020-01-10T09:25:24
224,680,332
0
0
null
null
null
null
UTF-8
Java
false
false
2,497
java
/* * Copyright 2016 Red Hat, Inc. and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.optaplanner.examples.thermokingplanning.domain; import java.util.ArrayList; import java.util.List; import com.thoughtworks.xstream.annotations.XStreamAlias; import org.optaplanner.examples.common.domain.AbstractPersistable; import org.optaplanner.examples.common.swingui.components.Labeled; @XStreamAlias("TaTaskType") public class TaskType extends AbstractPersistable implements Labeled { private String code; private String title; private int baseDuration; // In minutes private List<Skill> requiredSkillList; public TaskType() { } public TaskType(long id, String code, String title, int baseDuration) { super(id); this.code = code; this.title = title; this.baseDuration = baseDuration; requiredSkillList = new ArrayList<>(); } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public int getBaseDuration() { return baseDuration; } public void setBaseDuration(int baseDuration) { this.baseDuration = baseDuration; } public List<Skill> getRequiredSkillList() { return requiredSkillList; } public void setRequiredSkillList(List<Skill> requiredSkillList) { this.requiredSkillList = requiredSkillList; } // ************************************************************************ // Complex methods // ************************************************************************ @Override public String getLabel() { return title; } @Override public String toString() { return code; } }
[ "0910681@hr.nl" ]
0910681@hr.nl
e98be4dea6ec075ec643f6000fa67cebee661e98
a25098877919d6a0f2fa336f0d146b0b8711f679
/ClickApp/app/src/test/java/com/example/udaymahajan/clickapp/ExampleUnitTest.java
e2da72ec91222e24656c42827c07416199b4ab13
[]
no_license
udaymahajan242/Android-Development
c3af85efc3be909264f3167347142a6dfaac8d63
648742001a81a9406264e574ac43ccfe470bca90
refs/heads/master
2020-12-30T10:24:21.930152
2017-08-01T06:31:09
2017-08-01T06:31:09
98,967,623
0
0
null
null
null
null
UTF-8
Java
false
false
325
java
package com.example.udaymahajan.clickapp; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "udaym242@uw.edu" ]
udaym242@uw.edu
debec76cc57514379662639cf37f564d6885ac2b
e1ece44dc04f6759525b153ea9857054a1543899
/src/Tests/TestGestoraAlmacen.java
719f16c51e12b0717c38491caf0e044af461d9cc
[]
no_license
ManuelCaba/Ejercicio1
345e9c15124d55f8f29238294b422fb97a2cc7b0
25548031154e959da6d840e2ae271e4150fa308f
refs/heads/master
2020-06-02T09:18:07.491261
2019-06-17T11:51:09
2019-06-17T11:51:09
191,111,740
0
0
null
null
null
null
UTF-8
Java
false
false
1,151
java
package Tests; import Enums.EnumPresentacion; import Gestoras.GestoraAlmacen; import Validaciones.Validaciones; import clases.ProductoImpl; public class TestGestoraAlmacen { public static void main(String[] args) { GestoraAlmacen ga = new GestoraAlmacen(); String fichero = ".\\src\\archivos\\Almacen.txt"; String ficheroAux = ".\\src\\archivos\\AlmacenAux.txt"; ProductoImpl producto = new ProductoImpl(); //ga.listarProductosFabricante(fichero, "AsunApruebame"); //ga.listarProductosFabricante(fichero, "Noexiste"); //ga.listarProductosCaducidad(fichero, "14/6/2019"); //ga.listarProductosCaducidad(fichero, "15/6/2019"); //ga.listarProductosCaducidad(fichero, "16/6/2019"); //ga.imprimirPrecioTotal(fichero); //ga.mostrarTotalProductosPresentacion(fichero, EnumPresentacion.C); //ga.mostrarTotalProductosPresentacion(fichero, EnumPresentacion.S); //ga.mostrarTotalProductosPresentacion(fichero, EnumPresentacion.G); //ga.anhadirProducto(producto, fichero); ga.eliminarProducto("123456", fichero, ficheroAux); Validaciones v = new Validaciones(); v.leerYValidarProductoImpl(); } }
[ "emanenxd@gmail.com" ]
emanenxd@gmail.com
880de118c2a4760fbef2628fbcb6346becd3832c
5d9a0e6c96fdb192f3bf38b5c99c9516cc8be5d6
/SisXML/src/br/com/pbti/perfil/dto/SelectorPerfil.java
575f31af075cf09fe7fb6cb3e8e5f99a042902eb
[]
no_license
jansenVieira/pbti
5cd17ff31f18159fa81901010323cfe6375a896b
2cc100d6f4df8eb691597430eb7d8cae9f9fdba5
refs/heads/master
2020-05-16T22:27:57.383921
2016-09-26T20:02:11
2016-09-26T20:02:11
29,472,866
0
0
null
null
null
null
UTF-8
Java
false
false
8,654
java
package br.com.pbti.perfil.dto; import java.util.ArrayList; import java.util.Collection; import java.util.Map; import org.w3c.dom.Element; import br.com.pbti.perfil.principal.XmlConfigPerfil; import br.com.pbti.perfil.xml.MontarXmlPerfil; public class SelectorPerfil { // Objetos private Element selector; private Element montarSelector; private Element identityselector; private Element compoundfilter; private Element compositefilterOr; private Element compositefilterAnd; private Element filter; private Element value; private Element list; private Element tagString; // variaveis dinamincas private String operacaoCompositerAnd = "AND"; private String operacaoCompositerOr = "OR"; public MontarXmlPerfil montarXml = new MontarXmlPerfil(); @SuppressWarnings("static-access") public void montarSelector() { montarSelector = montarXml.getDoc().createElement("Selector"); setSelector(montarSelector); IdentitySelector(); } @SuppressWarnings("static-access") private void IdentitySelector() { identityselector = montarXml.getDoc().createElement("IdentitySelector"); selector.appendChild(identityselector); CompoundFilter(); } @SuppressWarnings("static-access") private void CompoundFilter() { compoundfilter = montarXml.getDoc().createElement("CompoundFilter"); identityselector.appendChild(compoundfilter); CompositeFilter(); } @SuppressWarnings({ "static-access", "unchecked" }) private void CompositeFilter() { ArrayList<Map<String, Object>> listaPerfil = new ArrayList<Map<String, Object>>(); listaPerfil.addAll(XmlConfigPerfil.getArraylistaCodFuncao()); if (listaPerfil == null || listaPerfil.isEmpty()) { System.out.println("Lista Vazia"); } else { compositefilterOr = montarXml.getDoc().createElement( "CompositeFilter"); compositefilterOr.setAttribute("operation", operacaoCompositerOr); compoundfilter.appendChild(compositefilterOr); for (Map<String, Object> listaPerfils : listaPerfil) { compositefilterAnd = montarXml.getDoc().createElement( "CompositeFilter"); compositefilterAnd.setAttribute("operation", operacaoCompositerAnd); compositefilterOr.appendChild(compositefilterAnd); String FUNCAO = "funcao", COD_UNIDADE = "cod_unidade", TIPO_USU = "tipo_usuario", COD_CARGO = "cod_cargo", IND_UNIDADE = "ind_unidade", asteri = "*", lotacaoFisica = "F", lotacaoAdm = "A", funcaoSEM = "SEMF", funcaoCOM = "COMF", LIST_FUNCAO = "cod_funcao", listTipo_unidade = "listTipo_unidade"; ArrayList<Object> arrayTipoUnidade = new ArrayList<Object>(); arrayTipoUnidade .addAll((Collection<? extends Object>) listaPerfils .get(listTipo_unidade)); if (listaPerfils.get(IND_UNIDADE).equals(lotacaoFisica)) { if ((arrayTipoUnidade.size() == 1 && !arrayTipoUnidade.get( 0).equals(asteri)) || (arrayTipoUnidade.size() > 1 && !arrayTipoUnidade .get(0).equals(asteri))) { filter = montarXml.getDoc().createElement("Filter"); filter.setAttribute("operation", "IN"); filter.setAttribute("property", "sg_unde_ltco_fisica"); compositefilterAnd.appendChild(filter); value = montarXml.getDoc().createElement("Value"); filter.appendChild(value); list = montarXml.getDoc().createElement("List"); value.appendChild(list); for (Object tipoUnidade : arrayTipoUnidade) { if (!tipoUnidade.equals(asteri)) { tagString = montarXml.getDoc().createElement( "String"); tagString .appendChild(montarXml.getDoc() .createTextNode( tipoUnidade.toString())); list.appendChild(getString()); } } } } else if (listaPerfils.get(IND_UNIDADE).equals(lotacaoAdm)) { if ((arrayTipoUnidade.size() == 1 && !arrayTipoUnidade.get( 0).equals(asteri)) || (arrayTipoUnidade.size() > 1 && !arrayTipoUnidade .get(0).equals(asteri))) { filter = montarXml.getDoc().createElement("Filter"); filter.setAttribute("operation", "IN"); filter.setAttribute("property", "sg_unde_ltco"); compositefilterAnd.appendChild(filter); value = montarXml.getDoc().createElement("Value"); filter.appendChild(value); list = montarXml.getDoc().createElement("List"); value.appendChild(list); for (Object tipoUnidade : arrayTipoUnidade) { if (!tipoUnidade.equals(asteri)) { tagString = montarXml.getDoc().createElement( "String"); tagString .appendChild(montarXml.getDoc() .createTextNode( tipoUnidade.toString())); list.appendChild(getString()); } } } } else { System.out .println("Dado inconsistente na coluna 9 IND_UNIDADE"); } if (!listaPerfils.get(COD_UNIDADE).equals(asteri)) { if (listaPerfils.get(IND_UNIDADE).equals(lotacaoFisica)) { int intCodUnidade = Integer.parseInt(listaPerfils.get( COD_UNIDADE).toString()); String uni = Integer.toString(intCodUnidade); filter = montarXml.getDoc().createElement("Filter"); filter.setAttribute("operation", "EQ"); filter.setAttribute("property", "nu_unde_ltco_fisica"); filter.setAttribute("value", uni.toString()); compositefilterAnd.appendChild(filter); } else if (listaPerfils.get(IND_UNIDADE).equals(lotacaoAdm)) { int intCodUnidade = Integer.parseInt(listaPerfils.get( COD_UNIDADE).toString()); String uni = Integer.toString(intCodUnidade); filter = montarXml.getDoc().createElement("Filter"); filter.setAttribute("operation", "EQ"); filter.setAttribute("property", "nu_unde_ltco"); filter.setAttribute("value", uni.toString()); compositefilterAnd.appendChild(filter); } else { System.out .println("Dado inconsistente na coluna 9 IND_UNIDADE"); } } if (!listaPerfils.get(TIPO_USU).equals(asteri)) { filter = montarXml.getDoc().createElement("Filter"); filter.setAttribute("operation", "EQ"); filter.setAttribute("property", "tipo_usuario"); filter.setAttribute("value", listaPerfils.get(TIPO_USU) .toString()); compositefilterAnd.appendChild(filter); } if (!listaPerfils.get(COD_CARGO).equals(asteri)) { filter = montarXml.getDoc().createElement("Filter"); filter.setAttribute("operation", "EQ"); filter.setAttribute("property", "co_cargo"); filter.setAttribute("value", listaPerfils.get(COD_CARGO) .toString()); compositefilterAnd.appendChild(filter); } if (!listaPerfils.get(FUNCAO).equals(asteri)) { if (listaPerfils.get(FUNCAO).equals(funcaoCOM)) { filter = montarXml.getDoc().createElement("Filter"); filter.setAttribute("operation", "NOTNULL"); filter.setAttribute("property", "nu_funcao"); compositefilterAnd.appendChild(filter); } if (listaPerfils.get(FUNCAO).equals(funcaoSEM)) { filter = montarXml.getDoc().createElement("Filter"); filter.setAttribute("operation", "ISNULL"); filter.setAttribute("property", "nu_funcao"); compositefilterAnd.appendChild(filter); } } // ArrayList<Object> arrayCodFuncao = new ArrayList<Object>(); // arrayCodFuncao.addAll((Collection<? extends Object>) // listaPerfils // .get(LIST_FUNCAO)); if (!listaPerfils.get(LIST_FUNCAO).equals(asteri)) { int intFunc = Integer.parseInt(listaPerfils .get(LIST_FUNCAO).toString()); String func = Integer.toString(intFunc); filter = montarXml.getDoc().createElement("Filter"); filter.setAttribute("operation", "EQ"); filter.setAttribute("property", "nu_funcao"); filter.setAttribute("value", func); compositefilterAnd.appendChild(filter); } } } } public Element getSelector() { return selector; } public void setSelector(Element selector) { this.selector = selector; } public String getOperacao() { return operacaoCompositerAnd; } public void setOperacao(String operacao) { this.operacaoCompositerAnd = operacao; } public Element getString() { return tagString; } public void setString(Element string) { this.tagString = string; } public Element getCompositefilterAnd() { return compositefilterAnd; } public void setCompositefilterAnd(Element compositefilterAnd) { this.compositefilterAnd = compositefilterAnd; } public String getOperacaoCompositerOr() { return operacaoCompositerOr; } public void setOperacaoCompositerOr(String operacaoCompositerOr) { this.operacaoCompositerOr = operacaoCompositerOr; } }
[ "jansen.vieira@pbti.com.br" ]
jansen.vieira@pbti.com.br
f38bc477e27b0b5d79e8b7ee7d73efde541b2b7b
edd65305aa6f0b2598142c487de99cbf7f62e7ae
/Exam/Java/src/main/java/issuetracker/bindingModel/IssueBindingModel.java
92ed018f81d93cffc2794fae9170a69c9f56da7b
[]
no_license
lyubomirp/BlogsAndCalculators
a1ef2282804a4f4ffb99b5de813e6e828b3d70fb
c49ef4c608b611328b3b6fa6fd40077931f113ea
refs/heads/master
2020-04-22T02:22:06.085406
2019-02-11T01:35:54
2019-02-11T01:35:54
170,046,137
0
0
null
null
null
null
UTF-8
Java
false
false
746
java
package issuetracker.bindingModel; import javax.validation.constraints.NotNull; public class IssueBindingModel { @NotNull public String title; @NotNull public String content; @NotNull public Integer priority; @NotNull public String getTitle() { return title; } public void setTitle(@NotNull String title) { this.title = title; } @NotNull public String getContent() { return content; } public void setContent(@NotNull String content) { this.content = content; } @NotNull public Integer getPriority() { return priority; } public void setPriority(@NotNull Integer priority) { this.priority = priority; } }
[ "lpetkov44@yahoo.com" ]
lpetkov44@yahoo.com
03554abb8d3b1c9b5239f3b5f4358ed9467f4006
a770e95028afb71f3b161d43648c347642819740
/sources/org/telegram/ui/ProfileActivity$$ExternalSyntheticLambda21.java
18a64de3abf4440bc33f5b49bf7386fe79d05fe4
[]
no_license
Edicksonjga/TGDecompiledBeta
d7aa48a2b39bbaefd4752299620ff7b72b515c83
d1db6a445d5bed43c1dc8213fb8dbefd96f6c51b
refs/heads/master
2023-08-25T04:12:15.592281
2021-10-28T20:24:07
2021-10-28T20:24:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
997
java
package org.telegram.ui; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC$TL_channels_getParticipants; import org.telegram.tgnet.TLRPC$TL_error; public final /* synthetic */ class ProfileActivity$$ExternalSyntheticLambda21 implements Runnable { public final /* synthetic */ ProfileActivity f$0; public final /* synthetic */ TLRPC$TL_error f$1; public final /* synthetic */ TLObject f$2; public final /* synthetic */ TLRPC$TL_channels_getParticipants f$3; public /* synthetic */ ProfileActivity$$ExternalSyntheticLambda21(ProfileActivity profileActivity, TLRPC$TL_error tLRPC$TL_error, TLObject tLObject, TLRPC$TL_channels_getParticipants tLRPC$TL_channels_getParticipants) { this.f$0 = profileActivity; this.f$1 = tLRPC$TL_error; this.f$2 = tLObject; this.f$3 = tLRPC$TL_channels_getParticipants; } public final void run() { this.f$0.lambda$getChannelParticipants$22(this.f$1, this.f$2, this.f$3); } }
[ "fabian_pastor@msn.com" ]
fabian_pastor@msn.com
95726b7c88e17f6c697fe020b5d13c13aab8b793
3e1eedc4977eef4fe849b90d7ae1524faa9ac56d
/Spinner/app/src/main/java/np/cnblabs/spinner/MainActivity.java
5027614078d704f8b1ff9e06848b3c9a60027e19
[]
no_license
sanjogshrestha/AndroidSeries
2fda755e78076d88703ed3e2dca2dc15ae885038
29209327b75176b55d7ca0e0f3f3b09a5dc75c4d
refs/heads/master
2021-09-08T01:37:12.578220
2018-03-05T10:23:10
2018-03-05T10:23:10
110,810,694
6
0
null
null
null
null
UTF-8
Java
false
false
620
java
package np.cnblabs.spinner; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void fromXML(View view) { startActivity(new Intent(this, SpinnerXMLActivity.class)); } public void fromArrayAdapter(View view) { startActivity(new Intent(this, SpinnerArrayAdapter.class)); } }
[ "Sanjogshrestha.nepal@gmail.com" ]
Sanjogshrestha.nepal@gmail.com
bfedc18e2b1ddfc68a0f51ec96638bbfac73a167
81d13226f82cc695ae056e57217eda27e6ef56cf
/my-akka-http-project/src/test/java/pingali/jeevan/UserRoutesTest.java
842bbc9f5af74ebb58187e13f3ce188bcaa56d61
[]
no_license
jeevanpingali/learning
29c98340baf3cd8504f30c2c6cc2a729e381c036
1167e5c0e0beb41c4bfe078243dedad4ebe09a25
refs/heads/master
2021-06-02T00:13:52.263816
2020-07-09T05:40:55
2020-07-09T05:40:55
3,451,637
0
0
null
null
null
null
UTF-8
Java
false
false
1,932
java
package pingali.jeevan; //#test-top import akka.actor.ActorRef; import akka.actor.ActorSystem; import akka.http.javadsl.model.*; import akka.http.javadsl.testkit.JUnitRouteTest; import akka.http.javadsl.testkit.TestRoute; import org.junit.Before; import org.junit.Test; import akka.http.javadsl.model.HttpRequest; import akka.http.javadsl.model.StatusCodes; //#set-up public class UserRoutesTest extends JUnitRouteTest { //#test-top private TestRoute appRoute; @Before public void initClass() { ActorSystem system = ActorSystem.create("helloAkkaHttpServer"); ActorRef userRegistryActor = system.actorOf(UserRegistryActor.props(), "userRegistryActor"); QuickstartServer server = new QuickstartServer(system, userRegistryActor); appRoute = testRoute(server.createRoute()); } //#set-up //#actual-test @Test public void testNoUsers() { appRoute.run(HttpRequest.GET("/users")) .assertStatusCode(StatusCodes.OK) .assertMediaType("application/json") .assertEntity("{\"users\":[]}"); } //#actual-test //#testing-post @Test public void testHandlePOST() { appRoute.run(HttpRequest.POST("/users") .withEntity(MediaTypes.APPLICATION_JSON.toContentType(), "{\"name\": \"Kapi\", \"age\": 42, \"countryOfResidence\": \"jp\"}")) .assertStatusCode(StatusCodes.CREATED) .assertMediaType("application/json") .assertEntity("{\"description\":\"User Kapi created.\"}"); } //#testing-post @Test public void testRemove() { appRoute.run(HttpRequest.DELETE("/users/Kapi")) .assertStatusCode(StatusCodes.OK) .assertMediaType("application/json") .assertEntity("{\"description\":\"User Kapi deleted.\"}"); } //#set-up } //#set-up
[ "jeevan.pingali@gmail.com" ]
jeevan.pingali@gmail.com
8a5e9565401fd5fdef5dac7fdb2930c0b59e54cd
3d0e6b5cb9af0770710fc47c773128f016b5929b
/src/test/java/hackzurich/HackzurichServerApplicationTests.java
ead3259fc3643a2fb7d93343080aa4fb48db322f
[]
no_license
radoslaw-jarzynka/hackzurichServer
6542a87b005d419d5ee9406aa6dd0dd6a3ca3906
8461bad19f0a24a8464e41a39cda0b3f6370fe73
refs/heads/master
2022-01-28T09:31:25.769741
2016-09-17T21:23:29
2016-09-17T21:23:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
337
java
package hackzurich; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class HackzurichServerApplicationTests { @Test public void contextLoads() { } }
[ "radoslaw.jarzynka@gmail.com" ]
radoslaw.jarzynka@gmail.com
3d07b5e3745fc87eeba46ef768e6d0b9323b6b1e
a13bcc186f507987d75cc318196766a36a3f5ab9
/client/Voluntinder/app/src/main/java/edu/upc/carlota/hacks/voluntinder/Presentation/NotificationsFragment.java
0cffec4b428fd1c9c38d1899f205b06966497bd2
[]
no_license
paualos3/voluntinder-server
6edd7531e1d2b72fdfb61f22a6c7fa87ad60b820
8a0259e7fb0c7e73b5d2d0791d34e4deed31ea15
refs/heads/master
2021-04-09T13:43:12.393073
2018-03-18T07:10:35
2018-03-18T07:10:35
125,614,277
0
0
null
null
null
null
UTF-8
Java
false
false
582
java
package edu.upc.carlota.hacks.voluntinder.Presentation; import android.support.v4.app.Fragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import edu.upc.carlota.hacks.voluntinder.R; public class NotificationsFragment extends Fragment{ @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_notifications, null); } }
[ "carkbra@gmail.com" ]
carkbra@gmail.com
0d7e77465665ea5a3c28f3e7d621bd484f5a6bc3
233cb33e0f95f6b8d742e5061d5a822d8efc0bd0
/src/main/java/com/example/domain/Article.java
ff25c5aeafa5b0a2c082978afaebb1401ab01c0a
[]
no_license
sooyoung32/hack-korea
d45c19b269efaf8c0c90c67d0db1947c1d236a4a
9dc60ede1db052621857c14c8c5a674b4da2dbf2
refs/heads/master
2021-01-10T03:40:10.863528
2015-12-18T08:43:01
2015-12-18T08:43:01
48,223,912
0
0
null
null
null
null
UTF-8
Java
false
false
913
java
package com.example.domain; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import lombok.Getter; import lombok.Setter; @Getter @Setter @Entity(name = "TB_ARTICLE") public class Article { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id", nullable = false, updatable = false) private Long internalId; @ManyToOne @JoinColumn(name = "user_id", nullable = false, updatable = true) private User user; private String title; @Column(columnDefinition = "LONGTEXT") private String content; private Boolean deleted; private Long hitCount; private Date createDate; private Date modifyDate; }
[ "sooyoung32@gmail.com" ]
sooyoung32@gmail.com
b09dffc08e3a5fcbac69b72d670d919e2594e194
fa5dfff1ba3af7aa71181a5283eee954e99d7f73
/src/main/java/org/dreamwork/ui/concurrent/IMessageHandler.java
d8809850609ab273a9e79093bc001c7850124e0a
[ "MIT" ]
permissive
seth-yang/dreamwork-base
26de5acf1588edef10f45956d81011167338975e
31162a40912f95042364a272f3fb83a3681f82b3
refs/heads/master
2022-10-03T13:30:00.415164
2020-02-27T03:40:52
2020-02-27T03:40:52
243,729,195
0
0
MIT
2022-09-22T19:05:42
2020-02-28T09:50:06
Java
UTF-8
Java
false
false
211
java
package org.dreamwork.ui.concurrent; /** * Created by seth.yang on 2016/10/11 */ public interface IMessageHandler { void handleUIMessage (Message message); void handleNonUIMessage (Message message); }
[ "seth_yang@126.com" ]
seth_yang@126.com
b4263b80ca8418781a0e7fe8a893b66f3c1029d7
ce20d1aef5d1c04e1ea2cfbf4086675d49d887d7
/src/ru/vsu/cs/course1/graph/demo/GraphvizExamples.java
a6712ba3ef2949cac398444a9ba86701d16de91a
[]
no_license
PlaksinaKate/7.11task
4dfbfb0ac0fcef705c1ccaca183d42526ae88b64
1ed94a9ad75bd6df07e9e25ae05fe73e3d7c3f15
refs/heads/master
2022-11-08T14:06:50.510774
2020-07-02T14:29:32
2020-07-02T14:29:32
276,650,561
0
0
null
null
null
null
UTF-8
Java
false
false
6,897
java
package ru.vsu.cs.course1.graph.demo; import guru.nidi.graphviz.attribute.*; import guru.nidi.graphviz.engine.Format; import guru.nidi.graphviz.engine.Graphviz; import guru.nidi.graphviz.model.Graph; import guru.nidi.graphviz.model.MutableGraph; import guru.nidi.graphviz.model.Node; import guru.nidi.graphviz.parse.Parser; import java.io.File; import java.io.IOException; import static guru.nidi.graphviz.attribute.Label.Justification.LEFT; import static guru.nidi.graphviz.attribute.Records.rec; import static guru.nidi.graphviz.attribute.Records.turn; import static guru.nidi.graphviz.model.Compass.*; import static guru.nidi.graphviz.model.Factory.*; /** * Примеры из описания graphviz-java: * https://github.com/nidi3/graphviz-java */ public class GraphvizExamples { public static String ex1() { Graph g = graph("example1").directed() .graphAttr().with(Rank.dir(Rank.RankDir.LEFT_TO_RIGHT)) .with( node("a").with(Color.RED).link(node("b")), node("b").link(to(node("c")).with(Style.DASHED)) ); Graphviz gv = Graphviz.fromGraph(g).height(100); try { gv.render(Format.PNG).toFile(new File("./files/output/ex1.png")); gv.render(Format.SVG).toFile(new File("./files/output/ex1.svg")); } catch (Exception ignored) { } return gv.render(Format.SVG).toString(); } public static String ex1m() { MutableGraph g = mutGraph("example1").setDirected(true).add( mutNode("a").add(Color.RED).addLink(mutNode("b"))); Graphviz gv = Graphviz.fromGraph(g).width(200); try { gv.render(Format.PNG).toFile(new File("./files/output/ex1m.png")); gv.render(Format.SVG).toFile(new File("./files/output/ex1m.svg")); } catch (Exception ignored) { } return gv.render(Format.SVG).toString(); } public static String ex1i() { MutableGraph g = mutGraph("example1").setDirected(true).use((gr, ctx) -> { mutNode("b"); nodeAttrs().add(Color.RED); mutNode("a").addLink(mutNode("b")); }); Graphviz gv = Graphviz.fromGraph(g).width(200); try { gv.render(Format.PNG).toFile(new File("./files/output/ex1.png")); gv.render(Format.SVG).toFile(new File("./files/output/ex1.svg")); } catch (Exception ignored) { } return gv.render(Format.SVG).toString(); } public static String ex2() { Node main = node("main").with(Label.html("<b>main</b><br/>start"), Color.rgb("1020d0").font()), init = node(Label.markdown("**_init_**")), execute = node("execute"), compare = node("compare").with(Shape.RECTANGLE, Style.FILLED, Color.hsv(.7, .3, 1.0)), mkString = node("mkString").with(Label.lines(LEFT, "make", "a", "multi-line")), printf = node("printf"); Graph g = graph("example2").directed().with( main.link( to(node("parse").link(execute)).with(LinkAttr.weight(8)), to(init).with(Style.DOTTED), node("cleanup"), to(printf).with(Style.BOLD, Label.of("100 times"), Color.RED)), execute.link( graph().with(mkString, printf), to(compare).with(Color.RED)), init.link(mkString) ); Graphviz gv = Graphviz.fromGraph(g).width(900); try { gv.render(Format.PNG).toFile(new File("./files/output/ex2.png")); gv.render(Format.SVG).toFile(new File("./files/output/ex2.svg")); } catch (Exception ignored) { } return gv.render(Format.SVG).toString(); } public static String ex3() { Node node0 = node("node0").with(Records.of(rec("f0", ""), rec("f1", ""), rec("f2", ""), rec("f3", ""), rec("f4", ""))), node1 = node("node1").with(Records.of(turn(rec("n4"), rec("v", "719"), rec("")))), node2 = node("node2").with(Records.of(turn(rec("a1"), rec("805"), rec("p", "")))), node3 = node("node3").with(Records.of(turn(rec("i9"), rec("718"), rec("")))), node4 = node("node4").with(Records.of(turn(rec("e5"), rec("989"), rec("p", "")))), node5 = node("node5").with(Records.of(turn(rec("t2"), rec("v", "959"), rec("")))), node6 = node("node6").with(Records.of(turn(rec("o1"), rec("794"), rec("")))), node7 = node("node7").with(Records.of(turn(rec("s7"), rec("659"), rec("")))); Graph g = graph("example3").directed() .graphAttr().with(Rank.dir(Rank.RankDir.LEFT_TO_RIGHT)) .with( node0.link( between(port("f0"), node1.port("v", SOUTH)), between(port("f1"), node2.port(WEST)), between(port("f2"), node3.port(WEST)), between(port("f3"), node4.port(WEST)), between(port("f4"), node5.port("v", NORTH)) ), node2.link(between(port("p"), node6.port(NORTH_WEST))), node4.link(between(port("p"), node7.port(SOUTH_WEST))) ); Graphviz gv = Graphviz.fromGraph(g).width(900); try { gv.render(Format.PNG).toFile(new File("./files/output/ex3.png")); gv.render(Format.SVG).toFile(new File("./files/output/ex3.svg")); } catch (Exception ignored) { } return gv.render(Format.SVG).toString(); } public static String ex4() throws IOException { MutableGraph g = new Parser().read(new File("./files/input/color.dot")); Graphviz gv1 = Graphviz.fromGraph(g).width(700); try { gv1.render(Format.PNG).toFile(new File("./files/output/ex4.1.png")); gv1.render(Format.SVG).toFile(new File("./files/output/ex4.1.svg")); } catch (Exception ignored) { } g.graphAttrs() .add(Color.WHITE.gradient(Color.rgb("888888")).background().angle(90)) .nodeAttrs().add(Color.WHITE.fill()) .nodes().forEach(node -> node.add( Color.named(node.name().toString()), Style.lineWidth(4).and(Style.FILLED))); Graphviz gv2 = Graphviz.fromGraph(g).width(700); try { gv2.render(Format.PNG).toFile(new File("./files/output/ex4.2.png")); gv2.render(Format.SVG).toFile(new File("./files/output/ex4.2.svg")); } catch (Exception ignored) { } return gv2.render(Format.SVG).toString(); } }
[ "plaksina.larisa@yandex.ru" ]
plaksina.larisa@yandex.ru
3b20705936a991349b598bfeae5d58ddbd9ae23c
08f785ae118a71631ad52326a3ac9fe25d0051cd
/javaActivity33B/DoubleQueueExampleClass.java
574e8ef1306346f0a5234608caa1ab211d38a3b7
[]
no_license
Jag46/SDET_Java_Activities
78e4ea8fa1ae3e515cce62276b8f0e197f7915b1
e4d812dbb2da1daf957b862fc41d5b14f954f00a
refs/heads/master
2022-11-14T06:46:25.511560
2020-07-14T16:11:30
2020-07-14T16:11:30
278,261,618
0
0
null
null
null
null
UTF-8
Java
false
false
1,209
java
package javaActivity33B; import java.util.*; public class DoubleQueueExampleClass { public static void main(String[] args) { // TODO Auto-generated method stub //creating double queue Deque<String> dqueue = new LinkedList<String>(); dqueue.add("dhoni"); dqueue.addFirst("Ganguly"); dqueue.addLast("Sachin"); dqueue.offer("Yuvi"); dqueue.offerFirst("Kaif"); dqueue.offerLast("Rohit"); //Iterate through the queue elements. Iterator<String> iterator = dqueue.iterator(); while (iterator.hasNext()) { System.out.println(iterator.next()); } System.out.println("Peek first: " + dqueue.peekFirst()); System.out.println("Peek Last: " + dqueue.peekLast()); //Search for element System.out.println("is Wolf present in the Dqueue: " + dqueue.contains("Wolf")); //Remove the first and last element dqueue.removeFirst(); dqueue.removeLast(); System.out.println("Removing first and last elements: " + dqueue); System.out.println("Size of deque: " + dqueue.size()); } }
[ "noreply@github.com" ]
Jag46.noreply@github.com
893c1f75dd8ed6b6be199d76d0e785def55a64eb
b01225458492d08c35f31983b2dd0beb79989a29
/heima102-5_health/health_pojo/src/main/java/com/itheima/health/entity/QueryPageBean.java
d0fa21c4070ac3fd1688f7dffef2b15ef6ed61bd
[]
no_license
wsx-max/czhealth
583e95891da62f2e6964c9931d16606045110695
15515d02c8511b2777569870d60ad274ec8d690f
refs/heads/master
2023-01-12T09:34:07.153383
2020-11-07T13:08:17
2020-11-07T13:08:17
306,566,478
0
0
null
null
null
null
UTF-8
Java
false
false
418
java
package com.itheima.health.entity; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; /** * 封装查询条件 */ @Data @AllArgsConstructor @NoArgsConstructor public class QueryPageBean implements Serializable { private Integer currentPage;//页码 private Integer pageSize;//每页记录数 private String queryString;//查询条件 }
[ "319407133@qq.com" ]
319407133@qq.com
0714617f6ffddb5412c7c6c0af99c032f9e54160
afb5ab0a46bbe75909d5067425401897154827b0
/src/com/tiendaOnline/dao/GenericDao.java
74aa608584578b760ca6114d3956b05c4e1e5f81
[]
no_license
GDanielAvram/tiendaOnline
7d40ae94756fb0162b2dfc80fdbe97fc43ba4cc8
073c7d049c0a9c2b325fdae941591f25a7a725c0
refs/heads/master
2022-12-22T16:32:34.786554
2020-06-16T15:57:40
2020-06-16T15:57:40
248,483,886
0
0
null
null
null
null
UTF-8
Java
false
false
232
java
package com.tiendaOnline.dao; import java.util.Map; public interface GenericDao<T> { long countAll(Map<String, Object> params); T create(T t); void delete(Object id); T find(Object id); T update(T t); }
[ "49310003+GDanielAvram@users.noreply.github.com" ]
49310003+GDanielAvram@users.noreply.github.com
f3cd362d6d6f3abae86406bf72bf2f94ba878379
96f0e7766522cd45d4483803b4ae34de25b50da6
/src/ac/bootcamp/row1game/menu/Button.java
e9ec9ff28debc62bc5cf16ffbff8ec215f417cd0
[]
no_license
edgar-dias/anorocs-den
d7c62b7a078150753c4ebe675b39342dfe778a22
8ec588d3024492671e4923a0ae3b7b5723b9e3af
refs/heads/master
2022-12-04T02:56:59.837412
2020-08-22T14:11:06
2020-08-22T14:11:06
289,499,803
0
1
null
null
null
null
UTF-8
Java
false
false
1,338
java
package ac.bootcamp.row1game.menu; import org.academiadecodigo.simplegraphics.keyboard.Keyboard; import org.academiadecodigo.simplegraphics.keyboard.KeyboardEvent; import org.academiadecodigo.simplegraphics.keyboard.KeyboardHandler; import org.academiadecodigo.simplegraphics.mouse.MouseEvent; import org.academiadecodigo.simplegraphics.mouse.MouseHandler; public abstract class Button extends Actor implements MouseHandler, KeyboardHandler { public Button(double x, double y, String source) { super(x, y, source); } @Override public void mouseClicked(MouseEvent mouseEvent) { if(mouseEventIsWithinBounds(mouseEvent)) { processMouseClicked(mouseEvent); } } public void processMouseClicked(MouseEvent mouseEvent) { } private boolean mouseEventIsWithinBounds(MouseEvent mouseEvent) { if(mouseEvent.getX() >= getX() && mouseEvent.getX() <= getX() + getWidth()) { if(mouseEvent.getY() >= getY() && mouseEvent.getY() <= getY() + getHeight()) { return true; } } return false; } @Override public void mouseMoved(MouseEvent mouseEvent) { } @Override public void keyPressed(KeyboardEvent keyboardEvent) { processMouseClicked(null); } @Override public void keyReleased(KeyboardEvent keyboardEvent) { } public abstract int getKey(); }
[ "andreia.codesarmento@gmail.com" ]
andreia.codesarmento@gmail.com
f4c46cdcc69be681fe03dbbf01c50abffc7ad74f
34b0b295cfe90196648f2c14a3fa1320698eda9f
/framework-web/src/main/java/top/lshaci/framework/web/exception/handler/GlobalExceptionHandler.java
c48c25d2455585ccdb025d796c73369551f397f2
[]
no_license
GacYize/framework
23bb3bf842282f46ef0df4413ae8a944d4fd8f99
11ab7877ea91f7baf1e95cd2771e4450a72e0836
refs/heads/master
2022-11-25T12:35:36.199919
2020-06-30T06:45:41
2020-06-30T06:45:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,119
java
package top.lshaci.framework.web.exception.handler; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.BindException; import org.springframework.validation.FieldError; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestController; import top.lshaci.framework.common.exception.BaseException; import top.lshaci.framework.common.model.JsonResponse; import top.lshaci.framework.web.model.ExceptionMessage; import top.lshaci.framework.web.utils.GlobalExceptionUtils; /** * Global exception handler<br><br> * * <b>0.0.4: </b>Add method argumentExceptionHandler<br> * <b>1.0.4: </b>使用GlobalExceptionUtils来获取自定义的异常消息 * * @author lshaci * @since 0.0.3 * @version 1.0.4 */ @Slf4j @RestController @ControllerAdvice public class GlobalExceptionHandler { /** * System exception log message */ private static final String SYSTEM_EXCEPTION = "System anomaly!"; /** * Argument exception log message */ private final static String FIELD = "字段:"; /** * Base exception handler * * @param e the exception * @return json response */ @ExceptionHandler(BaseException.class) public JsonResponse<Object> baseExceptionHandler(BaseException e) { return JsonResponse .failure(e.getMessage()) .setCode(e.getCode()); } /** * BindException and MethodArgumentNotValidException handler * * @param e the exception * @return json response */ @ExceptionHandler(value = { BindException.class, MethodArgumentNotValidException.class }) public JsonResponse<Object> argumentExceptionHandler(Exception e) { log.error(SYSTEM_EXCEPTION, e); StringBuilder message = new StringBuilder(); FieldError fieldError = null; if (e instanceof BindException) { BindException bindException = (BindException) e; fieldError = bindException.getBindingResult().getFieldErrors().get(0); } else if (e instanceof MethodArgumentNotValidException) { MethodArgumentNotValidException argumentNotValidException = (MethodArgumentNotValidException) e; fieldError = argumentNotValidException.getBindingResult().getFieldErrors().get(0); } if (fieldError != null) { String field = fieldError.getField(); log.warn(FIELD + field); String msg = fieldError.getDefaultMessage(); message.append(msg); } return JsonResponse.failure(message.toString()); } /** * Default exception handler * * @param e the exception * @return json response */ @ExceptionHandler(Exception.class) public JsonResponse<Object> defaultExceptionHandler(Exception e) { log.error(SYSTEM_EXCEPTION, e); ExceptionMessage message = GlobalExceptionUtils.get(e.getClass()); return JsonResponse .failure(message.getMessage()) .setCode(message.getCode()); } }
[ "lshaci@qq.com" ]
lshaci@qq.com
653ce367ff256ab0216cf751abda0e28b3b448e8
9dd27d85f7214afdd568a9c4e9100083d7eef8a0
/src/main/java/net/jasonhk/minecraft/mods/torvaldsinput/core/utilities/LwjglVersion.java
c65ab9a1892288bf60ceaa228d70c9a7dd267d6a
[]
no_license
JasonHK-Minecraft/TorvaldsInput
245d264e6399f6cc600d7f3938e359d331856acb
9bd4cf50bc7701fb62f4ec9bfac089e503efa4bd
refs/heads/master
2022-12-12T03:33:27.639841
2020-09-07T14:37:30
2020-09-07T14:37:30
280,619,881
4
0
null
null
null
null
UTF-8
Java
false
false
594
java
//#if MINECRAFT>=11300 package net.jasonhk.minecraft.mods.torvaldsinput.core.utilities; import static org.lwjgl.Version.VERSION_MAJOR; import static org.lwjgl.Version.VERSION_MINOR; import static org.lwjgl.Version.VERSION_REVISION; import lombok.experimental.UtilityClass; import com.github.zafarkhaja.semver.Version; @UtilityClass public class LwjglVersion { public final int MAJOR = VERSION_MAJOR; public final int MINOR = VERSION_MINOR; public final int REVISION = VERSION_REVISION; public final Version VERSION = Version.forIntegers(MAJOR, MINOR, REVISION); } //#endif
[ "JasonHK@users.noreply.github.com" ]
JasonHK@users.noreply.github.com
3cb942702fb80798cc4fc1ba969406703a432021
bb958ca2244e47d2cfd70059ace83961db18d38a
/cws-war/src/main/java/edu/ucsd/crbs/cws/workflow/kepler/RectangleAttribute.java
adc2f87a692db6af24306ee463ed3c1089ab36c0
[]
no_license
CRBS/cws
a945c74af5293bc2359b65b2418ac8b2a588872d
a839f99b1338055ac90c69943f8141d73b2bcffe
refs/heads/master
2021-01-09T07:59:21.141935
2015-12-08T22:40:22
2015-12-08T22:40:22
19,551,382
0
0
null
null
null
null
UTF-8
Java
false
false
6,385
java
/* * COPYRIGHT AND LICENSE * * Copyright 2014 The Regents of the University of California All Rights Reserved * * Permission to copy, modify and distribute any part of this CRBS Workflow * Service for educational, research and non-profit purposes, without fee, and * without a written agreement is hereby granted, provided that the above * copyright notice, this paragraph and the following three paragraphs appear * in all copies. * * Those desiring to incorporate this CRBS Workflow Service into commercial * products or use for commercial purposes should contact the Technology * Transfer Office, University of California, San Diego, 9500 Gilman Drive, * Mail Code 0910, La Jolla, CA 92093-0910, Ph: (858) 534-5815, * FAX: (858) 534-7345, E-MAIL:invent@ucsd.edu. * * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING * LOST PROFITS, ARISING OUT OF THE USE OF THIS CRBS Workflow Service, EVEN IF * THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. * * THE CRBS Workflow Service PROVIDED HEREIN IS ON AN "AS IS" BASIS, AND THE * UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, * UPDATES, ENHANCEMENTS, OR MODIFICATIONS. THE UNIVERSITY OF CALIFORNIA MAKES * NO REPRESENTATIONS AND EXTENDS NO WARRANTIES OF ANY KIND, EITHER IMPLIED OR * EXPRESS, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, OR THAT THE USE OF * THE CRBS Workflow Service WILL NOT INFRINGE ANY PATENT, TRADEMARK OR OTHER * RIGHTS. */ package edu.ucsd.crbs.cws.workflow.kepler; import java.util.ArrayList; import java.util.List; /** * Represents a Rectangle in a Kepler 2.4 workflow * * @author Christopher Churas <churas@ncmir.ucsd.edu> */ public class RectangleAttribute extends Attribute { private List<TextAttribute> _intersectingTextAttributes; private List<ParameterAttribute> _intersectingParameterAttributes; private double _width; private double _height; public RectangleAttribute(){ super(); } public double getWidth() { return _width; } public void setWidth(double width) { _width = width; } public double getHeight() { return _height; } public void setHeight(double height) { _height = height; } public boolean addTextAttributeIfIntersecting(TextAttribute attrib){ if (isItOkayToAddAttribute(attrib) == false){ return false; } if (_intersectingTextAttributes == null){ _intersectingTextAttributes = new ArrayList<>(); } _intersectingTextAttributes.add(attrib); return true; } public List<TextAttribute> getIntersectingTextAttributes() { return _intersectingTextAttributes; } private boolean isItOkayToAddAttribute(Attribute attribute){ if (attribute == null){ return false; } if (doesIntersect(attribute) == false){ return false; } return true; } public boolean addParameterAttributeIfIntersecting(ParameterAttribute attrib){ if (isItOkayToAddAttribute(attrib) == false){ return false; } if (_intersectingParameterAttributes == null){ _intersectingParameterAttributes = new ArrayList<>(); } _intersectingParameterAttributes.add(attrib); return true; } public List<ParameterAttribute> getIntersectingParameterAttributes() { return _intersectingParameterAttributes; } /** * Checks if the <b>attrib</b> passed in is located within the rectangle of * this object. The code assumes the coordinates are based on the upper left * corner and not centered. * @param attrib Attribute whose coordinates are extracted and compared to this object * @return true if the <b>attrib</b> lies within the bounds of this object's location false otherwise */ public boolean doesIntersect(Attribute attrib){ if (attrib == null){ return false; } //fail if coordinate is above or to left of upper left corner of rectangle if (attrib.getXCoordinate() < _xCoordinate || attrib.getYCoordinate() < _yCoordinate){ return false; } // fail if coordinate is below or to right of lower right corner of rectangle if (attrib.getXCoordinate() > _xCoordinate + _width || attrib.getYCoordinate() > _yCoordinate + _height){ return false; } return true; } public String getTextFromTextAttributes(){ if (_intersectingTextAttributes == null || _intersectingTextAttributes.isEmpty()){ return null; } StringBuilder sb = new StringBuilder(); for (TextAttribute ta : _intersectingTextAttributes){ if (sb.length() > 0){ sb.append("\n"); } if (ta.getText() != null){ sb.append(ta.getText()); } } return sb.toString(); } /** * * @return */ @Override public String asString(){ StringBuilder sb = new StringBuilder(); sb.append(super.asString()); sb.append(",width=").append(Double.toString(_width)); sb.append(",height=").append(Double.toString(_height)); sb.append(",numtextattributes="); if (_intersectingTextAttributes == null || _intersectingTextAttributes.isEmpty()){ sb.append("0"); } else { sb.append(_intersectingTextAttributes.size()); } sb.append(",numparameterattributes="); if (_intersectingParameterAttributes == null || _intersectingParameterAttributes.isEmpty()){ sb.append("0"); } else { sb.append(_intersectingParameterAttributes.size()); } return sb.toString(); } public void moveCoordinatesToUpperLeftCornerFromCenter(){ _xCoordinate -= (_width/2); _yCoordinate -= (_height/2); } }
[ "churas@gmail.com" ]
churas@gmail.com
adcc6f97e8a9642826903d9718a67659575a07fe
6658253985268e4c696fc2b6a7f20a8137fc2815
/Authorization/target/tmp/jsp/org/apache/jsp/setPremium_jsp.java
8c9f4b7bbeba828b1381754d33f63c765126681a
[]
no_license
dominik-stec/Atomic_Java_3_PJA
fbaee754e25935ba9f5f86201c4dcb6a06635211
375f1f55953c500844f0ab4a1b835c8f6d123b24
refs/heads/master
2023-08-24T17:59:50.401190
2021-09-28T16:02:02
2021-09-28T16:02:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,855
java
package org.apache.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public final class setPremium_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory(); private static java.util.Vector _jspx_dependants; private org.glassfish.jsp.api.ResourceInjector _jspx_resourceInjector; public Object getDependants() { return _jspx_dependants; } public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { response.setContentType("text/html; charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; _jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector"); out.write("\n"); out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n"); out.write("<html>\n"); out.write("<head>\n"); out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n"); out.write("<title>Formularz rejestracji użytkownika Premium</title>\n"); out.write("</head>\n"); out.write("<body>\n"); out.write("<h1>Strona administratora<br />Formularz rejestracyjny użytkownika Premium</h1>\n"); out.write("<br /><br />\n"); out.write("<form action=\"addPremium\" method=\"post\">\n"); out.write("\t<label>Nazwa użytkownika: &nbsp <input type=\"text\" id=\"userPremium\" name=\"userPremium\" /></label><br />\n"); out.write("\t<label><input type=\"submit\" value=\"zarejestruj\" /></label><br />\n"); out.write("</form>\n"); out.write("</body>\n"); out.write("</html>"); } catch (Throwable t) { if (!(t instanceof SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } }
[ "dccstcc@gmail.com" ]
dccstcc@gmail.com
d1bf8f9a529765cc211ffcd21b1a8459b5185c1e
1a37bf939e36e095759986b24b1eeb36b566aa2f
/src/main/java/co/igb/b1ws/client/stocktransfer/RemoveResponse.java
8edd8e43dbacd628790938cf1002c498866aaa10
[]
no_license
dboterov/igb-java
109aec769f092d1522f86fbb5a5aaefc3df409ef
0d8d533e4067e24527fa5426e2b0a3b06c24beb2
refs/heads/master
2021-06-04T13:13:13.933979
2020-10-05T21:31:24
2020-10-05T21:31:24
113,262,134
0
3
null
null
null
null
UTF-8
Java
false
false
796
java
package co.igb.b1ws.client.stocktransfer; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Clase Java para anonymous complex type. * * <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "") @XmlRootElement(name = "RemoveResponse") public class RemoveResponse { }
[ "dbotero@matisses.co" ]
dbotero@matisses.co
1e702aecf1699a6b403877b33754605842f858af
a55dcdccde52dd2bcac21c11cfb21f9f56ff7034
/src/com/picktr/example/helpers/BounceOption.java
8ecd09ca07cc1cb0136670d511bb40b248d0e749
[]
no_license
benstopford/bounceAndroid
0aab7663ef5444eee2c738759f105b20d8209821
2950c59c8a9b9ad8de6c36642fcf0aff612c9963
refs/heads/master
2021-01-18T11:47:22.421419
2014-03-07T02:08:39
2014-03-07T02:08:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,427
java
package com.picktr.example.helpers; public class BounceOption { // private variables private long id; private long bounce_db_id; private int optionNumber; private int type; private byte[] image; private String url; private String title; // Empty constructor public BounceOption() { } // constructor public BounceOption(long id, long bounceID, int optionNumber, int type, String title, byte[] image, String url) { this.id = id; this.bounce_db_id = bounceID; this.optionNumber = optionNumber; this.type = type; this.title = title; this.image = image; this.url = url; } public void setID(long id) { this.id = id; } public long getID() { return this.id; } public void setBounceID(long bounceID) { this.bounce_db_id = bounceID; } public long getBounceID() { return this.bounce_db_id; } public void setOptionNumber(int optionNumber) { this.optionNumber = optionNumber; } public int getOptionNumber() { return this.optionNumber; } public void setType(int type) { this.type = type; } public int getType() { return type; } public void setTitle(String title) { this.title = title; } public String getTitle() { return title; } public void setImage(byte[] image) { this.image = image; } public byte[] getImage() { return this.image; } public void setUrl(String url) { this.url = url; } public String getUrl() { return this.url; } }
[ "bahakz@gmail.com" ]
bahakz@gmail.com
02ede74a7a6e785c26edd247ebc84159132d9a0e
452b3a785105ea7d2d72dbc2ee2189c5781bdee7
/account-persist/src/main/java/com/juvenxu/mvnbook/account/persist/AccountPersistServiceImpl.java
75628487429c7b7d17b1dcfdbbc5d76e5541cd73
[]
no_license
lurker8/maven-test
8a0cd1ccef28d5381522ae508dc441a16dc11ed7
ade5ddcd211d787035f7dbb36cdf719c4f571b6f
refs/heads/master
2021-01-01T18:21:41.602624
2016-03-27T03:30:36
2016-03-27T03:30:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,314
java
package com.juvenxu.mvnbook.account.persist; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.Writer; import java.util.List; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.DocumentFactory; import org.dom4j.Element; import org.dom4j.io.OutputFormat; import org.dom4j.io.SAXReader; import org.dom4j.io.XMLWriter; public class AccountPersistServiceImpl implements AccountPersistService { private static final String ELEMENT_ROOT = "account-persist"; private static final String ELEMENT_ACCOUNTS = "accounts"; private static final String ELEMENT_ACCOUNT_ID = "id"; private static final String ELEMENT_ACCOUNT_NAME = "name"; private static final String ELEMENT_ACCOUNT_EMAIL = "email"; private static final String ELEMENT_PASSWORD = "password"; private static final String ELEMENT_ACCOUNT_ACTIVATED = "activated"; private String file; private SAXReader reader = new SAXReader(); private Document readDocument() throws AccountPersistException { File dataFile = new File(file); if (!dataFile.exists()) { dataFile.getParentFile().mkdirs(); Document doc = DocumentFactory.getInstance().createDocument(); Element rootEle = doc.addElement(ELEMENT_ROOT); rootEle.addElement(ELEMENT_ACCOUNTS); writeDocument(doc); } try { return reader.read(new File(file)); } catch (DocumentException e) { throw new AccountPersistException("Unable to read persist data xml", e); } } private void writeDocument(Document doc) throws AccountPersistException { Writer out = null; try { out = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); XMLWriter writer = new XMLWriter(out, OutputFormat.createPrettyPrint()); writer.write(doc); } catch (IOException e) { throw new AccountPersistException("Unable to write persist data xml.", e); }finally { try { if(out!=null){ out.close(); } } catch (IOException e) { throw new AccountPersistException("Unable to close persist data xml writer.", e); } } } @Override public Account createAccount(Account account) throws AccountPersistException { return null; } @Override public Account readAccount(String id) throws AccountPersistException { Document doc=readDocument(); Element accountsEle=doc.getRootElement().element(ELEMENT_ACCOUNTS); for (Element accountEle : (List<Element>)accountsEle.elements()) { if(accountEle.elementText(ELEMENT_ACCOUNT_ID).equals(id)){ return buildAccount(accountEle); } } return null; } private Account buildAccount(Element element) { Account account=new Account(); account.setId(element.elementText(ELEMENT_ACCOUNT_ID)); account.setName(element.elementText(ELEMENT_ACCOUNT_NAME)); account.setEmail(element.elementText(ELEMENT_ACCOUNT_EMAIL)); account.setPassword(element.elementText(ELEMENT_PASSWORD)); account.setActivated(Boolean.valueOf(element.elementText(ELEMENT_ACCOUNT_ACTIVATED))); return account; } @Override public Account updateAccount(Account account) throws AccountPersistException { // TODO Auto-generated method stub return null; } @Override public void deleteAccount(String id) throws AccountPersistException { // TODO Auto-generated method stub } }
[ "601235723@qq.com" ]
601235723@qq.com
de3ef37de2c27052a191ec0e9f0cbacf21915716
5c1cb8bf03a8442e7c90fca3caec6ed509f86177
/app/src/test/java/xyz/charliemiller/hackjack/ExampleUnitTest.java
e199046e60c726a48d6dce900dceb43c68bae589
[]
no_license
CharlesAMiller/HackJackAndroid
1e715f316fa2b3981c41b8a9c8656c33a11858f4
94b1c82a8f9eac3eb9fe0b4af3b485ed0fe0571b
refs/heads/master
2021-07-11T11:24:04.966019
2017-10-02T07:42:07
2017-10-02T07:42:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
404
java
package xyz.charliemiller.hackjack; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "charliea.miller@gmail.com" ]
charliea.miller@gmail.com