blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
132
path
stringlengths
2
382
src_encoding
stringclasses
34 values
length_bytes
int64
9
3.8M
score
float64
1.5
4.94
int_score
int64
2
5
detected_licenses
listlengths
0
142
license_type
stringclasses
2 values
text
stringlengths
9
3.8M
download_success
bool
1 class
9152a3bd3f186cf9c282d8c7362c0c1caceaa560
Java
G-Delgado/residence-management
/src/model/Vehicle.java
UTF-8
900
3.0625
3
[]
no_license
package model; import java.io.Serializable; public abstract class Vehicle implements Serializable{ /** * */ private static final long serialVersionUID = 1L; private String licensePlate; private String type; public Vehicle(String licensePlate,String type) { this.licensePlate = licensePlate; this.type=type; } public String getLicensePlate() { return this.licensePlate; } public void setLicensePlate(String licensePlate) { this.licensePlate = licensePlate; } @Override public String toString() { /*return "{" + " licensePlate='" + getLicensePlate() + "'" + "}";*/ return getLicensePlate() + " - " + getType(); } public String toCSV(){ return this.licensePlate+","+this.type; } public String getType() { return this.type; } }
true
1066c2387129de8f51bc828748dc7d55a071e014
Java
SEU-3S/codesvn
/hive/src/com/klspta/model/analysis/PropertyAnalyse.java
UTF-8
8,958
2.1875
2
[]
no_license
package com.klspta.model.analysis; import java.text.DecimalFormat; import java.util.List; import java.util.Map; import com.klspta.base.AbstractBaseBean; import com.klspta.base.wkt.Point; public class PropertyAnalyse extends AbstractBaseBean { DecimalFormat df=new DecimalFormat("0.##"); public void showInfo(){ String zb = request.getParameter("point"); String x = zb.split(",")[0]; String y = zb.split(",")[1]; Point p = new Point(x,y); //ICoordinateChangeUtil coor = new CoordinateChangeUtil(); //Point point = coor.changePoint(p, ICoordinateChangeUtil.BL80_TO_PLAIN80); String wkt = p.toWKT(); StringBuffer ms = new StringBuffer("<table cellpadding='0' cellspacing='0'>"); String sql = "select t.shape.srid srid from dlgzspr t where rownum =1 "; List<Map<String, Object>> ls = query(sql,GIS); String srid = ""; if(ls.size()>0){ srid = (ls.get(0)).get("srid").toString(); } sql = "select * from dlgzspr t where sde.st_contains (t.shape,sde.st_geometry(?,?))=1"; ls = query(sql,GIS,new Object[]{wkt,srid}); ms.append("<tr><td>审批情况:</td>"); if (ls.size() > 0) { Map<String, Object> map = ls.get(0); ms.append("<td><SPAN style='COLOR:green'>已审批:").append(map.get("xmmc")).append("</SPAN></td></tr>"); } else { ms.append("<td><SPAN style='COLOR:red'>未审批</SPAN>").append("</td></tr>"); } sql = "select * from dlgzgdr t where sde.st_contains (t.shape,sde.st_geometry(?,?))=1"; ls = query(sql,GIS,new Object[]{wkt,srid}); ms.append("<tr><td>供地情况:</td>"); if (ls.size() > 0) { Map<String, Object> map = ls.get(0); ms.append("<td><SPAN style='COLOR:green'>已供地:").append(map.get("xmmc")).append("</SPAN></td></tr>"); } else { ms.append("<td><SPAN style='COLOR:red'>未供地</SPAN>").append("</td></tr>"); } sql = "select * from dlgztdytqr t where sde.st_contains (t.shape,sde.st_geometry(?,?))=1 and t.tdytqlxdm ='010'"; ls = query(sql,GIS,new Object[]{wkt,srid}); ms.append("<tr><td>规划情况:</td>"); if (ls.size() > 0) { ms.append("<td><SPAN style='COLOR:red'>占用基本农田</SPAN>").append("</td></tr>"); } else { ms.append("<td><SPAN style='COLOR:green'>未占用基本农田</SPAN>").append("</td></tr>"); } sql = "select t.tbbh from dlgzyswftb_zfjc_2012r t where sde.st_contains (t.shape,sde.st_geometry(?,?))=1"; ls = query(sql,GIS,new Object[]{wkt,srid}); ms.append("<tr><td>卫片情况:</td>"); if (ls.size() > 0) { Map<String, Object> map = ls.get(0); ms.append("<td><SPAN style='COLOR:green'>发现2012年度卫片执法检查").append( "</SPAN></td></tr>"); }else { ms.append("<td><SPAN style='COLOR:green'>年度卫片执法检查未发现</SPAN></td></tr>"); } ms.append("</table>"); response(ms.toString()); } public void fenxi(){ String points = request.getParameter("points"); String flag = request.getParameter("flag"); Djfx djfx = new Djfx(); String wkt = djfx.getWkt(points,flag); Analysis analysis = new Analysis(); //现状 List<Map<String,Object>> xzList =analysis.analysis("dlgzxzr", "TBBH,QSDWMC,DLBM,DLMC", wkt); double nydmj = 0; double gengdmj = 0; double jsydmj = 0; double wlydmj = 0; String nydbm = "011,012,013,021,022,023,031,032,033,041,042,043,104,114,117,123"; String gengdbm = "011,012,013"; String jsydbm = "051,052,053,054,061,062,063,071,072,081,082,083,084,085,086,087,088,091,092,093,094,095,101,102,103,105,106,107,113,118,121,201,202,203,204,205"; String wlydbm = "111,112,115,116,119,122,124,125,126,127"; for(int i=0;i<xzList.size();i++){ Map<String,Object> xzMap = xzList.get(i); String dlbm = (String)xzMap.get("dlbm"); double xzdlmj = 0; if(xzMap.get("area")!=null){ xzdlmj = Double.parseDouble(xzMap.get("area").toString()); } if (nydbm.indexOf(dlbm) >= 0) { nydmj += xzdlmj; } if (gengdbm.indexOf(dlbm) >= 0) { gengdmj += xzdlmj; } if (jsydbm.indexOf(dlbm) >= 0) { jsydmj += xzdlmj; } if (wlydbm.indexOf(dlbm) >= 0) { wlydmj += xzdlmj; } } String nydmianji = String.valueOf(df.format(nydmj*0.0015))+"亩"; String gengdmianji = String.valueOf(df.format(gengdmj*0.0015))+"亩"; String jsydmianji = String.valueOf(df.format(jsydmj*0.0015))+"亩"; String wlydmianji = String.valueOf(df.format(wlydmj*0.0015))+"亩"; StringBuffer xzsb = new StringBuffer("<table border='1' cellpadding='0' cellspacing='0' width='330' style='text-align:center; vertical-align:middle;font-family: 宋体, Arial; font-size: 12px;border-collapse:collapse;border:1px #000 solid;' >"); xzsb.append("<tr><td>农用地面积</td><td>耕地面积</td><td>建设用地面积</td><td>未利用地面积</td></tr>"); xzsb.append("<tr><td>"+nydmianji+"</td><td>"+gengdmianji+"</td><td>"+jsydmianji+"</td><td>"+wlydmianji+"</td></tr>").append("</table>"); xzsb.append("<br/><table border='1' cellpadding='0' cellspacing='0' width='330' style='text-align:center; vertical-align:middle;font-family: 宋体, Arial; font-size: 12px;border-collapse:collapse;border:1px #000 solid;' >"); xzsb.append("<tr><td>编号</td><td>权属单位</td><td>地类名称</td><td>面积</td></tr>"); for(int i=0;i<xzList.size();i++){ Map<String,Object> xzMap = xzList.get(i); double xzdlmj = 0; String area = "&nbsp;"; if(xzMap.get("area")!=null){ xzdlmj = Double.parseDouble(xzMap.get("area").toString()); area = String.valueOf(df.format(xzdlmj*0.0015))+"亩"; } xzsb.append("<tr><td>").append(xzMap.get("tbbh")==null?"&nbsp;":xzMap.get("tbbh").toString()) .append("</td><td>").append(xzMap.get("qsdwmc")==null?"&nbsp;":xzMap.get("qsdwmc").toString()) .append("</td><td>").append(xzMap.get("dlmc")==null?"&nbsp;":xzMap.get("dlmc").toString()) .append("</td><td>").append(area).append("</td></tr>"); } xzsb.append("</table>"); //规划 List<Map<String,Object>> ghList = analysis.analysis("dlgztdytqr", "TDYTQLXDM", wkt); double fhghmj = 0; double bfhghmj = 0; double zyjbntmj = 0; String fhghdm = "030,040,050"; String zyjbntdm = "010"; for(int i=0;i<ghList.size();i++){ Map<String,Object> ghMap = ghList.get(i); String tdytqlxdm = (String)ghMap.get("tdytqlxdm"); double ghdlmj = 0; if(ghMap.get("area")!=null){ ghdlmj = Double.parseDouble(ghMap.get("area").toString()); } if (fhghdm.indexOf(tdytqlxdm) >= 0) { fhghmj += ghdlmj; } else { bfhghmj += ghdlmj; if (zyjbntdm.equals(tdytqlxdm)) { zyjbntmj += ghdlmj; } } } String fhghmianji = String.valueOf(df.format(fhghmj*0.0015))+"亩"; String bfhghmianji = String.valueOf(df.format(bfhghmj*0.0015))+"亩"; String zyjbntmianji = String.valueOf(df.format(zyjbntmj*0.0015))+"亩"; StringBuffer ghsb = new StringBuffer("<table border='1' cellpadding='0' cellspacing='0' width='330' style='text-align:center; vertical-align:middle;font-family: 宋体, Arial; font-size: 12px;border-collapse:collapse;border:1px #000 solid;' >"); ghsb.append("<tr><td>符合规划面积</td><td>不符合规划面积</td><td>其中基本农田面积</td></tr>"); ghsb.append("<tr><td>"+fhghmianji+"</td><td>"+bfhghmianji+"</td><td>"+zyjbntmianji+"</td></tr>").append("</table>"); String msg = (xzsb.append("@").append(ghsb)).toString(); response(msg); } public void fenxiproanalyse(){ } }
true
bced64a2fb1fca52e1590b90ca4205f2e26a019f
Java
kilokahn/spring-testers
/spring-test-context-tester/src/test/java/com/kilo/ServiceTest.java
UTF-8
1,032
2.671875
3
[]
no_license
package com.kilo; import javax.annotation.Resource; import org.junit.Test; import com.kilo.driver.FibonacciService; public class ServiceTest extends BaseTest { @Resource(name = "fibonacciService") private FibonacciService fibonacciService; @Resource(name = "helper") private Helper helper; @Test public void test1() { int nextInteger = helper.getNextInteger(); long fibonacci = fibonacciService.getFibonacci(nextInteger); System.out.println("Fibo for " + nextInteger + " is " + fibonacci); } @Test public void test2() { int nextInteger = helper.getNextInteger(); long fibonacci = fibonacciService.getFibonacci(nextInteger); System.out.println("Fibo for " + nextInteger + " is " + fibonacci); } @Test public void test3() { int nextInteger = helper.getNextInteger(); long fibonacci = fibonacciService.getFibonacci(nextInteger); System.out.println("Fibo for " + nextInteger + " is " + fibonacci); } }
true
70079dcc0b3b414f98505e99dc589d9ad6223d2e
Java
mrfoott/OOP_Homework_VTCA
/IUH/Module2_Bai7/Main.java
UTF-8
2,168
3.109375
3
[]
no_license
import java.text.DecimalFormat; public class Main { public static void main(String[] args) { Programmer emp1 = new Programmer(100, "John", 3000, "C/C++"); Programmer emp2 = new Programmer(101, "Smith", 2750, "C#"); Programmer emp3 = new Programmer(102, "Tim", 2600, "Java"); Administrator emp4 = new Administrator(103, "Jenn", 3500, "UX/UI"); Administrator emp5 = new Administrator(104, "Grunt", 3600, "Tools"); Administrator emp6 = new Administrator(105, "Paul", 3400, "Marketing"); ProjectLeader emp7 = new ProjectLeader(106, "Adam", 3100, "Kotlin"); ProjectLeader emp8 = new ProjectLeader(107, "Mint", 3000, "Swift"); ProjectLeader emp9 = new ProjectLeader(108, "Lorance", 2900, "PHP"); ProjectLeader emp10 = new ProjectLeader(108, "&&&&&&", 2900, "&&&"); SoftwareHouse sh = new SoftwareHouse("M&T"); sh.addEmployee(emp1); sh.addEmployee(emp2); sh.addEmployee(emp3); sh.addEmployee(emp4); sh.addEmployee(emp5); sh.addEmployee(emp6); sh.addEmployee(emp7); sh.addEmployee(emp8); sh.addEmployee(emp9); sh.addEmployee(emp10); System.out.println("----------------------------------------------------------"); sh.displayAllStaff(); System.out.println("----------------------------------------------------------"); DecimalFormat df = new DecimalFormat("#,###.00"); System.out.printf("Total money: %20s$\n", df.format(sh.getMonthlySalaryBill())); System.out.println("----------------------------------------------------------"); sh.sortAllStaffByName(); sh.displayAllStaff(); System.out.println("----------------------------------------------------------"); sh.displayListProgrammers(); System.out.println("----------------------------------------------------------"); sh.updateDepartmentForAdmin(105, "New Marketing"); sh.displayAllStaff(); System.out.println("----------------------------------------------------------"); } }
true
4b17e9574bcf27e4d8337f764044a67098f27dda
Java
KyleAWang/FoodFinder
/app/src/main/java/com/wang/kyle/foodfinder/module/PlaceDetailResponse.java
UTF-8
239
1.695313
2
[]
no_license
package com.wang.kyle.foodfinder.module; /** * Created by Kyle on 5/5/2016. */ public class PlaceDetailResponse extends BaseResponse { private PlaceDetail result; public PlaceDetail getResult() { return result; } }
true
9db09f797bfd4e9ece862f4d31d93bdd6f53f74b
Java
braldanago/Design-Patterns
/Estructurales/Adapter/Adapter/AdapterObj/AddressValidator.java
UTF-8
154
1.929688
2
[ "MIT" ]
permissive
public abstract class AddressValidator { public abstract boolean isValidAddress(String inp_address,String inp_zip, String inp_state); }// end of class
true
124751fc29ebd7b025d06d7b602302e55ea3f1f2
Java
mathias-mike/EplStars
/sources/androidx/constraintlayout/solver/widgets/Chain.java
UTF-8
42,252
1.851563
2
[]
no_license
package androidx.constraintlayout.solver.widgets; import androidx.constraintlayout.solver.LinearSystem; import java.util.ArrayList; public class Chain { private static final boolean DEBUG = false; public static final boolean USE_CHAIN_OPTIMIZATION = false; public static void applyChainConstraints(ConstraintWidgetContainer constraintWidgetContainer, LinearSystem system, ArrayList<ConstraintWidget> widgets, int orientation) { ChainHead[] chainsArray; int chainsSize; int offset; if (orientation == 0) { offset = 0; chainsSize = constraintWidgetContainer.mHorizontalChainsSize; chainsArray = constraintWidgetContainer.mHorizontalChainsArray; } else { offset = 2; chainsSize = constraintWidgetContainer.mVerticalChainsSize; chainsArray = constraintWidgetContainer.mVerticalChainsArray; } for (int i = 0; i < chainsSize; i++) { ChainHead first = chainsArray[i]; first.define(); if (widgets == null || (widgets != null && widgets.contains(first.mFirst))) { applyChainConstraints(constraintWidgetContainer, system, orientation, offset, first); } } } /* JADX WARNING: Removed duplicated region for block: B:299:0x0668 A[ADDED_TO_REGION] */ /* JADX WARNING: Removed duplicated region for block: B:304:0x067c */ /* JADX WARNING: Removed duplicated region for block: B:305:0x0681 */ /* JADX WARNING: Removed duplicated region for block: B:308:0x0688 */ /* JADX WARNING: Removed duplicated region for block: B:309:0x068d */ /* JADX WARNING: Removed duplicated region for block: B:311:0x0690 */ /* JADX WARNING: Removed duplicated region for block: B:316:0x06a8 */ /* JADX WARNING: Removed duplicated region for block: B:318:0x06ac */ /* JADX WARNING: Removed duplicated region for block: B:319:0x06b8 */ /* JADX WARNING: Removed duplicated region for block: B:321:0x06bb A[ADDED_TO_REGION] */ /* Code decompiled incorrectly, please refer to instructions dump. */ static void applyChainConstraints(androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r45, androidx.constraintlayout.solver.LinearSystem r46, int r47, int r48, androidx.constraintlayout.solver.widgets.ChainHead r49) { /* r0 = r45 r10 = r46 r11 = r49 androidx.constraintlayout.solver.widgets.ConstraintWidget r12 = r11.mFirst androidx.constraintlayout.solver.widgets.ConstraintWidget r13 = r11.mLast androidx.constraintlayout.solver.widgets.ConstraintWidget r14 = r11.mFirstVisibleWidget androidx.constraintlayout.solver.widgets.ConstraintWidget r15 = r11.mLastVisibleWidget androidx.constraintlayout.solver.widgets.ConstraintWidget r9 = r11.mHead r1 = r12 r2 = 0 r3 = 0 float r4 = r11.mTotalWeight androidx.constraintlayout.solver.widgets.ConstraintWidget r8 = r11.mFirstMatchConstraintWidget androidx.constraintlayout.solver.widgets.ConstraintWidget r7 = r11.mLastMatchConstraintWidget androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour[] r5 = r0.mListDimensionBehaviors r5 = r5[r47] androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r6 = androidx.constraintlayout.solver.widgets.ConstraintWidget.DimensionBehaviour.WRAP_CONTENT r16 = r1 if (r5 != r6) goto L_0x0025 r5 = 1 goto L_0x0026 L_0x0025: r5 = 0 L_0x0026: r18 = r5 r5 = 0 r6 = 0 r19 = 0 if (r47 != 0) goto L_0x0052 int r1 = r9.mHorizontalChainStyle if (r1 != 0) goto L_0x0034 r1 = 1 goto L_0x0035 L_0x0034: r1 = 0 L_0x0035: int r5 = r9.mHorizontalChainStyle r22 = r1 r1 = 1 if (r5 != r1) goto L_0x003e r1 = 1 goto L_0x003f L_0x003e: r1 = 0 L_0x003f: int r5 = r9.mHorizontalChainStyle r6 = 2 if (r5 != r6) goto L_0x0046 r5 = 1 goto L_0x0047 L_0x0046: r5 = 0 L_0x0047: r19 = r2 r21 = r3 r23 = r5 r6 = r16 r16 = r1 goto L_0x0075 L_0x0052: int r1 = r9.mVerticalChainStyle if (r1 != 0) goto L_0x0058 r1 = 1 goto L_0x0059 L_0x0058: r1 = 0 L_0x0059: int r5 = r9.mVerticalChainStyle r22 = r1 r1 = 1 if (r5 != r1) goto L_0x0062 r1 = 1 goto L_0x0063 L_0x0062: r1 = 0 L_0x0063: int r5 = r9.mVerticalChainStyle r6 = 2 if (r5 != r6) goto L_0x006a r5 = 1 goto L_0x006b L_0x006a: r5 = 0 L_0x006b: r19 = r2 r21 = r3 r23 = r5 r6 = r16 r16 = r1 L_0x0075: if (r21 != 0) goto L_0x0164 androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r3 = r6.mListAnchors r3 = r3[r48] r24 = 4 if (r23 == 0) goto L_0x0081 r24 = 1 L_0x0081: int r25 = r3.getMargin() androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour[] r1 = r6.mListDimensionBehaviors r1 = r1[r47] androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r5 = androidx.constraintlayout.solver.widgets.ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT if (r1 != r5) goto L_0x0095 int[] r1 = r6.mResolvedMatchConstraintDefault r1 = r1[r47] if (r1 != 0) goto L_0x0095 r1 = 1 goto L_0x0096 L_0x0095: r1 = 0 L_0x0096: androidx.constraintlayout.solver.widgets.ConstraintAnchor r5 = r3.mTarget if (r5 == 0) goto L_0x00a7 if (r6 == r12) goto L_0x00a7 androidx.constraintlayout.solver.widgets.ConstraintAnchor r5 = r3.mTarget int r5 = r5.getMargin() int r25 = r25 + r5 r5 = r25 goto L_0x00a9 L_0x00a7: r5 = r25 L_0x00a9: if (r23 == 0) goto L_0x00b1 if (r6 == r12) goto L_0x00b1 if (r6 == r14) goto L_0x00b1 r24 = 8 L_0x00b1: androidx.constraintlayout.solver.widgets.ConstraintAnchor r2 = r3.mTarget if (r2 == 0) goto L_0x00e9 if (r6 != r14) goto L_0x00c6 androidx.constraintlayout.solver.SolverVariable r2 = r3.mSolverVariable r28 = r4 androidx.constraintlayout.solver.widgets.ConstraintAnchor r4 = r3.mTarget androidx.constraintlayout.solver.SolverVariable r4 = r4.mSolverVariable r29 = r7 r7 = 6 r10.addGreaterThan(r2, r4, r5, r7) goto L_0x00d5 L_0x00c6: r28 = r4 r29 = r7 androidx.constraintlayout.solver.SolverVariable r2 = r3.mSolverVariable androidx.constraintlayout.solver.widgets.ConstraintAnchor r4 = r3.mTarget androidx.constraintlayout.solver.SolverVariable r4 = r4.mSolverVariable r7 = 8 r10.addGreaterThan(r2, r4, r5, r7) L_0x00d5: if (r1 == 0) goto L_0x00db if (r23 != 0) goto L_0x00db r2 = 5 goto L_0x00dd L_0x00db: r2 = r24 L_0x00dd: androidx.constraintlayout.solver.SolverVariable r4 = r3.mSolverVariable androidx.constraintlayout.solver.widgets.ConstraintAnchor r7 = r3.mTarget androidx.constraintlayout.solver.SolverVariable r7 = r7.mSolverVariable r10.addEquality(r4, r7, r5, r2) r24 = r2 goto L_0x00ed L_0x00e9: r28 = r4 r29 = r7 L_0x00ed: if (r18 == 0) goto L_0x012a int r2 = r6.getVisibility() r4 = 8 if (r2 == r4) goto L_0x0115 androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour[] r2 = r6.mListDimensionBehaviors r2 = r2[r47] androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r4 = androidx.constraintlayout.solver.widgets.ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT if (r2 != r4) goto L_0x0115 androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r2 = r6.mListAnchors int r4 = r48 + 1 r2 = r2[r4] androidx.constraintlayout.solver.SolverVariable r2 = r2.mSolverVariable androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r4 = r6.mListAnchors r4 = r4[r48] androidx.constraintlayout.solver.SolverVariable r4 = r4.mSolverVariable r25 = r1 r1 = 0 r7 = 5 r10.addGreaterThan(r2, r4, r1, r7) goto L_0x0117 L_0x0115: r25 = r1 L_0x0117: androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r1 = r6.mListAnchors r1 = r1[r48] androidx.constraintlayout.solver.SolverVariable r1 = r1.mSolverVariable androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r2 = r0.mListAnchors r2 = r2[r48] androidx.constraintlayout.solver.SolverVariable r2 = r2.mSolverVariable r4 = 8 r7 = 0 r10.addGreaterThan(r1, r2, r7, r4) goto L_0x012c L_0x012a: r25 = r1 L_0x012c: androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r1 = r6.mListAnchors int r2 = r48 + 1 r1 = r1[r2] androidx.constraintlayout.solver.widgets.ConstraintAnchor r1 = r1.mTarget if (r1 == 0) goto L_0x0152 androidx.constraintlayout.solver.widgets.ConstraintWidget r2 = r1.mOwner androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r4 = r2.mListAnchors r4 = r4[r48] androidx.constraintlayout.solver.widgets.ConstraintAnchor r4 = r4.mTarget if (r4 == 0) goto L_0x014e androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r4 = r2.mListAnchors r4 = r4[r48] androidx.constraintlayout.solver.widgets.ConstraintAnchor r4 = r4.mTarget androidx.constraintlayout.solver.widgets.ConstraintWidget r4 = r4.mOwner if (r4 == r6) goto L_0x014b goto L_0x014e L_0x014b: r19 = r2 goto L_0x0155 L_0x014e: r2 = 0 r19 = r2 goto L_0x0155 L_0x0152: r2 = 0 r19 = r2 L_0x0155: if (r19 == 0) goto L_0x015b r2 = r19 r6 = r2 goto L_0x015e L_0x015b: r2 = 1 r21 = r2 L_0x015e: r4 = r28 r7 = r29 goto L_0x0075 L_0x0164: r28 = r4 r29 = r7 if (r15 == 0) goto L_0x01d1 androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r2 = r13.mListAnchors int r3 = r48 + 1 r2 = r2[r3] androidx.constraintlayout.solver.widgets.ConstraintAnchor r2 = r2.mTarget if (r2 == 0) goto L_0x01d1 androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r2 = r15.mListAnchors int r3 = r48 + 1 r2 = r2[r3] androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour[] r3 = r15.mListDimensionBehaviors r3 = r3[r47] androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r4 = androidx.constraintlayout.solver.widgets.ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT if (r3 != r4) goto L_0x018a int[] r3 = r15.mResolvedMatchConstraintDefault r3 = r3[r47] if (r3 != 0) goto L_0x018a r3 = 1 goto L_0x018b L_0x018a: r3 = 0 L_0x018b: if (r3 == 0) goto L_0x01a5 if (r23 != 0) goto L_0x01a5 androidx.constraintlayout.solver.widgets.ConstraintAnchor r4 = r2.mTarget androidx.constraintlayout.solver.widgets.ConstraintWidget r4 = r4.mOwner if (r4 != r0) goto L_0x01a5 androidx.constraintlayout.solver.SolverVariable r4 = r2.mSolverVariable androidx.constraintlayout.solver.widgets.ConstraintAnchor r5 = r2.mTarget androidx.constraintlayout.solver.SolverVariable r5 = r5.mSolverVariable int r7 = r2.getMargin() int r7 = -r7 r1 = 5 r10.addEquality(r4, r5, r7, r1) goto L_0x01bc L_0x01a5: if (r23 == 0) goto L_0x01bc androidx.constraintlayout.solver.widgets.ConstraintAnchor r1 = r2.mTarget androidx.constraintlayout.solver.widgets.ConstraintWidget r1 = r1.mOwner if (r1 != r0) goto L_0x01bc androidx.constraintlayout.solver.SolverVariable r1 = r2.mSolverVariable androidx.constraintlayout.solver.widgets.ConstraintAnchor r4 = r2.mTarget androidx.constraintlayout.solver.SolverVariable r4 = r4.mSolverVariable int r5 = r2.getMargin() int r5 = -r5 r7 = 4 r10.addEquality(r1, r4, r5, r7) L_0x01bc: androidx.constraintlayout.solver.SolverVariable r1 = r2.mSolverVariable androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r4 = r13.mListAnchors int r5 = r48 + 1 r4 = r4[r5] androidx.constraintlayout.solver.widgets.ConstraintAnchor r4 = r4.mTarget androidx.constraintlayout.solver.SolverVariable r4 = r4.mSolverVariable int r5 = r2.getMargin() int r5 = -r5 r7 = 6 r10.addLowerThan(r1, r4, r5, r7) L_0x01d1: if (r18 == 0) goto L_0x01f2 androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r1 = r0.mListAnchors int r2 = r48 + 1 r1 = r1[r2] androidx.constraintlayout.solver.SolverVariable r1 = r1.mSolverVariable androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r2 = r13.mListAnchors int r3 = r48 + 1 r2 = r2[r3] androidx.constraintlayout.solver.SolverVariable r2 = r2.mSolverVariable androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r3 = r13.mListAnchors int r4 = r48 + 1 r3 = r3[r4] int r3 = r3.getMargin() r4 = 8 r10.addGreaterThan(r1, r2, r3, r4) L_0x01f2: java.util.ArrayList<androidx.constraintlayout.solver.widgets.ConstraintWidget> r7 = r11.mWeightedMatchConstraintsWidgets if (r7 == 0) goto L_0x02da int r1 = r7.size() r2 = 1 if (r1 <= r2) goto L_0x02d1 r3 = 0 r4 = 0 boolean r5 = r11.mHasUndefinedWeights if (r5 == 0) goto L_0x020c boolean r5 = r11.mHasComplexMatchWeights if (r5 != 0) goto L_0x020c int r5 = r11.mWidgetsMatchCount float r5 = (float) r5 r28 = r5 L_0x020c: r5 = 0 L_0x020d: if (r5 >= r1) goto L_0x02c6 java.lang.Object r20 = r7.get(r5) r2 = r20 androidx.constraintlayout.solver.widgets.ConstraintWidget r2 = (androidx.constraintlayout.solver.widgets.ConstraintWidget) r2 float[] r0 = r2.mWeight r0 = r0[r47] r20 = 0 int r26 = (r0 > r20 ? 1 : (r0 == r20 ? 0 : -1)) if (r26 >= 0) goto L_0x024f r26 = r0 boolean r0 = r11.mHasComplexMatchWeights if (r0 == 0) goto L_0x0245 androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r0 = r2.mListAnchors int r20 = r48 + 1 r0 = r0[r20] androidx.constraintlayout.solver.SolverVariable r0 = r0.mSolverVariable r38 = r1 androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r1 = r2.mListAnchors r1 = r1[r48] androidx.constraintlayout.solver.SolverVariable r1 = r1.mSolverVariable r39 = r6 r24 = r7 r6 = 4 r7 = 0 r10.addEquality(r0, r1, r7, r6) r17 = r8 r8 = 0 goto L_0x02b7 L_0x0245: r38 = r1 r39 = r6 r24 = r7 r6 = 4 r0 = 1065353216(0x3f800000, float:1.0) goto L_0x0258 L_0x024f: r26 = r0 r38 = r1 r39 = r6 r24 = r7 r6 = 4 L_0x0258: int r1 = (r0 > r20 ? 1 : (r0 == r20 ? 0 : -1)) if (r1 != 0) goto L_0x0273 androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r1 = r2.mListAnchors int r7 = r48 + 1 r1 = r1[r7] androidx.constraintlayout.solver.SolverVariable r1 = r1.mSolverVariable androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r7 = r2.mListAnchors r7 = r7[r48] androidx.constraintlayout.solver.SolverVariable r7 = r7.mSolverVariable r17 = r8 r6 = 8 r8 = 0 r10.addEquality(r1, r7, r8, r6) goto L_0x02b7 L_0x0273: r17 = r8 r8 = 0 if (r3 == 0) goto L_0x02b1 androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r1 = r3.mListAnchors r1 = r1[r48] androidx.constraintlayout.solver.SolverVariable r1 = r1.mSolverVariable androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r6 = r3.mListAnchors int r7 = r48 + 1 r6 = r6[r7] androidx.constraintlayout.solver.SolverVariable r6 = r6.mSolverVariable androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r7 = r2.mListAnchors r7 = r7[r48] androidx.constraintlayout.solver.SolverVariable r7 = r7.mSolverVariable androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r8 = r2.mListAnchors int r30 = r48 + 1 r8 = r8[r30] androidx.constraintlayout.solver.SolverVariable r8 = r8.mSolverVariable r40 = r3 androidx.constraintlayout.solver.ArrayRow r3 = r46.createRow() r30 = r3 r31 = r4 r32 = r28 r33 = r0 r34 = r1 r35 = r6 r36 = r7 r37 = r8 r30.createRowEqualMatchDimensions(r31, r32, r33, r34, r35, r36, r37) r10.addConstraint(r3) goto L_0x02b3 L_0x02b1: r40 = r3 L_0x02b3: r1 = r2 r3 = r0 r4 = r3 r3 = r1 L_0x02b7: int r5 = r5 + 1 r0 = r45 r8 = r17 r7 = r24 r1 = r38 r6 = r39 r2 = 1 goto L_0x020d L_0x02c6: r38 = r1 r40 = r3 r39 = r6 r24 = r7 r17 = r8 goto L_0x02e0 L_0x02d1: r38 = r1 r39 = r6 r24 = r7 r17 = r8 goto L_0x02e0 L_0x02da: r39 = r6 r24 = r7 r17 = r8 L_0x02e0: if (r14 == 0) goto L_0x0372 if (r14 == r15) goto L_0x02f3 if (r23 == 0) goto L_0x02e7 goto L_0x02f3 L_0x02e7: r35 = r9 r32 = r39 r44 = r29 r29 = r24 r24 = r44 goto L_0x037c L_0x02f3: androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r1 = r12.mListAnchors r1 = r1[r48] androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r2 = r13.mListAnchors int r3 = r48 + 1 r2 = r2[r3] androidx.constraintlayout.solver.widgets.ConstraintAnchor r3 = r1.mTarget if (r3 == 0) goto L_0x0306 androidx.constraintlayout.solver.widgets.ConstraintAnchor r3 = r1.mTarget androidx.constraintlayout.solver.SolverVariable r3 = r3.mSolverVariable goto L_0x0307 L_0x0306: r3 = 0 L_0x0307: r20 = r3 androidx.constraintlayout.solver.widgets.ConstraintAnchor r3 = r2.mTarget if (r3 == 0) goto L_0x0312 androidx.constraintlayout.solver.widgets.ConstraintAnchor r3 = r2.mTarget androidx.constraintlayout.solver.SolverVariable r3 = r3.mSolverVariable goto L_0x0313 L_0x0312: r3 = 0 L_0x0313: r25 = r3 androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r3 = r14.mListAnchors r8 = r3[r48] androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r1 = r15.mListAnchors int r3 = r48 + 1 r7 = r1[r3] if (r20 == 0) goto L_0x0362 if (r25 == 0) goto L_0x0362 r1 = 1056964608(0x3f000000, float:0.5) if (r47 != 0) goto L_0x032c float r1 = r9.mHorizontalBiasPercent r26 = r1 goto L_0x0330 L_0x032c: float r1 = r9.mVerticalBiasPercent r26 = r1 L_0x0330: int r27 = r8.getMargin() int r30 = r7.getMargin() androidx.constraintlayout.solver.SolverVariable r2 = r8.mSolverVariable androidx.constraintlayout.solver.SolverVariable r6 = r7.mSolverVariable r31 = 7 r1 = r46 r3 = r20 r4 = r27 r5 = r26 r33 = r6 r32 = r39 r6 = r25 r34 = r7 r44 = r29 r29 = r24 r24 = r44 r7 = r33 r33 = r8 r8 = r30 r35 = r9 r9 = r31 r1.addCentering(r2, r3, r4, r5, r6, r7, r8, r9) goto L_0x0370 L_0x0362: r34 = r7 r33 = r8 r35 = r9 r32 = r39 r44 = r29 r29 = r24 r24 = r44 L_0x0370: goto L_0x0666 L_0x0372: r35 = r9 r32 = r39 r44 = r29 r29 = r24 r24 = r44 L_0x037c: if (r22 == 0) goto L_0x04cc if (r14 == 0) goto L_0x04cc r1 = r14 r2 = r14 int r3 = r11.mWidgetsMatchCount if (r3 <= 0) goto L_0x038f int r3 = r11.mWidgetsCount int r4 = r11.mWidgetsMatchCount if (r3 != r4) goto L_0x038f r25 = 1 goto L_0x0391 L_0x038f: r25 = 0 L_0x0391: r20 = r25 r8 = r1 r9 = r2 L_0x0395: if (r8 == 0) goto L_0x04c4 androidx.constraintlayout.solver.widgets.ConstraintWidget[] r1 = r8.mNextChainWidget r1 = r1[r47] r7 = r1 L_0x039c: if (r7 == 0) goto L_0x03ab int r1 = r7.getVisibility() r5 = 8 if (r1 != r5) goto L_0x03ad androidx.constraintlayout.solver.widgets.ConstraintWidget[] r1 = r7.mNextChainWidget r7 = r1[r47] goto L_0x039c L_0x03ab: r5 = 8 L_0x03ad: if (r7 != 0) goto L_0x03bc if (r8 != r15) goto L_0x03b2 goto L_0x03bc L_0x03b2: r39 = r7 r40 = r8 r41 = r9 r0 = 8 goto L_0x04b2 L_0x03bc: androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r1 = r8.mListAnchors r6 = r1[r48] androidx.constraintlayout.solver.SolverVariable r4 = r6.mSolverVariable androidx.constraintlayout.solver.widgets.ConstraintAnchor r1 = r6.mTarget if (r1 == 0) goto L_0x03cb androidx.constraintlayout.solver.widgets.ConstraintAnchor r1 = r6.mTarget androidx.constraintlayout.solver.SolverVariable r1 = r1.mSolverVariable goto L_0x03cc L_0x03cb: r1 = 0 L_0x03cc: if (r9 == r8) goto L_0x03d9 androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r2 = r9.mListAnchors int r3 = r48 + 1 r2 = r2[r3] androidx.constraintlayout.solver.SolverVariable r1 = r2.mSolverVariable r19 = r1 goto L_0x03f5 L_0x03d9: if (r8 != r14) goto L_0x03f3 if (r9 != r8) goto L_0x03f3 androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r2 = r12.mListAnchors r2 = r2[r48] androidx.constraintlayout.solver.widgets.ConstraintAnchor r2 = r2.mTarget if (r2 == 0) goto L_0x03ee androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r2 = r12.mListAnchors r2 = r2[r48] androidx.constraintlayout.solver.widgets.ConstraintAnchor r2 = r2.mTarget androidx.constraintlayout.solver.SolverVariable r2 = r2.mSolverVariable goto L_0x03ef L_0x03ee: r2 = 0 L_0x03ef: r1 = r2 r19 = r1 goto L_0x03f5 L_0x03f3: r19 = r1 L_0x03f5: r1 = 0 r2 = 0 r3 = 0 int r25 = r6.getMargin() androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r0 = r8.mListAnchors int r26 = r48 + 1 r0 = r0[r26] int r0 = r0.getMargin() if (r7 == 0) goto L_0x041d androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r5 = r7.mListAnchors r1 = r5[r48] androidx.constraintlayout.solver.SolverVariable r2 = r1.mSolverVariable androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r5 = r8.mListAnchors int r30 = r48 + 1 r5 = r5[r30] androidx.constraintlayout.solver.SolverVariable r3 = r5.mSolverVariable r30 = r1 r31 = r2 r32 = r3 goto L_0x0437 L_0x041d: androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r5 = r13.mListAnchors int r30 = r48 + 1 r5 = r5[r30] androidx.constraintlayout.solver.widgets.ConstraintAnchor r1 = r5.mTarget if (r1 == 0) goto L_0x0429 androidx.constraintlayout.solver.SolverVariable r2 = r1.mSolverVariable L_0x0429: androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r5 = r8.mListAnchors int r30 = r48 + 1 r5 = r5[r30] androidx.constraintlayout.solver.SolverVariable r3 = r5.mSolverVariable r30 = r1 r31 = r2 r32 = r3 L_0x0437: if (r30 == 0) goto L_0x043e int r1 = r30.getMargin() int r0 = r0 + r1 L_0x043e: if (r9 == 0) goto L_0x044c androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r1 = r9.mListAnchors int r2 = r48 + 1 r1 = r1[r2] int r1 = r1.getMargin() int r25 = r25 + r1 L_0x044c: if (r4 == 0) goto L_0x04a4 if (r19 == 0) goto L_0x04a4 if (r31 == 0) goto L_0x04a4 if (r32 == 0) goto L_0x04a4 r1 = r25 if (r8 != r14) goto L_0x0463 androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r2 = r14.mListAnchors r2 = r2[r48] int r1 = r2.getMargin() r33 = r1 goto L_0x0465 L_0x0463: r33 = r1 L_0x0465: r1 = r0 if (r8 != r15) goto L_0x0475 androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r2 = r15.mListAnchors int r3 = r48 + 1 r2 = r2[r3] int r1 = r2.getMargin() r34 = r1 goto L_0x0477 L_0x0475: r34 = r1 L_0x0477: r1 = 5 if (r20 == 0) goto L_0x047f r1 = 8 r36 = r1 goto L_0x0481 L_0x047f: r36 = r1 L_0x0481: r5 = 1056964608(0x3f000000, float:0.5) r1 = r46 r2 = r4 r3 = r19 r37 = r4 r4 = r33 r38 = r0 r0 = 8 r26 = r6 r6 = r31 r39 = r7 r7 = r32 r40 = r8 r8 = r34 r41 = r9 r9 = r36 r1.addCentering(r2, r3, r4, r5, r6, r7, r8, r9) goto L_0x04b2 L_0x04a4: r38 = r0 r37 = r4 r26 = r6 r39 = r7 r40 = r8 r41 = r9 r0 = 8 L_0x04b2: int r1 = r40.getVisibility() if (r1 == r0) goto L_0x04bc r1 = r40 r9 = r1 goto L_0x04be L_0x04bc: r9 = r41 L_0x04be: r8 = r39 r19 = r39 goto L_0x0395 L_0x04c4: r40 = r8 r41 = r9 r32 = r40 goto L_0x0666 L_0x04cc: r0 = 8 if (r16 == 0) goto L_0x0666 if (r14 == 0) goto L_0x0666 r1 = r14 r2 = r14 int r3 = r11.mWidgetsMatchCount if (r3 <= 0) goto L_0x04e1 int r3 = r11.mWidgetsCount int r4 = r11.mWidgetsMatchCount if (r3 != r4) goto L_0x04e1 r25 = 1 goto L_0x04e3 L_0x04e1: r25 = 0 L_0x04e3: r20 = r25 r8 = r1 r9 = r2 L_0x04e7: if (r8 == 0) goto L_0x05d5 androidx.constraintlayout.solver.widgets.ConstraintWidget[] r1 = r8.mNextChainWidget r1 = r1[r47] L_0x04ed: if (r1 == 0) goto L_0x04fa int r2 = r1.getVisibility() if (r2 != r0) goto L_0x04fa androidx.constraintlayout.solver.widgets.ConstraintWidget[] r2 = r1.mNextChainWidget r1 = r2[r47] goto L_0x04ed L_0x04fa: if (r8 == r14) goto L_0x05bb if (r8 == r15) goto L_0x05bb if (r1 == 0) goto L_0x05bb if (r1 != r15) goto L_0x0505 r1 = 0 r7 = r1 goto L_0x0506 L_0x0505: r7 = r1 L_0x0506: androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r1 = r8.mListAnchors r6 = r1[r48] androidx.constraintlayout.solver.SolverVariable r5 = r6.mSolverVariable androidx.constraintlayout.solver.widgets.ConstraintAnchor r1 = r6.mTarget if (r1 == 0) goto L_0x0515 androidx.constraintlayout.solver.widgets.ConstraintAnchor r1 = r6.mTarget androidx.constraintlayout.solver.SolverVariable r1 = r1.mSolverVariable goto L_0x0516 L_0x0515: r1 = 0 L_0x0516: androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r2 = r9.mListAnchors int r3 = r48 + 1 r2 = r2[r3] androidx.constraintlayout.solver.SolverVariable r4 = r2.mSolverVariable r1 = 0 r2 = 0 r3 = 0 int r19 = r6.getMargin() androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r0 = r8.mListAnchors int r25 = r48 + 1 r0 = r0[r25] int r0 = r0.getMargin() if (r7 == 0) goto L_0x054c r25 = r1 androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r1 = r7.mListAnchors r1 = r1[r48] androidx.constraintlayout.solver.SolverVariable r2 = r1.mSolverVariable r25 = r2 androidx.constraintlayout.solver.widgets.ConstraintAnchor r2 = r1.mTarget if (r2 == 0) goto L_0x0544 androidx.constraintlayout.solver.widgets.ConstraintAnchor r2 = r1.mTarget androidx.constraintlayout.solver.SolverVariable r2 = r2.mSolverVariable goto L_0x0545 L_0x0544: r2 = 0 L_0x0545: r30 = r2 r31 = r25 r25 = r1 goto L_0x0564 L_0x054c: r25 = r1 androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r1 = r15.mListAnchors r1 = r1[r48] if (r1 == 0) goto L_0x0556 androidx.constraintlayout.solver.SolverVariable r2 = r1.mSolverVariable L_0x0556: r25 = r1 androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r1 = r8.mListAnchors int r30 = r48 + 1 r1 = r1[r30] androidx.constraintlayout.solver.SolverVariable r1 = r1.mSolverVariable r30 = r1 r31 = r2 L_0x0564: if (r25 == 0) goto L_0x056b int r1 = r25.getMargin() int r0 = r0 + r1 L_0x056b: if (r9 == 0) goto L_0x0579 androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r1 = r9.mListAnchors int r2 = r48 + 1 r1 = r1[r2] int r1 = r1.getMargin() int r19 = r19 + r1 L_0x0579: r1 = 4 if (r20 == 0) goto L_0x0581 r1 = 8 r32 = r1 goto L_0x0583 L_0x0581: r32 = r1 L_0x0583: if (r5 == 0) goto L_0x05ac if (r4 == 0) goto L_0x05ac if (r31 == 0) goto L_0x05ac if (r30 == 0) goto L_0x05ac r33 = 1056964608(0x3f000000, float:0.5) r1 = r46 r2 = r5 r3 = r4 r34 = r4 r4 = r19 r36 = r5 r5 = r33 r33 = r6 r6 = r31 r37 = r7 r7 = r30 r38 = r8 r8 = r0 r39 = r9 r9 = r32 r1.addCentering(r2, r3, r4, r5, r6, r7, r8, r9) goto L_0x05b8 L_0x05ac: r34 = r4 r36 = r5 r33 = r6 r37 = r7 r38 = r8 r39 = r9 L_0x05b8: r19 = r37 goto L_0x05c1 L_0x05bb: r38 = r8 r39 = r9 r19 = r1 L_0x05c1: int r0 = r38.getVisibility() r1 = 8 if (r0 == r1) goto L_0x05cd r0 = r38 r9 = r0 goto L_0x05cf L_0x05cd: r9 = r39 L_0x05cf: r8 = r19 r0 = 8 goto L_0x04e7 L_0x05d5: r38 = r8 r39 = r9 androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r0 = r14.mListAnchors r0 = r0[r48] androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r1 = r12.mListAnchors r1 = r1[r48] androidx.constraintlayout.solver.widgets.ConstraintAnchor r9 = r1.mTarget androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r1 = r15.mListAnchors int r2 = r48 + 1 r8 = r1[r2] androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r1 = r13.mListAnchors int r2 = r48 + 1 r1 = r1[r2] androidx.constraintlayout.solver.widgets.ConstraintAnchor r7 = r1.mTarget r6 = 5 if (r9 == 0) goto L_0x0641 if (r14 == r15) goto L_0x060a androidx.constraintlayout.solver.SolverVariable r1 = r0.mSolverVariable androidx.constraintlayout.solver.SolverVariable r2 = r9.mSolverVariable int r3 = r0.getMargin() r10.addEquality(r1, r2, r3, r6) r31 = r6 r42 = r7 r43 = r8 r25 = r9 goto L_0x0649 L_0x060a: if (r7 == 0) goto L_0x0638 androidx.constraintlayout.solver.SolverVariable r2 = r0.mSolverVariable androidx.constraintlayout.solver.SolverVariable r3 = r9.mSolverVariable int r4 = r0.getMargin() androidx.constraintlayout.solver.SolverVariable r1 = r8.mSolverVariable androidx.constraintlayout.solver.SolverVariable r5 = r7.mSolverVariable int r26 = r8.getMargin() r30 = r1 r1 = r46 r25 = r5 r5 = 1056964608(0x3f000000, float:0.5) r31 = r6 r6 = r30 r42 = r7 r7 = r25 r43 = r8 r8 = r26 r25 = r9 r9 = r31 r1.addCentering(r2, r3, r4, r5, r6, r7, r8, r9) goto L_0x0649 L_0x0638: r31 = r6 r42 = r7 r43 = r8 r25 = r9 goto L_0x0649 L_0x0641: r31 = r6 r42 = r7 r43 = r8 r25 = r9 L_0x0649: r1 = r42 if (r1 == 0) goto L_0x0660 if (r14 == r15) goto L_0x0660 r2 = r43 androidx.constraintlayout.solver.SolverVariable r3 = r2.mSolverVariable androidx.constraintlayout.solver.SolverVariable r4 = r1.mSolverVariable int r5 = r2.getMargin() int r5 = -r5 r6 = r31 r10.addEquality(r3, r4, r5, r6) goto L_0x0664 L_0x0660: r6 = r31 r2 = r43 L_0x0664: r32 = r38 L_0x0666: if (r22 != 0) goto L_0x066a if (r16 == 0) goto L_0x06ed L_0x066a: if (r14 == 0) goto L_0x06ed if (r14 == r15) goto L_0x06ed androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r0 = r14.mListAnchors r0 = r0[r48] androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r1 = r15.mListAnchors int r2 = r48 + 1 r1 = r1[r2] androidx.constraintlayout.solver.widgets.ConstraintAnchor r2 = r0.mTarget if (r2 == 0) goto L_0x0681 androidx.constraintlayout.solver.widgets.ConstraintAnchor r2 = r0.mTarget androidx.constraintlayout.solver.SolverVariable r2 = r2.mSolverVariable goto L_0x0682 L_0x0681: r2 = 0 L_0x0682: r20 = r2 androidx.constraintlayout.solver.widgets.ConstraintAnchor r2 = r1.mTarget if (r2 == 0) goto L_0x068d androidx.constraintlayout.solver.widgets.ConstraintAnchor r2 = r1.mTarget androidx.constraintlayout.solver.SolverVariable r2 = r2.mSolverVariable goto L_0x068e L_0x068d: r2 = 0 L_0x068e: if (r13 == r15) goto L_0x06a8 androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r3 = r13.mListAnchors int r4 = r48 + 1 r3 = r3[r4] androidx.constraintlayout.solver.widgets.ConstraintAnchor r4 = r3.mTarget if (r4 == 0) goto L_0x06a1 androidx.constraintlayout.solver.widgets.ConstraintAnchor r4 = r3.mTarget androidx.constraintlayout.solver.SolverVariable r4 = r4.mSolverVariable r27 = r4 goto L_0x06a3 L_0x06a1: r27 = 0 L_0x06a3: r2 = r27 r25 = r2 goto L_0x06aa L_0x06a8: r25 = r2 L_0x06aa: if (r14 != r15) goto L_0x06b8 androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r2 = r14.mListAnchors r0 = r2[r48] androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r2 = r14.mListAnchors int r3 = r48 + 1 r1 = r2[r3] r9 = r1 goto L_0x06b9 L_0x06b8: r9 = r1 L_0x06b9: if (r20 == 0) goto L_0x06eb if (r25 == 0) goto L_0x06eb r26 = 1056964608(0x3f000000, float:0.5) int r27 = r0.getMargin() if (r15 != 0) goto L_0x06c7 r1 = r13 r15 = r1 L_0x06c7: androidx.constraintlayout.solver.widgets.ConstraintAnchor[] r1 = r15.mListAnchors int r2 = r48 + 1 r1 = r1[r2] int r30 = r1.getMargin() androidx.constraintlayout.solver.SolverVariable r2 = r0.mSolverVariable androidx.constraintlayout.solver.SolverVariable r7 = r9.mSolverVariable r31 = 5 r1 = r46 r3 = r20 r4 = r27 r5 = r26 r6 = r25 r8 = r30 r33 = r9 r9 = r31 r1.addCentering(r2, r3, r4, r5, r6, r7, r8, r9) goto L_0x06ed L_0x06eb: r33 = r9 L_0x06ed: return */ throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.solver.widgets.Chain.applyChainConstraints(androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer, androidx.constraintlayout.solver.LinearSystem, int, int, androidx.constraintlayout.solver.widgets.ChainHead):void"); } }
true
501473ddabdd9be1d9e964f32c38653937df394c
Java
kyoung-k/kmtp-root
/microservice/master-service/src/main/java/com/kmtp/master/service/MemberHandler.java
UTF-8
6,005
2.15625
2
[]
no_license
/* * Copyright (c) 2021-Present KYoung. * * 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 * * https://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.kmtp.master.service; import com.kmtp.common.api.Member; import com.kmtp.common.generic.GenericError; import com.kmtp.common.generic.GenericValidator; import com.kmtp.common.http.ResponseHandler; import com.kmtp.master.persistence.MemberEntity; import com.kmtp.master.persistence.MemberRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; import org.springframework.web.reactive.function.server.ServerRequest; import org.springframework.web.reactive.function.server.ServerResponse; import reactor.core.publisher.Mono; import java.net.URI; @Component public class MemberHandler { final private MemberRepository memberRepository; final private GenericValidator genericValidator; @Autowired public MemberHandler(MemberRepository memberRepository, GenericValidator genericValidator) { this.memberRepository = memberRepository; this.genericValidator = genericValidator; } /** * 회원 정보를 조회합니다. * <p></p> * (1) id값을 path variable에서 조회합니다.<br> * (2) 회원 정보를 DB에서 조회합니다.<br> 회원 정보가 없을경우 {@link HttpStatus#NOT_FOUND} 상태로 응답합니다.<br> 응답 객체로 변환합니다. * <p></p> * @param request {@link ServerRequest} * @return {@link Mono}<{@link Member}></{@link> */ public Mono<ServerResponse> get(ServerRequest request) { // (1) final Long id = Long.parseLong( request.pathVariable("id") ); // (2) final Mono<Member> memberMono = memberRepository.findById(id) .switchIfEmpty(GenericError.of(HttpStatus.NOT_FOUND, "not found member-id.")) .map(MemberMapper.INSTANCE::entityToApi); return ResponseHandler.ok(memberMono); } /** * 회원 정보를 등록합니다. * <p></p> * (1) request body 정보를 변환한뒤 유효성 체크를 진행합니다.<br> Entity 객체로 변환하고 회원 정보를 등록합니다. * <p></p> * @param request {@link ServerRequest} * @return {@link HttpStatus#CREATED} */ public Mono<ServerResponse> post(ServerRequest request) { // (1) final Mono<MemberEntity> memberEntityMono = request.bodyToMono(Member.class) .doOnNext(member -> genericValidator.validate(member, Member.class)) .map(MemberMapper.INSTANCE::apiToEntity) .flatMap(memberRepository::save); return ResponseHandler.created(memberEntityMono, URI.create(request.path())); } /** * 회원 정보를 수정합니다. * <p></p> * (1) id값을 path variable에서 조회합니다.<br> * (2) request body 정보를 변환한뒤 유효성 체크를 진행합니다.<br> * (3) 회원 정보를 DB에서 조회합니다.<br> 회원 정보가 없을경우 {@link HttpStatus#NOT_FOUND} 상태로 응답합니다.<br> * (4) request 정보와 DB 정보를 {@link Mono#zip} 하여 수정할 정보를 설정하고 DB에 저장합니다. * <p></p> * @param request {@link ServerRequest} * @return {@link HttpStatus#NO_CONTENT} */ public Mono<ServerResponse> put(ServerRequest request) { // (1) final Long id = Long.parseLong(request.pathVariable("id")); // (2) final Mono<Member> memberMono = request.bodyToMono(Member.class) .doOnNext(member -> genericValidator.validate(member, Member.class)); // (3) final Mono<MemberEntity> memberEntityMono = memberRepository.findById(id) .switchIfEmpty(GenericError.of(HttpStatus.NOT_FOUND, "not found item-id")); // (4) final Mono<MemberEntity> updateMemberMono = Mono.zip(memberMono, memberEntityMono) .flatMap(tuple2 -> { tuple2.getT2().change(memberEntity -> { memberEntity.setEmail(tuple2.getT1().getEmail()); memberEntity.setName(tuple2.getT1().getName()); memberEntity.setAge(tuple2.getT1().getAge()); memberEntity.setAddress(tuple2.getT1().getAddress()); }); return Mono.just(tuple2.getT2()) .flatMap(memberRepository::save); }); return ResponseHandler.noContent(updateMemberMono); } /** * 회원 정보를 삭제합니다. * <p></p> * (1) id값을 path variable에서 조회합니다.<br> * (2) 회원 정보를 DB에서 조회합니다.<br> 회원 정보가 없을경우 {@link HttpStatus#NOT_FOUND} 상태로 응답합니다.<br> 조회된 회원 정보를 삭제합니다. * <p></p> * @param request {@link ServerRequest} * @return {@link HttpStatus#NO_CONTENT} */ public Mono<ServerResponse> delete(ServerRequest request) { // (1) final Long id = Long.parseLong( request.pathVariable("id") ); // (2) final Mono<Void> deleteMemberMono = memberRepository.findById(id) .switchIfEmpty(GenericError.of(HttpStatus.NOT_FOUND, "not found member-id.")) .then(memberRepository.deleteById(id)); return ResponseHandler.noContent(deleteMemberMono); } }
true
0a291f1cbdd8e380ef91bedcbceda1a7fb763538
Java
Jhafeth/ED2ABBP2
/src/main/java/bo/edu/uagrm/ficct/inf310sb/abbp2/DatoYaExiste.java
UTF-8
452
2.046875
2
[]
no_license
/* * 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 bo.edu.uagrm.ficct.inf310sb.abbp2; /** * * @author Jhafeth */ public class DatoYaExiste extends Exception { public DatoYaExiste() { super("La clave ya existe"); } public DatoYaExiste(String mensaje) { super(mensaje); } }
true
3e17c6c69c636bc2d653b8708146cd8f8887a0b7
Java
gitikapinjani1/TechmentJava
/Techment/Interface/jdbcConnecter.java
UTF-8
92
1.609375
2
[]
no_license
package com.Techment.Interface; public interface jdbcConnecter { void Connect(); }
true
27522c48e9c7ad670c5c1b4829820d11c80be632
Java
iyustlop/spring-lab
/spring-config-client/src/main/java/com/freelance/spring/springconfigclient/controller/JugsPresentersController.java
UTF-8
582
2.046875
2
[]
no_license
package com.freelance.spring.springconfigclient.controller; import org.springframework.beans.factory.annotation.Value; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RefreshScope public class JugsPresentersController { @Value("${jugs-presentes}") String jugsPresentes; @RequestMapping("/jugs-presentes") public String showJugsPresentes(){ return "Manufacturers: " + jugsPresentes; } }
true
ea58519648ad90d82be17dbb1a3f36b881550504
Java
WilsonPMedeiros/Projeto-IFRN
/src/main/java/com/example/Sistemadegerencimantodeloja/model/ClientesPDFExporter.java
UTF-8
2,481
2.71875
3
[]
no_license
package com.example.Sistemadegerencimantodeloja.model; import com.lowagie.text.*; import com.lowagie.text.Font; import com.lowagie.text.pdf.PdfPCell; import com.lowagie.text.pdf.PdfPTable; import com.lowagie.text.pdf.PdfWriter; import javax.servlet.http.HttpServletResponse; import java.awt.*; import java.io.IOException; import java.util.List; public class ClientesPDFExporter { private List<Cliente> listclientes; public ClientesPDFExporter(List<Cliente> listclientes) { this.listclientes = listclientes; } private void writeTableHeader(PdfPTable table) { PdfPCell cell = new PdfPCell(); cell.setBackgroundColor(Color.BLUE); cell.setPadding(5); com.lowagie.text.Font font = FontFactory.getFont(FontFactory.HELVETICA); font.setColor(Color.WHITE); cell.setPhrase(new Phrase("ID", font)); table.addCell(cell); cell.setPhrase(new Phrase("Nome", font)); table.addCell(cell); cell.setPhrase(new Phrase("CPF", font)); table.addCell(cell); cell.setPhrase(new Phrase("Email", font)); table.addCell(cell); cell.setPhrase(new Phrase("Telefone", font)); table.addCell(cell); } private void writeTableData(PdfPTable table) { for (Cliente cliente : listclientes) { table.addCell(String.valueOf(cliente.getId())); table.addCell(cliente.getNome()); table.addCell(String.valueOf(cliente.getCpf())); table.addCell(String.valueOf(cliente.getEmail())); table.addCell(String.valueOf(cliente.getTelefone())); } } public void export(HttpServletResponse response) throws DocumentException, IOException { Document document = new Document(PageSize.A4); PdfWriter.getInstance(document, response.getOutputStream()); document.open(); Font font = FontFactory.getFont(FontFactory.HELVETICA_BOLD); font.setSize(18); font.setColor(Color.BLACK); Paragraph p = new Paragraph("Relatório de clientes", font); p.setAlignment(Paragraph.ALIGN_CENTER); document.add(p); PdfPTable table = new PdfPTable(5); table.setWidthPercentage(100f); table.setWidths(new float[] {1.5f, 3.5f, 3.0f, 3.0f, 1.5f}); table.setSpacingBefore(10); writeTableHeader(table); writeTableData(table); document.add(table); document.close(); } }
true
d832a65f9e2814007621035fd6579b75f4bc2641
Java
AlfaLeon7/Sockets
/ej3/Cliente.java
UTF-8
2,334
3.234375
3
[]
no_license
package ej3; //Java implementation for a client //Save file as Client.java import java.io.*; import java.net.*; import java.util.Scanner; public class Cliente { public static void main(String[] args) throws IOException { Cliente cliente = new Cliente(); cliente.run(); } private void run() { final int PUERTO = 4444; final String SERVIDOR = "localhost"; Socket socket = null; Scanner sc = new Scanner(System.in); DataInputStream entrada = null; DataOutputStream salida = null; FileInputStream archivo = null; try { while (true) { socket = new Socket(SERVIDOR, PUERTO); salida = new DataOutputStream(socket.getOutputStream()); entrada = new DataInputStream(socket.getInputStream()); // recibo el mensaje de bienvenida System.out.println(entrada.readUTF()); // String ruta = sc.nextLine(); if(ruta.equals("")) { salida.close(); entrada.close(); socket.close(); System.exit(-1); } // envio la ruta del archivo al servidor salida.writeUTF(ruta); // byte resultado = entrada.readByte(); if (resultado == 1) { System.out.println("RESULTADO: " + resultado); System.out.println("ERROR: "+entrada.readUTF()); } else { System.out.println("RESULTADO: "+resultado); // imprimo la ruta donde esta el archivo System.out.println(entrada.readUTF()); // // le mando el destino del archivo al servidor salida.writeUTF(sc.nextLine()); // archivo = new FileInputStream(ruta); long longitud = 0; byte[] buffer = new byte[4096]; while (true) { longitud = archivo.read(buffer); if (longitud == -1) { break; } salida.write(buffer, 0, (int) longitud); } System.out.println("transferencia completada"); archivo.close(); } salida.close(); entrada.close(); } } catch (UnknownHostException e) { System.out.println("ERROR 1: " + e.getMessage()); } catch (IOException e) { System.out.println("ERROR 2: " + e.getMessage()); } try { socket.close(); } catch (IOException e) { System.out.println("ERROR 3: " + e.getMessage()); } sc.close(); } }
true
2ae20aae68e2b3ccd27223113727e40157113adf
Java
IWertz/Week3Assessment
/src/model/Games.java
UTF-8
1,115
2.796875
3
[]
no_license
package model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; /** * @author Snipe - iwertz * CIS175 - Spring 2021 * Feb 15, 2021 */ @Entity @Table(name="games") public class Games { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="ID") private int id; @Column(name="GAME") private String game; @Column(name="RATING") private String rating; public Games() { super(); // TODO Auto-generated constructor stub } public Games(String game, String rating) { super(); this.game = game; this.rating = rating; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getGame() { return game; } public void setGame(String game) { this.game = game; } public String getRating() { return rating; } public void setRating(String rating) { this.rating = rating; } public String returnGameDetails( ) { return game + ": " + rating + " stars"; } }
true
19f3346fbacb29d03ab0c1d44e13b2dbfe601bc2
Java
Fao2212/ExamenOOP
/src/main/java/RestauranteObservador/src/Modelo/Adicional.java
UTF-8
742
2.71875
3
[]
no_license
/* * 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 Modelo; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author Fernando Alvarez */ public class Adicional implements Cloneable{ String name; double precio; public Adicional(String name, double precio) { this.name = name; this.precio = precio; } @Override protected Adicional clone() { return new Adicional(name, precio); } public double getPrecio() { return precio; } public String getName(){ return name; } }
true
2c2db1800f1521a06a8ae95761810b62d816208b
Java
SecondProjectTeam1/SecondProject
/SecondProject/src/main/java/com/sist/web/BooksRestController.java
UTF-8
1,890
2.046875
2
[]
no_license
package com.sist.web; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; import java.util.*; import com.sist.dao.*; import com.sist.vo.BooksFindVO; import com.sist.vo.BooksVO; import com.sist.vo.VideoVO; @RestController public class BooksRestController { @Autowired private BooksDAO dao; @GetMapping(value="junggo/junggo_find.do", produces="text/plain;charset=UTF-8") public String junggo_find(String userFind, String page, String type) { String json=""; try { if(page==null) page="1"; int curpage=Integer.parseInt(page); int rowSize=9; int start=(rowSize*curpage)-(rowSize-1); int end=(rowSize*curpage); Map map=new HashMap(); map.put("userFind", userFind); map.put("start", start); map.put("end", end); map.put("type", type); List<BooksVO> fList=dao.booksFindData(map); JSONArray arr=new JSONArray(); for(BooksVO fvo:fList) { JSONObject obj=new JSONObject(); obj.put("no", fvo.getNo()); obj.put("title", fvo.getTitle()); obj.put("poster", fvo.getPoster()); obj.put("price", fvo.getPrice()); obj.put("author", fvo.getAuthor()); obj.put("sale_price", fvo.getSale_price()); arr.add(obj); } json=arr.toJSONString(); }catch(Exception ex){ex.printStackTrace();} return json; } @GetMapping("junggo/junggo_find_total.do") public String junggo_find_total(String type, String userFind) { Map map = new HashMap(); map.put("type", type); map.put("userFind", userFind); int totalpage=dao.booksFindTotalPage(map); return String.valueOf(totalpage); } }
true
68e94c40fab6735232aef2f6c0b704d49747be30
Java
Henry-Mark/HH_Android
/app/src/main/java/com/henry/hh/dialog/PromptDialog.java
UTF-8
3,736
2.375
2
[ "Apache-2.0" ]
permissive
package com.henry.hh.dialog; import android.annotation.SuppressLint; import android.app.DialogFragment; import android.content.Context; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.Button; import android.widget.TextView; import com.henry.hh.R; import com.henry.hh.interfaces.OnDialogClickListener; /** * Date: 16-10-10 下午8:17 * Creator: henry * Email: heneymark@gmail.com * Description:提示对话框 */ @SuppressLint("ValidFragment") public class PromptDialog extends DialogFragment implements View.OnClickListener { private Context context; //提示的信息 private String msg; //显示消息控件 private TextView mMsg; //确定按钮 private Button mOk; //取消按钮 private Button mCancel; private String CONTEXT; private String MESSAGE = "message"; private String SCREENWIDTH = "width"; private int screenWidth; //设置监听 private OnDialogClickListener dialogClickListener = null; /** * 构造方法 * * @param context * @param msg */ public PromptDialog(Context context, String msg, int screenWidth) { this.context = context; this.msg = msg; this.screenWidth = screenWidth; Bundle arguments = new Bundle(); arguments.putString(MESSAGE, msg); arguments.putInt(SCREENWIDTH, screenWidth); } public PromptDialog() { } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle arguments; if ((arguments = this.getArguments()) != null) { this.MESSAGE = arguments.getString(MESSAGE); this.screenWidth = arguments.getInt(SCREENWIDTH); } } @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Window window = getDialog().getWindow(); //无标题 window.requestFeature(Window.FEATURE_NO_TITLE); View view = inflater.inflate(R.layout.fragment_dialog_prompt, container, false); //点击window外的区域 是否消失 getDialog().setCanceledOnTouchOutside(false); bindView(view); window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); mMsg.setText(msg == null ? "" : msg); return view; } /** * 绑定控件 * * @param view */ private void bindView(View view) { mMsg = (TextView) view.findViewById(R.id.dialog_content); mOk = (Button) view.findViewById(R.id.bt_dialog_ok); mCancel = (Button) view.findViewById(R.id.bt_dialog_cancel); mOk.setOnClickListener(this); mCancel.setOnClickListener(this); } @Override public void onResume() { super.onResume(); getDialog().getWindow().setLayout(screenWidth * 3 / 5, screenWidth * 3 / 8); } @Override public void onClick(View v) { if (v == mOk) { if (dialogClickListener != null) { dismiss(); dialogClickListener.onOkClick(); } } else if (v == mCancel) { if (dialogClickListener != null) { dismiss(); dialogClickListener.onCancel(); } } } /** * 设置监听事件 * * @param listener */ public void setOnDialogClickListener(OnDialogClickListener listener) { this.dialogClickListener = listener; } }
true
4e9ba66d2d9e74a40b0a5fc38216517166732bb7
Java
catsaveearth/TIC-TAC-TALK
/src/client/SignUp.java
UTF-8
8,240
2.609375
3
[]
no_license
package client; /** * 공사 끝 * */ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; @SuppressWarnings("serial") public class SignUp extends JFrame { @SuppressWarnings({ "rawtypes", "unchecked" }) public SignUp() { JFrame frame = new JFrame(); frame.setLayout(new GridLayout(15, 2)); frame.setBackground(new Color(74, 210, 149)); JPanel blank = new JPanel(); blank.setBackground(new Color(74, 210, 149)); JPanel blank1 = new JPanel(); blank1.setBackground(new Color(74, 210, 149)); JPanel blank2 = new JPanel(); blank2.setBackground(new Color(74, 210, 149)); JPanel blank3 = new JPanel(); blank3.setBackground(new Color(74, 210, 149)); JPanel blank4 = new JPanel(); blank4.setBackground(new Color(74, 210, 149)); JPanel infoPanel = new JPanel(); infoPanel.setBackground(new Color(74, 210, 149)); JPanel IDPanel = new JPanel(); IDPanel.setBackground(new Color(74, 210, 149)); JPanel NickNamePanel = new JPanel(); NickNamePanel.setBackground(new Color(74, 210, 149)); JPanel PWPanel = new JPanel(); PWPanel.setBackground(new Color(74, 210, 149)); JPanel NamePanel = new JPanel(); NamePanel.setBackground(new Color(74, 210, 149)); JPanel PNPanel = new JPanel(); PNPanel.setBackground(new Color(74, 210, 149)); JPanel EmailPanel = new JPanel(); EmailPanel.setBackground(new Color(74, 210, 149)); JPanel BirthPanel = new JPanel(); BirthPanel.setBackground(new Color(74, 210, 149)); JPanel GithubPanel = new JPanel(); GithubPanel.setBackground(new Color(74, 210, 149)); ImageIcon icon = new ImageIcon("image/signupTitle.png"); Image titleImage = icon.getImage(); Image titleChangeImg = titleImage.getScaledInstance(600, 40, Image.SCALE_SMOOTH); ImageIcon titleChangeIcon = new ImageIcon(titleChangeImg); JButton label = new JButton(); label.setPreferredSize(new Dimension(100, 30)); label.setBounds(5, 5, 15, 15); label.setIcon(titleChangeIcon); //setting.setForeground(Color.red); label.setBorder(null); label.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { } }); JLabel labelID = new JLabel("ID : "); JLabel labelNickName = new JLabel("NickName : "); JLabel labelPW = new JLabel("Password : "); JLabel labelName = new JLabel("Name : "); JLabel labelPN = new JLabel("Phone Number : "); JLabel labelEmail = new JLabel("Email : "); JLabel labelBirth = new JLabel("Birth : "); String[] year = new String[71]; int yearStart = 1950; for (int i = 0; i <= 70; i++) { year[i] = " " + Integer.toString(yearStart); yearStart++; } setLayout(new FlowLayout()); JComboBox yearCombo = new JComboBox(year); add(yearCombo); String[] month = { " 1", " 2", " 3", " 4", " 5", " 6", " 7", " 8", " 9", " 10", " 11", " 12" }; setLayout(new FlowLayout()); JComboBox monthCombo = new JComboBox(month); add(monthCombo); String[] day = new String[31]; int dayStart = 1; for (int i = 0; i < 31; i++) { day[i] = " " + Integer.toString(dayStart); dayStart++; } setLayout(new FlowLayout()); JComboBox dayCombo = new JComboBox(day); add(dayCombo); JLabel labelGit = new JLabel("GitHub : "); JTextField ID = new JTextField(15); JTextField NickName = new JTextField(15); JPasswordField txtPass = new JPasswordField(15); JTextField name = new JTextField(15); JTextField phoneNumber = new JTextField(15); JTextField email = new JTextField(15); JTextField github = new JTextField(15); JPanel panelBtn = new JPanel(); panelBtn.setBackground(new Color(74, 210, 149)); JButton backBtn = new JButton("BACK"); backBtn.setBackground(new Color(0, 54, 78)); backBtn.setForeground(Color.white); JButton signUpBtn = new JButton("SIGN UP"); signUpBtn.setForeground(Color.white); signUpBtn.setBackground(new Color(0, 54, 78)); IDPanel.add(labelID); IDPanel.add(ID); NickNamePanel.add(labelNickName); NickNamePanel.add(NickName); PWPanel.add(labelPW); PWPanel.add(txtPass); NamePanel.add(labelName); NamePanel.add(name); PNPanel.add(labelPN); PNPanel.add(phoneNumber); EmailPanel.add(labelEmail); EmailPanel.add(email); BirthPanel.add(labelBirth); BirthPanel.add(yearCombo); BirthPanel.add(monthCombo); BirthPanel.add(dayCombo); GithubPanel.add(labelGit); GithubPanel.add(github); panelBtn.add(backBtn); panelBtn.add(signUpBtn); backBtn.addActionListener(new ActionListener() { @SuppressWarnings("unused") @Override public void actionPerformed(ActionEvent e) { frame.dispose(); LogIn check = new LogIn(); // 중복 체크 해주기!! } }); signUpBtn.addActionListener(new ActionListener() { @SuppressWarnings("unused") @Override public void actionPerformed(ActionEvent e) { String git = "0"; if(ID.getText().equals("")) { JOptionPane.showMessageDialog(null, "ID를 입력하세요"); return; } if(NickName.getText().equals("")) { JOptionPane.showMessageDialog(null, "NickName을 입력하세요"); return; } if(String.valueOf(txtPass.getPassword()).equals("")) { JOptionPane.showMessageDialog(null, "비밀번호를 입력하세요"); return; } if(name.getText().equals("")) { JOptionPane.showMessageDialog(null, "이름을 입력하세요"); return; } if(phoneNumber.getText().equals("")) { JOptionPane.showMessageDialog(null, "전화번호를 입력하세요"); return; } if(email.getText().equals("")) { JOptionPane.showMessageDialog(null, "email을 입력하세요"); return; } //모든 조건을 통과하면 그제야 준다 String message = ID.getText() + "`|" + NickName.getText() + "`|" + String.valueOf(txtPass.getPassword()) + "`|" + name.getText() + "`|" + phoneNumber.getText() + "`|" + email.getText() + "`|"; String year = yearCombo.getSelectedItem().toString().substring(4); int month = Integer.parseInt(monthCombo.getSelectedItem().toString().trim()); int day = Integer.parseInt(dayCombo.getSelectedItem().toString().trim()); String m = null; String d = null; if(month < 10) m = "0" + month; else m = Integer.toString(month); if(day < 10) d = "0" + day; else d = Integer.toString(day); message = message + year + m + d; if(github.getText().compareTo("") != 0) { git = "1"; message = message + "`|" + github.getText(); } //이제 client에서 함수 불러서 Server와 소통해서 Check int tf = Client.register(git, message); if(tf == 0) { JOptionPane.showMessageDialog(null, "SUCCESS!!"); frame.dispose(); LogIn check = new LogIn(); } else if(tf == 1) { //뭐 아이디가 중복된다, 그런거 알려줘야 하나??? JOptionPane.showMessageDialog(null, "아이디 중복!!"); } else if(tf == 2) { JOptionPane.showMessageDialog(null, "닉네임 중복!!"); } else if(tf == 3) { JOptionPane.showMessageDialog(null, "Fail!!"); } } }); frame.getContentPane().add(blank); frame.getContentPane().add(label); frame.getContentPane().add(IDPanel); frame.getContentPane().add(NickNamePanel); frame.getContentPane().add(PWPanel); frame.getContentPane().add(NamePanel); frame.getContentPane().add(PNPanel); frame.getContentPane().add(EmailPanel); frame.getContentPane().add(BirthPanel); frame.getContentPane().add(GithubPanel); frame.getContentPane().add(panelBtn); frame.getContentPane().add(blank1); frame.getContentPane().add(blank2); frame.getContentPane().add(blank3); frame.getContentPane().add(blank4); frame.getContentPane().setBackground(new Color(74, 210, 149)); frame.setTitle("Sign-Up"); frame.setVisible(true); frame.setSize(450, 550); frame.setLocationRelativeTo(null); frame.setResizable(false); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }
true
f675ae2b980cc0e6eb5ad832850933f5386019cb
Java
KangJun1024/test
/src/main/java/com/kangjun/util/OpenSlideUtil.java
UTF-8
11,770
2.25
2
[]
no_license
package com.kangjun.util; import com.baomidou.mybatisplus.core.toolkit.Constants; import com.google.common.collect.Lists; import lombok.extern.slf4j.Slf4j; import org.openslide.AssociatedImage; import org.openslide.OpenSlide; import org.springframework.stereotype.Component; import javax.imageio.ImageIO; import java.awt.*; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.List; import java.util.Map; /** * @author mayifan * @date 2023/8/3 * @apiNote */ @Slf4j @Component public class OpenSlideUtil { private static final String osName = System.getProperty("os.name"); // @Value("${open-slide.img-type:jpg}") private static String imgType = "jpg"; // @Value("${open-slide.img-size:256}") private static Integer imgSize = 256; // @Resource // private MinIoUtils minIoUtils; private static boolean OPENSLIDE_UNAVAILABLE = false; // private static final WIN_LIBRARIES = static { try { // Try loading OpenSlide-JNI - hopefully there is a version of OpenSlide on the PATH we should use // 确保本系统已经安装了对应版本的openslide文件并设置了环境变量 // if (osName.startsWith("Windows")) { // log.info("已检测到您当前使用的系统为:WIN"); System.loadLibrary("openslide-jni"); // log.info("openslide-jni load success"); // } else { // linux的so包可以去相关网站下载或者按官网操作打包,目前作者还未用到 // log.info("已检测到您当前使用的系统为:Linux"); System.loadLibrary("libopenslide-jni"); // log.info("libopenslide-jni load success"); // } } catch (UnsatisfiedLinkError e) { try { // If we didn't succeed, try loading dependencies in reverse order log.error("Couldn't load OpenSlide directly, attempting to load dependencies first...", e); // if (osName.startsWith("Windows")) { // for (String lib : WIN_LIBRARIES) { // System.loadLibrary(lib); // } // } } catch (UnsatisfiedLinkError ignored) { } } try { // Finally try to get the library version log.info("OpenSlide version {}", OpenSlide.getLibraryVersion()); } catch (UnsatisfiedLinkError e) { log.error("Could not load OpenSlide native libraries", e); log.info("If you want to use OpenSlide, you'll need to get the native libraries (either building from source or with a packager manager)\n" + "and add them to your system PATH, including openslide-jni."); OPENSLIDE_UNAVAILABLE = true; } } /** * cutImg * 切割图片文件 * 这个用作本地测试 * * @author: chong * @param: infile 输入的文件 * @param: outfile 输出的文件目录 * @return: String 文件输出地址 * @description: 获取文件中的附带文件 * @date: 2022/4/19 */ public static List<String> cutImg(File infile, File outfile) { System.out.println(imgType); System.out.println(imgSize); // 自定义异常,可以根据自己的需要判断或者删除(相关类不进行粘贴) List<String> resultAddress = Lists.newArrayList(); String fileName = infile.getName(); String nameWithoutExtension = fileName.substring(0, fileName.lastIndexOf(Constants.DOT)); OpenSlide os = null; try { os = new OpenSlide(infile); int levelCount = os.getLevelCount(); System.out.println(levelCount); System.out.println(System.getProperty("java.library.path")); // 切割 for (int n = levelCount - 1; n > -1; n--) { //n表示层级,也表示需要创建的文件夹名字 int nHeight = (int) (os.getLevel0Height() / os.getLevelHeight(n)); //切高的次数 int nWidth = (int) (os.getLevel0Width() / os.getLevelWidth(n)); //切长的次数 for (int j = 0; j < nWidth; j++) { //循环切长 for (int i = 0; i < nHeight; i++) { //循环切高 BufferedImage th = os.createThumbnailImage((int) (j * os.getLevelWidth(n)), (int) (i * os.getLevelHeight(n)), os.getLevelWidth(n), os.getLevelHeight(n), imgSize); //开始切图 // 输出文件到对应目录 //创建目录 String resultName = outfile + File.separator + (n + 9) + File.separator + j + Constants.UNDERSCORE + i + Constants.DOT + imgType; File file = new File(outfile + File.separator + (n + 9)); if (!file.exists()) { System.out.println("文件不存在"); file.mkdirs();//创建失败会抛出异常throw new IOException("Invalid file path"); } ImageIO.write(th, imgType, new File(resultName)); System.out.println("保存成功:" + resultName); } } } // 附件获取 Map<String, AssociatedImage> map = os.getAssociatedImages(); for (Map.Entry<String, AssociatedImage> entry : map.entrySet()) { BufferedImage img = entry.getValue().toBufferedImage(); BufferedImage result = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_RGB); Graphics g = result.getGraphics(); g.drawImage(img, 0, 0, null); String resultName = outfile + File.separator + nameWithoutExtension + Constants.DASH + entry.getKey() + Constants.DOT + imgType; // 输出文件到对应目录 ImageIO.write(result, imgType, new File(resultName)); resultAddress.add(resultName); } return resultAddress; } catch (IOException e) { log.error("创建OS对象失败"); e.printStackTrace(); return null; } finally { assert os != null; os.close(); } } public static void main(String[] args) { cutImg(new File("D:\\photos\\CMU-1.tiff"), new File("D:\\photos")); } /** * cutFileToMinIo * 切割文件存放到minio * 这个用作将上传的文件进行切割保存至相关文件服务器上 * 由于这里是上传至minio的,所以会有bucketName和directory参数,可以自行进行修改,最后进行测试 * @param inFile * @param bucketName * @param directory * @author: chong * @description * @date 2022/5/10 */ // public MinioOpenSlideVo cutFileToMinIo(MultipartFile inFile, String bucketName, String directory) { // // 自定义异常,可以根据自己的需要判断或者删除(相关类不进行粘贴) // SysException.throwException(OPENSLIDE_UNAVAILABLE, ResultCodeEnum.FAIL.code(), "OpenSlide is unavailable - will be skipped"); // SysException.throwException(StringUtils.isBlank(inFile.getOriginalFilename()), ResultCodeEnum.NOT_FOUND.code(), "切割文件失败!文件不存在!--》" + inFile.getName()); // OpenSlide os = null; // File file = null; // MinioOpenSlideVo minioOpenSlideVo = new MinioOpenSlideVo(); // try { // // 转换临时文件 // file = FileUtils.multipartFileToFile(inFile); // String fileName = file.getName(); // String nameWithoutExtension = fileName.substring(0, fileName.lastIndexOf(Constants.POINT)); // os = new OpenSlide(file); // int levelCount = os.getLevelCount(); // // 切割 // for (int n = levelCount - 1; n > -1; n--) { //n表示层级,也表示需要创建的文件夹名字 // int nHeight = (int) (os.getLevel0Height() / os.getLevelHeight(n)); //切高的次数 // int nWidth = (int) (os.getLevel0Width() / os.getLevelWidth(n)); //切长的次数 // for (int j = 0; j < nWidth; j++) { //循环切长 // for (int i = 0; i < nHeight; i++) { //循环切高 // BufferedImage image = os.createThumbnailImage((int) (j * os.getLevelWidth(n)), (int) (i * os.getLevelHeight(n)), os.getLevelHeight(n), os.getLevelHeight(n), imgSize); //开始切图 // // 文件名 Constants.UNDERSCORE是下划线_ // String resultName = nameWithoutExtension + Constants.UNDERSCORE + j + Constants.UNDERSCORE + i + Constants.POINT + imgType; // // 文件存放位置 // String resultPath = directory + File.separator + n + File.separator + nameWithoutExtension + Constants.UNDERSCORE + j + Constants.UNDERSCORE + i; // // 输出流 // ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); // ImageIO.write(image, imgType, outputStream); // //转换为MultipartFile // MultipartFile multipartFile = new MockMultipartFile(resultName, resultName, "application/octet-stream", outputStream.toByteArray()); // // 上传minio // minIoUtils.upload(multipartFile, bucketName, resultPath); // } // } // } // // 附件获取 // Set<String> appendixes = new HashSet<>(); // Map<String, AssociatedImage> map = os.getAssociatedImages(); // for (Map.Entry<String, AssociatedImage> entry : map.entrySet()) { // BufferedImage image = entry.getValue().toBufferedImage(); // // BufferedImage result = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_RGB); // Graphics g = result.getGraphics(); // g.drawImage(image, 0, 0, null); // // 文件名 // String resultName = nameWithoutExtension + Constants.LINE + entry.getKey() + Constants.POINT + imgType; // // 文件存放位置 Constants.LINE是横线- // String resultPath = directory + File.separator + nameWithoutExtension + Constants.LINE + entry.getKey(); // // 输出流 // ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); // ImageIO.write(image, imgType, outputStream); // //转换为MultipartFile // MultipartFile multipartFile = new MockMultipartFile(resultName, resultName, "application/octet-stream", outputStream.toByteArray()); // // 上传minio // minIoUtils.upload(multipartFile, bucketName, resultPath); // appendixes.add(entry.getKey()); // } // log.info("文件切割成功!--》" + inFile.getOriginalFilename()); // minioOpenSlideVo.setLevelCount(levelCount); // minioOpenSlideVo.setAppendixes(appendixes); // return minioOpenSlideVo; // } catch (IOException e) { // log.error("文件切割失败!" + inFile.getOriginalFilename()); // e.printStackTrace(); // return null; // } finally { // // 删除临时文件 // FileUtils.deleteTempFile(file); // assert os != null; // os.close(); // } // } }
true
f0d20d6919669e48bd91a05f0cf8ec7f024b1578
Java
vipindhama/homemgt
/app/src/main/java/com/homeguide/database/DbHelper.java
UTF-8
10,578
2.546875
3
[]
no_license
package com.homeguide.database; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; import com.homeguide.models.MyExpense; import java.util.ArrayList; /** * Created by Shweta on 6/9/2016. */ public class DbHelper extends SQLiteOpenHelper { private final String TAG = "Dbhelper"; public static final String DATABASE_NAME = "home_guide.db"; public static final String ID = "ID"; public static final String NAME = "name"; public static final String EXPENSE_BY = "expenseBy"; public static final String DESCRIPTION = "description"; public static final String EXPENSE_TYPE = "expenseType"; public static final String EXPENSE_DATE = "expenseDate"; public static final String COST = "cost"; public static final String QTY = "qty"; public static final String CREATED_AT = "createdAt"; public static final String UPDATED_AT = "updatedAt"; public static final String COUNTER = "updatedAt"; private Context context; public DbHelper(Context context) { super(context, DATABASE_NAME, null, 6); this.context=context; } @Override public void onCreate(SQLiteDatabase db) { db.execSQL( "create table MyExpense " + "(ID INTEGER NOT NULL, " + " name TEXT NOT NULL, " + " expenseBy TEXT, " + " description TEXT, " + " expenseType TEXT, " + " expenseDate TEXT, " + " cost REAL, " + " qty INTEGER, " + " createdAt TEXT, " + " updatedAt TEXT)" ); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // db.execSQL("DROP TABLE IF EXISTS MyExpense"); db.execSQL( "alter table MyExpense add expenseBy TEXT" ); } public boolean insertExpenseItem(MyExpense item,String createdAt,String updatedAt) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues contentValues = new ContentValues(); contentValues.put(ID, item.getId()); contentValues.put(NAME, item.getName()); contentValues.put(EXPENSE_BY, item.getExpenseBy()); contentValues.put(DESCRIPTION, item.getDescription()); contentValues.put(EXPENSE_TYPE, item.getExpenseType()); contentValues.put(EXPENSE_DATE, item.getDate()); contentValues.put(COST, item.getCost()); contentValues.put(QTY, item.getQty()); contentValues.put(CREATED_AT, createdAt); contentValues.put(UPDATED_AT, updatedAt); db.insert("MyExpense", null, contentValues); return true; } public ArrayList<MyExpense> getExpenses(){ SQLiteDatabase db = this.getReadableDatabase(); final String query="select * from MyExpense"; Cursor res = db.rawQuery(query, null); // res.moveToFirst(); ArrayList<MyExpense> itemList=new ArrayList<>(); MyExpense item = null; if(res.moveToFirst()){ do{ item = new MyExpense(); item.setId(res.getInt(res.getColumnIndex(ID))); item.setExpenseBy(res.getString(res.getColumnIndex(EXPENSE_BY))); item.setName(res.getString(res.getColumnIndex(NAME))); item.setDescription(res.getString(res.getColumnIndex(DESCRIPTION))); item.setExpenseType(res.getString(res.getColumnIndex(EXPENSE_TYPE))); item.setDate(res.getString(res.getColumnIndex(EXPENSE_DATE))); item.setCost(res.getFloat(res.getColumnIndex(COST))); item.setQty(res.getInt(res.getColumnIndex(QTY))); itemList.add(item); }while (res.moveToNext()); } return itemList; } public MyExpense getExpense(String id){ Log.i(TAG,"id "+id); SQLiteDatabase db = this.getReadableDatabase(); final String query="select * from MyExpense where "+ID+" = ?"; Cursor res = db.rawQuery(query, new String[]{id}); Log.i(TAG,"size "+res.getCount()); MyExpense item = null; if(res.moveToFirst()){ item = new MyExpense(); item.setId(res.getInt(res.getColumnIndex(ID))); item.setName(res.getString(res.getColumnIndex(NAME))); item.setExpenseBy(res.getString(res.getColumnIndex(EXPENSE_BY))); item.setDescription(res.getString(res.getColumnIndex(DESCRIPTION))); item.setExpenseType(res.getString(res.getColumnIndex(EXPENSE_TYPE))); item.setDate(res.getString(res.getColumnIndex(EXPENSE_DATE))); item.setCost(res.getFloat(res.getColumnIndex(COST))); item.setQty(res.getInt(res.getColumnIndex(QTY))); } return item; } public ArrayList<MyExpense> getExpenses(String fromDate,String toDate){ Log.i(TAG,fromDate+" "+toDate); SQLiteDatabase db = this.getReadableDatabase(); final String query="select * from MyExpense where date("+EXPENSE_DATE+") >= date(?) and " + "date("+EXPENSE_DATE+") <= date(?)"; Cursor res = db.rawQuery(query, new String[]{fromDate,toDate}); // res.moveToFirst(); ArrayList<MyExpense> itemList=new ArrayList<>(); MyExpense item = null; if(res.moveToFirst()){ do{ item = new MyExpense(); item.setId(res.getInt(res.getColumnIndex(ID))); item.setName(res.getString(res.getColumnIndex(NAME))); item.setExpenseBy(res.getString(res.getColumnIndex(EXPENSE_BY))); item.setDescription(res.getString(res.getColumnIndex(DESCRIPTION))); item.setExpenseType(res.getString(res.getColumnIndex(EXPENSE_TYPE))); item.setDate(res.getString(res.getColumnIndex(EXPENSE_DATE))); item.setCost(res.getFloat(res.getColumnIndex(COST))); item.setQty(res.getInt(res.getColumnIndex(QTY))); itemList.add(item); }while (res.moveToNext()); } return itemList; } public float getTotalExpenses(String fromDate,String toDate){ SQLiteDatabase db = this.getReadableDatabase(); final String query="select sum("+COST+") as totalExp from MyExpense where date("+EXPENSE_DATE+") >= date(?) and " + "date("+EXPENSE_DATE+") <= date(?)"; Cursor res = db.rawQuery(query, new String[]{fromDate,toDate}); res.moveToFirst(); float sum = res.getFloat(res.getColumnIndex("totalExp")); Log.i(TAG,"Sum "+sum); return sum; } public int getExpensesId(){ SQLiteDatabase db = this.getReadableDatabase(); final String query="select max(ID) as maxID from MyExpense"; Cursor res = db.rawQuery(query, null); res.moveToFirst(); int id = res.getInt(res.getColumnIndex("maxID")); Log.i(TAG,"max id "+id); return ++id; } public ArrayList<String> getExpenseTypes(){ SQLiteDatabase db = this.getReadableDatabase(); final String query="select DISTINCT "+EXPENSE_TYPE+" from MyExpense"; Cursor res = db.rawQuery(query, null); // res.moveToFirst(); ArrayList<String> itemList=new ArrayList<>(); if(res.moveToFirst()){ do{ itemList.add(res.getString(res.getColumnIndex(EXPENSE_TYPE))); }while (res.moveToNext()); } return itemList; } public ArrayList<String> getExpenseByNames(){ SQLiteDatabase db = this.getReadableDatabase(); final String query="select DISTINCT "+EXPENSE_BY+" from MyExpense"; Cursor res = db.rawQuery(query, null); // res.moveToFirst(); ArrayList<String> itemList=new ArrayList<>(); if(res.moveToFirst()){ do{ if(res.getString(res.getColumnIndex(EXPENSE_BY)) != null && !res.getString(res.getColumnIndex(EXPENSE_BY)).equals("null")) itemList.add(res.getString(res.getColumnIndex(EXPENSE_BY))); }while (res.moveToNext()); } return itemList; } public boolean isExpenseTypeExist(String type){ SQLiteDatabase db = this.getReadableDatabase(); final String query="select count(*) as counter from MyExpense where "+EXPENSE_TYPE+" = ?"; Cursor res = db.rawQuery(query, new String[]{type}); boolean exist = false; if(res.moveToFirst()){ if(res.getInt(res.getColumnIndex("counter")) > 0) exist = true; } return exist; } public boolean isExpenseByExist(String by){ SQLiteDatabase db = this.getReadableDatabase(); final String query="select count(*) as counter from MyExpense where "+EXPENSE_BY+" = ?"; Cursor res = db.rawQuery(query, new String[]{by}); boolean exist = false; if(res.moveToFirst()){ if(res.getInt(res.getColumnIndex("counter")) > 0) exist = true; } return exist; } public boolean updateExpenseData(MyExpense item,String updatedAt) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues contentValues = new ContentValues(); contentValues.put(NAME, item.getName()); contentValues.put(EXPENSE_BY, item.getExpenseBy()); contentValues.put(DESCRIPTION, item.getDescription()); contentValues.put(EXPENSE_TYPE, item.getExpenseType()); contentValues.put(EXPENSE_DATE, item.getDate()); contentValues.put(COST, item.getCost()); contentValues.put(QTY, item.getQty()); contentValues.put(UPDATED_AT, updatedAt); db.update("MyExpense", contentValues, ID+" = ? ", new String[]{String.valueOf(item.getId())}); db.close(); return true; } public void deleteExpenseItem(int id) { SQLiteDatabase db = this.getWritableDatabase(); db.delete("MyExpense", ID+"=?", new String[]{String.valueOf(id)}); db.close(); } public boolean dropAndCreateBookingTable(){ SQLiteDatabase db = this.getWritableDatabase(); db.execSQL("DROP TABLE IF EXISTS MyExpense"); onCreate(db); return true; } }
true
d70e4212385f8ae57df7c783d7c6fabbaa41cb56
Java
KapaleAnup/Excerises
/src/main/java/practice/practice1/MinandMAxFromArray.java
UTF-8
462
2.84375
3
[]
no_license
package practice.practice1; public class MinandMAxFromArray { public static void main(String[] args) { int a[] = {23, 45, 56, 67}; int max = a[0]; int min = a[0]; for (int i = 1; i < a.length; i++) { if (a[i] > max) { max = a[i]; }else if(a[i]<min){ min = a[i]; } } System.out.println(max); System.out.println(min); } }
true
a0c8f4c2b5341073996fa5c37c28656ab6366d2b
Java
NibeditaPanda/TrialPOC
/src/main/java/com/tesco/services/adapters/rpm/readers/PriceServiceCSVReader.java
UTF-8
205
1.757813
2
[]
no_license
package com.tesco.services.adapters.rpm.readers; import java.io.IOException; import java.util.Map; public interface PriceServiceCSVReader { public Map<String, String> getNext() throws IOException; }
true
83dde9ef3dc44f0e507f3ab68244008c7e7c2e8e
Java
FS1360472174/javaweb
/web/src/main/java/com/fs/web/instance/InstanceBySpring.java
UTF-8
1,194
2.421875
2
[]
no_license
/* * InstanceBySpring.java */ package com.fs.web.instance; import com.fs.web.instance.state.AbstractState; import com.fs.web.instance.state.StateEnum; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; /** * @author fangzhang * @Service不能少,需要注入进去 */ @Service public class InstanceBySpring implements StateFactory<AbstractState>, InitializingBean { private static Map<StateEnum, AbstractState> map = new HashMap<>(); @Autowired private List<AbstractState> states; @Override public void afterPropertiesSet() throws Exception { if (!CollectionUtils.isEmpty(states)) { map = states.stream().collect(Collectors.toMap(v -> v .getCode(), Function.identity())); } } @Override public AbstractState getInstance(final StateEnum stateEnum) { return map.get(stateEnum); } }
true
84b86aed1d354bd9499100bd2af88fd52fd812d9
Java
Mrjiangzhu/test
/src/main/java/com/ruofeng/app/common/configuration/BeetlSqlConfiguration.java
UTF-8
965
2.046875
2
[]
no_license
package com.ruofeng.app.common.configuration; import com.alibaba.druid.pool.DruidDataSource; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import javax.sql.DataSource; public class BeetlSqlConfiguration { @Bean(name = { "datasource" }, initMethod = "init", destroyMethod = "close") @ConfigurationProperties(prefix = "spring.datasource.druid") public DataSource dataSource() { return (DataSource) (new DruidDataSource()); } @Bean(name = { "txManager" }) public DataSourceTransactionManager getDataSourceTransactionManager( @Qualifier("datasource") DataSource datasource) { DataSourceTransactionManager dsm = new DataSourceTransactionManager(); dsm.setDataSource(datasource); return dsm; } }
true
54a47c9ed231bad35d571c62500ac878537bd848
Java
cota990/MJCompiler-pp1
/src/rs/ac/bg/etf/pp1/ActualParametersCodeGenerator.java
UTF-8
1,334
2.796875
3
[]
no_license
package rs.ac.bg.etf.pp1; import rs.ac.bg.etf.pp1.ast.*; public class ActualParametersCodeGenerator extends VisitorAdaptor { private int depth; private int actParsStarted = 0; /** * @param depth */ public ActualParametersCodeGenerator(int depth) { this.depth = depth; } /** For each actual parameter start new generator */ public void visit(SingleActPar sap) { if (actParsStarted == 0) { if (sap.getExpr() instanceof ExprWithAssign) { ExpressionRightAssocCodeGenerator parameterGenerator = new ExpressionRightAssocCodeGenerator(); sap.getExpr().traverseBottomUp(parameterGenerator); } else if (sap.getExpr() instanceof ExprWithoutAssign) { ExpressionLeftAssocCodeGenerator parameterGenerator = new ExpressionLeftAssocCodeGenerator(depth); sap.getExpr().traverseBottomUp(parameterGenerator); } } } /**Method designator; if gets here, it means atgument of this method is another method, so skip generating code until its done */ public void visit(MethodDesignator lp) { SyntaxNode parent = lp.getParent(); if (parent instanceof MethodCallFactor) { actParsStarted++; } } /** method called, continue with generating */ public void visit(MethodCallFactor mcf) { actParsStarted--; } }
true
855b2ef47754e3fcb95a9c1c940081ed3da6a21f
Java
tioola/clist
/clist-mongo-infrastructure/src/main/java/com/clist/repositories/mongo/infra/UserRepositoryInfra.java
UTF-8
296
1.523438
2
[]
no_license
package com.clist.repositories.mongo.infra; import org.springframework.data.mongodb.repository.MongoRepository; import com.clist.domain.entities.User; import com.clist.repositories.UserRepository; public interface UserRepositoryInfra extends MongoRepository<User, String> , UserRepository{ }
true
08bccdb374605aa17e074b3f464c5074315b4645
Java
bellmit/pearls
/pearls-iot/common/src/main/java/com/vela/iot/common/bean/Gateway.java
UTF-8
3,213
2.65625
3
[]
no_license
package com.vela.iot.common.bean; import java.util.EnumMap; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import static com.vela.iot.common.util.StringUtils.*; public enum Gateway { // perf "String"比String.class性能提供1倍 sn("String"), pwd("String"), slt("String"), key("String"), scrt("String"), acKey( "String"), acScrt("String"), active("Boolean"), activeTime("Long"), resetNum( "Integer"), activated("Boolean"), ability("Integer"), deadline( "Long"); final String cls; Gateway(String cls) { this.cls = cls; } public final String getCls() { return cls; } public static final Map<String, String> enumToHash( Map<Gateway, Object> enumMap) { Map<String, String> hashMap = new HashMap<>(); // perf lambda写法性能很差 // enumMap.forEach((k,v) -> hashMap.put(k.name(), v.toString())); for (Entry<Gateway, Object> entry : enumMap.entrySet()) { hashMap.put(entry.getKey().name(), entry.getValue().toString()); } return hashMap; } public static final Map<Gateway, Object> hashToEnum( Map<String, String> hashMap) { Map<Gateway, Object> enumMap = new EnumMap<Gateway, Object>( Gateway.class); for (Entry<String, String> entry : hashMap.entrySet()) { Gateway gw = Gateway.valueOf(entry.getKey()); enumMap.put(gw, strToObj(entry.getValue(), gw.getCls())); } return enumMap; } } // public class Gateway { // private String sn; // private String pwd; // private String key; // private String scrt; // private String acKey; // private String acScrt; // private boolean active; // private long activeTime; // private int resetNum; // private boolean activated; // private int ability; // private long deadline; // public String getSn() { // return sn; // } // public void setSn(String sn) { // this.sn = sn; // } // public String getPwd() { // return pwd; // } // public void setPwd(String pwd) { // this.pwd = pwd; // } // public String getKey() { // return key; // } // public void setKey(String key) { // this.key = key; // } // public String getScrt() { // return scrt; // } // public void setScrt(String scrt) { // this.scrt = scrt; // } // public String getAcKey() { // return acKey; // } // public void setAcKey(String acKey) { // this.acKey = acKey; // } // public String getAcScrt() { // return acScrt; // } // public void setAcScrt(String acScrt) { // this.acScrt = acScrt; // } // // public long getActiveTime() { // return activeTime; // } // public void setActiveTime(long activeTime) { // this.activeTime = activeTime; // } // public int getResetNum() { // return resetNum; // } // public void setResetNum(int resetNum) { // this.resetNum = resetNum; // } // // public boolean isActive() { // return active; // } // public void setActive(boolean active) { // this.active = active; // } // public boolean isActivated() { // return activated; // } // public void setActivated(boolean activated) { // this.activated = activated; // } // public int getAbility() { // return ability; // } // public void setAbility(int ability) { // this.ability = ability; // } // public long getDeadline() { // return deadline; // } // public void setDeadline(long deadline) { // this.deadline = deadline; // } // }
true
596acb360d106d683e06e4a79fdf0f493e22e0c6
Java
weifeng17183/chebao
/src/main/java/com/justfind/vo/UserContext.java
UTF-8
1,071
2.390625
2
[]
no_license
package com.justfind.vo; import javax.servlet.http.HttpSession; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; /** * 用于存放当前用户的上下文(获取当前用户) * @author pc * */ public class UserContext { public static final String USER_IN_SESSION="logininfo"; public static final String VERIFYCODE_IN_SESSION="verifycode_in_session"; /** * 从当前线程中获取session * @return */ private static HttpSession getSession(){ return ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest().getSession(); } /** * 从当前线程中获取验证码 * @return */ public static VerifyCodeVO getCurrentVerifyCode(){ return (VerifyCodeVO) getSession().getAttribute(VERIFYCODE_IN_SESSION); } /** * 把验证码放入到session中 * @param vc */ public static void putVerifyCode(VerifyCodeVO vc){ getSession().setAttribute(VERIFYCODE_IN_SESSION, vc); } }
true
1128437973747b543954f1f44dcaf06d1c381ac6
Java
ranajeetjadhav/Java-Algorithms
/src/com/algo/sort/number/patterns/Pattern_5.java
UTF-8
516
3.515625
4
[]
no_license
/** * 7 6 5 4 3 2 1 7 6 5 4 3 2 7 6 5 4 3 7 6 5 4 7 6 5 7 6 7 7 6 7 6 5 7 6 5 4 7 6 5 4 3 7 6 5 4 3 2 7 6 5 4 3 2 1 */ package com.algo.sort.number.patterns; public class Pattern_5 { public static void main(String[] args) { for(int i = 1; i <= 7; i++){ for(int j = 7; j >= i; j--){ System.out.print(j+" "); } System.out.println(); } for(int i = 6; i >= 1; i--){ for(int j = 7; j >= i; j--){ System.out.print(j+" "); } System.out.println(); } } }
true
8ffa436e042c13aa5482aa69cd2b95e33927e170
Java
marcelolimabh/estoqueWS
/estoqueWS/src/br/com/caelum/estoque/modelo/usuario/AuthorizationException.java
UTF-8
539
2.109375
2
[]
no_license
/** * */ package br.com.caelum.estoque.modelo.usuario; import java.util.Date; import javax.xml.ws.WebFault; import br.com.caelum.estoque.modelo.util.InfoFault; /** * @author marcelolimabh * */ @WebFault(name="AuthorizationFault") public class AuthorizationException extends Exception { /** * */ private static final long serialVersionUID = 1L; public AuthorizationException(String msg) { super(msg); } public InfoFault getFaultInfo(){ return new InfoFault("Token Inválido", new Date()); } }
true
d33d10270d95d38246976e46dfbb74e5ed159839
Java
Valentindp/LevelUp
/src/HomeWorkInteface/Beverages.java
UTF-8
548
2.921875
3
[]
no_license
package HomeWorkInteface; /** * Created by Валентин on 09.10.2016. */ public class Beverages extends Food implements Edible { @Override public Flavour getFlavour() { return Flavour.BITTER; } @Override int getWeight() { return 0; } @Override void setWeight(int weight) { } public Beverages(String name, double weight, double price, double calories) { super(name, weight, price, calories); } @Override public double getCalories() { return 0; } }
true
9bebd04e85f4064967a046caa2fe5951a56a1394
Java
TianLuhua/I9sMonitor
/app/src/main/java/com/tencent/devicedemo/BinderListAdapter.java
UTF-8
1,769
2.40625
2
[]
no_license
package com.tencent.devicedemo; import android.content.Context; import android.content.Intent; import com.tencent.device.TXBinderInfo; import java.util.ArrayList; import java.util.List; public class BinderListAdapter extends ListAdapter { private static String TAG = "BinderListAdapter"; private List<TXBinderInfo> mListBinder = new ArrayList<>(); private Context mContext; public BinderListAdapter(Context applicationContext) { // TODO Auto-generated constructor stub super(applicationContext); mContext = applicationContext; } public void freshBinderList(List<TXBinderInfo> binderList){ mListBinder.clear(); for (int i = 0; i < binderList.size(); ++i){ TXBinderInfo binder = binderList.get(i); mListBinder.add(binder); } notifyDataSetChanged(); } @Override public ListItemInfo getListItemInfo(int index) { ListItemInfo item = new ListItemInfo(); TXBinderInfo binder = mListBinder.get(index); item.id = binder.tinyid; item.head_url = binder.head_url; item.type = ListItemInfo.LISTITEM_TYPE_BINDER; item.nick_name = binder.getNickName(); return item; } @Override public void onItemClicked(int index) { ListItemInfo item = getListItemInfo(index); Intent binder = new Intent(mContext, BinderActivity.class); binder.putExtra("tinyid", item.id); binder.putExtra("nickname", item.nick_name); binder.putExtra("type", item.type); mContext.startActivity(binder); } @Override public int getCount() { // TODO Auto-generated method stub return mListBinder.size(); } @Override public Object getItem(int arg0) { // TODO Auto-generated method stub return mListBinder.get(arg0); } @Override public long getItemId(int arg0) { // TODO Auto-generated method stub return arg0; } }
true
dc95d03bd7bf2c6d805e28c0d17308b8c6f5a76f
Java
juanipicart/GeoPosUy
/GeoPosUy/EJB/com/bd/DBConector.java
WINDOWS-1250
3,190
2.859375
3
[]
no_license
package com.bd; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Locale; import javax.naming.Context; import javax.naming.InitialContext; import javax.sql.DataSource; public class DBConector { private final String dataSrc = "java:/OracleDS"; //private final String usr = "proyecto"; //private final String pwd = "proyecto"; //private final String srv = "127.0.0.1"; //private final String instancia = "xe"; private Connection sqlCnn = null; private static DBConector conector; private PreparedStatement prepstmt; private Statement stmt; private ResultSet resultset; // creo la conexion si no existe public static DBConector getinstance() { if ( DBConector.conector == null) { System.out.println("Nueva instancia DBConexion.."); conector = new DBConector(); } System.out.println("Ya existe Instancia DBConexion.."); return conector; } // Preparar una SQL prepared statement para no tener que hacer una asignacion afuera public void setPrepStmt(String Sttm) { try { prepstmt = this.sqlCnn.prepareStatement(Sttm); System.out.println("Ejecut seteo consulta pre parseada..=" + Sttm); } catch (SQLException e) { System.out.println("Error en Prepared Statement-->"); e.printStackTrace(); } } // devolver el objeto prepared para setearle los parametros afuera public PreparedStatement getPrepStmt() { return this.prepstmt; } public ResultSet getResultSet() { return this.resultset; } public int execDML() { int i = -1; try { i = this.prepstmt.executeUpdate(); System.out.println("Ejecut DML.."); } catch (SQLException e) { System.out.println("Error al ejecutar DDL-->"); e.printStackTrace(); } return i; } // ejecutar consulta SQL Prepared public void execQry() { try { this.resultset = this.prepstmt.executeQuery(); System.out.println("Ejecut consulta pre parseada.."); } catch (SQLException e) { System.out.println("Error al ejecutar Consulta-->"); e.printStackTrace(); } } // Ejecutar una SQL simple public void execStmt(String Sttm) { try { stmt = this.sqlCnn.createStatement(); this.resultset = stmt.executeQuery(Sttm); System.out.println("Ejecut consulta simple..=" +Sttm); } catch (SQLException e) { System.out.println("Error en Statement-->"); e.printStackTrace(); } } // Contructor que crea la conexion a la bd. es un singleton para mantener una sola instancia de dichas conexiones protected DBConector() { Locale.setDefault(Locale.ENGLISH); Context ctx; // contexto jndi DataSource ds; // datasource // Relizar la conexion via datasource try { ctx = new InitialContext(); System.out.println("Contexto cargado..."); ds = (DataSource) ctx.lookup(dataSrc); System.out.println("Encontr el Datasource..."); this.sqlCnn = ds.getConnection(); System.out.println("Capturo la conexion.."); }catch (Exception e) { System.out.println("Error al buscar Driver Oracle-->" +e.getMessage()); e.printStackTrace(); } System.out.println("Conectado.."); } }
true
8cbc85aa55bdad1a216de24a702eacebea194537
Java
AlexResonable/Java
/src/gameDesigner/ModifyGameDesign.java
UTF-8
10,620
2.515625
3
[]
no_license
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package gameDesigner; import systemAdministrator.Login; import gameDesigner.setBoard; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; import javax.swing.border.Border; import javax.swing.border.EtchedBorder; /** * * @author kamijean2 */ public class ModifyGameDesign implements ActionListener { setBoard board = new setBoard(); int sizeX = 20; int sizeY = 20; int playerNum = 4; int turnNum = 10; int gameNum = 30; int pieceNum = 21; private JFrame window = new JFrame("Modify Game Design"); private JLabel header = new JLabel("Modify Game Board"); private JComboBox gameList = new JComboBox(); private JComboBox difficultList = new JComboBox(); private JButton logout = new JButton("Logout"); private SpinnerModel gameSizeModel = new SpinnerNumberModel(getSizeX(), 20, 100, 10); private JSpinner size1 = new JSpinner(gameSizeModel); private SpinnerModel gameSizeModel2 = new SpinnerNumberModel(getSizeY(), 20, 100, 10); private JSpinner size2 = new JSpinner(gameSizeModel2); private SpinnerModel model = new SpinnerNumberModel(getPlayerNum(), 2, 4, 1); private JSpinner players = new JSpinner(model); private SpinnerModel turnModel = new SpinnerNumberModel(getTurnNum(), 3, 99, 1); private JSpinner turnTime = new JSpinner(turnModel); private SpinnerModel gameModel = new SpinnerNumberModel(getGameNum(), 5, 120, 1); private JSpinner gameTime = new JSpinner(gameModel); private SpinnerModel pieceModel = new SpinnerNumberModel(getPieceNum(), 21, 120, 1); private JSpinner pieces = new JSpinner(pieceModel); private JButton boardButton = new JButton("Edit Board"); private JButton piecesButton = new JButton("Edit Pieces"); private JButton createNewButton = new JButton("New"); private JButton saveButton = new JButton("Save Design"); private JButton deleteButton = new JButton("Detele"); private JPanel innerPane = new JPanel(); public int getGameNum() { return gameNum; } private void setGameNum(int gameNum) { this.gameNum = gameNum; } public int getPieceNum() { return pieceNum; } private void setPieceNum(int pieceNum) { this.pieceNum = pieceNum; } public int getPlayerNum() { return playerNum; } private void setPlayerNum(int playerNum) { this.playerNum = playerNum; } public int getSizeX() { return sizeX; } private void setSizeX(int sizeX) { this.sizeX = sizeX; } public int getSizeY() { return sizeY; } private void setSizeY(int sizeY) { this.sizeY = sizeY; } public int getTurnNum() { return turnNum; } private void setTurnNum(int turnNum) { this.turnNum = turnNum; } public void run(){ this.createDesignerMain(); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); int width = window.getSize().width; int height = window.getSize().height; int x = (d.width-width)/2; int y = (d.height-height)/2; window.setLocation(x, y); window.setVisible(true); } public ModifyGameDesign(setBoard game){ this.setSizeX(game.getSizeX()); this.setSizeY(game.getSizeY()); this.setTurnNum(game.getTurnTime()); this.setGameNum(game.getGameTime()); this.setPlayerNum(game.getPlayerNumber()); this.setPieceNum(game.getPieceNumber()); this.board = game; } private void createDesignerMain(){ window.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0; c.gridwidth = 2; c.insets = new Insets(10,40,0,60); header.setName("Modify Game Board"); header.setFont(new Font("Arial", Font.PLAIN, 24)); window.add(header, c); c.gridx=2; c.gridy=0; c.insets = new Insets(10,50,0,60); logout.setContentAreaFilled(false); logout.setBorderPainted(false); logout.setForeground(Color.blue); logout.addActionListener(this); logout.setName("Logout"); window.add(logout, c); Border borderBlack = BorderFactory.createEtchedBorder(EtchedBorder.RAISED, Color.lightGray, Color.blue); innerPane.setLayout(new GridBagLayout()); c.gridx = 0; c.gridy = 0; c.gridwidth =2; c.insets = new Insets(15,20,5,0); JLabel j1 = new JLabel("Choose Designed Game "); j1.setName("Choose Designed Game "); innerPane.add(j1,c); c.gridx = 1; c.gridy = 0; c.insets = new Insets(15,0,5,0); innerPane.add(gameList); c.gridx = 2; c.gridy =0; c.insets = new Insets(15, 0, 5, 0); innerPane.add(difficultList); c.gridx = 0; c.gridy = 1; c.gridwidth =1; c.insets = new Insets(15,20,5,20); JLabel j2 = new JLabel("Game Board Size "); j2.setName("Game Board Size "); innerPane.add(j2,c); c.gridx = 1; c.gridy = 1; c.insets = new Insets(15,0,5,0); size1.setValue(getSizeX()); size1.setName("game size1"); innerPane.add(size1,c); c.gridx = 2; c.gridy = 1; JLabel j3 = new JLabel(" x "); j3.setName(" x "); innerPane.add(j3,c); c.gridx = 3; c.gridy = 1; c.insets = new Insets(15,0,5,10); size2.setValue(getSizeY()); size2.setName("game size2"); innerPane.add(size2,c); c.gridx = 0; c.gridy = 2; c.insets = new Insets(5,20,5,20); JLabel j4 = new JLabel("Number of Players "); j4.setName("Number of Players "); innerPane.add(j4,c); c.gridx = 1; c.gridy = 2; c.insets = new Insets(5,0,5,0); players.setName("player numbers"); players.setValue(getPlayerNum()); innerPane.add(players,c); c.gridx = 0; c.gridy = 3; c.insets = new Insets(5,20,5,20); JLabel j5 = new JLabel("Turn Time (seconds) "); j5.setName("Turn Time (seconds) "); innerPane.add(j5,c); c.gridx = 1; c.gridy = 3; c.insets = new Insets(5,0,5,0); turnTime.setValue(getTurnNum()); turnTime.setName("turnTime"); innerPane.add(turnTime,c); c.gridx = 0; c.gridy = 4; c.insets = new Insets(5,20,5,20); JLabel j6 = new JLabel("Game Time (minutes)"); j6.setName("Game Time (minutes)"); innerPane.add(j6,c); c.gridx = 1; c.gridy = 4; c.insets = new Insets(5,0,5,0); gameTime.setName("GameTime"); gameTime.setValue(getGameNum()); innerPane.add(gameTime,c); c.gridx = 0; c.gridy = 5; c.insets = new Insets(5,20,5,20); JLabel j7 = new JLabel("Number of Pieces"); j7.setName("Number of Pieces"); innerPane.add(j7,c); c.gridx = 1; c.gridy = 5; c.insets = new Insets(5,0,5,0); pieces.setName("pieces numbers"); pieces.setValue(getPieceNum()); innerPane.add(pieces,c); c.gridx = 0; c.gridy = 6; c.gridwidth = 3; c.insets = new Insets(20,0,15,130); innerPane.add(boardButton,c); boardButton.setName("Edit Board"); boardButton.addActionListener(this); c.gridx=2; c.gridy=6; c.insets = new Insets(20,50,15,0); deleteButton.setName("Delete"); deleteButton.setForeground(Color.red); deleteButton.addActionListener(this); innerPane.add(deleteButton, c); innerPane.setBorder(borderBlack); c.gridx = 0; c.gridy = 2; c.gridwidth = 1; c.gridwidth = 4; c.insets = new Insets(0,30,20,30); window.add(innerPane,c); c.gridx = 0; c.gridy = 3; c.insets = new Insets(0,30,20,350); window.add(createNewButton, c); createNewButton.setName("New"); createNewButton.addActionListener(this); c.gridx = 2; c.gridy = 3; c.insets = new Insets(0,30,20,30); saveButton.setName("Save"); window.add(saveButton, c); saveButton.addActionListener(this); window.pack(); } @Override public void actionPerformed(ActionEvent ae) { if(ae.getSource() == logout){ //logout and send to main menu window.dispose();//setVisible(false); Login lg = new Login(); lg.run(); } else if(ae.getSource()== logout) { window.dispose(); Login lg = new Login(); lg.run(); } else if(ae.getSource() == createNewButton){ //take back to main menu screen //setVisible(false); } else if(ae.getSource() == boardButton){ //take to board where you can edit which squares are blocked window.dispose();//setVisible(false); board = new setBoard((Integer)size1.getValue(), (Integer)size2.getValue()); board.setGameTime((Integer)gameTime.getValue()); board.setPieceNumber((Integer)pieces.getValue()); board.setPlayerNumber((Integer)players.getValue()); board.setTurnTime((Integer)turnTime.getValue()); EditBoard editBoard = new EditBoard(board); editBoard.run(); } else if(ae.getSource() == saveButton){ //save board to database and then take back to menu with it added to the GUI // window.dispose();//setVisible(false); JOptionPane.showMessageDialog(null, "Game Board Options have been Saved!"); // GameDesignerMain game = new GameDesignerMain(); // game.run(); } } public JFrame getWindow() { return window; } }
true
35fedf5132e1e3c6cec37d68f2542876a9703bcc
Java
Gaz1676/twitter-android-app
/app/src/main/java/app/tweeting/activities/SignupActivity.java
UTF-8
3,276
2.328125
2
[]
no_license
/** * Author: Gary Fleming * Student No: 20019497 * Start Date: Sept 24th 2017 */ package app.tweeting.activities; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.TextView; import app.tweeting.R; import app.tweeting.helpers.ValidateHelper; import app.tweeting.main.MyTweetApp; import app.tweeting.models.User; import static app.tweeting.helpers.MediaPlayerHelper.invalidInput; import static app.tweeting.helpers.MediaPlayerHelper.validInput; import static app.tweeting.helpers.ToastHelper.createToastMessage; public class SignupActivity extends AppCompatActivity { /** * Signup Activity Referenced from: * https://wit-ictskills-2017.github.io/mobile-app-dev/topic02-b/book-a-donation-03/index.html#/Donation-03 */ // called to do initial creation of the activity @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_signup); Button signup_button = (Button) findViewById(R.id.signupButton); signup_button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { signup(view); } }); } // details of new user created on sign up and saved in MyTweetApp Object public void signup(View view) { TextView firstName = (TextView) findViewById(R.id.signupFirstName); TextView lastName = (TextView) findViewById(R.id.signupLastName); TextView email = (TextView) findViewById(R.id.signupEmail); TextView password = (TextView) findViewById(R.id.signupPassword); if (!ValidateHelper.isValidInput(firstName.getText().toString())) { invalidInput(this); firstName.setError("Please input first name"); } else if (!ValidateHelper.isValidName(firstName.getText().toString())) { invalidInput(this); firstName.setError("Only use letters"); } else if (!ValidateHelper.isValidInput(lastName.getText().toString())) { invalidInput(this); lastName.setError("Please input last name"); } else if (!ValidateHelper.isValidName(lastName.getText().toString())) { invalidInput(this); lastName.setError("Only use letters"); } else if (!ValidateHelper.isValidEmail(email.getText().toString())) { invalidInput(this); email.setError("Please enter a valid email"); } else if (!ValidateHelper.isValidInput(password.getText().toString())) { invalidInput(this); password.setError("Please enter password"); } else { User user = new User(firstName.getText().toString(), lastName.getText().toString(), email.getText().toString(), password.getText().toString()); MyTweetApp app = MyTweetApp.getApp(); app.userStore.addUser(user); app.userStore.saveUsers(); startActivity(new Intent(this, TimelineActivity.class)); validInput(this); createToastMessage(this, "Welcome to MyTweetApp!"); } } }
true
7e2a2aa68097014c0b42ce470e99d5d00c76579b
Java
Desirous1/training-solutions
/src/main/java/exam03/Histogram.java
UTF-8
882
3.234375
3
[]
no_license
package exam03; import java.io.BufferedReader; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; public class Histogram { public void readFile() { Path file = Path.of("resources/Histogram.txt"); try (BufferedReader readFile = Files.newBufferedReader(file)) { createHistogram(readFile); } catch (IOException ioe) { throw new IllegalStateException("can not read file", ioe); } } public String createHistogram(BufferedReader paraReader) throws IOException { StringBuilder sb = new StringBuilder(); String line; while((line=paraReader.readLine()) != null){ int q = Integer.parseInt(line); for (int i=1; i<=q;i++){ sb.append("*"); } sb.append("\n"); } return sb.toString(); } }
true
d79b923c1c33b2f8021366b8a32f1a7fee21b0e4
Java
afirez/irouter
/irouter_provider_api/src/main/java/com/afirez/irouter/provider/api/ProviderRouter.java
UTF-8
185
1.59375
2
[ "Apache-2.0" ]
permissive
package com.afirez.irouter.provider.api; import com.afirez.irouter.router.Path; public interface ProviderRouter { @Path("/irouter/provider/nav") NavProvider navProvider(); }
true
c3389edce3ad83526e1d8501964ce6424f61a660
Java
teos0009/mqtt-spy
/mqtt-spy-common/src/main/java/pl/baczkowicz/mqttspy/exceptions/MqttSpyUncaughtExceptionHandler.java
UTF-8
1,182
2.09375
2
[]
no_license
/*********************************************************************************** * * Copyright (c) 2014 Kamil Baczkowicz * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v1.0 which accompany this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Eclipse Distribution License is available at * http://www.eclipse.org/org/documents/edl-v10.php. * * Contributors: * * Kamil Baczkowicz - initial API and implementation and/or initial documentation * */ package pl.baczkowicz.mqttspy.exceptions; import java.lang.Thread.UncaughtExceptionHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Used for catching any uncaught exceptions. */ public class MqttSpyUncaughtExceptionHandler implements UncaughtExceptionHandler { private final static Logger logger = LoggerFactory.getLogger(MqttSpyUncaughtExceptionHandler.class); @Override public void uncaughtException(Thread t, Throwable e) { logger.error("Thread " + t + " failed with " + e, e); } }
true
d59f69415829660d3b5e39b39979e2c2b40a3da3
Java
ARAMULEWESLEY/ERestaurant
/ERestro/src/main/java/Beans/CustomerBean.java
UTF-8
3,169
2.34375
2
[]
no_license
package Beans; import java.io.Serializable; import java.time.Instant; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.Date; import javax.faces.bean.*; import org.apache.commons.codec.digest.DigestUtils; import javax.inject.*; import org.springframework.context.annotation.Scope; import Services.CustomerService; import com.bionic.edu.ERestro.Customer; @Named @Scope("session") public class CustomerBean implements Serializable{ private Customer customer; @Inject private CustomerService custService; private boolean loggedIn; private java.util.Date birthday; private String email; private String password; private int valid; private boolean birthdayToday; public CustomerBean() { customer = new Customer(); loggedIn = false; } public CustomerService getCustService() { return custService; } public int getValid() { return valid; } public void setValid(int valid) { this.valid = valid; } public boolean isLoggedIn() { return loggedIn; } public void setLoggedIn(boolean loggedIn) { this.loggedIn = loggedIn; } public java.util.Date getBirthday() { return birthday; } public void setBirthday(java.util.Date birthday) { this.birthday = birthday; } public Customer getCustomer() { return customer; } public void setCustomer(Customer customer) { this.customer = customer; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public boolean isBirthdayToday() { return birthdayToday; } public void setBirthdayToday(boolean birthdayToday) { this.birthdayToday = birthdayToday; } public String editCustomer(String id) { customer = custService.findById(Integer.valueOf(id)); birthday = customer.getBirthDate(); valid = customer.getValid(); return "allCustomers"; } public String logIn() { customer = custService.logIn(email, password); //String pass = DigestUtils.md5Hex(password); - //this one should go into custService implementation if (customer.getId() != 0) { loggedIn = true; birthday = customer.getBirthDate(); checkBirthday(); } return "index"; } public String save() { customer.setValid(valid); customer.setBirthDate(birthday); custService.save(customer); customer = new Customer(); birthday = null; return "allCustomers"; } public String logOff() { loggedIn = false; customer = new Customer(); return "index"; } public void checkBirthday() { LocalDate today = LocalDate.now(); Instant instant = Instant.ofEpochMilli(birthday.getTime()); LocalDate birth = LocalDateTime.ofInstant(instant, ZoneId.systemDefault()).toLocalDate(); if((today.getMonthValue()==birth.getMonthValue())&&(today.getDayOfMonth()==birth.getDayOfMonth())) { birthdayToday = true; } else { birthdayToday = false; } } }
true
e211fbf7c4896b3da3e6b6813a658341402d1a8a
Java
unic/neba
/spring/src/test/java/io/neba/spring/resourcemodels/registration/SpringBasedModelDefinitionTest.java
UTF-8
1,806
2.1875
2
[ "BSD-3-Clause", "MIT", "EPL-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
permissive
package io.neba.spring.resourcemodels.registration; import io.neba.api.annotations.ResourceModel; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.doReturn; @RunWith(MockitoJUnitRunner.class) public class SpringBasedModelDefinitionTest { @Mock private ResourceModel resourceModelAnnotation; private SpringBasedModelDefinition testee; @Before public void setUp() { doReturn("").when(this.resourceModelAnnotation).name(); this.testee = new SpringBasedModelDefinition(this.resourceModelAnnotation, "beanName", getClass()); } @Test public void testModelNameIsBeanNameByDefault() { assertModelNameIs("beanName"); } @Test public void testExplicitModelNameOverridesBeanName() { withExplicitModelName("explicitModelName"); assertModelNameIs("explicitModelName"); } @Test public void testModelTypeRetrieval() { assertModelTypeIsReturnedAsIs(); } @Test public void testResourceModelAnnotationRetrieval() { assertResourceModelAnnotationIsReturnedAsIs(); } private void assertResourceModelAnnotationIsReturnedAsIs() { assertThat(this.testee.getResourceModel()).isSameAs(this.resourceModelAnnotation); } private void assertModelTypeIsReturnedAsIs() { assertThat(this.testee.getType()).isSameAs(getClass()); } private void withExplicitModelName(String name) { doReturn(name).when(this.resourceModelAnnotation).name(); } private void assertModelNameIs(String name) { assertThat(this.testee.getName()).isEqualTo(name); } }
true
463c845851783aafc36d6c05a4df573f78f08126
Java
RollisR/pedidos
/src/Item.java
UTF-8
403
2.5625
3
[]
no_license
public class Item { public String descricao; public String categoria; public double valor; public Item(double valor, String descricao, String categoria) { this.valor = valor; this.descricao = descricao; this.categoria = categoria; } public Item(double valor, String descricao) { this.valor = valor; this.descricao = descricao; } }
true
824ea2db8f148e1ed228118c42802e5f2d7cf44e
Java
dsalas85/contact-service
/src/main/java/com/example/demo/controller/GlobalController.java
UTF-8
774
2.234375
2
[]
no_license
package com.example.demo.controller; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/contacts") public class GlobalController { @ApiOperation( value = "health check for the service. Should return 'pong'", response = String.class ) @ApiResponses( value = { @ApiResponse( code = 200, message = "Service is working properly" ) } ) @GetMapping( value = "/ping" ) public String ping() { String response = "pong"; return response; } }
true
fe911a1257937cae8f4fee682e54fe84f5d70eb2
Java
Emesless/playersearch
/src/main/java/ru/emesless/searchplayers/DTO/PagePlayerRequestDTO.java
UTF-8
628
2.078125
2
[]
no_license
package ru.emesless.searchplayers.DTO; import lombok.Data; import lombok.Getter; import lombok.Setter; import ru.emesless.searchplayers.model.PlayerSearchList; import java.util.List; /** * todo Document type PagePlayerRequest */ @Data @Getter @Setter public class PagePlayerRequestDTO { private List<PlayerSearchList> playerSearchList; private int currentPage; private int totalPages; public PagePlayerRequestDTO(List<PlayerSearchList> content, int pageNumber, int totalPages) { this.playerSearchList = content; this.currentPage = pageNumber; this.totalPages = totalPages; } }
true
5759f2daf00c2c7a8c53d35bad2ae35c0ae8d7e4
Java
mohitrajvardhan17/java1.8.0_151
/com/sun/xml/internal/ws/util/HandlerAnnotationInfo.java
UTF-8
767
1.875
2
[]
no_license
package com.sun.xml.internal.ws.util; import java.util.List; import java.util.Set; import javax.xml.ws.handler.Handler; public class HandlerAnnotationInfo { private List<Handler> handlers; private Set<String> roles; public HandlerAnnotationInfo() {} public List<Handler> getHandlers() { return handlers; } public void setHandlers(List<Handler> paramList) { handlers = paramList; } public Set<String> getRoles() { return roles; } public void setRoles(Set<String> paramSet) { roles = paramSet; } } /* Location: C:\Program Files (x86)\Java\jre1.8.0_151\lib\rt.jar!\com\sun\xml\internal\ws\util\HandlerAnnotationInfo.class * Java compiler version: 8 (52.0) * JD-Core Version: 0.7.1 */
true
5152e6a30ae399deac018e8abdeb532c47cdfabf
Java
Jeetthakar/stockpile
/src/main/java/harrier/income/com/report/IndexWise.java
UTF-8
1,095
2.53125
3
[]
no_license
package harrier.income.com.report; public class IndexWise { private String industryname; private String marketcap; private String weightage ; public IndexWise(String industryname,String marketcap,String weightage) { this.industryname=industryname; this.marketcap=marketcap; this.weightage=weightage; } /** * @return Returns the industryname. */ public String getIndustryname() { return industryname; } /** * @param industryname The industryname to set. */ public void setIndustryname(String industryname) { this.industryname = industryname; } /** * @return Returns the marketcap. */ public String getMarketcap() { return marketcap; } /** * @param marketcap The marketcap to set. */ public void setMarketcap(String marketcap) { this.marketcap = marketcap; } /** * @return Returns the weightage. */ public String getWeightage() { return weightage; } /** * @param weightage The weightage to set. */ public void setWeightage(String weightage) { this.weightage = weightage; } }
true
a27ae97085eb3f1499ee35115e875f7fb7efa6cb
Java
ucam-cl-dtg/supervision-api
/src/main/java/uk/ac/cam/cl/dtg/teaching/hibernate/HibernateUtil.java
UTF-8
3,019
2.3125
2
[ "Apache-2.0" ]
permissive
package uk.ac.cam.cl.dtg.teaching.hibernate; import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.DefaultComponentSafeNamingStrategy; import org.hibernate.internal.SessionFactoryImpl; import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; import org.hibernate.service.spi.Stoppable; import org.hibernate.tool.hbm2ddl.SchemaUpdate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class HibernateUtil { private static Logger log = LoggerFactory.getLogger(HibernateUtil.class); private static HibernateUtil singleton = null; public static HibernateUtil getInstance() { while(singleton == null) { synchronized(HibernateUtil.class) { if(singleton == null) { singleton = init("/hibernate.cfg.xml"); } } } return singleton; } public static void init() { init("/hibernate.cfg.xml"); } public static HibernateUtil init(String configurationFile) { HibernateUtil o = new HibernateUtil(); try { Configuration configuration = new Configuration(); configuration.configure(configurationFile); configuration .setNamingStrategy(new DefaultComponentSafeNamingStrategy()); if ("update".equals(configuration .getProperty("hibernate.hbm2ddl.auto"))) { SchemaUpdate update = new SchemaUpdate(configuration); update.execute(true, true); configuration.setProperty("hibernate.hbm2ddl.auto", "validate"); } ServiceRegistry serviceRegistry = new ServiceRegistryBuilder() .applySettings(configuration.getProperties()) .buildServiceRegistry(); SessionFactory sessionFactory = configuration .buildSessionFactory(serviceRegistry); o.sf = sessionFactory; } catch (HibernateException e) { log.error( "Exception occurred when building SessionFactory {}. Deferring until use.", e.getMessage()); o.heldException = e; } return o; } private SessionFactory sf = null; private HibernateException heldException = null; public void close() { if (sf instanceof SessionFactoryImpl) { SessionFactoryImpl i = (SessionFactoryImpl)sf; ConnectionProvider p = i.getConnectionProvider(); if (p instanceof Stoppable) { log.info("Stopping ConnectionProvider {}",p.toString()); ((Stoppable)p).stop(); } } sf.close(); } public boolean isReady() { return sf != null; } public SessionFactory getSF() throws HibernateException { if (sf == null) { throw new HibernateException("SessionFactory was not initialised", heldException); } else { return sf; } } public Session getSession() throws HibernateException { Session session = getSF().getCurrentSession(); if (!session.isOpen()) { session = sf.openSession(); } if (!session.getTransaction().isActive()) { session.beginTransaction(); } return session; } }
true
09913f4821c6aa3a02e9f238e919f1ca92a53d14
Java
wangmin19861205/test
/src/com/eloancn/shared/common/Data.java
GB18030
44,975
1.859375
2
[]
no_license
package com.eloancn.shared.common; import java.awt.image.BufferedImage; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.util.*; import javax.imageio.IIOImage; import javax.imageio.ImageIO; import javax.imageio.ImageReader; import javax.imageio.ImageWriteParam; import javax.imageio.ImageWriter; import javax.imageio.metadata.IIOMetadata; import javax.imageio.stream.ImageInputStream; import javax.imageio.stream.ImageOutputStream; import org.jdesktop.swingx.util.OS; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.sikuli.script.Screen; import org.testng.Reporter; import com.sun.media.imageio.plugins.tiff.TIFFImageWriteParam; import com.eloancn.shared.common.Base; public class Data { static Data data = new Data(); Base base = new Base(); /******************************ɻע˻*************************************/ public static String email = data.emailConcatenation(0,2); public static String email2 = data.emailConcatenation(0,2); public static String tel = data.phoneConcatenation(0);// public static String realName = ""; public static String tel2 = data.phoneConcatenation(0);//Ͷ2 public static String realName2 = "޺ѩ"; public static String tel3 = data.phoneConcatenation(0);//Ͷ3 public static String password = "111111"; public static String zzmm = "111111";//֧ //xty public static String tel_run_debit2 = "13111122280";// ȷϽܵ public static String realName_run_debit2 = ""; public static String email_run_debit2 = "13111111171@qq.com"; public static String idCard_run_debit2 = "11011519620715562X"; //public static String tel_run_credit = "13111111153";//Ͷ Ǯ public static String tel_run_DebentureTransfer = "13632917617";//רͶ Ͷ10000(ԭ˺ţ13689802284) public static String idCard_run_credit = "11011519620715561X"; public static String newUser ="13111111158";//ֱû //jby public static String tel_run_EcunBao = "13800138002";//汦 13111111155 public static String tel_run_MyAccount = "13581569929";//ҵ˻ public static String name_run_MyAccount = "";//ҵ˻ public static String id_run_MyAccount = "11010519850423007X";//ҵ˻֤ //lj public static String tel_run_zhaiquan1 = "13111111201"; public static String tel_run_zhaiquan2 = "13111111169"; // /*****************P1*******************/ //ECunBao_P1>>>>>>>>>>>>>>>>>>>>>>>> //jby public static String run_ECunBao_99 = "13111111188";//˻100 public static String run_ECunBao_register = "13111111177";//δǮûͶ עֻû public static String run_ECunBao_oldtel = "13111111141";//δǮûͶ ֻû public static String run_ECunBao_oldemail = "123@126.com";//δǮûͶ û public static String ECunBao_Normal_tel = "13581567705"; //ͨû public static String ECunBao_VIP10_tel = "13581567706"; //VIP1.0û ̨汦ǰֱ̨ӹ򼴿ɡ public static String ECunBao_VIP15_tel = "13581567707"; //VIP1.5û ̨汦ǰֱ̨ӹ򼴿ɡ //xty public static String tel_eCunBao_P1 = "13111111240"; //public static String tel_securityAuth_P1 = "13111111241"; /*****************P2*******************/ public static String tel_balance_49 = "13111111202";//˻49Ԫ ɢͶ-Ͷʴ-Զ public static String tel_balance_50 = "13111111203";//˻50Ԫ ɢͶ-Ͷʴ-Զ public static String tel_investmentList_P2 = "13111111239"; //汦 public static String tel_ExperienceNoInterest_client = "13581568811"; //ڵûЧΪһ£ڻţ 13581568800 public static String tel_ExperienceInterest_client = "13581567600"; //ѹ汦ʼϢ public static String email_ExperienceInterest_client = "13581567600@163.com"; public static String tel_ExperienceNoInterest_test = ""; //ڵûЧΪһ£ڻţ public static String tel_ExperienceInterest_test = ""; //ѹ汦ʼϢ public static String email_ExperienceInterest_test = ""; public static String email_MyAccountP2 = "13581567702@163.com";//ֻδעû public static String client_tel_new = "13581568700"; //ֻעû public static String client_tel_old = "13581568701"; //ֻעû public static String tel_change = "13581567703"; public static String tel_noChange = "13581567699"; //-lj public static String tel_Loan = "13011887694"; //ɡû public static String tel_Loan_Name= "ޱ"; public static String tel_Loan_PayPwd="111111"; public static String tel_Loan_idCard="34020419760312152X"; // public static String tel_LBDCreaterLoan= "13581838716"; public static String tel_LBDCreaterName="߽ѫ"; public static String tel_LBDNoncreaterLoan ="13581838717"; public static String tel_LBDNoncreaterName="׸"; //Ͷ-lj public static String tel_Invest = "13011879174";//ҪͶɢ public static String tel_Invest_Name=""; public static String tel_Invest_PayPwd="111111"; public static String tel_Invest_idCard="360103197807124724"; //Ͷб // public static String tel_old_user = "13581838716"; //δǮûͶ ֻû // public static String email_old_user = "ligen65@qq.com"; //δǮûͶ û /******************************Ԥ߻˻*************************************/ //עdebit>>>>>>>>>>>>>>>>>>>>>>>> public static String test_register_debit_tel = "13011874514";//ֻ public static String test_register_debit_realName = "ֿܶ";//ʵ public static String test_register_debit_idCard = "210181198803168317"; //Ͷעcredit>>>>>>>>>>>>>>>>>>>>>>>> public static String test_register_credit_tel = "13011885149";//ֻ public static String test_register_credit_realName = "ɽ";//ʵ public static String test_register_credit_idCard = "150430198611211499"; //testרú 18880000200>>>>>>>>>>>>>>>>> public static String test_tel = "18880000200";//ֻ public static String test_password = "111111";// public static String test_realName = "";//ʵ public static String test_idCard = "420400197512034215";//֤ public static String test_zzmm = "yqlxzh";//ת public static String test_email = "eloanxn200@eloancn.com";// //testרú2 δ֤ 18880000199>>>>>>>> public static String test2_tel = "18880000199";//ֻ public static String test2_password = "111111";// public static String test2_realName = "֮";//ʵ public static String test2_idCard = "440607197510046801";//֤ public static String test2_zzmm = "yqlxzh";//ת public static String test2_email = "eloanxn199@eloancn.com";// //testרú3 δ֤ 18880000198>>>>>>>> public static String test3_tel = "18880000198";//ֻ public static String test3_password = "111111";// public static String test3_realName = "ܺ޺";//ʵ public static String test3_idCard = "360425199009155028";//֤ public static String test3_zzmm = "yqlxzh";//ת public static String test3_email = "eloanxn198@eloancn.com";// //testרú4 ֤ 18880000197>>>>>>>> public static String test4_tel = "18880000197";//ֻ public static String test4_password = "111111";// public static String test4_realName = "";//ʵ public static String test4_idCard = "110101194206062035";//֤ public static String test4_zzmm = "yqlxzh";//ת public static String test4_email = "eloanxn197@eloancn.com";// /*****************P1*******************/ //ECunBao_P1>>>>>>>>>>>>>>>>>>>>>>>> public static String test_run_ECunBao_register = "13810367911";//δǮûͶ עֻû public static String test_run_ECunBao_oldtel = "15011514888";//δǮûͶ ֻû public static String test_run_ECunBao_oldemail = "ff@qq.com";//δǮûͶ û //Register_P1>>>>>>>>>>>>>>>>>>>>>>>> public static String test_run_Register_tel = "13011885141"; //MyAccount_P1 public static String test_tel_run_MyAccount = "13011887854"; /*****************P2*******************/ //ͶбInvestmentList_P2>>>>>>>>>>>>>>>>>>>>>>>> public static String[] defaultPlaces = {"","","Ϻ","","ɶ",""};//Ĭϵ //ҵ˻ public static String test_myAccount_P2_tel = "13011887724";//֤ /*****************ȫ֤*******************/ public static String test_run_SecurityAuth_P1_tel = "13011887642"; public static String test_run_SecurityAuth_P1_realName = ""; public static String test_run_SecurityAuth_P1_idCard = "140105198412063716"; public static String test_run_SecurityAuth_P3_tel1 = "13011887469"; public static String test_run_SecurityAuth_P3_tel2 = "13011879450"; public static String test_run_SecurityAuth_P3_realName2 = ""; public static String test_run_SecurityAuth_P3_idCard2 = "510106197904075116"; public static String test_run_SecurityAuth_P3_tel3 = "13011879452"; public static String test_run_SecurityAuth_P3_tel4 = "13011873604"; public static String test_run_SecurityAuth_P3_realName4 = ""; public static String test_run_SecurityAuth_P3_idCard4 = "320283199109253237"; public static String test_run_SecurityAuth_P3_tel5 = "13011876149"; public static String test_run_SecurityAuth_P3_realName5 = "ű"; public static String test_run_SecurityAuth_P3_idCard5 = "142401198402112118"; public static String test_run_SecurityAuth_P3_tel6 = "13011884785"; public static String test_run_SecurityAuth_P3_realName6 = "ŷƽ"; public static String test_run_SecurityAuth_P3_idCard6 = "431126198901137618"; public static String test_run_SecurityAuth_P3_tel8 = "13011873524"; public static String test_run_SecurityAuth_P3_realName8 = ""; public static String test_run_SecurityAuth_P3_idCard8 = "130625198505032012"; public static String test_run_SecurityAuth_P3_tel9 = "13011884752"; public static String test_run_SecurityAuth_P3_realName9 = ""; public static String test_run_SecurityAuth_P3_idCard9 = "330326198605254314"; public static String test_run_SecurityAuth_P3_tel11 = "13011884709"; public static String test_run_SecurityAuth_P3_tel12 = "13011871482"; public static String test_run_SecurityAuth_P3_realName12 = "Ӣ"; public static String test_run_SecurityAuth_P3_idCard12 = "450324198803131918"; public static String test_run_SecurityAuth_P3_tel13_1 = "13011887944"; public static String test_run_SecurityAuth_P3_realName13_1 = ""; public static String test_run_SecurityAuth_P3_idCard13_1 = "211022198107120016"; public static String test_run_SecurityAuth_P3_tel13_2 = "13011887874"; public static String test_run_SecurityAuth_P3_realName13_2 = ""; public static String test_run_SecurityAuth_P3_idCard13_2 = "510107199009111817"; public static String test_run_SecurityAuth_P3_tel13_3 = "13011885384"; public static String test_run_SecurityAuth_P3_realName13_3 = "μѿ"; public static String test_run_SecurityAuth_P3_idCard13_3 = "513401198004215517"; /**************************************************************************/ public static String bankAccount = "622848181113360";//ԭݣ622848181113333 public static String[] names = {"һ","","","","",""}; public static String[] tels = data.getTels();//{"13145458001","13145458002","13145458003","13145458004","13145458005","13145458006"}; //ҳbannerͼtitle public static String[] banners_client = {"˫ʮȫ񻶣7 ׬-ר-̳ - ", "200ڻÿս100ͷ5Ԫ-ר-̳ - ", "淨-õˬ-ר-̳ - ", "ֵٳ֣汦Ϣһ£꣡-ר-̳ - ", "APP|ͶֻͻiPhone/Androidء", "511һ汨-", "-"}; public static String[] banners_test = { "ֵ7000Ԫĺװݺͣȵȵ-ר-̳ - ", "С˾ļҺã-", "ͬƼ޹˾2016ƸϢ_ַ_绰-ƸҵϢ", "ƶ֮ݱ-¶̬-̳ - ", "ʱ|վũӽ ũҵδչ-¶̬-̳ - ", "塱֪Ͷ˿գУ-¶̬-̳ - ", "2016õĿˣ1·Ӫ¯-¶̬-̳ - " }; /******************************ɻĺ̨˻*************************************/ //֪ͨ public static String noticeCode = "4000292886d"; //ܲû public static String headquartersUserName1 = "jby1"; public static String headquartersUserName2 = "jby2"; public static String headquartersUserName3 = "jby3"; //û public static String allianceBusinessUserName1 = "jby_1"; public static String allianceBusinessUserName2 = "jby_2"; public static String allianceBusinessUserName3 = "jby_3"; //̣һܲ public static String userNameArray[] = {"jby_1", "jby_2", "jby_3", "jby1"}; // public static String userNameArray[] = {"xty_1", "xty_2", "xty_3", "xty1"}; // public static String userNameArray[] = {"lj_1", "lj_2", "lj_3", "lj1"}; //̻ܲȷ public static String passwordByBack = "eloancn888"; // public static String borrowerName = "û"; // public static String borrowerEmail = "yh2@11.com"; // public static String lendEmail = "mgr06@t01.com"; //_ǰ̨ | _̨ ǰ̨>=̨Ϊ10010ڲظ public static String loanAmount = "15900"; public static String loanAmount2 = "16000"; public static String loanAmount_Fail = "15600"; /**************************************************************************/ /** * п */ public String getBank(){ String bank = "62284818"; bank += (int)(Math.random()*10000000); return bank; } /** * Ԫ * ϵֻ */ public String[] getTels(){ String[] telphones = new String[6]; for (int i = 0; i < telphones.length; i++) { telphones[i] = phoneConcatenation(0); // logger.info("ϵ"+i+""+telphones[i]); Reporter.log("ϵ"+i+""+telphones[i]+"<br/>"); } return telphones; } /********************************ȡ֤*******************************************/ /** * * @param * @param * @return * @author */ @Deprecated public String get(WebElement yanZhengMa,WebDriver webDriver){ //ȡ֤ //WebElement yanZhengMa = webDriver.findElement(By.xpath("//img[contains(@src,'/randCode')]")); Actions action = new Actions(webDriver); //Ҽ֤ action.contextClick(yanZhengMa).build().perform(); base.sleep(2000); //IE chrome firefox Screen screen = new Screen(); String curPath = new File("").getAbsolutePath();//ǰ· String webdriver = base.getWebDriver().toString(); String edition = base.getBrowserEdition(); if (webdriver.contains("InternetExplorerDriver")){ screen.type("S"); }else if(webdriver.contains("FirefoxDriver")){ //ʹÿݼ"Shift + Alt + v" action.keyDown(Keys.SHIFT); action.keyDown(Keys.ALT).sendKeys("V").perform(); action.keyUp(Keys.SHIFT); action.keyUp(Keys.ALT); } else { screen.type("V"); } base.sleep(3000); //AutoIt дĽű try { if (webdriver.contains("FirefoxDriver")) { Runtime.getRuntime().exec(curPath+"\\exe\\HuoQuYanZhengMa.exe");//HuoQuYanZhengMa.exe yanzhengma_ff.exe }else if(webdriver.contains("InternetExplorerDriver")){ if(edition.contains("8")){ Runtime.getRuntime().exec(curPath+"\\exe\\yanzhengma_ie8.exe"); }else{ Runtime.getRuntime().exec(curPath+"\\exe\\yanzhengma_ie.exe"); } }else{ Runtime.getRuntime().exec(curPath+"\\exe\\yanzhengma_chrome.exe"); } // else if (base.browserType.equalsIgnoreCase("ie")){ // Runtime.getRuntime().exec(curPath+"\\exe\\yanzhengma_ie.exe"); // } // else if (base.browserType.equalsIgnoreCase("ie8")){ // Runtime.getRuntime().exec(curPath+"\\exe\\yanzhengma_ie8.exe"); // } } catch (IOException e) { e.printStackTrace(); } try { Thread.sleep(20000); } catch (InterruptedException e1) { e1.printStackTrace(); } //ͼƬļַ String imagePath = ""; if(webdriver.contains("FirefoxDriver")||webdriver.contains("ChromeDriver")){ imagePath = "C://randCode.jsp.jpg"; }else{ if(edition.contains("8")){ imagePath = "C://randCode.jsp.bmp"; }else{ imagePath = "C://randCode.jsp.png"; } } // else if (base.browserType.equalsIgnoreCase("ie")) { // imagePath = "C://randCode.jsp.png"; // }else if (base.browserType.equalsIgnoreCase("ie8")){ // imagePath = "C://randCode.jsp.bmp"; // } System.out.println("ORC Test Begin......");//----------------- String codeString = ""; try { //ȡչΪ"jpg"ͼƬļ if(webdriver.contains("FirefoxDriver")||webdriver.contains("ChromeDriver")){ codeString = recognizeText(new File(imagePath), "jpg"); }else{ if(edition.contains("8")){ codeString = recognizeText(new File(imagePath), "bmp"); }else{ codeString = recognizeText(new File(imagePath), "png"); } } // else if (base.browserType.equalsIgnoreCase("ie")) { // codeString = recognizeText(new File(imagePath), "png"); // }else if (base.browserType.equalsIgnoreCase("ie8")) { // codeString = recognizeText(new File(imagePath), "bmp"); // } System.out.println(codeString); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } //֤ if (codeString.toLowerCase().contains("s")) { codeString = codeString.toLowerCase().replace("s", "5"); } if (codeString.toLowerCase().contains("z")) { codeString = codeString.toLowerCase().replace("z", "2"); } if(codeString.toLowerCase().contains("-")){ codeString = codeString.toLowerCase().replace("-", ""); } if(codeString.toLowerCase().contains("I")){ codeString = codeString.toLowerCase().replace("I", "1"); } if(codeString.toLowerCase().contains("B")){ codeString = codeString.toLowerCase().replace("B", "8"); } System.out.println("ORC Test End......");//----------------- return codeString.replace(" ", ""); } /** * ͼƬļתΪtifʽ * @param imageFile ȡԴͼƬ· * @param imageFormat ȡͼƬʽ * @return * @author */ public static File createImage(File imageFile, String imageFormat) { File tempFile = null; try { //ȡһͼƬļ Iterator<ImageReader> readers = ImageIO.getImageReadersByFormatName(imageFormat); ImageReader reader = (ImageReader) readers.next(); //ͼƬ· ImageInputStream iis = ImageIO.createImageInputStream(imageFile); reader.setInput(iis); //ȡԪݣͼʽֻһͼʱʹԪݣ IIOMetadata streamMetadata = reader.getStreamMetadata(); //Set up the writeParam TIFFImageWriteParam tiffWriteParam = new TIFFImageWriteParam(Locale.CHINESE); tiffWriteParam.setCompressionMode(ImageWriteParam.MODE_DISABLED); //Get tif writer and set output to file Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName("tiff"); ImageWriter writer = (ImageWriter) writers.next(); BufferedImage bi = reader.read(0); //ȡһͼƬ IIOImage image = new IIOImage(bi,null,reader.getImageMetadata(0)); //洢ͼԪ tempFile = tempImageFile(imageFile); ImageOutputStream ios = ImageIO.createImageOutputStream(tempFile); writer.setOutput(ios); writer.write(streamMetadata, image, tiffWriteParam); ios.close(); writer.dispose(); reader.dispose(); } catch (IOException e) { e.printStackTrace(); } return tempFile; } /** * * @param * @param * @return * @author */ private static File tempImageFile(File imageFile) { String path = imageFile.getPath(); StringBuffer strB = new StringBuffer(path); strB.insert(path.lastIndexOf('.'),0); return new File(strB.toString().replaceFirst("(?<=//.)(//w+)$", "tif")); } private final String LANG_OPTION = "-l"; //ӢĸСдl1 private final String EOL = System.getProperty("line.separator"); //㰲װOCR· private String tessPath = "D://Program Files (x86)//Tesseract-OCR"; //private String tessPath = new File("tesseract").getAbsolutePath(); /** * * @param * @param * @return * @author */ public String recognizeText(File imageFile,String imageFormat)throws Exception{ File tempImage = createImage(imageFile,imageFormat); File outputFile = new File(imageFile.getParentFile(),"output"); StringBuffer strB = new StringBuffer(); List<String> cmd = new ArrayList<String>(); if(OS.isWindowsXP()){ cmd.add(tessPath+"//tesseract"); // cmd.add(tessPath); }else if(OS.isLinux()){ cmd.add("tesseract"); }else{ cmd.add(tessPath+"//tesseract"); // cmd.add(tessPath); } cmd.add(""); cmd.add(outputFile.getName()); cmd.add(LANG_OPTION); // cmd.add("chi_sim"); cmd.add("eng"); ProcessBuilder pb = new ProcessBuilder(); pb.directory(imageFile.getParentFile()); cmd.set(1, tempImage.getName()); pb.command(cmd); pb.redirectErrorStream(true); Process process = pb.start(); //tesseract.exe 1.jpg 1 -l chi_sim int w = process.waitFor(); //ɾʱڹļ tempImage.delete(); if(w==0){ BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(outputFile.getAbsolutePath()+".txt"),"UTF-8")); String str; while((str = in.readLine())!=null){ strB.append(str).append(EOL); } in.close(); }else{ String msg; switch(w){ case 1: msg = "Errors accessing files.There may be spaces in your image's filename."; break; case 29: msg = "Cannot recongnize the image or its selected region."; break; case 31: msg = "Unsupported image format."; break; default: msg = "Errors occurred."; } tempImage.delete(); throw new RuntimeException(msg); } new File(outputFile.getAbsolutePath()+".txt").delete(); return strB.toString(); } /***************************************************************************/ //ûij(3-16λ) /* * 0ⳤȣ3:3֮Դ */ public int getUserNameLength(int length) { //󳤶 int maxLength = length; //Ϊ03-16 if(maxLength == 0){ maxLength = (int)(Math.random() * 13 + 3); return maxLength; } else if(maxLength<=16) { return maxLength; } else { return -1; } } //ûĸ public char getCharacter(){ char englishChar=(char)(int)(Math.random() * 26 + 97); return englishChar; } //û public char getNum() { int numInt = (int)(Math.random() * 9); String numString = String.valueOf(numInt); char numChar = numString.charAt(0); return numChar; } //ʼ public String getEmailDoMain(){ String doMainArray[] = {"163.com","126.com","188.com","yeah.net","sina.com","sohu.com","tom.com","gmail.com","qq.com","263.net","qq.com"}; int index = (int)(Math.random() * (doMainArray.length-1)); return doMainArray[index]; } /* * length 0ⳤȣ3:3֮Դ * sign 0ĸ,1֣2ĸ+ */ public String emailConcatenation(int length, int sign){ StringBuilder emailStringBuilder = new StringBuilder(); int emailLength = this.getUserNameLength(length); if(sign==0){ for(int i=0;i<emailLength;i++){ emailStringBuilder.append(this.getCharacter()); } emailStringBuilder.append("@"); return emailStringBuilder.append(this.getEmailDoMain()).toString(); } else if(sign==1){ for(int i=0;i<emailLength;i++){ if(i==0 && this.getNum()!=0){ emailStringBuilder.append(this.getNum()); } else if(i!=0){ emailStringBuilder.append(this.getNum()); } } emailStringBuilder.append("@"); return emailStringBuilder.append(this.getEmailDoMain()).toString(); } else if(sign==2){ int temp = (int)(Math.random() * 13 + 3); for(int i=0;i<temp;i++){ emailStringBuilder.append(this.getCharacter()); } for(int i=0;i<emailLength-temp;i++){ emailStringBuilder.append(this.getNum()); } emailStringBuilder.append("@"); return emailStringBuilder.append(this.getEmailDoMain()).toString(); } else { return "ϴ"; } } /********************************ֻ*******************************************/ //ֻ붼ǰӪ̺͵滮ģǰ3λӪ̵Ĵ롢м4λǹش롢4λû //ƶŶ - 0 - 16http://service.bj.10086.cn/phone/jxhsimcard/gotone_list.html String mobileArray[] = {"139","138","137","136","135","134","188","187","183","182","159","158","157","152","151","150"}; //ͨŶ- 1 - 8http://num.10010.com/NumApp/chseNumList/init String unicomArray[] = {"186","185","176","156","155","132","131","130"}; //źŶ- 2 - 6http://www.189.cn/?cmpid=jt-ppc-baidu-am-ppzq-home# String telecomArray[] = {"189","181","180","177","153","133"}; int mobileLength = mobileArray.length; int unicomLength = unicomArray.length; int telecomLength = telecomArray.length; /* * ȡ˾Ŷ */ public String getCompany(int companyName){ //ƶ if(companyName == 0){ //0~15֮ return mobileArray[(int)(Math.random() * mobileLength)]; } //ͨ else if(companyName == 1){ //0~7֮ return unicomArray[(int)(Math.random() * unicomLength)]; } // else if(companyName == 2){ //0~5֮ return telecomArray[(int)(Math.random() * telecomLength)]; } //ƶ ͨ ȡ else{ int temp = -1; //ֵΪ012 temp = (int)(Math.random() * 3); if(temp == 0){ return mobileArray[(int)(Math.random() * mobileLength)]; } else if(temp == 1){ return unicomArray[(int)(Math.random() * unicomLength)]; } else if(temp == 2){ return telecomArray[(int)(Math.random() * telecomLength)]; } } return null; } /* * ȡŶ */ public String getAreaCode(){ String areaCode = ""; //ѭɵţֱΪ4 while(true){ //0~9999֮ areaCode = Integer.toString((int)(Math.random() * 10000)); //Ϊ4ʱ if(areaCode.length()==4){ return areaCode; } } } /* * ȡλ */ public String getUserCode(){ String userCode = ""; //ѭţֱΪ4 while(true){ //0~9999֮ userCode = Integer.toString((int)(Math.random() * 10000)); //Ϊ4ʱ if(userCode.length()==4){ return userCode; } } } /* * ƴֻ */ public String phoneConcatenation(int companyName){ StringBuilder phoneStringBuilder = new StringBuilder(); phoneStringBuilder.append(this.getCompany(companyName)); phoneStringBuilder.append(this.getAreaCode()); phoneStringBuilder.append(this.getUserCode()); return phoneStringBuilder.toString(); } /***********************************************************/ /** * ȡ * @return */ public String getFirstName(){ Random random = new Random(); /* 598 ټ */ String[] firstName= {"","Ǯ","","","","","֣","","","","","","","","","" + "","","","","","","","ʩ","","","","","","","κ","" + "","","","л","","","","ˮ","","","","","","","","" + "","","","³","Τ","","","","","","","","","Ԭ","","" + "ۺ","","ʷ","","","","","Ѧ","","","","","","","","" + "","","","","","","","ʱ","","Ƥ","","","","","","" + "Ԫ","","","","ƽ","","","","","","Ҧ","","տ","","","" + "ë","","","","","","","","","","","̸","","é","","" + "","","","","","ף","","","","","","","ϯ","","","" + "ǿ","","·","¦","Σ","","ͯ","","","÷","ʢ","","","","","" + "","","","","","","","","","","","","֧","","","" + "","¬","Ī","","","","","","","Ӧ","","","","","","" + "","","","","","","","ʯ","","","ť","","","","","" + "","","½","","","","","","","","","","","","","" + "","","","","","","","","","","","","","","","" + "","ɽ","","","","","","ȫ","ۭ","","","","","","","" + "","","","","","","","","","","","","","ղ","","" + "","Ҷ","","˾","","۬","","","","ӡ","","","","","ۢ","" + "","","","","","","׿","","","","","","","","","" + "","","˫","","ݷ","","","̷","","","","","","","","" + "Ƚ","","۪","Ӻ","ȴ","","ɣ","","","ţ","","ͨ","","","","" + "","","","ũ","","","ׯ","","","","","","Ľ","","","" + "ϰ","","","","","","","","","","","","","","","" + "","","","","","","","","","","","»","","","ŷ","" + "","","","ε","Խ","","¡","ʦ","","","","","","","","" + "","","","","","","","","","","ɳ","ؿ","","","","" + "","","","","","","","","","","ۣ","","Ȩ","","","" + "","","","","","","˧","","","","C","","","","","" + "","","","","","۳","Ϳ","","","IJ","","٦","","","ī","" + "","","","","","","١","","","","","","","","","" + "","","չ","","̴","","","","","˴","¥","","ð","","ֿ","" + "","","","","ԭ","","","","","","","","","","","" + "","","","","","","","ľ","","","ۨ","","ö","","","" + "","","","","","","","","","","","","","","","" + "","","","","","","G","ٹ","˾","Ϲ","ŷ","ĺ","","","","" + "","ʸ","","ξ","","̨","ұ","","","","","̫","","","","" + "ԯ","","","","","Ľ","","","˾ͽ","˾","أ","˾","","","ӳ","" + "","ľ","","","","","","","ذ","й","׸","","θ","","","" + "΢","","","","","Ϲ","","","","̫ʷ","ٳ","","ͻ","","","" + "","ĸ","˾","","Ӻ","","","","®","","Ϲ","",""}; int index = random.nextInt(firstName.length-1); return firstName[index]; } /** * ȡ * @return */ public String getName() { String str = null; int highPos, lowPos; Random random = new Random(); highPos = (176 + Math.abs(random.nextInt(71)));//룬0xA0ͷӵ16ʼ0xB0=11*16=176,16~55һ֣56~87 random=new Random(); lowPos = 161 + Math.abs(random.nextInt(94));//λ룬0xA0ͷΧ1~94 byte[] bArr = new byte[2]; bArr[0] = (new Integer(highPos)).byteValue(); bArr[1] = (new Integer(lowPos)).byteValue(); try { str = new String(bArr, "GB2312"); //λϳɺ } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return str; } /** * ȡ * @return */ public String getFullName(){ Random random = new Random(); String fullName = ""; /* ӳѡȡһΪ */ if(random.nextBoolean()){ fullName += getFirstName() + getName() + getName(); } else{ fullName += getFirstName() + getName(); } return fullName; } /****************************֤ź****************************/ /* * ֤ * * @author * @version 1.0.0.0417, 2015-04-17 * * עʹStringBuildeṛ̰߳߳ȫ */ /* * 18λ֤֤ * ݡл񹲺͹ұ׼ GB 11643-1999йعݺĹ涨ݺ룬ʮλֱһλУɡ * ˳Ϊλֵַ룬λֳ룬λ˳һλУ롣 * ʮλ(У)ļ㷽Ϊ 1 1 0 1 0 5 1 9 8 7 1 2 2 2 1 5 1 * 1.ǰ֤17λֱԲͬϵӵһλʮλϵֱΪ7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2 * 2.17λֺϵ˵Ľӡ * 3.üӳͳ11Ƕ٣ * 4.ֻ0 1 2 3 4 5 6 7 8 9 1011ֱ֡Ӧһλ֤ĺΪ1 0 X 9 8 7 6 5 4 3 2 * 5.֪ͨ2ͻ֤ĵ18λϳֵĢ10֤һλ2 */ Calendar calendar = Calendar.getInstance(); public static Map<String, Integer> areaCode = new HashMap<String, Integer>(); /* * ƴ֤ */ public String idConcatenation() { StringBuilder stringBuilder = new StringBuilder(); // System.out.println(randomAreaCode()); stringBuilder.append(randomAreaCode()); // System.out.println(stringBuilder.toString()); // System.out.println(randomBirthday()); stringBuilder.append(randomBirthday()); // System.out.println(stringBuilder.toString()); // System.out.println(randomCode()); stringBuilder.append(randomCode()); // System.out.println(stringBuilder.toString()); // System.out.println(lastNumber(stringBuilder.toString().toCharArray())); stringBuilder.append(lastNumber(stringBuilder.toString().toCharArray())); return stringBuilder.toString(); } /* * ȡ */ public String randomAreaCode() { int code = 0; int index = -1; //areaCode.size()Ӧ-1random()ȡ0~1֮2޷ȡ0~2ֻ֮ܳ3ȡ0~2֮ //Mapģ index = (int)(Math.random()*(areaCode.size())); Collection<Integer> collection = areaCode.values(); Iterator<Integer> iterator = collection.iterator(); for(int i=0;i<=index && iterator.hasNext();i++) { code = iterator.next(); } return code + ""; } /* * ȡ֤ */ public int randomYear() { //䷶Χ18~80 int age = 80; //ȡʱ80ʱ //System.out.println("ǰ꣺ "+calendar.get(Calendar.YEAR)); int nowYear = calendar.get(Calendar.YEAR); int modernYear = calendar.get(Calendar.YEAR)-age; // calendar.set(Calendar.YEAR,(int)(Math.random()*61+1) + modernYear); //ȡ int year = calendar.get(Calendar.YEAR); // calendar.set(Calendar.YEAR,nowYear); return year; } /* * ȡ֤ */ public int randomMonth() { calendar.set(Calendar.MONTH, (int)(Math.random()*11+1)); int month = calendar.get(Calendar.MONTH)+1; return month; } /* * ȡ֤ */ public int randomDay(int year,int month){ int day = -1; if(month==2){ //꣬229 //һ򣬰겻İ if((year%4==0 && year%100!=0)||year%400==0){ calendar.set(Calendar.DATE, (int)(Math.random()*28+1)); day = calendar.get(Calendar.DATE); } //ƽ꣬228 else{ calendar.set(Calendar.DATE, (int)(Math.random()*27+1)); day = calendar.get(Calendar.DATE); } } else if(month==4 || month==6 || month==9 || month==11){ calendar.set(Calendar.DATE, (int)(Math.random()*29+1)); day = calendar.get(Calendar.DATE); } //һ߰ʮʮһ else{ calendar.set(Calendar.DATE, (int)(Math.random()*30+1)); day = calendar.get(Calendar.DATE); } return day; } /* * ȡ֤ */ public String randomBirthday(){ int year = randomYear(); int month = randomMonth(); int day = randomDay(year,month); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(year); if(month<10){stringBuilder.append("0");} stringBuilder.append(month); if(day<10){stringBuilder.append("0");} stringBuilder.append(day); return stringBuilder.toString(); } /* * ȡ֤2~4λ */ public String randomCode() { int randomCode = (int)(Math.random()*999); if(randomCode<10) { return "00" + randomCode; } else if(randomCode<100) { return "0" + randomCode; } else{ return "" + randomCode; } } /* * ȡ֤һλ */ //ϵ7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2 // 0 1 2 3 4 5 6 7 8 9 10 //Ӧ֤1λ:1 0 X 9 8 7 6 5 4 3 2 public String lastNumber(char seventeenCharArray[]){ //char seventeenCharArray[] = {'1','1','0','1','0','5','1','9','8','7','1','2','2','2','1','5','1'}; //жϴַΪյ //ϵ˺ĺ int sum = 0; //֤ǰ17λint int seventeenIntArray[] = new int[17]; //ϵ int xiShu[] = {7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2}; //Ӧ֤1λint char lastNum[] = {'1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'}; //ǰ17λ ַ תΪ for(int i=0;i<seventeenCharArray.length;i++) { //ַתѾȥ0д((int)(seventeenCharArray[i]-'0')) * xiShu[i] seventeenIntArray[i] = Integer.parseInt(seventeenCharArray[i]+""); } //17λ֤ * Ӧϵ for(int i=0;i<seventeenIntArray.length;i++) { sum += (seventeenIntArray[i] * xiShu[i]); } // ͡ 11ȡ Ӧַ return lastNum[sum%11]+""; } /* * ȡ֤ */ static { // areaCode.put("", 110000); areaCode.put("Ͻ", 110100); areaCode.put("", 110101); areaCode.put("", 110102); areaCode.put("", 110103); areaCode.put("", 110104); areaCode.put("", 110105); areaCode.put("̨", 110106); areaCode.put("ʯɽ", 110107); areaCode.put("", 110108); areaCode.put("ͷ", 110109); areaCode.put("ɽ", 110111); areaCode.put("ͨ", 110112); areaCode.put("˳", 110113); areaCode.put("ƽ", 110114); areaCode.put("", 110115); areaCode.put("", 110116); areaCode.put("ƽ", 110117); areaCode.put("", 110200); areaCode.put("", 110228); areaCode.put("", 110229); } public static void main(String args[]){ Data data = new Data(); System.out.println(data.phoneConcatenation(3)); System.out.print(data.idConcatenation()); } }
true
265e8ea2ddb3944cd4316fe639f7e831e6bc5bd4
Java
yhhuang79/antrack
/src/tw/plash/antrack/location/LocationUploader.java
UTF-8
2,388
2.265625
2
[]
no_license
package tw.plash.antrack.location; import java.util.List; import java.util.Observable; import java.util.Observer; import org.json.JSONException; import org.json.JSONObject; import tw.plash.antrack.AntrackApp; import tw.plash.antrack.util.Constants; import android.content.SharedPreferences; import android.util.Log; import com.android.volley.Response.ErrorListener; import com.android.volley.Response.Listener; import com.android.volley.VolleyError; public class LocationUploader implements Observer{ private AntrackApp app; private SharedPreferences preference; public LocationUploader(AntrackApp app, SharedPreferences preference) { this.app = app; this.preference = preference; } @Override public void update(Observable observable, Object data) { AntrackLocation antrackLocation = (AntrackLocation) data; upload(antrackLocation); } private void upload(AntrackLocation aLocation){ List<AntrackLocation> locations = app.getDbhelper().getAllPendingUploadLocations(); locations.add(aLocation); new Thread(new locationUploadTask(locations)).start(); } private class locationUploadTask implements Runnable{ private List<AntrackLocation> locations; public locationUploadTask(List<AntrackLocation> locations){ this.locations = locations; } @Override public void run() { try { app.getApi().upload(preference.getString("token", null), locations, new Listener<JSONObject>() { @Override public void onResponse(JSONObject obj) { try { Log.d("tw.uploadlocation", "locationUploadTask: res= " + obj.toString()); if(obj.getInt(Constants.API_RES_KEY_STATUS_CODE) == 200){ Log.d("tw.uploadlocation", "locationUploadTask: success"); int followers = obj.getInt("number_of_watcher"); app.getStatsKeeper().getStats().setNumberOfFollowers(followers); } else{ addToRetry(); } } catch (JSONException e) { e.printStackTrace(); addToRetry(); } } }, new ErrorListener() { @Override public void onErrorResponse(VolleyError arg0) { addToRetry(); } }); } catch (JSONException e) { e.printStackTrace(); } } private void addToRetry(){ app.getDbhelper().insertPendingUploadLocations(locations); } }; }
true
dbadbe2ffba8699ba19a8ea649a80d27bb6d28b3
Java
Juniorrek/DAC
/RHINDO/src/java/service/DepartamentoResource.java
UTF-8
1,315
2.234375
2
[]
no_license
package service; import java.util.List; import javax.ws.rs.core.Context; import javax.ws.rs.core.UriInfo; import javax.ws.rs.Produces; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import model.Departamento; import facade.Facade; import javax.ws.rs.PathParam; import javax.ws.rs.core.GenericEntity; @Path("departamentos") public class DepartamentoResource { @Context private UriInfo context; /** * Creates a new instance of DepartamentoResource */ public DepartamentoResource() { } @GET @Produces(MediaType.APPLICATION_JSON) public Response carregar() { List<Departamento> departamentos = Facade.carregarDepartamento(); GenericEntity<List<Departamento>> lista = new GenericEntity<List<Departamento>>(departamentos) {}; return Response.ok().entity(lista).build(); } @GET @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) public Departamento carregar(@PathParam("id") int id) { Departamento departamento = Facade.carregarDepartamento(id); return departamento; } @GET @Path("/notificar/{id}") public void notificar(@PathParam("id") int id) { Facade.notificarDepartamento(id); } }
true
cfc12789ac5d2061e8f351e5a7fe126fb750aa22
Java
tdt008/tdt-wheels
/wheel-redis/src/main/java/com/tdt/wheel/redis/domain/response/TokenInfo.java
UTF-8
371
1.710938
2
[]
no_license
package com.tdt.wheel.redis.domain.response; import lombok.Data; /** * @author tudoutiao * @version v1.0.0 * @description: TokenInfo * @since 2020/05/19 00:45 */ @Data public class TokenInfo { /** token类型: service:0 、user:1 */ private Integer tokenType; /** App 信息 */ private AppInfo appInfo; /** 用户其他数据 */ private UserInfo userInfo; }
true
f39c194ed3b0cf3082d09e89a134a5053d2afd6a
Java
WinterSmileSB101/EasySyrinx
/app/src/main/java/winter/zxb/smilesb101/easysyrinx/UI/Fragments/CityPicker.java
UTF-8
6,189
2.125
2
[]
no_license
package winter.zxb.smilesb101.easysyrinx.UI.Fragments; import android.content.Context; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.view.PagerAdapter; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import java.util.List; import winter.zxb.smilesb101.easysyrinx.Data.CityInfo; import winter.zxb.smilesb101.easysyrinx.Data.ProvinceInfo; import winter.zxb.smilesb101.easysyrinx.Data.TownInfo; import winter.zxb.smilesb101.easysyrinx.Net.HttpWork; import winter.zxb.smilesb101.easysyrinx.R; /** * 项目名称:EasySyrinx * 类描述:城市选择器 * 创建人:SmileSB101 * 创建时间:2017/5/26 0026 10:31 * 修改人:Administrator * 修改时间:2017/5/26 0026 10:31 * 修改备注: */ public class CityPicker extends Fragment implements View.OnClickListener{ View view; Context context; ImageView backImage; TextView backBtn; RecyclerView recyclerView; RVAdapter adapter; String TAG = "CityPicker"; @Nullable @Override public View onCreateView(LayoutInflater inflater,@Nullable ViewGroup container,@Nullable Bundle savedInstanceState){ view = inflater.inflate(R.layout.city_picker_fragment_layout,container,false); context = container.getContext(); recyclerView = (RecyclerView)view.findViewById(R.id.recyclerView); recyclerView.setItemAnimator(new DefaultItemAnimator()); backBtn = (TextView)view.findViewById(R.id.backBtn); backImage = (ImageView)view.findViewById(R.id.backImage); backBtn.setOnClickListener(this); backImage.setOnClickListener(this); recyclerView.setLayoutManager(new LinearLayoutManager(container.getContext(),LinearLayoutManager.VERTICAL,false)); HttpWork.getChinaProvince(new HttpWork.ProvinceListener(){ @Override public void onSuccess(List<ProvinceInfo> infoList){ adapter = new RVAdapter(infoList,getChildFragmentManager()); recyclerView.setAdapter(adapter); } @Override public void onError(String error){ Log.e(TAG,"onError: ",new Throwable(error)); } }); return view; } @Override public void onClick(View v){ switch(v.getId()) { case R.id.backBtn: case R.id.backImage: break; } } class RVAdapter extends RecyclerView.Adapter{ List<ProvinceInfo> provinceInfos; FragmentManager fragmentManager; Context context; List<CityInfo> cityInfos; List<TownInfo> townInfos; RVAdapter adapter; int ProvinceId; public void setCityInfos(List<CityInfo> cityInfos){ this.cityInfos = cityInfos; } public void setTownInfos(List<TownInfo> townInfos){ this.townInfos = townInfos; } public RVAdapter(List<ProvinceInfo> provinceInfos,FragmentManager fm) { this.provinceInfos = provinceInfos; fragmentManager = fm; adapter = this; } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent,int viewType){ context = parent.getContext(); View view = LayoutInflater.from(context) .inflate(R.layout.city_pick_item,parent,false); return new MyViewHolder(view); } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder,final int position){ MyViewHolder myViewHolder = (MyViewHolder)holder; if(townInfos!=null) { //乡镇信息 final TownInfo townInfo = townInfos.get(position); myViewHolder.itemName.setText(townInfo.getName()); myViewHolder.rightArrow.setVisibility(View.INVISIBLE); myViewHolder.item.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v){ } }); } else if(cityInfos!=null) { //城市信息 final CityInfo info = cityInfos.get(position); myViewHolder.item.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v){ //根据id获取相应内容 Log.e(TAG,"onBindViewHolder: "+ProvinceId+" "+info.getOwn_id()); HttpWork.getChinaCity(ProvinceId,info.getOwn_id(),new HttpWork.TownListener(){ @Override public void onSuccess(List<TownInfo> infoList){ townInfos = infoList; adapter.setTownInfos(townInfos); adapter.notifyDataSetChanged(); } @Override public void onError(String error){ Log.e(TAG,"onError: ",new Throwable(error)); } }); } }); myViewHolder.itemName.setText(info.getName()); } else if(provinceInfos!=null) { //省份信息 final ProvinceInfo info = provinceInfos.get(position); myViewHolder.item.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v){ //根据id获取相应内容 HttpWork.getChinaCity(info.getOwn_id(),new HttpWork.CityListener(){ @Override public void onSuccess(List<CityInfo> infoList){ ProvinceId = position+1;//赋值省份id cityInfos = infoList; adapter.setCityInfos(infoList); adapter.notifyDataSetChanged(); } @Override public void onError(String error){ Log.e(TAG,"onError: ",new Throwable(error)); } }); } }); myViewHolder.itemName.setText(info.getName()); } } @Override public int getItemCount(){ if(townInfos != null) { return townInfos.size(); } else if(cityInfos!=null) { return cityInfos.size(); } else if(provinceInfos!=null) { return provinceInfos.size(); } return 0; } class MyViewHolder extends RecyclerView.ViewHolder{ LinearLayout item; TextView itemName; ImageView rightArrow; public MyViewHolder(View itemView){ super(itemView); item = (LinearLayout)itemView.findViewById(R.id.item); itemName = (TextView)itemView.findViewById(R.id.itemName); rightArrow = (ImageView)itemView.findViewById(R.id.rightArrow); } } } }
true
3fe5a17329975b4077c8310edabfafa9d23c2cfe
Java
inakiap/EjemplosJSE
/JSEBasico/src/iap/clases/ficheros/Practica2Main.java
UTF-8
3,860
3.296875
3
[]
no_license
package iap.clases.ficheros; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; public class Practica2Main { /** * Método para leer un archivo de texto.FicheroToArray * * @param ruta * @return */ public static String [] leerFichero (String ruta) { String [] lineas = null; //coger un archivo File f = new File(ruta);//creo un objeto File con el parametro ruta que se introduce if (f.exists() && f.isFile() && f.canRead()) {//comprobar que existe, si es un archivo de texto y que se puede leer FileReader fileReader = null; try { fileReader = new FileReader(f); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } BufferedReader lector = new BufferedReader(fileReader); int i = 0; try { while (lector.readLine()!= null) { i++; System.out.println(i); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { fileReader.close(); lector.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { fileReader = new FileReader(f); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } lector = new BufferedReader(fileReader); if (i != 0) { lineas = new String [i]; for (int j = 0; j < lineas.length; j++) { try { lineas [j] = lector.readLine(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } return lineas; } /** * Método para guardar un archivo de texto a un fichero dado. ArrayToFichero * * @param contenido * @param destino * @return */ static void guardarFichero(String [] contenido, String destino) { //creo un objeto File con el parametro ruta que se introduce File f = new File(destino); //comprobar que existe, si es un archivo de texto y que se puede leer if (f.exists() && f.isFile() && f.canRead()) { FileWriter fw = null; try { fw = new FileWriter(destino, true); BufferedWriter bw = new BufferedWriter(fw); for (int j = 0; j < contenido.length; j++) { bw.write(contenido[j]); bw.newLine(); } bw.close(); fw.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } /** * Método que copia un archivo binario * @param origen * @param destino */ static void ficheroToFichero (String origen , String destino) { File file1 = null; File file2 = null; FileInputStream fIS = null; FileOutputStream fOS = null; try { file1 = new File (origen); file2 = new File (destino); fIS = new FileInputStream(file1); fOS = new FileOutputStream(file2); file2.createNewFile(); int contenido = 0; while ((contenido = fIS.read())!=-1){ fOS.write(contenido); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void main(String[] args) { // TODO Auto-generated method stub /* String [] mierda = leerFichero("ficherico1.txt"); for (int i = 0; i < mierda.length; i++) { System.out.println(mierda[i]); } */ //guardarFichero(leerFichero("ficherico1.txt"), "ficherico3.txt"); ficheroToFichero("foto.jpg", "foto2.jpg"); } }
true
b09efcba8434dc661bda249deccf320eeb35309b
Java
helloHaifei/AndroidNote
/common/src/main/java/com/zhf/common/net/NetConstant.java
UTF-8
329
1.703125
2
[]
no_license
package com.zhf.common.net; /** * 网络常量 * */ public class NetConstant { /** * app id */ public final static String APP_ID = "chezhu.app.android"; public final static String APP_CLIENT_VERSION = "1.0" ;//+ SystemUtil.getVersionCode(ContextUtil.getApplicationContext()); }
true
cbaaf1a5a68cf098d2f4b2fa6c4f5af709f25478
Java
sivabe35/inquiry
/library/src/androidTest/java/com/afollestad/inquiry/AutoValueRow.java
UTF-8
1,133
2.453125
2
[ "Apache-2.0" ]
permissive
package com.afollestad.inquiry; import com.afollestad.inquiry.annotations.Column; import com.afollestad.inquiry.annotations.Table; import com.google.auto.value.AutoValue; /** * @author Aidan Follestad (afollestad) */ @Table @AutoValue public abstract class AutoValueRow { public static Builder create() { return new AutoValue_AutoValueRow.Builder(); } public AutoValueRow withId(long id) { return new AutoValue_AutoValueRow.Builder(this).id(id).build(); } @Column(autoIncrement = true, name = "_id", primaryKey = true) public abstract long id(); @Column public abstract String username(); @Column public abstract int age(); @Column public abstract boolean online(); @Column public abstract float rank(); @AutoValue.Builder static abstract class Builder { public abstract Builder id(long id); public abstract Builder username(String username); public abstract Builder age(int age); public abstract Builder online(boolean online); public abstract Builder rank(float rank); public abstract AutoValueRow build(); } }
true
5e88f37e43c2660ff55b40613878ee56864dfa42
Java
CrackerCat/XiaomiFramework
/mi2s_securitycenter_miui12/src/main/java/com/miui/superpower/c/b.java
UTF-8
1,727
2.046875
2
[]
no_license
package com.miui.superpower.c; import android.util.Log; import java.util.ArrayList; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; public class b extends d { public b(String str) { super(str); } private ArrayList<String> b(String str) { ArrayList<String> arrayList = new ArrayList<>(); try { JSONArray jSONArray = new JSONArray(str); for (int i = 0; i < jSONArray.length(); i++) { if (jSONArray.get(i) != null) { arrayList.add(jSONArray.get(i).toString()); } } } catch (JSONException e) { Log.d("SuperPowerSaveManager", "jsonArray解析失败" + e); } return arrayList; } /* access modifiers changed from: protected */ public void a(JSONObject jSONObject) { super.a(jSONObject); if (a()) { JSONArray optJSONArray = jSONObject.optJSONArray("hiddenPackageName"); if (optJSONArray != null) { com.miui.common.persistence.b.b("pref_key_superpower_cloud_hidden_packagename", b(optJSONArray.toString())); } JSONArray optJSONArray2 = jSONObject.optJSONArray("whitePackageName"); if (optJSONArray2 != null) { com.miui.common.persistence.b.b("pref_key_superpower_cloud_white_processname", b(optJSONArray2.toString())); } JSONArray optJSONArray3 = jSONObject.optJSONArray("blackPackageName"); if (optJSONArray3 != null) { com.miui.common.persistence.b.b("pref_key_superpower_cloud_black_processname", b(optJSONArray3.toString())); } } } }
true
89f9642f425e72cf596282aba14a4640e38dca29
Java
Olafur01/Trix-oppgaver-ny
/Uke12Oppgaver/SnoemannTegning.java
UTF-8
928
3.375
3
[]
no_license
import java.awt.*; import java.awt.event.*; import javax.swing.*; public class SnoemannTegning extends JComponent { SnoemannTegning(){ setPreferredSize(new Dimension(300,600)); } void tegnKule(Graphics2D g2, int centerX, int centerY, int radius){ g2.setColor(Color.WHITE); g2.fillOval(centerX-radius, centerY-radius, 2*radius, 2*radius); g2.setColor(Color.BLACK); g2.drawOval(centerX-radius, centerY-radius, 2*radius, 2*radius); } @Override public void paintComponent(Graphics g){ super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; //Hodet tegnKule(g2, 150, 150, 50); //Overkropp tegnKule(g2, 150, 275, 75); //Underkropp tegnKule(g2, 150, 450, 100); //Hatten g2.setColor(Color.RED); g2.fillRect(125, 50, 50, 25); g2.fillRect(100, 75, 100, 30); } }
true
695780bfe28c729c0596ffb0c997bf4b088dba9e
Java
ayax79/bb
/presentation/src/main/java/com/blackbox/presentation/action/user/DashBoardActionBean.java
UTF-8
805
1.710938
2
[]
no_license
/* * Copyright (c) 2009. Blackbox, LLC * All rights reserved. */ package com.blackbox.presentation.action.user; import com.blackbox.presentation.action.BaseBlackBoxActionBean; import net.sourceforge.stripes.action.DontValidate; import net.sourceforge.stripes.action.ForwardResolution; import net.sourceforge.stripes.action.Resolution; import net.sourceforge.stripes.action.UrlBinding; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /* * * Original Author: Artie Copeland * Last Modified Date: $DateTime: $ */ @UrlBinding("/dashboard") public class DashBoardActionBean extends BaseBlackBoxActionBean { @DontValidate public Resolution begin() { return new ForwardResolution("/dashboard.jsp"); } @Override public boolean isHasIntro() { return true; } }
true
d6d2d61a1424294f51c6d0a999d1d00088829799
Java
NozhkinNikita/hackathon2019
/server/hton/controller/src/main/java/com/hton/api/user/ScanController.java
UTF-8
6,304
1.914063
2
[]
no_license
package com.hton.api.user; import com.hton.api.CredentialUtils; import com.hton.api.FilterUtils; import com.hton.api.WebMvcConfig; import com.hton.api.requests.ScanCreateRequest; import com.hton.dao.CommonDao; import com.hton.dao.filters.ComplexCondition; import com.hton.dao.filters.Condition; import com.hton.dao.filters.Operation; import com.hton.dao.filters.SearchCondition; import com.hton.dao.filters.SimpleCondition; import com.hton.domain.Scan; import com.hton.domain.User; import com.hton.domain.UserLocation; import com.hton.entities.Role; import com.hton.entities.ScanEntity; import com.hton.entities.ScanStatus; import com.hton.service.LocationValidatorService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; 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.RequestParam; import java.time.LocalDateTime; import java.util.Arrays; import java.util.Collections; import java.util.Optional; @CrossOrigin @Controller @RequestMapping(value = WebMvcConfig.USER_SCAN_PATH) @Slf4j public class ScanController { @Autowired private CommonDao<Scan, ScanEntity> scanDao; @Autowired private CredentialUtils credentialUtils; @Autowired private LocationValidatorService locationValidatorService; @GetMapping(value = "/{id}", produces = "application/json") public ResponseEntity<?> getScanById(@PathVariable("id") String id) { User user = credentialUtils.getUserInfo(); if (credentialUtils.getCredentialRoles().contains(Role.NETWORK_ADMIN)) { return new ResponseEntity<>(scanDao.getById(id), HttpStatus.OK); } else { ComplexCondition condition = new ComplexCondition.Builder() .setOperation(Operation.AND) .setConditions(new SimpleCondition.Builder() .setSearchField("id") .setSearchCondition(SearchCondition.EQUALS) .setSearchValue(id) .build(), new SimpleCondition.Builder() .setSearchField("userLocation.userId") .setSearchCondition(SearchCondition.EQUALS) .setSearchValue(user.getId()) .build() ) .build(); return new ResponseEntity<>( scanDao.getByCondition(condition).stream().findFirst().orElse(null), HttpStatus.OK); } } @GetMapping(value = "/", produces = "application/json") public ResponseEntity<?> getScans(@RequestParam(required = false) String filter) { User user = credentialUtils.getUserInfo(); Condition condition = FilterUtils.getFilterWithLogin(filter, "userLocation.userId", user.getId()); condition.setMaskFields(Arrays.asList("id", "begin", "end", "status", "device", "userLocation.location")); return new ResponseEntity<>(scanDao.getByCondition(condition), HttpStatus.OK); } @PostMapping(value = "/") public ResponseEntity createScan(@RequestBody ScanCreateRequest request) { String login = credentialUtils.getCredentialLogin(); Optional<UserLocation> userLocation = locationValidatorService.validateLocation(login, request.getLocationId()); if (userLocation.isPresent()) { Scan scan = new Scan(); scan.setBegin(LocalDateTime.now()); scan.setStatus(ScanStatus.DRAFT); scan.setUserLocation(userLocation.get()); scan.setDevice(request.getDevice()); scan.setPoints(Collections.emptyList()); Scan savedScan = scanDao.save(scan); ScanCreateRequest result = new ScanCreateRequest(); result.setBegin(savedScan.getBegin()); result.setId(savedScan.getId()); return new ResponseEntity<>(result, HttpStatus.CREATED); } else { return new ResponseEntity<>(HttpStatus.FORBIDDEN); } } @PutMapping(value = "/{id}") public ResponseEntity<?> finishScan(@PathVariable("id") String id) { Scan scan = scanDao.getById(id); if (scan.getUserLocation() == null) { return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } else { String login = credentialUtils.getCredentialLogin(); Optional<UserLocation> result = locationValidatorService.validateLocation(login, scan.getUserLocation().getLocation().getId()); if (result.isPresent()) { scan.setStatus(ScanStatus.FINISHED); scanDao.update(scan); return new ResponseEntity<>(HttpStatus.OK); } else { return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } } } @DeleteMapping(value = "/{id}", produces = "application/json") public ResponseEntity<?> removeScanById(@PathVariable("id") String id) { Scan scan = scanDao.getById(id); if (scan.getUserLocation() == null) { return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } else { String login = credentialUtils.getCredentialLogin(); Optional<UserLocation> result = locationValidatorService.validateLocation(login, scan.getUserLocation().getLocation().getId()); if (result.isPresent()) { scanDao.remove(id); return new ResponseEntity<>(HttpStatus.OK); } else { return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } } } }
true
c26371f81e049a60a245351120b8850a8b3b8aaa
Java
shawntime/shawn-design-pattern
/src/main/java/com/shawntime/designpattern/strategy/example2/GiftInfoTest.java
UTF-8
370
2.09375
2
[]
no_license
package com.shawntime.designpattern.strategy.example2; import org.junit.Assert; /** * Created by shma on 2018/9/26. */ public class GiftInfoTest { public GiftInfo getGiftInfo(int subjectId, int activityId) { GiftInfo giftInfo = GiftInfoContext.getGiftInfo(subjectId, activityId); Assert.assertNotNull(giftInfo); return giftInfo; } }
true
27b84afe7c58957881012236f787b048b31a4379
Java
yangziwen/patchmaker-java8
/src/main/java/net/yangziwen/patchmaker/util/CmdUtil.java
UTF-8
1,300
2.859375
3
[]
no_license
package net.yangziwen.patchmaker.util; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; public class CmdUtil { private CmdUtil(){} public static <T> Map<String, T> consume(Process process, CmdCallback<T> callback) { if(process == null) { return Collections.emptyMap(); } Map<String, T> resultMap = new LinkedHashMap<>(); // 保持顺序 String line = ""; try ( InputStream in = process.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); ) { while((line = reader.readLine()) != null) { callback.process(line, resultMap); } callback.afterProcess(resultMap); } catch (Exception e) { e.printStackTrace(); return null; } return resultMap; } public static int waitForProcess(Process process) { if(process != null) { try { return process.waitFor(); } catch (InterruptedException e) { e.printStackTrace(); } } return -1; } public static abstract class CmdCallback<T> { protected abstract void process(String line, Map<String, T> resultMap); protected void afterProcess(Map<String, T> resultMap) { // defaultly do nothing } } }
true
2a3762417bdcd36d807f85dc1b3489a7c3822843
Java
Noweaj/Practice
/Kakao_2018OR_test1/src/main/ASCIIEncodedStrings.java
UTF-8
824
3.390625
3
[]
no_license
package main; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class ASCIIEncodedStrings { private static void conversion(String input) { String tempInput = input; String num = ""; for(int i=1; i<input.length(); i++) { num += tempInput.substring(tempInput.length()-1, tempInput.length()); tempInput = tempInput.substring(0, tempInput.length()-1); if(Integer.parseInt(num)<32) { } else { System.out.print((char) Integer.parseInt(num)); num = ""; } } } public static void main(String[] args) throws IOException { String filename = "input.txt"; BufferedReader br = new BufferedReader(new FileReader(filename)); try { String input = br.readLine(); conversion(input); } finally { br.close(); } } }
true
b4d705176c3d7592374665dad9d898c80b55c12c
Java
DonaldY/coding2017
/group11/996108220/src/com/coderising/jvm/loader/ClassFileLoader.java
UTF-8
1,984
2.734375
3
[]
no_license
package com.coderising.jvm.loader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import com.coderising.jvm.clz.ClassFile; public class ClassFileLoader { private List<String> clzPaths = new ArrayList<String>(); public byte[] readBinaryCode(String className) { className = className.replace('.', File.separatorChar) +".class"; for(String path : this.clzPaths){ String clzFileName = path + File.separatorChar + className; byte[] codes = loadClassFile(clzFileName); if(codes != null){ return codes; } } return null; } private byte[] loadClassFile(String fileName) { ArrayList<Byte> list=new ArrayList<Byte>(); try { InputStream in=new FileInputStream(fileName.toString()); int length=-1; byte[] buffer=new byte[1024]; while ((length=in.read(buffer))!=-1) { int size=list.size(); for (int i = size; i < size+length; i++) { list.add(buffer[i-size]); } } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } byte[] byteCodes=new byte[list.size()]; for (int i = 0; i < byteCodes.length; i++) { byteCodes[i]=list.get(i); } return byteCodes; } public ClassFile loadClass(String className) { byte[] codes = this.readBinaryCode(className); ClassFileParser parser = new ClassFileParser(); return parser.parse(codes); } public void addClassPath(String path) { clzPaths.add(path); } public String getClassPath(){ String string=""; for (int i = 0; i < clzPaths.size(); i++) { string=i==0?string+clzPaths.get(i):string+";"+clzPaths.get(i); } return string; } }
true
6f704bc8a9dd4a0723786bcd52c0b364bcd1afc7
Java
xinyuan4android/TPshop-Demo
/soubaoShopMobile/src/main/java/com/tpshop/mallc/utils/SPOrderUtils.java
UTF-8
7,554
2.5625
3
[ "Apache-2.0" ]
permissive
/** * tpshop * ============================================================================ * * 版权所有 2015-2027 深圳搜豹网络科技有限公司,并保留所有权利。 * 网站地址: http://www.tp-shop.cn * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 . * 不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: 飞龙 15/12/1 $ * $description: 订单公共操作类 */ package com.tpshop.mallc.utils; import com.tpshop.mallc.model.SPProduct; import com.tpshop.mallc.model.order.SPOrder; /** * Created by admin on 2016/7/1. */ public class SPOrderUtils { //订单类型 public static final String typeWaitPay = "WAITPAY"; // 待支付 public static final String typeWaitSend = "WAITSEND"; // 待发货 public static final String typeWaitReceive = "WAITRECEIVE"; // 待收货 public static final String typeWaitComment = "WAITCCOMMENT"; // 待评价 public static final String typeCommented = "COMMENTED"; // 已评价 public static final String typeReturned = "RETURNED"; // 已退货 public static final String typeAll = ""; // 全部订单 public final String typeCanceled = "CANCEL"; // 已取消 public final String typeFinished ="FINISH"; // 已完成 public static OrderStatus getOrderStatusByValue(int value){ switch (value){ case 1: return OrderStatus.waitPay; case 2: return OrderStatus.waitSend; case 3: return OrderStatus.waitReceive; case 4: return OrderStatus.waitComment; case 5: return OrderStatus.commented; case 6: return OrderStatus.returned; case 7: return OrderStatus.all; } return OrderStatus.all; } /** * 订单状态 */ static public enum OrderStatus{ waitPay(1 , "待付款"), waitSend(2,"待发货"), waitReceive(3,"待收货"), waitComment(4,"待评价"), commented(5,"已评价"), returned(6 ,"已退货"), all(7 , "全部订单"); private String name; private int value; private OrderStatus(int value , String name){ this.name = name; this.value = value; } public int value(){ return value; } } /** * 获取订单状态的 中文描述名称 * * @param order order description * * @return return value description */ public static String getOrderStatusText(SPOrder order){ if (order.getPayStatus().equals("0") && order.getOrderStatus().equals("0")){ return "待支付"; } if(order.getPayStatus().equals("1") || order.getPayCode().equals("cod") && order.getOrderStatus().equals("0") && order.getShippingStatus().equals("0")){ //待发货: (已支付 || 货到付款) && 未发货 && 已下单 return "待发货"; } if(order.getShippingStatus().equals("1") && order.getOrderStatus().equals("0")){ //待收货: 已发货 && 已下单 return "待收货"; } if(order.getOrderStatus().equals("1")){ //待评价: 待评价 return "待评价"; } if(order.getOrderStatus().equals("4")){ //已评价 return "已评价"; } return "其它"; } /** * 获取订单状态的 * 订单状态详情可查看TPSHOP开发手册 : (Android/IOS)开发者手册 -> 常见文件 -> TPSHOP的订单状态 * * @param order order description * * @return 订单枚举 * */ public static OrderStatus getOrderStatusWithOrder(SPOrder order){ if (order.getPayStatus().equals("0") && order.getOrderStatus().equals("0")){ //待支付: 未支付 && 已下单 return OrderStatus.waitPay; } if(order.getPayStatus().equals("1") || order.getPayCode().equals("cod") && order.getOrderStatus().equals("0") && order.getShippingStatus().equals("0")){ //待发货: (已支付 || 货到付款) && 未发货 && 已下单 return OrderStatus.waitSend; } if(order.getShippingStatus().equals("1") && order.getOrderStatus().equals("0")){ //待收货: 已发货 && 已下单 return OrderStatus.waitReceive; } if(order.getOrderStatus().equals("1")){ //待评价: 待评价 return OrderStatus.waitComment; } if(order.getOrderStatus().equals("4")){ //已评价 return OrderStatus.commented; } return OrderStatus.all; } /** * 根据订单状态获取标题 * * @return 标题 */ public static String getOrderTitlteWithOrderStatus(OrderStatus orderStatus){ switch (orderStatus) { case waitPay: return "待付款"; case waitSend: return "待发货"; case waitReceive: return "待收货"; case waitComment: return "待评价"; case commented: return "已评价"; case returned: return "已退货"; case all: return "全部订单"; } return "全部订单"; } /** * 根据订单状态返回订单类型 * * @return 标题 */ public static String getOrderTypeWithOrderStatus(OrderStatus orderStatus){ switch (orderStatus) { case waitPay: return typeWaitPay; case waitSend: return typeWaitSend; case waitReceive: return typeWaitReceive; case waitComment: return typeWaitComment; case commented: return typeCommented; case returned: return typeReturned; case all: return typeAll; } return typeAll; } /** * 根据订单状态返回订单类型 * * @return 标题 */ public static String getExchangeStatusNameWithStatus(String status){ switch (Integer.valueOf(status)) { case 0: return "申请中"; case 1: return "处理中"; case 2: return "已完成"; } return "未知"; } /** * 根据订单状态返回订单类型 * * @return 标题 */ public static String getExchangeTypeNameWithType(String type){ switch (Integer.valueOf(type)) { case 0: return "退货"; case 1: return "换货"; } return "未知"; } public static int getProductCount(SPOrder order){ if (order == null || order.getProducts() == null || order.getProducts().size() < 1){ return 0; } int count = 0; for (SPProduct product : order.getProducts()){ count += product.getGoodsNum(); } return count; } }
true
f7a0aca31a03bd842518c8f0b7e126dac51bf22e
Java
AlexKosz/basics
/Basics.java
UTF-8
2,645
3.953125
4
[]
no_license
import java.util.ArrayList; public class Basics { public void printAll(Integer num) { for(int i = 0; i < num; i++) System.out.println(i); } public void printOdd(Integer num) { for(int i = 0; i < num; i++) { if (i % 2 == 1 ) System.out.println(i); } } public void sum(Integer num ) { Integer total = 0; for(Integer i=0; i < num; i++) { System.out.println("New Num:" + i + "Sum:" + (total + i)); total = i + total; } System.out.println(total); } public void itterateArray() { Integer[] arr = {1,2, 3, 4, 5, 5, 7, 8, 9, 10}; for (Integer i=0; i<arr.length; i++) { System.out.println(arr[i]); } } public void arrayOdd(Integer num) { ArrayList<Integer> arr = new ArrayList<Integer>(); for (Integer i=0; i<num; i++) { if (i % 2 == 1) { arr.add(i); } } System.out.println(arr); } public void findMax() { Integer[] arr = {100, 2, 4, 1, 1000, 9}; Integer max = arr[0]; for(Integer i=0; i<arr.length; i++) { if(arr[i]> max) { max = arr[i]; } } System.out.println(max); } public void greaterThan() { Integer[] arr = {1,3,5,7}; Integer y = 3; Integer total = 0; for (Integer i=0; i<arr.length; i++) { if(y < arr[i]) { total = total + 1; } } System.out.println(total); } public void average() { Integer[] arr = {1,3,5,7}; Integer temp = 0; for(Integer i=0; i<arr.length; i++) { temp = temp + arr[i]; } temp = temp / arr.length; System.out.println(temp); } public void square() { ArrayList<Integer> arr2 = new ArrayList<Integer>(); Integer[] arr = {10,12,3,-1}; for (Integer i=0; i<arr.length; i++) { arr2.add(arr[i] * arr[i]); } System.out.println(arr2); } public void noNegs() { ArrayList<Integer> arr2 = new ArrayList<Integer>(); Integer[] arr = {1,5,10,-2,-5,8}; for (Integer i=0; i<arr.length; i++) { if(arr[i] > 0) { arr2.add(arr[i]); }else { arr2.add(0); } } System.out.println(arr2); } public void maxMinAvg() { ArrayList<Integer> arr2 = new ArrayList<Integer>(); Integer[] arr = {100,5,12,-2}; Integer min = 0; Integer max = 0; Integer avg = 0; for (Integer i=0; i<arr.length; i++) { avg = avg + arr[i]; if(arr[i] < min) { min = arr[i]; }else if(arr[i] > max){ max = arr[i]; } } arr2.add(max); arr2.add(min); arr2.add(avg/arr.length); System.out.println(arr2); } public void shiftingVals(){ ArrayList<Integer> newArr = new ArrayList<Integer>(); Integer[] arr = {341,6,21,-4}; for (Integer i = 1; i<arr.length; i++ ) { newArr.add(arr[i]); } newArr.add(0); System.out.println(newArr); } }
true
d33a1dc28c315336e315410576a91e907494573f
Java
lgh52406/springcloudLearning
/service-hi/src/main/java/com/huiquan/servicehi/controller/HelloController.java
UTF-8
994
2.28125
2
[]
no_license
package com.huiquan.servicehi.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; import java.util.logging.Level; import java.util.logging.Logger; /** * @author lgh email:luguihua@witspring.com * @Description: * @Date 2018/5/9 13:59 * @since Ver V */ @RestController public class HelloController { private static final Logger LOGGER = Logger.getLogger(HelloController.class.getName()); @Autowired private RestTemplate restTemplate; @RequestMapping("/hi") public String callHome(){ LOGGER.log(Level.INFO,"calling trace service-hi "); return restTemplate.getForObject("http://localhost:8103/miya",String.class); } @RequestMapping("/info") public String info(){ LOGGER.info("calling trace service-hi "); return "i`m service-hi"; } }
true
57c8393cb07606f995602f0b36135c6d0b360404
Java
edusasse/BrowseFramework
/base/src/main/java/br/com/browseframework/base/exception/enums/BusinessExceptionMessage.java
UTF-8
448
2.34375
2
[]
no_license
package br.com.browseframework.base.exception.enums; public enum BusinessExceptionMessage { AUTHENTICATION_ERROR("authentication.error"), GENERIC_ERROR("generic.error"), DATABASE_ERROR("atabase.error"), OPTIMISTICLOCK_ERROR("optimisticlock.error"); private String key; private BusinessExceptionMessage(String key){ setKey(key); } public void setKey(String key) { this.key = key; } public String getKey() { return key; } }
true
a16eea36a7b27cb05ebda616d87fc7ce2ab0c380
Java
soumya348/FlatList
/app/src/main/java/com/soumya/flatlist/MainActivity.java
UTF-8
3,801
2.328125
2
[]
no_license
package com.soumya.flatlist; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.app.ProgressDialog; import android.os.Bundle; import android.view.MenuItem; import android.view.View; import android.widget.Toast; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { RecyclerView recyclerView; FlatListAdapter flatListAdapter; ArrayList<FlatList> lists=new ArrayList<FlatList>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); recyclerView=findViewById(R.id.nameRecycler); recyclerView.setHasFixedSize(true); flatListAdapter=new FlatListAdapter(lists, MainActivity.this); recyclerView.setAdapter(flatListAdapter); LinearLayoutManager linearLayoutManager=new LinearLayoutManager(MainActivity.this,LinearLayoutManager.VERTICAL,false); recyclerView.setLayoutManager(linearLayoutManager); // for (int i=0; i<10; i++ ) { // FlatList list=new FlatList(String.valueOf(i),"Mr","soumya","ranjan"); // lists.add(list); // } ProgressDialog loading = ProgressDialog.show(this, "Please wait...", "Fetching...", false, false); String url = " https://randomuser.me/api/?results=100&inc=name"; StringRequest stringRequest = new StringRequest(url, new Response.Listener<String>() { @Override public void onResponse(String response) { loading.dismiss(); showJSON(response); // Toast.makeText(MainActivity.this, "" + response, Toast.LENGTH_LONG).show(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Toast.makeText(MainActivity.this, error.getMessage().toString(), Toast.LENGTH_LONG).show(); } }); RequestQueue requestQueue = Volley.newRequestQueue(this); requestQueue.add(stringRequest); } private void showJSON(String response) { // Toast.makeText(MainActivity.this,""+response,Toast.LENGTH_LONG).show(); if (response.contains("results")) { try { JSONObject jsonObject = new JSONObject(response); JSONArray result = jsonObject.getJSONArray("results"); for (int i = 0; i < result.length(); i++) { JSONObject ob = result.getJSONObject(i); String pageName = ob.getJSONObject("name").getString("title"); FlatList list = new FlatList(String.valueOf(i+1), ob.getJSONObject("name").getString("title"), ob.getJSONObject("name").getString("first"), ob.getJSONObject("name").getString("last")); lists.add(list); } // Toast.makeText(MainActivity.this,""+result.getJSONObject(1).getJSONObject("name").getString("title"),Toast.LENGTH_LONG).show(); } catch (JSONException e) { e.printStackTrace(); } recyclerView.setAdapter(flatListAdapter); flatListAdapter.notifyDataSetChanged(); } else { Toast.makeText(MainActivity.this,""+response,Toast.LENGTH_LONG).show(); } } }
true
0f19b04fcfd8c7bb542d56712914e65bdf1b4abd
Java
SunilTanuku/CoreJava_Java8
/CoreJava/src/com/sunil/corejava/HelloWorld.java
UTF-8
162
2.09375
2
[]
no_license
package com.sunil.corejava; public class HelloWorld { public static void main(String a[]) { System.out.println(10+100+"Hello "+30+"world"+100); } }
true
e5de8eb5861a11a1fd3940ed3daf2da5db808208
Java
chronos314/workspace
/day16/src/com/zzxx/queue/Demo02Deque.java
UTF-8
859
3.78125
4
[]
no_license
package com.zzxx.queue; import java.util.Deque; import java.util.LinkedList; public class Demo02Deque{ public static void main(String[] args){ // 1.创建一个双端队列的方法 Deque<String> dq = new LinkedList<>(); // 2.拥有队列相关的所有方法 offer peek poll dq.offer("哈哈哈"); dq.offer("嘻嘻嘻"); // 3.可以从队列头和尾加元素 dq.offerFirst("hahaha"); dq.offerLast("heihei"); // 等同于offer方法 System.out.println(dq); // 4.可以从队列头和尾取元素 String s1 = dq.pollFirst(); // 等同于poll System.out.println("队列头: " + s1); System.out.println("队列: " + dq); s1 = dq.pollLast(); System.out.println("队列尾: " + s1); System.out.println("队列: " + dq); } }
true
3f84b09e87957097d3b773233dc4f68c3f62173f
Java
CarryWill/Shoppingmart
/src/com/uu/test/CategoryDaoImplTest.java
UTF-8
826
2.125
2
[]
no_license
package com.uu.test; import com.uu.dao.CategoryDao; import com.uu.dao.impl.CategoryDaoImpl; import org.junit.Test; import org.junit.Before; import org.junit.After; /** * CategoryDaoImpl Tester. * * @author <Authors name> * @since <pre>三月 12, 2018</pre> * @version 1.0 */ public class CategoryDaoImplTest { CategoryDao dao ; @Before public void before() throws Exception { String i="b44c1065-d057-4d2a-8d5a-06163e85685e_"; System.out.println(i.length()); dao= new CategoryDaoImpl(); } @After public void after() throws Exception { } /** * * Method: addCategory(String cname) * */ @Test public void testAddCategory() throws Exception { dao.addCategory("nike"); } @Test public void testdeleteMultiGategory()throws Exception{ dao.deleteMultiGategory(0); } }
true
d9f721f69002b4e777301fdc1e684f19a4f30fdd
Java
GuilhermeJackson/ATM-Consultoria
/app/src/main/java/com/example/atmempresadeconsultoria/GroupRadionButtonActivity.java
UTF-8
1,255
2.109375
2
[]
no_license
package com.example.atmempresadeconsultoria; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TextView; public class GroupRadionButtonActivity extends AppCompatActivity { private RadioGroup radioGroup; private RadioButton radionButton; private Button escolher; private TextView exibir; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_group_radion_button); radioGroup = findViewById(R.id.radioGroup); escolher = findViewById(R.id.escolher); exibir = findViewById(R.id.exibindoRadio); escolher.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int idRadioButtonEscolhido = radioGroup.getCheckedRadioButtonId(); if (idRadioButtonEscolhido >0) { radionButton = findViewById(idRadioButtonEscolhido); exibir.setText(radionButton.getText()); } } }); } }
true
f3d4dbb44e6fdccc5a69ecf596e46a25eeba636f
Java
Srinivasa-Raghavan/FirstBatch
/src/main/java/wdMethods/SeMethods.java
UTF-8
8,013
2.609375
3
[]
no_license
package wdMethods; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit; import org.apache.commons.io.FileUtils; import org.openqa.selenium.By; import org.openqa.selenium.OutputType; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.WebDriverWait; public class SeMethods implements WdMethods{ public static RemoteWebDriver driver; int imgctr; public static WebDriverWait objExpWait; @Override public void startApp(String browser, String url) { if(browser.equalsIgnoreCase("chrome")) { System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe"); driver = new ChromeDriver(); }else if(browser.equalsIgnoreCase("firefox")) { System.setProperty("webdriver.gecko.driver", "./drivers/geckodriver.exe"); driver = new FirefoxDriver(); } driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); driver.get(url); System.out.println("The Browser "+browser+" launched Successfully"); //Declaring Explicit wait time objExpWait = new WebDriverWait(driver, 25); takeSnap(); } @Override public WebElement locateElement(String locator, String locValue) { switch(locator) { case "id": return driver.findElementById(locValue); case "name": return driver.findElementByName(locValue); case "link": return driver.findElementByLinkText(locValue); case "class": return driver.findElementByClassName(locValue); case "xpath": return driver.findElementByXPath(locValue); } return null; } @Override public WebElement locateElement(String locValue) { return driver.findElementById(locValue); } @Override public void type(WebElement ele, String data) { ele.clear(); ele.sendKeys(data); System.out.println("The Element "+ele+" is entered with "+data); takeSnap(); } @Override public void click(WebElement ele) { ele.click(); System.out.println("The Element "+ele+" is clicked"); takeSnap(); } @Override public void clickWithoutSnap(WebElement ele) { ele.click(); } @Override public String getText(WebElement ele) { //returns the visible text in the given webelement takeSnap(); return ele.getText(); } @Override public void selectDropDownUsingText(WebElement ele, String value) { // Select the dropdown values using visible text Select dropDown = new Select(ele); dropDown.selectByVisibleText(value); takeSnap(); } @Override public void selectDropDownUsingIndex(WebElement ele, int index) { // Select the dropdown values using index Select dropDown = new Select(ele); dropDown.selectByIndex(index); takeSnap(); } @Override public boolean verifyTitle(String expectedTitle) { // Verify the title if(driver.getTitle().equals(expectedTitle)) { takeSnap(); return true; } else { takeSnap(); return false; } } @Override public void verifyExactText(WebElement ele, String expectedText) { // Verify the exact text of the given element if(ele.getText().equals(expectedText)) { System.out.println("The Visible Text of the element: "+ele+"EXACTLY matches"); } else { System.out.println("The Visible Text of the element: "+ele+"NOT matches"); } takeSnap(); } @Override public void verifyPartialText(WebElement ele, String expectedText) { // Verify the partial text of the given element if(ele.getText().contains(expectedText)) { System.out.println("The Visible Text of the element: "+ele+"Partially matches"); } else { System.out.println("The Visible Text of the element: "+ele+"doesn't contains the expected text"); } takeSnap(); } @Override public void verifyExactAttribute(WebElement ele, String attribute, String value) { // Verifies the attribute value exactly matches with the expected value in the given webelement if(ele.getAttribute(attribute).equals(value)) { System.out.println("The attribute value of the element: "+ele+"EXACTLY matches"); } else { System.out.println("The attribute value of the element: "+ele+"doesn't Matches"); } takeSnap(); } @Override public void verifyPartialAttribute(WebElement ele, String attribute, String value) { // Verifies the attribute value Partially matches with the expected value in the given webelement if(ele.getAttribute(attribute).contains(value)) { System.out.println("The attribute value of the element: "+ele+"Partially matches"); } else { System.out.println("The attribute value of the element: "+ele+"doesn't Matches"); } takeSnap(); } @Override public void verifySelected(WebElement ele) { //Verify whether the element is selected if(ele.isSelected()) { System.out.println("The Element" +ele +"is Selected"); } else { System.out.println("The Element" +ele +"is NOT Selected"); } takeSnap(); } @Override public void verifyDisplayed(WebElement ele) { //Verify whether the element is displayed if(ele.isDisplayed()) { System.out.println("The Element" +ele +"is Displayed"); } else { System.out.println("The Element" +ele +"is NOT Displayed"); } takeSnap(); } @Override public void switchToWindow(int index) { //switch to window with the index given Set<String> allWindows = driver.getWindowHandles(); List<String> allList = new ArrayList<String>(); allList.addAll(allWindows); System.out.println(allList.size()); driver.switchTo().window(allList.get(index)); takeSnap(); } @Override public void switchToFrame(WebElement ele) { //switch to the specific frame (ele) driver.switchTo().frame(ele); takeSnap(); } @Override public void acceptAlert() { //accept the alert driver.switchTo().alert().accept(); } @Override public void dismissAlert() { //dismissing the alert driver.switchTo().alert().dismiss(); } @Override public String getAlertText() { //returns the alert text return driver.switchTo().alert().getText(); } @Override public void takeSnap() { //take snapshot and save as png in the project path File src = driver.getScreenshotAs(OutputType.FILE); File desc = new File("./snaps/img"+imgctr+".png"); try { FileUtils.copyFile(src, desc); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } imgctr++; } @Override public void closeBrowser() { driver.close(); } @Override public void closeAllBrowsers() { driver.quit(); } @Override public void delayUntilClickable(String xPath) { objExpWait.until(ExpectedConditions.elementToBeClickable(By.xpath(xPath))); } @Override public void delayUntilVisible(String type, String value) { if(type.equalsIgnoreCase("id")) { objExpWait.until(ExpectedConditions.visibilityOfElementLocated(By.id(value))); } if(type.equalsIgnoreCase("class")) { objExpWait.until(ExpectedConditions.visibilityOfElementLocated(By.className(value))); } } @Override public void switchToFrameByNameID(String value) { driver.switchTo().frame(value); } @Override public String getAttributeValue(WebElement ele,String attributeName) { return ele.getAttribute(attributeName); } @Override public void delayUntilFrameVisible(String frameNameID) { objExpWait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.id(frameNameID))); } }
true
cfd86b034e110ac85c8ae59f0a16c5e9b6580b1e
Java
meangeee/webStudy03_Maven
/webStudy03_Maven/src/main/java/kr/or/ddit/filter/MultipartRequestCheckFilter.java
UTF-8
1,480
2.328125
2
[]
no_license
package kr.or.ddit.filter; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import kr.or.ddit.wrapper.MultipartRequestWrapper; public class MultipartRequestCheckFilter implements Filter{ private static Logger logger = LoggerFactory.getLogger(MultipartRequestCheckFilter.class); @Override public void init(FilterConfig filterConfig) throws ServletException { logger.info("{} 필터 생성", getClass().getSimpleName()); } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { //1. 파일 업로드 여부 확인 HttpServletRequest req = (HttpServletRequest) request; String bodyMime = req.getContentType(); if(bodyMime!=null && bodyMime.startsWith("multipart/")) { //2. 업로드된 파일데 대한 전처리 담당 Wrapper 생성 MultipartRequestWrapper requestWrapper = new MultipartRequestWrapper(req); chain.doFilter(requestWrapper, response); }else { chain.doFilter(request, response); } } @Override public void destroy() { logger.info("{} 필터 소멸", getClass().getSimpleName()); } }
true
012d4ef991e96e570a267e49b925e78ecb0049a1
Java
frcleiton/fsolutionsapi-rest
/fsolutions-ejb-client/src/main/java/br/com/fsolution/ejb/interfaces/Customer.java
UTF-8
258
1.929688
2
[]
no_license
package br.com.fsolution.ejb.interfaces; public interface Customer { void createNewCustomer(String name, String phone, String phone2, String address, String number, String district, String city, String obs); String listAllCustomers(); }
true
9448215ef6eb825eaed18921599cd7c87bdc453d
Java
zhongxingyu/Seer
/Diff-Raw-Data/17/17_2d04c9da877fa5379c361a89b8b689de41f44f3c/MainActivity/17_2d04c9da877fa5379c361a89b8b689de41f44f3c_MainActivity_s.java
UTF-8
3,349
2.296875
2
[]
no_license
package com.gpslistener; import com.gpslistener.fragments.ShowDateFragment.OnDateSelectedListener; import com.gpslistener.helpers.Constants; import com.gpslistener.helpers.DatabaseTask; import com.gpslistener.helpers.GPSListenerDbHelper; import com.gpslistener.helpers.HttpFetchLocationTask; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; public class MainActivity extends Activity implements AsyncResponse, OnDateSelectedListener { private LocationManager manager; private gpslistenerLocationListener listener = new gpslistenerLocationListener(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); manager = (LocationManager) getSystemService(LOCATION_SERVICE); //To register the listener to be call backed when the Async Task returns data HttpFetchLocationTask.delegate = this; } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public void onResume() { super.onResume(); // Always call the superclass method first if(manager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)){ manager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 50, listener); } else if(manager.isProviderEnabled(LocationManager.GPS_PROVIDER)){ manager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 50, listener); } } @Override public void onPause() { super.onPause(); // Always call the superclass method first manager.removeUpdates(listener); } @Override public void onTaskCompleted(Object value) { GPSListenerDbHelper dbHelper = new GPSListenerDbHelper(getApplicationContext()); Object params[] = {value, dbHelper}; new DatabaseTask().execute(params); } public void onDateSelected(String selectedDate) { Intent intent = new Intent(getApplicationContext(), DetailActivity.class); intent.putExtra("date", selectedDate); startActivity(intent); } public class gpslistenerLocationListener implements LocationListener { @Override public void onLocationChanged(Location location) { double lat = location.getLatitude(); double lon = location.getLongitude(); /*Bundle locationDataBundle = new Bundle(); locationDataBundle.putDouble("com.gpslistener.locationData.latitude", lat); locationDataBundle.putDouble("com.gpslistener.locationData.longtitude", lon); Intent intent = new Intent(getApplicationContext(), FetchLocationService.class); intent.putExtra("com.gpslistener.locationData", locationDataBundle); startService(intent);*/ new HttpFetchLocationTask().execute(Constants.getNEARBY_SEARCH_URI(lat, lon, "false", 100)); } @Override public void onProviderDisabled(String provider) { } @Override public void onProviderEnabled(String provider) { } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } } }
true
c6c4ef887106fde1cadc3dfd10d0d2bf05951631
Java
nihesh/PseudoJudge
/PseudoJudge/Results/K_35/lab122.java
UTF-8
4,364
2.765625
3
[]
no_license
import java.io.*; import java.util.*; class Reader { static BufferedReader reader; static StringTokenizer tokenizer; static void init(InputStream input) { reader = new BufferedReader( new InputStreamReader(input) ); tokenizer = new StringTokenizer(""); } static String next() throws IOException { while ( ! tokenizer.hasMoreTokens() ) { tokenizer = new StringTokenizer( reader.readLine() ); } return tokenizer.nextToken(); } static int nextInt() throws IOException { return Integer.parseInt( next() ); } } class Edge{ String flight; int arrivalatc2; int departfromc1; Edge(){ flight=""; arrivalatc2=0; departfromc1=0; } Edge(String c,int d,int e){ flight=c; arrivalatc2=e; departfromc1=d; } } class Vertex{ int city; int time; int arrivaltime; boolean visit; String name; Vertex path; Vertex(int i){ path=null; visit=false; time=Integer.MAX_VALUE; city=i; arrivaltime=0; name=""; } Vertex(){ path=null; visit=false; time=Integer.MAX_VALUE; city=0; arrivaltime=0; name=""; } Vertex(int a,int b,int c,String d,Vertex e){ city=a; time=b; arrivaltime=c; name=d; path=e; visit=false; } } public class lab122{ public static void main(String[] args) throws Exception{ Reader.init(System.in); int cityno=Reader.nextInt(); Vertex []ver=new Vertex[cityno+1]; int src=Reader.nextInt(); int end=Reader.nextInt(); int starttime=Reader.nextInt(); starttime=starttime/100*60+starttime%100; int finishtime=Reader.nextInt(); finishtime=finishtime/100*60+finishtime%100; int flno=Reader.nextInt(); String []arr=new String[flno]; Edge graph[][]=new Edge[cityno+1][cityno+1]; for(int i=0;i<flno;i++){ int a=Reader.nextInt(); int b=Reader.nextInt(); String c=Reader.next(); int d=Reader.nextInt(); int d1=d/100*60; int d2=d%100; int e=Reader.nextInt(); int e1=e/100*60; int e2=e%100; graph[a][b]=new Edge(c,d1+d2,e1+e2); } for(int i=1;i<ver.length;i++) ver[i]=new Vertex(i); int flag=0; int check=0; for(;;){ Vertex v=new Vertex(); if(flag==0){ v.city=src; v.time=0; flag=1; } else{ v=min(ver); } if(v==null) break; v.visit=true; if(v.city==src){ for(int i=1;i<ver.length;i++){ if(graph[v.city][ver[i].city]!=null&&ver[i].visit==false&&v.time!=Integer.MAX_VALUE){ if(graph[v.city][ver[i].city].arrivalatc2-graph[v.city][ver[i].city].departfromc1+v.time<ver[i].time&&graph[v.city][ver[i].city].departfromc1>=starttime){ ver[i].time=0; ver[i].time=graph[v.city][ver[i].city].arrivalatc2-graph[v.city][ver[i].city].departfromc1+v.time; ver[i].arrivaltime=graph[v.city][ver[i].city].arrivalatc2; ver[i].name=graph[v.city][ver[i].city].flight; ver[i].path=v; } } } } else{ for(int i=1;i<ver.length;i++){ if(graph[v.city][ver[i].city]!=null&&ver[i].visit==false&&v.time!=Integer.MAX_VALUE){ if(graph[v.city][ver[i].city].arrivalatc2-graph[v.city][ver[i].city].departfromc1+v.time+graph[v.city][ver[i].city].departfromc1-v.arrivaltime<ver[i].time&&graph[v.city][ver[i].city].departfromc1>=starttime&&graph[v.city][ver[i].city].departfromc1>=v.arrivaltime){ ver[i].time=0; ver[i].time=graph[v.city][ver[i].city].arrivalatc2-graph[v.city][ver[i].city].departfromc1+v.time+graph[v.city][ver[i].city].departfromc1-v.arrivaltime; ver[i].arrivaltime=graph[v.city][ver[i].city].arrivalatc2; ver[i].name=graph[v.city][ver[i].city].flight; ver[i].path=v; } } } } } Vertex v=new Vertex(); v=ver[end]; if(v.arrivaltime>finishtime||v.visit==false) System.out.println(-1); else{ int i=0; Vertex a=new Vertex(); a=ver[end]; while(a!=null){ arr[i]=a.name; i++; a=a.path; } i=i-1; System.out.println(i); i--; while(i>=0){ if(i==0){ System.out.println(arr[i]+" "); } else System.out.print(arr[i]+" "); i--; } } } public static Vertex min(Vertex[] v){ Vertex min=null; for(int i=1;i<v.length;i++){ if(v[i].visit==false&&v[i].time!=Integer.MAX_VALUE&&(min==null||min.time>v[i].time)){ min=v[i]; } } return min; } }
true
4c5ca338e7857b6cfac42521088c444ca9b3606e
Java
Dylanlicho/apde-beans
/AuctionHouse/AuctionHouse-war/build/generated-sources/ap-source-output/auction/entities/UserEntity_.java
UTF-8
940
1.679688
2
[]
no_license
package auction.entities; import auction.entities.ParticipationEntity; import javax.annotation.Generated; import javax.persistence.metamodel.SetAttribute; import javax.persistence.metamodel.SingularAttribute; import javax.persistence.metamodel.StaticMetamodel; @Generated(value="EclipseLink-2.7.7.v20200504-rNA", date="2021-01-27T21:41:44") @StaticMetamodel(UserEntity.class) public class UserEntity_ { public static volatile SingularAttribute<UserEntity, String> firstname; public static volatile SingularAttribute<UserEntity, String> password; public static volatile SetAttribute<UserEntity, ParticipationEntity> participations; public static volatile SingularAttribute<UserEntity, String> address; public static volatile SingularAttribute<UserEntity, Integer> id; public static volatile SingularAttribute<UserEntity, String> login; public static volatile SingularAttribute<UserEntity, String> lastname; }
true
87b4255c68560fbad959727feab5e1cd9942dc94
Java
georgepetrof/CourseAutomationPragmatic18
/Lecture 6 - Code Examples/src/lesson06/animal/Dog.java
UTF-8
389
3.5625
4
[]
no_license
package lesson06.animal; public class Dog extends Animal{ private boolean isDangerous; public void bringStick(){ } @Override public void makeSomeNoise() { System.out.println("Bau Bau"); } @Override public void play() { System.out.println("Playing with stick"); bringStick(); } @Override public void walk() { System.out.println("Walking like a dog"); } }
true
026bae27471ed9913f263792ebcc0640e74e2eef
Java
Caleydo/org.caleydo.view.genesequence
/src/main/java/org/caleydo/view/genesequence/metadata/ID2ChromosomeLocation.java
UTF-8
1,217
2.390625
2
[]
no_license
/******************************************************************************* * Caleydo - Visualization for Molecular Biology - http://caleydo.org * Copyright (c) The Caleydo Team. All rights reserved. * Licensed under the new BSD license, available at http://caleydo.org/license *******************************************************************************/ package org.caleydo.view.genesequence.metadata; import gleem.linalg.Vec2f; import gleem.linalg.open.Vec2i; import com.google.common.base.Function; /** * @author Christian * */ public class ID2ChromosomeLocation implements Function<Integer, Vec2f> { protected final Function<Integer, Vec2i> positionFunction; protected final int chromosomeTotalLength; public ID2ChromosomeLocation(String chromosome, Function<Integer, Vec2i> positionFunction) { this.positionFunction = positionFunction; chromosomeTotalLength = ChromosomeMetaData.getTotalLength(chromosome); } @Override public Vec2f apply(Integer input) { Vec2i position = positionFunction.apply(input); if (position == null) return null; // normalize float v = 1.f / chromosomeTotalLength; return new Vec2f(position.x() * v, (position.y() - position.x()) * v); } }
true
68cbba74bde7f4f3de5cd535857b83ac06954272
Java
canmogol/bdd-tdd-example
/src/test/java/com/fererlab/service/UserServiceTest.java
UTF-8
2,696
2.296875
2
[ "MIT" ]
permissive
package com.fererlab.service; import com.fererlab.repository.UserRepository; import com.fererlab.repository.entity.UserEntity; import com.fererlab.service.model.UserModel; import ma.glasnost.orika.MapperFacade; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.mockito.internal.util.reflection.Whitebox; import java.util.Optional; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; public class UserServiceTest { public static final String ID = "1ID"; public static final String NAME = "name"; public static final String USERNAME = "username"; public static final String PASSWORD = "password"; public static final UserModel USER_MODEL = new UserModel(NAME, USERNAME, PASSWORD); public static final UserEntity USER_ENTITY = new UserEntity(ID, NAME, USERNAME, PASSWORD); @Mock private UserService userService; @Mock private UserRepository localUserRepository; @Mock private MapperFacade mapperFacade; @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); } @Test public void testFindUser() throws Exception { Mockito.when(userService.findUser(USER_MODEL)) .thenReturn(Optional.of(USER_MODEL)); Optional<UserModel> optional = userService.findUser(USER_MODEL); assertThat("optional should contain an object", optional.isPresent(), is(Boolean.TRUE)); UserModel userModel = optional.get(); assertThat("should return the user model", userModel, is(equalTo(USER_MODEL))); } @Test public void testFindUserInternalRepository() throws Exception { // create local service UserService localUserService = new UserService(); // mock repository Mockito.when(localUserRepository.findByUsernameAndPassword(USERNAME, PASSWORD)) .thenReturn(Optional.of(USER_ENTITY)); Whitebox.setInternalState(localUserService, "repository", localUserRepository); // mock mapper Mockito.when(mapperFacade.map(USER_ENTITY, UserModel.class)) .thenReturn(USER_MODEL); Whitebox.setInternalState(localUserService, "mapper", mapperFacade); // assert Optional<UserModel> optional = localUserService.findUser(USER_MODEL); assertThat("optional should contain an object", optional.isPresent(), is(Boolean.TRUE)); UserModel userModel = optional.get(); assertThat("should return the user model", userModel, is(equalTo(USER_MODEL))); } }
true
069ebe974ec997c80417859c3e91edddbab9e492
Java
rench/tx-parent
/tx-components/tx-component-rule/src/main/java/com/tx/component/rule/method/MethodRuleLoader.java
UTF-8
8,917
2.109375
2
[]
no_license
/* * 描 述: <描述> * 修 改 人: pengqingyang * 修改时间: 2013-1-27 * <修改描述:> */ package com.tx.component.rule.method; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import javax.annotation.Resource; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.transaction.annotation.Transactional; import com.tx.component.rule.context.RuleLoader; import com.tx.component.rule.model.Rule; import com.tx.component.rule.model.RuleStateEnum; import com.tx.component.rule.model.RuleTypeEnum; import com.tx.component.rule.model.SimplePersistenceRule; import com.tx.component.rule.service.SimplePersistenceRuleService; import com.tx.core.TxConstants; /** * 方法类型的规则加载器<br/> * * @author pengqingyang * @version [版本号, 2013-1-27] * @see [相关类/方法] * @since [产品/模块版本] */ public class MethodRuleLoader implements RuleLoader, ApplicationContextAware { private ApplicationContext applicationContext; /** 规则存在的包 */ private String rulePackage = "com.tx"; /** 负责对规则进行持久 */ @Resource(name = "simplePersistenceRuleService") private SimplePersistenceRuleService simplePersistenceRuleService; /** * 是否同步移除不存在方法类型规则 * 开发阶段如果打开该设置可能造成,当前新添加的规则,被其他机器意外移除 */ private boolean isSynchronizeRemoveNotExsitMethodRule = true; /** * 规则顺序:值大的规则加载器将会覆盖同名规则加载器 */ private int order = 0; /** * @param applicationContext * @throws BeansException */ @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; } /** * @return */ @Transactional public List<Rule> load() { List<Rule> resList = new ArrayList<Rule>(); //获取当前存在的方法规则 List<MethodRule> currentRuleMethodList = MethodRuleHelper.scanCurrentSystemRuleMethod(this.applicationContext); //获取历史数据库中存储的规则 Map<String, MethodRule> currentRuleMap = new HashMap<String, MethodRule>(); //获取历史数据库中存储的规则 Map<String, SimplePersistenceRule> dbRuleMap = queryDBMethodRuleMap(); //压入加载的规则方法 for (MethodRule mrTemp : currentRuleMethodList) { //设置该部分需要写入容器的规则状态为运营态 mrTemp.setState(RuleStateEnum.OPERATION); currentRuleMap.put(getRuleKeyFromRule(mrTemp), mrTemp); SimplePersistenceRule dbRuleTemp = dbRuleMap.get(getRuleKeyFromRule(mrTemp)); //如果对应规则,在数据库中原不存在 if (dbRuleTemp == null) { //持久化新添加的规则 SimplePersistenceRule spr = new SimplePersistenceRule(mrTemp); this.simplePersistenceRuleService.saveSimplePersistenceRule(spr); //设置对应的存储规则 mrTemp.setSimplePersistenceRule(spr); } else if (dbRuleTemp != null && !RuleStateEnum.OPERATION.equals(dbRuleTemp.getState())) { //修改存储中规则状态为持久态 this.simplePersistenceRuleService.changeRuleStateById(dbRuleTemp.getId(), RuleStateEnum.OPERATION); mrTemp.setSimplePersistenceRule(dbRuleTemp); } else { //设置规则状态 mrTemp.setSimplePersistenceRule(dbRuleTemp); } //添加到容器中 resList.add(mrTemp); } //根据当前系统中存在的规则,如果方法级规则现在不存在了,则将该规则设置为错误态 if (isSynchronizeRemoveNotExsitMethodRule) { for (Entry<String, SimplePersistenceRule> entryTemp : dbRuleMap.entrySet()) { if (!currentRuleMap.containsKey(getRuleKeyFromRule(entryTemp.getValue()))) { SimplePersistenceRule spRule = entryTemp.getValue(); //如果不为运营态则将该规则实体社会自为错误态 if (!RuleStateEnum.OPERATION.equals(spRule.getState())) { //设置对应规则状态为错误态 spRule.setState(RuleStateEnum.ERROR); //持久化规则状态 //可能是其他系统的规则实体,这里不对不存在的方法实体进行持久化状态 //this.simplePersistenceRuleService.changeRuleStateById(spRule.getId(), // RuleStateEnum.ERROR); //错误态的规则,依然加入规则容器中 MethodRule methodRule = new MethodRule(spRule); resList.add(methodRule); } } } } return resList; } /** * 方法级规则最先调用校验方法 * @return */ @Override public int getOrder() { return order; } /** *<功能简述> *<功能详细描述> * @param rule * @return [参数说明] * * @return String [返回类型说明] * @exception throws [异常类型] [异常说明] * @see [类、类#方法、类#成员] */ private String getRuleKeyFromRule(Rule rule) { StringBuilder sb = new StringBuilder(TxConstants.INITIAL_STR_LENGTH); sb.append(rule.getRuleType()) .append(".") .append(rule.getServiceType()) .append(".") .append(rule.rule()); return sb.toString(); } /** * 查询数据库中方法类型的规则映射 * <功能详细描述> * @return [参数说明] * * @return List<SimplePersistenceRule> [返回类型说明] * @exception throws [异常类型] [异常说明] * @see [类、类#方法、类#成员] */ private Map<String, SimplePersistenceRule> queryDBMethodRuleMap() { List<SimplePersistenceRule> resList = this.simplePersistenceRuleService.querySimplePersistenceRuleListByRuleType(RuleTypeEnum.METHOD); Map<String, SimplePersistenceRule> res = new HashMap<String, SimplePersistenceRule>(); if (resList == null) { return res; } for (SimplePersistenceRule simplePRuleTemp : resList) { res.put(getRuleKeyFromRule(simplePRuleTemp), simplePRuleTemp); } return res; } /** * @return 返回 rulePackage */ public String getRulePackage() { return rulePackage; } /** * @param 对rulePackage进行赋值 */ public void setRulePackage(String rulePackage) { this.rulePackage = rulePackage; } /** * @return 返回 isSynchronizeRemoveNotExsitMethodRule */ public boolean isSynchronizeRemoveNotExsitMethodRule() { return isSynchronizeRemoveNotExsitMethodRule; } /** * @param 对isSynchronizeRemoveNotExsitMethodRule进行赋值 */ public void setSynchronizeRemoveNotExsitMethodRule( boolean isSynchronizeRemoveNotExsitMethodRule) { this.isSynchronizeRemoveNotExsitMethodRule = isSynchronizeRemoveNotExsitMethodRule; } /** * @param 对order进行赋值 */ public void setOrder(int order) { this.order = order; } /** * @return 返回 simplePersistenceRuleService */ public SimplePersistenceRuleService getSimplePersistenceRuleService() { return simplePersistenceRuleService; } /** * @param 对simplePersistenceRuleService进行赋值 */ public void setSimplePersistenceRuleService( SimplePersistenceRuleService simplePersistenceRuleService) { this.simplePersistenceRuleService = simplePersistenceRuleService; } }
true
9b33d95513c05f2728265e933d5f8654af7990f3
Java
limsm9449/lms
/src/main/java/com/qp/lms/ax/account/service/AxPointService.java
UTF-8
8,253
1.859375
2
[]
no_license
package com.qp.lms.ax.account.service; import java.util.HashMap; import java.util.List; import org.apache.ibatis.session.SqlSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import com.qp.lms.ax.common.service.AxCommService; import com.qp.lms.common.CommUtil; import com.qp.lms.common.Constant; import com.qp.lms.common.SessionUtil; @Service public class AxPointService { @Autowired private SqlSession sqlSession; @Autowired private AxCommService axCommService; public HashMap<String, Object> axPointCodeList(HashMap<String, Object> paramMap) throws Exception { HashMap<String, Object> hm = new HashMap<String, Object>(); List<HashMap<String, Object>> list = sqlSession.selectList("axPoint.axPointCodeList", paramMap); hm.put("list", list); return hm; } @Transactional(propagation=Propagation.REQUIRED, rollbackFor={Throwable.class}) public HashMap<String, Object> axPointCodeSave(HashMap<String, Object> paramMap) throws Exception { HashMap<String, Object> hm = new HashMap<String, Object>(); List<HashMap<String, Object>> updList = (List<HashMap<String, Object>>)paramMap.get("modified"); //dup 체크 for ( int i = 0; i < updList.size(); i++ ) { HashMap<String, Object> row = (HashMap<String, Object>)updList.get(i); if ( "Y".equals((String)row.get("NEW_FLAG")) ) { int cnt = sqlSession.selectOne("axPoint.axPointCodePk", row); if ( cnt > 0 ) { hm.put("RtnMode", Constant.mode.DUPLICATION.name()); return hm; } } } for ( int i = 0; i < updList.size(); i++ ) { HashMap<String, Object> row = (HashMap<String, Object>)updList.get(i); row.put("SESSION_USER_ID", SessionUtil.getSessionUserId()); if ( "Y".equals((String)row.get("NEW_FLAG")) ) { sqlSession.insert("axPoint.axPointCodeInsert", row); } else { sqlSession.update("axPoint.axPointCodeUpdate", row); } } List<HashMap<String, Object>> delList = (List<HashMap<String, Object>>)paramMap.get("deleted"); for ( int i = 0; i < delList.size(); i++ ) { sqlSession.delete("axPoint.axPointCodeDelete", delList.get(i)); } hm.put("RtnMode", Constant.mode.OK.name()); return hm; } public HashMap<String, Object> axPointList(HashMap<String, Object> paramMap) throws Exception { HashMap<String, Object> hm = new HashMap<String, Object>(); List<HashMap<String, Object>> list = sqlSession.selectList("axPoint.axPointList", paramMap); hm.put("list", list); return hm; } public HashMap<String, Object> axPointDetailList(HashMap<String, Object> paramMap) throws Exception { HashMap<String, Object> hm = new HashMap<String, Object>(); List<HashMap<String, Object>> list = sqlSession.selectList("axPoint.axPointDetailList", paramMap); hm.put("list", list); return hm; } public HashMap<String, Object> axPointEventMemberList(HashMap<String, Object> paramMap) throws Exception { HashMap<String, Object> hm = new HashMap<String, Object>(); List<HashMap<String, Object>> list = sqlSession.selectList("axPoint.axPointEventMemberList", paramMap); hm.put("list", list); return hm; } @Transactional(propagation=Propagation.REQUIRED, rollbackFor={Throwable.class}) public HashMap<String, Object> axPointEventMemberSave(HashMap<String, Object> paramMap) throws Exception { HashMap<String, Object> hm = new HashMap<String, Object>(); paramMap.put("SESSION_USER_ID", SessionUtil.getSessionUserId()); List<HashMap<String, Object>> updList = (List<HashMap<String, Object>>)paramMap.get("modified"); for ( int i = 0 ; i < updList.size(); i++ ) { paramMap.put("USER_ID", updList.get(i).get("USER_ID")); sqlSession.insert("axPoint.memberEventPointInsert", paramMap); } for ( int i = 0 ; i < updList.size(); i++ ) { StringBuffer contents = new StringBuffer(); contents.append("<div style='font-size: 12px; width: 650px; height:500px; margin:0 auto;' align='center'>"); contents.append(" <div align='left'>"); contents.append(" <a href='" + SessionUtil.getAttribute("serverDomain") + "'><img src='http://www.qlearning.co.kr/resources/images/common/toplogo.png' style='border:0;' /></a>"); contents.append(" </div>"); contents.append(" <div style='text-align: left;margin: 30px 10px 30px;'>"); contents.append(" <p style='font-size: 14px; line-height: 1.5;'>안녕하세요.<br />온라인 학습 사이트 <b>큐러닝</b>입니다.<br /><br /></p>"); contents.append(" " + updList.get(i).get("USER_NAME") + "님의 포인트가 ( " + CommUtil.toNumFormat((String)paramMap.get("POINT")) + " )점 적립되었습니다. <br />"); contents.append(" <p style='display:block;margin: 30px 10px;'>자세한 적립/사용내역은 <span style='color:#0a88d9'>마이페이지 > 포인트</span> 페이지에서 확인하실 수 있습니다.</p>"); contents.append(" </div>"); contents.append(" <div style='margin: 40px 0 0;'>"); contents.append(" <div style='float: left;'><img src='http://www.qlearning.co.kr/resources/images/admin/common/bottom_logo.png' alt='Qpeople' /></div>"); contents.append(" <div style='float: left;margin-left: 20px;'><p style='font-size: 11px;'>Copyrights 2017 Qpeople Academy. ALL Right Reserved</p></div>"); contents.append(" </div>"); contents.append("</div>"); axCommService.axMailSave((String)updList.get(i).get("USER_ID"), (String)updList.get(i).get("EMAIL"), "회원 이벤트 포인트 지급 공지", contents.toString()); } axCommService.axSendMail(null); hm.put("RtnMode", Constant.mode.OK.name()); return hm; } @Transactional(propagation=Propagation.REQUIRED, rollbackFor={Throwable.class}) public HashMap<String, Object> axPointSave(HashMap<String, Object> paramMap) throws Exception { HashMap<String, Object> hm = new HashMap<String, Object>(); List<HashMap<String, Object>> delList = (List<HashMap<String, Object>>)paramMap.get("deleted"); for ( int i = 0; i < delList.size(); i++ ) { sqlSession.delete("axPoint.axPointDelete", delList.get(i)); StringBuffer contents = new StringBuffer(); contents.append("<div style='font-size: 12px; width: 650px; height:500px; margin:0 auto;' align='center'>"); contents.append(" <div align='left'>"); contents.append(" <a href='" + SessionUtil.getAttribute("serverDomain") + "'><img src='http://www.qlearning.co.kr/resources/images/common/toplogo.png' style='border:0;' /></a>"); contents.append(" </div>"); contents.append(" <div style='text-align: left;margin: 30px 10px 30px;'>"); contents.append(" <p style='font-size: 14px; line-height: 1.5;'>안녕하세요.<br />온라인 학습 사이트 <b>큐러닝</b>입니다.<br /><br /></p>"); contents.append(" " + delList.get(i).get("USER_NAME") + "님의 포인트 ( " + CommUtil.toNumFormat("" + delList.get(i).get("POINT")) + " )점이 [사유(구매취소 취소 등)]로 적립 취소되었습니다 <br />"); contents.append(" <p style='display:block;margin: 30px 10px;'>자세한 적립/사용내역은 <span style='color:#0a88d9'>마이페이지 > 포인트</span> 페이지에서 확인하실 수 있습니다.</p>"); contents.append(" </div>"); contents.append(" <div style='margin: 40px 0 0;'>"); contents.append(" <div style='float: left;'><img src='http://www.qlearning.co.kr/resources/images/admin/common/bottom_logo.png' alt='Qpeople' /></div>"); contents.append(" <div style='float: left;margin-left: 20px;'><p style='font-size: 11px;'>Copyrights 2017 Qpeople Academy. ALL Right Reserved</p></div>"); contents.append(" </div>"); contents.append("</div>"); axCommService.axMailSave((String)delList.get(i).get("USER_ID"), (String)delList.get(i).get("EMAIL"), "회원 포인트 취소 공지", contents.toString()); } hm.put("RtnMode", Constant.mode.OK.name()); return hm; } }
true
7b8236466b483089a8a78dc0c93bb129ccf59e67
Java
alenatokar87/weld_2
/src/main/java/validation/DataCheker.java
UTF-8
701
1.945313
2
[]
no_license
package validation; import javax.validation.Constraint; import javax.validation.Payload; import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.*; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; /** * Created by vov on 22.05.2017. */ @Constraint(validatedBy = {DateValidator.class}) @Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE}) @Retention(RUNTIME) public @interface DataCheker { String message() default "{HommeTask3.Dates.message}"; Class<?>[] groups() default {}; Class<? extends Payload>[] payload() default {}; }
true
c05a508e2524d0c47d7b1782ffc96735625aeeef
Java
OlexiyZh/moc_chat
/src/main/java/com/mochallenge/chat/mapper/ChatSecurityMapper.java
UTF-8
638
1.953125
2
[]
no_license
package com.mochallenge.chat.mapper; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.Mappings; import com.mochallenge.chat.controller.dto.LoginUserResponse; import com.mochallenge.chat.service.SecurityService; @Mapper public abstract class ChatSecurityMapper { @Mappings({ @Mapping(target = "userId", source = "user.userId"), @Mapping(target = "userName", source = "user.userName"), @Mapping(target = "credentials", source = "credentials") }) public abstract LoginUserResponse toLoginUserResponse(SecurityService.UserLoggedInModel userLoggedInModel); }
true
e7fe1d5972ff09e0f466addc00b4b4793d075ddc
Java
ArryLuo/SSH
/src/com/shandian/service/IService.java
UTF-8
218
1.53125
2
[]
no_license
package com.shandian.service; import java.util.List; import com.shandian.bean.Dept; import com.shandian.bean.Emp; import com.shandian.bean.Users; public interface IService { // 登录 Users login(Users users); }
true
c40021295c0d84df2bae8c55aebfa0fbdf3b9d7e
Java
eyjs/workspace-sts-3.9.11.RELEASE
/springAppJavaConfig/ServletConfig1.java
UTF-8
4,275
2.125
2
[]
no_license
import org.springframework.context.annotation.ComponentScan; import org.springframework.format.FormatterRegistry; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.validation.MessageCodesResolver; import org.springframework.validation.Validator; import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.method.support.HandlerMethodReturnValueHandler; import org.springframework.web.servlet.HandlerExceptionResolver; import org.springframework.web.servlet.config.annotation.*; import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.JstlView; import java.util.List; // servlet-context.xml을 대신할 java 클래스 // @EnableWebMvc: web mvc을 이용하는데 있어서 spring container가 가져야할 기본적인 bean component 등록. 빠르고 편하게 mvc을 구축할수 있는 configuration 환경 제공 // WebMvcConfigurationSupport 클래스가 자동으로 Bean 등록된다. Mvc Java Config 설정에서 설정을 제공하는 주요 클래스 // Web에 필요한 Bean들을 대부분 자동으로 설정해준다. // WebMvcConfigurer 인터페이스: 기본 설정 이외의 설정이 필요할 경우 해당 클래스 상속 받은 후 오버라이딩하여 구현. // @ComponentScan: Controller, Service, Repository, Component 어노테이션이 붙을 클래스를 찾아 스프링 컨테이너가 관리 @EnableWebMvc @ComponentScan(basePackages = {"org.home.controller"}) public class ServletConfig implements WebMvcConfigurer { // jsp를 view로 사용할 때 사용 // Controller에서 리턴하는 뷰 이름에 접두, 접미어를 붙여서 jsp 경로를 찾는다. @Override public void configureViewResolvers(ViewResolverRegistry viewResolverRegistry) { InternalResourceViewResolver bean = new InternalResourceViewResolver(); bean.setViewClass(JstlView.class); bean.setPrefix("/WEB-INF/views/"); bean.setSuffix(".jsp"); viewResolverRegistry.viewResolver(bean); } // '/'로 모든 요청을 받아들이는데 이 요청들을 처리할 url 설정에 대한 코드 @Override public void addResourceHandlers(ResourceHandlerRegistry resourceHandlerRegistry) { resourceHandlerRegistry.addResourceHandler("/resources/**").addResourceLocations("/resources/"); } @Override public void configurePathMatch(PathMatchConfigurer pathMatchConfigurer) { } @Override public void configureContentNegotiation(ContentNegotiationConfigurer contentNegotiationConfigurer) { } @Override public void configureAsyncSupport(AsyncSupportConfigurer asyncSupportConfigurer) { } @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer defaultServletHandlerConfigurer) { } @Override public void addFormatters(FormatterRegistry formatterRegistry) { } @Override public void addInterceptors(InterceptorRegistry interceptorRegistry) { } @Override public void addCorsMappings(CorsRegistry corsRegistry) { } @Override public void addViewControllers(ViewControllerRegistry viewControllerRegistry) { } @Override public void addArgumentResolvers(List<HandlerMethodArgumentResolver> list) { } @Override public void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> list) { } @Override public void configureMessageConverters(List<HttpMessageConverter<?>> list) { } @Override public void extendMessageConverters(List<HttpMessageConverter<?>> list) { } @Override public void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> list) { } @Override public void extendHandlerExceptionResolvers(List<HandlerExceptionResolver> list) { } @Override public Validator getValidator() { return null; } @Override public MessageCodesResolver getMessageCodesResolver() { return null; } } 출처: https://sofies.tistory.com/41 [소피의 세계]
true
e23aaa8e2467f3a162ea32f03d4e023e0f129958
Java
codjo/codjo-jconnect
/src/test/java/com/sybase/jdbc2/jdbc/CallableStatementWrapperTest.java
UTF-8
3,641
2.546875
3
[]
no_license
package com.sybase.jdbc2.jdbc; import java.sql.CallableStatement; import java.sql.Date; import java.sql.ResultSet; import java.sql.Types; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.junit.Test; /** * */ public class CallableStatementWrapperTest extends CallableStatementTestCase { private Date myDatetime = Date.valueOf("2009-01-01"); public CallableStatementWrapperTest() throws Exception { super(true); } @Test public void test_callableStatementWithSqlTypeAndScale() throws Exception { CallableStatement cstmt = createStatement(); cstmt.setObject(1, MY_NUMERIC, Types.NUMERIC, 2); cstmt.setObject(2, MY_VARCHAR, Types.VARCHAR); cstmt.setObject(3, myDatetime, Types.DATE); cstmt.setObject(4, MY_DATETIME_MILLIS, Types.TIMESTAMP); cstmt.setObject(5, MY_BIT, Types.BIT); cstmt.setObject(6, MY_INT, Types.INTEGER); cstmt.executeUpdate(); ResultSet resultSet = executeSelectAllQuery(); assertTrue(resultSet.next()); assertEquals(MY_NUMERIC, resultSet.getBigDecimal("MY_NUMERIC")); assertEquals(MY_VARCHAR, resultSet.getString("MY_VARCHAR")); assertEquals(myDatetime, resultSet.getDate("MY_DATETIME")); assertEquals(MY_DATETIME_MILLIS, resultSet.getTimestamp("MY_DATETIME_SEC")); assertEquals(MY_BIT, resultSet.getBoolean("MY_BIT")); assertEquals(MY_INT.intValue(), resultSet.getInt("MY_INT")); assertFalse(resultSet.next()); } @Test public void test_callableStatementWithSqlType() throws Exception { CallableStatement cstmt = createStatement(); cstmt.setObject(1, MY_NUMERIC, Types.NUMERIC); cstmt.setObject(2, MY_VARCHAR, Types.VARCHAR); cstmt.setObject(3, myDatetime, Types.DATE); cstmt.setObject(4, MY_DATETIME_MILLIS, Types.TIMESTAMP); cstmt.setObject(5, MY_BIT, Types.BIT); cstmt.setObject(6, MY_INT, Types.INTEGER); cstmt.executeUpdate(); ResultSet resultSet = executeSelectAllQuery(); assertTrue(resultSet.next()); assertEquals(MY_NUMERIC, resultSet.getBigDecimal("MY_NUMERIC")); assertEquals(MY_VARCHAR, resultSet.getString("MY_VARCHAR")); assertEquals(myDatetime, resultSet.getDate("MY_DATETIME")); assertEquals(MY_DATETIME_MILLIS, resultSet.getTimestamp("MY_DATETIME_SEC")); assertEquals(MY_BIT, resultSet.getBoolean("MY_BIT")); assertEquals(MY_INT.intValue(), resultSet.getInt("MY_INT")); assertFalse(resultSet.next()); } @Test public void test_callableStatementWithoutSqlType() throws Exception { CallableStatement cstmt = createStatement(); cstmt.setObject(1, MY_NUMERIC); cstmt.setObject(2, MY_VARCHAR); cstmt.setObject(3, myDatetime); cstmt.setObject(4, MY_DATETIME_MILLIS); cstmt.setObject(5, MY_BIT); cstmt.setObject(6, MY_INT); cstmt.executeUpdate(); ResultSet resultSet = executeSelectAllQuery(); assertTrue(resultSet.next()); assertEquals(MY_NUMERIC, resultSet.getBigDecimal("MY_NUMERIC")); assertEquals(MY_VARCHAR, resultSet.getString("MY_VARCHAR")); assertEquals(myDatetime, resultSet.getDate("MY_DATETIME")); assertEquals(MY_DATETIME_MILLIS, resultSet.getTimestamp("MY_DATETIME_SEC")); assertEquals(MY_BIT, resultSet.getBoolean("MY_BIT")); assertEquals(MY_INT.intValue(), resultSet.getInt("MY_INT")); assertFalse(resultSet.next()); } }
true
2363a75085bc7ecc36dd39d27c1b0ad6c4286dfd
Java
sirdir/ingenicoTymur
/src/main/java/com.ingenico/pages/ApiKeysPage.java
UTF-8
1,047
1.976563
2
[]
no_license
package com.ingenico.pages; import com.paulhammant.ngwebdriver.ByAngularRepeaterColumn; import io.qameta.allure.Step; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.PageFactory; public class ApiKeysPage extends BasePage { public ApiKeysPage(WebDriver driver) { super(driver); ngWebDriver.waitForAngularRequestsToFinish(); sideNavigationMenu = PageFactory.initElements(driver, SideNavigationMenu.class); } public SideNavigationMenu sideNavigationMenu; @ByAngularRepeaterColumn.FindBy(repeater = "apikey in GC.keys", exact = true, column = "apikey.apiKeyId") private WebElement apiKeyIdText; @ByAngularRepeaterColumn.FindBy(repeater = "apikey in GC.keys", exact = true, column = "apikey.secretApiKey") private WebElement secredApiText; @Step public String getApiKeyId() { return apiKeyIdText.getText(); } @Step public String getSecretApiKey() { return secredApiText.getText(); } }
true
44012d35d5c0eba15c09ec9883c29726218d49be
Java
EmilyHickey/CommandZone
/src/main/java/com/example/redmajesty/commandzone/AbstractClasses/CardList.java
UTF-8
6,261
2.453125
2
[]
no_license
package com.example.redmajesty.commandzone.AbstractClasses; import android.os.AsyncTask; import android.util.JsonReader; import android.util.JsonToken; import android.util.Log; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.lang.reflect.Array; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import javax.net.ssl.HttpsURLConnection; /** * Created by Red Majesty on 3/2/2019. */ public class CardList { /** * Contains every card in the game >n< */ public ArrayList<Card> cards = new ArrayList<>(); private URL previousPage = null; private URL currentURL = null; private URL nextPage = null; public CardList() { } public ArrayList<Card> makeCommanders(){ AsyncTask.execute(new Runnable() { @Override public void run() { Boolean has_more = false; try { currentURL = new URL("https://api.scryfall.com/cards/search?q=is%3Acommander&unique=cards"); HttpsURLConnection myConnection = (HttpsURLConnection) currentURL.openConnection(); myConnection.setRequestProperty("User-Agent", "command=zone-v0.1"); if (myConnection.getResponseCode() == 200) { InputStream responseBody = myConnection.getInputStream(); InputStreamReader responseBodyReader = new InputStreamReader(responseBody, "UTF-8"); JsonReader jsonReader = new JsonReader(responseBodyReader); jsonReader.beginObject(); // Start processing the JSON object while (jsonReader.hasNext()) { // Loop through all keys String key = jsonReader.nextName(); // Fetch the next key Card card = new Card(""); if (key.equals("has_more")) { has_more = jsonReader.nextBoolean(); continue; } if (key.equals("next_page") && has_more) { nextPage = new URL(jsonReader.nextString()); continue; } if (key.equals("data")) { jsonReader.beginArray(); jsonReader.beginObject(); while (cards.size() < 40) { String name = jsonReader.nextName(); if (name.equals("name")) { if(card == null){ card = new Card(jsonReader.nextString()); continue; }else { card.setName(jsonReader.nextString()); continue; } } if (name.equals("mana_cost") || name.equals("cmc") || name.equals("type_line") || name.equals("oracle_text") || name.equals("power") || name.equals("toughness")) { card.addAspect(name, jsonReader.nextString()); continue; } if (name.equals("color_identity")) { jsonReader.beginArray(); String colorIdentity = ""; while (jsonReader.hasNext()) { colorIdentity += jsonReader.nextString(); } jsonReader.endArray(); cards.add(card); card = null; continue; } if (name.equals("purchase_uris")) { jsonReader.skipValue(); jsonReader.endObject(); if(jsonReader.peek().equals(JsonToken.END_ARRAY)) { jsonReader.endArray(); } else if (jsonReader.peek().equals(JsonToken.BEGIN_ARRAY)){ jsonReader.beginArray(); } else if (jsonReader.peek().equals(JsonToken.BEGIN_OBJECT)){ jsonReader.beginObject(); } else if (jsonReader.peek().equals(JsonToken.END_OBJECT)){ jsonReader.endObject(); } } else { jsonReader.skipValue(); } } } else { jsonReader.skipValue(); // Skip values of other keys } } jsonReader.close(); myConnection.disconnect(); Log.d("MyApp", "Done"); } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }); return cards; } public void NextPage() { } public void LastPage() { } public ArrayList<Card> getCards() { return cards; } }
true
221154222a908038195f536051aab56c9e532939
Java
viniciusinnovatium/netmanager
/src/main/java/WWWNEXT.java
ISO-8859-1
40,726
1.5625
2
[]
no_license
//***************************************************************************** //** TASC - ALPHALINC - MAC WWWNEXT //** Innovatium Systems - Code Converter - v1.29 //** 2014-06-03 20:54:38 //***************************************************************************** import mLibrary.*; //<< //<< #include WWWConst import include.WWWConst; import include.COMSYS; //<< #include COMSYS import include.COMSYS; import include.COMSYSDate; import include.COMSYSNum; import include.COMSYSString; import include.COMSYSWWW; import include.COMSYSOutput; import include.COMSYSEnum; import include.COMGridEdit31Interface; import include.COMTab; import include.COMEditor; import include.COMSYSJS; import include.$occInclude; //<< WWWNEXT(pYFORMDATEI,YZAHL) public class WWWNEXT extends mClass { public Object main(Object ... _p) { mVar pYFORMDATEI = m$.newVarRef("pYFORMDATEI",(((_p!=null)&&(_p.length>=1))?_p[0]:null)); mVar YZAHL = m$.newVarRef("YZAHL",(((_p!=null)&&(_p.length>=2))?_p[1]:null)); return _WWWNEXT(pYFORMDATEI,YZAHL); } public Object _WWWNEXT(Object ... _p) { mVar pYFORMDATEI = m$.newVarRef("pYFORMDATEI",(((_p!=null)&&(_p.length>=1))?_p[0]:null)); mVar YZAHL = m$.newVarRef("YZAHL",(((_p!=null)&&(_p.length>=2))?_p[1]:null)); //<< //<< ;--------------------------------------- //<< ; Numerator Classes //<< ; WWW128 WWW1280 WWW1281 WWW128Form //<< ; P1 Form Form Form Class //<< ; P2 - Location Sequence Form (associated with P1) //<< ; //<< ; D1 SeqNo SeqNo SeqNo Prefix //<< ; D2 Increment Increment - Link Class //<< ; D3 Reset Reset //<< ; D4 ResetYear ResetYear //<< ;--------------------------------------- //<< //<< ;------------------------------------------------------------------------------ //<< ; Description of Function : //<< ; NAESCHSTE LAUFENDE NUMMER //<< ; SET NO=$$^WWWNEXT(FORMNAME) //<< ; //<< ; Inputs : //<< ; pYFORMDATEI : FORMUALR / FORM ;shape //<< ; YZAHL : ZAHLER, UM DEN HOCHGEZHLT WIRD / SEQUENCE //<< ; //<< ; //<< ; ByRef : //<< ; //<< ; //<< ; Returns : //<< ; //<< ; //<< ; History : //<< ; 28-Aug-2013 shobby CORE-251: Fixed problem with INCALL form //<< ; 02-May-2012 shobby SR17817: Check whether this has been called from a save //<< ; in a form (idYFORM). Otherwise for background processes //<< ; continue as before. //<< ; 02-Jul-2008 shobby SRBR014965: Reworked so that multiple forms/classes can //<< ; share a numbering sequence (with a different prefix) //<< ; 25-Sep-2007 GRF SR15602: variables moved to NEW in subroutine; A=>idNext; //<< ; Consolidate YDATEI/YFKEY decisions //<< ; 12-Aug-2005 Steve S Macro Usage //<< ; 06-Jun-2005 GRF Replace $data(YM) with $get; !=>|| //<< ; 31-May-2005 RobertW SR12056: Attempt at Performance Improvement //<< ; 17.03.1999 DT //<< ;----------------------------------------------------------------------------- //<< new idNext,YDATEI,YI mVar idNext = m$.var("idNext"); mVar YDATEI = m$.var("YDATEI"); mVar YI = m$.var("YI"); m$.newVar(idNext,YDATEI,YI); //<< new idYFORM,objWWW128,strCheckList,strLink,strPrefix mVar idYFORM = m$.var("idYFORM"); mVar objWWW128 = m$.var("objWWW128"); mVar strCheckList = m$.var("strCheckList"); mVar strLink = m$.var("strLink"); mVar strPrefix = m$.var("strPrefix"); m$.newVar(idYFORM,objWWW128,strCheckList,strLink,strPrefix); //<< //<< ; BR014965. A bit of juggling of parameters here. previously the parameter YFORM contained the class (usually) //<< ; and the actual YFORM in the calling routines could be different. //<< set idYFORM=$get(YFORM) idYFORM.set(m$.Fnc.$get(m$.var("YFORM"))); //<< new YFORM mVar YFORM = m$.var("YFORM"); m$.newVar(YFORM); //<< set YFORM = $get(pYFORMDATEI) YFORM.set(m$.Fnc.$get(pYFORMDATEI)); //<< ;========================================================================== //<< set YZAHL =+$get(YZAHL) YZAHL.set(mOp.Positive(m$.Fnc.$get(YZAHL))); //<< if YZAHL=0 set YZAHL=1 if (mOp.Equal(YZAHL.get(),0)) { YZAHL.set(1); } //<< if $get(YM)="" set YM=0 if (mOp.Equal(m$.Fnc.$get(m$.var("YM")),"")) { mVar YM = m$.var("YM"); YM.set(0); } //<< //<< set idNext="" idNext.set(""); //<< if YFORM="" quit "" ;KEIN FORMULAR ;no form if (mOp.Equal(YFORM.get(),"")) { return ""; } //<< //<< if $get(YUCI)="" set YUCI=$ZUTIL(5) if (mOp.Equal(m$.Fnc.$get(m$.var("YUCI")),"")) { mVar YUCI = m$.var("YUCI"); YUCI.set(m$.Fnc.$zutil(5)); } //<< if $get(Y)="" do ^WWWVAR if (mOp.Equal(m$.Fnc.$get(m$.var("Y")),"")) { m$.Cmd.Do("WWWVAR.main"); } //<< //<< set strPrefix = $$GetPrefix^WWW128Form(YFORM,idYFORM) strPrefix.set(m$.fnc$("WWW128Form.GetPrefix",YFORM.get(),idYFORM.get())); //<< set strLink = $$GetLink^WWW128Form(YFORM,idYFORM) strLink.set(m$.fnc$("WWW128Form.GetLink",YFORM.get(),idYFORM.get())); //<< //<< set YDATEI = $$$WWW120ClassUsedInForm($get(^WWW120(0,YFORM,1))) YDATEI.set(include.WWWConst.$$$WWW120ClassUsedInForm(m$,m$.Fnc.$get(m$.var("^WWW120",0,YFORM.get(),1)))); //<< if YDATEI'="" if ($$$WWW001SharedFile($get(^WWW001(0,YDATEI,1)))=1)||(YDATEI="WWW009") new YM set YM=0 ;when shared data file - Deprecated if (mOp.NotEqual(YDATEI.get(),"")) { if ((mOp.Equal(include.WWWConst.$$$WWW001SharedFile(m$,m$.Fnc.$get(m$.var("^WWW001",0,YDATEI.get(),1))),1)) || (mOp.Equal(YDATEI.get(),"WWW009"))) { mVar YM = m$.var("YM"); m$.newVar(YM); YM.set(0); } } //<< if strLink'="" set YFORM = strLink ; Redirect the Numerator to another class if (mOp.NotEqual(strLink.get(),"")) { YFORM.set(strLink.get()); } //<< //<< if '$DATA(^WWW128(YM,YFORM,1)) set ^WWW128(YM,YFORM,1) = $$DefaultSequenceNo^COMUtils() ; returns site or server with "0000000" if (mOp.Not(m$.Fnc.$data(m$.var("^WWW128",m$.var("YM").get(),YFORM.get(),1)))) { m$.var("^WWW128",m$.var("YM").get(),YFORM.get(),1).set(m$.fnc$("COMUtils.DefaultSequenceNo")); } //<< if '$DATA(^WWW128(YM,YFORM,1)) set ^WWW128(YM,YFORM,1) = 0 ; FIXME : The previous line will ensure $data is "true" - deprecated? <GRF> if (mOp.Not(m$.Fnc.$data(m$.var("^WWW128",m$.var("YM").get(),YFORM.get(),1)))) { m$.var("^WWW128",m$.var("YM").get(),YFORM.get(),1).set(0); } //<< //<< if YDATEI="" { ; without a class if (mOp.Equal(YDATEI.get(),"")) { //<< do NEXT m$.Cmd.Do("NEXT"); } //<< } else { else { //<< set strCheckList = $$GetPrefixes^WWW128Form(YFORM) strCheckList.set(m$.fnc$("WWW128Form.GetPrefixes",YFORM.get())); //<< for { for (;true;) { //<< do NEXT m$.Cmd.Do("NEXT"); //<< quit:'$$Find(strCheckList,idNext,$piece($$GetKey(.YKEY,$get(YFKEY)),Y,1)) ;CORE-251 if (mOp.Not(m$.fnc$("Find",strCheckList.get(),idNext.get(),m$.Fnc.$piece(m$.fnc$("GetKey",m$.var("YKEY"),m$.Fnc.$get(m$.var("YFKEY"))),m$.var("Y").get(),1)))) { break; } } } //<< ; 17974 the following line caused translation DCM to stop and exceed license limit preventing login with //<< ; browser or studio as many processes were stuck in WWWNEXT. //<< ; Further investigation as some processes won't have anything in WWWDATEN //<< ; maybe if $get(YFKEY)="" set YFKEY=$piece(^WWWDATEN(YM,+$h,YUSER,YFORM,"P",1),",",1) //<< ;SR17817 (reverted 28-Dec-2011 17974) quit:'$$Find(strCheckList,idNext,$piece(^WWWDATEN(YM,+$h,YUSER,YFORM,"P",1),",",1)) ;SR17817 //<< ;CORE-251 will cause failure on current record. quit:($get(YUSER)'="")&&($get(idYFORM)'="")&&'$$Find(strCheckList,idNext,$piece(^WWWDATEN(YM,+$h,YUSER,idYFORM,"P",1),",",1)) ;SR17817 //<< } //<< } //<< //<< quit strPrefix_idNext return mOp.Concat(strPrefix.get(),idNext.get()); } //<< //<< GetKey(&YKEY,YFKEY="") ;CORE-251 public Object GetKey(Object ... _p) { mVar YKEY = m$.newVarRef("YKEY",(((_p!=null)&&(_p.length>=1))?_p[0]:null)); mVar YFKEY = m$.newVarRef("YFKEY",(((_p!=null)&&(_p.length>=2))?_p[1]:null),""); //<< ;------------------------------------------------------------------------------- //<< ; Build up the key //<< ; //<< ; Returns: //<< ; //<< ; History: //<< ; 28-Aug-2013 shobby CORE-251: Removed trailing , //<< ; 24-Aug-2013 shobby CORE-251: Created //<< ;------------------------------------------------------------------------------- //<< new YFKEY,i YFKEY = m$.var("YFKEY"); mVar i = m$.var("i"); m$.newVar(YFKEY,i); //<< //<< if $get(YFKEY)="" { if (mOp.Equal(m$.Fnc.$get(YFKEY),"")) { //<< set YFKEY="" YFKEY.set(""); //<< set i=$order(YKEY(""),-1) i.set(m$.Fnc.$order(YKEY.var(""),mOp.Negative(1))); //<< for { for (;true;) { //<< set i=$order(YKEY(i),-1) i.set(m$.Fnc.$order(YKEY.var(i.get()),mOp.Negative(1))); //<< quit:(i="") if ((mOp.Equal(i.get(),""))) { break; } //<< set YFKEY=YFKEY_YKEY(i)_"," YFKEY.set(mOp.Concat(mOp.Concat(YFKEY.get(),YKEY.var(i.get()).get()),",")); } } //<< } //<< } //<< if $extract(YFKEY,$length(YFKEY))="," set $extract(YFKEY,$length(YFKEY))="" ; CORE-251 if (mOp.Equal(m$.Fnc.$extract(YFKEY.get(),m$.Fnc.$length(YFKEY.get())),",")) { mVar $extract = m$.var("$extract"); $extract.var(YFKEY.get(),m$.Fnc.$length(YFKEY.get())).set(""); } //<< //<< quit YFKEY return YFKEY.get(); } //<< //<< Index(YDATEI) public Object Index(Object ... _p) { mVar YDATEI = m$.newVarRef("YDATEI",(((_p!=null)&&(_p.length>=1))?_p[0]:null)); //<< ;------------------------------------------------------------------------------- //<< ; Find the index on the last primary key //<< ; //<< ; Returns: //<< ; //<< ; History: //<< ; 28-Aug-2013 shobby CORE-251: Initialise intIndex //<< ; 01-Dec-2011 shobby SR17817 Created //<< ;------------------------------------------------------------------------------- //<< new idWWW002,intIndex,objWWW002 mVar idWWW002 = m$.var("idWWW002"); mVar intIndex = m$.var("intIndex"); mVar objWWW002 = m$.var("objWWW002"); m$.newVar(idWWW002,intIndex,objWWW002); //<< set idWWW002=$order(^WWW002(0,YDATEI,""),-1) idWWW002.set(m$.Fnc.$order(m$.var("^WWW002",0,YDATEI.get(),""),mOp.Negative(1))); //<< set intIndex="" ;CORE-251 intIndex.set(""); //<< if idWWW002'="" { if (mOp.NotEqual(idWWW002.get(),"")) { //<< set objWWW002=$get(^WWW002(0,YDATEI,idWWW002,1)) objWWW002.set(m$.Fnc.$get(m$.var("^WWW002",0,YDATEI.get(),idWWW002.get(),1))); //<< set intIndex=$$$WWW002IndexKey(objWWW002) intIndex.set(include.WWWConst.$$$WWW002IndexKey(m$,objWWW002)); } //<< } //<< quit intIndex return intIndex.get(); } //<< //<< //<< Find(pstrCheckList,pidNext,pYFKEY) public Object Find(Object ... _p) { mVar pstrCheckList = m$.newVarRef("pstrCheckList",(((_p!=null)&&(_p.length>=1))?_p[0]:null)); mVar pidNext = m$.newVarRef("pidNext",(((_p!=null)&&(_p.length>=2))?_p[1]:null)); mVar pYFKEY = m$.newVarRef("pYFKEY",(((_p!=null)&&(_p.length>=3))?_p[2]:null)); //<< ;------------------------------------------------------------------------------- //<< ; Determine whether this record has already been used, considering the sharing of //<< ; IDs (ignoring prefix) //<< ; //<< ; When allocating a new sequence number it is necessary to check all associated //<< ; classes - each potentially its own prefix - to ensure that the number has not //<< ; been allocated elsewhere. pstrCheckList contains all possible cross-checks //<< ; that are required. //<< ; //<< ; Inputs: //<< ; pstrCheckList Prefix1;Class1~Prefix2;Class2~... //<< ; pidNext Sequence key generated by NEXT that needs testing //<< ; pYFKEY Prior keys for record (Counter key may not be the first key) //<< ; //<< ; Returns: //<< ; //<< ; History: //<< ; 20-May-2009 GRF SRBR014965: standardise variables; doco; YM already set. //<< ; 04-Jul-2008 GRF SRBR014965: Doco //<< ; 03-Jul-2008 shobby SRBR014965: Created //<< ;------------------------------------------------------------------------------- //<< new blnFound,idClass,objPrefix,loop,strPrefix,strKey mVar blnFound = m$.var("blnFound"); mVar idClass = m$.var("idClass"); mVar objPrefix = m$.var("objPrefix"); mVar loop = m$.var("loop"); mVar strPrefix = m$.var("strPrefix"); mVar strKey = m$.var("strKey"); m$.newVar(blnFound,idClass,objPrefix,loop,strPrefix,strKey); //<< new intIndex ;SR17817 mVar intIndex = m$.var("intIndex"); m$.newVar(intIndex); //<< //<< set blnFound = $$$NO blnFound.set(include.COMSYS.$$$NO(m$)); //<< for loop=1:1:$length(pstrCheckList,Y) { for (loop.set(1);(mOp.LessOrEqual(loop.get(),m$.Fnc.$length(pstrCheckList.get(),m$.var("Y").get())));loop.set(mOp.Add(loop.get(),1))) { //<< quit:blnFound if (mOp.Logical(blnFound.get())) { break; } //<< //<< set objPrefix = $piece(pstrCheckList,Y,loop) objPrefix.set(m$.Fnc.$piece(pstrCheckList.get(),m$.var("Y").get(),loop.get())); //<< set strPrefix = $piece(objPrefix,";",1) strPrefix.set(m$.Fnc.$piece(objPrefix.get(),";",1)); //<< set idClass = $piece(objPrefix,";",2) idClass.set(m$.Fnc.$piece(objPrefix.get(),";",2)); //<< //<< if pYFKEY="" { if (mOp.Equal(pYFKEY.get(),"")) { //<< set blnFound = $data(@("^"_idClass_"("""_YM_""","""_strPrefix_pidNext_""")")) blnFound.set(m$.Fnc.$data(m$.indirectVar((mOp.Concat(mOp.Concat(mOp.Concat(mOp.Concat(mOp.Concat(mOp.Concat(mOp.Concat("^",idClass.get()),"(\""),m$.var("YM").get()),"\",\""),strPrefix.get()),pidNext.get()),"\")"))))); } //<< } else { else { //<< set intIndex=$$Index(idClass) intIndex.set(m$.fnc$("Index",idClass.get())); //<< if (intIndex'="") { if ((mOp.NotEqual(intIndex.get(),""))) { //<< ; This will ensure that the counter field is unique even if proceeding primary keys are different. //<< set blnFound=$data(@("^"_idClass_"s("""_YM_""","""_intIndex_""","""_$$Index^COMUtils(strPrefix_pidNext)_""")")) blnFound.set(m$.Fnc.$data(m$.indirectVar((mOp.Concat(mOp.Concat(mOp.Concat(mOp.Concat(mOp.Concat(mOp.Concat(mOp.Concat(mOp.Concat("^",idClass.get()),"s(\""),m$.var("YM").get()),"\",\""),intIndex.get()),"\",\""),m$.fnc$("COMUtils.Index",mOp.Concat(strPrefix.get(),pidNext.get()))),"\")"))))); } //<< } else { else { //<< set blnFound = $data(@("^"_idClass_"("""_YM_""","""_pYFKEY_""","""_strPrefix_pidNext_""")")) blnFound.set(m$.Fnc.$data(m$.indirectVar((mOp.Concat(mOp.Concat(mOp.Concat(mOp.Concat(mOp.Concat(mOp.Concat(mOp.Concat(mOp.Concat(mOp.Concat("^",idClass.get()),"(\""),m$.var("YM").get()),"\",\""),pYFKEY.get()),"\",\""),strPrefix.get()),pidNext.get()),"\")"))))); } } } //<< } //<< } //<< } //<< quit blnFound return blnFound.get(); } //<< //<< //<< NEXT public void NEXT() { //<< ;------------------------------------------------------------------------------- //<< ; History : //<< ; 20-Sep-2013 shobby HEVA-922: When reset the first number in the new series will be 1 not 0 //<< ; 20-Feb-2008 GRF SRBR014880: Peer Review corrections //<< ; 19-Feb-2008 GM SRBR014880: set increment value to zero When "$$MustResetYear() = 1" //<< ; 12-Feb-2008 GM SRBR014880: back increment value to zero when start new year //<< ; and button "ResetOnChangeOver" is selected //<< ; 25-Sep-2007 GRF SR15602: don't override general setting with location-based //<< ; update; determine split of prefix and value from RHS //<< ; when find non-numeric rather than from LHS with //<< ; first digit; Increment factor 10/100 converted to //<< ; while statement; avoid single digit variables //<< ; (A=>idNext, B=>strPrefix, Q=>intIncr, replace C, D //<< ; and with intLenValue) (original code moved to //<< ; oldNEXT with wrapper RunOldNEXT) //<< ; 20-Sep-2007 GRF SRBR014719: Doco //<< ; 17-Sep-2007 GRF SR15601: Replace "YEAR" transformation with "YYYY" and //<< ; generate 2 digit year from "YEAR" //<< ; 04-Jun-2007 GRF SR15533: Never rollback a new number record //<< ; 13-Mar-2007 GRF Highlight locking //<< ; 08-May-2006 Steve S Use $$^WWWFORMNAME //<< ; 18-Jan-2006 PO SR14109: Wait for 10s to get lock - if lock not granted, //<< ; error out with reason why then terminate process. //<< ; Included error trap for extra precaution - should //<< ; not be required. Immediately remove lock in case //<< ; called from within a transaction. //<< ; 18-Jul-2005 RobertW SR12994: Fix a missing $get around YLOCATION //<< ;------------------------------------------------------------------------------- //<< set $ztrap = "NEXTError" mVar $ztrap = m$.var("$ztrap"); $ztrap.set("NEXTError"); //<< //<< new blnLocnBased,blnResetYear,char,intIncr,intLenValue,intValue mVar blnLocnBased = m$.var("blnLocnBased"); mVar blnResetYear = m$.var("blnResetYear"); mVar _char = m$.var("_char"); mVar intIncr = m$.var("intIncr"); mVar intLenValue = m$.var("intLenValue"); mVar intValue = m$.var("intValue"); m$.newVar(blnLocnBased,blnResetYear,_char,intIncr,intLenValue,intValue); //<< new objWWW128,objWWW1280,strDescription,strPrefix mVar objWWW128 = m$.var("objWWW128"); mVar objWWW1280 = m$.var("objWWW1280"); mVar strDescription = m$.var("strDescription"); mVar strPrefix = m$.var("strPrefix"); m$.newVar(objWWW128,objWWW1280,strDescription,strPrefix); //<< //<< ; FIXME : <GRF> May have two forms with same class. If using a numerator they will //<< ; have separate streams of numbers though these could possibly just //<< ; leapfrog over each other. If both forms are used at the same time //<< ; the locks below will fail allowing them to possibly get the same //<< ; number. (Small window of opportunity - only open until the class //<< ; record is written at which time the $data test above will stop any //<< ; duplication.) //<< //<< //<< ;*************************************** //<< lock +^WWW128(YM,YFORM):10 m$.Cmd.LockInc(m$.var("^WWW128",m$.var("YM").get(),m$.var("YFORM").get()),10); //<< ;*************************************** //<< //<< if $test { if (mOp.Logical(m$.Fnc.$test())) { //<< set objWWW128 = $get(^WWW128(YM,YFORM,1)) objWWW128.set(m$.Fnc.$get(m$.var("^WWW128",m$.var("YM").get(),m$.var("YFORM").get(),1))); //<< if ($get(YLOCATION)'="") && $data(^WWW1280(YM,YFORM,YLOCATION,1)) { if ((mOp.NotEqual(m$.Fnc.$get(m$.var("YLOCATION")),"")) && mOp.Logical(m$.Fnc.$data(m$.var("^WWW1280",m$.var("YM").get(),m$.var("YFORM").get(),m$.var("YLOCATION").get(),1)))) { //<< set objWWW1280 = $get(^WWW1280(YM,YFORM,YLOCATION,1)) objWWW1280.set(m$.Fnc.$get(m$.var("^WWW1280",m$.var("YM").get(),m$.var("YFORM").get(),m$.var("YLOCATION").get(),1))); //<< set blnLocnBased = $$$YES blnLocnBased.set(include.COMSYS.$$$YES(m$)); } //<< } else { else { //<< set objWWW1280="" objWWW1280.set(""); //<< set blnLocnBased = $$$NO blnLocnBased.set(include.COMSYS.$$$NO(m$)); } //<< } //<< //<< ;----------------------------------- //<< ; YZAHL : Increment by (default 1) ;ZHLER //<< ;----------------------------------- //<< if blnLocnBased { if (mOp.Logical(blnLocnBased.get())) { //<< if YZAHL=1 { if (mOp.Equal(m$.var("YZAHL").get(),1)) { //<< set intIncr = +$piece(objWWW1280,Y,2) intIncr.set(mOp.Positive(m$.Fnc.$piece(objWWW1280.get(),m$.var("Y").get(),2))); //<< if intIncr set YZAHL=intIncr if (mOp.Logical(intIncr.get())) { mVar YZAHL = m$.var("YZAHL"); YZAHL.set(intIncr.get()); } } //<< } //<< //<< set idNext = $piece(objWWW1280,Y,1) mVar idNext = m$.var("idNext"); idNext.set(m$.Fnc.$piece(objWWW1280.get(),m$.var("Y").get(),1)); //<< if idNext="" { if (mOp.Equal(idNext.get(),"")) { //<< set idNext=$piece(objWWW128,Y,1) ; only basing increment locally - can't idNext.set(m$.Fnc.$piece(objWWW128.get(),m$.var("Y").get(),1)); //<< set blnLocnBased = $$$NO ; tell why this would occur but handles it blnLocnBased.set(include.COMSYS.$$$NO(m$)); } } //<< } //<< } else { else { //<< if YZAHL=1 { if (mOp.Equal(m$.var("YZAHL").get(),1)) { //<< set intIncr = +$piece(objWWW128,Y,2) intIncr.set(mOp.Positive(m$.Fnc.$piece(objWWW128.get(),m$.var("Y").get(),2))); //<< if intIncr set YZAHL = intIncr if (mOp.Logical(intIncr.get())) { mVar YZAHL = m$.var("YZAHL"); YZAHL.set(intIncr.get()); } } //<< } //<< set idNext = $piece(objWWW128,Y,1) mVar idNext = m$.var("idNext"); idNext.set(m$.Fnc.$piece(objWWW128.get(),m$.var("Y").get(),1)); } //<< //<< } //<< //<< ;--------------------------------------------------------------------------- //<< ; e.g. based on "ABC2:00007" //<< ; "ABC2:00007" //<< ; "70000:2CBA" => "70000" //<< ; strPrefix ":2CBA" => "ABC2:" //<< ; "00007" //<< ; intLenValue 5 //<< ; +1 intValue 7 => 8 (with ...0 or ...00 rounding) //<< ; "00008" //<< ; idNext "ABC2:00008" //<< ;--------------------------------------------------------------------------- //<< //<< set strPrefix = $reverse(idNext) strPrefix.set(m$.Fnc.$reverse(m$.var("idNext").get())); //<< for { for (;true;) { //<< quit:'$find("1234567890",$extract(strPrefix)) if (mOp.Not(m$.Fnc.$find("1234567890",m$.Fnc.$extract(strPrefix.get())))) { break; } //<< quit:strPrefix="" if (mOp.Equal(strPrefix.get(),"")) { break; } //<< //<< set strPrefix=$extract(strPrefix,2,999) strPrefix.set(m$.Fnc.$extract(strPrefix.get(),2,999)); } //<< } //<< set strPrefix = $reverse(strPrefix) strPrefix.set(m$.Fnc.$reverse(strPrefix.get())); //<< if strPrefix'="" { if (mOp.NotEqual(strPrefix.get(),"")) { //<< set intValue = $piece(idNext,strPrefix,2) intValue.set(m$.Fnc.$piece(m$.var("idNext").get(),strPrefix.get(),2)); } //<< } else { else { //<< set intValue = idNext intValue.set(m$.var("idNext").get()); } //<< } //<< set intLenValue = $length(intValue) ; includes leading zeros intLenValue.set(m$.Fnc.$length(intValue.get())); //<< set intValue = intValue + YZAHL ; strips leading zeros when increments intValue.set(mOp.Add(intValue.get(),m$.var("YZAHL").get())); //<< //<< set blnResetYear = $$MustResetYear(YFORM,YLOCATION,blnLocnBased) blnResetYear.set(m$.fnc$("MustResetYear",m$.var("YFORM").get(),m$.var("YLOCATION").get(),blnLocnBased.get())); //<< if blnResetYear set intValue = 1 ; HEVA-922 if (mOp.Logical(blnResetYear.get())) { intValue.set(1); } //<< //<< ; If trailing zeros are specified in increment //<< ;----------------------------------- //<< ; FIXME : <GRF> Is it more appropriate to use "intValue#YZAHL'=0"? //<< ; This will ensure rounded to next multiple of say 20 rather than //<< ; rounding to powers of 10 after adding 20. //<< ;----------------------------------- //<< ; Next 10*x //<< ; NOTE: may skip an entry //<< ; e.g. last number = 206, increment => 216, next "0" = 220, doesn't set 210. //<< if $extract(YZAHL,$length(YZAHL))="0" { if (mOp.Equal(m$.Fnc.$extract(m$.var("YZAHL").get(),m$.Fnc.$length(m$.var("YZAHL").get())),"0")) { //<< while intValue#10'=0 { while (mOp.NotEqual(mOp.Modulus(intValue.get(),10),0)) { //<< set intValue = intValue+1 intValue.set(mOp.Add(intValue.get(),1)); } } //<< } //<< } //<< //<< ; Next 100*x //<< ; NOTE: may skip an entry //<< ; e.g. last number = 206, increment => 306, next "00" = 400, doesn't set 300. //<< if $extract(YZAHL,$length(YZAHL)-1,$length(YZAHL))="00" { if (mOp.Equal(m$.Fnc.$extract(m$.var("YZAHL").get(),mOp.Subtract(m$.Fnc.$length(m$.var("YZAHL").get()),1),m$.Fnc.$length(m$.var("YZAHL").get())),"00")) { //<< while intValue#100'=0 { while (mOp.NotEqual(mOp.Modulus(intValue.get(),100),0)) { //<< set intValue = intValue+1 intValue.set(mOp.Add(intValue.get(),1)); } } //<< } //<< } //<< //<< ; Reconstruct identifier //<< ;----------------------------------- //<< set idNext = strPrefix_$translate($justify(intValue,intLenValue)," ","0") mVar idNext = m$.var("idNext"); idNext.set(mOp.Concat(strPrefix.get(),m$.Fnc.$translate(m$.Fnc.$justify(intValue.get(),intLenValue.get())," ","0"))); //<< //<< ;+++++++++++++++++++++++++++++++++++ ; Never rollback a new number record //<< $$$JournalOff include.COMSYS.$$$JournalOff(m$); //<< ;+++++++++++++++++++++++++++++++++++ //<< //<< ;----------------------------------- //<< ; Save the change - ONLY at the level the original value came from. //<< ;----------------------------------- //<< if blnLocnBased { if (mOp.Logical(blnLocnBased.get())) { //<< set $$$WWW1280LastUsedSequenceNumber(^WWW1280(YM,YFORM,YLOCATION,1)) = idNext include.WWWConst.$$$WWW1280LastUsedSequenceNumberSet(m$,m$.var("^WWW1280",m$.var("YM").get(),m$.var("YFORM").get(),m$.var("YLOCATION").get(),1),idNext.get()); //<< if blnResetYear set $$$WWW1280LastResetYear(^WWW1280(YM,YFORM,YLOCATION,1)) = +$zdate($horolog,3) if (mOp.Logical(blnResetYear.get())) { include.WWWConst.$$$WWW1280LastResetYearSet(m$,m$.var("^WWW1280",m$.var("YM").get(),m$.var("YFORM").get(),m$.var("YLOCATION").get(),1),mOp.Positive(m$.Fnc.$zdate(m$.Fnc.$horolog(),3))); } } //<< } else { else { //<< set $$$WWW128SequenceNumber(^WWW128(YM,YFORM,1)) = idNext include.WWWConst.$$$WWW128SequenceNumberSet(m$,m$.var("^WWW128",m$.var("YM").get(),m$.var("YFORM").get(),1),idNext.get()); //<< if blnResetYear set $$$WWW128LastResetYear(^WWW128(YM,YFORM,1)) = +$zdate($horolog,3) if (mOp.Logical(blnResetYear.get())) { include.WWWConst.$$$WWW128LastResetYearSet(m$,m$.var("^WWW128",m$.var("YM").get(),m$.var("YFORM").get(),1),mOp.Positive(m$.Fnc.$zdate(m$.Fnc.$horolog(),3))); } } //<< } //<< ;+++++++++++++++++++++++++++++++++++ //<< $$$JournalOn include.COMSYS.$$$JournalOn(m$); //<< ;+++++++++++++++++++++++++++++++++++ //<< //<< ;*********************************** //<< lock -^WWW128(YM,YFORM)#"I" ; SR14109 m$.Cmd.Unlock(m$.var("^WWW128",m$.var("YM").get(),m$.var("YFORM").get()),"I"); //<< ;*********************************** //<< //<< if $find(idNext,"YEAR") set idNext = $piece(idNext,"YEAR",1) _$extract($$^WWWYEAR(),3,4)_$piece(idNext,"YEAR",2) if (mOp.Logical(m$.Fnc.$find(idNext.get(),"YEAR"))) { idNext.set(mOp.Concat(mOp.Concat(m$.Fnc.$piece(idNext.get(),"YEAR",1),m$.Fnc.$extract(m$.fnc$("WWWYEAR.main"),3,4)),m$.Fnc.$piece(idNext.get(),"YEAR",2))); } //<< if $find(idNext,"YYYY") set idNext = $piece(idNext,"YYYY",1) _$$^WWWYEAR() _$piece(idNext,"YYYY",2) if (mOp.Logical(m$.Fnc.$find(idNext.get(),"YYYY"))) { idNext.set(mOp.Concat(mOp.Concat(m$.Fnc.$piece(idNext.get(),"YYYY",1),m$.fnc$("WWWYEAR.main")),m$.Fnc.$piece(idNext.get(),"YYYY",2))); } //<< if $find(idNext,"USER") set idNext = $piece(idNext,"USER",1) _$get(YBED) _$piece(idNext,"USER",2) if (mOp.Logical(m$.Fnc.$find(idNext.get(),"USER"))) { idNext.set(mOp.Concat(mOp.Concat(m$.Fnc.$piece(idNext.get(),"USER",1),m$.Fnc.$get(m$.var("YBED"))),m$.Fnc.$piece(idNext.get(),"USER",2))); } //<< if $find(idNext,"LOCATION") set idNext = $piece(idNext,"LOCATION",1)_$get(YLOCATION) _$piece(idNext,"LOCATION",2) if (mOp.Logical(m$.Fnc.$find(idNext.get(),"LOCATION"))) { idNext.set(mOp.Concat(mOp.Concat(m$.Fnc.$piece(idNext.get(),"LOCATION",1),m$.Fnc.$get(m$.var("YLOCATION"))),m$.Fnc.$piece(idNext.get(),"LOCATION",2))); } //<< if $find(idNext,"BETRIEB") set idNext = $piece(idNext,"BETRIEB",1) _$get(YLOCATION) _$piece(idNext,"BETRIEB",2) if (mOp.Logical(m$.Fnc.$find(idNext.get(),"BETRIEB"))) { idNext.set(mOp.Concat(mOp.Concat(m$.Fnc.$piece(idNext.get(),"BETRIEB",1),m$.Fnc.$get(m$.var("YLOCATION"))),m$.Fnc.$piece(idNext.get(),"BETRIEB",2))); } //<< if $find(idNext,"COMPANY") set idNext = $piece(idNext,"COMPANY",1) _$get(YM) _$piece(idNext,"COMPANY",2) ; Deprecated if (mOp.Logical(m$.Fnc.$find(idNext.get(),"COMPANY"))) { idNext.set(mOp.Concat(mOp.Concat(m$.Fnc.$piece(idNext.get(),"COMPANY",1),m$.Fnc.$get(m$.var("YM"))),m$.Fnc.$piece(idNext.get(),"COMPANY",2))); } //<< if $find(idNext,"MANDANT") set idNext = $piece(idNext,"MANDANT",1) _$get(YM) _$piece(idNext,"MANDANT",2) ; Deprecated if (mOp.Logical(m$.Fnc.$find(idNext.get(),"MANDANT"))) { idNext.set(mOp.Concat(mOp.Concat(m$.Fnc.$piece(idNext.get(),"MANDANT",1),m$.Fnc.$get(m$.var("YM"))),m$.Fnc.$piece(idNext.get(),"MANDANT",2))); } } //<< //<< } else { else { //<< set strDescription = $$^WWWFORMNAME(YFORM) strDescription.set(m$.fnc$("WWWFORMNAME.main",m$.var("YFORM").get())); //<< set:strDescription="" strDescription = YFORM if (mOp.Equal(strDescription.get(),"")) { strDescription.set(m$.var("YFORM").get()); } //<< //<< ;----------------------------------- //<< ; Next number for %1 can not be determined, contact your systems administrator. //<< ;----------------------------------- //<< if $get(%("%KEY","HYPEREVENT")) { if (mOp.Logical(m$.Fnc.$get(m$.var("%","%KEY","HYPEREVENT")))) { //<< $$$Alert($listbuild("WWW00001",strDescription)) include.COMSYS.$$$Alert(m$,m$.Fnc.$listbuild("WWW00001",strDescription.get())); } //<< } else { else { //<< $$$AlertInScript($listbuild("WWW00001",strDescription)) include.COMSYS.$$$AlertInScript(m$,m$.Fnc.$listbuild("WWW00001",strDescription.get())); } } //<< } //<< halt //<< } //<< quit return; } //<< //<< NEXTError ; Internal Tag public void NEXTError() { //<< set $ztrap = "" mVar $ztrap = m$.var("$ztrap"); $ztrap.set(""); //<< ;*************************************** //<< lock -^WWW128(YM,YFORM) m$.Cmd.Unlock(m$.var("^WWW128",m$.var("YM").get(),m$.var("YFORM").get())); //<< ;*************************************** //<< quit return; } //<< //<< //<< Reset(pidForm,pidReset,pidLoc="") public Object Reset(Object ... _p) { mVar pidForm = m$.newVarRef("pidForm",(((_p!=null)&&(_p.length>=1))?_p[0]:null)); mVar pidReset = m$.newVarRef("pidReset",(((_p!=null)&&(_p.length>=2))?_p[1]:null)); mVar pidLoc = m$.newVarRef("pidLoc",(((_p!=null)&&(_p.length>=3))?_p[2]:null),""); //<< ;------------------------------------------------------------------------------- //<< ; Reset the sequence number. //<< ; //<< ; Note: Currently only works if numerator form is same as class. //<< ; //<< ; Params: pidForm - numerator id (WWW128) //<< ; pidLoc - (optional) 2nd key to WWW1280 //<< ; pidReset - value to re-use. //<< ; ie - the numerator should be set to a value before this one //<< ; //<< ; Returns: //<< ; //<< ; History: //<< ; 10-Jan-2007 JW SR15347: Created. Moved from INDRPAUFKILL. //<< ;------------------------------------------------------------------------------- //<< new idLast,idNewLast,blnLoc mVar idLast = m$.var("idLast"); mVar idNewLast = m$.var("idNewLast"); mVar blnLoc = m$.var("blnLoc"); m$.newVar(idLast,idNewLast,blnLoc); //<< //<< set idNewLast="" idNewLast.set(""); //<< //<< set $ztrap = "NEXTError" mVar $ztrap = m$.var("$ztrap"); $ztrap.set("NEXTError"); //<< ;*************************************** //<< LOCK +^WWW128(YM,pidForm):10 m$.Cmd.LockInc(m$.var("^WWW128",m$.var("YM").get(),pidForm.get()),10); //<< ;*************************************** //<< //<< // If can't get the lock, don't worry about re-setting, not that important. //<< if $test { if (mOp.Logical(m$.Fnc.$test())) { //<< set blnLoc = ((pidLoc'="") && $data(^WWW1280(YM,pidForm,pidLoc))) ; Location Dependant Numerator blnLoc.set(((mOp.NotEqual(pidLoc.get(),"")) && mOp.Logical(m$.Fnc.$data(m$.var("^WWW1280",m$.var("YM").get(),pidForm.get(),pidLoc.get()))))); //<< //<< if blnLoc { if (mOp.Logical(blnLoc.get())) { //<< set idLast = $$$WWW1280LastUsedSequenceNumber($get(^WWW1280(YM,pidForm,pidLoc,1))) idLast.set(include.WWWConst.$$$WWW1280LastUsedSequenceNumber(m$,m$.Fnc.$get(m$.var("^WWW1280",m$.var("YM").get(),pidForm.get(),pidLoc.get(),1)))); } //<< } else { else { //<< set idLast = $$$WWW128SequenceNumber($get(^WWW128(YM,pidForm,1))) idLast.set(include.WWWConst.$$$WWW128SequenceNumber(m$,m$.Fnc.$get(m$.var("^WWW128",m$.var("YM").get(),pidForm.get(),1)))); } //<< } //<< //<< // Note - the following block was not changed from the original. It probably should be //<< // optimised using the same sort of functionality as WWWNEXT or FINAPChequeBook. //<< // I'm sure the execution isn't great. //<< //<< if $$$IsPosInt(idLast) && (idLast'<(pidReset-1)) { ; Numeric if (mOp.Logical(include.COMSYSNum.$$$IsPosInt(m$,idLast)) && (mOp.NotLess(idLast.get(),(mOp.Subtract(pidReset.get(),1))))) { //<< set idNewLast = pidReset-1 idNewLast.set(mOp.Subtract(pidReset.get(),1)); } //<< //<< } else { else { //<< xecute "set idLast = $order("_$$$GlobalString(pidForm,idLast)_",-1)" m$.Cmd.Xecute(mOp.Concat(mOp.Concat("set idLast = $order(",include.COMSYSWWW.$$$GlobalString(m$,pidForm,idLast)),",-1)")); //<< if (idLast'="") && (pidReset]]idLast) { ; Alphanumeric if ((mOp.NotEqual(idLast.get(),"")) && mOp.Logical((mOp.SortsAfter(pidReset.get(),idLast.get())))) { //<< set idNewLast = idLast idNewLast.set(idLast.get()); } } //<< } //<< } //<< //<< if idNewLast'="" { // Are we re-setting ? if (mOp.NotEqual(idNewLast.get(),"")) { //<< if blnLoc { if (mOp.Logical(blnLoc.get())) { //<< set $$$WWW1280LastUsedSequenceNumber(^WWW1280(YM,pidForm,pidLoc,1)) = idNewLast include.WWWConst.$$$WWW1280LastUsedSequenceNumberSet(m$,m$.var("^WWW1280",m$.var("YM").get(),pidForm.get(),pidLoc.get(),1),idNewLast.get()); } //<< //<< } else { else { //<< set $$$WWW128SequenceNumber(^WWW128(YM,pidForm,1)) = idNewLast include.WWWConst.$$$WWW128SequenceNumberSet(m$,m$.var("^WWW128",m$.var("YM").get(),pidForm.get(),1),idNewLast.get()); } } //<< } //<< } //<< //<< ;*********************************** //<< LOCK -^WWW128(YM,pidForm)#"I" m$.Cmd.Unlock(m$.var("^WWW128",m$.var("YM").get(),pidForm.get()),"I"); } //<< ;*********************************** //<< } //<< quit idNewLast return idNewLast.get(); } //<< //<< //<< MustResetYear(pidForm,pidLocn,pblnLocnBased) PRIVATE public Object MustResetYear(Object ... _p) { mVar pidForm = m$.newVarRef("pidForm",(((_p!=null)&&(_p.length>=1))?_p[0]:null)); mVar pidLocn = m$.newVarRef("pidLocn",(((_p!=null)&&(_p.length>=2))?_p[1]:null)); mVar pblnLocnBased = m$.newVarRef("pblnLocnBased",(((_p!=null)&&(_p.length>=3))?_p[2]:null)); //<< ;------------------------------------------------------------------------------- //<< ; Check data to reset the sequence number. //<< ; //<< ; Params: //<< ; pidForm - form name //<< ; pidLocn - location //<< ; pblnLocnBased - is numbering based on location //<< ; //<< ; Returns: //<< ; boolean //<< ; History: //<< ; 20-Feb-2008 GRF SRBR014880: Peer Review corrections //<< ; 13-Feb-2008 GM SRBR014880: Created //<< ;------------------------------------------------------------------------------- //<< new blnReset,blnResult,intLastReset mVar blnReset = m$.var("blnReset"); mVar blnResult = m$.var("blnResult"); mVar intLastReset = m$.var("intLastReset"); m$.newVar(blnReset,blnResult,intLastReset); //<< //<< if pblnLocnBased { if (mOp.Logical(pblnLocnBased.get())) { //<< set blnReset = $$$WWW1280ResetOnChangeOver($get(^WWW1280(YM,pidForm,pidLocn,1))) blnReset.set(include.WWWConst.$$$WWW1280ResetOnChangeOver(m$,m$.Fnc.$get(m$.var("^WWW1280",m$.var("YM").get(),pidForm.get(),pidLocn.get(),1)))); //<< set intLastReset = $$$WWW1280LastResetYear($get(^WWW1280(YM,pidForm,pidLocn,1))) intLastReset.set(include.WWWConst.$$$WWW1280LastResetYear(m$,m$.Fnc.$get(m$.var("^WWW1280",m$.var("YM").get(),pidForm.get(),pidLocn.get(),1)))); } //<< } else { else { //<< set blnReset = $$$WWW128ResetOnChangeOver($get(^WWW128(YM,pidForm,1))) blnReset.set(include.WWWConst.$$$WWW128ResetOnChangeOver(m$,m$.Fnc.$get(m$.var("^WWW128",m$.var("YM").get(),pidForm.get(),1)))); //<< set intLastReset = $$$WWW128LastResetYear($get(^WWW128(YM,pidForm,1))) intLastReset.set(include.WWWConst.$$$WWW128LastResetYear(m$,m$.Fnc.$get(m$.var("^WWW128",m$.var("YM").get(),pidForm.get(),1)))); } //<< } //<< //<< if blnReset="" { if (mOp.Equal(blnReset.get(),"")) { //<< set blnResult = $$$NO blnResult.set(include.COMSYS.$$$NO(m$)); } //<< //<< } elseif intLastReset=+$zdate($horolog,3) { else if (mOp.Equal(intLastReset.get(),mOp.Positive(m$.Fnc.$zdate(m$.Fnc.$horolog(),3)))) { //<< set blnResult = $$$NO blnResult.set(include.COMSYS.$$$NO(m$)); } //<< //<< } else { else { //<< set blnResult = $$$YES blnResult.set(include.COMSYS.$$$YES(m$)); } //<< } //<< quit blnResult return blnResult.get(); } //<< //<< //<< //<< //<< }
true
5b0c6b6865acf00f34e8fbd427600ebaa0e5839d
Java
zhongxingyu/Seer
/Diff-Raw-Data/8/8_43b37d662cd4c0214ae5ceb5e9f0b61c72358063/SkypeChatMessageData/8_43b37d662cd4c0214ae5ceb5e9f0b61c72358063_SkypeChatMessageData_t.java
UTF-8
2,275
2.78125
3
[]
no_license
package skype; import java.util.Date; import utils.DigestProvider; import com.skype.ChatMessage; import com.skype.SkypeException; public class SkypeChatMessageData implements SkypeChatMessage { private final String msgId; private final String userDisplay; private final String message; private final Date date; private final String userId; public SkypeChatMessageData(DigestProvider digestProvider, ChatMessage chatMessage) throws SkypeException { this( digestProvider, chatMessage.getSenderId(), chatMessage.getSenderDisplayName(), chatMessage.getContent(), chatMessage.getTime() ); } public SkypeChatMessageData(DigestProvider digestProvider, String userId, String userDisplay, String message, Date time) { if(userId == null || userDisplay == null || message == null || time == null) throw new IllegalArgumentException("None of the message arguments can be null"); final String encodingData = userId+"/"+message.replaceAll("[\r]", ""); this.msgId = digestProvider.encode(encodingData); this.userDisplay = userDisplay; this.message = message; this.date = time; this.userId = userId; } @Override public String getSenderDisplayname() { return this.userDisplay; } @Override public String getMessageBody() { return this.message; } @Override public String getSignature() { return this.msgId; } @Override public Date getTime() { return this.date; } @Override public String getSenderId() { return this.userId; } @Override public String messageText(boolean printSender) { String formattedTime = SkypeChatMessage.chatMessageDateFormat.format(this.getTime()); final String senderDisplayName; if (printSender) senderDisplayName = this.getSenderDisplayname()+":"; else senderDisplayName = "..."; return String.format("%s %s %s\n", formattedTime, senderDisplayName, this.getMessageBody() ); } @Override public String toString() { return this.messageText(true); } public int hashCode() { return this.getSignature().hashCode(); } @Override public boolean isMatchingSignature(String signature) { return this.getSignature().equals(signature); } }
true
6f3b19e70b9a2baf35da75756bc25945ae171253
Java
fer2d2/fernando.moro.DASM.ecp1.miw.upm.es
/app/src/main/java/es/upm/miw/ficheros/RecyclerViewClickListener.java
UTF-8
146
1.648438
2
[]
no_license
package es.upm.miw.ficheros; import android.view.View; public interface RecyclerViewClickListener { void recyclerViewListClicked(View v); }
true
80dfa82a63613a78d81d54dfaf4e2c727f5469dd
Java
lovelimanyi/liquan_cuishou_back
/cash-back/src/main/java/com/info/vo/bbd/BBD.java
UTF-8
746
1.742188
2
[]
no_license
package com.info.vo.bbd; public class BBD { private String msg; private String rsize; private String total; private DataObj[] results; private String err_code; public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public String getRsize() { return rsize; } public void setRsize(String rsize) { this.rsize = rsize; } public String getTotal() { return total; } public void setTotal(String total) { this.total = total; } public DataObj[] getResults() { return results; } public void setResults(DataObj[] results) { this.results = results; } public String getErr_code() { return err_code; } public void setErr_code(String errCode) { err_code = errCode; } }
true
eae4b9a9ba89df9399257aa2b00492487d7796e7
Java
Wikibeast/cs106a-assignments
/Assignment4/Histogram.java
UTF-8
1,436
3.65625
4
[]
no_license
/* * File: Histogram.java * ------------------ * Name: David Seamans * * This program generates a histogram of the scores listed in the file MidtermScores.txt */ import acm.program.*; import acm.util.*; import java.io.*; public class Histogram extends ConsoleProgram { public void run() { // Initialize the histogram array String[] hist = new String[11]; for (int i = 0; i < hist.length; i++) { hist[i] = ""; }; // Open and read the MidtermScores.txt file try { BufferedReader reader = new BufferedReader ( new FileReader("MidtermScores.txt")); while (true) { String line = reader.readLine(); if (line == null) break; int index = Integer.parseInt(line) / 10; if (index < 0 || index > 10) { println("The score " + line + " is out of range"); break; }; hist[index] += "*"; }; reader.close(); } catch (IOException ex) { throw new ErrorException(ex); }; // Print the histogram, this could be written as a for loop, but would likely take more code than listing the prints println("00-09: " + hist[0]); println("10-19: " + hist[1]); println("20-29: " + hist[2]); println("30-39: " + hist[3]); println("40-49: " + hist[4]); println("50-59: " + hist[5]); println("60-69: " + hist[6]); println("70-79: " + hist[7]); println("80-89: " + hist[8]); println("90-99: " + hist[9]); println(" 100: " + hist[10]); }; }
true
c27d489217df52190e584380ad3be5cd701c3755
Java
song-giung/project_travel
/src/schedule_board/db/SchBoardDAO.java
UTF-8
21,996
2.265625
2
[]
no_license
package schedule_board.db; /* DAO(data access object)�겢�옒�뒪 -�뜲�씠�꽣 踰좎씠�뒪�� �뿰�룞�븯�뿬 �젅肄붾뱶�쓽 異붽�, �닔�젙, �궘�젣 �옉�뾽�씠 �씠猷⑥뼱吏��뒗 �겢�옒�뒪 -�뼱�뼡 Action �겢�옒�뒪媛� �샇異쒕릺�뜑�씪�룄 洹몄뿉 �빐�떦�븯�뒗 �뜲�씠�꽣踰좎씠�뒪 �뿰�룞 泥섎━�뒗 DAO �겢�옒�뒪�뿉�꽌 �씠猷⑥뼱吏�寃� �맗�땲�떎. */ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import javax.naming.Context; import javax.naming.InitialContext; import javax.sql.DataSource; import comm_board.db.CBBforList; public class SchBoardDAO { DataSource ds; Connection con; PreparedStatement pstmt; ResultSet rs; public SchBoardDAO() { try { Context init= new InitialContext(); ds=(DataSource)init.lookup("java:comp/env/jdbc/OracleDB"); }catch(Exception e){ System.out.println("DB �뿰寃� �떎�뙣 : "+ e); return; } } public int getListCount() { // TODO Auto-generated method stub String sql="select count(*) from sch_board"; int result=0; try { con=ds.getConnection(); pstmt=con.prepareStatement(sql); rs=pstmt.executeQuery(); if(rs.next()) result=rs.getInt(1); }catch(Exception e) { e.printStackTrace(); }finally { if(rs!=null) try {rs.close();}catch(SQLException ex) { ex.printStackTrace();} if(pstmt!=null) try {pstmt.close();}catch(SQLException ex) { ex.printStackTrace();} if(con!=null) try {con.close();}catch(SQLException ex) { ex.printStackTrace();} } return result; } public List<SBBforList> firstgetBoardList(int page, int limit) { // TODO Auto-generated method stub System.out.println("firstgetBoardList �뱾�뼱�샂"); String board_list_sql1="select * from "+ "(select rownum rnum, sch_bo_no, sch_bo_title, sch_bo_content, sch_no, sch_bo_date, " + " user_id, user_type from " + " (select * from sch_board natural join client order by sch_bo_date desc) )where rnum>=? and rnum<= ?"; List<SBBforList> list= new ArrayList<SBBforList>(); //�븳�럹�씠吏��떦 10媛쒖뵫 紐⑸줉 1page 2 3 4 int startrow=(page-1)* limit +1; //�떆�옉踰덊샇 1 11 21 31 int endrow=startrow + limit -1; //留덉�留됰쾲�샇 10 20 30 40 try { con=ds.getConnection(); pstmt=con.prepareStatement(board_list_sql1); pstmt.setInt(1, startrow); pstmt.setInt(2, endrow); rs=pstmt.executeQuery(); while(rs.next()) { SBBforList b=new SBBforList(); b.setSch_bo_no(rs.getInt("sch_bo_no")); b.setSch_bo_title(rs.getString("sch_bo_title")); b.setSch_bo_content(rs.getString("sch_bo_content")); b.setSch_bo_date(rs.getDate("sch_bo_date")); b.setUser_id(rs.getString("user_id")); b.setUser_type(rs.getInt("user_type")); b.setSch_no(rs.getInt("sch_no")); list.add(b); } return list; }catch(Exception e) { System.out.println("getboardlist()�뿉�윭 �엯�땲�떎."+e); e.printStackTrace(); }finally { if(rs!=null) try {rs.close();}catch(SQLException ex) { ex.printStackTrace();} if(pstmt!=null) try {pstmt.close();}catch(SQLException ex) { ex.printStackTrace();} if(con!=null) try {con.close();}catch(SQLException ex) { ex.printStackTrace();} } return null; } public List<SBBforList> getTop3(String types[]){ int[] list3; list3=new int[3]; List<SBBforList> list= new ArrayList<SBBforList>(); int index=0; //상위 3개 sch_bo_no 찾아오는 sql 문 String sql="select sch_bo_no, count(sch_bo_no) count from (select * from up natural join client where user_type= ? "; for(int i=1; i<types.length;i++) sql+=" or user_type= ? "; sql+=" ) group by sch_bo_no order by count desc "; //가져온 sch_bo_no로 찾는 sql문 String getlistsql="select * from sch_board natural join client where sch_bo_no=? or sch_bo_no=? or sch_bo_no =? "; try { con=ds.getConnection(); pstmt=con.prepareStatement(sql); //checkbox 통해 가져온 types query에 넣어주기 for(int i=1; i<=types.length; i++) { System.out.println(types[i-1]); System.out.println(Integer.parseInt(types[i-1])); pstmt.setInt(i, Integer.parseInt(types[i-1])); } rs=pstmt.executeQuery(); //상위 3개 가져오기 위해 3번 실행 for(int i=0; i<list3.length;i++) { if(rs.next()) list3[i]=rs.getInt("sch_bo_no"); else list3[i]=0; } pstmt.close(); pstmt=con.prepareStatement(getlistsql); //3개 리스트 가져옴 for(int i=0; i<list3.length;i++) { if(list3[i]==0) pstmt.setInt(i+1, 0); pstmt.setInt(i+1, list3[i]); } rs=pstmt.executeQuery(); while(rs.next()) { SBBforList b=new SBBforList(); b.setSch_bo_no(rs.getInt("sch_bo_no")); b.setSch_bo_title(rs.getString("sch_bo_title")); b.setUser_id(rs.getString("user_id")); b.setUser_type(rs.getInt("user_type")); b.setSch_no(rs.getInt("sch_no")); list.add(b); } System.out.println("list3가져옴!"); return list; }catch(Exception e) { System.out.println("getTopList3()에러 입니다."); e.printStackTrace(); }finally { if(rs!=null) try {rs.close();}catch(SQLException ex) { ex.printStackTrace();} if(pstmt!=null) try {pstmt.close();}catch(SQLException ex) { ex.printStackTrace();} if(con!=null) try {con.close();}catch(SQLException ex) { ex.printStackTrace();} } return null; } public List<SBBforList> getTop3(){ int[] list3; list3=new int[3]; List<SBBforList> list= new ArrayList<SBBforList>(); int index=0; String sql="select sch_bo_no, count(sch_bo_no) count from (select * from up natural join client ) group by sch_bo_no order by count desc "; String getlistsql="select * from sch_board natural join client where sch_bo_no=? or sch_bo_no=? or sch_bo_no =? "; try { //상위 3개 의 게시판 pk 찾음 con=ds.getConnection(); pstmt=con.prepareStatement(sql); rs=pstmt.executeQuery(); for(int i=0; i<list3.length;i++) { if(rs.next()) list3[i]=rs.getInt("sch_bo_no"); else list3[i]=0; } /*if(rs.next()) { for(int i=0; i<list3.length;i++) { rs.next(); list3[i]=rs.getInt("sch_bo_no"); } }*/ pstmt.close(); pstmt=con.prepareStatement(getlistsql); //3개 리스트 가져옴 /*for(int i=0; i<list3.length;i++) { pstmt.setInt(i+1, list3[i]); }*/ for(int i=0; i<list3.length;i++) { if(list3[i]==0) pstmt.setInt(i+1, 0); pstmt.setInt(i+1, list3[i]); } rs=pstmt.executeQuery(); while(rs.next()) { SBBforList b=new SBBforList(); b.setSch_bo_no(rs.getInt("sch_bo_no")); b.setSch_bo_title(rs.getString("sch_bo_title")); b.setUser_id(rs.getString("user_id")); b.setUser_type(rs.getInt("user_type")); b.setSch_no(rs.getInt("sch_no")); list.add(b); } System.out.println("list3가져옴!"); return list; }catch(Exception e) { System.out.println("getTopList3()에러 입니다."); e.printStackTrace(); }finally { if(rs!=null) try {rs.close();}catch(SQLException ex) { ex.printStackTrace();} if(pstmt!=null) try {pstmt.close();}catch(SQLException ex) { ex.printStackTrace();} if(con!=null) try {con.close();}catch(SQLException ex) { ex.printStackTrace();} } return null; } public List<SBBforList> getBoardList(String types[],int page, int limit) { System.out.println("types�벐�뒗 method吏꾩엯"); // TODO Auto-generated method stub String board_list_sql1="select * from "+ "(select rownum rnum, sch_bo_no, sch_bo_title, sch_bo_content, sch_no, sch_bo_date, " + " user_no, user_id, user_type from " + " (select * from sch_board natural join client where user_type=? "; //媛쒖닔媛��졇�삤湲� String countlistsql="select count(sch_bo_no) from "+ "(select rownum rnum, sch_bo_no from " + " (select * from sch_board natural join client where user_type=? "; for(int i=1; i<types.length;i++) { board_list_sql1+=" or user_type=? "; countlistsql+=" or user_type=? "; } board_list_sql1+="order by sch_bo_date desc) )where rnum>=? and rnum<= ?"; countlistsql+=") )"; List<SBBforList> list= new ArrayList<SBBforList>(); int startrow=(page-1)* limit +1; //�떆�옉踰덊샇 1 11 21 31 int endrow=startrow + limit -1; //留덉�留됰쾲�샇 10 20 30 40 int listcount=0; try { con=ds.getConnection(); pstmt=con.prepareStatement(countlistsql); for(int i=1; i<=types.length; i++) { pstmt.setInt(i, Integer.parseInt(types[i-1])); } rs=pstmt.executeQuery(); rs.next(); listcount=rs.getInt(1); if(listcount <=10) { startrow=1; endrow=10; } pstmt.close(); pstmt=con.prepareStatement(board_list_sql1); for(int i=1; i<=types.length; i++) { pstmt.setInt(i, Integer.parseInt(types[i-1])); } pstmt.setInt(types.length+1, startrow); pstmt.setInt(types.length+2, endrow); rs=pstmt.executeQuery(); while(rs.next()) { SBBforList b=new SBBforList(); b.setSch_bo_no(rs.getInt("sch_bo_no")); b.setSch_bo_title(rs.getString("sch_bo_title")); b.setSch_bo_content(rs.getString("sch_bo_content")); b.setSch_bo_date(rs.getDate("sch_bo_date")); b.setUser_id(rs.getString("user_id")); b.setListcount(listcount); b.setUser_type(rs.getInt("user_type")); b.setSch_no(rs.getInt("sch_no")); list.add(b); } return list; }catch(Exception e) { System.out.println("getboardlist()�뿉�윭 �엯�땲�떎."+e); e.printStackTrace(); }finally { if(rs!=null) try {rs.close();}catch(SQLException ex) { ex.printStackTrace();} if(pstmt!=null) try {pstmt.close();}catch(SQLException ex) { ex.printStackTrace();} if(con!=null) try {con.close();}catch(SQLException ex) { ex.printStackTrace();} } return null; } public boolean boardInsert(SchBoardBean boarddata) { // TODO Auto-generated method stub int num=0; String sql=""; int result=0; try { con= ds.getConnection(); sql="insert into sch_board (sch_bo_no,sch_bo_title, sch_bo_content,user_no,sch_no,sch_bo_date)" +" values(sch_bo_no.nextval, ?, ?, ?, ?, sysdate)"; pstmt=con.prepareStatement(sql); pstmt.setString(1, boarddata.getSch_bo_title()); pstmt.setString(2, boarddata.getSch_bo_content()); pstmt.setInt(3, boarddata.getUser_no()); pstmt.setInt(4, boarddata.getSch_no()); result=pstmt.executeUpdate(); if(result==0) return false; return true; }catch(Exception e) { System.out.println("�씪�젙 寃뚯떆�뙋 boardinsert()�뿉�윭 �엯�땲�떎."); e.printStackTrace(); }finally { if(rs!=null) try {rs.close();}catch(SQLException ex) { ex.printStackTrace();} if(pstmt!=null) try {pstmt.close();}catch(SQLException ex) { ex.printStackTrace();} if(con!=null) try {con.close();}catch(SQLException ex) { ex.printStackTrace();} } return false; } public SBBforList getDetail(int sch_bo_no) { // TODO Auto-generated method stub String sql="select * from sch_board natural join client where sch_bo_no=?"; SBBforList bb=new SBBforList(); try { con=ds.getConnection(); pstmt=con.prepareStatement(sql); pstmt.setInt(1, sch_bo_no); rs=pstmt.executeQuery(); if(rs.next()) { bb.setSch_bo_no(rs.getInt("sch_bo_no")); bb.setSch_bo_title(rs.getString("sch_bo_title")); bb.setSch_bo_content(rs.getString("sch_bo_content")); bb.setSch_bo_date(rs.getDate("sch_bo_date")); bb.setUser_no(rs.getInt("user_no")); bb.setSch_no(rs.getInt("sch_no")); bb.setUser_no(rs.getInt("user_no")); bb.setUser_id(rs.getString("user_id")); bb.setUser_type(rs.getInt("user_type")); } }catch(Exception e) { e.printStackTrace(); }finally { if(rs!=null) try {rs.close();}catch(SQLException ex) { ex.printStackTrace();} if(pstmt!=null) try {pstmt.close();}catch(SQLException ex) { ex.printStackTrace();} if(con!=null) try {con.close();}catch(SQLException ex) { ex.printStackTrace();} } return bb; } public List<SBBforList> getBoardList(String searchindex, String searchcontent, int page, int limit) { // TODO Auto-generated method stub System.out.println("寃��깋留� �븯�뒗 DAO �뱾�뼱�샂"); String board_list_sql1="select * from "+ "(select rownum rnum, sch_bo_no, sch_bo_title, sch_bo_content, sch_bo_date, " + " user_no, user_id ,user_type, sch_no from " + " (select * from sch_board natural join client order by sch_bo_date desc) "; String countlistsql="select count(sch_bo_no) from (select sch_bo_no, sch_bo_content, sch_bo_title, user_id " +"from (select * from sch_board natural join client order by sch_bo_date desc) )"; String aa="%"+searchcontent+"%"; switch(searchindex){ case "title": searchindex="sch_bo_title"; break; case "user": searchindex="user_id"; break; case "content": searchindex="sch_bo_content"; break; } board_list_sql1 +=" where "+searchindex+" like ?"; board_list_sql1 += " )where rnum>=? and rnum<= ?"; countlistsql+=" where "+searchindex+" like ?"; List<SBBforList> list= new ArrayList<SBBforList>(); //�븳�럹�씠吏��떦 10媛쒖뵫 紐⑸줉 1page 2 3 4 int startrow=(page-1)* limit +1; //�떆�옉踰덊샇 1 11 21 31 int endrow=startrow + limit -1; //留덉�留됰쾲�샇 10 20 30 40 try { con=ds.getConnection(); pstmt=con.prepareStatement(countlistsql); pstmt.setString(1, aa); rs=pstmt.executeQuery(); rs.next(); int count=rs.getInt(1); System.out.println("count�븷�삤"+count); if(count<=10) { startrow=1; endrow=10; } pstmt.close(); pstmt=con.prepareStatement(board_list_sql1); pstmt.setString(1, aa); pstmt.setInt(2, startrow); pstmt.setInt(3, endrow); System.out.println("sql�씠�뿉�삤"+board_list_sql1); rs=pstmt.executeQuery(); while(rs.next()) { SBBforList b=new SBBforList(); b.setSch_bo_no(rs.getInt("sch_bo_no")); b.setSch_bo_title(rs.getString("sch_bo_title")); b.setSch_bo_content(rs.getString("sch_bo_content")); b.setSch_bo_date(rs.getDate("sch_bo_date")); b.setUser_id(rs.getString("user_id")); b.setUser_type(rs.getInt("user_type")); b.setListcount(count); b.setSch_no(rs.getInt("sch_no")); list.add(b); } return list; }catch(Exception e) { System.out.println("searchgetboardlist()�뿉�윭 �엯�땲�떎."+e); e.printStackTrace(); }finally { if(rs!=null) try {rs.close();}catch(SQLException ex) { ex.printStackTrace();} if(pstmt!=null) try {pstmt.close();}catch(SQLException ex) { ex.printStackTrace();} if(con!=null) try {con.close();}catch(SQLException ex) { ex.printStackTrace();} } return null; } public List<SBBforList> getBoardList(String searchindex, String searchcontent, String types[],int page, int limit) { // TODO Auto-generated method stub String board_list_sql1="select * from "+ "(select rownum rnum, sch_bo_no, sch_bo_title, sch_bo_content, sch_no, sch_bo_date, " + " user_no, user_id, user_type from " + " (select * from sch_board natural join client where user_type=? "; String countlistsql="select count(sch_bo_no) from (select sch_bo_no, sch_bo_title, sch_bo_content, user_id from" + " (select * from sch_board natural join client where user_type=? "; String aa="%"+searchcontent+"%"; switch(searchindex){ case "title": searchindex="sch_bo_title"; break; case "user": searchindex="user_id"; break; case "content": searchindex="sch_bo_content"; break; } for(int i=1; i<types.length;i++) { board_list_sql1+=" or user_type=? "; countlistsql+=" or user_type=? "; } board_list_sql1+=" order by sch_bo_date desc) "; board_list_sql1 +=" where "+searchindex+" like ?"; board_list_sql1 +=" )where rnum>=? and rnum<= ?"; countlistsql +=" )) where "+searchindex+" like ?"; List<SBBforList> list= new ArrayList<SBBforList>(); //�븳�럹�씠吏��떦 10媛쒖뵫 紐⑸줉 1page 2 3 4 int startrow=(page-1)* limit +1; //�떆�옉踰덊샇 1 11 21 31 int endrow=startrow + limit -1; //留덉�留됰쾲�샇 10 20 30 40 try { int listcount=0; con=ds.getConnection(); pstmt=con.prepareStatement(countlistsql); for(int i=1; i<=types.length; i++) { pstmt.setInt(i, Integer.parseInt(types[i-1])); } pstmt.setString(types.length+1, aa); rs=pstmt.executeQuery(); rs.next(); listcount=rs.getInt(1); pstmt.close(); if(listcount<=10) { startrow=1; endrow=10; } System.out.println("++listcount�븷�삤 " + listcount); pstmt=con.prepareStatement(countlistsql); pstmt=con.prepareStatement(board_list_sql1); for(int i=1; i<=types.length; i++) { pstmt.setInt(i, Integer.parseInt(types[i-1])); } pstmt.setString(types.length+1, aa); pstmt.setInt(types.length+2, startrow); pstmt.setInt(types.length+3, endrow); System.out.println("++sql�씠�뿉�삤 "+board_list_sql1 ); rs=pstmt.executeQuery(); while(rs.next()) { SBBforList b=new SBBforList(); b.setSch_bo_no(rs.getInt("sch_bo_no")); b.setSch_bo_title(rs.getString("sch_bo_title")); b.setSch_bo_content(rs.getString("sch_bo_content")); b.setSch_bo_date(rs.getDate("sch_bo_date")); b.setUser_id(rs.getString("user_id")); b.setUser_type(rs.getInt("user_type")); b.setListcount(listcount); b.setSch_no(rs.getInt("sch_no")); list.add(b); } return list; }catch(Exception e) { System.out.println("getboardlist()�뿉�윭 �엯�땲�떎."+e); e.printStackTrace(); }finally { if(rs!=null) try {rs.close();}catch(SQLException ex) { ex.printStackTrace();} if(pstmt!=null) try {pstmt.close();}catch(SQLException ex) { ex.printStackTrace();} if(con!=null) try {con.close();}catch(SQLException ex) { ex.printStackTrace();} } return null; } /*public boolean boardModify(SchBoardBean boarddata) { // TODO Auto-generated method stub String sql="update sch_board set sch_bo_title=? , sch_bo_content=? , sch_no=?, where sch_bo_no=?"; try { con=ds.getConnection(); pstmt=con.prepareStatement(sql); pstmt.setString(1, boarddata.getSch_bo_title()); pstmt.setString(2, boarddata.getSch_bo_content()); pstmt.setInt(3, boarddata.getSch_no()); pstmt.setInt(4, boarddata.getSch_bo_no()); pstmt.executeUpdate(); return true; }catch(Exception e) { e.printStackTrace(); }finally { if(rs!=null) try {rs.close();}catch(SQLException ex) { ex.printStackTrace();} if(pstmt!=null) try {pstmt.close();}catch(SQLException ex) { ex.printStackTrace();} if(con!=null) try {con.close();}catch(SQLException ex) { ex.printStackTrace();} } return false; } */ public int isBoardWriter(int sch_bo_no) { // TODO Auto-generated method stub String sql="select user_no from sch_board where sch_bo_no=?"; int userno=0; try { con=ds.getConnection(); pstmt=con.prepareStatement(sql); pstmt.setInt(1, sch_bo_no); rs=pstmt.executeQuery(); if(rs.next()) userno=rs.getInt(1); return userno; }catch(Exception e) { e.printStackTrace(); }finally { if(rs!=null) try {rs.close();}catch(SQLException ex) { ex.printStackTrace();} if(pstmt!=null) try {pstmt.close();}catch(SQLException ex) { ex.printStackTrace();} if(con!=null) try {con.close();}catch(SQLException ex) { ex.printStackTrace();} } System.out.println("isboardwriter�삤瑜�"); return userno; } public boolean boardDelete(int sch_bo_no) { // TODO Auto-generated method stub String sql="delete from sch_board where sch_bo_no=? "; String sql1="delete from sch_coment where sch_bo_no=? "; //�뙎湲��궘�젣 String sql2="delete from up where sch_bo_no=? "; //�뾽�궘�젣 String sql3="delete from down where sch_bo_no=? "; //�떎�슫�궘�젣 try { con=ds.getConnection(); pstmt=con.prepareStatement(sql1); pstmt.setInt(1, sch_bo_no); pstmt.executeUpdate(); pstmt=con.prepareStatement(sql2); pstmt.setInt(1, sch_bo_no); pstmt.executeUpdate(); pstmt=con.prepareStatement(sql3); pstmt.setInt(1, sch_bo_no); pstmt.executeUpdate(); pstmt=con.prepareStatement(sql); pstmt.setInt(1, sch_bo_no); pstmt.executeUpdate(); return true; }catch(Exception e) { e.printStackTrace(); }finally { if(pstmt!=null) try {pstmt.close();}catch(SQLException ex) { ex.printStackTrace();} if(con!=null) try {con.close();}catch(SQLException ex) { ex.printStackTrace();} } return false; } }
true
ec94368241b72ed9b41cebacbb6688b6c52d44f0
Java
Projecto2/PFII
/SIG_HDP_Master/SIG_HDP_Master-ejb/src/java/entidade/AdmsEstadoAgendamento.java
UTF-8
4,082
1.9375
2
[]
no_license
/* * 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 entidade; import java.io.Serializable; import java.util.List; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; /** * * @author amed */ @Entity @Table(name = "adms_estado_agendamento", catalog = "sigh_db", schema = "public") @XmlRootElement @NamedQueries({ @NamedQuery(name = "AdmsEstadoAgendamento.findAll", query = "SELECT a FROM AdmsEstadoAgendamento a"), @NamedQuery(name = "AdmsEstadoAgendamento.findByPkIdEstadoAgendamento", query = "SELECT a FROM AdmsEstadoAgendamento a WHERE a.pkIdEstadoAgendamento = :pkIdEstadoAgendamento"), @NamedQuery(name = "AdmsEstadoAgendamento.findByDescricaoEstadoAgendamento", query = "SELECT a FROM AdmsEstadoAgendamento a WHERE a.descricaoEstadoAgendamento = :descricaoEstadoAgendamento")}) public class AdmsEstadoAgendamento implements Serializable { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @NotNull @Column(name = "pk_id_estado_agendamento", nullable = false) private Integer pkIdEstadoAgendamento; @Basic(optional = false) @NotNull @Size(min = 1, max = 100) @Column(name = "descricao_estado_agendamento", nullable = false, length = 100) private String descricaoEstadoAgendamento; @OneToMany(cascade = CascadeType.ALL, mappedBy = "fkIdEstadoAgendamento") private List<AdmsAgendamento> admsAgendamentoList; public AdmsEstadoAgendamento() { } public AdmsEstadoAgendamento(Integer pkIdEstadoAgendamento) { this.pkIdEstadoAgendamento = pkIdEstadoAgendamento; } public AdmsEstadoAgendamento(Integer pkIdEstadoAgendamento, String descricaoEstadoAgendamento) { this.pkIdEstadoAgendamento = pkIdEstadoAgendamento; this.descricaoEstadoAgendamento = descricaoEstadoAgendamento; } public Integer getPkIdEstadoAgendamento() { return pkIdEstadoAgendamento; } public void setPkIdEstadoAgendamento(Integer pkIdEstadoAgendamento) { this.pkIdEstadoAgendamento = pkIdEstadoAgendamento; } public String getDescricaoEstadoAgendamento() { return descricaoEstadoAgendamento; } public void setDescricaoEstadoAgendamento(String descricaoEstadoAgendamento) { this.descricaoEstadoAgendamento = descricaoEstadoAgendamento; } @XmlTransient public List<AdmsAgendamento> getAdmsAgendamentoList() { return admsAgendamentoList; } public void setAdmsAgendamentoList(List<AdmsAgendamento> admsAgendamentoList) { this.admsAgendamentoList = admsAgendamentoList; } @Override public int hashCode() { int hash = 0; hash += (pkIdEstadoAgendamento != null ? pkIdEstadoAgendamento.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof AdmsEstadoAgendamento)) { return false; } AdmsEstadoAgendamento other = (AdmsEstadoAgendamento) object; if ((this.pkIdEstadoAgendamento == null && other.pkIdEstadoAgendamento != null) || (this.pkIdEstadoAgendamento != null && !this.pkIdEstadoAgendamento.equals(other.pkIdEstadoAgendamento))) { return false; } return true; } @Override public String toString() { return "entidade.AdmsEstadoAgendamento[ pkIdEstadoAgendamento=" + pkIdEstadoAgendamento + " ]"; } }
true
6d9ae206c8c53264ea8f1b1e50e44ee6a43699ea
Java
franciscocpg/spring-vaadin-jpa-example
/svexample-web/src/main/java/pl/pawelb/svexample/dao/TaskRepository.java
UTF-8
836
2.1875
2
[]
no_license
package pl.pawelb.svexample.dao; import java.util.List; import org.joda.time.LocalDate; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import pl.pawelb.svexample.ds.Task; /** * Spring data repository * * @author pawelb * */ public interface TaskRepository extends CrudRepository<Task, Long> { /** * Example method * * @param estimatedEndDate * @return */ @Query("select t from Task t where t.actualEndDate is null and t.estimatedEndDate = ?1") List<Task> findTasksToWarnAboutEstimatedEndDate(LocalDate estimatedEndDate); /** * Example method * * @param author * @param start * @param end * @return */ List<Task> findTasksByAuthorAndActualEndDateBetweenOrderByActualEndDateAsc(String author, LocalDate start, LocalDate end); }
true
ed3e5c440d1e399e026301cd2c2b5d8ae3236bc7
Java
cyl1187577565/cyl_demo
/src/main/java/leetCode/L0021_merge_2_sorted_list.java
UTF-8
885
3.203125
3
[]
no_license
package leetCode; /** * 21. 合并两个有序链表 */ public class L0021_merge_2_sorted_list { public ListNode mergeTwoLists(ListNode l1, ListNode l2) { ListNode cur1 = l1; ListNode cur2 = l2; ListNode head = new ListNode(-1); ListNode cur = head; while (cur2 !=null && cur1 !=null){ if(cur1.val < cur2.val){ cur.next = cur1; cur1 = cur1.next; }else{ cur.next = cur2; cur2 = cur2.next; } cur = cur.next; } if(cur1 != null){ cur.next = cur1; } if(cur2 != null){ cur.next = cur2; } return head.next; } class ListNode{ int val; ListNode next; public ListNode(int val) { this.val = val; } } }
true
522d00d1c4edb5582a20fa72c31899c2a6f5867a
Java
yexuejc/utils
/util-base/src/main/java/com/yexuejc/util/base/pojo/PagerVO.java
UTF-8
908
2.28125
2
[]
no_license
package com.yexuejc.util.base.pojo; import com.yexuejc.util.base.util.JsonUtil; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; public class PagerVO extends BaseVO { private static final long serialVersionUID = -7679296673189336136L; /** * 页码 */ @NotNull @Min(value = 1) private Integer page = 1; /** * 每页显示条数 */ @NotNull @Min(value = 1) private Integer size = 20; public int getOffset() { return (page - 1) * size; } public Integer getPage() { return page; } public void setPage(Integer page) { this.page = page; } public Integer getSize() { return size; } public void setSize(Integer size) { this.size = size; } @Override public String toString() { return JsonUtil.obj2Json(this); } }
true
114a15f99e0002b2342ab3db71bd4627be91a33b
Java
TakacNandor/MineSweeper
/src/Mines/Clue.java
UTF-8
286
2.609375
3
[]
no_license
package Mines; public class Clue extends Tile { private final int minesAround; public Clue(int minesAround) { this.minesAround = minesAround; } public int getMinesAround() { return minesAround; } @Override public String toString() { return "" + getMinesAround(); } }
true