blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
list
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
gha_stargazers_count
int32
0
112k
gha_forks_count
int32
0
39.4k
gha_open_issues_count
int32
0
11k
gha_language
stringlengths
1
21
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
list
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
eaf59a2f3911ea9d0b81909a36de7b6a5ba95163
26,396,869,005,689
9d8d3c438427fc6d750a4304c196708d677536f1
/PBC_DSnAlgo/IP/String/rearrengeAllChardistanceAway.java
7be32e0017f7e1a7ec2ca55879ebe14633431f1a
[]
no_license
Raarav/pepcodingDS
https://github.com/Raarav/pepcodingDS
23a0513677fdeae0881994edf9046f354ee58a22
311f1c38fd12b20add7440c29e74a294c4c1fa8b
refs/heads/master
2022-12-29T17:53:21.273000
2020-10-17T21:15:13
2020-10-17T21:15:13
234,934,190
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/*package whatever //do not write package name here */ import java.util.*; import java.lang.*; import java.io.*; class GFG { public static String racda(String str){ HashMap<Character, Integer> hm = new HashMap<>(); for(int i=0;i<str.length();i++){ char ch = str.charAt(i); if(hm.containskey(ch)){ int ans = hm.get(ch); hm.put(ch,ans+1); }else{ hm.put(ch,1); } } } public static void main (String[] args) { //code Scanner scn = new Scanner(System.in); String t = scn.nextLine(); System.out.println(racda(t)); } }
UTF-8
Java
688
java
rearrengeAllChardistanceAway.java
Java
[]
null
[]
/*package whatever //do not write package name here */ import java.util.*; import java.lang.*; import java.io.*; class GFG { public static String racda(String str){ HashMap<Character, Integer> hm = new HashMap<>(); for(int i=0;i<str.length();i++){ char ch = str.charAt(i); if(hm.containskey(ch)){ int ans = hm.get(ch); hm.put(ch,ans+1); }else{ hm.put(ch,1); } } } public static void main (String[] args) { //code Scanner scn = new Scanner(System.in); String t = scn.nextLine(); System.out.println(racda(t)); } }
688
0.501453
0.497093
29
22.758621
16.537638
57
false
false
0
0
0
0
0
0
0.827586
false
false
13
8a5b9877d1f0987ce35d64139c42567d8a114970
17,789,754,542,139
c1f3da1c585bb6228aae5328a9c66259b17ae9c4
/Group 4/android/support/v4/g/i.java
d79a81cb7636dbf40f6605b453c6b3365e2b0cb7
[]
no_license
cchr158/cchr158First
https://github.com/cchr158/cchr158First
75132da480cd62a10003a2d0bef6a87ced929cb1
65397ff205bfbc49980908b501d162dfb20f921f
refs/heads/master
2016-12-13T19:02:31.971000
2016-05-12T10:19:41
2016-05-12T10:19:41
35,201,460
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Decompiled with CFR 0_115. */ package android.support.v4.g; import android.support.v4.g.h; import java.util.Iterator; final class i implements Iterator { final int a; int b; int c; boolean d; final /* synthetic */ h e; i(h h2, int n2) { this.e = h2; this.d = false; this.a = n2; this.b = h2.a(); } @Override public boolean hasNext() { if (this.c >= this.b) return false; return true; } public Object next() { Object object = this.e.a(this.c, this.a); this.c = 1 + this.c; this.d = true; return object; } @Override public void remove() { if (!this.d) { throw new IllegalStateException(); } this.c = -1 + this.c; this.b = -1 + this.b; this.d = false; this.e.a(this.c); } }
UTF-8
Java
885
java
i.java
Java
[]
null
[]
/* * Decompiled with CFR 0_115. */ package android.support.v4.g; import android.support.v4.g.h; import java.util.Iterator; final class i implements Iterator { final int a; int b; int c; boolean d; final /* synthetic */ h e; i(h h2, int n2) { this.e = h2; this.d = false; this.a = n2; this.b = h2.a(); } @Override public boolean hasNext() { if (this.c >= this.b) return false; return true; } public Object next() { Object object = this.e.a(this.c, this.a); this.c = 1 + this.c; this.d = true; return object; } @Override public void remove() { if (!this.d) { throw new IllegalStateException(); } this.c = -1 + this.c; this.b = -1 + this.b; this.d = false; this.e.a(this.c); } }
885
0.499435
0.483616
47
17.80851
12.618187
49
false
false
0
0
0
0
0
0
0.531915
false
false
13
d02de68fe918b91f1dae6d586b6b7f99383b8416
2,911,987,873,673
ca0680b0a6fd786e2c9434fa7b223b0136f3376d
/src/org/happyzombie/WarpMain.java
36bd8952142317d4d603b7f9672c8228a1c8a27b
[]
no_license
leaker28/SimpleWarp
https://github.com/leaker28/SimpleWarp
e206aae601b539d78fab15c5fe66974dfb91d7c1
903ae8bd9dc743bf2a8adf3245b81a10d3e9607f
refs/heads/master
2022-10-17T19:09:18.867000
2016-05-21T20:48:12
2016-05-21T20:48:12
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * TODO * change warp world property from name to UUID * add worldname method to find a worlds name from the UUID */ package org.happyzombie; import java.io.File; import java.util.Map; import org.bukkit.permissions.Permission; import org.bukkit.plugin.java.JavaPlugin; import org.happyzombie.Objects.Warp; import org.happyzombie.WarpFunctions.LoadWarps; public class WarpMain extends JavaPlugin { public Permission warpSet = new Permission("simpleWarp.set"); public Permission warpDelete = new Permission("simpleWarp.delete"); public Permission warpGoto = new Permission("simpleWarp.goto"); public Permission warpGotoOther = new Permission("simpleWarp.goto.other"); public Permission warpCompass = new Permission("simpleWarp.compass"); public Permission warpBeacon = new Permission("simpleWarp.beacon"); public Permission warpList = new Permission("simpleWarp.list"); public Permission warpManual = new Permission("simpleWarp.manual"); public Permission warpRandom = new Permission("simpleWarp.random"); //create public list of warps public Map<String, Warp> warps = LoadWarps.loadAllWarps(this); @Override public void onEnable() { getLogger().info("WarpMain 1.0 enabled!"); warps = LoadWarps.loadAllWarps(this);//populate warp list this.getCommand("warp").setExecutor(new CommandHandler(this)); File WarpDir = new File ("plugins"+File.separator+"SimpleWarp"+File.separator+"Warps"+File.separator+getServer().getWorlds().get(0).getName()+File.separator); if(!WarpDir.exists()){ WarpDir.mkdirs(); getLogger().info("Warp folder for "+ getServer().getWorlds().get(0).getName() +" created!"); } } @Override public void onDisable() { getLogger().info("Shutting down warps"); } }
UTF-8
Java
1,732
java
WarpMain.java
Java
[]
null
[]
/* * TODO * change warp world property from name to UUID * add worldname method to find a worlds name from the UUID */ package org.happyzombie; import java.io.File; import java.util.Map; import org.bukkit.permissions.Permission; import org.bukkit.plugin.java.JavaPlugin; import org.happyzombie.Objects.Warp; import org.happyzombie.WarpFunctions.LoadWarps; public class WarpMain extends JavaPlugin { public Permission warpSet = new Permission("simpleWarp.set"); public Permission warpDelete = new Permission("simpleWarp.delete"); public Permission warpGoto = new Permission("simpleWarp.goto"); public Permission warpGotoOther = new Permission("simpleWarp.goto.other"); public Permission warpCompass = new Permission("simpleWarp.compass"); public Permission warpBeacon = new Permission("simpleWarp.beacon"); public Permission warpList = new Permission("simpleWarp.list"); public Permission warpManual = new Permission("simpleWarp.manual"); public Permission warpRandom = new Permission("simpleWarp.random"); //create public list of warps public Map<String, Warp> warps = LoadWarps.loadAllWarps(this); @Override public void onEnable() { getLogger().info("WarpMain 1.0 enabled!"); warps = LoadWarps.loadAllWarps(this);//populate warp list this.getCommand("warp").setExecutor(new CommandHandler(this)); File WarpDir = new File ("plugins"+File.separator+"SimpleWarp"+File.separator+"Warps"+File.separator+getServer().getWorlds().get(0).getName()+File.separator); if(!WarpDir.exists()){ WarpDir.mkdirs(); getLogger().info("Warp folder for "+ getServer().getWorlds().get(0).getName() +" created!"); } } @Override public void onDisable() { getLogger().info("Shutting down warps"); } }
1,732
0.751732
0.749423
51
32.980392
32.736313
160
false
false
0
0
0
0
0
0
1.313725
false
false
13
d43c7bf63852a602d0f33857390dcd257ffd29c0
28,570,122,469,696
f6899a2cf1c10a724632bbb2ccffb7283c77a5ff
/glassfish-3.0/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/RemoteSerialContextProviderImpl.java
5f9f56eadea400aebc7cbf24ff33f5486b121545
[]
no_license
Appdynamics/OSS
https://github.com/Appdynamics/OSS
a8903058e29f4783e34119a4d87639f508a63692
1e112f8854a25b3ecf337cad6eccf7c85e732525
refs/heads/master
2023-07-22T03:34:54.770000
2021-10-28T07:01:57
2021-10-28T07:01:57
19,390,624
2
13
null
false
2023-07-08T02:26:33
2014-05-02T22:42:20
2021-10-28T07:02:10
2023-07-08T02:26:26
629,110
1
4
222
null
false
false
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development * and Distribution License("CDDL") (collectively, the "License"). You * may not use this file except in compliance with the License. You can obtain * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific * language governing permissions and limitations under the License. * * When distributing the software, include this License Header Notice in each * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt. * Sun designates this particular file as subject to the "Classpath" exception * as provided by Sun in the GPL Version 2 section of the License file that * accompanied this code. If applicable, add the following below the License * Header, with the fields enclosed by brackets [] replaced by your own * identifying information: "Portions Copyrighted [year] * [name of copyright owner]" * * Contributor(s): * * If you wish your version of this file to be governed by only the CDDL or * only the GPL Version 2, indicate your decision by adding "[Contributor] * elects to include this software in this distribution under the [CDDL or GPL * Version 2] license." If you don't indicate a single choice of license, a * recipient has the option to distribute your version of this file under * either the CDDL, the GPL Version 2 or to extend the choice of license to * its licensees as provided above. However, if you add GPL Version 2 code * and therefore, elected the GPL Version 2 license, then the option applies * only if the new code is made subject to such option by the copyright * holder. */ package com.sun.enterprise.naming.impl; import java.rmi.*; import javax.naming.*; import org.omg.CORBA.ORB; import org.glassfish.api.naming.NamingObjectProxy; import java.util.logging.*; import java.util.Hashtable; import com.sun.enterprise.util.Utility; /** * This class is the implementation of the Remote SerialContextProvider * * @author Sheetal Vartak */ public class RemoteSerialContextProviderImpl extends SerialContextProviderImpl { static public final String SERIAL_CONTEXT_PROVIDER_NAME = "SerialContextProvider"; private ORB orb; private RemoteSerialContextProviderImpl(ORB orb, TransientContext rootContext) throws RemoteException { super(rootContext); this.orb = orb; } /** * Create the remote object and publish it in the CosNaming name service. */ static public Remote initSerialContextProvider(ORB orb, TransientContext rootContext) throws RemoteException { return new RemoteSerialContextProviderImpl(orb, rootContext); } public Object lookup(String name) throws NamingException, RemoteException { Object obj = super.lookup(name); // If CORBA object, resolve here in server to prevent a // another round-trip to CosNaming. ClassLoader originalClassLoader = null; try { if( obj instanceof Reference ) { Reference ref = (Reference) obj; if( ref.getFactoryClassName().equals(GlassfishNamingManagerImpl.IIOPOBJECT_FACTORY) ) { // Set CCL to this CL so it's guaranteed to be able to find IIOPObjectFactory originalClassLoader = Utility.setContextClassLoader(getClass().getClassLoader()); Hashtable env = new Hashtable(); env.put("java.naming.corba.orb", orb); obj = javax.naming.spi.NamingManager.getObjectInstance (obj, new CompositeName(name), null, env); } } else if (obj instanceof NamingObjectProxy) { NamingObjectProxy namingProxy = (NamingObjectProxy) obj; //this call will make sure that the actual object is initialized obj = ((NamingObjectProxy) obj).create(new InitialContext()); // If it's an InitialNamingProxy, ignore the result of the // create() call and re-lookup the name. if( namingProxy instanceof NamingObjectProxy.InitializationNamingObjectProxy ) { return super.lookup(name); } } } catch(Exception e) { RemoteException re = new RemoteException("", e); throw re; } finally { if( originalClassLoader != null ) { Utility.setContextClassLoader(originalClassLoader); } } return obj; } }
UTF-8
Java
4,843
java
RemoteSerialContextProviderImpl.java
Java
[ { "context": " of the Remote SerialContextProvider\n *\n * @author Sheetal Vartak\n */\n\npublic class RemoteSerialContextProviderImpl", "end": 2308, "score": 0.9996944665908813, "start": 2294, "tag": "NAME", "value": "Sheetal Vartak" } ]
null
[]
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development * and Distribution License("CDDL") (collectively, the "License"). You * may not use this file except in compliance with the License. You can obtain * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific * language governing permissions and limitations under the License. * * When distributing the software, include this License Header Notice in each * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt. * Sun designates this particular file as subject to the "Classpath" exception * as provided by Sun in the GPL Version 2 section of the License file that * accompanied this code. If applicable, add the following below the License * Header, with the fields enclosed by brackets [] replaced by your own * identifying information: "Portions Copyrighted [year] * [name of copyright owner]" * * Contributor(s): * * If you wish your version of this file to be governed by only the CDDL or * only the GPL Version 2, indicate your decision by adding "[Contributor] * elects to include this software in this distribution under the [CDDL or GPL * Version 2] license." If you don't indicate a single choice of license, a * recipient has the option to distribute your version of this file under * either the CDDL, the GPL Version 2 or to extend the choice of license to * its licensees as provided above. However, if you add GPL Version 2 code * and therefore, elected the GPL Version 2 license, then the option applies * only if the new code is made subject to such option by the copyright * holder. */ package com.sun.enterprise.naming.impl; import java.rmi.*; import javax.naming.*; import org.omg.CORBA.ORB; import org.glassfish.api.naming.NamingObjectProxy; import java.util.logging.*; import java.util.Hashtable; import com.sun.enterprise.util.Utility; /** * This class is the implementation of the Remote SerialContextProvider * * @author <NAME> */ public class RemoteSerialContextProviderImpl extends SerialContextProviderImpl { static public final String SERIAL_CONTEXT_PROVIDER_NAME = "SerialContextProvider"; private ORB orb; private RemoteSerialContextProviderImpl(ORB orb, TransientContext rootContext) throws RemoteException { super(rootContext); this.orb = orb; } /** * Create the remote object and publish it in the CosNaming name service. */ static public Remote initSerialContextProvider(ORB orb, TransientContext rootContext) throws RemoteException { return new RemoteSerialContextProviderImpl(orb, rootContext); } public Object lookup(String name) throws NamingException, RemoteException { Object obj = super.lookup(name); // If CORBA object, resolve here in server to prevent a // another round-trip to CosNaming. ClassLoader originalClassLoader = null; try { if( obj instanceof Reference ) { Reference ref = (Reference) obj; if( ref.getFactoryClassName().equals(GlassfishNamingManagerImpl.IIOPOBJECT_FACTORY) ) { // Set CCL to this CL so it's guaranteed to be able to find IIOPObjectFactory originalClassLoader = Utility.setContextClassLoader(getClass().getClassLoader()); Hashtable env = new Hashtable(); env.put("java.naming.corba.orb", orb); obj = javax.naming.spi.NamingManager.getObjectInstance (obj, new CompositeName(name), null, env); } } else if (obj instanceof NamingObjectProxy) { NamingObjectProxy namingProxy = (NamingObjectProxy) obj; //this call will make sure that the actual object is initialized obj = ((NamingObjectProxy) obj).create(new InitialContext()); // If it's an InitialNamingProxy, ignore the result of the // create() call and re-lookup the name. if( namingProxy instanceof NamingObjectProxy.InitializationNamingObjectProxy ) { return super.lookup(name); } } } catch(Exception e) { RemoteException re = new RemoteException("", e); throw re; } finally { if( originalClassLoader != null ) { Utility.setContextClassLoader(originalClassLoader); } } return obj; } }
4,835
0.68057
0.677473
136
34.610294
32.00211
101
false
false
0
0
0
0
0
0
0.492647
false
false
13
b5795c0d8ddcf865a3e828a798ab5e1732cdb6cb
8,014,409,043,791
a7cc1c2bb977fb99036dec126675a993b0c3f892
/src/com/game/rpg/Monster.java
86785f27449222334a3385417e3781e0cd51ff39
[]
no_license
wangzhaoming/RPG
https://github.com/wangzhaoming/RPG
d719a63a683acd9bc2760046bd36cd021f6e839e
2a7add069e82066fc5568a69f2e686927c3f4ed5
refs/heads/master
2021-01-19T07:02:05.907000
2015-07-17T11:57:22
2015-07-17T11:57:22
62,717,351
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.game.rpg; import java.awt.Graphics; import java.awt.Image; import java.io.IOException; import java.util.ArrayList; /** * 绘制怪物的类 * * @author Administrator * */ public class Monster implements Runnable { private Image img;// 素材 private ResourseReader reader; private Map map;// 用于调用map的方法 private int[][][] mapArray;// 地图数组 private java.util.List<Integer[]> monsterList;// 存放产生出来的怪 private final int SIZE = 32;// 常量,地图每一格长宽为32px public Monster(Map map) throws IOException { this.map = map;// 传入map reader = new ResourseReader(); img = reader.getImage("res/monster.png");// 载入素材 monsterList = new ArrayList<Integer[]>(); } /** * 每次调用产生一个怪物 * * @throws IOException */ public void create() throws IOException { int y = map.getMapWidth();// 地图列数 int x = map.getMapHeight();// 行数 if (map.getCreateMonster() && monsterList.size() < x * y / 50) {// 该地图允许刷怪且数量未到达上限时才产生怪,怪的密度为1/50 mapArray = map.getMapArray();// 获取地图数组 int monsterX;// 即将刷怪的坐标 int monsterY; int monsterDir;// 刷怪的方向 0下1左2右3上 do { monsterX = (int) (Math.random() * x);// 随机产生刷怪的坐标 monsterY = (int) (Math.random() * y); monsterDir = (int) (Math.random() * 4);// 随机产生刷怪的方向 } while (!isValidPlace(monsterX, monsterY));// 坐标不合法就重新产生坐标 monsterList.add(new Integer[] { monsterX, monsterY, monsterDir });// 将产生的怪的坐标存入list } } /** * 判断(x,y)处是否是有效的刷怪点 * * @param x * @param y * @return 能产生返回true */ public boolean isValidPlace(int x, int y) { for (Integer[] obj : monsterList) {// 检查该点是否有怪 if (obj[0] == x && obj[1] == y) return false; } if ((mapArray[x][y][2] & 0x80) == 0)// 检查该点是否可以通行 return false; return true; } /** * 开始绘制怪物,绘制在map(extends JPanel)上 * * @param g */ public void drawMonster(Graphics g) { int offx = map.getOffsetX();// 获取绘制的偏移 int offy = map.getOffsetY(); int x, y;// 存放怪物的坐标 int dir;// 怪的方向 for (Integer[] obj : monsterList) {// 遍历所有已产生的怪 x = obj[0];// 取出坐标 y = obj[1]; dir = obj[2];// 取出方向 g.drawImage(img, offx + y * SIZE, offy + x * SIZE, offx + y * SIZE + SIZE, offy + x * SIZE + SIZE, 0 * SIZE, dir * SIZE, 0 * SIZE + SIZE, dir * SIZE + SIZE, null); } } /** * 移动怪物 * * @param obj */ public void moveMonsters() { for (Integer[] obj : monsterList) {// 遍历所有已产生的怪 if (Math.random() < 0.5) {// 怪物有0.5的概率会移动 int dir = (int) (Math.random() * 4);// 产生一个新的移动方向 if (obj[2] == dir) {// 如果移动方向与原方向相等 switch (dir) {// 根据方向调整怪物的坐标 case 0: if (isValidPlace(obj[0] + 1, obj[1])) { obj[0] += 1; } break; case 1: if (isValidPlace(obj[0], obj[1] - 1)) { obj[1] -= 1; } break; case 2: if (isValidPlace(obj[0], obj[1] + 1)) { obj[1] += 1; } break; case 3: if (isValidPlace(obj[0] - 1, obj[1])) { obj[0] -= 1; } break; default: break; } } else {// 与原方向不等的话,只改变方向 obj[2] = dir; } } } } /** * 清空存放怪物的list * * 切换地图时由map调用 */ public void removeAllMonsters() { monsterList.clear(); } /** * 刷怪线程的实现 */ @Override public void run() { while (true) { try { create();// 产生怪 } catch (IOException e1) { e1.printStackTrace(); } for (int i = 0; i < 5; i++) { map.repaint();// 绘制地图,包括怪物 moveMonsters();// 绘制后让所有怪移动一次 try { Thread.sleep(500);// 绘制间隔 } catch (InterruptedException e) { e.printStackTrace(); } } } } }
GB18030
Java
4,190
java
Monster.java
Java
[ { "context": "java.util.ArrayList;\n\n/**\n * 绘制怪物的类\n * \n * @author Administrator\n * \n */\npublic class Monster implements Runnable ", "end": 171, "score": 0.5602639317512512, "start": 158, "tag": "USERNAME", "value": "Administrator" } ]
null
[]
package com.game.rpg; import java.awt.Graphics; import java.awt.Image; import java.io.IOException; import java.util.ArrayList; /** * 绘制怪物的类 * * @author Administrator * */ public class Monster implements Runnable { private Image img;// 素材 private ResourseReader reader; private Map map;// 用于调用map的方法 private int[][][] mapArray;// 地图数组 private java.util.List<Integer[]> monsterList;// 存放产生出来的怪 private final int SIZE = 32;// 常量,地图每一格长宽为32px public Monster(Map map) throws IOException { this.map = map;// 传入map reader = new ResourseReader(); img = reader.getImage("res/monster.png");// 载入素材 monsterList = new ArrayList<Integer[]>(); } /** * 每次调用产生一个怪物 * * @throws IOException */ public void create() throws IOException { int y = map.getMapWidth();// 地图列数 int x = map.getMapHeight();// 行数 if (map.getCreateMonster() && monsterList.size() < x * y / 50) {// 该地图允许刷怪且数量未到达上限时才产生怪,怪的密度为1/50 mapArray = map.getMapArray();// 获取地图数组 int monsterX;// 即将刷怪的坐标 int monsterY; int monsterDir;// 刷怪的方向 0下1左2右3上 do { monsterX = (int) (Math.random() * x);// 随机产生刷怪的坐标 monsterY = (int) (Math.random() * y); monsterDir = (int) (Math.random() * 4);// 随机产生刷怪的方向 } while (!isValidPlace(monsterX, monsterY));// 坐标不合法就重新产生坐标 monsterList.add(new Integer[] { monsterX, monsterY, monsterDir });// 将产生的怪的坐标存入list } } /** * 判断(x,y)处是否是有效的刷怪点 * * @param x * @param y * @return 能产生返回true */ public boolean isValidPlace(int x, int y) { for (Integer[] obj : monsterList) {// 检查该点是否有怪 if (obj[0] == x && obj[1] == y) return false; } if ((mapArray[x][y][2] & 0x80) == 0)// 检查该点是否可以通行 return false; return true; } /** * 开始绘制怪物,绘制在map(extends JPanel)上 * * @param g */ public void drawMonster(Graphics g) { int offx = map.getOffsetX();// 获取绘制的偏移 int offy = map.getOffsetY(); int x, y;// 存放怪物的坐标 int dir;// 怪的方向 for (Integer[] obj : monsterList) {// 遍历所有已产生的怪 x = obj[0];// 取出坐标 y = obj[1]; dir = obj[2];// 取出方向 g.drawImage(img, offx + y * SIZE, offy + x * SIZE, offx + y * SIZE + SIZE, offy + x * SIZE + SIZE, 0 * SIZE, dir * SIZE, 0 * SIZE + SIZE, dir * SIZE + SIZE, null); } } /** * 移动怪物 * * @param obj */ public void moveMonsters() { for (Integer[] obj : monsterList) {// 遍历所有已产生的怪 if (Math.random() < 0.5) {// 怪物有0.5的概率会移动 int dir = (int) (Math.random() * 4);// 产生一个新的移动方向 if (obj[2] == dir) {// 如果移动方向与原方向相等 switch (dir) {// 根据方向调整怪物的坐标 case 0: if (isValidPlace(obj[0] + 1, obj[1])) { obj[0] += 1; } break; case 1: if (isValidPlace(obj[0], obj[1] - 1)) { obj[1] -= 1; } break; case 2: if (isValidPlace(obj[0], obj[1] + 1)) { obj[1] += 1; } break; case 3: if (isValidPlace(obj[0] - 1, obj[1])) { obj[0] -= 1; } break; default: break; } } else {// 与原方向不等的话,只改变方向 obj[2] = dir; } } } } /** * 清空存放怪物的list * * 切换地图时由map调用 */ public void removeAllMonsters() { monsterList.clear(); } /** * 刷怪线程的实现 */ @Override public void run() { while (true) { try { create();// 产生怪 } catch (IOException e1) { e1.printStackTrace(); } for (int i = 0; i < 5; i++) { map.repaint();// 绘制地图,包括怪物 moveMonsters();// 绘制后让所有怪移动一次 try { Thread.sleep(500);// 绘制间隔 } catch (InterruptedException e) { e.printStackTrace(); } } } } }
4,190
0.571592
0.553265
163
20.423313
18.619501
99
false
false
0
0
0
0
0
0
2.815951
false
false
13
a7f6120a9f06d70f4e91f513d88c4be3f1f9eccb
7,310,034,339,785
1a2a5accf70136d91cbc2c107524155ff3a3d69d
/BuilderPattern/src/org/mylearnings/builder/CookieRobotBuilder.java
5afbe4b1e8282c56fca042c45429734f70074276
[]
no_license
apundhir/learn_patterns
https://github.com/apundhir/learn_patterns
9d836fee66c72b836f15f97369abf7167935bcbc
2b3653df878225149bdc0b025dbcb9b4299c0c5b
refs/heads/master
2021-06-19T00:15:23.612000
2017-03-21T10:13:13
2017-03-21T10:13:13
22,551,963
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.mylearnings.builder; import java.util.ArrayList; public class CookieRobotBuilder implements RobotBuilder{ CookieRobotBuildable robot; // store actions and sequence of actions ArrayList<Integer> actions; public CookieRobotBuilder() { robot = new CookieRobotBuildable(); actions = new ArrayList<Integer>(); } @Override public void addStart() { actions.add(new Integer(1)); } @Override public void addGetParts() { actions.add(new Integer(2)); } @Override public void assAssemble() { actions.add(new Integer(3)); } @Override public void addTest() { actions.add(new Integer(4)); } @Override public void addStop() { actions.add(new Integer(5)); } @Override public RobotBuildable getRobot() { robot.loadActions(actions); return robot; } }
UTF-8
Java
815
java
CookieRobotBuilder.java
Java
[]
null
[]
package org.mylearnings.builder; import java.util.ArrayList; public class CookieRobotBuilder implements RobotBuilder{ CookieRobotBuildable robot; // store actions and sequence of actions ArrayList<Integer> actions; public CookieRobotBuilder() { robot = new CookieRobotBuildable(); actions = new ArrayList<Integer>(); } @Override public void addStart() { actions.add(new Integer(1)); } @Override public void addGetParts() { actions.add(new Integer(2)); } @Override public void assAssemble() { actions.add(new Integer(3)); } @Override public void addTest() { actions.add(new Integer(4)); } @Override public void addStop() { actions.add(new Integer(5)); } @Override public RobotBuildable getRobot() { robot.loadActions(actions); return robot; } }
815
0.69816
0.692025
52
14.673077
14.786586
56
false
false
0
0
0
0
0
0
1.307692
false
false
13
4a9583ebdf77e6662ec46735ff96096288dcacd1
19,473,381,775,595
313ad16c4ef3aa689df006267e8c82a94a25f70f
/java/user/src/main/java/com/tushar/expenses/user/shared/DomainObjectIdCustomType.java
e0df34ca9c1788411ba5932ac520fbf2021abf37
[]
no_license
tushargoel86/expense-tracker
https://github.com/tushargoel86/expense-tracker
4de5581c5213f2f8ad3eded01349073198f335aa
5bc22c30cc966d9ef89038817a662f7f7a3a4648
refs/heads/master
2023-01-21T14:24:05.213000
2020-04-26T04:30:51
2020-04-26T04:30:51
252,645,695
0
0
null
false
2023-01-05T11:07:38
2020-04-03T06:01:47
2020-04-26T04:31:16
2023-01-05T11:07:36
4,729
0
0
23
Java
false
false
package com.tushar.expenses.user.shared; import org.hibernate.type.AbstractSingleColumnStandardBasicType; import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor; import org.springframework.lang.NonNull; /** * Hibernate custom type for a {@link DomainObjectId} subtype. You need this to be able to use {@link DomainObjectId}s * as primary keys. You have to create one subclass per {@link DomainObjectId} subtype. * * @param <ID> the ID type. * @see DomainObjectIdTypeDescriptor */ public abstract class DomainObjectIdCustomType<ID> extends AbstractSingleColumnStandardBasicType<ID> { /** * Creates a new {@code DomainObjectIdCustomType}. In your subclass, you should create a default constructor and * invoke this constructor from there. * * @param domainObjectIdTypeDescriptor the {@link DomainObjectIdTypeDescriptor} for the ID type. */ public DomainObjectIdCustomType(@NonNull DomainObjectIdTypeDescriptor<ID> domainObjectIdTypeDescriptor) { super(VarcharTypeDescriptor.INSTANCE, domainObjectIdTypeDescriptor); } @Override public String getName() { return getJavaTypeDescriptor().getJavaType().getSimpleName(); } }
UTF-8
Java
1,200
java
DomainObjectIdCustomType.java
Java
[]
null
[]
package com.tushar.expenses.user.shared; import org.hibernate.type.AbstractSingleColumnStandardBasicType; import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor; import org.springframework.lang.NonNull; /** * Hibernate custom type for a {@link DomainObjectId} subtype. You need this to be able to use {@link DomainObjectId}s * as primary keys. You have to create one subclass per {@link DomainObjectId} subtype. * * @param <ID> the ID type. * @see DomainObjectIdTypeDescriptor */ public abstract class DomainObjectIdCustomType<ID> extends AbstractSingleColumnStandardBasicType<ID> { /** * Creates a new {@code DomainObjectIdCustomType}. In your subclass, you should create a default constructor and * invoke this constructor from there. * * @param domainObjectIdTypeDescriptor the {@link DomainObjectIdTypeDescriptor} for the ID type. */ public DomainObjectIdCustomType(@NonNull DomainObjectIdTypeDescriptor<ID> domainObjectIdTypeDescriptor) { super(VarcharTypeDescriptor.INSTANCE, domainObjectIdTypeDescriptor); } @Override public String getName() { return getJavaTypeDescriptor().getJavaType().getSimpleName(); } }
1,200
0.7625
0.7625
30
39
40.171299
118
false
false
0
0
0
0
0
0
0.266667
false
false
13
f9d307487240f488613aa3bfc05103e9643c2949
33,973,191,326,884
db86ad13bcef5aa6401a989621f2cc2bb199892e
/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/generics/ticket3149/MainResource.java
9f1082b7bcbf35960196541a3d2eac1d4e4af063
[ "Apache-2.0" ]
permissive
fabianvo/swagger-core
https://github.com/fabianvo/swagger-core
8619839b45654de0cbb0cc08d586e08d80de43f2
4993709d403ba76225bd1489bcc2b3d91b44b523
refs/heads/master
2021-04-18T15:42:24.642000
2021-03-31T09:23:45
2021-03-31T09:23:45
249,558,793
0
1
Apache-2.0
true
2021-03-31T07:32:48
2020-03-23T22:33:11
2020-03-23T22:33:13
2021-03-31T07:32:48
13,877
0
1
0
null
false
false
package io.swagger.v3.jaxrs2.resources.generics.ticket3149; import io.swagger.v3.oas.annotations.tags.Tag; import javax.ws.rs.Path; @Path("/test") @Tag(name = "Test inheritance on default implementation in interfaces") public class MainResource implements AggregateEndpoint<SampleDTO, SampleOtherDTO> { }
UTF-8
Java
312
java
MainResource.java
Java
[]
null
[]
package io.swagger.v3.jaxrs2.resources.generics.ticket3149; import io.swagger.v3.oas.annotations.tags.Tag; import javax.ws.rs.Path; @Path("/test") @Tag(name = "Test inheritance on default implementation in interfaces") public class MainResource implements AggregateEndpoint<SampleDTO, SampleOtherDTO> { }
312
0.788462
0.766026
11
27.363636
26.147388
71
false
false
0
0
0
0
0
0
0.363636
false
false
13
da695a60771b75c9df9c46d61309117804c10fa8
7,619,272,043,764
ddf87d25cd5c15a5041fe9118ba445a5f095d250
/src/main/java/lv/javaguru/java2/services/validators/ProductValidator.java
3a772c918da1aaedb97024a3e1e1aa284e8d5c09
[]
no_license
vijai3d/JavaGuruShop
https://github.com/vijai3d/JavaGuruShop
db9ca86fe7a7a8716f82f96ed25051e4229d8bf9
510bd37cab36cf1792015448b1e4c611af36d4cc
refs/heads/master
2020-04-02T01:49:19.955000
2017-07-05T20:59:09
2017-07-05T20:59:09
83,599,483
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package lv.javaguru.java2.services.validators; import lv.javaguru.java2.domain.products.Category; import org.springframework.stereotype.Component; import java.math.BigDecimal; /** * Created by Vijai3D on 26.03.2017. */ @Component public interface ProductValidator { void validate(String name, String description, BigDecimal price, Category category); }
UTF-8
Java
362
java
ProductValidator.java
Java
[ { "context": ";\n\nimport java.math.BigDecimal;\n\n/**\n * Created by Vijai3D on 26.03.2017.\n */\n@Component\npublic interface Pr", "end": 204, "score": 0.9987484812736511, "start": 197, "tag": "USERNAME", "value": "Vijai3D" } ]
null
[]
package lv.javaguru.java2.services.validators; import lv.javaguru.java2.domain.products.Category; import org.springframework.stereotype.Component; import java.math.BigDecimal; /** * Created by Vijai3D on 26.03.2017. */ @Component public interface ProductValidator { void validate(String name, String description, BigDecimal price, Category category); }
362
0.790055
0.759669
14
24.857143
25.963869
88
false
false
0
0
0
0
0
0
0.571429
false
false
13
28fc9c92af2e50dceede46ce8f7f1ed52df0c808
21,062,519,639,862
b3ff6ab59c158661c1cb29b5e7122d0462431d71
/src/challenges/java/strings/JavaRegex2DuplicateWords.java
be905d0db0ee3392430b1b00bf9a6df098d98fc0
[]
no_license
AntonioDiaz/hackerrank.com
https://github.com/AntonioDiaz/hackerrank.com
7f9817f05ab66836ddf04f056d6432495e40afea
47b7fffa30710a582c6e7a1aae8ecd4a25bac7ed
refs/heads/master
2020-05-22T06:34:35.032000
2020-03-29T19:38:15
2020-03-29T19:38:15
60,717,894
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package challenges.java.strings; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.Properties; import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class JavaRegex2DuplicateWords { public static void main(String[] args) throws IOException { InputStream inputStream = JavaRegex2DuplicateWords.class.getClassLoader().getResourceAsStream("config.properties"); Properties properties = new Properties(); properties.load(inputStream); File file = new File(properties.getProperty("input.path") + "java_regex2_duplicate_words.txt"); Scanner in = new Scanner(file); // Scanner in = new Scanner(System.in); // String regex = "\\b(\\w+)\\s+\\1\\b"; String regex = "\\b(\\w+)(\\s+\\1\\b)*"; Pattern p = Pattern.compile(regex, Pattern.CASE_INSENSITIVE); int numSentences = Integer.parseInt(in.nextLine()); while (numSentences-- > 0) { String input = in.nextLine(); // System.out.println("begin [" + input + "]"); Matcher m = p.matcher(input); // Check for subsequences of input that match the compiled pattern while (m.find()) { // System.out.println(" m.group() -->" + m.group()); // System.out.println(" m.group(1) -->" + m.group(1)); input = input.replaceAll(m.group(), m.group(1)); // m = p.matcher(input); // System.out.println(input); } // Prints the modified sentence. System.out.println("end [" + input + "]"); } in.close(); } }
UTF-8
Java
1,530
java
JavaRegex2DuplicateWords.java
Java
[]
null
[]
package challenges.java.strings; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.Properties; import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class JavaRegex2DuplicateWords { public static void main(String[] args) throws IOException { InputStream inputStream = JavaRegex2DuplicateWords.class.getClassLoader().getResourceAsStream("config.properties"); Properties properties = new Properties(); properties.load(inputStream); File file = new File(properties.getProperty("input.path") + "java_regex2_duplicate_words.txt"); Scanner in = new Scanner(file); // Scanner in = new Scanner(System.in); // String regex = "\\b(\\w+)\\s+\\1\\b"; String regex = "\\b(\\w+)(\\s+\\1\\b)*"; Pattern p = Pattern.compile(regex, Pattern.CASE_INSENSITIVE); int numSentences = Integer.parseInt(in.nextLine()); while (numSentences-- > 0) { String input = in.nextLine(); // System.out.println("begin [" + input + "]"); Matcher m = p.matcher(input); // Check for subsequences of input that match the compiled pattern while (m.find()) { // System.out.println(" m.group() -->" + m.group()); // System.out.println(" m.group(1) -->" + m.group(1)); input = input.replaceAll(m.group(), m.group(1)); // m = p.matcher(input); // System.out.println(input); } // Prints the modified sentence. System.out.println("end [" + input + "]"); } in.close(); } }
1,530
0.654902
0.64902
46
31.304348
25.48987
117
false
false
0
0
0
0
0
0
2.217391
false
false
13
f532ecb1f020061e4773c5da13bb5e374a604927
25,486,335,962,523
0a9e23927487dba3844b09226302a1156fa1542b
/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/utils/DescriptorUtil.java
aa4595f868a38d7430e1d48d9c94b374f3e25f9a
[ "Apache-2.0" ]
permissive
msmemon/airavata
https://github.com/msmemon/airavata
1f58b621bd4f09f4349dfccc3aa48c4393ee8db1
b04341ab543171df469565cf22a949a9761a6206
refs/heads/master
2021-01-12T21:02:51.759000
2014-04-24T12:08:17
2014-04-24T12:08:17
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.airavata.rest.mappings.utils; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.apache.airavata.commons.gfac.type.ApplicationDescription; import org.apache.airavata.commons.gfac.type.HostDescription; import org.apache.airavata.commons.gfac.type.ServiceDescription; import org.apache.airavata.rest.mappings.resourcemappings.ApplicationDescriptor; import org.apache.airavata.rest.mappings.resourcemappings.HostDescriptor; import org.apache.airavata.rest.mappings.resourcemappings.ServiceDescriptor; import org.apache.airavata.rest.mappings.resourcemappings.ServiceParameters; import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType; import org.apache.airavata.schemas.gfac.DataType; import org.apache.airavata.schemas.gfac.Ec2ApplicationDeploymentType; import org.apache.airavata.schemas.gfac.Ec2HostType; import org.apache.airavata.schemas.gfac.GlobusHostType; import org.apache.airavata.schemas.gfac.GsisshHostType; import org.apache.airavata.schemas.gfac.HostDescriptionType; import org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType; import org.apache.airavata.schemas.gfac.InputParameterType; import org.apache.airavata.schemas.gfac.JobTypeType; import org.apache.airavata.schemas.gfac.NameValuePairType; import org.apache.airavata.schemas.gfac.OutputParameterType; import org.apache.airavata.schemas.gfac.ParameterType; import org.apache.airavata.schemas.gfac.ProjectAccountType; import org.apache.airavata.schemas.gfac.QueueType; import org.apache.airavata.schemas.gfac.SSHHostType; import org.apache.airavata.schemas.gfac.UnicoreHostType; public class DescriptorUtil { public static HostDescription createHostDescription(String hostName, String hostAddress, String hostEndpoint, String gatekeeperEndpoint, String providerType) { HostDescription host = new HostDescription(); host.getType().setHostName(hostName); host.getType().setHostAddress(hostAddress); if(providerType.equalsIgnoreCase(HostTypes.GLOBUS_HOST_TYPE)){ host.getType().changeType(GlobusHostType.type); ((GlobusHostType) host.getType()). setGridFTPEndPointArray(new String[]{hostEndpoint}); ((GlobusHostType) host.getType()). setGlobusGateKeeperEndPointArray(new String[]{gatekeeperEndpoint}); }else if (providerType.equalsIgnoreCase(HostTypes.SSH_HOST_TYPE)){ host.getType().changeType(SSHHostType.type); }else if (providerType.equalsIgnoreCase(HostTypes.UNICORE_HOST_TYPE)){ host.getType().changeType(GlobusHostType.type); ((UnicoreHostType) host.getType()). setGridFTPEndPointArray(new String[]{hostEndpoint}); ((UnicoreHostType) host.getType()). setUnicoreBESEndPointArray(new String[]{gatekeeperEndpoint}); } return host; } public static ApplicationDescription registerApplication(String appName, String exeuctableLocation, String scratchWorkingDirectory, String hostName, String projAccNumber, String queueName, String cpuCount, String nodeCount, String maxMemory) throws Exception { // Create Application Description ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type); HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType(); app.setCpuCount(Integer.parseInt(cpuCount)); app.setNodeCount(Integer.parseInt(nodeCount)); ApplicationDeploymentDescriptionType.ApplicationName name = appDesc.getType().addNewApplicationName(); name.setStringValue(appName); app.setExecutableLocation(exeuctableLocation); app.setScratchWorkingDirectory(scratchWorkingDirectory); ProjectAccountType projectAccountType = ((HpcApplicationDeploymentType) appDesc.getType()).addNewProjectAccount(); projectAccountType.setProjectAccountNumber(projAccNumber); QueueType queueType = app.addNewQueue(); queueType.setQueueName(queueName); app.setMaxMemory(Integer.parseInt(maxMemory)); return appDesc; } public static ServiceDescription getServiceDescription(String serviceName, String inputName, String inputType, String outputName, String outputType) { // Create Service Description ServiceDescription serv = new ServiceDescription(); serv.getType().setName(serviceName); InputParameterType input = InputParameterType.Factory.newInstance(); input.setParameterName(inputName); ParameterType parameterType = input.addNewParameterType(); parameterType.setType(DataType.Enum.forString(inputType)); parameterType.setName(inputName); List<InputParameterType> inputList = new ArrayList<InputParameterType>(); inputList.add(input); InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList .size()]); OutputParameterType output = OutputParameterType.Factory.newInstance(); output.setParameterName(outputName); ParameterType parameterType1 = output.addNewParameterType(); parameterType1.setType(DataType.Enum.forString(outputType)); parameterType1.setName(outputName); List<OutputParameterType> outputList = new ArrayList<OutputParameterType>(); outputList.add(output); OutputParameterType[] outputParamList = outputList .toArray(new OutputParameterType[outputList.size()]); serv.getType().setInputParametersArray(inputParamList); serv.getType().setOutputParametersArray(outputParamList); return serv; } public static HostDescriptor createHostDescriptor (HostDescription hostDescription){ List<String> hostType = new ArrayList<String>(); List<String> gridFTPEndPoint = new ArrayList<String>(); List<String> gateKeeperEndPoint = new ArrayList<String>(); List<String> imageID = new ArrayList<String>(); List<String> instanceID = new ArrayList<String>(); HostDescriptor hostDescriptor = new HostDescriptor(); hostDescriptor.setHostname(hostDescription.getType().getHostName()); hostDescriptor.setHostAddress(hostDescription.getType().getHostAddress()); HostDescriptionType hostDescriptionType = hostDescription.getType(); if (hostDescriptionType instanceof GlobusHostType){ GlobusHostType globusHostType = (GlobusHostType) hostDescriptionType; hostType.add(HostTypes.GLOBUS_HOST_TYPE); String[] globusGateKeeperEndPointArray = globusHostType.getGlobusGateKeeperEndPointArray(); for (int i = 0; i < globusGateKeeperEndPointArray.length ; i++){ gateKeeperEndPoint.add(globusGateKeeperEndPointArray[i]); } String[] gridFTPEndPointArray = globusHostType.getGridFTPEndPointArray(); for (int i = 0; i < gridFTPEndPointArray.length ; i++){ gridFTPEndPoint.add(gridFTPEndPointArray[i]); } }else if (hostDescriptionType instanceof GsisshHostType) { hostType.add(HostTypes.GSISSH_HOST_TYPE); } else if (hostDescriptionType instanceof SSHHostType) { hostType.add(HostTypes.SSH_HOST_TYPE); SSHHostType sshHostType = (SSHHostType) hostDescriptionType; hostDescriptor.setHpcResource(sshHostType.getHpcResource()); } else if (hostDescriptionType instanceof UnicoreHostType) { UnicoreHostType unicoreHostType = (UnicoreHostType) hostDescriptionType; hostType.add(HostTypes.UNICORE_HOST_TYPE); String[] unicoreGateKeeperEndPointArray = unicoreHostType.getUnicoreBESEndPointArray(); for (int i = 0; i < unicoreGateKeeperEndPointArray.length; i++) { gateKeeperEndPoint.add(unicoreGateKeeperEndPointArray[i]); } String[] gridFTPEndPointArray = unicoreHostType.getGridFTPEndPointArray(); for (int i = 0; i < gridFTPEndPointArray.length; i++) { gridFTPEndPoint.add(gridFTPEndPointArray[i]); } } else if (hostDescriptionType instanceof Ec2HostType) { hostType.add(HostTypes.EC2_HOST_TYPE); } else { hostType.add(HostTypes.HOST_DESCRIPTION_TYPE); } hostDescriptor.setGateKeeperEndPoint(gateKeeperEndPoint); hostDescriptor.setGridFTPEndPoint(gridFTPEndPoint); hostDescriptor.setImageID(imageID); hostDescriptor.setInstanceID(instanceID); hostDescriptor.setHostType(hostType); return hostDescriptor; } public static HostDescription createHostDescription (HostDescriptor hostDescriptor){ HostDescription hostDescription = new HostDescription(HostDescriptionType.type); hostDescription.getType().setHostAddress(hostDescriptor.getHostAddress()); hostDescription.getType().setHostName(hostDescriptor.getHostname()); if (hostDescriptor.getHostType() != null && !hostDescriptor.getHostType().isEmpty()) { if (hostDescriptor.getHostType().get(0).equals(HostTypes.GLOBUS_HOST_TYPE)) { hostDescription.getType().changeType(GlobusHostType.type); if (!hostDescriptor.getGateKeeperEndPoint().isEmpty() && hostDescriptor.getGateKeeperEndPoint() != null){ ((GlobusHostType) hostDescription.getType()).addGlobusGateKeeperEndPoint(hostDescriptor.getGateKeeperEndPoint().get(0)); } if (!hostDescriptor.getGridFTPEndPoint().isEmpty() && hostDescriptor.getGridFTPEndPoint() != null){ ((GlobusHostType) hostDescription.getType()).addGridFTPEndPoint(hostDescriptor.getGridFTPEndPoint().get(0)); } } else if (hostDescriptor.getHostType().get(0).equals(HostTypes.GSISSH_HOST_TYPE)) { hostDescription.getType().changeType(GsisshHostType.type); } else if (hostDescriptor.getHostType().get(0).equals(HostTypes.EC2_HOST_TYPE)) { hostDescription.getType().changeType(Ec2HostType.type); if (!hostDescriptor.getImageID().isEmpty() && hostDescriptor.getImageID() != null ){ ((Ec2HostType) hostDescription).addImageID(hostDescriptor.getImageID().get(0)); } if (!hostDescriptor.getInstanceID().isEmpty() && hostDescriptor.getInstanceID() != null){ ((Ec2HostType) hostDescription).addInstanceID(hostDescriptor.getInstanceID().get(0)); } }else if (hostDescriptor.getHostType().get(0).equals(HostTypes.SSH_HOST_TYPE)) { hostDescription.getType().changeType(SSHHostType.type); ((SSHHostType)hostDescription.getType()).setHpcResource(hostDescriptor.isHpcResource()); } else if (hostDescriptor.getHostType().get(0).equals(HostTypes.UNICORE_HOST_TYPE)) { hostDescription.getType().changeType(UnicoreHostType.type); if (!hostDescriptor.getGateKeeperEndPoint().isEmpty() && hostDescriptor.getGateKeeperEndPoint() != null){ ((UnicoreHostType) hostDescription.getType()).addUnicoreBESEndPoint(hostDescriptor.getGateKeeperEndPoint().get(0)); } if (!hostDescriptor.getGridFTPEndPoint().isEmpty() && hostDescriptor.getGridFTPEndPoint() != null){ ((UnicoreHostType) hostDescription.getType()).addGridFTPEndPoint(hostDescriptor.getGridFTPEndPoint().get(0)); } } } return hostDescription; } public static ServiceDescription createServiceDescription (ServiceDescriptor serviceDescriptor){ ServiceDescription serviceDescription = new ServiceDescription(); serviceDescription.getType().setName(serviceDescriptor.getServiceName()); serviceDescription.getType().setDescription(serviceDescriptor.getDescription()); List<ServiceParameters> inputParams = serviceDescriptor.getInputParams(); InputParameterType[] inputParameterTypeArray = new InputParameterType[inputParams.size()]; for (int i = 0; i < inputParams.size(); i++){ InputParameterType parameter = InputParameterType.Factory.newInstance(); parameter.setParameterName(inputParams.get(i).getName()); parameter.setParameterValueArray(new String[]{inputParams.get(i).getName()}); parameter.setParameterDescription(inputParams.get(i).getDescription()); ParameterType parameterType = parameter.addNewParameterType(); parameterType.setType(DataType.Enum.forString(inputParams.get(i).getType())); parameterType.setName(inputParams.get(i).getType()); parameter.setParameterType(parameterType); inputParameterTypeArray[i] = parameter; } serviceDescription.getType().setInputParametersArray(inputParameterTypeArray); List<ServiceParameters> outputParams = serviceDescriptor.getOutputParams(); OutputParameterType[] outputParameterTypeArray = new OutputParameterType[outputParams.size()]; for (int i = 0; i < outputParams.size(); i++){ OutputParameterType parameter = OutputParameterType.Factory.newInstance(); parameter.setParameterName(outputParams.get(i).getName()); parameter.setParameterDescription(outputParams.get(i).getDescription()); ParameterType parameterType = parameter.addNewParameterType(); parameterType.setType(DataType.Enum.forString(outputParams.get(i).getType())); parameterType.setName(outputParams.get(i).getType()); parameter.setParameterType(parameterType); outputParameterTypeArray[i] = parameter; } serviceDescription.getType().setOutputParametersArray(outputParameterTypeArray); return serviceDescription; } public static ServiceDescriptor createServiceDescriptor(ServiceDescription serviceDescription){ ServiceDescriptor serviceDescriptor = new ServiceDescriptor(); serviceDescriptor.setServiceName(serviceDescription.getType().getName()); serviceDescriptor.setDescription(serviceDescription.getType().getDescription()); InputParameterType[] inputParametersArray = serviceDescription.getType().getInputParametersArray(); OutputParameterType[] outputParametersArray = serviceDescription.getType().getOutputParametersArray(); List<ServiceParameters> inputParams = new ArrayList<ServiceParameters>(); List<ServiceParameters> outputParams = new ArrayList<ServiceParameters>(); for (int i = 0; i < inputParametersArray.length; i++){ ServiceParameters serviceParameters = new ServiceParameters(); serviceParameters.setType(inputParametersArray[i].getParameterType().getType().toString()); // String[] parameterValueArray = inputParametersArray[i].getParameterValueArray(); // if (parameterValueArray.length != 0){ // serviceParameters.setName(parameterValueArray[0]); // } serviceParameters.setName(inputParametersArray[i].getParameterName()); serviceParameters.setDescription(inputParametersArray[i].getParameterDescription()); // serviceParameters.set(inputParametersArray[i].getParameterType().getType().toString()); inputParams.add(serviceParameters); } serviceDescriptor.setInputParams(inputParams); for (int i = 0; i < outputParametersArray.length; i++){ ServiceParameters serviceParameters = new ServiceParameters(); serviceParameters.setType(outputParametersArray[i].getParameterType().getType().toString()); serviceParameters.setName(outputParametersArray[i].getParameterName()); serviceParameters.setDescription(outputParametersArray[i].getParameterDescription()); // serviceParameters.setDataType(outputParametersArray[i].getParameterType().getType().toString()); outputParams.add(serviceParameters); } serviceDescriptor.setOutputParams(outputParams); return serviceDescriptor; } public static ApplicationDescription createApplicationDescription(ApplicationDescriptor applicationDescriptor){ ApplicationDescription applicationDescription = new ApplicationDescription(); ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance(); name.setStringValue(applicationDescriptor.getName()); applicationDescription.getType().setApplicationName(name); applicationDescription.getType().setExecutableLocation(applicationDescriptor.getExecutablePath()); applicationDescription.getType().setScratchWorkingDirectory(applicationDescriptor.getWorkingDir()); if (applicationDescriptor.getInputDir() != null){ applicationDescription.getType().setInputDataDirectory(applicationDescriptor.getInputDir()); } if (applicationDescriptor.getOutputDir() != null){ applicationDescription.getType().setOutputDataDirectory(applicationDescriptor.getOutputDir()); } if (applicationDescriptor.getStdIn() != null){ applicationDescription.getType().setStandardInput(applicationDescriptor.getStdIn()); } if (applicationDescriptor.getStdOut() != null){ applicationDescription.getType().setStandardOutput(applicationDescriptor.getStdOut()); } if (applicationDescriptor.getStdError() != null){ applicationDescription.getType().setStandardError(applicationDescriptor.getStdError()); } if (applicationDescriptor.getStaticWorkigDir() != null){ applicationDescription.getType().setStaticWorkingDirectory(applicationDescriptor.getStaticWorkigDir()); } HashMap<String,String> environmentVariables = applicationDescriptor.getEnvironmentVariables(); if (environmentVariables != null && !environmentVariables.isEmpty()){ NameValuePairType[] appEnviVariablesArray = new NameValuePairType[environmentVariables.size()]; for(String key : environmentVariables.keySet()) { int i = 0; NameValuePairType nameValuePairType = applicationDescription.getType().addNewApplicationEnvironment(); nameValuePairType.setName(key); nameValuePairType.setValue(environmentVariables.get(key)); appEnviVariablesArray[i] = nameValuePairType; i++; } applicationDescription.getType().setApplicationEnvironmentArray(appEnviVariablesArray); } //set advanced options according app desc type if(applicationDescriptor.getApplicationDescType() != null && !applicationDescriptor.getApplicationDescType().isEmpty()){ if (applicationDescriptor.getApplicationDescType().equals(ApplicationDescriptorTypes.HPC_APP_DEP_DESC_TYPE)){ ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type); appDesc.getType().setApplicationName(name); appDesc.getType().setExecutableLocation(applicationDescriptor.getExecutablePath()); appDesc.getType().setScratchWorkingDirectory(applicationDescriptor.getWorkingDir()); if (applicationDescriptor.getInputDir() != null){ appDesc.getType().setInputDataDirectory(applicationDescriptor.getInputDir()); } if (applicationDescriptor.getOutputDir() != null){ appDesc.getType().setOutputDataDirectory(applicationDescriptor.getOutputDir()); } if (applicationDescriptor.getStdIn() != null){ appDesc.getType().setStandardInput(applicationDescriptor.getStdIn()); } if (applicationDescriptor.getStdOut() != null){ appDesc.getType().setStandardOutput(applicationDescriptor.getStdOut()); } if (applicationDescriptor.getStdError() != null){ appDesc.getType().setStandardError(applicationDescriptor.getStdError()); } if (applicationDescriptor.getStaticWorkigDir() != null){ appDesc.getType().setStaticWorkingDirectory(applicationDescriptor.getStaticWorkigDir()); } HashMap<String,String> envVariables = applicationDescriptor.getEnvironmentVariables(); if (envVariables != null && !envVariables.isEmpty()){ NameValuePairType[] appEnviVariablesArray = new NameValuePairType[envVariables.size()]; for(String key : envVariables.keySet()) { int i = 0; NameValuePairType nameValuePairType = applicationDescription.getType().addNewApplicationEnvironment(); nameValuePairType.setName(key); nameValuePairType.setValue(envVariables.get(key)); appEnviVariablesArray[i] = nameValuePairType; i++; } appDesc.getType().setApplicationEnvironmentArray(appEnviVariablesArray); } HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType(); ProjectAccountType projectAccountType = app.addNewProjectAccount(); if (applicationDescriptor.getProjectNumber() != null){ projectAccountType.setProjectAccountNumber(applicationDescriptor.getProjectNumber()); } if (applicationDescriptor.getProjectDescription() != null){ projectAccountType.setProjectAccountDescription(applicationDescriptor.getProjectDescription()); } app.setProjectAccount(projectAccountType); app.setCpuCount(applicationDescriptor.getCpuCount()); if (applicationDescriptor.getJobType() != null){ app.setJobType(JobTypeType.Enum.forString(applicationDescriptor.getJobType())); } app.setInstalledParentPath(applicationDescriptor.getInstalledPath()); app.setJobSubmitterCommand(applicationDescriptor.getJobSubmitterCommand()); app.setMaxMemory(applicationDescriptor.getMaxMemory()); app.setMinMemory(applicationDescriptor.getMinMemory()); app.setMaxWallTime(applicationDescriptor.getMaxWallTime()); app.setNodeCount(applicationDescriptor.getNodeCount()); app.setProcessorsPerNode(applicationDescriptor.getProcessorsPerNode()); QueueType queueType = app.addNewQueue(); if (applicationDescriptor.getQueueName() != null){ queueType.setQueueName(applicationDescriptor.getQueueName()); } app.setQueue(queueType); return appDesc; } } return applicationDescription; } public static ApplicationDescriptor createApplicationDescriptor (ApplicationDescription applicationDescription){ ApplicationDescriptor applicationDescriptor = new ApplicationDescriptor(); applicationDescriptor.setName(applicationDescription.getType().getApplicationName().getStringValue()); applicationDescriptor.setExecutablePath(applicationDescription.getType().getExecutableLocation()); applicationDescriptor.setWorkingDir(applicationDescription.getType().getScratchWorkingDirectory()); if (applicationDescription.getType().getInputDataDirectory() != null && !applicationDescription.getType().getInputDataDirectory().equals("") ){ applicationDescriptor.setInputDir(applicationDescription.getType().getInputDataDirectory()); } if (applicationDescription.getType().getOutputDataDirectory() != null && !applicationDescription.getType().getOutputDataDirectory().equals("")){ applicationDescriptor.setOutputDir(applicationDescription.getType().getOutputDataDirectory()); } if (applicationDescription.getType().getStaticWorkingDirectory() != null && !applicationDescription.getType().getStaticWorkingDirectory().equals("")){ applicationDescriptor.setStaticWorkigDir(applicationDescription.getType().getStaticWorkingDirectory()); } if (applicationDescription.getType().getStandardInput() != null && !applicationDescription.getType().getStandardInput().equals("")){ applicationDescriptor.setStdIn(applicationDescription.getType().getStandardInput()); } if (applicationDescription.getType().getStandardOutput() != null && !applicationDescription.getType().getStandardOutput().equals("")){ applicationDescriptor.setStdOut(applicationDescription.getType().getStandardOutput()); } if (applicationDescription.getType().getStandardError() != null && !applicationDescription.getType().getStandardError().equals("")){ applicationDescriptor.setStdError(applicationDescription.getType().getStandardError()); } NameValuePairType[] environmentArray = applicationDescription.getType().getApplicationEnvironmentArray(); HashMap<String, String> environmentVariableMap = new HashMap<String, String>(); if (environmentArray != null && environmentArray.length != 0){ for (NameValuePairType nameValuePairType : environmentArray){ environmentVariableMap.put(nameValuePairType.getName(), nameValuePairType.getValue()); } applicationDescriptor.setEnvironmentVariables(environmentVariableMap); } if(applicationDescription.getType() != null){ if(applicationDescription.getType() instanceof HpcApplicationDeploymentType){ applicationDescriptor.setApplicationDescType(ApplicationDescriptorTypes.HPC_APP_DEP_DESC_TYPE); HpcApplicationDeploymentType gramApplicationDeploymentType = (HpcApplicationDeploymentType) applicationDescription.getType(); if(gramApplicationDeploymentType != null){ applicationDescriptor.setCpuCount(gramApplicationDeploymentType.getCpuCount()); applicationDescriptor.setNodeCount(gramApplicationDeploymentType.getNodeCount()); applicationDescriptor.setMaxMemory(gramApplicationDeploymentType.getMaxMemory()); applicationDescriptor.setMinMemory(gramApplicationDeploymentType.getMinMemory()); applicationDescriptor.setMaxWallTime(gramApplicationDeploymentType.getMaxWallTime()); applicationDescriptor.setJobSubmitterCommand(gramApplicationDeploymentType.getJobSubmitterCommand()); applicationDescriptor.setInstalledPath(gramApplicationDeploymentType.getInstalledParentPath()); if (gramApplicationDeploymentType.getJobType() != null) { applicationDescriptor.setJobType(gramApplicationDeploymentType.getJobType().toString()); } if (gramApplicationDeploymentType.getProjectAccount() != null){ if (gramApplicationDeploymentType.getProjectAccount().getProjectAccountNumber() != null){ applicationDescriptor.setProjectNumber(gramApplicationDeploymentType.getProjectAccount().getProjectAccountNumber()); } } if (gramApplicationDeploymentType.getProjectAccount() != null){ if (gramApplicationDeploymentType.getProjectAccount().getProjectAccountDescription() != null){ applicationDescriptor.setProjectDescription(gramApplicationDeploymentType.getProjectAccount().getProjectAccountDescription()); } } if(gramApplicationDeploymentType.getQueue() != null){ applicationDescriptor.setQueueName(gramApplicationDeploymentType.getQueue().getQueueName()); } applicationDescriptor.setProcessorsPerNode(gramApplicationDeploymentType.getProcessorsPerNode()); } } else if (applicationDescription.getType() instanceof Ec2ApplicationDeploymentType) { applicationDescriptor.setApplicationDescType(ApplicationDescriptorTypes.EC2_APP_DEP_DESC_TYPE); } } return applicationDescriptor; } }
UTF-8
Java
29,835
java
DescriptorUtil.java
Java
[]
null
[]
/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.airavata.rest.mappings.utils; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.apache.airavata.commons.gfac.type.ApplicationDescription; import org.apache.airavata.commons.gfac.type.HostDescription; import org.apache.airavata.commons.gfac.type.ServiceDescription; import org.apache.airavata.rest.mappings.resourcemappings.ApplicationDescriptor; import org.apache.airavata.rest.mappings.resourcemappings.HostDescriptor; import org.apache.airavata.rest.mappings.resourcemappings.ServiceDescriptor; import org.apache.airavata.rest.mappings.resourcemappings.ServiceParameters; import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType; import org.apache.airavata.schemas.gfac.DataType; import org.apache.airavata.schemas.gfac.Ec2ApplicationDeploymentType; import org.apache.airavata.schemas.gfac.Ec2HostType; import org.apache.airavata.schemas.gfac.GlobusHostType; import org.apache.airavata.schemas.gfac.GsisshHostType; import org.apache.airavata.schemas.gfac.HostDescriptionType; import org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType; import org.apache.airavata.schemas.gfac.InputParameterType; import org.apache.airavata.schemas.gfac.JobTypeType; import org.apache.airavata.schemas.gfac.NameValuePairType; import org.apache.airavata.schemas.gfac.OutputParameterType; import org.apache.airavata.schemas.gfac.ParameterType; import org.apache.airavata.schemas.gfac.ProjectAccountType; import org.apache.airavata.schemas.gfac.QueueType; import org.apache.airavata.schemas.gfac.SSHHostType; import org.apache.airavata.schemas.gfac.UnicoreHostType; public class DescriptorUtil { public static HostDescription createHostDescription(String hostName, String hostAddress, String hostEndpoint, String gatekeeperEndpoint, String providerType) { HostDescription host = new HostDescription(); host.getType().setHostName(hostName); host.getType().setHostAddress(hostAddress); if(providerType.equalsIgnoreCase(HostTypes.GLOBUS_HOST_TYPE)){ host.getType().changeType(GlobusHostType.type); ((GlobusHostType) host.getType()). setGridFTPEndPointArray(new String[]{hostEndpoint}); ((GlobusHostType) host.getType()). setGlobusGateKeeperEndPointArray(new String[]{gatekeeperEndpoint}); }else if (providerType.equalsIgnoreCase(HostTypes.SSH_HOST_TYPE)){ host.getType().changeType(SSHHostType.type); }else if (providerType.equalsIgnoreCase(HostTypes.UNICORE_HOST_TYPE)){ host.getType().changeType(GlobusHostType.type); ((UnicoreHostType) host.getType()). setGridFTPEndPointArray(new String[]{hostEndpoint}); ((UnicoreHostType) host.getType()). setUnicoreBESEndPointArray(new String[]{gatekeeperEndpoint}); } return host; } public static ApplicationDescription registerApplication(String appName, String exeuctableLocation, String scratchWorkingDirectory, String hostName, String projAccNumber, String queueName, String cpuCount, String nodeCount, String maxMemory) throws Exception { // Create Application Description ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type); HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType(); app.setCpuCount(Integer.parseInt(cpuCount)); app.setNodeCount(Integer.parseInt(nodeCount)); ApplicationDeploymentDescriptionType.ApplicationName name = appDesc.getType().addNewApplicationName(); name.setStringValue(appName); app.setExecutableLocation(exeuctableLocation); app.setScratchWorkingDirectory(scratchWorkingDirectory); ProjectAccountType projectAccountType = ((HpcApplicationDeploymentType) appDesc.getType()).addNewProjectAccount(); projectAccountType.setProjectAccountNumber(projAccNumber); QueueType queueType = app.addNewQueue(); queueType.setQueueName(queueName); app.setMaxMemory(Integer.parseInt(maxMemory)); return appDesc; } public static ServiceDescription getServiceDescription(String serviceName, String inputName, String inputType, String outputName, String outputType) { // Create Service Description ServiceDescription serv = new ServiceDescription(); serv.getType().setName(serviceName); InputParameterType input = InputParameterType.Factory.newInstance(); input.setParameterName(inputName); ParameterType parameterType = input.addNewParameterType(); parameterType.setType(DataType.Enum.forString(inputType)); parameterType.setName(inputName); List<InputParameterType> inputList = new ArrayList<InputParameterType>(); inputList.add(input); InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList .size()]); OutputParameterType output = OutputParameterType.Factory.newInstance(); output.setParameterName(outputName); ParameterType parameterType1 = output.addNewParameterType(); parameterType1.setType(DataType.Enum.forString(outputType)); parameterType1.setName(outputName); List<OutputParameterType> outputList = new ArrayList<OutputParameterType>(); outputList.add(output); OutputParameterType[] outputParamList = outputList .toArray(new OutputParameterType[outputList.size()]); serv.getType().setInputParametersArray(inputParamList); serv.getType().setOutputParametersArray(outputParamList); return serv; } public static HostDescriptor createHostDescriptor (HostDescription hostDescription){ List<String> hostType = new ArrayList<String>(); List<String> gridFTPEndPoint = new ArrayList<String>(); List<String> gateKeeperEndPoint = new ArrayList<String>(); List<String> imageID = new ArrayList<String>(); List<String> instanceID = new ArrayList<String>(); HostDescriptor hostDescriptor = new HostDescriptor(); hostDescriptor.setHostname(hostDescription.getType().getHostName()); hostDescriptor.setHostAddress(hostDescription.getType().getHostAddress()); HostDescriptionType hostDescriptionType = hostDescription.getType(); if (hostDescriptionType instanceof GlobusHostType){ GlobusHostType globusHostType = (GlobusHostType) hostDescriptionType; hostType.add(HostTypes.GLOBUS_HOST_TYPE); String[] globusGateKeeperEndPointArray = globusHostType.getGlobusGateKeeperEndPointArray(); for (int i = 0; i < globusGateKeeperEndPointArray.length ; i++){ gateKeeperEndPoint.add(globusGateKeeperEndPointArray[i]); } String[] gridFTPEndPointArray = globusHostType.getGridFTPEndPointArray(); for (int i = 0; i < gridFTPEndPointArray.length ; i++){ gridFTPEndPoint.add(gridFTPEndPointArray[i]); } }else if (hostDescriptionType instanceof GsisshHostType) { hostType.add(HostTypes.GSISSH_HOST_TYPE); } else if (hostDescriptionType instanceof SSHHostType) { hostType.add(HostTypes.SSH_HOST_TYPE); SSHHostType sshHostType = (SSHHostType) hostDescriptionType; hostDescriptor.setHpcResource(sshHostType.getHpcResource()); } else if (hostDescriptionType instanceof UnicoreHostType) { UnicoreHostType unicoreHostType = (UnicoreHostType) hostDescriptionType; hostType.add(HostTypes.UNICORE_HOST_TYPE); String[] unicoreGateKeeperEndPointArray = unicoreHostType.getUnicoreBESEndPointArray(); for (int i = 0; i < unicoreGateKeeperEndPointArray.length; i++) { gateKeeperEndPoint.add(unicoreGateKeeperEndPointArray[i]); } String[] gridFTPEndPointArray = unicoreHostType.getGridFTPEndPointArray(); for (int i = 0; i < gridFTPEndPointArray.length; i++) { gridFTPEndPoint.add(gridFTPEndPointArray[i]); } } else if (hostDescriptionType instanceof Ec2HostType) { hostType.add(HostTypes.EC2_HOST_TYPE); } else { hostType.add(HostTypes.HOST_DESCRIPTION_TYPE); } hostDescriptor.setGateKeeperEndPoint(gateKeeperEndPoint); hostDescriptor.setGridFTPEndPoint(gridFTPEndPoint); hostDescriptor.setImageID(imageID); hostDescriptor.setInstanceID(instanceID); hostDescriptor.setHostType(hostType); return hostDescriptor; } public static HostDescription createHostDescription (HostDescriptor hostDescriptor){ HostDescription hostDescription = new HostDescription(HostDescriptionType.type); hostDescription.getType().setHostAddress(hostDescriptor.getHostAddress()); hostDescription.getType().setHostName(hostDescriptor.getHostname()); if (hostDescriptor.getHostType() != null && !hostDescriptor.getHostType().isEmpty()) { if (hostDescriptor.getHostType().get(0).equals(HostTypes.GLOBUS_HOST_TYPE)) { hostDescription.getType().changeType(GlobusHostType.type); if (!hostDescriptor.getGateKeeperEndPoint().isEmpty() && hostDescriptor.getGateKeeperEndPoint() != null){ ((GlobusHostType) hostDescription.getType()).addGlobusGateKeeperEndPoint(hostDescriptor.getGateKeeperEndPoint().get(0)); } if (!hostDescriptor.getGridFTPEndPoint().isEmpty() && hostDescriptor.getGridFTPEndPoint() != null){ ((GlobusHostType) hostDescription.getType()).addGridFTPEndPoint(hostDescriptor.getGridFTPEndPoint().get(0)); } } else if (hostDescriptor.getHostType().get(0).equals(HostTypes.GSISSH_HOST_TYPE)) { hostDescription.getType().changeType(GsisshHostType.type); } else if (hostDescriptor.getHostType().get(0).equals(HostTypes.EC2_HOST_TYPE)) { hostDescription.getType().changeType(Ec2HostType.type); if (!hostDescriptor.getImageID().isEmpty() && hostDescriptor.getImageID() != null ){ ((Ec2HostType) hostDescription).addImageID(hostDescriptor.getImageID().get(0)); } if (!hostDescriptor.getInstanceID().isEmpty() && hostDescriptor.getInstanceID() != null){ ((Ec2HostType) hostDescription).addInstanceID(hostDescriptor.getInstanceID().get(0)); } }else if (hostDescriptor.getHostType().get(0).equals(HostTypes.SSH_HOST_TYPE)) { hostDescription.getType().changeType(SSHHostType.type); ((SSHHostType)hostDescription.getType()).setHpcResource(hostDescriptor.isHpcResource()); } else if (hostDescriptor.getHostType().get(0).equals(HostTypes.UNICORE_HOST_TYPE)) { hostDescription.getType().changeType(UnicoreHostType.type); if (!hostDescriptor.getGateKeeperEndPoint().isEmpty() && hostDescriptor.getGateKeeperEndPoint() != null){ ((UnicoreHostType) hostDescription.getType()).addUnicoreBESEndPoint(hostDescriptor.getGateKeeperEndPoint().get(0)); } if (!hostDescriptor.getGridFTPEndPoint().isEmpty() && hostDescriptor.getGridFTPEndPoint() != null){ ((UnicoreHostType) hostDescription.getType()).addGridFTPEndPoint(hostDescriptor.getGridFTPEndPoint().get(0)); } } } return hostDescription; } public static ServiceDescription createServiceDescription (ServiceDescriptor serviceDescriptor){ ServiceDescription serviceDescription = new ServiceDescription(); serviceDescription.getType().setName(serviceDescriptor.getServiceName()); serviceDescription.getType().setDescription(serviceDescriptor.getDescription()); List<ServiceParameters> inputParams = serviceDescriptor.getInputParams(); InputParameterType[] inputParameterTypeArray = new InputParameterType[inputParams.size()]; for (int i = 0; i < inputParams.size(); i++){ InputParameterType parameter = InputParameterType.Factory.newInstance(); parameter.setParameterName(inputParams.get(i).getName()); parameter.setParameterValueArray(new String[]{inputParams.get(i).getName()}); parameter.setParameterDescription(inputParams.get(i).getDescription()); ParameterType parameterType = parameter.addNewParameterType(); parameterType.setType(DataType.Enum.forString(inputParams.get(i).getType())); parameterType.setName(inputParams.get(i).getType()); parameter.setParameterType(parameterType); inputParameterTypeArray[i] = parameter; } serviceDescription.getType().setInputParametersArray(inputParameterTypeArray); List<ServiceParameters> outputParams = serviceDescriptor.getOutputParams(); OutputParameterType[] outputParameterTypeArray = new OutputParameterType[outputParams.size()]; for (int i = 0; i < outputParams.size(); i++){ OutputParameterType parameter = OutputParameterType.Factory.newInstance(); parameter.setParameterName(outputParams.get(i).getName()); parameter.setParameterDescription(outputParams.get(i).getDescription()); ParameterType parameterType = parameter.addNewParameterType(); parameterType.setType(DataType.Enum.forString(outputParams.get(i).getType())); parameterType.setName(outputParams.get(i).getType()); parameter.setParameterType(parameterType); outputParameterTypeArray[i] = parameter; } serviceDescription.getType().setOutputParametersArray(outputParameterTypeArray); return serviceDescription; } public static ServiceDescriptor createServiceDescriptor(ServiceDescription serviceDescription){ ServiceDescriptor serviceDescriptor = new ServiceDescriptor(); serviceDescriptor.setServiceName(serviceDescription.getType().getName()); serviceDescriptor.setDescription(serviceDescription.getType().getDescription()); InputParameterType[] inputParametersArray = serviceDescription.getType().getInputParametersArray(); OutputParameterType[] outputParametersArray = serviceDescription.getType().getOutputParametersArray(); List<ServiceParameters> inputParams = new ArrayList<ServiceParameters>(); List<ServiceParameters> outputParams = new ArrayList<ServiceParameters>(); for (int i = 0; i < inputParametersArray.length; i++){ ServiceParameters serviceParameters = new ServiceParameters(); serviceParameters.setType(inputParametersArray[i].getParameterType().getType().toString()); // String[] parameterValueArray = inputParametersArray[i].getParameterValueArray(); // if (parameterValueArray.length != 0){ // serviceParameters.setName(parameterValueArray[0]); // } serviceParameters.setName(inputParametersArray[i].getParameterName()); serviceParameters.setDescription(inputParametersArray[i].getParameterDescription()); // serviceParameters.set(inputParametersArray[i].getParameterType().getType().toString()); inputParams.add(serviceParameters); } serviceDescriptor.setInputParams(inputParams); for (int i = 0; i < outputParametersArray.length; i++){ ServiceParameters serviceParameters = new ServiceParameters(); serviceParameters.setType(outputParametersArray[i].getParameterType().getType().toString()); serviceParameters.setName(outputParametersArray[i].getParameterName()); serviceParameters.setDescription(outputParametersArray[i].getParameterDescription()); // serviceParameters.setDataType(outputParametersArray[i].getParameterType().getType().toString()); outputParams.add(serviceParameters); } serviceDescriptor.setOutputParams(outputParams); return serviceDescriptor; } public static ApplicationDescription createApplicationDescription(ApplicationDescriptor applicationDescriptor){ ApplicationDescription applicationDescription = new ApplicationDescription(); ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance(); name.setStringValue(applicationDescriptor.getName()); applicationDescription.getType().setApplicationName(name); applicationDescription.getType().setExecutableLocation(applicationDescriptor.getExecutablePath()); applicationDescription.getType().setScratchWorkingDirectory(applicationDescriptor.getWorkingDir()); if (applicationDescriptor.getInputDir() != null){ applicationDescription.getType().setInputDataDirectory(applicationDescriptor.getInputDir()); } if (applicationDescriptor.getOutputDir() != null){ applicationDescription.getType().setOutputDataDirectory(applicationDescriptor.getOutputDir()); } if (applicationDescriptor.getStdIn() != null){ applicationDescription.getType().setStandardInput(applicationDescriptor.getStdIn()); } if (applicationDescriptor.getStdOut() != null){ applicationDescription.getType().setStandardOutput(applicationDescriptor.getStdOut()); } if (applicationDescriptor.getStdError() != null){ applicationDescription.getType().setStandardError(applicationDescriptor.getStdError()); } if (applicationDescriptor.getStaticWorkigDir() != null){ applicationDescription.getType().setStaticWorkingDirectory(applicationDescriptor.getStaticWorkigDir()); } HashMap<String,String> environmentVariables = applicationDescriptor.getEnvironmentVariables(); if (environmentVariables != null && !environmentVariables.isEmpty()){ NameValuePairType[] appEnviVariablesArray = new NameValuePairType[environmentVariables.size()]; for(String key : environmentVariables.keySet()) { int i = 0; NameValuePairType nameValuePairType = applicationDescription.getType().addNewApplicationEnvironment(); nameValuePairType.setName(key); nameValuePairType.setValue(environmentVariables.get(key)); appEnviVariablesArray[i] = nameValuePairType; i++; } applicationDescription.getType().setApplicationEnvironmentArray(appEnviVariablesArray); } //set advanced options according app desc type if(applicationDescriptor.getApplicationDescType() != null && !applicationDescriptor.getApplicationDescType().isEmpty()){ if (applicationDescriptor.getApplicationDescType().equals(ApplicationDescriptorTypes.HPC_APP_DEP_DESC_TYPE)){ ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type); appDesc.getType().setApplicationName(name); appDesc.getType().setExecutableLocation(applicationDescriptor.getExecutablePath()); appDesc.getType().setScratchWorkingDirectory(applicationDescriptor.getWorkingDir()); if (applicationDescriptor.getInputDir() != null){ appDesc.getType().setInputDataDirectory(applicationDescriptor.getInputDir()); } if (applicationDescriptor.getOutputDir() != null){ appDesc.getType().setOutputDataDirectory(applicationDescriptor.getOutputDir()); } if (applicationDescriptor.getStdIn() != null){ appDesc.getType().setStandardInput(applicationDescriptor.getStdIn()); } if (applicationDescriptor.getStdOut() != null){ appDesc.getType().setStandardOutput(applicationDescriptor.getStdOut()); } if (applicationDescriptor.getStdError() != null){ appDesc.getType().setStandardError(applicationDescriptor.getStdError()); } if (applicationDescriptor.getStaticWorkigDir() != null){ appDesc.getType().setStaticWorkingDirectory(applicationDescriptor.getStaticWorkigDir()); } HashMap<String,String> envVariables = applicationDescriptor.getEnvironmentVariables(); if (envVariables != null && !envVariables.isEmpty()){ NameValuePairType[] appEnviVariablesArray = new NameValuePairType[envVariables.size()]; for(String key : envVariables.keySet()) { int i = 0; NameValuePairType nameValuePairType = applicationDescription.getType().addNewApplicationEnvironment(); nameValuePairType.setName(key); nameValuePairType.setValue(envVariables.get(key)); appEnviVariablesArray[i] = nameValuePairType; i++; } appDesc.getType().setApplicationEnvironmentArray(appEnviVariablesArray); } HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType(); ProjectAccountType projectAccountType = app.addNewProjectAccount(); if (applicationDescriptor.getProjectNumber() != null){ projectAccountType.setProjectAccountNumber(applicationDescriptor.getProjectNumber()); } if (applicationDescriptor.getProjectDescription() != null){ projectAccountType.setProjectAccountDescription(applicationDescriptor.getProjectDescription()); } app.setProjectAccount(projectAccountType); app.setCpuCount(applicationDescriptor.getCpuCount()); if (applicationDescriptor.getJobType() != null){ app.setJobType(JobTypeType.Enum.forString(applicationDescriptor.getJobType())); } app.setInstalledParentPath(applicationDescriptor.getInstalledPath()); app.setJobSubmitterCommand(applicationDescriptor.getJobSubmitterCommand()); app.setMaxMemory(applicationDescriptor.getMaxMemory()); app.setMinMemory(applicationDescriptor.getMinMemory()); app.setMaxWallTime(applicationDescriptor.getMaxWallTime()); app.setNodeCount(applicationDescriptor.getNodeCount()); app.setProcessorsPerNode(applicationDescriptor.getProcessorsPerNode()); QueueType queueType = app.addNewQueue(); if (applicationDescriptor.getQueueName() != null){ queueType.setQueueName(applicationDescriptor.getQueueName()); } app.setQueue(queueType); return appDesc; } } return applicationDescription; } public static ApplicationDescriptor createApplicationDescriptor (ApplicationDescription applicationDescription){ ApplicationDescriptor applicationDescriptor = new ApplicationDescriptor(); applicationDescriptor.setName(applicationDescription.getType().getApplicationName().getStringValue()); applicationDescriptor.setExecutablePath(applicationDescription.getType().getExecutableLocation()); applicationDescriptor.setWorkingDir(applicationDescription.getType().getScratchWorkingDirectory()); if (applicationDescription.getType().getInputDataDirectory() != null && !applicationDescription.getType().getInputDataDirectory().equals("") ){ applicationDescriptor.setInputDir(applicationDescription.getType().getInputDataDirectory()); } if (applicationDescription.getType().getOutputDataDirectory() != null && !applicationDescription.getType().getOutputDataDirectory().equals("")){ applicationDescriptor.setOutputDir(applicationDescription.getType().getOutputDataDirectory()); } if (applicationDescription.getType().getStaticWorkingDirectory() != null && !applicationDescription.getType().getStaticWorkingDirectory().equals("")){ applicationDescriptor.setStaticWorkigDir(applicationDescription.getType().getStaticWorkingDirectory()); } if (applicationDescription.getType().getStandardInput() != null && !applicationDescription.getType().getStandardInput().equals("")){ applicationDescriptor.setStdIn(applicationDescription.getType().getStandardInput()); } if (applicationDescription.getType().getStandardOutput() != null && !applicationDescription.getType().getStandardOutput().equals("")){ applicationDescriptor.setStdOut(applicationDescription.getType().getStandardOutput()); } if (applicationDescription.getType().getStandardError() != null && !applicationDescription.getType().getStandardError().equals("")){ applicationDescriptor.setStdError(applicationDescription.getType().getStandardError()); } NameValuePairType[] environmentArray = applicationDescription.getType().getApplicationEnvironmentArray(); HashMap<String, String> environmentVariableMap = new HashMap<String, String>(); if (environmentArray != null && environmentArray.length != 0){ for (NameValuePairType nameValuePairType : environmentArray){ environmentVariableMap.put(nameValuePairType.getName(), nameValuePairType.getValue()); } applicationDescriptor.setEnvironmentVariables(environmentVariableMap); } if(applicationDescription.getType() != null){ if(applicationDescription.getType() instanceof HpcApplicationDeploymentType){ applicationDescriptor.setApplicationDescType(ApplicationDescriptorTypes.HPC_APP_DEP_DESC_TYPE); HpcApplicationDeploymentType gramApplicationDeploymentType = (HpcApplicationDeploymentType) applicationDescription.getType(); if(gramApplicationDeploymentType != null){ applicationDescriptor.setCpuCount(gramApplicationDeploymentType.getCpuCount()); applicationDescriptor.setNodeCount(gramApplicationDeploymentType.getNodeCount()); applicationDescriptor.setMaxMemory(gramApplicationDeploymentType.getMaxMemory()); applicationDescriptor.setMinMemory(gramApplicationDeploymentType.getMinMemory()); applicationDescriptor.setMaxWallTime(gramApplicationDeploymentType.getMaxWallTime()); applicationDescriptor.setJobSubmitterCommand(gramApplicationDeploymentType.getJobSubmitterCommand()); applicationDescriptor.setInstalledPath(gramApplicationDeploymentType.getInstalledParentPath()); if (gramApplicationDeploymentType.getJobType() != null) { applicationDescriptor.setJobType(gramApplicationDeploymentType.getJobType().toString()); } if (gramApplicationDeploymentType.getProjectAccount() != null){ if (gramApplicationDeploymentType.getProjectAccount().getProjectAccountNumber() != null){ applicationDescriptor.setProjectNumber(gramApplicationDeploymentType.getProjectAccount().getProjectAccountNumber()); } } if (gramApplicationDeploymentType.getProjectAccount() != null){ if (gramApplicationDeploymentType.getProjectAccount().getProjectAccountDescription() != null){ applicationDescriptor.setProjectDescription(gramApplicationDeploymentType.getProjectAccount().getProjectAccountDescription()); } } if(gramApplicationDeploymentType.getQueue() != null){ applicationDescriptor.setQueueName(gramApplicationDeploymentType.getQueue().getQueueName()); } applicationDescriptor.setProcessorsPerNode(gramApplicationDeploymentType.getProcessorsPerNode()); } } else if (applicationDescription.getType() instanceof Ec2ApplicationDeploymentType) { applicationDescriptor.setApplicationDescType(ApplicationDescriptorTypes.EC2_APP_DEP_DESC_TYPE); } } return applicationDescriptor; } }
29,835
0.693648
0.692274
483
60.770187
38.538128
182
false
false
0
0
0
0
0
0
0.639752
false
false
13
bc3308269a20e837c12f24301240a58cabb3b2a2
24,051,816,915,333
8429de2629b48fa4377a22065e2eb1f415f44d0b
/SeleniumWebDriverManager/src/test/java/seleniumframewrok/SeleniumFramewrok18TestNGSauceLabs.java
ac3321847dd65f19039b46d29b10a1dd3ea971b9
[]
no_license
muddassarhussain/Selenium
https://github.com/muddassarhussain/Selenium
55f47c43de926c2432a77db1e2261e0562a44f62
dd531975f3d1516c27a6a2c285e603b971e7b46a
refs/heads/master
2023-04-07T05:24:02.586000
2021-04-21T09:49:25
2021-04-21T09:49:25
333,180,198
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package seleniumframewrok; import java.io.IOException; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import io.github.bonigarcia.wdm.WebDriverManager; import java.net.*; /* * "Ignore" will ignore all the test inside a class */ // @Ignore public class SeleniumFramewrok18TestNGSauceLabs{ // public static WebDriver driver=null; public static String SAUCE_USERNAME="muddassarhussain"; public static String SAUCE_ACCESS_KEY="e137dd3d-77d6-40a1-8285-c3815a755e46"; public static final String URL = "https://" + SAUCE_USERNAME + ":" + SAUCE_ACCESS_KEY + "@ondemand.eu-central-1.saucelabs.com:443/wd/hub"; /*-----------------------------------Main Method-----------------------------------*/ //While running our test in TestNG framework, we do not need Main Method. so we comment it. /*-----------------------------Chrome Code Start Here-----------------------------*/ public static void main(String[] args) throws IOException{ DesiredCapabilities caps = new DesiredCapabilities(); caps.setCapability("os", "Windows"); caps.setCapability("os_version", "10"); caps.setCapability("browserName", "firefox"); caps.setCapability("browser_version", "80"); caps.setCapability("name", "SauceLabs First Test"); caps.setCapability("extendedDebugging", "true"); // caps.setCapability("platform", "Windows XP"); // caps.setCapability("version", "43.0"); // caps.setCapability("name", "SauceLabsTest"); // WebDriverManager.chromedriver().setup(); // WebDriver driv=new ChromeDriver(); // WebDriver driver = new RemoteWebDriver(new URL(URL), caps); // Write your test here driver.get("https://google.com"); driver.manage().window().maximize(); driver.findElement(By.name( "q")).sendKeys("SauceLabs Selenium Scripts"); driver.findElement(By.name("btnK")).submit(); driver.quit(); /*5th Automation TestNG+SauceLabs Code Ends Here*/ } /*-----------------------------Chrome Code End Here-----------------------------*/ }
UTF-8
Java
2,192
java
SeleniumFramewrok18TestNGSauceLabs.java
Java
[ { "context": "selenium.remote.RemoteWebDriver;\nimport io.github.bonigarcia.wdm.WebDriverManager;\nimport java.net.*;\n\n/*\n * \"", "end": 306, "score": 0.9926414489746094, "start": 296, "tag": "USERNAME", "value": "bonigarcia" }, { "context": "river=null;\n\tpublic static String SA...
null
[]
package seleniumframewrok; import java.io.IOException; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import io.github.bonigarcia.wdm.WebDriverManager; import java.net.*; /* * "Ignore" will ignore all the test inside a class */ // @Ignore public class SeleniumFramewrok18TestNGSauceLabs{ // public static WebDriver driver=null; public static String SAUCE_USERNAME="muddassarhussain"; public static String SAUCE_ACCESS_KEY="e137dd3d-77d6-40a1-8285-c3815a755e46"; public static final String URL = "https://" + SAUCE_USERNAME + ":" + SAUCE_ACCESS_KEY + "@ondemand.eu-central-1.saucelabs.com:443/wd/hub"; /*-----------------------------------Main Method-----------------------------------*/ //While running our test in TestNG framework, we do not need Main Method. so we comment it. /*-----------------------------Chrome Code Start Here-----------------------------*/ public static void main(String[] args) throws IOException{ DesiredCapabilities caps = new DesiredCapabilities(); caps.setCapability("os", "Windows"); caps.setCapability("os_version", "10"); caps.setCapability("browserName", "firefox"); caps.setCapability("browser_version", "80"); caps.setCapability("name", "SauceLabs First Test"); caps.setCapability("extendedDebugging", "true"); // caps.setCapability("platform", "Windows XP"); // caps.setCapability("version", "43.0"); // caps.setCapability("name", "SauceLabsTest"); // WebDriverManager.chromedriver().setup(); // WebDriver driv=new ChromeDriver(); // WebDriver driver = new RemoteWebDriver(new URL(URL), caps); // Write your test here driver.get("https://google.com"); driver.manage().window().maximize(); driver.findElement(By.name( "q")).sendKeys("SauceLabs Selenium Scripts"); driver.findElement(By.name("btnK")).submit(); driver.quit(); /*5th Automation TestNG+SauceLabs Code Ends Here*/ } /*-----------------------------Chrome Code End Here-----------------------------*/ }
2,192
0.654197
0.637318
60
35.549999
29.705458
139
false
false
0
0
0
0
0
0
1.566667
false
false
13
fb62c9074c0cce31fda2c434d9f9648ee8aff443
34,471,407,534,442
2872a03eac363dfe36675ff03b2b369bf9977edc
/miscroservice_user/src/main/java/com/e_commerce/miscroservice/user/vo/SmartUserView.java
118dc8ed04ee061d575ca7dcc1fe5100402d6933
[]
no_license
FancyDaily/e_commerce_miscroservice
https://github.com/FancyDaily/e_commerce_miscroservice
0fcff1dba6067ca4c09e7ee9a17c023eeff2c263
9bd9a164d063cfe8218137d0c4def39b7c285abf
refs/heads/master
2020-09-30T15:11:11.800000
2019-12-11T08:26:53
2019-12-11T08:26:53
227,311,458
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.e_commerce.miscroservice.user.vo; import java.io.Serializable; /** * 功能描述: 人性化的用户实体view * 模块: * 项目:timebank * 版本号:1.0 * 部门:技术研发部 * 公司:浙江晓时信息技术有限公司 * 作者:许方毅 * 邮箱:519029909@qq.com * 创建时间:2019年1月15日 下午4:14:02 ************************************* ************************************* * 修改人: * 修改时间: * 修改内容: * 1. * 2. */ public class SmartUserView implements Serializable { /** * */ private static final long serialVersionUID = 1L; private String idString; private String groupIdString; private String groupName; private String corpNickName; private String name; private String sexString; private String ageString; private String gainTimeString; private String totalComment; private Long id; private String userAccount; private String userTel; private Integer jurisdiction; private String userHeadPortraitPath; private String userPicturePath; private String vxId; private String occupation; private Integer age; private Long birthday; private Integer sex; private String maxEducation; private Integer followNum; private Integer receiptNum; private String remarks; private Integer level; private Long growthValue; private Integer seekHelpNum; private Integer serveNum; private Long surplusTime; private Long freezeTime; private Long publicWelfareTime; private Integer authenticationStatus; private Integer authenticationType; private Integer totalEvaluate; private Integer creditEvaluate; private Integer majorEvaluate; private Integer attitudeEvaluate; private String skill; private Integer integrity; private Integer accreditStatus; private Integer masterStatus; private Integer authStatus; private String inviteCode; private String avaliableStatus; private Integer isCompanyAccount; private Integer isFake; private String extend; private Long createUser; private String createUserName; private Long createTime; private Long updateUser; private String updateUserName; private Long updateTime; private String isValid; private Integer praise; public String getIdString() { return idString; } public void setIdString(String idString) { this.idString = idString; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSexString() { return sexString; } public void setSexString(String sexString) { this.sexString = sexString; } public String getAgeString() { return ageString; } public void setAgeString(String ageString) { this.ageString = ageString; } public String getGainTimeString() { return gainTimeString; } public void setGainTimeString(String gainTimeString) { this.gainTimeString = gainTimeString; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getUserAccount() { return userAccount; } public void setUserAccount(String userAccount) { this.userAccount = userAccount; } public String getUserTel() { return userTel; } public void setUserTel(String userTel) { this.userTel = userTel; } public Integer getJurisdiction() { return jurisdiction; } public void setJurisdiction(Integer jurisdiction) { this.jurisdiction = jurisdiction; } public String getUserHeadPortraitPath() { return userHeadPortraitPath; } public void setUserHeadPortraitPath(String userHeadPortraitPath) { this.userHeadPortraitPath = userHeadPortraitPath; } public String getUserPicturePath() { return userPicturePath; } public void setUserPicturePath(String userPicturePath) { this.userPicturePath = userPicturePath; } public String getVxId() { return vxId; } public void setVxId(String vxId) { this.vxId = vxId; } public String getOccupation() { return occupation; } public void setOccupation(String occupation) { this.occupation = occupation; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } public Long getBirthday() { return birthday; } public void setBirthday(Long birthday) { this.birthday = birthday; } public Integer getSex() { return sex; } public void setSex(Integer sex) { this.sex = sex; } public String getMaxEducation() { return maxEducation; } public void setMaxEducation(String maxEducation) { this.maxEducation = maxEducation; } public Integer getFollowNum() { return followNum; } public void setFollowNum(Integer followNum) { this.followNum = followNum; } public Integer getReceiptNum() { return receiptNum; } public void setReceiptNum(Integer receiptNum) { this.receiptNum = receiptNum; } public String getRemarks() { return remarks; } public void setRemarks(String remarks) { this.remarks = remarks; } public Integer getLevel() { return level; } public void setLevel(Integer level) { this.level = level; } public Long getGrowthValue() { return growthValue; } public void setGrowthValue(Long growthValue) { this.growthValue = growthValue; } public Integer getSeekHelpNum() { return seekHelpNum; } public void setSeekHelpNum(Integer seekHelpNum) { this.seekHelpNum = seekHelpNum; } public Integer getServeNum() { return serveNum; } public void setServeNum(Integer serveNum) { this.serveNum = serveNum; } public Long getSurplusTime() { return surplusTime; } public void setSurplusTime(Long surplusTime) { this.surplusTime = surplusTime; } public Long getFreezeTime() { return freezeTime; } public void setFreezeTime(Long freezeTime) { this.freezeTime = freezeTime; } public Long getPublicWelfareTime() { return publicWelfareTime; } public void setPublicWelfareTime(Long publicWelfareTime) { this.publicWelfareTime = publicWelfareTime; } public Integer getAuthenticationStatus() { return authenticationStatus; } public void setAuthenticationStatus(Integer authenticationStatus) { this.authenticationStatus = authenticationStatus; } public Integer getAuthenticationType() { return authenticationType; } public void setAuthenticationType(Integer authenticationType) { this.authenticationType = authenticationType; } public Integer getTotalEvaluate() { return totalEvaluate; } public void setTotalEvaluate(Integer totalEvaluate) { this.totalEvaluate = totalEvaluate; } public Integer getCreditEvaluate() { return creditEvaluate; } public void setCreditEvaluate(Integer creditEvaluate) { this.creditEvaluate = creditEvaluate; } public Integer getMajorEvaluate() { return majorEvaluate; } public void setMajorEvaluate(Integer majorEvaluate) { this.majorEvaluate = majorEvaluate; } public Integer getAttitudeEvaluate() { return attitudeEvaluate; } public void setAttitudeEvaluate(Integer attitudeEvaluate) { this.attitudeEvaluate = attitudeEvaluate; } public String getSkill() { return skill; } public void setSkill(String skill) { this.skill = skill; } public Integer getIntegrity() { return integrity; } public void setIntegrity(Integer integrity) { this.integrity = integrity; } public Integer getAccreditStatus() { return accreditStatus; } public void setAccreditStatus(Integer accreditStatus) { this.accreditStatus = accreditStatus; } public Integer getMasterStatus() { return masterStatus; } public void setMasterStatus(Integer masterStatus) { this.masterStatus = masterStatus; } public Integer getAuthStatus() { return authStatus; } public void setAuthStatus(Integer authStatus) { this.authStatus = authStatus; } public String getInviteCode() { return inviteCode; } public void setInviteCode(String inviteCode) { this.inviteCode = inviteCode; } public String getAvaliableStatus() { return avaliableStatus; } public void setAvaliableStatus(String avaliableStatus) { this.avaliableStatus = avaliableStatus; } public Integer getIsCompanyAccount() { return isCompanyAccount; } public void setIsCompanyAccount(Integer isCompanyAccount) { this.isCompanyAccount = isCompanyAccount; } public Integer getIsFake() { return isFake; } public void setIsFake(Integer isFake) { this.isFake = isFake; } public String getExtend() { return extend; } public void setExtend(String extend) { this.extend = extend; } public Long getCreateUser() { return createUser; } public void setCreateUser(Long createUser) { this.createUser = createUser; } public String getCreateUserName() { return createUserName; } public void setCreateUserName(String createUserName) { this.createUserName = createUserName; } public Long getCreateTime() { return createTime; } public void setCreateTime(Long createTime) { this.createTime = createTime; } public Long getUpdateUser() { return updateUser; } public void setUpdateUser(Long updateUser) { this.updateUser = updateUser; } public String getUpdateUserName() { return updateUserName; } public void setUpdateUserName(String updateUserName) { this.updateUserName = updateUserName; } public Long getUpdateTime() { return updateTime; } public void setUpdateTime(Long updateTime) { this.updateTime = updateTime; } public String getIsValid() { return isValid; } public void setIsValid(String isValid) { this.isValid = isValid; } public Integer getPraise() { return praise; } public void setPraise(Integer praise) { this.praise = praise; } public String getTotalComment() { return totalComment; } public void setTotalComment(String totalComment) { this.totalComment = totalComment; } public String getCorpNickName() { return corpNickName; } public void setCorpNickName(String corpNickName) { this.corpNickName = corpNickName; } public String getGroupName() { return groupName; } public void setGroupName(String groupName) { this.groupName = groupName; } public String getGroupIdString() { return groupIdString; } public void setGroupIdString(String groupIdString) { this.groupIdString = groupIdString; } }
UTF-8
Java
10,326
java
SmartUserView.java
Java
[ { "context": "k\n * 版本号:1.0\n * 部门:技术研发部\n * 公司:浙江晓时信息技术有限公司\n * 作者:许方毅\n * 邮箱:519029909@qq.com\n * 创建时间:2019年1月15日 下午4:14:", "end": 176, "score": 0.9998410940170288, "start": 173, "tag": "NAME", "value": "许方毅" }, { "context": ".0\n * 部门:技术研发部\n * 公司:浙江晓时信息技术有限公司\n * 作者:许方毅\n * 邮箱:51...
null
[]
package com.e_commerce.miscroservice.user.vo; import java.io.Serializable; /** * 功能描述: 人性化的用户实体view * 模块: * 项目:timebank * 版本号:1.0 * 部门:技术研发部 * 公司:浙江晓时信息技术有限公司 * 作者:许方毅 * 邮箱:<EMAIL> * 创建时间:2019年1月15日 下午4:14:02 ************************************* ************************************* * 修改人: * 修改时间: * 修改内容: * 1. * 2. */ public class SmartUserView implements Serializable { /** * */ private static final long serialVersionUID = 1L; private String idString; private String groupIdString; private String groupName; private String corpNickName; private String name; private String sexString; private String ageString; private String gainTimeString; private String totalComment; private Long id; private String userAccount; private String userTel; private Integer jurisdiction; private String userHeadPortraitPath; private String userPicturePath; private String vxId; private String occupation; private Integer age; private Long birthday; private Integer sex; private String maxEducation; private Integer followNum; private Integer receiptNum; private String remarks; private Integer level; private Long growthValue; private Integer seekHelpNum; private Integer serveNum; private Long surplusTime; private Long freezeTime; private Long publicWelfareTime; private Integer authenticationStatus; private Integer authenticationType; private Integer totalEvaluate; private Integer creditEvaluate; private Integer majorEvaluate; private Integer attitudeEvaluate; private String skill; private Integer integrity; private Integer accreditStatus; private Integer masterStatus; private Integer authStatus; private String inviteCode; private String avaliableStatus; private Integer isCompanyAccount; private Integer isFake; private String extend; private Long createUser; private String createUserName; private Long createTime; private Long updateUser; private String updateUserName; private Long updateTime; private String isValid; private Integer praise; public String getIdString() { return idString; } public void setIdString(String idString) { this.idString = idString; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSexString() { return sexString; } public void setSexString(String sexString) { this.sexString = sexString; } public String getAgeString() { return ageString; } public void setAgeString(String ageString) { this.ageString = ageString; } public String getGainTimeString() { return gainTimeString; } public void setGainTimeString(String gainTimeString) { this.gainTimeString = gainTimeString; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getUserAccount() { return userAccount; } public void setUserAccount(String userAccount) { this.userAccount = userAccount; } public String getUserTel() { return userTel; } public void setUserTel(String userTel) { this.userTel = userTel; } public Integer getJurisdiction() { return jurisdiction; } public void setJurisdiction(Integer jurisdiction) { this.jurisdiction = jurisdiction; } public String getUserHeadPortraitPath() { return userHeadPortraitPath; } public void setUserHeadPortraitPath(String userHeadPortraitPath) { this.userHeadPortraitPath = userHeadPortraitPath; } public String getUserPicturePath() { return userPicturePath; } public void setUserPicturePath(String userPicturePath) { this.userPicturePath = userPicturePath; } public String getVxId() { return vxId; } public void setVxId(String vxId) { this.vxId = vxId; } public String getOccupation() { return occupation; } public void setOccupation(String occupation) { this.occupation = occupation; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } public Long getBirthday() { return birthday; } public void setBirthday(Long birthday) { this.birthday = birthday; } public Integer getSex() { return sex; } public void setSex(Integer sex) { this.sex = sex; } public String getMaxEducation() { return maxEducation; } public void setMaxEducation(String maxEducation) { this.maxEducation = maxEducation; } public Integer getFollowNum() { return followNum; } public void setFollowNum(Integer followNum) { this.followNum = followNum; } public Integer getReceiptNum() { return receiptNum; } public void setReceiptNum(Integer receiptNum) { this.receiptNum = receiptNum; } public String getRemarks() { return remarks; } public void setRemarks(String remarks) { this.remarks = remarks; } public Integer getLevel() { return level; } public void setLevel(Integer level) { this.level = level; } public Long getGrowthValue() { return growthValue; } public void setGrowthValue(Long growthValue) { this.growthValue = growthValue; } public Integer getSeekHelpNum() { return seekHelpNum; } public void setSeekHelpNum(Integer seekHelpNum) { this.seekHelpNum = seekHelpNum; } public Integer getServeNum() { return serveNum; } public void setServeNum(Integer serveNum) { this.serveNum = serveNum; } public Long getSurplusTime() { return surplusTime; } public void setSurplusTime(Long surplusTime) { this.surplusTime = surplusTime; } public Long getFreezeTime() { return freezeTime; } public void setFreezeTime(Long freezeTime) { this.freezeTime = freezeTime; } public Long getPublicWelfareTime() { return publicWelfareTime; } public void setPublicWelfareTime(Long publicWelfareTime) { this.publicWelfareTime = publicWelfareTime; } public Integer getAuthenticationStatus() { return authenticationStatus; } public void setAuthenticationStatus(Integer authenticationStatus) { this.authenticationStatus = authenticationStatus; } public Integer getAuthenticationType() { return authenticationType; } public void setAuthenticationType(Integer authenticationType) { this.authenticationType = authenticationType; } public Integer getTotalEvaluate() { return totalEvaluate; } public void setTotalEvaluate(Integer totalEvaluate) { this.totalEvaluate = totalEvaluate; } public Integer getCreditEvaluate() { return creditEvaluate; } public void setCreditEvaluate(Integer creditEvaluate) { this.creditEvaluate = creditEvaluate; } public Integer getMajorEvaluate() { return majorEvaluate; } public void setMajorEvaluate(Integer majorEvaluate) { this.majorEvaluate = majorEvaluate; } public Integer getAttitudeEvaluate() { return attitudeEvaluate; } public void setAttitudeEvaluate(Integer attitudeEvaluate) { this.attitudeEvaluate = attitudeEvaluate; } public String getSkill() { return skill; } public void setSkill(String skill) { this.skill = skill; } public Integer getIntegrity() { return integrity; } public void setIntegrity(Integer integrity) { this.integrity = integrity; } public Integer getAccreditStatus() { return accreditStatus; } public void setAccreditStatus(Integer accreditStatus) { this.accreditStatus = accreditStatus; } public Integer getMasterStatus() { return masterStatus; } public void setMasterStatus(Integer masterStatus) { this.masterStatus = masterStatus; } public Integer getAuthStatus() { return authStatus; } public void setAuthStatus(Integer authStatus) { this.authStatus = authStatus; } public String getInviteCode() { return inviteCode; } public void setInviteCode(String inviteCode) { this.inviteCode = inviteCode; } public String getAvaliableStatus() { return avaliableStatus; } public void setAvaliableStatus(String avaliableStatus) { this.avaliableStatus = avaliableStatus; } public Integer getIsCompanyAccount() { return isCompanyAccount; } public void setIsCompanyAccount(Integer isCompanyAccount) { this.isCompanyAccount = isCompanyAccount; } public Integer getIsFake() { return isFake; } public void setIsFake(Integer isFake) { this.isFake = isFake; } public String getExtend() { return extend; } public void setExtend(String extend) { this.extend = extend; } public Long getCreateUser() { return createUser; } public void setCreateUser(Long createUser) { this.createUser = createUser; } public String getCreateUserName() { return createUserName; } public void setCreateUserName(String createUserName) { this.createUserName = createUserName; } public Long getCreateTime() { return createTime; } public void setCreateTime(Long createTime) { this.createTime = createTime; } public Long getUpdateUser() { return updateUser; } public void setUpdateUser(Long updateUser) { this.updateUser = updateUser; } public String getUpdateUserName() { return updateUserName; } public void setUpdateUserName(String updateUserName) { this.updateUserName = updateUserName; } public Long getUpdateTime() { return updateTime; } public void setUpdateTime(Long updateTime) { this.updateTime = updateTime; } public String getIsValid() { return isValid; } public void setIsValid(String isValid) { this.isValid = isValid; } public Integer getPraise() { return praise; } public void setPraise(Integer praise) { this.praise = praise; } public String getTotalComment() { return totalComment; } public void setTotalComment(String totalComment) { this.totalComment = totalComment; } public String getCorpNickName() { return corpNickName; } public void setCorpNickName(String corpNickName) { this.corpNickName = corpNickName; } public String getGroupName() { return groupName; } public void setGroupName(String groupName) { this.groupName = groupName; } public String getGroupIdString() { return groupIdString; } public void setGroupIdString(String groupIdString) { this.groupIdString = groupIdString; } }
10,317
0.727335
0.724784
579
16.602764
17.505421
68
false
false
0
0
0
0
0
0
1.093264
false
false
13
84f72f445a2670adfc6af274dc93429c0c345b30
32,152,125,187,588
a564b72087149dcdb5559dd64a825687d9dfb7c0
/src/cn/edu/swu/book/AddBookServlet.java
f391810770ab5292aed73613c48b57612ffc812e
[]
no_license
dyeeee/JEECourse
https://github.com/dyeeee/JEECourse
17bd3b87bc355038c497eb0d40f17962aaec2585
96a9bc2eaabc9a303a2a01110d3cd2ae9255452a
refs/heads/master
2022-04-20T10:56:14.669000
2020-04-11T13:35:37
2020-04-11T13:35:37
250,267,969
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.edu.swu.book; import java.io.IOException; import java.io.Writer; import java.util.List; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class AddBookServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { this.doPost(request, response); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { //获取参数name和price String name = request.getParameter("name"); String price = request.getParameter("price"); //禁止输入为空的参数 if (name == null || name.isEmpty() || price == null || price.isEmpty()) { throw new IOException("Wrong parameter for create a new book"); } DBTools.addBook(name, Float.valueOf(price)); //重定向回listBookServlet response.sendRedirect("./listBook"); } }
UTF-8
Java
1,029
java
AddBookServlet.java
Java
[]
null
[]
package cn.edu.swu.book; import java.io.IOException; import java.io.Writer; import java.util.List; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class AddBookServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { this.doPost(request, response); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { //获取参数name和price String name = request.getParameter("name"); String price = request.getParameter("price"); //禁止输入为空的参数 if (name == null || name.isEmpty() || price == null || price.isEmpty()) { throw new IOException("Wrong parameter for create a new book"); } DBTools.addBook(name, Float.valueOf(price)); //重定向回listBookServlet response.sendRedirect("./listBook"); } }
1,029
0.698892
0.698892
32
30.03125
29.190628
101
false
false
0
0
0
0
0
0
0.71875
false
false
13
7255e9113d6a8a99beb2ebfa50c31a93cacff71d
12,017,318,505,738
8003fef9de2f354b7f2d034649e502ee46f1bc80
/src/trackafrik/entity/Top.java
64ecdbdec2bbcc69af91211ca8347dcc9cdadd53
[]
no_license
ndjaka/trackAfrik
https://github.com/ndjaka/trackAfrik
7050463effa3792798ff5cc8841b434f5a04ba16
68ba06e6e82e39ab8d51a09bf70a3b5fc46a83ab
refs/heads/master
2020-03-24T23:48:51.589000
2018-08-01T11:51:41
2018-08-01T11:51:41
143,155,313
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package trackafrik.entity; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; /** * * @author InfinixX99 */ public class Top { private StringProperty nom; private StringProperty qte; private StringProperty prix; public Top(String fName, String lName, String email) { this.nom = new SimpleStringProperty(fName); this.qte = new SimpleStringProperty(lName); this.prix = new SimpleStringProperty(email); } public void setNom(StringProperty nom) { this.nom = nom; } public void setQte(StringProperty qte) { this.qte = qte; } public void setPrix(StringProperty prix) { this.prix = prix; } public StringProperty nomProperty() { return nom; } public StringProperty qteProperty() { return qte; } public StringProperty prixProperty() { return prix; } }
UTF-8
Java
1,134
java
Top.java
Java
[ { "context": ".beans.property.StringProperty;\n\n/**\n *\n * @author InfinixX99\n */\npublic class Top {\n \n private StringPro", "end": 338, "score": 0.9995315670967102, "start": 328, "tag": "USERNAME", "value": "InfinixX99" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package trackafrik.entity; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; /** * * @author InfinixX99 */ public class Top { private StringProperty nom; private StringProperty qte; private StringProperty prix; public Top(String fName, String lName, String email) { this.nom = new SimpleStringProperty(fName); this.qte = new SimpleStringProperty(lName); this.prix = new SimpleStringProperty(email); } public void setNom(StringProperty nom) { this.nom = nom; } public void setQte(StringProperty qte) { this.qte = qte; } public void setPrix(StringProperty prix) { this.prix = prix; } public StringProperty nomProperty() { return nom; } public StringProperty qteProperty() { return qte; } public StringProperty prixProperty() { return prix; } }
1,134
0.661376
0.659612
50
21.68
20.858034
79
false
false
0
0
0
0
0
0
0.4
false
false
13
402728024e71c5bdf92ec58d8ad62f1031a78409
17,824,114,286,757
2fc312601004acdb37e9e79fed26056f6f873526
/app/src/main/java/com/alejandro/aplicaciondelistalittle/model/Tag.java
5b4f923f6959657f4f6fa73033ba6e6b64433107
[]
no_license
alelasesino/AplicacionDeListaLittle
https://github.com/alelasesino/AplicacionDeListaLittle
41cd85c285ce802d7c772d6a6603ae1dddd7bc94
c15668b8dcb0ae1d08e6db56fc8c4f0b81417beb
refs/heads/master
2020-12-13T02:25:07.940000
2020-01-16T11:38:43
2020-01-16T11:38:43
234,287,248
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.alejandro.aplicaciondelistalittle.model; import android.os.Parcel; import android.os.Parcelable; public class Tag implements Parcelable { private int id; private String tag; public Tag(String tag) { this.id = -1; this.tag = tag; } protected Tag(int id, String tag) { this.id = id; this.tag = tag; } protected Tag(Parcel in) { id = in.readInt(); tag = in.readString(); } public static final Creator<Tag> CREATOR = new Creator<Tag>() { @Override public Tag createFromParcel(Parcel in) { return new Tag(in); } @Override public Tag[] newArray(int size) { return new Tag[size]; } }; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getTag() { return tag; } public void setTag(String tag) { this.tag = tag; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel parcel, int i) { parcel.writeInt(id); parcel.writeString(tag); } }
UTF-8
Java
1,208
java
Tag.java
Java
[]
null
[]
package com.alejandro.aplicaciondelistalittle.model; import android.os.Parcel; import android.os.Parcelable; public class Tag implements Parcelable { private int id; private String tag; public Tag(String tag) { this.id = -1; this.tag = tag; } protected Tag(int id, String tag) { this.id = id; this.tag = tag; } protected Tag(Parcel in) { id = in.readInt(); tag = in.readString(); } public static final Creator<Tag> CREATOR = new Creator<Tag>() { @Override public Tag createFromParcel(Parcel in) { return new Tag(in); } @Override public Tag[] newArray(int size) { return new Tag[size]; } }; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getTag() { return tag; } public void setTag(String tag) { this.tag = tag; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel parcel, int i) { parcel.writeInt(id); parcel.writeString(tag); } }
1,208
0.550497
0.548841
64
17.875
15.909411
67
false
false
0
0
0
0
0
0
0.359375
false
false
13
4de751c8e8d56d5ecc5bb542959f0966f611f14c
20,031,727,495,676
cca38c93834201b5931154284d1b5115d04ae549
/msf-starters/msf-aop-log-starter/src/main/java/cn/com/git/msf/starters/aop/log/LogAopAutoConfig.java
15c179b6bde15df66b58a8d255a0ccd2802dfba2
[]
no_license
gspandy/msf
https://github.com/gspandy/msf
f65677214882cf27fd36bdd5519f2630d269ff13
127892f30a13679668070761ec9c2f3af54f1a24
refs/heads/master
2023-08-09T22:25:26.436000
2016-09-06T09:28:15
2016-09-06T09:28:15
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.com.git.msf.starters.aop.log; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; /** * @author serj * @version [版本号, 2016/7/28] */ @Configuration @ConfigurationProperties(prefix = "msf.aop.log") @ComponentScan(basePackages = {"cn.com.git.msf.starters.aop.log.aop"}) public class LogAopAutoConfig { }
UTF-8
Java
469
java
LogAopAutoConfig.java
Java
[ { "context": ".context.annotation.Configuration;\n\n/**\n * @author serj\n * @version [版本号, 2016/7/28]\n */\n@Configuration\n@", "end": 260, "score": 0.999686598777771, "start": 256, "tag": "USERNAME", "value": "serj" } ]
null
[]
package cn.com.git.msf.starters.aop.log; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; /** * @author serj * @version [版本号, 2016/7/28] */ @Configuration @ConfigurationProperties(prefix = "msf.aop.log") @ComponentScan(basePackages = {"cn.com.git.msf.starters.aop.log.aop"}) public class LogAopAutoConfig { }
469
0.790497
0.775378
15
29.866667
26.373894
75
false
false
0
0
0
0
0
0
0.333333
false
false
13
01b3ab730912e231cb302647090aa3739eb2d044
23,132,693,902,978
60194b0dcb7600a7229a528fdffa8ee1214f5daf
/Proyectoweb/Contructora/src/java/DAO/AdministradorDAO.java
07eb8dc6c5374e4de577ebe6c9d54ae3ad8d4556
[]
no_license
andresferia/Proyectoweb
https://github.com/andresferia/Proyectoweb
15539ccf372f7bbc336b979505100c04b4b6342c
44b578fb4d73d83cb9719ecb9efadc21825443d1
refs/heads/master
2018-10-12T12:51:30.314000
2018-07-14T06:44:56
2018-07-14T06:44:56
140,183,886
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package DAO; import BEAN.AdministradorBean; import UTIL.ConexionBD; import java.sql.*; import java.util.ArrayList; public class AdministradorDAO { Connection cn=null; PreparedStatement pt=null; ResultSet rs=null; public boolean validarAdministrador(AdministradorBean objadministradorBean) { boolean validar=false; try{ //CODIGOS PARA LA CONEXION ConexionBD objconexion=new ConexionBD(); cn=objconexion.getConexionBD();//ACA LO CONECTAMOS CON LA BASE DE DATOS pt=cn.prepareStatement("select * from usuario where Username=? and Clave=? "); //CREAMOS LA SENTENCIA A PROCESAR EN LA BASE DE DATOS pt.setString(1, objadministradorBean.getUsername()); pt.setString(2, objadministradorBean.getClave()); rs=pt.executeQuery(); //GUARDAMOS TODOS LOS CAMBIOS HECHOS CON LA BASE DE DATOS //CREAMO UNA CONDICIONAL SI TODO MARCHA BIEN if(rs.next()) { validar=true; } //CERRAMOS LOS REGISTROS DE LA BASE DE DATOS pt.close(); rs.close(); cn.close(); }catch(Exception e) { } return validar; } public void RegistrarAccesoAdministrador (AdministradorBean objadministradorpersonalBean) { try{ ConexionBD objconexion=new ConexionBD(); //CONEXION cn=objconexion.getConexionBD(); pt=cn.prepareStatement("insert into usuario values(?,?,?,?,?,?,?,?,?,?,?,?) ;"); //DECLARAMOS LA SENTENCIA SQL // CallableStatement smt = cn.prepareCall("{call RegistrarAccesoTrabajador(?,?,?,?,?,?,?,?,?,?,?,?)}"); //CAPTURAMOS LOS DATOS INGRESADOS PARA AÑADIRLOS A LA BASE DE DATOS pt.executeUpdate(); pt.close(); }catch(Exception e) { } } //CREAMOS EL OBJETO ADMINISTRADORPERSONALBEAN DE LA CLASE ADMINISTRADORPERSONALBEAN AdministradorBean objadministradorpersonalBean=null; //CREAMOS EL ARRAYLIST DE TIPO ADMINISTRADORPERSONALBEAN Y CREAMOS EL OBJETO LISTA ArrayList<AdministradorBean> lista=new ArrayList<AdministradorBean>(); //CREAMOS EL METODO ARRAYLIST CON LOS VALORES DE ADMINISTRADORPERSONALBEAN public ArrayList<AdministradorBean> ListarAdministradores() { try{ ConexionBD objconexion=new ConexionBD(); //CONEXION cn=objconexion.getConexionBD(); pt=cn.prepareStatement("select * from usuario where codtipo=2 "); // CallableStatement smt = cn.prepareCall("{call ListarAdministradores()}"); rs=pt.executeQuery(); while(rs.next()) { objadministradorpersonalBean=new AdministradorBean(); //CAPTURAMOS LOS VALORES DE LA BASE DE DATOS DE LA CONSTRUCTORA lista.add(objadministradorpersonalBean); } //CERRAMOS LA CONEXION pt.close(); rs.close(); cn.close(); }catch(Exception e) { } return lista; } }
UTF-8
Java
3,207
java
AdministradorDAO.java
Java
[]
null
[]
package DAO; import BEAN.AdministradorBean; import UTIL.ConexionBD; import java.sql.*; import java.util.ArrayList; public class AdministradorDAO { Connection cn=null; PreparedStatement pt=null; ResultSet rs=null; public boolean validarAdministrador(AdministradorBean objadministradorBean) { boolean validar=false; try{ //CODIGOS PARA LA CONEXION ConexionBD objconexion=new ConexionBD(); cn=objconexion.getConexionBD();//ACA LO CONECTAMOS CON LA BASE DE DATOS pt=cn.prepareStatement("select * from usuario where Username=? and Clave=? "); //CREAMOS LA SENTENCIA A PROCESAR EN LA BASE DE DATOS pt.setString(1, objadministradorBean.getUsername()); pt.setString(2, objadministradorBean.getClave()); rs=pt.executeQuery(); //GUARDAMOS TODOS LOS CAMBIOS HECHOS CON LA BASE DE DATOS //CREAMO UNA CONDICIONAL SI TODO MARCHA BIEN if(rs.next()) { validar=true; } //CERRAMOS LOS REGISTROS DE LA BASE DE DATOS pt.close(); rs.close(); cn.close(); }catch(Exception e) { } return validar; } public void RegistrarAccesoAdministrador (AdministradorBean objadministradorpersonalBean) { try{ ConexionBD objconexion=new ConexionBD(); //CONEXION cn=objconexion.getConexionBD(); pt=cn.prepareStatement("insert into usuario values(?,?,?,?,?,?,?,?,?,?,?,?) ;"); //DECLARAMOS LA SENTENCIA SQL // CallableStatement smt = cn.prepareCall("{call RegistrarAccesoTrabajador(?,?,?,?,?,?,?,?,?,?,?,?)}"); //CAPTURAMOS LOS DATOS INGRESADOS PARA AÑADIRLOS A LA BASE DE DATOS pt.executeUpdate(); pt.close(); }catch(Exception e) { } } //CREAMOS EL OBJETO ADMINISTRADORPERSONALBEAN DE LA CLASE ADMINISTRADORPERSONALBEAN AdministradorBean objadministradorpersonalBean=null; //CREAMOS EL ARRAYLIST DE TIPO ADMINISTRADORPERSONALBEAN Y CREAMOS EL OBJETO LISTA ArrayList<AdministradorBean> lista=new ArrayList<AdministradorBean>(); //CREAMOS EL METODO ARRAYLIST CON LOS VALORES DE ADMINISTRADORPERSONALBEAN public ArrayList<AdministradorBean> ListarAdministradores() { try{ ConexionBD objconexion=new ConexionBD(); //CONEXION cn=objconexion.getConexionBD(); pt=cn.prepareStatement("select * from usuario where codtipo=2 "); // CallableStatement smt = cn.prepareCall("{call ListarAdministradores()}"); rs=pt.executeQuery(); while(rs.next()) { objadministradorpersonalBean=new AdministradorBean(); //CAPTURAMOS LOS VALORES DE LA BASE DE DATOS DE LA CONSTRUCTORA lista.add(objadministradorpersonalBean); } //CERRAMOS LA CONEXION pt.close(); rs.close(); cn.close(); }catch(Exception e) { } return lista; } }
3,207
0.596694
0.595758
90
34.611111
31.928286
147
false
false
0
0
0
0
0
0
0.711111
false
false
13
d3fda680f096080cf64bf0481cf95b2dd1c8aa74
10,840,497,492,076
cecce187f9a335d686bfd1020b091419454c3b1f
/src/com/willemhustinx/games/world/Level.java
5ec61a577f6732cf48fa8ef83f46e6c104fe1ba9
[]
no_license
willemhustinx/2DGame
https://github.com/willemhustinx/2DGame
cd0c4ed400a71eaa1b6f2715501b7eddf7846295
8ee0ec3c648c19f60880d591675c51f920f6c131
refs/heads/master
2021-08-22T13:26:59.401000
2017-10-12T14:01:54
2017-10-12T14:01:54
106,204,481
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.willemhustinx.games.world; import com.willemhustinx.games.gfx.Color; import com.willemhustinx.games.gfx.Screen; public class Level { public int w, h; public Level(int width, int height) { this.w = width; this.h = height; } public void tick() { } public void renderBackground(Screen screen, int xScroll, int yScroll) { int col = Color.get(0, 555, 555, 555); for (int y = 0; y <= h; y++) { for (int x = 0; x <= w; x++) { //screen.render(x * 16 + 0, y * 16 + 0, 0, col, 0); screen.render(x * 8, y * 8, 0, col, 0); } } } } /* /** This method renders all the tiles in the game * public void renderBackground(Screen screen, int xScroll, int yScroll) { int xo = xScroll >> 4; // the game's horizontal scroll offset. int yo = yScroll >> 4; // the game's vertical scroll offset. int w = (screen.w + 15) >> 4; // width of the screen being rendered int h = (screen.h + 15) >> 4; // height of the screen being rendered screen.setOffset(xScroll, yScroll); // sets the scroll offsets. for (int y = yo; y <= h + yo; y++) { // loops through the vertical positions for (int x = xo; x <= w + xo; x++) { // loops through the horizontal positions getTile(x, y).render(screen, this, x, y); // renders the tile on the screen } } screen.setOffset(0, 0); // resets the offset. } */
UTF-8
Java
1,467
java
Level.java
Java
[]
null
[]
package com.willemhustinx.games.world; import com.willemhustinx.games.gfx.Color; import com.willemhustinx.games.gfx.Screen; public class Level { public int w, h; public Level(int width, int height) { this.w = width; this.h = height; } public void tick() { } public void renderBackground(Screen screen, int xScroll, int yScroll) { int col = Color.get(0, 555, 555, 555); for (int y = 0; y <= h; y++) { for (int x = 0; x <= w; x++) { //screen.render(x * 16 + 0, y * 16 + 0, 0, col, 0); screen.render(x * 8, y * 8, 0, col, 0); } } } } /* /** This method renders all the tiles in the game * public void renderBackground(Screen screen, int xScroll, int yScroll) { int xo = xScroll >> 4; // the game's horizontal scroll offset. int yo = yScroll >> 4; // the game's vertical scroll offset. int w = (screen.w + 15) >> 4; // width of the screen being rendered int h = (screen.h + 15) >> 4; // height of the screen being rendered screen.setOffset(xScroll, yScroll); // sets the scroll offsets. for (int y = yo; y <= h + yo; y++) { // loops through the vertical positions for (int x = xo; x <= w + xo; x++) { // loops through the horizontal positions getTile(x, y).render(screen, this, x, y); // renders the tile on the screen } } screen.setOffset(0, 0); // resets the offset. } */
1,467
0.570552
0.547376
50
28.360001
29.092789
87
false
false
0
0
0
0
0
0
0.94
false
false
13
2f7f00c40a442f542751e6e5d0236a3832eb3743
1,460,288,896,851
255ff79057c0ff14d0b760fc2d6da1165f1806c8
/08Advanced/02资料-解密JVM/代码/jvm/src/cn/itcast/jvm/t3/load/Load5_2.java
dd9c2f9bb805e5d340dd25bba8a942e05e37a7db
[]
no_license
wjphappy90/Resource
https://github.com/wjphappy90/Resource
7f1f817d323db5adae06d26da17dfc09ee5f9d3a
6574c8399f3cdfb6d6b39cd64dc9507e784a2549
refs/heads/master
2022-07-30T03:33:59.869000
2020-08-10T02:31:35
2020-08-10T02:31:35
285,701,650
2
6
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.itcast.jvm.t3.load; /** * 演示 扩展类加载器 * 在 C:\Program Files\Java\jdk1.8.0_91 下有一个 my.jar * 里面也有一个 G 的类,观察到底是哪个类被加载了 */ public class Load5_2 { public static void main(String[] args) throws ClassNotFoundException { Class<?> aClass = Class.forName("cn.itcast.jvm.t3.load.G"); System.out.println(aClass.getClassLoader()); } }
UTF-8
Java
428
java
Load5_2.java
Java
[]
null
[]
package cn.itcast.jvm.t3.load; /** * 演示 扩展类加载器 * 在 C:\Program Files\Java\jdk1.8.0_91 下有一个 my.jar * 里面也有一个 G 的类,观察到底是哪个类被加载了 */ public class Load5_2 { public static void main(String[] args) throws ClassNotFoundException { Class<?> aClass = Class.forName("cn.itcast.jvm.t3.load.G"); System.out.println(aClass.getClassLoader()); } }
428
0.666667
0.641667
13
26.615385
25.208479
74
false
false
0
0
0
0
0
0
0.230769
false
false
13
d90c2d655d866c503d921b005bee454c9aa49270
27,934,467,306,666
03cb378b0b185b65cbaa03920a5d19c489e6514d
/DSA/src/linkedListDSA/MyLinkedList.java
dcd7e21305290a34618219873e72b669bc6e60de
[]
no_license
harshraj4825/dsa
https://github.com/harshraj4825/dsa
010042e6ebc40d239ec4fed05e55d9874ebf8d1d
bd2cbe7bdf0489dcde69bed1f4512570ec0f5933
refs/heads/master
2023-04-25T07:39:53.863000
2021-05-12T06:47:34
2021-05-12T06:47:34
359,862,359
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package linkedListDSA; public class MyLinkedList { private Node head; private int size; public MyLinkedList() { this.head=null; size=0; } class Node { int data; Node next; public Node(int data) { this.data = data; this.next = null; } } Node insert(int data) { Node new_node = new Node(data); // new_node.next = null; if (head == null) { head = new_node; size++; } else { Node last = head; while (last.next != null) { last = last.next; } last.next = new_node; size++; } return head; } int size() { return size; } Node reverse(Node head) { Node revrsedList=null; Node curr=head; Node tempNext=null; while(curr!=null) { tempNext=curr.next; curr.next=revrsedList; revrsedList=curr; curr=tempNext; } return revrsedList; } String print(Node head) { StringBuilder sb=new StringBuilder(); Node temp=head; while(temp!=null) { sb.append(temp.data+"-->"); temp=temp.next; } sb.append("null"); return sb.toString(); } }
UTF-8
Java
1,026
java
MyLinkedList.java
Java
[]
null
[]
package linkedListDSA; public class MyLinkedList { private Node head; private int size; public MyLinkedList() { this.head=null; size=0; } class Node { int data; Node next; public Node(int data) { this.data = data; this.next = null; } } Node insert(int data) { Node new_node = new Node(data); // new_node.next = null; if (head == null) { head = new_node; size++; } else { Node last = head; while (last.next != null) { last = last.next; } last.next = new_node; size++; } return head; } int size() { return size; } Node reverse(Node head) { Node revrsedList=null; Node curr=head; Node tempNext=null; while(curr!=null) { tempNext=curr.next; curr.next=revrsedList; revrsedList=curr; curr=tempNext; } return revrsedList; } String print(Node head) { StringBuilder sb=new StringBuilder(); Node temp=head; while(temp!=null) { sb.append(temp.data+"-->"); temp=temp.next; } sb.append("null"); return sb.toString(); } }
1,026
0.61501
0.614035
63
15.285714
9.818073
39
false
false
0
0
0
0
0
0
2.333333
false
false
13
180af6f26ee6d8c343155e5495928035f6e9e650
1,288,490,203,400
5359690a35a9bea535f8a5dcd44901a5914c9f32
/src/main/java/com/subtickets/servlet/VotingsServlet.java
d3ee3c0f8dcd401fd77fcb1300c0b0ac0d8b85ac
[]
no_license
pshepilov/subtickets-plugin
https://github.com/pshepilov/subtickets-plugin
2a8c957b79edaf1147586912df2612cb24c93560
8c14557384434d1158395be6491d322a0593640c
refs/heads/master
2021-05-11T11:54:48.127000
2019-03-31T12:10:18
2019-03-31T12:10:18
117,647,275
0
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.subtickets.servlet; import javax.inject.Named; import static com.subtickets.Constants.CREATE_SUBS_URL; @Named public class VotingsServlet extends RedirectingServlet { @Override protected String getURL() { return CREATE_SUBS_URL; } }
UTF-8
Java
269
java
VotingsServlet.java
Java
[]
null
[]
package com.subtickets.servlet; import javax.inject.Named; import static com.subtickets.Constants.CREATE_SUBS_URL; @Named public class VotingsServlet extends RedirectingServlet { @Override protected String getURL() { return CREATE_SUBS_URL; } }
269
0.739777
0.739777
15
17
19.349419
56
false
false
0
0
0
0
0
0
0.266667
false
false
13
b6bac3f1df441c6794a95624d6316adb033316d1
12,128,987,661,406
92efff43504858f33966cc11cd77492f4673be37
/src/com/sertek/file/GeneratePDF.java
dd59ca65893194568bb702f6c8500f8ceb5c772d
[]
no_license
biology62027703/MUST
https://github.com/biology62027703/MUST
06b52da32931b45c8d87969c667cac0954f22f6b
a1c062e71ee10742a79c145ac37864d83269f1c6
refs/heads/master
2021-01-25T13:18:32.253000
2018-06-12T02:19:06
2018-06-12T02:19:06
123,553,498
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/*package com.sertek.file; import java.io.File; import java.io.FileOutputStream; import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.apache.log4j.Logger; import sun.font.FontManager; import com.itextpdf.text.BaseColor; import com.itextpdf.text.Chunk; import com.itextpdf.text.Document; import com.itextpdf.text.Element; import com.itextpdf.text.Font; import com.itextpdf.text.PageSize; import com.itextpdf.text.Phrase; import com.itextpdf.text.pdf.BaseFont; import com.itextpdf.text.pdf.ColumnText; import com.itextpdf.text.pdf.PdfContentByte; import com.itextpdf.text.pdf.PdfPCell; import com.itextpdf.text.pdf.PdfPTable; import com.itextpdf.text.pdf.PdfPageEventHelper; import com.itextpdf.text.pdf.PdfWriter; import com.sertek.form.SOLHelper; import com.sertek.ibatis.util.SqlDBUtility; import com.sertek.table.C60; import com.sertek.table.C60_ATT; import com.sertek.table.C60_WEB; import com.sertek.table.C61; import com.sertek.table.C6A; import com.sertek.table.COURT; import com.sertek.util.CheckObject; import com.sertek.util.util_date; import com.sertek.util.utility; public class GeneratePDF { private Logger logger = Logger.getLogger(this.getClass()); private SqlDBUtility sqlDBUtility = null; private HashMap form = new HashMap(); private CheckObject check = new CheckObject(); private utility ut = new utility(); private util_date ud = new util_date(); private Font font = new Font(); private Font redFont = new Font(); private Font blueFont = new Font(); private Font headerFont = new Font(); private Font signFont = new Font(); Document document = null; public GeneratePDF() throws Exception { initFont(); } public class Watermark extends PdfPageEventHelper { protected String text = ""; public Watermark(String text) { this.text = text; } @Override public void onEndPage(PdfWriter writer, Document document) { PdfContentByte canvas = writer.getDirectContentUnder(); String watertxt = String.valueOf(document.getPageNumber()) + " " + text; Phrase watermark = new Phrase( watertxt, font); ColumnText.showTextAligned(canvas, Element.ALIGN_LEFT, watermark, 298, 20, 0); } } *//** * 產生「網頁繕打」的PDF * @param sqlDBUtility * @param form * @param filenm * @throws Exception *//* public void createPDF(SqlDBUtility sqlDBUtility, HashMap form, String filenm) throws Exception { this.sqlDBUtility = sqlDBUtility; this.form = form; try { int marginLeft = -20; int marginRight = -20; int marginTop = 40; int marginBottom = 40; document = new Document(PageSize.A4, marginLeft, marginRight, marginTop, marginBottom); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(filenm)); writer.setPageEvent(new Watermark(getDocumentFooterText())); document.open(); C60 c60 = new C60(); HashMap c60Key = new HashMap(); c60Key.put("crtid", check.checkNull(form.get("crtid"), "")); c60Key.put("sys", check.checkNull(form.get("sys"), "")); c60Key.put("c_no", check.checkNull(form.get("c_no"), "")); List c60List = sqlDBUtility.queryForList("C60.queryByKey", c60Key); if (c60List.size() > 0) { c60 = (C60) c60List.get(0); HashMap courtKey = new HashMap(); courtKey.put("crtid", c60.getCrtid()); List courtList = sqlDBUtility.queryForList("COURT.queryByKey", courtKey); if (courtList.size() > 0) { COURT court = (COURT) courtList.get(0); form.put("crtnm", court.getCrtnm()); } } // 聲請人 C61 c61_1 = new C61(); C6A c6a = new C6A(); HashMap c61Key = new HashMap(); c61Key.put("crtid", check.checkNull(form.get("crtid"), "")); c61Key.put("sys", check.checkNull(form.get("sys"), "")); c61Key.put("c_no", check.checkNull(form.get("c_no"), "")); List c61List1 = sqlDBUtility.queryForList("FGSO1A04.C61_Query1", c61Key); if (c61List1.size() > 0) { c61_1 = (C61) c61List1.get(0); HashMap c6aKey = new HashMap(); c6aKey.put("crtid", c61_1.getCrtid()); c6aKey.put("sys", c61_1.getSys()); c6aKey.put("c_no", c61_1.getC_no()); c6aKey.put("sysid", c61_1.getSysid()); List c6aList = sqlDBUtility.queryForList("FGSO1A04.C6A_Query", c6aKey); if (c6aList.size() > 0) { c6a = (C6A) c6aList.get(0); } } // (機關首長) form.put("leader", getGSOS08Argvl("FGSO1A04", "機關首長")); // 受收容人 C61 c61_2 = new C61(); List c61List2 = sqlDBUtility.queryForList("FGSO1A04.C61_Query2", c61Key); if(c61List2.size() > 0){ c61_2 = (C61) c61List2.get(0); HashMap c91Key = new HashMap(); c91Key.put("st_code", c61_2.getNat()); List c91List = sqlDBUtility.queryForList("C91.queryByKey", c91Key); if (c91List.size() > 0) { C91 c91 = (C91) c91List.get(0); c61_2.setNat(c91.getCdds()); } } C60_WEB web = new C60_WEB(); HashMap webKey = new HashMap(); webKey.put("crtid", check.checkNull(form.get("crtid"), "")); webKey.put("sys", check.checkNull(form.get("sys"), "")); webKey.put("c_no", check.checkNull(form.get("c_no"), "")); webKey.put("s_seq", check.checkNull(form.get("s_seq"), "")); List webList = sqlDBUtility.queryForList("C60_WEB.queryByKey", webKey); if (webList.size() > 0) { web = (C60_WEB) webList.get(0); } createHeader(c60); createBody(c60, c61_1, c6a, c61_2, web); createBody2(web); createBody3(web); createFooter(web); createDocumentFooter(); //CryptoFile.encryptFile(item.getInputStream(), s_filenm); } catch (Exception e) { logger.error(e, e); } finally { if (document != null) { document.close(); } } } *//** * 產生「查看及列印」的PDF * @param sqlDBUtility * @param form * @param filenm * @throws Exception *//* public void createPDF2(SqlDBUtility sqlDBUtility, HashMap form, String filenm) throws Exception { this.sqlDBUtility = sqlDBUtility; this.form = form; try { int marginLeft = -20; int marginRight = -20; int marginTop = 40; int marginBottom = 40; document = new Document(PageSize.A4, marginLeft, marginRight, marginTop, marginBottom); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(filenm)); writer.setPageEvent(new Watermark(getDocumentFooterText())); document.open(); C60 c60 = new C60(); HashMap c60Key = new HashMap(); c60Key.put("crtid", check.checkNull(form.get("crtid"), "")); c60Key.put("sys", check.checkNull(form.get("sys"), "")); c60Key.put("c_no", check.checkNull(form.get("c_no"), "")); List c60List = sqlDBUtility.queryForList("C60.queryByKey", c60Key); if (c60List.size() > 0) { c60 = (C60) c60List.get(0); HashMap courtKey = new HashMap(); courtKey.put("crtid", c60.getCrtid()); List courtList = sqlDBUtility.queryForList("COURT.queryByKey", courtKey); if (courtList.size() > 0) { COURT court = (COURT) courtList.get(0); form.put("crtnm", court.getCrtnm()); } } // 聲請人 C61 c61_1 = new C61(); C6A c6a = new C6A(); HashMap c61Key = new HashMap(); c61Key.put("crtid", check.checkNull(form.get("crtid"), "")); c61Key.put("sys", check.checkNull(form.get("sys"), "")); c61Key.put("c_no", check.checkNull(form.get("c_no"), "")); List c61List1 = sqlDBUtility.queryForList("FGSO1A04.C61_Query1", c61Key); if (c61List1.size() > 0) { c61_1 = (C61) c61List1.get(0); HashMap c6aKey = new HashMap(); c6aKey.put("crtid", c61_1.getCrtid()); c6aKey.put("sys", c61_1.getSys()); c6aKey.put("c_no", c61_1.getC_no()); c6aKey.put("sysid", c61_1.getSysid()); List c6aList = sqlDBUtility.queryForList("FGSO1A04.C6A_Query", c6aKey); if (c6aList.size() > 0) { c6a = (C6A) c6aList.get(0); } } // (機關首長) form.put("leader", getGSOS08Argvl("FGSO1A04", "機關首長")); // 受收容人 C61 c61_2 = new C61(); List c61List2 = sqlDBUtility.queryForList("FGSO1A04.C61_Query2", c61Key); if(c61List2.size() > 0){ c61_2 = (C61) c61List2.get(0); HashMap c91Key = new HashMap(); c91Key.put("st_code", c61_2.getNat()); List c91List = sqlDBUtility.queryForList("C91.queryByKey", c91Key); if (c91List.size() > 0) { C91 c91 = (C91) c91List.get(0); c61_2.setNat(c91.getCdds()); } } C60_WEB web = new C60_WEB(); HashMap webKey = new HashMap(); webKey.put("crtid", check.checkNull(form.get("crtid"), "")); webKey.put("sys", check.checkNull(form.get("sys"), "")); webKey.put("c_no", check.checkNull(form.get("c_no"), "")); webKey.put("s_seq", check.checkNull(form.get("s_seq"), "")); List webList = sqlDBUtility.queryForList("C60_WEB.queryByKey", webKey); if (webList.size() > 0) { web = (C60_WEB) webList.get(0); } createPreHeader(); createHeader(c60); createBody(c60, c61_1, c6a, c61_2, web); createBody2(web); createBody3(web); createFooter(web); createAttList(); createDocumentFooter(); //CryptoFile.encryptFile(item.getInputStream(), s_filenm); } catch (Exception e) { logger.error(e, e); } finally { if (document != null) { document.close(); } } } private void createPreHeader() throws Exception { PdfPTable table = new PdfPTable(2); float[] columnWidths = new float[] { 4f, 16f }; table.setWidths(columnWidths); table.addCell(createCell("注意事項")); Phrase phrase = new Phrase(); phrase.add(new Chunk("您的案件已完成遞狀,\n", font)); phrase.add(new Chunk("收狀日期為", font)); phrase.add(new Chunk("" + ud.formatCDate(check.checkNull(form.get("rcvdt"), "").toString(), "/") + " " + ud.formatTime(check.checkNull(form.get("rcvtm"), "").toString(), ":"), redFont)); phrase.add(new Chunk(",\n", font)); phrase.add(new Chunk("遞狀流水號為", font)); phrase.add(new Chunk("" + check.checkNull(form.get("doc_no"), ""), redFont)); phrase.add(new Chunk(",\n", font)); System.out.println("************************************"); System.out.println(form.toString()); phrase.add(new Chunk("遞狀種類為", font)); //phrase.add(new Chunk("" + SOLHelper.getSuit_nm(check.checkNull(form.get("s_kd"), "").toString()), redFont)); phrase.add(new Chunk(",\n", font)); phrase.add(new Chunk("本案當事人共", font)); phrase.add(new Chunk("" + check.checkNull(form.get("c61Cnt"), ""), redFont)); phrase.add(new Chunk("名、上傳共", font)); phrase.add(new Chunk("" + check.checkNull(form.get("docCnt"), ""), redFont)); phrase.add(new Chunk("個附件。\n", font)); phrase.add(new Chunk("本案後續書狀遞送請由「聲請查詢」功能查詢出本案時,點「遞補充書狀」圖示,接著點選「新增」進行。", blueFont)); table.addCell(createCell(phrase)); document.add(table); document.newPage(); //document.add(new Phrase("\n")); } private void createHeader(C60 c60) throws Exception { PdfPTable table = new PdfPTable(1); float[] columnWidths = new float[] { 1f }; table.setWidths(columnWidths); table.addCell(createHeader(SOLHelper.getSuit_nm(c60.getS_kd()), 1)); document.add(table); } private void createBody(C60 c60, C61 c61_1, C6A c6a, C61 c61_2, C60_WEB web) throws Exception { PdfPTable table = new PdfPTable(5); float[] columnWidths = new float[] { 2f, 2f, 3f, 2f, 1f }; table.setWidths(columnWidths); table.addCell(createCell("案號")); table.addCell(createColspanCell(" " + c60.getCrmyy() + " 年度 " + c60.getCrmid() + " 字第 " + c60.getCrmno() + " 號", 2)); table.addCell(createCell("承辦股別")); table.addCell(createCell(c60.getDpt())); table.addCell(createCell("訴訟標的金額或價額")); table.addCell(createColspanCell("新臺幣 " + ut.Fillspace(web.getS_price(), 16, 0) + " 元", 4)); // 稱謂 table.addCell(createCell("稱謂")); table.addCell(createCell("姓名或名稱")); StringBuffer str1 = new StringBuffer(); str1.append("依序填寫:國民身分證統一編號或營利事業統一編號、性別、出生年月日、職業、住居所、就業處所、公務所、事務所或營業所、郵遞區號、電話、傳真、電子郵件位址、指定送達代收人及其送達處所。"); table.addCell(createColspanCell(str1.toString(), 3)); // 聲請人 table.addCell(createCell("聲請人")); table.addCell(createCell(getSyskdGNm())); StringBuffer str2 = new StringBuffer(); str2.append("設:" + c61_1.getCity() + c61_1.getArea() + c61_1.getAddr() + "\n"); str2.append("送達代收人:" + c6a.getClnm() + "\n"); str2.append("送達處所:" + c6a.getCity() + c6a.getArea() + c6a.getAddr() + "\n"); table.addCell(createColspanCell(str2.toString(), 3)); // 代表人 table.addCell(createCell("代表人")); table.addCell(createCell(check.checkNull(form.get("leader"), "") + "\n" + "(機關首長)")); StringBuffer str3 = new StringBuffer(); str3.append("住同上" + "\n"); table.addCell(createColspanCell(str3.toString(), 3)); // 受收容人 table.addCell(createCell("受收容人")); table.addCell(createCell((c61_2.getClnm().equals("") ? c61_2.getClnm_e() : c61_2.getClnm()) + "\n")); StringBuffer str4 = new StringBuffer(); str4.append("國民身分證統一編號(或" + c61_2.getNat() + "國籍,護照號碼):" + c61_2.getIdno() + "\n"); str4.append("性別:" + formatSex(c61_2.getSex()) + "\n"); str4.append("生日:" + formatBirdt(c61_2.getBirdt()) + "\n"); str4.append("職業:" + c61_2.getPfs() + "\n"); str4.append("住:" + c61_2.getCity() + c61_2.getArea() + c61_2.getAddr() + "\n"); str4.append("郵遞區號:" + c61_2.getZip() + "\n"); str4.append("電話:" + c61_2.getTel() + "\n"); str4.append("傳真:" + c61_2.getFax() + "\n"); str4.append("電子郵件位址:" + c61_2.getEmail() + "\n"); str4.append("*有通譯需求之語言別:" + SOLHelper.getInterp(c61_2.getInterp(), c61_2.getInt_rmk()) + "\n"); table.addCell(createColspanCell(str4.toString(), 3)); document.add(table); } private void createBody2(C60_WEB web) throws Exception { PdfPTable table = new PdfPTable(1); float[] columnWidths = new float[] { 1f }; table.setWidths(columnWidths); table.addCell(this.getBody2Cell(web)); document.add(table); } private PdfPTable getBody2Cell(C60_WEB web) throws Exception { PdfPTable table = new PdfPTable(1); float[] columnWidths = new float[] { 1f }; table.setWidths(columnWidths); StringBuffer stmt = new StringBuffer(); stmt.append(web.getS_stmt() + "\n"); stmt.append("\n"); stmt.append("\n"); stmt.append("  此 致\n"); stmt.append("\n"); stmt.append(check.checkNull(form.get("crtnm"), "") + "行政訴訟庭    公鑒\n"); table.addCell(createColspanCell(stmt.toString(), 0, 1)); return table; } private void createBody3(C60_WEB web) throws Exception { PdfPTable table = new PdfPTable(5); float[] columnWidths = new float[] { 2f, 2f, 3f, 2f, 1f }; table.setWidths(columnWidths); table.addCell(createCell("證物名稱及件數")); table.addCell(createColspanCell(web.getS_evd(), 4)); document.add(table); } private void createFooter(C60_WEB web) throws Exception { PdfPTable table = new PdfPTable(1); float[] columnWidths = new float[] { 1f }; table.setWidths(columnWidths); table.addCell(this.getFootCell()); document.add(table); } private PdfPTable getFootCell() throws Exception { String usrnm = check.checkNull(form.get("usrnm"), "").toString(); String s_opsn = check.checkNull(form.get("s_opsn"), "").toString(); PdfPTable table = new PdfPTable(4); float[] columnWidths = new float[] { 14f, 3f, 2f, 1f }; table.setWidths(columnWidths); StringBuffer str = new StringBuffer(); String sysdt = ud.nowCDate(); str.setLength(0); str.append("中華民國 " + sysdt.substring(0, 3) + " 年 " + sysdt.substring(3, 5) + " 月 " + sysdt.substring(5, 7) + " 日\n"); table.addCell(createColspanCell(str.toString(), 0, 4)); str.setLength(0); str.append("        具狀人 內政部移民署 代表人  "); table.addCell(createColspanCell(str.toString(), 0, 1)); table.addCell(createCell("簽名蓋章 ", 0)); table.addCell(createCell("", 0)); str.setLength(0); str.append("        撰狀人 " + usrnm + " "); table.addCell(createColspanCell(str.toString(), 0, 1)); table.addCell(createCell("簽名蓋章 ", 0)); table.addCell(createSignCell(usrnm)); table.addCell(createCell("", 0)); return table; } private void createAttList() throws Exception { List attList = new ArrayList(); if (form.get("attList") != null) { attList = (List) form.get("attList"); } PdfPTable table = new PdfPTable(5); float[] columnWidths = new float[] { 2f, 6f, 5f, 4f, 3f }; table.setWidths(columnWidths); table.addCell(createCell("序號")); table.addCell(createCell("檔名")); table.addCell(createCell("說明")); table.addCell(createCell("上傳日期")); table.addCell(createCell("檔案大小")); for (int i = 0; i < attList.size(); i++) { C60_ATT att = (C60_ATT) attList.get(i); table.addCell(createCell("" + (i + 1))); table.addCell(createCell(att.getS_file())); table.addCell(createCell(att.getS_fileds())); table.addCell(createCell(ud.formatCDate(att.getS_updt(), "/") + " " + ud.formatTime(att.getS_uptm(), ":"))); table.addCell(createCell(formatFileSize(att.getS_filesz()))); } document.add(new Phrase("\n")); document.add(table); } private void createDocumentFooter() throws Exception { String usrnm = check.checkNull(form.get("usrnm"), "").toString(); PdfPTable table = new PdfPTable(1); float[] columnWidths = new float[] { 1f }; table.setWidths(columnWidths); table.addCell(createLeftFooter("*依實際狀況填載,若無此狀況者免填。", 1)); document.add(table); } private String getDocumentFooterText() throws Exception { String usrnm = check.checkNull(form.get("usrnm"), "").toString(); StringBuffer str = new StringBuffer(); String sysdt = ud.nowCDate(); String systm = ud.nowTime(); str.setLength(0); str.append(sysdt.substring(0, 3) + "年" + sysdt.substring(3, 5) + "月" + sysdt.substring(5, 7) + "日"); str.append(systm.substring(0, 2) + "時" + systm.substring(2, 4) + "分" + systm.substring(4, 6) + "秒"); str.append(" " + usrnm + " " + "印"); return str.toString(); } private String formatSex(String sex) { if ("M".equals(sex)) { return "男"; } else if ("F".equals(sex)) { return "女"; } else if ("C".equals(sex)) { return "法人"; } else if ("G".equals(sex)) { return "中央及地方機關"; } else if ("O".equals(sex)) { return "其他"; } else { return sex; } } private String formatBirdt(String birdt) { if (birdt.length() >= 8) { return birdt.substring(0, 4) + "/" + birdt.substring(4, 6) + "/" + birdt.substring(6, 8); } else { return birdt; } } private PdfPCell createCell(String str) { return createCell(str, 1, 1); } private PdfPCell createColspanCell(String str, int colspan) { return createCell(str, colspan, 1); } private PdfPCell createColspanCell(String str, int border, int colspan) { return createCell(str, border, colspan, 1); } // private PdfPCell createRowspanCell(String str, int rowspan) { // return createCell(str, 1, rowspan); // } private PdfPCell createHeader(String str, int colspan) { PdfPCell cell = new PdfPCell(new Phrase(str, headerFont)); //cell.setBorder(0); cell.setColspan(colspan); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setPaddingTop(0); cell.setPaddingBottom(8); cell.setPaddingLeft(4); cell.setPaddingRight(4); //cell.setLeading(0f, 1.2f); return cell; } // private PdfPCell createHeader2(String str, int colspan) { // PdfPCell cell = new PdfPCell(new Phrase(str,font)); // cell.setBorder(0); // cell.setColspan(colspan); // cell.setHorizontalAlignment(Element.ALIGN_RIGHT); // cell.setVerticalAlignment(Element.ALIGN_TOP); // cell.setPaddingTop(0); // cell.setPaddingBottom(8); // cell.setPaddingLeft(4); // cell.setPaddingRight(4); // //cell.setLeading(0f, 1.2f); // return cell; // } private PdfPCell createLeftFooter(String str, int colspan) { PdfPCell cell = new PdfPCell(new Phrase(str,font)); cell.setBorder(0); cell.setColspan(colspan); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setPaddingTop(0); cell.setPaddingBottom(8); cell.setPaddingLeft(4); cell.setPaddingRight(4); //cell.setLeading(0f, 1.2f); return cell; } // private PdfPCell createRightFooter(String str, int colspan) { // PdfPCell cell = new PdfPCell(new Phrase(str,font)); // cell.setBorder(0); // cell.setColspan(colspan); // cell.setHorizontalAlignment(Element.ALIGN_RIGHT); // cell.setVerticalAlignment(Element.ALIGN_TOP); // cell.setPaddingTop(0); // cell.setPaddingBottom(8); // cell.setPaddingLeft(4); // cell.setPaddingRight(4); // //cell.setLeading(0f, 1.2f); // return cell; // } private PdfPCell createCell(String str, int border) { return createCell(str, border, 1, 1); } private PdfPCell createCell(String str, int colspan, int rowspan) { PdfPCell cell = new PdfPCell(new Phrase(str, font)); //cell.setBorder(border); cell.setColspan(colspan); cell.setRowspan(rowspan); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setPaddingTop(0); cell.setPaddingBottom(6); cell.setPaddingLeft(4); cell.setPaddingRight(4); cell.setLeading(0f, 1.2f); return cell; } private PdfPCell createCell(String str, int border, int colspan, int rowspan) { PdfPCell cell = new PdfPCell(new Phrase(str, font)); cell.setBorder(border); cell.setColspan(colspan); cell.setRowspan(rowspan); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setPaddingTop(0); cell.setPaddingBottom(6); cell.setPaddingLeft(4); cell.setPaddingRight(4); cell.setLeading(0f, 1.2f); return cell; } private PdfPCell createCell(Phrase phrase) { PdfPCell cell = new PdfPCell(phrase); //cell.setBorder(border); //cell.setColspan(colspan); //cell.setRowspan(rowspan); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setPaddingTop(0); cell.setPaddingBottom(6); cell.setPaddingLeft(4); cell.setPaddingRight(4); cell.setLeading(0f, 1.2f); return cell; } private PdfPCell createDocumentFootCell(String str) { PdfPCell cell = new PdfPCell(new Phrase(str, font)); cell.setBorder(0); //cell.setColspan(colspan); //cell.setRowspan(rowspan); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setPaddingTop(0); cell.setPaddingBottom(6); cell.setPaddingLeft(4); cell.setPaddingRight(4); cell.setLeading(0f, 1.2f); return cell; } private PdfPCell createSignCell(String str) throws Exception { PdfPCell cell = new PdfPCell(new Phrase(str, signFont)); //cell.setBorder(1); cell.setBorderWidth(1.2f); cell.setBorderColor(BaseColor.RED); cell.setHorizontalAlignment(Element.ALIGN_JUSTIFIED_ALL); //cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setPaddingTop(0); cell.setPaddingBottom(8); cell.setPaddingLeft(4); cell.setPaddingRight(4); cell.setLeading(0f, 1.2f); return cell; } private String formatFileSize(String bytes) { BigDecimal KB = new BigDecimal(1024); BigDecimal MB = new BigDecimal(1024 * 1024); int SCALE = new Integer(2).intValue(); try { BigDecimal result = new BigDecimal(bytes).divide(KB, SCALE, BigDecimal.ROUND_HALF_UP); if (result.intValue() < 1000) { return result.toString() + "KB"; } else { result = new BigDecimal(bytes).divide(MB, SCALE, BigDecimal.ROUND_HALF_UP); return result.toString() + "MB"; } } catch (Exception e) { return bytes; } } // private String formatCrmyyidno(String crmyy, String crmid, String crmno) { // if("".equals(crmyy) && "".equals(crmid) && "".equals(crmno)){ // return ""; // } else { // return crmyy + "." + crmid + "." + crmno; // } // } private String getGSOS08Argvl(String prgid, String argnm) { StringBuffer sql = new StringBuffer(); sql.append("select argvl from gso..s08 where prgid = '" + prgid + "' and argnm = '" + argnm + "'"); String argvl = ""; List s08MapList = sqlDBUtility.queryForList("UTIL.executeSelectSql", sql.toString()); if (s08MapList.size() > 0) { HashMap map = (HashMap) s08MapList.get(0); argvl = check.checkNull(map.get("ARGVL"), "").toString(); } return argvl; } private void initFont() throws Exception { logger.info("font path = [" + FontManager.getFontPath(true) + "]"); // 指定要使用的字型(KAIU.TTF為Windows內建的標楷體) // C:\WINDOWS\Fonts\KAIU.TTF String winFont = "KAIU.TTF"; BaseFont bf = BaseFont.createFont(FontManager.getFontPath(true) + File.separator + winFont, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); // 設定中文字型(BaseFont、字型大小、字型型態) font = new Font(bf, 12, Font.NORMAL); redFont = new Font(bf, 12, Font.NORMAL); redFont.setColor(BaseColor.RED); blueFont = new Font(bf, 12, Font.NORMAL); blueFont.setColor(BaseColor.BLUE); headerFont = new Font(bf, 20, Font.NORMAL); signFont = new Font(bf, 10, Font.NORMAL); signFont.setColor(BaseColor.RED); } private void testPDF() throws Exception { try { int marginLeft = -20; int marginRight = -20; int marginTop = 40; int marginBottom = 40; document = new Document(PageSize.A4, marginLeft, marginRight, marginTop, marginBottom); PdfWriter.getInstance(document, new FileOutputStream("C:\\test.pdf")); document.open(); PdfPTable table = new PdfPTable(4); //table.setTotalWidth(2f); float[] columnWidths = new float[] { 14f, 3f, 2f, 1f }; table.setWidths(columnWidths); table.addCell(""); table.addCell(""); //table.addCell(getSign("張律師")); table.addCell(createSignCell("張律師")); table.addCell(""); document.add(table); } catch (Exception e) { logger.error(e, e); } finally { if (document != null) { document.close(); } } } private String getSyskdGNm() { List list = this.sqlDBUtility.queryForList("SYS.C79_syskdG_select"); return list.size()==0 ? "內政部移民署" : ((HashMap)list.get(0)).get("DS").toString(); } public static void main(String[] args){ try{ GeneratePDF pdf = new GeneratePDF(); pdf.testPDF(); }catch(Exception e){ e.printStackTrace(); } } }*/
UTF-8
Java
27,990
java
GeneratePDF.java
Java
[]
null
[]
/*package com.sertek.file; import java.io.File; import java.io.FileOutputStream; import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.apache.log4j.Logger; import sun.font.FontManager; import com.itextpdf.text.BaseColor; import com.itextpdf.text.Chunk; import com.itextpdf.text.Document; import com.itextpdf.text.Element; import com.itextpdf.text.Font; import com.itextpdf.text.PageSize; import com.itextpdf.text.Phrase; import com.itextpdf.text.pdf.BaseFont; import com.itextpdf.text.pdf.ColumnText; import com.itextpdf.text.pdf.PdfContentByte; import com.itextpdf.text.pdf.PdfPCell; import com.itextpdf.text.pdf.PdfPTable; import com.itextpdf.text.pdf.PdfPageEventHelper; import com.itextpdf.text.pdf.PdfWriter; import com.sertek.form.SOLHelper; import com.sertek.ibatis.util.SqlDBUtility; import com.sertek.table.C60; import com.sertek.table.C60_ATT; import com.sertek.table.C60_WEB; import com.sertek.table.C61; import com.sertek.table.C6A; import com.sertek.table.COURT; import com.sertek.util.CheckObject; import com.sertek.util.util_date; import com.sertek.util.utility; public class GeneratePDF { private Logger logger = Logger.getLogger(this.getClass()); private SqlDBUtility sqlDBUtility = null; private HashMap form = new HashMap(); private CheckObject check = new CheckObject(); private utility ut = new utility(); private util_date ud = new util_date(); private Font font = new Font(); private Font redFont = new Font(); private Font blueFont = new Font(); private Font headerFont = new Font(); private Font signFont = new Font(); Document document = null; public GeneratePDF() throws Exception { initFont(); } public class Watermark extends PdfPageEventHelper { protected String text = ""; public Watermark(String text) { this.text = text; } @Override public void onEndPage(PdfWriter writer, Document document) { PdfContentByte canvas = writer.getDirectContentUnder(); String watertxt = String.valueOf(document.getPageNumber()) + " " + text; Phrase watermark = new Phrase( watertxt, font); ColumnText.showTextAligned(canvas, Element.ALIGN_LEFT, watermark, 298, 20, 0); } } *//** * 產生「網頁繕打」的PDF * @param sqlDBUtility * @param form * @param filenm * @throws Exception *//* public void createPDF(SqlDBUtility sqlDBUtility, HashMap form, String filenm) throws Exception { this.sqlDBUtility = sqlDBUtility; this.form = form; try { int marginLeft = -20; int marginRight = -20; int marginTop = 40; int marginBottom = 40; document = new Document(PageSize.A4, marginLeft, marginRight, marginTop, marginBottom); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(filenm)); writer.setPageEvent(new Watermark(getDocumentFooterText())); document.open(); C60 c60 = new C60(); HashMap c60Key = new HashMap(); c60Key.put("crtid", check.checkNull(form.get("crtid"), "")); c60Key.put("sys", check.checkNull(form.get("sys"), "")); c60Key.put("c_no", check.checkNull(form.get("c_no"), "")); List c60List = sqlDBUtility.queryForList("C60.queryByKey", c60Key); if (c60List.size() > 0) { c60 = (C60) c60List.get(0); HashMap courtKey = new HashMap(); courtKey.put("crtid", c60.getCrtid()); List courtList = sqlDBUtility.queryForList("COURT.queryByKey", courtKey); if (courtList.size() > 0) { COURT court = (COURT) courtList.get(0); form.put("crtnm", court.getCrtnm()); } } // 聲請人 C61 c61_1 = new C61(); C6A c6a = new C6A(); HashMap c61Key = new HashMap(); c61Key.put("crtid", check.checkNull(form.get("crtid"), "")); c61Key.put("sys", check.checkNull(form.get("sys"), "")); c61Key.put("c_no", check.checkNull(form.get("c_no"), "")); List c61List1 = sqlDBUtility.queryForList("FGSO1A04.C61_Query1", c61Key); if (c61List1.size() > 0) { c61_1 = (C61) c61List1.get(0); HashMap c6aKey = new HashMap(); c6aKey.put("crtid", c61_1.getCrtid()); c6aKey.put("sys", c61_1.getSys()); c6aKey.put("c_no", c61_1.getC_no()); c6aKey.put("sysid", c61_1.getSysid()); List c6aList = sqlDBUtility.queryForList("FGSO1A04.C6A_Query", c6aKey); if (c6aList.size() > 0) { c6a = (C6A) c6aList.get(0); } } // (機關首長) form.put("leader", getGSOS08Argvl("FGSO1A04", "機關首長")); // 受收容人 C61 c61_2 = new C61(); List c61List2 = sqlDBUtility.queryForList("FGSO1A04.C61_Query2", c61Key); if(c61List2.size() > 0){ c61_2 = (C61) c61List2.get(0); HashMap c91Key = new HashMap(); c91Key.put("st_code", c61_2.getNat()); List c91List = sqlDBUtility.queryForList("C91.queryByKey", c91Key); if (c91List.size() > 0) { C91 c91 = (C91) c91List.get(0); c61_2.setNat(c91.getCdds()); } } C60_WEB web = new C60_WEB(); HashMap webKey = new HashMap(); webKey.put("crtid", check.checkNull(form.get("crtid"), "")); webKey.put("sys", check.checkNull(form.get("sys"), "")); webKey.put("c_no", check.checkNull(form.get("c_no"), "")); webKey.put("s_seq", check.checkNull(form.get("s_seq"), "")); List webList = sqlDBUtility.queryForList("C60_WEB.queryByKey", webKey); if (webList.size() > 0) { web = (C60_WEB) webList.get(0); } createHeader(c60); createBody(c60, c61_1, c6a, c61_2, web); createBody2(web); createBody3(web); createFooter(web); createDocumentFooter(); //CryptoFile.encryptFile(item.getInputStream(), s_filenm); } catch (Exception e) { logger.error(e, e); } finally { if (document != null) { document.close(); } } } *//** * 產生「查看及列印」的PDF * @param sqlDBUtility * @param form * @param filenm * @throws Exception *//* public void createPDF2(SqlDBUtility sqlDBUtility, HashMap form, String filenm) throws Exception { this.sqlDBUtility = sqlDBUtility; this.form = form; try { int marginLeft = -20; int marginRight = -20; int marginTop = 40; int marginBottom = 40; document = new Document(PageSize.A4, marginLeft, marginRight, marginTop, marginBottom); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(filenm)); writer.setPageEvent(new Watermark(getDocumentFooterText())); document.open(); C60 c60 = new C60(); HashMap c60Key = new HashMap(); c60Key.put("crtid", check.checkNull(form.get("crtid"), "")); c60Key.put("sys", check.checkNull(form.get("sys"), "")); c60Key.put("c_no", check.checkNull(form.get("c_no"), "")); List c60List = sqlDBUtility.queryForList("C60.queryByKey", c60Key); if (c60List.size() > 0) { c60 = (C60) c60List.get(0); HashMap courtKey = new HashMap(); courtKey.put("crtid", c60.getCrtid()); List courtList = sqlDBUtility.queryForList("COURT.queryByKey", courtKey); if (courtList.size() > 0) { COURT court = (COURT) courtList.get(0); form.put("crtnm", court.getCrtnm()); } } // 聲請人 C61 c61_1 = new C61(); C6A c6a = new C6A(); HashMap c61Key = new HashMap(); c61Key.put("crtid", check.checkNull(form.get("crtid"), "")); c61Key.put("sys", check.checkNull(form.get("sys"), "")); c61Key.put("c_no", check.checkNull(form.get("c_no"), "")); List c61List1 = sqlDBUtility.queryForList("FGSO1A04.C61_Query1", c61Key); if (c61List1.size() > 0) { c61_1 = (C61) c61List1.get(0); HashMap c6aKey = new HashMap(); c6aKey.put("crtid", c61_1.getCrtid()); c6aKey.put("sys", c61_1.getSys()); c6aKey.put("c_no", c61_1.getC_no()); c6aKey.put("sysid", c61_1.getSysid()); List c6aList = sqlDBUtility.queryForList("FGSO1A04.C6A_Query", c6aKey); if (c6aList.size() > 0) { c6a = (C6A) c6aList.get(0); } } // (機關首長) form.put("leader", getGSOS08Argvl("FGSO1A04", "機關首長")); // 受收容人 C61 c61_2 = new C61(); List c61List2 = sqlDBUtility.queryForList("FGSO1A04.C61_Query2", c61Key); if(c61List2.size() > 0){ c61_2 = (C61) c61List2.get(0); HashMap c91Key = new HashMap(); c91Key.put("st_code", c61_2.getNat()); List c91List = sqlDBUtility.queryForList("C91.queryByKey", c91Key); if (c91List.size() > 0) { C91 c91 = (C91) c91List.get(0); c61_2.setNat(c91.getCdds()); } } C60_WEB web = new C60_WEB(); HashMap webKey = new HashMap(); webKey.put("crtid", check.checkNull(form.get("crtid"), "")); webKey.put("sys", check.checkNull(form.get("sys"), "")); webKey.put("c_no", check.checkNull(form.get("c_no"), "")); webKey.put("s_seq", check.checkNull(form.get("s_seq"), "")); List webList = sqlDBUtility.queryForList("C60_WEB.queryByKey", webKey); if (webList.size() > 0) { web = (C60_WEB) webList.get(0); } createPreHeader(); createHeader(c60); createBody(c60, c61_1, c6a, c61_2, web); createBody2(web); createBody3(web); createFooter(web); createAttList(); createDocumentFooter(); //CryptoFile.encryptFile(item.getInputStream(), s_filenm); } catch (Exception e) { logger.error(e, e); } finally { if (document != null) { document.close(); } } } private void createPreHeader() throws Exception { PdfPTable table = new PdfPTable(2); float[] columnWidths = new float[] { 4f, 16f }; table.setWidths(columnWidths); table.addCell(createCell("注意事項")); Phrase phrase = new Phrase(); phrase.add(new Chunk("您的案件已完成遞狀,\n", font)); phrase.add(new Chunk("收狀日期為", font)); phrase.add(new Chunk("" + ud.formatCDate(check.checkNull(form.get("rcvdt"), "").toString(), "/") + " " + ud.formatTime(check.checkNull(form.get("rcvtm"), "").toString(), ":"), redFont)); phrase.add(new Chunk(",\n", font)); phrase.add(new Chunk("遞狀流水號為", font)); phrase.add(new Chunk("" + check.checkNull(form.get("doc_no"), ""), redFont)); phrase.add(new Chunk(",\n", font)); System.out.println("************************************"); System.out.println(form.toString()); phrase.add(new Chunk("遞狀種類為", font)); //phrase.add(new Chunk("" + SOLHelper.getSuit_nm(check.checkNull(form.get("s_kd"), "").toString()), redFont)); phrase.add(new Chunk(",\n", font)); phrase.add(new Chunk("本案當事人共", font)); phrase.add(new Chunk("" + check.checkNull(form.get("c61Cnt"), ""), redFont)); phrase.add(new Chunk("名、上傳共", font)); phrase.add(new Chunk("" + check.checkNull(form.get("docCnt"), ""), redFont)); phrase.add(new Chunk("個附件。\n", font)); phrase.add(new Chunk("本案後續書狀遞送請由「聲請查詢」功能查詢出本案時,點「遞補充書狀」圖示,接著點選「新增」進行。", blueFont)); table.addCell(createCell(phrase)); document.add(table); document.newPage(); //document.add(new Phrase("\n")); } private void createHeader(C60 c60) throws Exception { PdfPTable table = new PdfPTable(1); float[] columnWidths = new float[] { 1f }; table.setWidths(columnWidths); table.addCell(createHeader(SOLHelper.getSuit_nm(c60.getS_kd()), 1)); document.add(table); } private void createBody(C60 c60, C61 c61_1, C6A c6a, C61 c61_2, C60_WEB web) throws Exception { PdfPTable table = new PdfPTable(5); float[] columnWidths = new float[] { 2f, 2f, 3f, 2f, 1f }; table.setWidths(columnWidths); table.addCell(createCell("案號")); table.addCell(createColspanCell(" " + c60.getCrmyy() + " 年度 " + c60.getCrmid() + " 字第 " + c60.getCrmno() + " 號", 2)); table.addCell(createCell("承辦股別")); table.addCell(createCell(c60.getDpt())); table.addCell(createCell("訴訟標的金額或價額")); table.addCell(createColspanCell("新臺幣 " + ut.Fillspace(web.getS_price(), 16, 0) + " 元", 4)); // 稱謂 table.addCell(createCell("稱謂")); table.addCell(createCell("姓名或名稱")); StringBuffer str1 = new StringBuffer(); str1.append("依序填寫:國民身分證統一編號或營利事業統一編號、性別、出生年月日、職業、住居所、就業處所、公務所、事務所或營業所、郵遞區號、電話、傳真、電子郵件位址、指定送達代收人及其送達處所。"); table.addCell(createColspanCell(str1.toString(), 3)); // 聲請人 table.addCell(createCell("聲請人")); table.addCell(createCell(getSyskdGNm())); StringBuffer str2 = new StringBuffer(); str2.append("設:" + c61_1.getCity() + c61_1.getArea() + c61_1.getAddr() + "\n"); str2.append("送達代收人:" + c6a.getClnm() + "\n"); str2.append("送達處所:" + c6a.getCity() + c6a.getArea() + c6a.getAddr() + "\n"); table.addCell(createColspanCell(str2.toString(), 3)); // 代表人 table.addCell(createCell("代表人")); table.addCell(createCell(check.checkNull(form.get("leader"), "") + "\n" + "(機關首長)")); StringBuffer str3 = new StringBuffer(); str3.append("住同上" + "\n"); table.addCell(createColspanCell(str3.toString(), 3)); // 受收容人 table.addCell(createCell("受收容人")); table.addCell(createCell((c61_2.getClnm().equals("") ? c61_2.getClnm_e() : c61_2.getClnm()) + "\n")); StringBuffer str4 = new StringBuffer(); str4.append("國民身分證統一編號(或" + c61_2.getNat() + "國籍,護照號碼):" + c61_2.getIdno() + "\n"); str4.append("性別:" + formatSex(c61_2.getSex()) + "\n"); str4.append("生日:" + formatBirdt(c61_2.getBirdt()) + "\n"); str4.append("職業:" + c61_2.getPfs() + "\n"); str4.append("住:" + c61_2.getCity() + c61_2.getArea() + c61_2.getAddr() + "\n"); str4.append("郵遞區號:" + c61_2.getZip() + "\n"); str4.append("電話:" + c61_2.getTel() + "\n"); str4.append("傳真:" + c61_2.getFax() + "\n"); str4.append("電子郵件位址:" + c61_2.getEmail() + "\n"); str4.append("*有通譯需求之語言別:" + SOLHelper.getInterp(c61_2.getInterp(), c61_2.getInt_rmk()) + "\n"); table.addCell(createColspanCell(str4.toString(), 3)); document.add(table); } private void createBody2(C60_WEB web) throws Exception { PdfPTable table = new PdfPTable(1); float[] columnWidths = new float[] { 1f }; table.setWidths(columnWidths); table.addCell(this.getBody2Cell(web)); document.add(table); } private PdfPTable getBody2Cell(C60_WEB web) throws Exception { PdfPTable table = new PdfPTable(1); float[] columnWidths = new float[] { 1f }; table.setWidths(columnWidths); StringBuffer stmt = new StringBuffer(); stmt.append(web.getS_stmt() + "\n"); stmt.append("\n"); stmt.append("\n"); stmt.append("  此 致\n"); stmt.append("\n"); stmt.append(check.checkNull(form.get("crtnm"), "") + "行政訴訟庭    公鑒\n"); table.addCell(createColspanCell(stmt.toString(), 0, 1)); return table; } private void createBody3(C60_WEB web) throws Exception { PdfPTable table = new PdfPTable(5); float[] columnWidths = new float[] { 2f, 2f, 3f, 2f, 1f }; table.setWidths(columnWidths); table.addCell(createCell("證物名稱及件數")); table.addCell(createColspanCell(web.getS_evd(), 4)); document.add(table); } private void createFooter(C60_WEB web) throws Exception { PdfPTable table = new PdfPTable(1); float[] columnWidths = new float[] { 1f }; table.setWidths(columnWidths); table.addCell(this.getFootCell()); document.add(table); } private PdfPTable getFootCell() throws Exception { String usrnm = check.checkNull(form.get("usrnm"), "").toString(); String s_opsn = check.checkNull(form.get("s_opsn"), "").toString(); PdfPTable table = new PdfPTable(4); float[] columnWidths = new float[] { 14f, 3f, 2f, 1f }; table.setWidths(columnWidths); StringBuffer str = new StringBuffer(); String sysdt = ud.nowCDate(); str.setLength(0); str.append("中華民國 " + sysdt.substring(0, 3) + " 年 " + sysdt.substring(3, 5) + " 月 " + sysdt.substring(5, 7) + " 日\n"); table.addCell(createColspanCell(str.toString(), 0, 4)); str.setLength(0); str.append("        具狀人 內政部移民署 代表人  "); table.addCell(createColspanCell(str.toString(), 0, 1)); table.addCell(createCell("簽名蓋章 ", 0)); table.addCell(createCell("", 0)); str.setLength(0); str.append("        撰狀人 " + usrnm + " "); table.addCell(createColspanCell(str.toString(), 0, 1)); table.addCell(createCell("簽名蓋章 ", 0)); table.addCell(createSignCell(usrnm)); table.addCell(createCell("", 0)); return table; } private void createAttList() throws Exception { List attList = new ArrayList(); if (form.get("attList") != null) { attList = (List) form.get("attList"); } PdfPTable table = new PdfPTable(5); float[] columnWidths = new float[] { 2f, 6f, 5f, 4f, 3f }; table.setWidths(columnWidths); table.addCell(createCell("序號")); table.addCell(createCell("檔名")); table.addCell(createCell("說明")); table.addCell(createCell("上傳日期")); table.addCell(createCell("檔案大小")); for (int i = 0; i < attList.size(); i++) { C60_ATT att = (C60_ATT) attList.get(i); table.addCell(createCell("" + (i + 1))); table.addCell(createCell(att.getS_file())); table.addCell(createCell(att.getS_fileds())); table.addCell(createCell(ud.formatCDate(att.getS_updt(), "/") + " " + ud.formatTime(att.getS_uptm(), ":"))); table.addCell(createCell(formatFileSize(att.getS_filesz()))); } document.add(new Phrase("\n")); document.add(table); } private void createDocumentFooter() throws Exception { String usrnm = check.checkNull(form.get("usrnm"), "").toString(); PdfPTable table = new PdfPTable(1); float[] columnWidths = new float[] { 1f }; table.setWidths(columnWidths); table.addCell(createLeftFooter("*依實際狀況填載,若無此狀況者免填。", 1)); document.add(table); } private String getDocumentFooterText() throws Exception { String usrnm = check.checkNull(form.get("usrnm"), "").toString(); StringBuffer str = new StringBuffer(); String sysdt = ud.nowCDate(); String systm = ud.nowTime(); str.setLength(0); str.append(sysdt.substring(0, 3) + "年" + sysdt.substring(3, 5) + "月" + sysdt.substring(5, 7) + "日"); str.append(systm.substring(0, 2) + "時" + systm.substring(2, 4) + "分" + systm.substring(4, 6) + "秒"); str.append(" " + usrnm + " " + "印"); return str.toString(); } private String formatSex(String sex) { if ("M".equals(sex)) { return "男"; } else if ("F".equals(sex)) { return "女"; } else if ("C".equals(sex)) { return "法人"; } else if ("G".equals(sex)) { return "中央及地方機關"; } else if ("O".equals(sex)) { return "其他"; } else { return sex; } } private String formatBirdt(String birdt) { if (birdt.length() >= 8) { return birdt.substring(0, 4) + "/" + birdt.substring(4, 6) + "/" + birdt.substring(6, 8); } else { return birdt; } } private PdfPCell createCell(String str) { return createCell(str, 1, 1); } private PdfPCell createColspanCell(String str, int colspan) { return createCell(str, colspan, 1); } private PdfPCell createColspanCell(String str, int border, int colspan) { return createCell(str, border, colspan, 1); } // private PdfPCell createRowspanCell(String str, int rowspan) { // return createCell(str, 1, rowspan); // } private PdfPCell createHeader(String str, int colspan) { PdfPCell cell = new PdfPCell(new Phrase(str, headerFont)); //cell.setBorder(0); cell.setColspan(colspan); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setPaddingTop(0); cell.setPaddingBottom(8); cell.setPaddingLeft(4); cell.setPaddingRight(4); //cell.setLeading(0f, 1.2f); return cell; } // private PdfPCell createHeader2(String str, int colspan) { // PdfPCell cell = new PdfPCell(new Phrase(str,font)); // cell.setBorder(0); // cell.setColspan(colspan); // cell.setHorizontalAlignment(Element.ALIGN_RIGHT); // cell.setVerticalAlignment(Element.ALIGN_TOP); // cell.setPaddingTop(0); // cell.setPaddingBottom(8); // cell.setPaddingLeft(4); // cell.setPaddingRight(4); // //cell.setLeading(0f, 1.2f); // return cell; // } private PdfPCell createLeftFooter(String str, int colspan) { PdfPCell cell = new PdfPCell(new Phrase(str,font)); cell.setBorder(0); cell.setColspan(colspan); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setPaddingTop(0); cell.setPaddingBottom(8); cell.setPaddingLeft(4); cell.setPaddingRight(4); //cell.setLeading(0f, 1.2f); return cell; } // private PdfPCell createRightFooter(String str, int colspan) { // PdfPCell cell = new PdfPCell(new Phrase(str,font)); // cell.setBorder(0); // cell.setColspan(colspan); // cell.setHorizontalAlignment(Element.ALIGN_RIGHT); // cell.setVerticalAlignment(Element.ALIGN_TOP); // cell.setPaddingTop(0); // cell.setPaddingBottom(8); // cell.setPaddingLeft(4); // cell.setPaddingRight(4); // //cell.setLeading(0f, 1.2f); // return cell; // } private PdfPCell createCell(String str, int border) { return createCell(str, border, 1, 1); } private PdfPCell createCell(String str, int colspan, int rowspan) { PdfPCell cell = new PdfPCell(new Phrase(str, font)); //cell.setBorder(border); cell.setColspan(colspan); cell.setRowspan(rowspan); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setPaddingTop(0); cell.setPaddingBottom(6); cell.setPaddingLeft(4); cell.setPaddingRight(4); cell.setLeading(0f, 1.2f); return cell; } private PdfPCell createCell(String str, int border, int colspan, int rowspan) { PdfPCell cell = new PdfPCell(new Phrase(str, font)); cell.setBorder(border); cell.setColspan(colspan); cell.setRowspan(rowspan); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setPaddingTop(0); cell.setPaddingBottom(6); cell.setPaddingLeft(4); cell.setPaddingRight(4); cell.setLeading(0f, 1.2f); return cell; } private PdfPCell createCell(Phrase phrase) { PdfPCell cell = new PdfPCell(phrase); //cell.setBorder(border); //cell.setColspan(colspan); //cell.setRowspan(rowspan); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setPaddingTop(0); cell.setPaddingBottom(6); cell.setPaddingLeft(4); cell.setPaddingRight(4); cell.setLeading(0f, 1.2f); return cell; } private PdfPCell createDocumentFootCell(String str) { PdfPCell cell = new PdfPCell(new Phrase(str, font)); cell.setBorder(0); //cell.setColspan(colspan); //cell.setRowspan(rowspan); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setPaddingTop(0); cell.setPaddingBottom(6); cell.setPaddingLeft(4); cell.setPaddingRight(4); cell.setLeading(0f, 1.2f); return cell; } private PdfPCell createSignCell(String str) throws Exception { PdfPCell cell = new PdfPCell(new Phrase(str, signFont)); //cell.setBorder(1); cell.setBorderWidth(1.2f); cell.setBorderColor(BaseColor.RED); cell.setHorizontalAlignment(Element.ALIGN_JUSTIFIED_ALL); //cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setPaddingTop(0); cell.setPaddingBottom(8); cell.setPaddingLeft(4); cell.setPaddingRight(4); cell.setLeading(0f, 1.2f); return cell; } private String formatFileSize(String bytes) { BigDecimal KB = new BigDecimal(1024); BigDecimal MB = new BigDecimal(1024 * 1024); int SCALE = new Integer(2).intValue(); try { BigDecimal result = new BigDecimal(bytes).divide(KB, SCALE, BigDecimal.ROUND_HALF_UP); if (result.intValue() < 1000) { return result.toString() + "KB"; } else { result = new BigDecimal(bytes).divide(MB, SCALE, BigDecimal.ROUND_HALF_UP); return result.toString() + "MB"; } } catch (Exception e) { return bytes; } } // private String formatCrmyyidno(String crmyy, String crmid, String crmno) { // if("".equals(crmyy) && "".equals(crmid) && "".equals(crmno)){ // return ""; // } else { // return crmyy + "." + crmid + "." + crmno; // } // } private String getGSOS08Argvl(String prgid, String argnm) { StringBuffer sql = new StringBuffer(); sql.append("select argvl from gso..s08 where prgid = '" + prgid + "' and argnm = '" + argnm + "'"); String argvl = ""; List s08MapList = sqlDBUtility.queryForList("UTIL.executeSelectSql", sql.toString()); if (s08MapList.size() > 0) { HashMap map = (HashMap) s08MapList.get(0); argvl = check.checkNull(map.get("ARGVL"), "").toString(); } return argvl; } private void initFont() throws Exception { logger.info("font path = [" + FontManager.getFontPath(true) + "]"); // 指定要使用的字型(KAIU.TTF為Windows內建的標楷體) // C:\WINDOWS\Fonts\KAIU.TTF String winFont = "KAIU.TTF"; BaseFont bf = BaseFont.createFont(FontManager.getFontPath(true) + File.separator + winFont, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); // 設定中文字型(BaseFont、字型大小、字型型態) font = new Font(bf, 12, Font.NORMAL); redFont = new Font(bf, 12, Font.NORMAL); redFont.setColor(BaseColor.RED); blueFont = new Font(bf, 12, Font.NORMAL); blueFont.setColor(BaseColor.BLUE); headerFont = new Font(bf, 20, Font.NORMAL); signFont = new Font(bf, 10, Font.NORMAL); signFont.setColor(BaseColor.RED); } private void testPDF() throws Exception { try { int marginLeft = -20; int marginRight = -20; int marginTop = 40; int marginBottom = 40; document = new Document(PageSize.A4, marginLeft, marginRight, marginTop, marginBottom); PdfWriter.getInstance(document, new FileOutputStream("C:\\test.pdf")); document.open(); PdfPTable table = new PdfPTable(4); //table.setTotalWidth(2f); float[] columnWidths = new float[] { 14f, 3f, 2f, 1f }; table.setWidths(columnWidths); table.addCell(""); table.addCell(""); //table.addCell(getSign("張律師")); table.addCell(createSignCell("張律師")); table.addCell(""); document.add(table); } catch (Exception e) { logger.error(e, e); } finally { if (document != null) { document.close(); } } } private String getSyskdGNm() { List list = this.sqlDBUtility.queryForList("SYS.C79_syskdG_select"); return list.size()==0 ? "內政部移民署" : ((HashMap)list.get(0)).get("DS").toString(); } public static void main(String[] args){ try{ GeneratePDF pdf = new GeneratePDF(); pdf.testPDF(); }catch(Exception e){ e.printStackTrace(); } } }*/
27,990
0.635156
0.605729
865
29.077457
24.913071
188
false
false
0
0
0
0
0
0
2.890173
false
false
13
96eb38be70e4b8323dcc779e863c1a0ef67d96c2
30,356,828,860,268
fdbaf790411a1918e62ec4747458e0a63767df23
/nicer_occ/simulator/src/main/java/coordinate/Coordinate.java
a6faa5f6ce87b70db38ff516647b04ddb335ae92
[]
no_license
Telecooperation/NICER_OCC
https://github.com/Telecooperation/NICER_OCC
9ce6fec87308ecb11a77288731d367c45750ceda
e279fde0e1c1d290a3075fb0bb0e88114f3d2a00
refs/heads/master
2021-01-23T00:25:31.941000
2017-07-07T15:10:58
2017-07-07T15:10:58
92,812,070
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package coordinate; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @Data @AllArgsConstructor @Builder public class Coordinate { private double latitude, longitude; }
UTF-8
Java
201
java
Coordinate.java
Java
[]
null
[]
package coordinate; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @Data @AllArgsConstructor @Builder public class Coordinate { private double latitude, longitude; }
201
0.80597
0.80597
14
13.357142
12.447645
36
false
false
0
0
0
0
0
0
0.5
false
false
13
d34b0e1163be892d4f5ea1a0c98aa3f91dad8cb4
9,534,827,415,123
ad2ec857c549bc36a24e3ea5b12b2f29046083f2
/src/com/j2/w9/command/GarageOpenCommand.java
989f0348fc8ef505b4d0a99f1ba5edcd9d356b88
[]
no_license
minzz-zz/myrepo
https://github.com/minzz-zz/myrepo
3e4127e4f7df97166207a39706c1139e1b4614b7
27bd7e39c1aaa326f0cd97e4cfff95d43b3dfbd8
refs/heads/master
2021-01-21T04:44:17.788000
2016-06-15T05:57:13
2016-06-15T05:57:13
53,250,795
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.j2.w9.command; public class GarageOpenCommand implements Command{ private GarageDoor garage; public GarageOpenCommand(GarageDoor garage){ this.garage=garage; } public void execute(){ garage.open(); } }
UTF-8
Java
233
java
GarageOpenCommand.java
Java
[]
null
[]
package com.j2.w9.command; public class GarageOpenCommand implements Command{ private GarageDoor garage; public GarageOpenCommand(GarageDoor garage){ this.garage=garage; } public void execute(){ garage.open(); } }
233
0.733906
0.725322
12
18.5
16.874537
50
false
false
0
0
0
0
0
0
0.333333
false
false
13
af45bcedb99cb003ca0a06305b1c90022d07ed6f
9,663,676,433,332
6e33f5c4745d18a15d51daecee8543d66cd2526a
/src/main/java/org/vaadin/addon/leaflet/LeafletLocateEvent.java
796de1af7c04b2eaebdadf9166954229a9bc6092
[ "Apache-2.0", "BSD-2-Clause" ]
permissive
mstahv/v-leaflet
https://github.com/mstahv/v-leaflet
ab4a8de2444d593b49894d0693c835cbecf2f665
72ca53935b94a980fc23e030b8a00c142821f1a9
refs/heads/master
2023-04-07T22:26:29.248000
2022-08-22T10:34:16
2022-08-22T10:34:16
7,380,300
36
40
NOASSERTION
false
2023-03-31T15:09:34
2012-12-30T20:58:26
2021-11-19T14:01:54
2023-03-31T15:09:34
1,044
42
38
45
Java
false
false
package org.vaadin.addon.leaflet; import com.vaadin.event.ConnectorEvent; import com.vaadin.server.ClientConnector; import org.vaadin.addon.leaflet.shared.Point; public class LeafletLocateEvent extends ConnectorEvent { private final Double accuracy; private final Double altitude; private final Double speed; private Point point; public LeafletLocateEvent(ClientConnector source, Point p, Double a, Double altitude, Double speed) { super(source); this.point = p; this.accuracy = a; this.altitude = altitude; this.speed = speed; } public Point getPoint() { return point; } public Double getAccuracy() { return accuracy; } public Double getAltitude() { return altitude; } public Double getSpeed() { return speed; } @Override public String toString() { return point.toString() + " a: " + accuracy + " alt:" + altitude; } }
UTF-8
Java
877
java
LeafletLocateEvent.java
Java
[]
null
[]
package org.vaadin.addon.leaflet; import com.vaadin.event.ConnectorEvent; import com.vaadin.server.ClientConnector; import org.vaadin.addon.leaflet.shared.Point; public class LeafletLocateEvent extends ConnectorEvent { private final Double accuracy; private final Double altitude; private final Double speed; private Point point; public LeafletLocateEvent(ClientConnector source, Point p, Double a, Double altitude, Double speed) { super(source); this.point = p; this.accuracy = a; this.altitude = altitude; this.speed = speed; } public Point getPoint() { return point; } public Double getAccuracy() { return accuracy; } public Double getAltitude() { return altitude; } public Double getSpeed() { return speed; } @Override public String toString() { return point.toString() + " a: " + accuracy + " alt:" + altitude; } }
877
0.719498
0.719498
41
20.414635
21.002874
102
false
false
0
0
0
0
0
0
1.365854
false
false
13
f0dfed47f0e42f8bd493fba0131c933356ea23eb
38,740,605,039,303
2e01ab279b2ca2c252c1dd872de5be181e2a4a64
/src/com/lixueandroid/view/TouchTabScrollView.java
5e53e7788c5e49a07ce0ed1f2f0013a64fa3fed0
[]
no_license
heavenxue/lixueAndroids
https://github.com/heavenxue/lixueAndroids
fac3fa19924b2dadd614a0664fbf4882c4f3154c
fe19bd5722f2f39b98e49a3d543e5ec0123cf11f
refs/heads/master
2020-05-19T08:54:28.221000
2014-03-26T03:19:16
2014-03-26T03:19:16
12,450,163
6
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lixueandroid.view; import me.xiaopan.easyjava.util.StringUtils; import android.content.Context; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.view.LayoutInflater; import android.view.WindowManager; import android.view.animation.LinearInterpolator; import android.view.animation.TranslateAnimation; import android.widget.HorizontalScrollView; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.RadioGroup.OnCheckedChangeListener; import com.lixue.lixueandroid.R; /** * 一个融合了横向tab和viewPager的控件 * @author lixue * */ public class TouchTabScrollView extends LinearLayout{ private LinearLayout r1_tab; private HorizontalScrollView mHsv; private RadioGroup rg_nav_content;//tab身体 private ImageView iv_nav_indicator;//tab滑块 private int currentIndicatorLeft = 0;//tab小滑块左侧距离 private int indicatorWidth;//tab小滑块的宽度 public static String[] tabTitle; // 标题 private ViewPager mViewPager;//ViewPager //此构造函数是在布局文档中使用的时候,默认的就用了此构造函数 public TouchTabScrollView(Context context, AttributeSet attrs) { super(context, attrs); Init(); } //此构造函数是在new出这个实例时用到 public TouchTabScrollView(Context context) { super(context); Init(); } //初始化各个控件 public void Init(){ tabTitle = StringUtils.split((String) getContentDescription(), ' '); r1_tab=(LinearLayout)inflate(getContext(), R.layout.touchtab, null); mHsv=(HorizontalScrollView) r1_tab.findViewById(R.id.mHsv); rg_nav_content=(RadioGroup) r1_tab.findViewById(R.id.rg_nav_content); iv_nav_indicator=(ImageView) r1_tab.findViewById(R.id.iv_nav_indicator); mViewPager=(ViewPager) r1_tab.findViewById(R.id.mViewPager); setOnCheckChanged(); //初始化视图 DisplayMetrics dm = new DisplayMetrics(); WindowManager windowManager = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE); windowManager.getDefaultDisplay().getMetrics(dm); if(tabTitle.length<4){ indicatorWidth = dm.widthPixels / (tabTitle.length); }else{ indicatorWidth = dm.widthPixels / 4; } android.view.ViewGroup.LayoutParams cursor_Params = iv_nav_indicator.getLayoutParams(); cursor_Params.width = indicatorWidth;// 初始化滑动下标的宽 iv_nav_indicator.setLayoutParams(cursor_Params); //填充标题 rg_nav_content.removeAllViews(); for (int i = 0; i < tabTitle.length; i++) { RadioButton rb = (RadioButton) LayoutInflater.from(getContext()).inflate(R.layout.touchtab_nav_radiogroup_item, null); rb.setId(i); rb.setText(tabTitle[i]); if(tabTitle.length<4){ indicatorWidth=dm.widthPixels/tabTitle.length; } rb.setLayoutParams(new LayoutParams(indicatorWidth, LayoutParams.MATCH_PARENT)); rg_nav_content.addView(rb); } addView(r1_tab); rg_nav_content.check(0); mViewPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int arg0) { if (rg_nav_content != null && rg_nav_content.getChildCount() > arg0) { ((RadioButton) rg_nav_content.getChildAt(arg0)).performClick(); } } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); } //tab是由radioGroup组成和ImageView小滑块组成的,外皮由SynchorizontalScrollView包裹,radioGroup的事件见下面 //当radioGroup滑动时(选中时),ImageView小滑块也要跟着滑动 public void setOnCheckChanged(){ rg_nav_content.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { if (rg_nav_content.getChildAt(checkedId) != null) { //移动滑块并记录当前位置 TranslateAnimation animation = new TranslateAnimation(currentIndicatorLeft, ((RadioButton) rg_nav_content.getChildAt(checkedId)).getLeft(), 0f, 0f); animation.setInterpolator(new LinearInterpolator()); animation.setDuration(100); animation.setFillAfter(true); iv_nav_indicator.startAnimation(animation); currentIndicatorLeft = ((RadioButton) rg_nav_content.getChildAt(checkedId)).getLeft(); mViewPager.setCurrentItem(checkedId); // ViewPager 跟随一起 切换 if(tabTitle.length<4){ mHsv.smoothScrollTo((checkedId > 1 ? ((RadioButton) rg_nav_content.getChildAt(checkedId)).getLeft() : 0) - ((RadioButton) rg_nav_content.getChildAt(1)).getLeft(), 0); }else{ mHsv.smoothScrollTo((checkedId > 1 ? ((RadioButton) rg_nav_content.getChildAt(checkedId)).getLeft() : 0) - ((RadioButton) rg_nav_content.getChildAt(2)).getLeft(), 0); } } } }); } //得到viewPager对象 public ViewPager getViewPager(){ return mViewPager; } //得到tab的长度 public int getTabTitleLength(){ return tabTitle.length; } //得到tab的body public RadioGroup getTabBody(){ return rg_nav_content; } }
UTF-8
Java
5,373
java
TouchTabScrollView.java
Java
[ { "context": ".R;\r\n\r\n/**\r\n * 一个融合了横向tab和viewPager的控件\r\n * @author lixue\r\n *\r\n */\r\npublic class TouchTabScrollView extends", "end": 800, "score": 0.9986184239387512, "start": 795, "tag": "USERNAME", "value": "lixue" } ]
null
[]
package com.lixueandroid.view; import me.xiaopan.easyjava.util.StringUtils; import android.content.Context; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.view.LayoutInflater; import android.view.WindowManager; import android.view.animation.LinearInterpolator; import android.view.animation.TranslateAnimation; import android.widget.HorizontalScrollView; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.RadioGroup.OnCheckedChangeListener; import com.lixue.lixueandroid.R; /** * 一个融合了横向tab和viewPager的控件 * @author lixue * */ public class TouchTabScrollView extends LinearLayout{ private LinearLayout r1_tab; private HorizontalScrollView mHsv; private RadioGroup rg_nav_content;//tab身体 private ImageView iv_nav_indicator;//tab滑块 private int currentIndicatorLeft = 0;//tab小滑块左侧距离 private int indicatorWidth;//tab小滑块的宽度 public static String[] tabTitle; // 标题 private ViewPager mViewPager;//ViewPager //此构造函数是在布局文档中使用的时候,默认的就用了此构造函数 public TouchTabScrollView(Context context, AttributeSet attrs) { super(context, attrs); Init(); } //此构造函数是在new出这个实例时用到 public TouchTabScrollView(Context context) { super(context); Init(); } //初始化各个控件 public void Init(){ tabTitle = StringUtils.split((String) getContentDescription(), ' '); r1_tab=(LinearLayout)inflate(getContext(), R.layout.touchtab, null); mHsv=(HorizontalScrollView) r1_tab.findViewById(R.id.mHsv); rg_nav_content=(RadioGroup) r1_tab.findViewById(R.id.rg_nav_content); iv_nav_indicator=(ImageView) r1_tab.findViewById(R.id.iv_nav_indicator); mViewPager=(ViewPager) r1_tab.findViewById(R.id.mViewPager); setOnCheckChanged(); //初始化视图 DisplayMetrics dm = new DisplayMetrics(); WindowManager windowManager = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE); windowManager.getDefaultDisplay().getMetrics(dm); if(tabTitle.length<4){ indicatorWidth = dm.widthPixels / (tabTitle.length); }else{ indicatorWidth = dm.widthPixels / 4; } android.view.ViewGroup.LayoutParams cursor_Params = iv_nav_indicator.getLayoutParams(); cursor_Params.width = indicatorWidth;// 初始化滑动下标的宽 iv_nav_indicator.setLayoutParams(cursor_Params); //填充标题 rg_nav_content.removeAllViews(); for (int i = 0; i < tabTitle.length; i++) { RadioButton rb = (RadioButton) LayoutInflater.from(getContext()).inflate(R.layout.touchtab_nav_radiogroup_item, null); rb.setId(i); rb.setText(tabTitle[i]); if(tabTitle.length<4){ indicatorWidth=dm.widthPixels/tabTitle.length; } rb.setLayoutParams(new LayoutParams(indicatorWidth, LayoutParams.MATCH_PARENT)); rg_nav_content.addView(rb); } addView(r1_tab); rg_nav_content.check(0); mViewPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int arg0) { if (rg_nav_content != null && rg_nav_content.getChildCount() > arg0) { ((RadioButton) rg_nav_content.getChildAt(arg0)).performClick(); } } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); } //tab是由radioGroup组成和ImageView小滑块组成的,外皮由SynchorizontalScrollView包裹,radioGroup的事件见下面 //当radioGroup滑动时(选中时),ImageView小滑块也要跟着滑动 public void setOnCheckChanged(){ rg_nav_content.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { if (rg_nav_content.getChildAt(checkedId) != null) { //移动滑块并记录当前位置 TranslateAnimation animation = new TranslateAnimation(currentIndicatorLeft, ((RadioButton) rg_nav_content.getChildAt(checkedId)).getLeft(), 0f, 0f); animation.setInterpolator(new LinearInterpolator()); animation.setDuration(100); animation.setFillAfter(true); iv_nav_indicator.startAnimation(animation); currentIndicatorLeft = ((RadioButton) rg_nav_content.getChildAt(checkedId)).getLeft(); mViewPager.setCurrentItem(checkedId); // ViewPager 跟随一起 切换 if(tabTitle.length<4){ mHsv.smoothScrollTo((checkedId > 1 ? ((RadioButton) rg_nav_content.getChildAt(checkedId)).getLeft() : 0) - ((RadioButton) rg_nav_content.getChildAt(1)).getLeft(), 0); }else{ mHsv.smoothScrollTo((checkedId > 1 ? ((RadioButton) rg_nav_content.getChildAt(checkedId)).getLeft() : 0) - ((RadioButton) rg_nav_content.getChildAt(2)).getLeft(), 0); } } } }); } //得到viewPager对象 public ViewPager getViewPager(){ return mViewPager; } //得到tab的长度 public int getTabTitleLength(){ return tabTitle.length; } //得到tab的body public RadioGroup getTabBody(){ return rg_nav_content; } }
5,373
0.726514
0.719364
140
33.964287
31.799013
172
false
false
0
0
0
0
0
0
2.592857
false
false
13
71ed99dbc50506903b22d1a35c3b7d6ecb39d75f
23,905,788,023,761
4b5d4fd896a1e6eab9fe583f44b1c715b2d6da2b
/ncpjg/src/com/bric/ncpjg/bean/ProductInfoResult.java
a96f59e250eab8562394a9f475597eee0274b1dc
[]
no_license
cheshenghui/ncpjg
https://github.com/cheshenghui/ncpjg
a7a24fec583574ba6fc75927eabcb38c44083370
aa8c79d7e2ec9e7d2274494274aebc808922a4b4
refs/heads/master
2016-08-11T17:15:38.554000
2016-03-15T02:21:49
2016-03-15T02:21:49
53,117,232
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bric.ncpjg.bean; import java.util.List; public class ProductInfoResult { public int success; public String message; public List<ProductInfo> data; }
UTF-8
Java
166
java
ProductInfoResult.java
Java
[]
null
[]
package com.bric.ncpjg.bean; import java.util.List; public class ProductInfoResult { public int success; public String message; public List<ProductInfo> data; }
166
0.777108
0.777108
9
17.444445
12.667642
32
false
false
0
0
0
0
0
0
0.888889
false
false
13
b1a0df392dc8e98ac0782740e1c4095353f6ca12
7,224,135,055,091
820e67af2387a742a7b0d7e29769deb7dbd1bd92
/src/main/java/com/ipetrovic/master/messagingcalendar/dao/PredmetDao.java
d6e43162d86e38747c1a44dc3aabfa0474f3c17a
[]
no_license
ipetrovic92/messaging-calendar
https://github.com/ipetrovic92/messaging-calendar
4720bb516ba3542b23a3abeb310753a490e88215
faeb42e668fb85bb53e622554b678e91546a2eb0
refs/heads/master
2020-03-28T19:36:24.643000
2018-09-29T08:16:46
2018-09-29T08:16:46
148,991,816
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ipetrovic.master.messagingcalendar.dao; import org.springframework.stereotype.Repository; import com.ipetrovic.master.messagingcalendar.model.Predmet; @Repository public class PredmetDao extends Dao<Predmet, String>{ public PredmetDao() { super(Predmet.class); } }
UTF-8
Java
286
java
PredmetDao.java
Java
[]
null
[]
package com.ipetrovic.master.messagingcalendar.dao; import org.springframework.stereotype.Repository; import com.ipetrovic.master.messagingcalendar.model.Predmet; @Repository public class PredmetDao extends Dao<Predmet, String>{ public PredmetDao() { super(Predmet.class); } }
286
0.800699
0.800699
14
19.428572
22.780676
60
false
false
0
0
0
0
0
0
0.642857
false
false
13
9ede461d326f8008accb265e283fd94f91e528e4
38,457,137,179,416
b5bceafb6e1c108507eebcc4c054ec962c2de804
/code/src/utility/Constants.java
615122e13d0d431777fd296cbad535b2a79669c9
[]
no_license
KDMG/replacement-planning
https://github.com/KDMG/replacement-planning
77b2f234a85318c75570e122db4c3a002bf0285b
0041a6d119a9cf2ce9f972feb57002d336f08491
refs/heads/master
2022-11-18T19:03:54.611000
2020-07-15T16:23:41
2020-07-15T16:23:41
274,437,320
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package utility; public class Constants { // // public static final String EVENTLOG="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/CoreUpdated2000/SecondSet/LogSyntheticUpdatedNew_SE_noLC.xes"; //Wabo4SEFiltered // public static final String MODEL="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/CoreUpdated2000/SecondSet/Inductive20PetriNet.pnml"; // public static final String CONFORMANCE="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/CoreUpdated2000/SecondSet/Conformance/"; //AlignmentFilteredFiltered98Mined40New // public static final String GRAPHPATH="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/CoreUpdated2000/SecondSet/Grafi/graph"; // public static final String EVENTLOG="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/CoreUpdated2000/Final/LogSynthetic_SE_noLC.xes"; // public static final String MODEL="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/CoreUpdated2000/Final/Inductive20PetriNet.pnml"; // public static final String CONFORMANCE="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/CoreUpdated2000/Final/Conformance/"; //AlignmentFilteredFiltered98Mined40New // public static final String GRAPHPATH="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/CoreUpdated2000/Final/Grafi/graph"; //IMPORTANTE: il 11-07 ho rilanciato l'hospital perchè ho corretto IGBuilder!! // public static final String EVENTLOG="/Users/Laura/Documents/workspace/HospitalLog/Hospital_log_SE_noUnknow_Changed_noLC.xes"; //Wabo4SEFiltered // public static final String MODEL="/Users/Laura/Documents/workspace/HospitalLog/Inductive20_Hospital_log_SE_noUnknow_Res_modified_ChangedNames_noLC.pnml"; // public static final String CONFORMANCE="/Users/Laura/Documents/workspace/HospitalLog/Conformance/"; //AlignmentFilteredFiltered98Mined40New // public static final String GRAPHPATH="/Users/Laura/Documents/workspace/HospitalLog/Grafi/graph"; // public static final String EVENTLOG="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/logOnlyCoreSimplified_SE_noLC.xes"; // public static final String MODEL="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/Inductive20SimplifiedPetriNet.pnml"; // public static final String CONFORMANCE="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/Conformance/"; //AlignmentFilteredFiltered98Mined40New // public static final String GRAPHPATH="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/Grafi/graph"; // public static final String EVENTLOG="/Users/Laura/Documents/workspace/BPI12/BPI_Challenge_2012_SE.xes"; // public static final String MODEL="/Users/Laura/Documents/workspace/BPI12/Inductive40_BPI12_SE.pnml"; public static final String COVGRAPH="/Users/Laura/Documents/workspace/BPI12/Coverability.tsml"; // public static final String CONFORMANCE="/Users/Laura/Documents/workspace/BPI12/Conformance/"; //AlignmentFilteredFiltered98Mined40New // public static final String GRAPHPATH="/Users/Laura/Documents/workspace/BPI12/Grafi/graph"; // // public static final String EVENTLOG="/Users/Laura/Documents/workspace/HospitalLogThesis/Hospital_log_SE_noUnknow_Res_modified_ChangedNames_noLC_noAmp.xes"; // public static final String MODEL="/Users/Laura/Documents/workspace/HospitalLogThesis/Inductive20_Hospital_log_SE_noUnknow_Res_modified_ChangedNames_noLC.pnml"; // public static final String CONFORMANCE="/Users/Laura/Documents/workspace/HospitalLogThesis/Conformance/"; //AlignmentFilteredFiltered98Mined40New // public static final String GRAPHPATH="/Users/Laura/Documents/workspace/HospitalLogThesis/Grafi/graph"; ////// // public static final String EVENTLOG="/Users/Laura/Documents/workspace/WABO4/Wabo4SEFiltered.xes"; // public static final String MODEL="/Users/Laura/Documents/workspace/WABO4/Inductive40WaboNOFiltered.pnml"; // public static final String CONFORMANCE="/Users/Laura/Documents/workspace/WABO4/Conformance/"; //AlignmentFilteredFiltered98Mined40New // public static final String GRAPHPATH="/Users/Laura/Documents/workspace/WABO4/Grafi/graph"; // public static String EVENTLOG="/Users/Laura/Documents/workspace/BPI12/BPI_Challenge_2012_SE_Split1_200.xes"; // public static String MODEL="/Users/Laura/Documents/workspace/BPI12/Inductive40_BPI12_SE.pnml"; // public static String CONFORMANCE="/Users/Laura/Documents/workspace/BPI12/Conformance"; //AlignmentFilteredFiltered98Mined40New // public static String GRAPHPATH="/Users/Laura/Documents/workspace/BPI12/Grafi/graph"; // // public static final String EVENTLOG="/Users/Laura/Documents/workspace/LogTest/LogPerTest.xes"; // public static final String MODEL="/Users/Laura/Documents/workspace/LogTest/HeuristicPetriNet.pnml"; // public static final String CONFORMANCE="/Users/Laura/Documents/workspace/LogTest/Conformance/"; //AlignmentFilteredFiltered98Mined40New // public static final String GRAPHPATH="/Users/Laura/Documents/workspace/LogTest/Grafi/graph"; // // public static final String EVENTLOG="/Users/Laura/Documents/workspace/researchTeam/W2NewDR3_sett_SE_NoVirgola.xes"; // public static final String MODEL="/Users/Laura/Documents/workspace/researchTeam/inductive20.pnml"; // public static final String CONFORMANCE="/Users/Laura/Documents/workspace/researchTeam/Conformance/"; //AlignmentFilteredFiltered98Mined40New // public static final String GRAPHPATH="/Users/Laura/Documents/BackupWindows/Test/WABO4/GrafiPOAlpha/graph"; // // /*public static final String EVENTLOG="/Users/Laura/Documents/workspace/NewSyntLog/logSynt11000_Anomalies50PerCent_noLC_Ridotto.xes"; public static final String MODEL="/Users/Laura/Documents/workspace/NewSyntLog/HeuristicPetriNet_noLC.pnml"; public static final String CONFORMANCE="/Users/Laura/Documents/workspace/NewSyntLog/Conformance/"; //AlignmentFilteredFiltered98Mined40New public static final String GRAPHPATH="/Users/Laura/Documents/workspace/NewSyntLog/graph/graph";*/ /*public static final String EVENTLOG="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_DM16/BPIDM16_SE_noLC.xes"; public static final String MODEL="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_DM16/PetriNet_Inductive_20.pnml"; public static final String CONFORMANCE="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_DM16/Conformance/"; //AlignmentFilteredFiltered98Mined40New public static final String GRAPHPATH="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_DM16/graphIGUpdated/";*/ /*public static final String EVENTLOG="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_dcc/HospitalLogFromAccess_dcc_noLC_SE.xes"; public static final String MODEL="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_dcc/PetriNet_Inductive20_SE.pnml"; public static final String CONFORMANCE="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_dcc/Conformance/"; //AlignmentFilteredFiltered98Mined40New public static final String GRAPHPATH="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_dcc/graphIGUpdated/";*/ public static final String EVENTLOG="/Users/Laura/Desktop/BankTransactionSubProcess6/BankTransactionSubProcess6.xes"; public static final String MODEL="/Users/Laura/Desktop/BankTransactionSubProcess6/BankTransactionSubProcess6_petriNet.pnml"; public static final String CONFORMANCE="/Users/Laura/Desktop/BankTransactionSubProcess6/Conformance/"; //AlignmentFilteredFiltered98Mined40New public static final String GRAPHPATH="/Users/Laura/Desktop/BankTransactionSubProcess6/graphs/"; // public static final String FOLDER="/Users/Laura/Documents/workspace/SubProcessPaper/NuovaSerieDiEsperimenti/Log_6An_10P/"; // public static final String EVENTLOG="/Users/Laura/Documents/workspace/SubProcessPaper/NuovaSerieDiEsperimenti/Log_6An_10P/log_6an_10P.xes"; // public static final String MODEL="/Users/Laura/Documents/workspace/SubProcessPaper/NuovaSerieDiEsperimenti/provaLaura.pnml"; // public static final String CONFORMANCE="/Users/Laura/Documents/workspace/SubProcessPaper/NuovaSerieDiEsperimenti/Log_6An_10P/Conformance/"; //AlignmentFilteredFiltered98Mined40New // public static final String GRAPHPATH="/Users/Laura/Documents/workspace/SubProcessPaper/NuovaSerieDiEsperimenti/Log_6An_10P/Grafi/"; /*public static final String EVENTLOG="/Users/Laura/Documents/workspace/LogBPI13/BPI_Incident_Filtered_ResGroup_SE_noLC.xes"; public static final String MODEL="/Users/Laura/Documents/workspace/LogBPI13/Inductive_20_BPI_Incident_Filtered_ResGroup_SE.pnml"; public static final String CONFORMANCE="/Users/Laura/Documents/workspace/LogBPI13/Conformance/"; //AlignmentFilteredFiltered98Mined40New public static final String GRAPHPATH="/Users/Laura/Documents/workspace/LogBPI13/graphIGUpdated/";*/ /*public static final String EVENTLOG="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_T101/BPIT101_SE_noLC.xes"; public static final String MODEL="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_T101/PetriNet_Inductive_20_ChangedName.pnml"; public static final String CONFORMANCE="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_T101/Conformance/"; //AlignmentFilteredFiltered98Mined40New public static final String GRAPHPATH="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_T101/graphIGUpdated/"; */ /*public static final String EVENTLOG="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_dcc/BP/Hospital_dcc_res_SE_noLC.xes"; public static final String MODEL="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_dcc/BP/PetriNet_Inductive20_SE_noLC_Res.pnml"; public static final String CONFORMANCE="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_dcc/BP/Conformance/"; //AlignmentFilteredFiltered98Mined40New public static final String GRAPHPATH="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_dcc/BP/graphIGUpdated/";*/ // }
UTF-8
Java
9,890
java
Constants.java
Java
[ { "context": "//\t\tpublic static final String EVENTLOG=\"/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/CoreU", "end": 105, "score": 0.5863502621650696, "start": 102, "tag": "USERNAME", "value": "ura" }, { "context": "d\r\n//\t\tpublic static final String MODEL=\"/Users/La...
null
[]
package utility; public class Constants { // // public static final String EVENTLOG="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/CoreUpdated2000/SecondSet/LogSyntheticUpdatedNew_SE_noLC.xes"; //Wabo4SEFiltered // public static final String MODEL="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/CoreUpdated2000/SecondSet/Inductive20PetriNet.pnml"; // public static final String CONFORMANCE="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/CoreUpdated2000/SecondSet/Conformance/"; //AlignmentFilteredFiltered98Mined40New // public static final String GRAPHPATH="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/CoreUpdated2000/SecondSet/Grafi/graph"; // public static final String EVENTLOG="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/CoreUpdated2000/Final/LogSynthetic_SE_noLC.xes"; // public static final String MODEL="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/CoreUpdated2000/Final/Inductive20PetriNet.pnml"; // public static final String CONFORMANCE="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/CoreUpdated2000/Final/Conformance/"; //AlignmentFilteredFiltered98Mined40New // public static final String GRAPHPATH="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/CoreUpdated2000/Final/Grafi/graph"; //IMPORTANTE: il 11-07 ho rilanciato l'hospital perchè ho corretto IGBuilder!! // public static final String EVENTLOG="/Users/Laura/Documents/workspace/HospitalLog/Hospital_log_SE_noUnknow_Changed_noLC.xes"; //Wabo4SEFiltered // public static final String MODEL="/Users/Laura/Documents/workspace/HospitalLog/Inductive20_Hospital_log_SE_noUnknow_Res_modified_ChangedNames_noLC.pnml"; // public static final String CONFORMANCE="/Users/Laura/Documents/workspace/HospitalLog/Conformance/"; //AlignmentFilteredFiltered98Mined40New // public static final String GRAPHPATH="/Users/Laura/Documents/workspace/HospitalLog/Grafi/graph"; // public static final String EVENTLOG="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/logOnlyCoreSimplified_SE_noLC.xes"; // public static final String MODEL="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/Inductive20SimplifiedPetriNet.pnml"; // public static final String CONFORMANCE="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/Conformance/"; //AlignmentFilteredFiltered98Mined40New // public static final String GRAPHPATH="/Users/Laura/Documents/workspace/SynthethicECML/OnlyCore/Grafi/graph"; // public static final String EVENTLOG="/Users/Laura/Documents/workspace/BPI12/BPI_Challenge_2012_SE.xes"; // public static final String MODEL="/Users/Laura/Documents/workspace/BPI12/Inductive40_BPI12_SE.pnml"; public static final String COVGRAPH="/Users/Laura/Documents/workspace/BPI12/Coverability.tsml"; // public static final String CONFORMANCE="/Users/Laura/Documents/workspace/BPI12/Conformance/"; //AlignmentFilteredFiltered98Mined40New // public static final String GRAPHPATH="/Users/Laura/Documents/workspace/BPI12/Grafi/graph"; // // public static final String EVENTLOG="/Users/Laura/Documents/workspace/HospitalLogThesis/Hospital_log_SE_noUnknow_Res_modified_ChangedNames_noLC_noAmp.xes"; // public static final String MODEL="/Users/Laura/Documents/workspace/HospitalLogThesis/Inductive20_Hospital_log_SE_noUnknow_Res_modified_ChangedNames_noLC.pnml"; // public static final String CONFORMANCE="/Users/Laura/Documents/workspace/HospitalLogThesis/Conformance/"; //AlignmentFilteredFiltered98Mined40New // public static final String GRAPHPATH="/Users/Laura/Documents/workspace/HospitalLogThesis/Grafi/graph"; ////// // public static final String EVENTLOG="/Users/Laura/Documents/workspace/WABO4/Wabo4SEFiltered.xes"; // public static final String MODEL="/Users/Laura/Documents/workspace/WABO4/Inductive40WaboNOFiltered.pnml"; // public static final String CONFORMANCE="/Users/Laura/Documents/workspace/WABO4/Conformance/"; //AlignmentFilteredFiltered98Mined40New // public static final String GRAPHPATH="/Users/Laura/Documents/workspace/WABO4/Grafi/graph"; // public static String EVENTLOG="/Users/Laura/Documents/workspace/BPI12/BPI_Challenge_2012_SE_Split1_200.xes"; // public static String MODEL="/Users/Laura/Documents/workspace/BPI12/Inductive40_BPI12_SE.pnml"; // public static String CONFORMANCE="/Users/Laura/Documents/workspace/BPI12/Conformance"; //AlignmentFilteredFiltered98Mined40New // public static String GRAPHPATH="/Users/Laura/Documents/workspace/BPI12/Grafi/graph"; // // public static final String EVENTLOG="/Users/Laura/Documents/workspace/LogTest/LogPerTest.xes"; // public static final String MODEL="/Users/Laura/Documents/workspace/LogTest/HeuristicPetriNet.pnml"; // public static final String CONFORMANCE="/Users/Laura/Documents/workspace/LogTest/Conformance/"; //AlignmentFilteredFiltered98Mined40New // public static final String GRAPHPATH="/Users/Laura/Documents/workspace/LogTest/Grafi/graph"; // // public static final String EVENTLOG="/Users/Laura/Documents/workspace/researchTeam/W2NewDR3_sett_SE_NoVirgola.xes"; // public static final String MODEL="/Users/Laura/Documents/workspace/researchTeam/inductive20.pnml"; // public static final String CONFORMANCE="/Users/Laura/Documents/workspace/researchTeam/Conformance/"; //AlignmentFilteredFiltered98Mined40New // public static final String GRAPHPATH="/Users/Laura/Documents/BackupWindows/Test/WABO4/GrafiPOAlpha/graph"; // // /*public static final String EVENTLOG="/Users/Laura/Documents/workspace/NewSyntLog/logSynt11000_Anomalies50PerCent_noLC_Ridotto.xes"; public static final String MODEL="/Users/Laura/Documents/workspace/NewSyntLog/HeuristicPetriNet_noLC.pnml"; public static final String CONFORMANCE="/Users/Laura/Documents/workspace/NewSyntLog/Conformance/"; //AlignmentFilteredFiltered98Mined40New public static final String GRAPHPATH="/Users/Laura/Documents/workspace/NewSyntLog/graph/graph";*/ /*public static final String EVENTLOG="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_DM16/BPIDM16_SE_noLC.xes"; public static final String MODEL="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_DM16/PetriNet_Inductive_20.pnml"; public static final String CONFORMANCE="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_DM16/Conformance/"; //AlignmentFilteredFiltered98Mined40New public static final String GRAPHPATH="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_DM16/graphIGUpdated/";*/ /*public static final String EVENTLOG="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_dcc/HospitalLogFromAccess_dcc_noLC_SE.xes"; public static final String MODEL="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_dcc/PetriNet_Inductive20_SE.pnml"; public static final String CONFORMANCE="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_dcc/Conformance/"; //AlignmentFilteredFiltered98Mined40New public static final String GRAPHPATH="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_dcc/graphIGUpdated/";*/ public static final String EVENTLOG="/Users/Laura/Desktop/BankTransactionSubProcess6/BankTransactionSubProcess6.xes"; public static final String MODEL="/Users/Laura/Desktop/BankTransactionSubProcess6/BankTransactionSubProcess6_petriNet.pnml"; public static final String CONFORMANCE="/Users/Laura/Desktop/BankTransactionSubProcess6/Conformance/"; //AlignmentFilteredFiltered98Mined40New public static final String GRAPHPATH="/Users/Laura/Desktop/BankTransactionSubProcess6/graphs/"; // public static final String FOLDER="/Users/Laura/Documents/workspace/SubProcessPaper/NuovaSerieDiEsperimenti/Log_6An_10P/"; // public static final String EVENTLOG="/Users/Laura/Documents/workspace/SubProcessPaper/NuovaSerieDiEsperimenti/Log_6An_10P/log_6an_10P.xes"; // public static final String MODEL="/Users/Laura/Documents/workspace/SubProcessPaper/NuovaSerieDiEsperimenti/provaLaura.pnml"; // public static final String CONFORMANCE="/Users/Laura/Documents/workspace/SubProcessPaper/NuovaSerieDiEsperimenti/Log_6An_10P/Conformance/"; //AlignmentFilteredFiltered98Mined40New // public static final String GRAPHPATH="/Users/Laura/Documents/workspace/SubProcessPaper/NuovaSerieDiEsperimenti/Log_6An_10P/Grafi/"; /*public static final String EVENTLOG="/Users/Laura/Documents/workspace/LogBPI13/BPI_Incident_Filtered_ResGroup_SE_noLC.xes"; public static final String MODEL="/Users/Laura/Documents/workspace/LogBPI13/Inductive_20_BPI_Incident_Filtered_ResGroup_SE.pnml"; public static final String CONFORMANCE="/Users/Laura/Documents/workspace/LogBPI13/Conformance/"; //AlignmentFilteredFiltered98Mined40New public static final String GRAPHPATH="/Users/Laura/Documents/workspace/LogBPI13/graphIGUpdated/";*/ /*public static final String EVENTLOG="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_T101/BPIT101_SE_noLC.xes"; public static final String MODEL="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_T101/PetriNet_Inductive_20_ChangedName.pnml"; public static final String CONFORMANCE="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_T101/Conformance/"; //AlignmentFilteredFiltered98Mined40New public static final String GRAPHPATH="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_T101/graphIGUpdated/"; */ /*public static final String EVENTLOG="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_dcc/BP/Hospital_dcc_res_SE_noLC.xes"; public static final String MODEL="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_dcc/BP/PetriNet_Inductive20_SE_noLC_Res.pnml"; public static final String CONFORMANCE="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_dcc/BP/Conformance/"; //AlignmentFilteredFiltered98Mined40New public static final String GRAPHPATH="/Users/Laura/Documents/workspace/Coopis/Hospital/Hospital_dcc/BP/graphIGUpdated/";*/ // }
9,890
0.816362
0.791991
103
94.009712
59.271385
182
false
false
0
0
0
0
105
0.175144
1.728155
false
false
13
e555c612deca5481f84c387471736f39a3c7f886
36,232,344,131,339
ada7f967d0b0a2c1cee532e67b8912cc9f8f7518
/w00/exercises/Structural/DynamicLinkage/RegularPizzaFactory.java
bee1ee7f515ab442b5e5182bf2343da391c06654
[]
no_license
konstantin-psu/designPatterns
https://github.com/konstantin-psu/designPatterns
092e6ac506dcf98937024a7e043917fec9e1f3a1
22fd1c99937d91bb5294616a6a1804bd7b3ab7ea
refs/heads/master
2021-01-10T08:32:34.728000
2016-03-11T23:19:00
2016-03-11T23:19:00
49,178,213
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Regular implementation of the AbstractPizzaFactory interface. * Implementations of the abstract pizza's component are nested * classes within this class. This is generally unusual, but in * this case it helps to keep each concrete pizza factory self * contained, hence easier to understand. */ class RegularPizzaFactory extends AbstractPizzaFactory { /** Regular implementation of the AbstractCrust interface. */ private class Crust implements AbstractCrust { public int calories () { return 350; } } /** Regular implementation of the AbstractCheese interface. */ private class Cheese implements AbstractCheese { public int calories () { return 600; } } /** * Method to create a crust. * @return this factory's implementation of a crust. */ AbstractCrust createCrust () { return new Crust (); } /** * Method to create a crust. * @return this factory's implementation of a crust. */ AbstractCheese createCheese () { return new Cheese (); } }
UTF-8
Java
1,036
java
RegularPizzaFactory.java
Java
[]
null
[]
/** * Regular implementation of the AbstractPizzaFactory interface. * Implementations of the abstract pizza's component are nested * classes within this class. This is generally unusual, but in * this case it helps to keep each concrete pizza factory self * contained, hence easier to understand. */ class RegularPizzaFactory extends AbstractPizzaFactory { /** Regular implementation of the AbstractCrust interface. */ private class Crust implements AbstractCrust { public int calories () { return 350; } } /** Regular implementation of the AbstractCheese interface. */ private class Cheese implements AbstractCheese { public int calories () { return 600; } } /** * Method to create a crust. * @return this factory's implementation of a crust. */ AbstractCrust createCrust () { return new Crust (); } /** * Method to create a crust. * @return this factory's implementation of a crust. */ AbstractCheese createCheese () { return new Cheese (); } }
1,036
0.69305
0.687259
27
37.370369
24.594711
66
false
false
0
0
0
0
0
0
0.296296
false
false
13
6c1db429b403c14689d99e04fcf4179635f3844f
37,357,625,554,151
57e4b3f1546863954c3580dc67f62bc177dc572a
/src/main/java/phenotypage/model/fiche/ficheOpu/FicheOpuService.java
0f6a81038bc1b938294089b5da5ea53589628bdb
[]
no_license
JeanCellier/Allice
https://github.com/JeanCellier/Allice
9302309e30298cd1eb8b9f822e8e37c3eca80bd3
553aaeda46e52f17de5b2c50661bcb630790038c
refs/heads/master
2021-01-13T05:25:48.918000
2017-02-09T10:19:57
2017-02-09T10:19:57
81,434,521
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package phenotypage.model.fiche.ficheOpu; import java.util.List; /** * @author fabien */ public interface FicheOpuService { List<FicheOpu> findAllFicheOpu(); FicheOpu createFichieOpu(String nom); FicheOpu addFicheOpu(FicheOpu fichieOpu); FicheOpu newFicheOpu(); FicheOpu findByNom(String nom); long countFicheOpu(); List<FicheOpu> findFicheOpuSNIG(); }
UTF-8
Java
370
java
FicheOpuService.java
Java
[ { "context": ".ficheOpu;\n\nimport java.util.List;\n\n/**\n * @author fabien\n */\npublic interface FicheOpuService\n{\n\tList<Fich", "end": 88, "score": 0.9434977173805237, "start": 82, "tag": "NAME", "value": "fabien" } ]
null
[]
package phenotypage.model.fiche.ficheOpu; import java.util.List; /** * @author fabien */ public interface FicheOpuService { List<FicheOpu> findAllFicheOpu(); FicheOpu createFichieOpu(String nom); FicheOpu addFicheOpu(FicheOpu fichieOpu); FicheOpu newFicheOpu(); FicheOpu findByNom(String nom); long countFicheOpu(); List<FicheOpu> findFicheOpuSNIG(); }
370
0.759459
0.759459
23
15.086957
16.06485
42
false
false
0
0
0
0
0
0
0.695652
false
false
13
ffcd9f5df0b5f056d65704ee922de9cd515f190e
37,391,985,299,491
c60751731bec00d2b4d3e46e59291612b399b296
/src/com/bytedance/java/java_base_study/day03/ReviewTest.java
992fad90e613d07b5939edbbee61a1ae91775f81
[]
no_license
sssv587/JavaFullStuckStudy
https://github.com/sssv587/JavaFullStuckStudy
4a194dd1ac258a00d362c900a7bc859c848309df
13fb8c355a231067de431d30831374d6dbfe7f58
refs/heads/master
2023-02-27T15:42:00.265000
2021-02-10T17:49:37
2021-02-10T17:49:37
325,601,741
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bytedance.java.java_base_study.day03; /** * @author yuhang.sun * @date 2020/12/13 - 23:55 */ public class ReviewTest { public static void main(String[] args) { char c1 = 'c'; char c2 = 97; System.out.println(c2); char c3 = 65; char c4 = '5'; System.out.println(c3); System.out.println((int) c4); } }
UTF-8
Java
383
java
ReviewTest.java
Java
[ { "context": "edance.java.java_base_study.day03;\n\n/**\n * @author yuhang.sun\n * @date 2020/12/13 - 23:55\n */\n\npublic class Rev", "end": 76, "score": 0.9997323155403137, "start": 66, "tag": "NAME", "value": "yuhang.sun" } ]
null
[]
package com.bytedance.java.java_base_study.day03; /** * @author yuhang.sun * @date 2020/12/13 - 23:55 */ public class ReviewTest { public static void main(String[] args) { char c1 = 'c'; char c2 = 97; System.out.println(c2); char c3 = 65; char c4 = '5'; System.out.println(c3); System.out.println((int) c4); } }
383
0.548303
0.480418
20
18.15
15.376199
49
false
false
0
0
0
0
0
0
0.4
false
false
13
fae11dfe0a1424654f802c1089c7ff64642fc5c0
9,105,330,694,691
f705012e9ed54d666a045d336887e0390a5ff88d
/app/src/main/java/sachika/eMart/NewProducts.java
a59da545520db442d55769345235421252f5936b
[]
no_license
sachikanimantha/eMart
https://github.com/sachikanimantha/eMart
dd8e70b3ae73d96924a6d4a7bfc37e37dd576d7e
c58e69f018467caea254a9d1eecfe3e7b26fd8c0
refs/heads/master
2021-04-28T17:17:01.149000
2018-02-17T11:32:24
2018-02-17T11:32:24
121,849,938
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package sachika.eMart; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.Gravity; import android.view.MenuItem; import android.view.View; import android.widget.Toast; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.google.zxing.integration.android.IntentIntegrator; import com.kosalgeek.android.json.JsonConverter; import com.mikepenz.fontawesome_typeface_library.FontAwesome; import com.mikepenz.google_material_typeface_library.GoogleMaterial; import com.mikepenz.materialdrawer.AccountHeader; import com.mikepenz.materialdrawer.AccountHeaderBuilder; import com.mikepenz.materialdrawer.Drawer; import com.mikepenz.materialdrawer.DrawerBuilder; import com.mikepenz.materialdrawer.holder.BadgeStyle; import com.mikepenz.materialdrawer.model.DividerDrawerItem; import com.mikepenz.materialdrawer.model.PrimaryDrawerItem; import com.mikepenz.materialdrawer.model.ProfileDrawerItem; import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem; import com.mikepenz.materialdrawer.model.SecondaryDrawerItem; import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; import com.mikepenz.materialdrawer.model.interfaces.IProfile; import com.mikepenz.materialdrawer.model.interfaces.Nameable; import java.util.ArrayList; import sachika.eMart.web.HTTPPaths; public class NewProducts extends AppCompatActivity { //Toolbar private Toolbar mToolBar; //Navigation Drawer private AccountHeader headerResult = null; private Drawer result = null; private static final int PROFILE_SETTING = 1; RecyclerView rvNewProducts; //SharedPreferences SharedPreferences pref; SharedPreferences.Editor editor; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_products); //SharedPreferences pref = getSharedPreferences("login.conf", Context.MODE_PRIVATE); editor =pref.edit(); final int id = pref.getInt("user_id",-1); //Toolbar mToolBar = (Toolbar) findViewById(R.id.tb_main); mToolBar.setTitle("New Arrivals"); //set the back arrow in the toolbar setSupportActionBar(mToolBar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(false); mToolBar.inflateMenu(R.menu.menu_main); mToolBar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { int id = item.getItemId(); switch (id){ case R.id.cart: Intent intent = new Intent(getApplicationContext(),MyCartActivity.class); startActivity(intent); break; case R.id.category: IntentIntegrator intentIntegrator = new IntentIntegrator(NewProducts.this); intentIntegrator.setDesiredBarcodeFormats(IntentIntegrator.QR_CODE_TYPES); intentIntegrator.setPrompt("Scan QR"); intentIntegrator.setCameraId(0); intentIntegrator.setBeepEnabled(true); intentIntegrator.setBarcodeImageEnabled(false); intentIntegrator.initiateScan(); break; } return true; } }); //=========Navigation Drawer=========================================== //Drawer Header // Create a few sample profile final IProfile profile = new ProfileDrawerItem().withName("Sachika Nimantha").withEmail("sachi2011ac@gmail.com").withIcon(getResources().getDrawable(R.drawable.profile)); final IProfile profile2 = new ProfileDrawerItem().withName("Dilhara Jayathissa").withEmail("dilhara@gmail.com").withIcon(Uri.parse("https://avatars3.githubusercontent.com/u/887462?v=3&s=460")); final IProfile profile3 = new ProfileDrawerItem().withName("Ironman Muster").withEmail("ironman@gmail.com").withIcon(getResources().getDrawable(R.drawable.profile2)); final IProfile profile4 = new ProfileDrawerItem().withName("Superman House").withEmail("superman.house@gmail.com").withIcon(getResources().getDrawable(R.drawable.profile3)); final IProfile profile5 = new ProfileDrawerItem().withName("Mr. Xxx").withEmail("mister.xxx@gmail.com").withIcon(getResources().getDrawable(R.drawable.profile4)).withIdentifier(4); final IProfile profile6 = new ProfileDrawerItem().withName("Batman").withEmail("batman@gmail.com").withIcon(getResources().getDrawable(R.drawable.profile5)); // Create the AccountHeader headerResult = new AccountHeaderBuilder() .withActivity(this) .withHeaderBackground(R.drawable.header) .withTranslucentStatusBar(false) .addProfiles( profile, profile2, profile3, profile4, profile5, profile6, new ProfileSettingDrawerItem().withName("Add Account").withDescription("Add new eMart Account").withIcon(GoogleMaterial.Icon.gmd_plus_one).withIdentifier(PROFILE_SETTING), new ProfileSettingDrawerItem().withName("Manage Account").withIcon(GoogleMaterial.Icon.gmd_settings) ) .withOnAccountHeaderListener(new AccountHeader.OnAccountHeaderListener() { @Override public boolean onProfileChanged(View view, IProfile profile, boolean current) { //sample usage of the onProfileChanged listener //if the clicked item has the identifier 1 add a new profile ;) if (profile instanceof IDrawerItem && ((IDrawerItem) profile).getIdentifier() == PROFILE_SETTING) { IProfile newProfile = new ProfileDrawerItem().withNameShown(true).withName("Batman").withEmail("batman@gmail.com").withIcon(getResources().getDrawable(R.drawable.profile5)); if (headerResult.getProfiles() != null) { //we know that there are 2 setting elements. set the new profile above them ;) headerResult.addProfile(newProfile, headerResult.getProfiles().size() - 2); } else { headerResult.addProfiles(newProfile); } } //false if you have not consumed the event and it should close the drawer return false; } }) .withSavedInstance(savedInstanceState) .build(); //Drawer result = new DrawerBuilder() .withActivity(this) .withToolbar(mToolBar) .withDisplayBelowStatusBar(false) .withActionBarDrawerToggleAnimated(true) .withDrawerGravity(Gravity.LEFT) .withSavedInstance(savedInstanceState) .withSelectedItem(0) .withTranslucentStatusBar(false) .withAccountHeader(headerResult) //set the AccountHeader created earlier for the header .addDrawerItems( new PrimaryDrawerItem().withName("Home").withIcon(GoogleMaterial.Icon.gmd_home).withIdentifier(1).withSelectedColor(3), new PrimaryDrawerItem().withName("My Account").withIcon(GoogleMaterial.Icon.gmd_account_box).withIdentifier(2).withSelectedColor(2), new PrimaryDrawerItem().withName("Shopping Cart").withIcon(FontAwesome.Icon.faw_shopping_cart).withIdentifier(3).withBadge("5").withBadgeStyle(new BadgeStyle(Color.RED, Color.RED)), new PrimaryDrawerItem().withName("My Orders").withIcon(GoogleMaterial.Icon.gmd_list).withIdentifier(4), new PrimaryDrawerItem().withName("Messages").withIcon(GoogleMaterial.Icon.gmd_message).withIdentifier(5).withBadge("2").withBadgeStyle(new BadgeStyle(Color.RED, Color.RED)), new DividerDrawerItem(), new PrimaryDrawerItem().withDescription("Explore Yourself...").withName("eMart App").withIdentifier(6), new SecondaryDrawerItem().withName("Settings").withIcon(GoogleMaterial.Icon.gmd_settings), new SecondaryDrawerItem().withName("About Us").withIcon(GoogleMaterial.Icon.gmd_apps).withTag("Bullhorn"), new SecondaryDrawerItem().withName("Logout").withIcon(GoogleMaterial.Icon.gmd_exit_to_app) ) // add the items we want to use with our Drawer .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { @Override public boolean onItemClick(View view, int position, IDrawerItem drawerItem) { if (drawerItem instanceof Nameable) { Toast.makeText(NewProducts.this, ((Nameable) drawerItem).getName().getText(NewProducts.this), Toast.LENGTH_SHORT).show(); } if (((Nameable) drawerItem).getName().getText(NewProducts.this)=="Shopping Cart"){ Intent intent = new Intent(getApplicationContext(),MyCartActivity.class); startActivity(intent); } if (((Nameable) drawerItem).getName().getText(NewProducts.this)=="Home"){ Intent intent = new Intent(getApplicationContext(), MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); } if (((Nameable) drawerItem).getName().getText(NewProducts.this)=="My Account"){ Intent intent = new Intent(getApplicationContext(),MyAccountActivity.class); startActivity(intent); } if (((Nameable) drawerItem).getName().getText(NewProducts.this)=="Messages"){ Intent intent = new Intent(getApplicationContext(),SignInActivity.class); startActivity(intent); } if (((Nameable) drawerItem).getName().getText(NewProducts.this)=="My Orders"){ Intent intent = new Intent(getApplicationContext(),SignUpActivity.class); startActivity(intent); } if (((Nameable) drawerItem).getName().getText(NewProducts.this)=="Settings"){ Intent intent = new Intent(getApplicationContext(),WelcomeActivity.class); startActivity(intent); } if (((Nameable) drawerItem).getName().getText(NewProducts.this)=="Logout"){ //pref.edit().clear().commit(); editor = pref.edit(); editor.clear(); editor.commit(); Intent intent = new Intent(getApplicationContext(), MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); } return false; } }) .build(); //set Data to RecyclerView String newUrl = HTTPPaths.baseUrl+ "new_all_product.php"; // String newUrl ="http://sampletemp.96.lt/android/new_all_product.php"; rvNewProducts = (RecyclerView)findViewById(R.id.rvNewProducts); LinearLayoutManager layoutManager = new GridLayoutManager(NewProducts.this,2,LinearLayoutManager.VERTICAL,false); rvNewProducts.setLayoutManager(layoutManager); rvNewProducts.setHasFixedSize(true); //======= StringRequest stringRequest = new StringRequest(Request.Method.GET, newUrl, new Response.Listener<String>() { @Override public void onResponse(String response) { ArrayList<Product> proCategoryList = new JsonConverter<Product>() .toArrayList(response, Product.class); NewProductAdapter newProductAdapter = new NewProductAdapter(NewProducts.this,proCategoryList); rvNewProducts.setAdapter(newProductAdapter); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { } }); MySingleton.getInstance(getApplicationContext()).addToRequestQueue(stringRequest); //======= }//end onCreate }
UTF-8
Java
14,041
java
NewProducts.java
Java
[ { "context": "ofile profile = new ProfileDrawerItem().withName(\"Sachika Nimantha\").withEmail(\"sachi2011ac@gmail.com\").withIcon(get", "end": 4229, "score": 0.9998805522918701, "start": 4213, "tag": "NAME", "value": "Sachika Nimantha" }, { "context": "werItem().withName(\"Sachika N...
null
[]
package sachika.eMart; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.Gravity; import android.view.MenuItem; import android.view.View; import android.widget.Toast; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.google.zxing.integration.android.IntentIntegrator; import com.kosalgeek.android.json.JsonConverter; import com.mikepenz.fontawesome_typeface_library.FontAwesome; import com.mikepenz.google_material_typeface_library.GoogleMaterial; import com.mikepenz.materialdrawer.AccountHeader; import com.mikepenz.materialdrawer.AccountHeaderBuilder; import com.mikepenz.materialdrawer.Drawer; import com.mikepenz.materialdrawer.DrawerBuilder; import com.mikepenz.materialdrawer.holder.BadgeStyle; import com.mikepenz.materialdrawer.model.DividerDrawerItem; import com.mikepenz.materialdrawer.model.PrimaryDrawerItem; import com.mikepenz.materialdrawer.model.ProfileDrawerItem; import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem; import com.mikepenz.materialdrawer.model.SecondaryDrawerItem; import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; import com.mikepenz.materialdrawer.model.interfaces.IProfile; import com.mikepenz.materialdrawer.model.interfaces.Nameable; import java.util.ArrayList; import sachika.eMart.web.HTTPPaths; public class NewProducts extends AppCompatActivity { //Toolbar private Toolbar mToolBar; //Navigation Drawer private AccountHeader headerResult = null; private Drawer result = null; private static final int PROFILE_SETTING = 1; RecyclerView rvNewProducts; //SharedPreferences SharedPreferences pref; SharedPreferences.Editor editor; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_products); //SharedPreferences pref = getSharedPreferences("login.conf", Context.MODE_PRIVATE); editor =pref.edit(); final int id = pref.getInt("user_id",-1); //Toolbar mToolBar = (Toolbar) findViewById(R.id.tb_main); mToolBar.setTitle("New Arrivals"); //set the back arrow in the toolbar setSupportActionBar(mToolBar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(false); mToolBar.inflateMenu(R.menu.menu_main); mToolBar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { int id = item.getItemId(); switch (id){ case R.id.cart: Intent intent = new Intent(getApplicationContext(),MyCartActivity.class); startActivity(intent); break; case R.id.category: IntentIntegrator intentIntegrator = new IntentIntegrator(NewProducts.this); intentIntegrator.setDesiredBarcodeFormats(IntentIntegrator.QR_CODE_TYPES); intentIntegrator.setPrompt("Scan QR"); intentIntegrator.setCameraId(0); intentIntegrator.setBeepEnabled(true); intentIntegrator.setBarcodeImageEnabled(false); intentIntegrator.initiateScan(); break; } return true; } }); //=========Navigation Drawer=========================================== //Drawer Header // Create a few sample profile final IProfile profile = new ProfileDrawerItem().withName("<NAME>").withEmail("<EMAIL>").withIcon(getResources().getDrawable(R.drawable.profile)); final IProfile profile2 = new ProfileDrawerItem().withName("<NAME>").withEmail("<EMAIL>").withIcon(Uri.parse("https://avatars3.githubusercontent.com/u/887462?v=3&s=460")); final IProfile profile3 = new ProfileDrawerItem().withName("<NAME>").withEmail("<EMAIL>").withIcon(getResources().getDrawable(R.drawable.profile2)); final IProfile profile4 = new ProfileDrawerItem().withName("<NAME>").withEmail("<EMAIL>").withIcon(getResources().getDrawable(R.drawable.profile3)); final IProfile profile5 = new ProfileDrawerItem().withName("Mr. Xxx").withEmail("<EMAIL>").withIcon(getResources().getDrawable(R.drawable.profile4)).withIdentifier(4); final IProfile profile6 = new ProfileDrawerItem().withName("Batman").withEmail("<EMAIL>").withIcon(getResources().getDrawable(R.drawable.profile5)); // Create the AccountHeader headerResult = new AccountHeaderBuilder() .withActivity(this) .withHeaderBackground(R.drawable.header) .withTranslucentStatusBar(false) .addProfiles( profile, profile2, profile3, profile4, profile5, profile6, new ProfileSettingDrawerItem().withName("Add Account").withDescription("Add new eMart Account").withIcon(GoogleMaterial.Icon.gmd_plus_one).withIdentifier(PROFILE_SETTING), new ProfileSettingDrawerItem().withName("Manage Account").withIcon(GoogleMaterial.Icon.gmd_settings) ) .withOnAccountHeaderListener(new AccountHeader.OnAccountHeaderListener() { @Override public boolean onProfileChanged(View view, IProfile profile, boolean current) { //sample usage of the onProfileChanged listener //if the clicked item has the identifier 1 add a new profile ;) if (profile instanceof IDrawerItem && ((IDrawerItem) profile).getIdentifier() == PROFILE_SETTING) { IProfile newProfile = new ProfileDrawerItem().withNameShown(true).withName("Batman").withEmail("<EMAIL>").withIcon(getResources().getDrawable(R.drawable.profile5)); if (headerResult.getProfiles() != null) { //we know that there are 2 setting elements. set the new profile above them ;) headerResult.addProfile(newProfile, headerResult.getProfiles().size() - 2); } else { headerResult.addProfiles(newProfile); } } //false if you have not consumed the event and it should close the drawer return false; } }) .withSavedInstance(savedInstanceState) .build(); //Drawer result = new DrawerBuilder() .withActivity(this) .withToolbar(mToolBar) .withDisplayBelowStatusBar(false) .withActionBarDrawerToggleAnimated(true) .withDrawerGravity(Gravity.LEFT) .withSavedInstance(savedInstanceState) .withSelectedItem(0) .withTranslucentStatusBar(false) .withAccountHeader(headerResult) //set the AccountHeader created earlier for the header .addDrawerItems( new PrimaryDrawerItem().withName("Home").withIcon(GoogleMaterial.Icon.gmd_home).withIdentifier(1).withSelectedColor(3), new PrimaryDrawerItem().withName("My Account").withIcon(GoogleMaterial.Icon.gmd_account_box).withIdentifier(2).withSelectedColor(2), new PrimaryDrawerItem().withName("Shopping Cart").withIcon(FontAwesome.Icon.faw_shopping_cart).withIdentifier(3).withBadge("5").withBadgeStyle(new BadgeStyle(Color.RED, Color.RED)), new PrimaryDrawerItem().withName("My Orders").withIcon(GoogleMaterial.Icon.gmd_list).withIdentifier(4), new PrimaryDrawerItem().withName("Messages").withIcon(GoogleMaterial.Icon.gmd_message).withIdentifier(5).withBadge("2").withBadgeStyle(new BadgeStyle(Color.RED, Color.RED)), new DividerDrawerItem(), new PrimaryDrawerItem().withDescription("Explore Yourself...").withName("eMart App").withIdentifier(6), new SecondaryDrawerItem().withName("Settings").withIcon(GoogleMaterial.Icon.gmd_settings), new SecondaryDrawerItem().withName("About Us").withIcon(GoogleMaterial.Icon.gmd_apps).withTag("Bullhorn"), new SecondaryDrawerItem().withName("Logout").withIcon(GoogleMaterial.Icon.gmd_exit_to_app) ) // add the items we want to use with our Drawer .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { @Override public boolean onItemClick(View view, int position, IDrawerItem drawerItem) { if (drawerItem instanceof Nameable) { Toast.makeText(NewProducts.this, ((Nameable) drawerItem).getName().getText(NewProducts.this), Toast.LENGTH_SHORT).show(); } if (((Nameable) drawerItem).getName().getText(NewProducts.this)=="Shopping Cart"){ Intent intent = new Intent(getApplicationContext(),MyCartActivity.class); startActivity(intent); } if (((Nameable) drawerItem).getName().getText(NewProducts.this)=="Home"){ Intent intent = new Intent(getApplicationContext(), MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); } if (((Nameable) drawerItem).getName().getText(NewProducts.this)=="My Account"){ Intent intent = new Intent(getApplicationContext(),MyAccountActivity.class); startActivity(intent); } if (((Nameable) drawerItem).getName().getText(NewProducts.this)=="Messages"){ Intent intent = new Intent(getApplicationContext(),SignInActivity.class); startActivity(intent); } if (((Nameable) drawerItem).getName().getText(NewProducts.this)=="My Orders"){ Intent intent = new Intent(getApplicationContext(),SignUpActivity.class); startActivity(intent); } if (((Nameable) drawerItem).getName().getText(NewProducts.this)=="Settings"){ Intent intent = new Intent(getApplicationContext(),WelcomeActivity.class); startActivity(intent); } if (((Nameable) drawerItem).getName().getText(NewProducts.this)=="Logout"){ //pref.edit().clear().commit(); editor = pref.edit(); editor.clear(); editor.commit(); Intent intent = new Intent(getApplicationContext(), MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); } return false; } }) .build(); //set Data to RecyclerView String newUrl = HTTPPaths.baseUrl+ "new_all_product.php"; // String newUrl ="http://sampletemp.96.lt/android/new_all_product.php"; rvNewProducts = (RecyclerView)findViewById(R.id.rvNewProducts); LinearLayoutManager layoutManager = new GridLayoutManager(NewProducts.this,2,LinearLayoutManager.VERTICAL,false); rvNewProducts.setLayoutManager(layoutManager); rvNewProducts.setHasFixedSize(true); //======= StringRequest stringRequest = new StringRequest(Request.Method.GET, newUrl, new Response.Listener<String>() { @Override public void onResponse(String response) { ArrayList<Product> proCategoryList = new JsonConverter<Product>() .toArrayList(response, Product.class); NewProductAdapter newProductAdapter = new NewProductAdapter(NewProducts.this,proCategoryList); rvNewProducts.setAdapter(newProductAdapter); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { } }); MySingleton.getInstance(getApplicationContext()).addToRequestQueue(stringRequest); //======= }//end onCreate }
13,921
0.598248
0.59426
264
52.185608
43.282017
205
false
false
0
0
0
0
0
0
0.617424
false
false
13
b9f84cf46b657355a1c5d69143a463f1f4bbc2c4
1,614,907,718,738
24b00f87c0bd124973a2866453206cbcf7a90fb8
/quarkus/reactive-sql/src/main/java/org/acme/reactive/Coffee.java
459256ef49bb96f721464355d377a09b01823af7
[]
no_license
rhidsa/rhoar-getting-started
https://github.com/rhidsa/rhoar-getting-started
9c89fa717702214ed7b3fc3c060d22a96ee8d123
45749f4a686cb7aa8451a7715f76afb5baedf68c
refs/heads/master
2023-04-02T12:18:19.501000
2021-03-17T13:17:34
2021-03-17T13:17:34
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.acme.reactive; import java.util.ArrayList; import java.util.List; import java.util.concurrent.CompletionStage; import io.vertx.axle.pgclient.PgPool; import io.vertx.axle.sqlclient.Row; import io.vertx.axle.sqlclient.RowSet; import io.vertx.axle.sqlclient.Tuple; public class Coffee { public Long id; public String name; public Coffee() { } public Coffee(String name) { this.name = name; } public Coffee(Long id, String name) { this.id = id; this.name = name; } public static CompletionStage<List<Coffee>> findAll(PgPool client) { return client.query("SELECT id, name FROM coffee ORDER BY name ASC").thenApply(pgRowSet -> { List<Coffee> list = new ArrayList<>(pgRowSet.size()); for (Row row : pgRowSet) { list.add(from(row)); } return list; }); } // TODO FindById public CompletionStage<Long> save(PgPool client) { return client.preparedQuery("INSERT INTO coffee (name) VALUES ($1) RETURNING (id)", Tuple.of(name)) .thenApply(pgRowSet -> pgRowSet.iterator().next().getLong("id")); } public CompletionStage<Boolean> update(PgPool client) { return client.preparedQuery("UPDATE coffee SET name = $1 WHERE id = $2", Tuple.of(name, id)) .thenApply(pgRowSet -> pgRowSet.rowCount() == 1); } public static CompletionStage<Boolean> delete(PgPool client, Long id) { return client.preparedQuery("DELETE FROM coffee WHERE id = $1", Tuple.of(id)) .thenApply(pgRowSet -> pgRowSet.rowCount() == 1); } private static Coffee from(Row row) { return new Coffee(row.getLong("id"), row.getString("name")); } }
UTF-8
Java
1,773
java
Coffee.java
Java
[]
null
[]
package org.acme.reactive; import java.util.ArrayList; import java.util.List; import java.util.concurrent.CompletionStage; import io.vertx.axle.pgclient.PgPool; import io.vertx.axle.sqlclient.Row; import io.vertx.axle.sqlclient.RowSet; import io.vertx.axle.sqlclient.Tuple; public class Coffee { public Long id; public String name; public Coffee() { } public Coffee(String name) { this.name = name; } public Coffee(Long id, String name) { this.id = id; this.name = name; } public static CompletionStage<List<Coffee>> findAll(PgPool client) { return client.query("SELECT id, name FROM coffee ORDER BY name ASC").thenApply(pgRowSet -> { List<Coffee> list = new ArrayList<>(pgRowSet.size()); for (Row row : pgRowSet) { list.add(from(row)); } return list; }); } // TODO FindById public CompletionStage<Long> save(PgPool client) { return client.preparedQuery("INSERT INTO coffee (name) VALUES ($1) RETURNING (id)", Tuple.of(name)) .thenApply(pgRowSet -> pgRowSet.iterator().next().getLong("id")); } public CompletionStage<Boolean> update(PgPool client) { return client.preparedQuery("UPDATE coffee SET name = $1 WHERE id = $2", Tuple.of(name, id)) .thenApply(pgRowSet -> pgRowSet.rowCount() == 1); } public static CompletionStage<Boolean> delete(PgPool client, Long id) { return client.preparedQuery("DELETE FROM coffee WHERE id = $1", Tuple.of(id)) .thenApply(pgRowSet -> pgRowSet.rowCount() == 1); } private static Coffee from(Row row) { return new Coffee(row.getLong("id"), row.getString("name")); } }
1,773
0.626058
0.622673
60
28.566668
29.457521
107
false
false
0
0
0
0
0
0
0.483333
false
false
13
8f91209474baf949c7a2fab506350913b6cf26a1
16,982,300,701,340
50f278ca5ea09a5f47efd4ad0eff977568b59ba4
/src/entity/RspPerson.java
6f4d5f54a8c21322866652d57151a236c4462242
[]
no_license
OrangeTuan/XmlReader
https://github.com/OrangeTuan/XmlReader
a715e90b83b02073ca71aed02844cfa6b2864b6f
340b09e2af0fbc1ee740e48beac229c01870ecc0
refs/heads/master
2022-02-21T19:59:28.801000
2019-07-18T04:56:47
2019-07-18T04:56:47
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package entity; import Annotation.XmlAttr; import Annotation.XmlAttrImplicit; import java.util.ArrayList; import java.util.List; public class RspPerson { @XmlAttr("message") private String rspState; @XmlAttrImplicit("ryxxlist") private List<Person> personlist; public String getRspState() { return rspState; } public void setRspState(String rspState) { this.rspState = rspState; } public List<Person> getPersonlist() { return personlist; } public void setPersonlist(List<Person> personlist) { this.personlist = personlist; } }
UTF-8
Java
614
java
RspPerson.java
Java
[]
null
[]
package entity; import Annotation.XmlAttr; import Annotation.XmlAttrImplicit; import java.util.ArrayList; import java.util.List; public class RspPerson { @XmlAttr("message") private String rspState; @XmlAttrImplicit("ryxxlist") private List<Person> personlist; public String getRspState() { return rspState; } public void setRspState(String rspState) { this.rspState = rspState; } public List<Person> getPersonlist() { return personlist; } public void setPersonlist(List<Person> personlist) { this.personlist = personlist; } }
614
0.679153
0.679153
30
19.466667
16.272131
56
false
false
0
0
0
0
0
0
0.366667
false
false
13
61b3d3d12244f4a84851da971c13e52beabb8413
20,813,411,532,592
0986005fcc72a332e787ed24f7adcd119eda21e0
/meidianyi-common/src/main/java/com/meidianyi/shop/service/pojo/shop/member/card/UserCardChargeListVo.java
36c64272bccd8c1a5a88c59b0b537759b9cf6978
[]
no_license
moutainhigh/meidianyishop
https://github.com/moutainhigh/meidianyishop
73ae414649175f7277d60b385a53987d904b1f1c
bd82267d824d4dfe2333622393fde45ac0a78911
refs/heads/main
2023-03-04T11:25:50.640000
2021-02-17T04:59:37
2021-02-17T04:59:37
342,996,236
0
1
null
true
2021-02-28T01:31:23
2021-02-28T01:31:23
2021-02-17T05:00:17
2021-02-17T05:00:03
10,179
0
0
0
null
false
false
package com.meidianyi.shop.service.pojo.shop.member.card; import lombok.Getter; import lombok.Setter; import java.math.BigDecimal; import java.sql.Timestamp; /** * @author: 王兵兵 * @create: 2020-05-18 17:33 **/ @Setter @Getter public class UserCardChargeListVo { /** * 充值单号 */ private String orderSn; /** * */ private Integer userId; /** * 会员卡名称 */ private String cardName; /** * 卡ID */ private Integer cardId; /** * 会员昵称 */ private String username; /** * 会员手机号 */ private String mobile; /** * 充值时间 */ private Timestamp createTime; /** * 充值金额 */ private BigDecimal charge; /** * 当次充值后卡余额 */ private BigDecimal afterChargeMoney; /** * */ private Integer reasonId; /** * 充值原因 */ private String reason; /** * 充值类型 1发卡 2用户充值 3 管理员操作 */ private Byte changeType; }
UTF-8
Java
1,093
java
UserCardChargeListVo.java
Java
[ { "context": "imal;\nimport java.sql.Timestamp;\n\n/**\n * @author: 王兵兵\n * @create: 2020-05-18 17:33\n **/\n@Setter\n@Getter", "end": 180, "score": 0.9651299715042114, "start": 177, "tag": "NAME", "value": "王兵兵" } ]
null
[]
package com.meidianyi.shop.service.pojo.shop.member.card; import lombok.Getter; import lombok.Setter; import java.math.BigDecimal; import java.sql.Timestamp; /** * @author: 王兵兵 * @create: 2020-05-18 17:33 **/ @Setter @Getter public class UserCardChargeListVo { /** * 充值单号 */ private String orderSn; /** * */ private Integer userId; /** * 会员卡名称 */ private String cardName; /** * 卡ID */ private Integer cardId; /** * 会员昵称 */ private String username; /** * 会员手机号 */ private String mobile; /** * 充值时间 */ private Timestamp createTime; /** * 充值金额 */ private BigDecimal charge; /** * 当次充值后卡余额 */ private BigDecimal afterChargeMoney; /** * */ private Integer reasonId; /** * 充值原因 */ private String reason; /** * 充值类型 1发卡 2用户充值 3 管理员操作 */ private Byte changeType; }
1,093
0.53524
0.519918
64
14.296875
11.521284
57
false
false
0
0
0
0
0
0
0.265625
false
false
13
25ee72df0d201da40b03eb667ebc6699dcb508d2
13,065,290,520,826
aa23839617dc4b05425a0702281c39dc716c134b
/src/test/java/com/whattodo/test/Test.java
91fc0168e749ae319ce39a1764518ee3d9c1a85c
[]
no_license
knn046101/getTest1
https://github.com/knn046101/getTest1
a4bf11053d40e7383c472532b1cddf9cb7c259b8
f839fff54b63883eaae0ddd730c5b126ee943538
refs/heads/master
2021-01-12T14:24:53.444000
2016-11-10T00:39:12
2016-11-10T00:39:12
69,933,980
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.whattodo.test; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; import static org.junit.Assert.assertThat; import java.util.Date; import java.util.List; import org.junit.Before; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.whattodo.config.ApplicationConfig; import com.whattodo.dto.Admin; import com.whattodo.dto.Advertisement; import com.whattodo.dto.Benefit; import com.whattodo.dto.Board; import com.whattodo.dto.BoardsFollows; import com.whattodo.dto.BoardsGoods; import com.whattodo.dto.City; import com.whattodo.dto.Meeting; import com.whattodo.dto.MeetingBoard; import com.whattodo.dto.MeetingBoardReply; import com.whattodo.dto.Member; import com.whattodo.dto.Tokens; import com.whattodo.repo.AdminRepo; import com.whattodo.repo.AdvertisementRepo; import com.whattodo.repo.BenefitRepo; import com.whattodo.repo.BoardRepo; import com.whattodo.repo.MeetingBoardReplyRepo; import com.whattodo.repo.MeetingBoardRepo; import com.whattodo.repo.MeetingRepo; import com.whattodo.repo.MemberRepo; import com.whattodo.repo.NotificationRepo; import com.whattodo.repo.TokenRepo; import com.whattodo.service.BoardServiceInterface; import com.whattodo.service.MeetingService; import com.whattodo.service.MemberService; import com.whattodo.service.RegionService; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes={ApplicationConfig.class}) public class Test { @Autowired AdminRepo adminInterface; @Autowired MemberRepo memberRepo; @Autowired ApplicationConfig ac; @Autowired AdvertisementRepo adrepo; @Autowired BenefitRepo br; @Autowired MeetingBoardRepo mbr; @Autowired MeetingRepo mr; @Autowired MeetingBoardReplyRepo mbrr; @Autowired BoardRepo boardrepo; @Autowired TokenRepo tokenrepo; @Before public void setUp() throws Exception { } @org.junit.Test public void ddtest() { assertThat(ac, is(notNullValue())); } @Autowired MemberService ms; @org.junit.Test public void tokeninserttest() { Tokens token = new Tokens("123asdas",1); int result = tokenrepo.addClientToken(token); assertThat(result, is(notNullValue())); } @org.junit.Test public void tokenalltest() { List<Tokens> list = tokenrepo.selectAlltokens(); assertThat(list, is(notNullValue())); } @org.junit.Test public void tokenAllowalltest() { List<Tokens> list = tokenrepo.selectAllowtokens(); assertThat(list, is(notNullValue())); } @org.junit.Test public void tokenupdatetest() { Tokens token = new Tokens("123asdas",0); int result = tokenrepo.updateClientToken(token); assertThat(result, is(1)); } @org.junit.Test public void test() { Admin admin=ms.getAdmin("admin"); assertThat(admin, is(notNullValue())); assertThat(admin.getPass(), is("admin123!")); } @org.junit.Test public void serviceAdminTest() { Admin admin=adminInterface.getAdmin("admin"); assertThat(admin, is(notNullValue())); assertThat(admin.getPass(), is("1234")); } @org.junit.Test public void memeberTest() { Member member=memberRepo.getMemberById("jong"); assertThat(member, is(notNullValue())); assertThat(member.getPass(), is("1234")); } @org.junit.Test public void deletememeberTest() { int result=memberRepo.deleteMember("jong"); assertThat(result, is(1)); } @org.junit.Test public void insertMemberTest() { Member member = new Member(); member.setId("dong"); member.setPass("1234"); member.setNickname("jong"); member.setEmail("knn046101@naver.com"); member.setRegion("경기도 광주시"); member.setBirth("19920328"); member.setFavorite("운동#헬스"); member.setProfileImg("/img/path"); member.setQuestion("출신 고등학교는 ?"); member.setAnswer("광주중앙고등학교"); member.setDivision("Editor"); int result=memberRepo.insertMember(member); assertThat(result, is(1)); } @org.junit.Test public void updateMemberTest() { Member member = new Member(); member.setId("dong"); member.setPass("1111"); member.setNickname("jjong"); member.setRegion("경기도 광주시"); member.setFavorite("운동#헬스"); member.setProfileImg("/img/path"); int result=memberRepo.updateMember(member); assertThat(result, is(1)); } @Autowired MeetingRepo mrepo; @org.junit.Test public void updateMeetingTest() { Meeting meeting = new Meeting(); meeting.setMeetingTitle("예사모"); meeting.setMeetingContent("예리 사랑 모임"); meeting.setMeetingKeyword("#예리#예리사랑"); meeting.setMeetingNo(101); meeting.setMeetingImg("이미지"); meeting.setPlace("경기도,광주시"); int result= mrepo.updateMeeting(meeting); assertThat(result, is(1)); } @org.junit.Test public void insertAds(){ Advertisement ad = new Advertisement(); ad.setAdsTitle("팔로우"); ad.setAdsImg("/link"); ad.setLink("link"); ad.setAdminId("admin"); int result=adrepo.insertAd(ad); assertThat(result, is(1)); } @org.junit.Test public void deleteAds(){ int result=adrepo.deleteAd(9); assertThat(result, is(1)); } @org.junit.Test public void selectgoodmainbesttest(){ List<Board> result=boardrepo.selectBoardByGoodMainBest(); assertThat(result, is(notNullValue())); } @org.junit.Test public void selectAllAdvertisement(){ java.util.List <Advertisement> list = adrepo.selectAllAdvertisement(); assertThat(list.size(), is(1)); } @org.junit.Test public void selectAdvertisement(){ List <Advertisement> list = adrepo.selectAdvertisement(); assertThat(list, notNullValue()); } @org.junit.Test public void updateAd(){ Advertisement ad = new Advertisement(); ad.setAdsNo(25); ad.setAdsTitle("mid"); ad.setAdsImg("img"); ad.setLink("link"); ad.setAdminId("admin"); ad.setOptionFlag(1); int result = adrepo.updateAd(ad); assertThat(result, is(1)); } @org.junit.Test public void insertBenefit(){ Benefit benefit = new Benefit(); benefit.setBenefitNo("DS-1"); benefit.setBenefitTitle("밥주떼여"); benefit.setStartDate(new Date()); benefit.setEndDate(new Date()); benefit.setPlace("장소"); benefit.setAdminId("admin"); int result=br.insertBenifit(benefit); assertThat(result, is(1)); } @org.junit.Test public void insertMembersBenefit(){ int result=br.insertMembersBenefit("DS-1", "jong"); assertThat(result, is(1)); } @org.junit.Test public void selectBenefitByMemberId(){ List <Benefit> benefits=br.selectBenefitByMemberId("jong"); assertThat(benefits.size(), is(1)); } @org.junit.Test public void insertMeeting(){ Meeting meeting = new Meeting(); meeting.setMeetingTitle("제목"); meeting.setMeetingContent("내용"); meeting.setMeetingKeyword("키워드"); meeting.setMeetingImg("이미지"); meeting.setId("knn046101"); meeting.setPlace("jong"); int result=mr.insertMeeting(meeting); assertThat(result, is(1)); } @org.junit.Test public void insertMeetingBoard(){ MeetingBoard meetingBoard = new MeetingBoard(); meetingBoard.setMeetingBoardTitle("까메오"); meetingBoard.setMeetingBoardContent("쑤ㅠ바랑"); meetingBoard.setMeetingNo(1); meetingBoard.setId("jong"); int result=mbr.insertMeetingBoard(meetingBoard); assertThat(result, is(1)); } @Autowired MeetingService mss; @org.junit.Test public void deleteMeetingBoard(){ mss.deleteMeeting(63); } @org.junit.Test public void insertMeetingBoardReplys(){ MeetingBoardReply meetingBoardReply = new MeetingBoardReply(); meetingBoardReply.setMeetingBoardReplyContent("제목"); meetingBoardReply.setMeetingBoardReplyDate(new Date()); meetingBoardReply.setMeetingBoardNo(1); meetingBoardReply.setId("jong"); int result=mbrr.insertMeetingBoardReply(meetingBoardReply); assertThat(result, is(1)); } @org.junit.Test public void insertBoard(){ Board board = new Board(); board.setBoardTitle("에디터 게시글 Test"); board.setBoardContent("내용쭈르르르르"); board.setLocation("경기도 광주시"); board.setNumberOfPeople("혼자서"); board.setWhat("밥도둑#개그#쌍쌍바"); board.setCategory("먹거리"); board.setId("knn046101"); board.setMainImg("mainImg경로"); int result=boardrepo.insertBoard(board); assertThat(result, is(1)); } @org.junit.Test public void updateBoard(){ Board board = new Board(); board.setBoardNo(2); board.setBoardTitle("에디터 게시글 Test"); board.setBoardContent("내용 변경 Test"); board.setLocation("경기도 광주시"); board.setNumberOfPeople("혼자서"); board.setWhat("밥도둑#개그#쌍쌍바"); board.setCategory("먹거리"); board.setId("hong"); board.setMainImg("mainImg경로"); int result=boardrepo.updateBoard(board); assertThat(result, is(1)); } @org.junit.Test public void deleteBoard(){ int result = boardrepo.deleteBoard(1); assertThat(result, is(1)); } @org.junit.Test public void selectAllBoard(){ List<Board> boards = boardrepo.selectAllBoard(); System.out.println(boards); assertThat(boards, is(notNullValue())); } @org.junit.Test public void selectBoardByEditor(){ List<Board> boards = boardrepo.selectBoardByEditor(); System.out.println(boards); assertThat(boards, is(notNullValue())); } @Autowired RegionService rs; @org.junit.Test public void getRegion(){ List<City> city = rs.getCity("강원도"); System.out.println(city); } @Autowired BoardServiceInterface bsi; @org.junit.Test public void getBoardsFollows(){ BoardsFollows bf = bsi.selectboardFollowsByIdAndBoardNo("knn046101", 85); assertThat(bf, is(notNullValue())); } @org.junit.Test public void updateBoardScrap(){ int result=boardrepo.updateBoardScrap(92); assertThat(result, is(1)); } @org.junit.Test public void selectboardGoodsByIdAndBoardNo(){ BoardsGoods bg=boardrepo.selectboardGoodsByIdAndBoardNo("test2", 83); assertThat(bg, is(notNullValue())); } @org.junit.Test public void selectBoardByLocation(){ List<Board> boards=boardrepo.selectBoardByLocation("통영"); assertThat(boards, is(notNullValue())); } @org.junit.Test public void selectBoardByCapitalAndCity(){ List<Board> boards=boardrepo.selectBoardByCapitalAndCity("충청남도","천안시"); assertThat(boards, is(notNullValue())); } @Autowired NotificationRepo nrepo; @org.junit.Test public void NotificationRepo(){ int result=nrepo.deleteNoti(4); assertThat(result, is(1)); } }
UTF-8
Java
11,072
java
Test.java
Java
[ { "context": "tokeninserttest() {\r\n\t\tTokens token = new Tokens(\"123asdas\",1);\r\n\t\t\r\n\t\tint result = tokenrepo.addClientToken", "end": 2331, "score": 0.7995709180831909, "start": 2323, "tag": "PASSWORD", "value": "123asdas" }, { "context": "tokenupdatetest() {\r\n\t\tToken...
null
[]
package com.whattodo.test; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; import static org.junit.Assert.assertThat; import java.util.Date; import java.util.List; import org.junit.Before; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.whattodo.config.ApplicationConfig; import com.whattodo.dto.Admin; import com.whattodo.dto.Advertisement; import com.whattodo.dto.Benefit; import com.whattodo.dto.Board; import com.whattodo.dto.BoardsFollows; import com.whattodo.dto.BoardsGoods; import com.whattodo.dto.City; import com.whattodo.dto.Meeting; import com.whattodo.dto.MeetingBoard; import com.whattodo.dto.MeetingBoardReply; import com.whattodo.dto.Member; import com.whattodo.dto.Tokens; import com.whattodo.repo.AdminRepo; import com.whattodo.repo.AdvertisementRepo; import com.whattodo.repo.BenefitRepo; import com.whattodo.repo.BoardRepo; import com.whattodo.repo.MeetingBoardReplyRepo; import com.whattodo.repo.MeetingBoardRepo; import com.whattodo.repo.MeetingRepo; import com.whattodo.repo.MemberRepo; import com.whattodo.repo.NotificationRepo; import com.whattodo.repo.TokenRepo; import com.whattodo.service.BoardServiceInterface; import com.whattodo.service.MeetingService; import com.whattodo.service.MemberService; import com.whattodo.service.RegionService; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes={ApplicationConfig.class}) public class Test { @Autowired AdminRepo adminInterface; @Autowired MemberRepo memberRepo; @Autowired ApplicationConfig ac; @Autowired AdvertisementRepo adrepo; @Autowired BenefitRepo br; @Autowired MeetingBoardRepo mbr; @Autowired MeetingRepo mr; @Autowired MeetingBoardReplyRepo mbrr; @Autowired BoardRepo boardrepo; @Autowired TokenRepo tokenrepo; @Before public void setUp() throws Exception { } @org.junit.Test public void ddtest() { assertThat(ac, is(notNullValue())); } @Autowired MemberService ms; @org.junit.Test public void tokeninserttest() { Tokens token = new Tokens("<PASSWORD>",1); int result = tokenrepo.addClientToken(token); assertThat(result, is(notNullValue())); } @org.junit.Test public void tokenalltest() { List<Tokens> list = tokenrepo.selectAlltokens(); assertThat(list, is(notNullValue())); } @org.junit.Test public void tokenAllowalltest() { List<Tokens> list = tokenrepo.selectAllowtokens(); assertThat(list, is(notNullValue())); } @org.junit.Test public void tokenupdatetest() { Tokens token = new Tokens("<PASSWORD>",0); int result = tokenrepo.updateClientToken(token); assertThat(result, is(1)); } @org.junit.Test public void test() { Admin admin=ms.getAdmin("admin"); assertThat(admin, is(notNullValue())); assertThat(admin.getPass(), is("admin123!")); } @org.junit.Test public void serviceAdminTest() { Admin admin=adminInterface.getAdmin("admin"); assertThat(admin, is(notNullValue())); assertThat(admin.getPass(), is("<PASSWORD>")); } @org.junit.Test public void memeberTest() { Member member=memberRepo.getMemberById("jong"); assertThat(member, is(notNullValue())); assertThat(member.getPass(), is("1234")); } @org.junit.Test public void deletememeberTest() { int result=memberRepo.deleteMember("jong"); assertThat(result, is(1)); } @org.junit.Test public void insertMemberTest() { Member member = new Member(); member.setId("dong"); member.setPass("<PASSWORD>"); member.setNickname("jong"); member.setEmail("<EMAIL>"); member.setRegion("경기도 광주시"); member.setBirth("19920328"); member.setFavorite("운동#헬스"); member.setProfileImg("/img/path"); member.setQuestion("출신 고등학교는 ?"); member.setAnswer("광주중앙고등학교"); member.setDivision("Editor"); int result=memberRepo.insertMember(member); assertThat(result, is(1)); } @org.junit.Test public void updateMemberTest() { Member member = new Member(); member.setId("dong"); member.setPass("<PASSWORD>"); member.setNickname("jjong"); member.setRegion("경기도 광주시"); member.setFavorite("운동#헬스"); member.setProfileImg("/img/path"); int result=memberRepo.updateMember(member); assertThat(result, is(1)); } @Autowired MeetingRepo mrepo; @org.junit.Test public void updateMeetingTest() { Meeting meeting = new Meeting(); meeting.setMeetingTitle("예사모"); meeting.setMeetingContent("예리 사랑 모임"); meeting.setMeetingKeyword("#예리#예리사랑"); meeting.setMeetingNo(101); meeting.setMeetingImg("이미지"); meeting.setPlace("경기도,광주시"); int result= mrepo.updateMeeting(meeting); assertThat(result, is(1)); } @org.junit.Test public void insertAds(){ Advertisement ad = new Advertisement(); ad.setAdsTitle("팔로우"); ad.setAdsImg("/link"); ad.setLink("link"); ad.setAdminId("admin"); int result=adrepo.insertAd(ad); assertThat(result, is(1)); } @org.junit.Test public void deleteAds(){ int result=adrepo.deleteAd(9); assertThat(result, is(1)); } @org.junit.Test public void selectgoodmainbesttest(){ List<Board> result=boardrepo.selectBoardByGoodMainBest(); assertThat(result, is(notNullValue())); } @org.junit.Test public void selectAllAdvertisement(){ java.util.List <Advertisement> list = adrepo.selectAllAdvertisement(); assertThat(list.size(), is(1)); } @org.junit.Test public void selectAdvertisement(){ List <Advertisement> list = adrepo.selectAdvertisement(); assertThat(list, notNullValue()); } @org.junit.Test public void updateAd(){ Advertisement ad = new Advertisement(); ad.setAdsNo(25); ad.setAdsTitle("mid"); ad.setAdsImg("img"); ad.setLink("link"); ad.setAdminId("admin"); ad.setOptionFlag(1); int result = adrepo.updateAd(ad); assertThat(result, is(1)); } @org.junit.Test public void insertBenefit(){ Benefit benefit = new Benefit(); benefit.setBenefitNo("DS-1"); benefit.setBenefitTitle("밥주떼여"); benefit.setStartDate(new Date()); benefit.setEndDate(new Date()); benefit.setPlace("장소"); benefit.setAdminId("admin"); int result=br.insertBenifit(benefit); assertThat(result, is(1)); } @org.junit.Test public void insertMembersBenefit(){ int result=br.insertMembersBenefit("DS-1", "jong"); assertThat(result, is(1)); } @org.junit.Test public void selectBenefitByMemberId(){ List <Benefit> benefits=br.selectBenefitByMemberId("jong"); assertThat(benefits.size(), is(1)); } @org.junit.Test public void insertMeeting(){ Meeting meeting = new Meeting(); meeting.setMeetingTitle("제목"); meeting.setMeetingContent("내용"); meeting.setMeetingKeyword("키워드"); meeting.setMeetingImg("이미지"); meeting.setId("knn046101"); meeting.setPlace("jong"); int result=mr.insertMeeting(meeting); assertThat(result, is(1)); } @org.junit.Test public void insertMeetingBoard(){ MeetingBoard meetingBoard = new MeetingBoard(); meetingBoard.setMeetingBoardTitle("까메오"); meetingBoard.setMeetingBoardContent("쑤ㅠ바랑"); meetingBoard.setMeetingNo(1); meetingBoard.setId("jong"); int result=mbr.insertMeetingBoard(meetingBoard); assertThat(result, is(1)); } @Autowired MeetingService mss; @org.junit.Test public void deleteMeetingBoard(){ mss.deleteMeeting(63); } @org.junit.Test public void insertMeetingBoardReplys(){ MeetingBoardReply meetingBoardReply = new MeetingBoardReply(); meetingBoardReply.setMeetingBoardReplyContent("제목"); meetingBoardReply.setMeetingBoardReplyDate(new Date()); meetingBoardReply.setMeetingBoardNo(1); meetingBoardReply.setId("jong"); int result=mbrr.insertMeetingBoardReply(meetingBoardReply); assertThat(result, is(1)); } @org.junit.Test public void insertBoard(){ Board board = new Board(); board.setBoardTitle("에디터 게시글 Test"); board.setBoardContent("내용쭈르르르르"); board.setLocation("경기도 광주시"); board.setNumberOfPeople("혼자서"); board.setWhat("밥도둑#개그#쌍쌍바"); board.setCategory("먹거리"); board.setId("knn046101"); board.setMainImg("mainImg경로"); int result=boardrepo.insertBoard(board); assertThat(result, is(1)); } @org.junit.Test public void updateBoard(){ Board board = new Board(); board.setBoardNo(2); board.setBoardTitle("에디터 게시글 Test"); board.setBoardContent("내용 변경 Test"); board.setLocation("경기도 광주시"); board.setNumberOfPeople("혼자서"); board.setWhat("밥도둑#개그#쌍쌍바"); board.setCategory("먹거리"); board.setId("hong"); board.setMainImg("mainImg경로"); int result=boardrepo.updateBoard(board); assertThat(result, is(1)); } @org.junit.Test public void deleteBoard(){ int result = boardrepo.deleteBoard(1); assertThat(result, is(1)); } @org.junit.Test public void selectAllBoard(){ List<Board> boards = boardrepo.selectAllBoard(); System.out.println(boards); assertThat(boards, is(notNullValue())); } @org.junit.Test public void selectBoardByEditor(){ List<Board> boards = boardrepo.selectBoardByEditor(); System.out.println(boards); assertThat(boards, is(notNullValue())); } @Autowired RegionService rs; @org.junit.Test public void getRegion(){ List<City> city = rs.getCity("강원도"); System.out.println(city); } @Autowired BoardServiceInterface bsi; @org.junit.Test public void getBoardsFollows(){ BoardsFollows bf = bsi.selectboardFollowsByIdAndBoardNo("knn046101", 85); assertThat(bf, is(notNullValue())); } @org.junit.Test public void updateBoardScrap(){ int result=boardrepo.updateBoardScrap(92); assertThat(result, is(1)); } @org.junit.Test public void selectboardGoodsByIdAndBoardNo(){ BoardsGoods bg=boardrepo.selectboardGoodsByIdAndBoardNo("test2", 83); assertThat(bg, is(notNullValue())); } @org.junit.Test public void selectBoardByLocation(){ List<Board> boards=boardrepo.selectBoardByLocation("통영"); assertThat(boards, is(notNullValue())); } @org.junit.Test public void selectBoardByCapitalAndCity(){ List<Board> boards=boardrepo.selectBoardByCapitalAndCity("충청남도","천안시"); assertThat(boards, is(notNullValue())); } @Autowired NotificationRepo nrepo; @org.junit.Test public void NotificationRepo(){ int result=nrepo.deleteNoti(4); assertThat(result, is(1)); } }
11,082
0.703724
0.693948
420
23.566668
17.127195
75
false
false
0
0
0
0
0
0
1.909524
false
false
13
fc3e4d5e3358692bb490c02e50c199c118d620c7
4,621,384,830,923
b1ffdaf4781fa443df3798e202f6b2b41cbf00b2
/TP2 Pourvoirie/concretes/implementation/activites/LocationVTT.java
ac2b464c2653d6d3a3c4f8b820eb4c82b7639b7a
[]
no_license
charlest360/TP2_Pourvoirie
https://github.com/charlest360/TP2_Pourvoirie
8d6bbad47b896d6592245dafb1f38ba39e9f6ace
b210fa3e27a13a1a895f1df4a7b7ae51d9777e58
refs/heads/master
2020-08-27T08:39:12.523000
2019-11-05T00:54:02
2019-11-05T00:54:02
217,303,157
0
0
null
false
2019-11-05T00:54:03
2019-10-24T13:14:48
2019-11-05T00:50:16
2019-11-05T00:54:02
42
0
0
0
Java
false
false
package implementation.activites; import implementation.forfait.Forfait; import implementation.forfait.ForfaitOption; import implementation.forfait.IForfait; public class LocationVTT extends ForfaitOption{ public static final float COST = 30f; private static Float cost = COST; public LocationVTT(IForfait forfait, int nbDeVTT) { super(forfait); } public static void setCost(Float cost) { LocationVTT.cost = cost; } public static Float getCost() { return LocationVTT.cost; } @Override public Float calculateCost() { return super.getForfait().calculateCost() + (LocationVTT.getCost() * this.getNbDeJours()); } }
UTF-8
Java
669
java
LocationVTT.java
Java
[]
null
[]
package implementation.activites; import implementation.forfait.Forfait; import implementation.forfait.ForfaitOption; import implementation.forfait.IForfait; public class LocationVTT extends ForfaitOption{ public static final float COST = 30f; private static Float cost = COST; public LocationVTT(IForfait forfait, int nbDeVTT) { super(forfait); } public static void setCost(Float cost) { LocationVTT.cost = cost; } public static Float getCost() { return LocationVTT.cost; } @Override public Float calculateCost() { return super.getForfait().calculateCost() + (LocationVTT.getCost() * this.getNbDeJours()); } }
669
0.726457
0.723468
28
21.892857
22.340448
92
false
false
0
0
0
0
0
0
1.214286
false
false
13
59b0be3d510acaf7a6c6035fbd84a42059cdb258
17,051,020,181,199
ff6e3b032ef3df324da8ecd06e3898dca799bbb8
/core/src/main/java/com/github/fd/sealclub/core/world/WorldDimension.java
4bde95923c178f1a7007a0423f47507448ee8036
[]
no_license
francois-dorval/SealClub
https://github.com/francois-dorval/SealClub
c552116048ad919b8f30f27342c68ba19f5ed771
2bbdc4387e07bb25d054036eef45f7482adba680
refs/heads/master
2019-01-19T09:27:26.645000
2013-07-04T22:11:01
2013-07-04T22:11:01
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.github.fd.sealclub.core.world; public interface WorldDimension { int getWidth(); int getHeight(); }
UTF-8
Java
116
java
WorldDimension.java
Java
[]
null
[]
package com.github.fd.sealclub.core.world; public interface WorldDimension { int getWidth(); int getHeight(); }
116
0.75
0.75
7
15.571428
15.59173
42
false
false
0
0
0
0
0
0
0.714286
false
false
13
aab5f5499e66a35b68bc16756f7b0468ecaf5c2d
14,766,097,567,336
e9529b1133ce7a7e578308b394d53684e8ba09d8
/chain-console/src/main/java/oxchains/fabric/console/domain/User.java
98aad1b8331ae68d35635365ab4f0b395c829c61
[]
no_license
james1106/fabric-manage
https://github.com/james1106/fabric-manage
7687c0f28e05eb63f41a62cf90310698a5030cc7
812ffd52bed0e4e195086c171688b906fbafd009
refs/heads/master
2021-05-11T11:19:08.361000
2017-07-20T09:33:52
2017-07-20T09:33:52
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package oxchains.fabric.console.domain; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonSetter; import javax.persistence.*; import java.util.Date; import java.util.HashSet; import java.util.Set; import static org.springframework.util.StringUtils.isEmpty; /** * @author aiet */ @Entity public class User { public User() { } public User(String username, String affiliation) { this.username = username; this.affiliation = affiliation; } @JsonIgnore @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String username; private String password; @ElementCollection(fetch = FetchType.EAGER) @JsonIgnore private Set<String> authorities = new HashSet<>(); private String affiliation; private String msp; private String ca; private String uri; @JsonIgnore @Column(length = 1024) private String privateKey; @Column(length = 1024) private String certificate; public void inheritMSP(User user) { setCa(user.getCa()); setUri(user.getUri()); setMsp(user.getMsp()); setAffiliation(user.getAffiliation()); } public Set<String> getAuthorities() { return authorities; } public void setAuthorities(Set<String> authorities) { this.authorities = authorities; } public String getMsp() { return msp; } public void setMsp(String msp) { this.msp = msp; } public String getPrivateKey() { return privateKey; } public void setPrivateKey(String privateKey) { this.privateKey = privateKey; } public String getCertificate() { return certificate; } public void setCertificate(String certificate) { this.certificate = certificate; } @JsonIgnore public String getUri() { return uri; } @JsonSetter public void setUri(String uri) { this.uri = uri; } public String getCa() { return ca; } public void setCa(String ca) { this.ca = ca; } @JsonIgnore private Date createtime = new Date(); public Date getCreatetime() { return createtime; } public void setCreatetime(Date createtime) { this.createtime = createtime; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } @JsonIgnore public String getPassword() { return password; } @JsonSetter public void setPassword(String password) { this.password = password; } public String getAffiliation() { return affiliation; } public void setAffiliation(String affiliation) { this.affiliation = affiliation; } @Override public String toString() { return String.format("%s of %s [%s]", username, affiliation, id); } @JsonIgnore public boolean enrolled() { return !isEmpty(privateKey) && !isEmpty(certificate); } }
UTF-8
Java
3,226
java
User.java
Java
[ { "context": "ramework.util.StringUtils.isEmpty;\n\n/**\n * @author aiet\n */\n@Entity\npublic class User {\n\n public User(", "end": 326, "score": 0.9994736909866333, "start": 322, "tag": "USERNAME", "value": "aiet" }, { "context": "ame, String affiliation) {\n this.userna...
null
[]
package oxchains.fabric.console.domain; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonSetter; import javax.persistence.*; import java.util.Date; import java.util.HashSet; import java.util.Set; import static org.springframework.util.StringUtils.isEmpty; /** * @author aiet */ @Entity public class User { public User() { } public User(String username, String affiliation) { this.username = username; this.affiliation = affiliation; } @JsonIgnore @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String username; private String password; @ElementCollection(fetch = FetchType.EAGER) @JsonIgnore private Set<String> authorities = new HashSet<>(); private String affiliation; private String msp; private String ca; private String uri; @JsonIgnore @Column(length = 1024) private String privateKey; @Column(length = 1024) private String certificate; public void inheritMSP(User user) { setCa(user.getCa()); setUri(user.getUri()); setMsp(user.getMsp()); setAffiliation(user.getAffiliation()); } public Set<String> getAuthorities() { return authorities; } public void setAuthorities(Set<String> authorities) { this.authorities = authorities; } public String getMsp() { return msp; } public void setMsp(String msp) { this.msp = msp; } public String getPrivateKey() { return privateKey; } public void setPrivateKey(String privateKey) { this.privateKey = privateKey; } public String getCertificate() { return certificate; } public void setCertificate(String certificate) { this.certificate = certificate; } @JsonIgnore public String getUri() { return uri; } @JsonSetter public void setUri(String uri) { this.uri = uri; } public String getCa() { return ca; } public void setCa(String ca) { this.ca = ca; } @JsonIgnore private Date createtime = new Date(); public Date getCreatetime() { return createtime; } public void setCreatetime(Date createtime) { this.createtime = createtime; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } @JsonIgnore public String getPassword() { return password; } @JsonSetter public void setPassword(String password) { this.password = password; } public String getAffiliation() { return affiliation; } public void setAffiliation(String affiliation) { this.affiliation = affiliation; } @Override public String toString() { return String.format("%s of %s [%s]", username, affiliation, id); } @JsonIgnore public boolean enrolled() { return !isEmpty(privateKey) && !isEmpty(certificate); } }
3,226
0.626162
0.623683
157
19.547771
17.918941
73
false
false
0
0
0
0
0
0
0.33758
false
false
13
feca54ab0dc2808c7ac1e5f2feb4688d6a3cbdd7
34,187,939,676,206
3b510bdba00b80fa537f892d8b8b70f1240c857e
/app/src/main/java/com/fournodes/ud/pranky/activities/AddSoundDialogActivity.java
7a83071c2c5945b677d28fea08eb56ae264cf525
[]
no_license
usmandurrany/Pranky-5.1
https://github.com/usmandurrany/Pranky-5.1
a4a02ba2ad5a4833b5c00a1f166a9e5fad1f0848
9a73f3e9ec2d4947c5be38330d3785ca64f53bc3
refs/heads/master
2021-01-21T13:04:08.012000
2016-05-04T18:09:43
2016-05-04T18:09:43
45,497,031
0
1
null
false
2015-12-14T19:13:03
2015-11-03T21:32:07
2015-11-03T21:33:34
2015-12-14T19:13:02
87,353
0
1
0
Java
null
null
package com.fournodes.ud.pranky.activities; import android.app.Activity; import android.content.ContentValues; import android.database.sqlite.SQLiteDatabase; import android.graphics.drawable.AnimationDrawable; import android.media.MediaPlayer; import android.os.Bundle; import android.os.Environment; import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.ImageView; import android.widget.Toast; import com.fournodes.ud.pranky.R; import com.fournodes.ud.pranky.SharedPrefs; import com.fournodes.ud.pranky.Tutorial; import com.fournodes.ud.pranky.custom.CustomToast; import com.fournodes.ud.pranky.enums.Type; import com.fournodes.ud.pranky.mediaplayers.BackgroundMusic; import com.fournodes.ud.pranky.mediaplayers.PreviewMediaPlayer; import com.fournodes.ud.pranky.utils.DatabaseHelper; import com.fournodes.ud.pranky.utils.FileChooser; import com.fournodes.ud.pranky.utils.FontManager; import com.github.amlcurran.showcaseview.targets.ViewTarget; import org.apache.commons.io.FileUtils; import java.io.File; import java.io.IOException; /** * Created by Usman-Durrani on 10-Nov-15. */ public class AddSoundDialogActivity extends Activity { private DatabaseHelper db; private int cusIconID; private File fileSelected; private String fileName; private String fileExt; private ImageView buttonSave; private ImageView iconSelected; private EditText eTextFileName; private ImageView iconCustom; private Tutorial mTutorial; private PreviewMediaPlayer previewMediaPlayer; private int durInMillis; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dialog_addsound); onWindowFocusChanged(true); previewMediaPlayer = PreviewMediaPlayer.getInstance(this); db = new DatabaseHelper(AddSoundDialogActivity.this); eTextFileName = (EditText) findViewById(R.id.txtSelSound); eTextFileName.setTypeface(FontManager.getTypeFace(this, SharedPrefs.DEFAULT_FONT)); ImageView buttonBrowse = (ImageView) findViewById(R.id.btnMusicToggle); ImageView buttonClose = (ImageView) findViewById(R.id.btnClose); iconCustom = (ImageView) findViewById(R.id.custom2); buttonSave = (ImageView) findViewById(R.id.btnSave); buttonSave.setEnabled(false); if (SharedPrefs.isAddmoreFirstLaunch()) { mTutorial = new Tutorial(this, Type.AddSoundDialogActivity); mTutorial.show(new ViewTarget(buttonBrowse), getString(R.string.tut_select_sound_title), getString(R.string.tut_select_sound_desc)); } buttonClose.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); buttonBrowse.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { FileChooser mFileChooser = new FileChooser(AddSoundDialogActivity.this); mFileChooser.setFileListener( new FileChooser.FileSelectedListener() { @Override public void fileSelected(File file) { fileName = file.getName(); fileExt = fileName.substring(fileName.lastIndexOf(".")); //Toast.makeText(AddSoundDialogActivity.this, //fileExt, Toast.LENGTH_SHORT).show(); if (fileExt.equals(".mp3") || fileExt.equals(".wav") || fileExt.equals(".3gp") || fileExt.equals(".ogg")) { fileSelected = file; previewMediaPlayer.getDurInMills(fileSelected.getAbsolutePath(), new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { durInMillis = mp.getDuration(); Log.e("Add Sound", "Sound Duration " + String.valueOf(durInMillis)); if (durInMillis < 60000) { eTextFileName.setText(fileName); if (mTutorial != null) mTutorial.moveToNext(new ViewTarget(iconCustom), getString(R.string.tut_pick_icon_title), getString(R.string.tut_pick_icon_desc)); } else { Toast.makeText(AddSoundDialogActivity.this, R.string.toast_sound_duration, Toast.LENGTH_SHORT).show(); } } }); } else Toast.makeText(AddSoundDialogActivity.this, R.string.toast_invalid_file, Toast.LENGTH_SHORT).show(); } } ).showDialog(); } }); buttonSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (cusIconID != 0) { if (mTutorial != null) mTutorial.end(); String newFilePath = copyFile(fileSelected.getAbsolutePath(), fileSelected.getName()); // Gets the data repository in write mode SQLiteDatabase databse = db.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(DatabaseHelper.COLUMN_ITEM_IMG_LOC, cusIconID); values.put(DatabaseHelper.COLUMN_ITEM_NAME, fileSelected.getName()); values.put(DatabaseHelper.COLUMN_ITEM_SOUND_LOC, newFilePath); values.put(DatabaseHelper.COLUMN_REPEAT_COUNT, 1); values.put(DatabaseHelper.COLUMN_SOUND_VOL, 1); values.put(DatabaseHelper.COLUMN_ITEM_CATEGORY, 8);//Custom databse.insert(DatabaseHelper.TABLE_ITEMS, "null", values); } else new CustomToast(AddSoundDialogActivity.this, getString(R.string.tut_pick_icon_title)).show(); SharedPrefs.setCusSoundAdded(true); Log.e("Sound Added", String.valueOf(SharedPrefs.isCusSoundAdded())); finish(); } }); } public void iconClick(View v) { if (iconSelected != null) iconSelected.setImageResource(0); iconSelected = (ImageView) findViewById(v.getId()); String imgName = getResources().getResourceEntryName(v.getId()); try { cusIconID = R.mipmap.class.getField(imgName).getInt(null); int custom_hover = R.mipmap.class.getField(imgName + "_hover").getInt(null); iconSelected.setBackgroundResource(custom_hover); iconSelected.setImageResource(R.drawable.item_selected_animation); AnimationDrawable boxsel = (AnimationDrawable) iconSelected.getDrawable(); boxsel.start(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (NoSuchFieldException e) { e.printStackTrace(); } if (fileSelected != null) buttonSave.setEnabled(true); if (fileSelected != null && mTutorial != null) { mTutorial.moveToNext(new ViewTarget(buttonSave), getString(R.string.tut_save_sound_title), getString(R.string.tut_save_sound_desc)); } } @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); View decorView = getWindow().getDecorView(); decorView.setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); } public String copyFile(String srcPath, String fileName) { //String sourcePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/TongueTwister/tt_temp.3gp"; File source = new File(srcPath); String destinationPath = Environment .getExternalStorageDirectory() .getAbsolutePath() + "/Pranky/" + fileName; File destination = new File(destinationPath); try { FileUtils.copyFile(source, destination); return destinationPath; } catch (IOException e) { e.printStackTrace(); } return null; } @Override protected void onDestroy() { super.onDestroy(); SharedPrefs.setBgMusicPlaying(false); } @Override protected void onPause() { super.onPause(); try { if (BackgroundMusic.mp != null) { BackgroundMusic.pause(); } } catch (Exception e) { Log.e("BG Music Pause", e.toString()); } } @Override protected void onResume() { if (SharedPrefs.prefs == null) SharedPrefs.setContext(this); super.onResume(); try { if (BackgroundMusic.mp != null) { BackgroundMusic.play(); } } catch (Exception e) { Log.e("BG Music Pause", e.toString()); } } }
UTF-8
Java
10,480
java
AddSoundDialogActivity.java
Java
[ { "context": "es.ud.pranky.utils.FontManager;\nimport com.github.amlcurran.showcaseview.targets.ViewTarget;\n\nimport org.apac", "end": 966, "score": 0.973960816860199, "start": 957, "tag": "USERNAME", "value": "amlcurran" }, { "context": "e;\nimport java.io.IOException;\n\n\n/**\n *...
null
[]
package com.fournodes.ud.pranky.activities; import android.app.Activity; import android.content.ContentValues; import android.database.sqlite.SQLiteDatabase; import android.graphics.drawable.AnimationDrawable; import android.media.MediaPlayer; import android.os.Bundle; import android.os.Environment; import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.ImageView; import android.widget.Toast; import com.fournodes.ud.pranky.R; import com.fournodes.ud.pranky.SharedPrefs; import com.fournodes.ud.pranky.Tutorial; import com.fournodes.ud.pranky.custom.CustomToast; import com.fournodes.ud.pranky.enums.Type; import com.fournodes.ud.pranky.mediaplayers.BackgroundMusic; import com.fournodes.ud.pranky.mediaplayers.PreviewMediaPlayer; import com.fournodes.ud.pranky.utils.DatabaseHelper; import com.fournodes.ud.pranky.utils.FileChooser; import com.fournodes.ud.pranky.utils.FontManager; import com.github.amlcurran.showcaseview.targets.ViewTarget; import org.apache.commons.io.FileUtils; import java.io.File; import java.io.IOException; /** * Created by Usman-Durrani on 10-Nov-15. */ public class AddSoundDialogActivity extends Activity { private DatabaseHelper db; private int cusIconID; private File fileSelected; private String fileName; private String fileExt; private ImageView buttonSave; private ImageView iconSelected; private EditText eTextFileName; private ImageView iconCustom; private Tutorial mTutorial; private PreviewMediaPlayer previewMediaPlayer; private int durInMillis; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dialog_addsound); onWindowFocusChanged(true); previewMediaPlayer = PreviewMediaPlayer.getInstance(this); db = new DatabaseHelper(AddSoundDialogActivity.this); eTextFileName = (EditText) findViewById(R.id.txtSelSound); eTextFileName.setTypeface(FontManager.getTypeFace(this, SharedPrefs.DEFAULT_FONT)); ImageView buttonBrowse = (ImageView) findViewById(R.id.btnMusicToggle); ImageView buttonClose = (ImageView) findViewById(R.id.btnClose); iconCustom = (ImageView) findViewById(R.id.custom2); buttonSave = (ImageView) findViewById(R.id.btnSave); buttonSave.setEnabled(false); if (SharedPrefs.isAddmoreFirstLaunch()) { mTutorial = new Tutorial(this, Type.AddSoundDialogActivity); mTutorial.show(new ViewTarget(buttonBrowse), getString(R.string.tut_select_sound_title), getString(R.string.tut_select_sound_desc)); } buttonClose.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); buttonBrowse.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { FileChooser mFileChooser = new FileChooser(AddSoundDialogActivity.this); mFileChooser.setFileListener( new FileChooser.FileSelectedListener() { @Override public void fileSelected(File file) { fileName = file.getName(); fileExt = fileName.substring(fileName.lastIndexOf(".")); //Toast.makeText(AddSoundDialogActivity.this, //fileExt, Toast.LENGTH_SHORT).show(); if (fileExt.equals(".mp3") || fileExt.equals(".wav") || fileExt.equals(".3gp") || fileExt.equals(".ogg")) { fileSelected = file; previewMediaPlayer.getDurInMills(fileSelected.getAbsolutePath(), new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { durInMillis = mp.getDuration(); Log.e("Add Sound", "Sound Duration " + String.valueOf(durInMillis)); if (durInMillis < 60000) { eTextFileName.setText(fileName); if (mTutorial != null) mTutorial.moveToNext(new ViewTarget(iconCustom), getString(R.string.tut_pick_icon_title), getString(R.string.tut_pick_icon_desc)); } else { Toast.makeText(AddSoundDialogActivity.this, R.string.toast_sound_duration, Toast.LENGTH_SHORT).show(); } } }); } else Toast.makeText(AddSoundDialogActivity.this, R.string.toast_invalid_file, Toast.LENGTH_SHORT).show(); } } ).showDialog(); } }); buttonSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (cusIconID != 0) { if (mTutorial != null) mTutorial.end(); String newFilePath = copyFile(fileSelected.getAbsolutePath(), fileSelected.getName()); // Gets the data repository in write mode SQLiteDatabase databse = db.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(DatabaseHelper.COLUMN_ITEM_IMG_LOC, cusIconID); values.put(DatabaseHelper.COLUMN_ITEM_NAME, fileSelected.getName()); values.put(DatabaseHelper.COLUMN_ITEM_SOUND_LOC, newFilePath); values.put(DatabaseHelper.COLUMN_REPEAT_COUNT, 1); values.put(DatabaseHelper.COLUMN_SOUND_VOL, 1); values.put(DatabaseHelper.COLUMN_ITEM_CATEGORY, 8);//Custom databse.insert(DatabaseHelper.TABLE_ITEMS, "null", values); } else new CustomToast(AddSoundDialogActivity.this, getString(R.string.tut_pick_icon_title)).show(); SharedPrefs.setCusSoundAdded(true); Log.e("Sound Added", String.valueOf(SharedPrefs.isCusSoundAdded())); finish(); } }); } public void iconClick(View v) { if (iconSelected != null) iconSelected.setImageResource(0); iconSelected = (ImageView) findViewById(v.getId()); String imgName = getResources().getResourceEntryName(v.getId()); try { cusIconID = R.mipmap.class.getField(imgName).getInt(null); int custom_hover = R.mipmap.class.getField(imgName + "_hover").getInt(null); iconSelected.setBackgroundResource(custom_hover); iconSelected.setImageResource(R.drawable.item_selected_animation); AnimationDrawable boxsel = (AnimationDrawable) iconSelected.getDrawable(); boxsel.start(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (NoSuchFieldException e) { e.printStackTrace(); } if (fileSelected != null) buttonSave.setEnabled(true); if (fileSelected != null && mTutorial != null) { mTutorial.moveToNext(new ViewTarget(buttonSave), getString(R.string.tut_save_sound_title), getString(R.string.tut_save_sound_desc)); } } @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); View decorView = getWindow().getDecorView(); decorView.setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); } public String copyFile(String srcPath, String fileName) { //String sourcePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/TongueTwister/tt_temp.3gp"; File source = new File(srcPath); String destinationPath = Environment .getExternalStorageDirectory() .getAbsolutePath() + "/Pranky/" + fileName; File destination = new File(destinationPath); try { FileUtils.copyFile(source, destination); return destinationPath; } catch (IOException e) { e.printStackTrace(); } return null; } @Override protected void onDestroy() { super.onDestroy(); SharedPrefs.setBgMusicPlaying(false); } @Override protected void onPause() { super.onPause(); try { if (BackgroundMusic.mp != null) { BackgroundMusic.pause(); } } catch (Exception e) { Log.e("BG Music Pause", e.toString()); } } @Override protected void onResume() { if (SharedPrefs.prefs == null) SharedPrefs.setContext(this); super.onResume(); try { if (BackgroundMusic.mp != null) { BackgroundMusic.play(); } } catch (Exception e) { Log.e("BG Music Pause", e.toString()); } } }
10,480
0.551431
0.549714
260
39.307693
29.83502
122
false
false
0
0
0
0
0
0
0.615385
false
false
13
83d5e3e56668fb9609b9e27d8f1c1c1ede9d5b77
25,366,076,908,195
0c0946489cfb682ce48d9ba565c629bb72506f65
/common/src/main/java/com/hamming/storim/common/dto/protocol/Protocol.java
9d082b4d6b1d2553a5a542a2a0f8d60ea602c29e
[]
no_license
jehamming/STORiM
https://github.com/jehamming/STORiM
21e648e399e4428c5291103d12a0605b5a4b5c61
6af2263ee92fe59be9283b035ba826cc4b5c2247
refs/heads/develop
2023-08-31T21:29:50.141000
2023-08-30T13:17:24
2023-08-30T13:17:24
242,352,231
0
0
null
false
2023-03-15T04:41:26
2020-02-22T14:08:37
2022-01-06T14:47:27
2023-03-15T04:41:26
4,377
0
0
4
Java
false
false
package com.hamming.storim.common.dto.protocol; import com.hamming.storim.common.util.Logger; import java.util.HashMap; import java.util.List; public class Protocol { private static Protocol instance; private HashMap<String, Class> registeredClasses; private Protocol() { registeredClasses = new HashMap<>(); } public static Protocol getInstance() { if ( instance == null ) { instance = new Protocol(); } return instance; } public void registerClass(String name, Class clazz) { if ( registeredClasses.get(name) == null ) { registeredClasses.put(name,clazz); } } public Class getClass(String name) { return registeredClasses.get(name); } }
UTF-8
Java
769
java
Protocol.java
Java
[]
null
[]
package com.hamming.storim.common.dto.protocol; import com.hamming.storim.common.util.Logger; import java.util.HashMap; import java.util.List; public class Protocol { private static Protocol instance; private HashMap<String, Class> registeredClasses; private Protocol() { registeredClasses = new HashMap<>(); } public static Protocol getInstance() { if ( instance == null ) { instance = new Protocol(); } return instance; } public void registerClass(String name, Class clazz) { if ( registeredClasses.get(name) == null ) { registeredClasses.put(name,clazz); } } public Class getClass(String name) { return registeredClasses.get(name); } }
769
0.63459
0.63459
34
21.617647
19.862785
57
false
false
0
0
0
0
0
0
0.411765
false
false
13
fc8e0403679da04dba429fcbf0b33576a1ea770a
3,358,664,495,917
06a4d1d89db6fd7616e24923d410cfffa0038e1f
/src/LoginScreen.java
5d3f9aed3c90e475e54dc5aee54ff3faa0f025d7
[]
no_license
hamiz-hk/MCDONALD-S-Management-System
https://github.com/hamiz-hk/MCDONALD-S-Management-System
6e8dfa11133983dd78fc47383162aeb0e2409474
70e4e864a5a81685f3d4f4d4aeae29661f71d25d
refs/heads/master
2022-12-25T03:10:58.409000
2020-09-27T16:47:49
2020-09-27T16:47:49
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import javafx.animation.Animation; import javafx.animation.FadeTransition; import javafx.animation.Transition; import javafx.application.Application; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.Alert; import javafx.scene.control.Alert.AlertType; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.PasswordField; import javafx.scene.control.TextField; import javafx.scene.effect.InnerShadow; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.KeyCode; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.FontWeight; import javafx.scene.text.Text; import javafx.stage.Stage; import javafx.util.Duration; public class LoginScreen extends Application { TextField txt_username; private String username="user"; private String password="pakistan"; private String ownerid="owner"; private String ownerpass="password"; public static void main(String[] args) { launch(args); } public void start(Stage loginstage) { loginstage.getIcons().add(new Image ("file:images/download.png")); loginstage.setTitle("Mc Donald's\nManagment Syatem"); loginstage.setWidth(1000); loginstage.setHeight(800); loginstage.setResizable(true); Group root = new Group(); addComponents(root); Scene sc=new Scene(root); sc.setFill(Color.RED); loginstage.setScene(sc); loginstage.show(); } private void Animation(Group root) { FadeTransition ft = new FadeTransition(Duration.millis(3000), root); ft.setFromValue(0.0); ft.setToValue(1.0); ft.play(); } public void addComponents(Group root) { //background Image Animation(root); ImageView imgbackground = new ImageView(new Image("file:images/01_macdonalds_countries-that-have-banned-mcdonald-s_678182368-editorial-ty-lim-1200x1200.jpg")); imgbackground.setOpacity(0.2); Image img= new Image("file:images/download.png"); ImageView imgview=new ImageView(img); imgview.setX(295); imgview.setY(110); imgview.setFitHeight(190); imgview.setFitWidth(190); //LABEL OF USERNAME Label lblusername=new Label("Username"); lblusername.setFont(Font.font("Roman", FontWeight.BOLD, 20)); lblusername.setTextFill(Color.LIGHTBLUE); lblusername.setTranslateX(220); lblusername.setTranslateY(340); //TEXTFIELD OF USERNAME txt_username=new TextField(); txt_username.setPrefWidth(200); txt_username.setTranslateX(305); txt_username.setTranslateY(340); //LABEL OF PASSWORD Label lblpassword =new Label("Password"); lblpassword.setFont(Font.font("Roman", FontWeight.BOLD, 20)); lblpassword.setTextFill(Color.LIGHTBLUE); lblpassword.setTranslateX(220); lblpassword.setTranslateY(380); //TEXTFIELD of PASSOWORD final PasswordField txt_password=new PasswordField(); txt_password.setPrefWidth(200); txt_password.setTranslateX(305); txt_password.setTranslateY(380); //LOGIN BUTTON Button btn=new Button(); btn.setText("Log In"); btn.setPrefWidth(200); btn.setTranslateX(305); btn.setTranslateY(440); btn.setTextFill(Color.GREENYELLOW); btn.setStyle("-fx-font: 15 roman; -fx-base: #cf9a0f;"); //Welcome Animation final String content = "WELCOME TO MC DONALD'S"; final Text wellCome = new Text(10, 20, "WELCOME TO MC DONALD'S"); wellCome.setTranslateX(110); wellCome.setTranslateY(50); wellCome.setFill(Color.WHITE); wellCome.setFont(Font.font("Verdana", FontWeight.BOLD, 40)); final Animation animation = new Transition() { { setCycleDuration(Duration.millis(6000)); } protected void interpolate(double frac) { final int length = content.length(); final int n = Math.round(length * (float) frac); wellCome.setText(content.substring(0, n)); } }; animation.play(); btn.setOnAction(new EventHandler<ActionEvent>(){ public void handle(ActionEvent Login) { if (txt_username.getText().equals(username) && txt_password.getText().equals(password)) { ((Stage )txt_username.getScene().getWindow()).close(); Options opt=new Options(); } else if (txt_username.getText().equals(ownerid) && txt_password.getText().equals(ownerpass)) { Stage st=new Stage(); st.setTitle("Owner information"); st.getIcons().add(new Image ("file:images/download.png")); st.setTitle("Mc DOnald Managment"); st.setWidth(800); st.setHeight(600); st.setResizable(true); Group root1 = new Group(); //addComponents(root); Scene sc1=new Scene(root1); sc1.setFill(Color.DARKSLATEGRAY); st.setScene(sc1); st.show(); Alert alrt2=new Alert(AlertType.INFORMATION); alrt2.setTitle("Owner Log In"); alrt2.setHeaderText(null); alrt2.setContentText("Owner Log In Successful"); alrt2.showAndWait(); } else { Alert alrt1=new Alert(AlertType.ERROR); alrt1.setTitle("Log In Failed"); alrt1.setHeaderText(null); alrt1.setContentText("Invalid Username or Password "); alrt1.showAndWait(); } } }); ObservableList<Node> child=root.getChildren(); child.add(imgbackground); child.add(imgview); child.add(lblusername); child.add(btn); child.add(txt_username); child.add(txt_password); child.add(lblpassword); child.add(wellCome); } }
UTF-8
Java
5,476
java
LoginScreen.java
Java
[ { "context": "xtField txt_username;\n\t\n\tprivate String username=\"user\";\n\tprivate String password=\"pakistan\";\n\tprivate S", "end": 1013, "score": 0.9038257002830505, "start": 1009, "tag": "USERNAME", "value": "user" }, { "context": "String username=\"user\";\n\tprivate Strin...
null
[]
import javafx.animation.Animation; import javafx.animation.FadeTransition; import javafx.animation.Transition; import javafx.application.Application; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.Alert; import javafx.scene.control.Alert.AlertType; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.PasswordField; import javafx.scene.control.TextField; import javafx.scene.effect.InnerShadow; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.KeyCode; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.FontWeight; import javafx.scene.text.Text; import javafx.stage.Stage; import javafx.util.Duration; public class LoginScreen extends Application { TextField txt_username; private String username="user"; private String password="<PASSWORD>"; private String ownerid="owner"; private String ownerpass="<PASSWORD>"; public static void main(String[] args) { launch(args); } public void start(Stage loginstage) { loginstage.getIcons().add(new Image ("file:images/download.png")); loginstage.setTitle("Mc Donald's\nManagment Syatem"); loginstage.setWidth(1000); loginstage.setHeight(800); loginstage.setResizable(true); Group root = new Group(); addComponents(root); Scene sc=new Scene(root); sc.setFill(Color.RED); loginstage.setScene(sc); loginstage.show(); } private void Animation(Group root) { FadeTransition ft = new FadeTransition(Duration.millis(3000), root); ft.setFromValue(0.0); ft.setToValue(1.0); ft.play(); } public void addComponents(Group root) { //background Image Animation(root); ImageView imgbackground = new ImageView(new Image("file:images/01_macdonalds_countries-that-have-banned-mcdonald-s_678182368-editorial-ty-lim-1200x1200.jpg")); imgbackground.setOpacity(0.2); Image img= new Image("file:images/download.png"); ImageView imgview=new ImageView(img); imgview.setX(295); imgview.setY(110); imgview.setFitHeight(190); imgview.setFitWidth(190); //LABEL OF USERNAME Label lblusername=new Label("Username"); lblusername.setFont(Font.font("Roman", FontWeight.BOLD, 20)); lblusername.setTextFill(Color.LIGHTBLUE); lblusername.setTranslateX(220); lblusername.setTranslateY(340); //TEXTFIELD OF USERNAME txt_username=new TextField(); txt_username.setPrefWidth(200); txt_username.setTranslateX(305); txt_username.setTranslateY(340); //LABEL OF PASSWORD Label lblpassword =new Label("Password"); lblpassword.setFont(Font.font("Roman", FontWeight.BOLD, 20)); lblpassword.setTextFill(Color.LIGHTBLUE); lblpassword.setTranslateX(220); lblpassword.setTranslateY(380); //TEXTFIELD of PASSOWORD final PasswordField txt_password=new PasswordField(); txt_password.setPrefWidth(200); txt_password.setTranslateX(305); txt_password.setTranslateY(380); //LOGIN BUTTON Button btn=new Button(); btn.setText("Log In"); btn.setPrefWidth(200); btn.setTranslateX(305); btn.setTranslateY(440); btn.setTextFill(Color.GREENYELLOW); btn.setStyle("-fx-font: 15 roman; -fx-base: #cf9a0f;"); //Welcome Animation final String content = "WELCOME TO MC DONALD'S"; final Text wellCome = new Text(10, 20, "WELCOME TO MC DONALD'S"); wellCome.setTranslateX(110); wellCome.setTranslateY(50); wellCome.setFill(Color.WHITE); wellCome.setFont(Font.font("Verdana", FontWeight.BOLD, 40)); final Animation animation = new Transition() { { setCycleDuration(Duration.millis(6000)); } protected void interpolate(double frac) { final int length = content.length(); final int n = Math.round(length * (float) frac); wellCome.setText(content.substring(0, n)); } }; animation.play(); btn.setOnAction(new EventHandler<ActionEvent>(){ public void handle(ActionEvent Login) { if (txt_username.getText().equals(username) && txt_password.getText().equals(password)) { ((Stage )txt_username.getScene().getWindow()).close(); Options opt=new Options(); } else if (txt_username.getText().equals(ownerid) && txt_password.getText().equals(ownerpass)) { Stage st=new Stage(); st.setTitle("Owner information"); st.getIcons().add(new Image ("file:images/download.png")); st.setTitle("Mc DOnald Managment"); st.setWidth(800); st.setHeight(600); st.setResizable(true); Group root1 = new Group(); //addComponents(root); Scene sc1=new Scene(root1); sc1.setFill(Color.DARKSLATEGRAY); st.setScene(sc1); st.show(); Alert alrt2=new Alert(AlertType.INFORMATION); alrt2.setTitle("Owner Log In"); alrt2.setHeaderText(null); alrt2.setContentText("Owner Log In Successful"); alrt2.showAndWait(); } else { Alert alrt1=new Alert(AlertType.ERROR); alrt1.setTitle("Log In Failed"); alrt1.setHeaderText(null); alrt1.setContentText("Invalid Username or Password "); alrt1.showAndWait(); } } }); ObservableList<Node> child=root.getChildren(); child.add(imgbackground); child.add(imgview); child.add(lblusername); child.add(btn); child.add(txt_username); child.add(txt_password); child.add(lblpassword); child.add(wellCome); } }
5,480
0.721147
0.697042
200
26.385
21.189779
160
false
false
0
0
0
0
0
0
2
false
false
13
45855465423b050510d347b726b900fdb0711267
7,885,560,001,971
97b1d6add6f73cd5363f025447c8c44b01ad6fe1
/src/test/java/Definicao/CriarDefinicao.java
05edbf5c623bb68149a0da3483d1c0d458631386
[]
no_license
RogerioDoCarmo/labes
https://github.com/RogerioDoCarmo/labes
109203c77b37ee7a5d28a8fc5a06ab0445860162
248df6023c20d88dc0320401809e7f1952a8e6c3
refs/heads/master
2022-02-08T07:40:49.186000
2018-01-24T23:47:42
2018-01-24T23:47:42
116,252,920
1
0
null
true
2018-01-04T11:35:48
2018-01-04T11:35:48
2017-12-19T20:27:14
2017-12-20T00:21:56
21,217
0
0
0
null
false
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Definicao; import com.mycompany.controller.ControllerDefinicao; import com.mycompany.controller.ControllerExperimento; import com.mycompany.controller.ControllerUsuario; import com.mycompany.model.Experimento; import com.mycompany.model.Usuario; import java.util.Calendar; import java.util.List; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*; /** * * @author FELIPE */ public class CriarDefinicao { public CriarDefinicao() { } Usuario usuario; Calendar calendario; Experimento experimento; @BeforeClass public static void setUpClass() { } @AfterClass public static void tearDownClass() { } @Before public void setUp() { calendario = Calendar.getInstance(); usuario = ControllerUsuario.buscaUsuario(1); if(usuario == null){ usuario = new Usuario("UsuarioTeste@teste.com","123456789"); usuario.saveOnDatabase(); } if(ControllerExperimento.listarExperimentos(1) == null){ experimento = new Experimento("Testeum", "Testeum", false, calendario, false, usuario); experimento.saveOnDatabase(); } else{ List<Experimento> experimentos = ControllerExperimento.listarExperimentos(1); experimento = experimentos.get(0); } } @After public void tearDown() { } //Testando todos campos nulos @Test public void verificarNuloDefinicao() { assertTrue(ControllerDefinicao.createDefinicao(null,null,null,null,null,null,false)); } //Definição com campos não nulos e objeto experimento não nulo @Test public void verificarDefinicaoFuncional() { assertTrue(ControllerDefinicao.createDefinicao(experimento,"ObjEstudo","Objetivo","Perspectiva","FocoQualidade","Contexto",false)); } //Testando campo com objeto experimento nulo @Test public void verificarDefinicaoExperimentoNulo() { assertTrue(ControllerDefinicao.createDefinicao(null,"objEstudo","objetivo","perspectiva","focoQualidade","contexto",false)); } //Testando com objeto experimento não nulo, porém os outros campos nulos @Test public void verificarDefinicaoExperimoNaoNuloCamposNulos() { assertTrue(ControllerDefinicao.createDefinicao(experimento,null,null,null,null,null,false)); } }
UTF-8
Java
2,752
java
CriarDefinicao.java
Java
[ { "context": "port static org.junit.Assert.*;\n\n/**\n *\n * @author FELIPE\n */\npublic class CriarDefinicao {\n \n public", "end": 680, "score": 0.9492807984352112, "start": 674, "tag": "NAME", "value": "FELIPE" }, { "context": "uario == null){\n usuario = new Usuar...
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Definicao; import com.mycompany.controller.ControllerDefinicao; import com.mycompany.controller.ControllerExperimento; import com.mycompany.controller.ControllerUsuario; import com.mycompany.model.Experimento; import com.mycompany.model.Usuario; import java.util.Calendar; import java.util.List; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*; /** * * @author FELIPE */ public class CriarDefinicao { public CriarDefinicao() { } Usuario usuario; Calendar calendario; Experimento experimento; @BeforeClass public static void setUpClass() { } @AfterClass public static void tearDownClass() { } @Before public void setUp() { calendario = Calendar.getInstance(); usuario = ControllerUsuario.buscaUsuario(1); if(usuario == null){ usuario = new Usuario("<EMAIL>","123456789"); usuario.saveOnDatabase(); } if(ControllerExperimento.listarExperimentos(1) == null){ experimento = new Experimento("Testeum", "Testeum", false, calendario, false, usuario); experimento.saveOnDatabase(); } else{ List<Experimento> experimentos = ControllerExperimento.listarExperimentos(1); experimento = experimentos.get(0); } } @After public void tearDown() { } //Testando todos campos nulos @Test public void verificarNuloDefinicao() { assertTrue(ControllerDefinicao.createDefinicao(null,null,null,null,null,null,false)); } //Definição com campos não nulos e objeto experimento não nulo @Test public void verificarDefinicaoFuncional() { assertTrue(ControllerDefinicao.createDefinicao(experimento,"ObjEstudo","Objetivo","Perspectiva","FocoQualidade","Contexto",false)); } //Testando campo com objeto experimento nulo @Test public void verificarDefinicaoExperimentoNulo() { assertTrue(ControllerDefinicao.createDefinicao(null,"objEstudo","objetivo","perspectiva","focoQualidade","contexto",false)); } //Testando com objeto experimento não nulo, porém os outros campos nulos @Test public void verificarDefinicaoExperimoNaoNuloCamposNulos() { assertTrue(ControllerDefinicao.createDefinicao(experimento,null,null,null,null,null,false)); } }
2,737
0.676985
0.672251
93
28.526882
29.560797
140
false
false
0
0
0
0
0
0
0.677419
false
false
13
135580154c54d72082a1704903cce07118660b9a
19,731,079,792,763
af1514a5fa758aec18e0154e2cd6caf16d8a893d
/baseywmj/src/main/java/com/yingwumeijia/baseywmj/utils/net/exception/TokenIsRefreshEdException.java
c05b6cd03f3fb099900a57b7fab06c4f5947bb74
[]
no_license
Jam741/ModularizationProject
https://github.com/Jam741/ModularizationProject
6d1c8f48991a0d2326a6da74a3c6e0c4e3af6715
4d08efd4403519f66a3037af0dbae772395f1d1e
refs/heads/master
2021-01-21T09:34:27.200000
2018-02-28T10:31:00
2018-02-28T10:31:00
91,657,229
0
1
null
false
2018-02-28T10:31:01
2017-05-18T06:29:45
2017-05-18T06:34:58
2018-02-28T10:31:01
90,991
0
1
0
Kotlin
false
null
package com.yingwumeijia.baseywmj.utils.net.exception; /** * Created by Jam on 2017/2/23 下午5:36. * Describe: */ public class TokenIsRefreshEdException extends RuntimeException { }
UTF-8
Java
189
java
TokenIsRefreshEdException.java
Java
[ { "context": "a.baseywmj.utils.net.exception;\n\n/**\n * Created by Jam on 2017/2/23 下午5:36.\n * Describe:\n */\n\npublic c", "end": 75, "score": 0.6123055815696716, "start": 74, "tag": "NAME", "value": "J" }, { "context": "baseywmj.utils.net.exception;\n\n/**\n * Created by Jam on 2...
null
[]
package com.yingwumeijia.baseywmj.utils.net.exception; /** * Created by Jam on 2017/2/23 下午5:36. * Describe: */ public class TokenIsRefreshEdException extends RuntimeException { }
189
0.756757
0.702703
9
19.555555
24.281273
65
false
false
0
0
0
0
0
0
0.111111
false
false
13
30916b7cc9d1f449480a0b6587a639fbfefeb4df
33,122,787,794,950
5fcdddd479e943024fb461d6bfc67c91cf1221d2
/src/codingBat/Warmup1.java
0afd4ec3d782c4bbca5c3a17f12079bb844564dd
[]
no_license
tomasfly/codingbat
https://github.com/tomasfly/codingbat
2592b4fbca92cae4b91a03c76dffac81cf1d93f0
59070cd2b329c4a4ae33fa2fcab2b72d7bf6e6ca
refs/heads/master
2017-12-14T16:59:14.601000
2017-01-05T11:22:47
2017-01-05T11:22:47
78,105,701
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package codingBat; import java.util.ArrayList; import java.util.List; public class Warmup1 { // We'll say that a number is "teen" if it is in the range // 13..19 inclusive. Given 2 int values, return true if one or the other is // teen, but not both. // loneTeen(13, 99) true // loneTeen(21, 19) true // loneTeen(13, 13) false public boolean loneTeen(int a, int b) { boolean var1 = (a >= 13) && (a <= 19); boolean var2 = (b >= 13) && (b <= 19); boolean result = (var1 && !var2) || (!var1 && var2); return result; } // Given a string, if the string "del" appears starting at index 1, return a // string where that "del" has been deleted. Otherwise, return the string // unchanged. // // delDel("adelbc") "abc" // delDel("adelHello") "aHello" // delDel("adedbc") "adedbc" public String delDel(String str) { char[] chars = str.toCharArray(); List<Character> mylista = new ArrayList<Character>(); for (Character character : chars) { mylista.add(character); } for (int i = 0; i < mylista.size(); i++) { if (mylista.get(1).equals("d")) { String valor = mylista.get(1).toString() + mylista.get(2).toString() + mylista.get(3).toString(); if (valor.equals("del")) { return str.substring(1, 3); } } } return str; } }
UTF-8
Java
1,278
java
Warmup1.java
Java
[]
null
[]
package codingBat; import java.util.ArrayList; import java.util.List; public class Warmup1 { // We'll say that a number is "teen" if it is in the range // 13..19 inclusive. Given 2 int values, return true if one or the other is // teen, but not both. // loneTeen(13, 99) true // loneTeen(21, 19) true // loneTeen(13, 13) false public boolean loneTeen(int a, int b) { boolean var1 = (a >= 13) && (a <= 19); boolean var2 = (b >= 13) && (b <= 19); boolean result = (var1 && !var2) || (!var1 && var2); return result; } // Given a string, if the string "del" appears starting at index 1, return a // string where that "del" has been deleted. Otherwise, return the string // unchanged. // // delDel("adelbc") "abc" // delDel("adelHello") "aHello" // delDel("adedbc") "adedbc" public String delDel(String str) { char[] chars = str.toCharArray(); List<Character> mylista = new ArrayList<Character>(); for (Character character : chars) { mylista.add(character); } for (int i = 0; i < mylista.size(); i++) { if (mylista.get(1).equals("d")) { String valor = mylista.get(1).toString() + mylista.get(2).toString() + mylista.get(3).toString(); if (valor.equals("del")) { return str.substring(1, 3); } } } return str; } }
1,278
0.627543
0.596244
46
26.782608
23.762331
101
false
false
0
0
0
0
0
0
2
false
false
13
8894ffc1f5abad3998002fc141aaf9a49b9d6f9b
26,585,847,581,193
30361921619d54a662797bb8f5b08cd397dad76e
/src/com/amg/mvc/dispatch/RequestFilter.java
6f4ff34992539dee657b22b97b0cbad6288e3199
[]
no_license
anishmgoyal/amgmvc
https://github.com/anishmgoyal/amgmvc
6e494781df0cf33842a1ec681e9f2fda712d4d0d
3df8900580be7a125ee72eac8c092d261a10a9af
refs/heads/master
2021-06-26T06:12:35.743000
2017-04-17T23:06:25
2017-04-17T23:06:25
35,299,447
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.amg.mvc.dispatch; import java.io.IOException; import java.lang.reflect.Method; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.amg.mvc.bean.controller.Controller; import com.amg.mvc.bean.view.View; import com.amg.mvc.config.SettingsManager; import com.amg.mvc.context.ServletContextManager; public class RequestFilter implements Filter { @Override public void destroy() { //Do nothing } @Override public void doFilter(ServletRequest srequest, ServletResponse sresponse, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) srequest; HttpServletResponse response = (HttpServletResponse) sresponse; ServletContext sc = request.getServletContext(); ServletContextManager scm = new ServletContextManager(sc); SettingsManager sm = scm.getSettingsManager(); DispatchRequest dr = processRequest(request, sm); switch(dr.dispatchType) { case VIEW: View view = scm.getViewManager().getObject(dr.dispatchObject); if(view == null) { System.out.println("No such view " + dr.dispatchObject); } else view.generateView(request, response); break; case CONTROLLER: Controller controller = scm.getControllerManager().getObject(dr.dispatchObject); if(controller == null) { System.out.println("No such controller: " + dr.dispatchObject); break; } View returnedView = null; try { Method method = controller.getClass().getMethod(dr.dispatchMethod, ServletRequest.class, ServletResponse.class); returnedView = (View) method.invoke(controller, request, response); } catch(Exception e) { returnedView = controller.handleRequest(request, response); } if(returnedView != null) returnedView.generateView(request, response); break; default: chain.doFilter(srequest, sresponse); break; } } @Override public void init(FilterConfig config) throws ServletException { //Do nothing } public DispatchRequest processRequest(HttpServletRequest request, SettingsManager settings) { DispatchType dispatchType = DispatchType.NONE; String dispatchObject = null; String dispatchMethod = null; String[] servletPath = request.getServletPath().split("/"); if(servletPath.length > 1) { String viewPath = settings.getSetting("bean.request.mapping.view.dir").replace("/", ""); String controllerPath = settings.getSetting("bean.request.mapping.controller.dir").replace("/", ""); dispatchType = (servletPath[1].equals(viewPath))? DispatchType.VIEW : (servletPath[1].equals(controllerPath))? DispatchType.CONTROLLER : dispatchType; if(servletPath.length > 2) { dispatchObject = servletPath[2]; if(servletPath.length > 3) { dispatchMethod = servletPath[3]; } } } return new DispatchRequest(dispatchType, dispatchObject, dispatchMethod); /*DispatchType dispatchType = (request.getServletPath().equals(settings.getSetting("bean.request.mapping.view.dir")))? DispatchType.VIEW : (request.getServletPath().equals(settings.getSetting("bean.request.mapping.controller.dir")))? DispatchType.CONTROLLER : DispatchType.NONE; if(dispatchType == DispatchType.NONE) return new DispatchRequest(dispatchType, null, null); String[] params = request.getPathInfo().split("/"); String dispatchObject = null; String dispatchMethod = null; for(int i = 0; i < params.length; i++) { if(params[i].trim().length() == 0) continue; if(dispatchObject == null) { dispatchObject = params[i]; //TODO: Replace with the view action url if(dispatchType.equals(DispatchType.VIEW)) { break; } } else if(dispatchMethod == null) { dispatchMethod = params[i]; } } DispatchRequest dispatchRequest = new DispatchRequest(dispatchType, dispatchObject, dispatchMethod); return dispatchRequest;*/ } }
UTF-8
Java
4,203
java
RequestFilter.java
Java
[]
null
[]
package com.amg.mvc.dispatch; import java.io.IOException; import java.lang.reflect.Method; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.amg.mvc.bean.controller.Controller; import com.amg.mvc.bean.view.View; import com.amg.mvc.config.SettingsManager; import com.amg.mvc.context.ServletContextManager; public class RequestFilter implements Filter { @Override public void destroy() { //Do nothing } @Override public void doFilter(ServletRequest srequest, ServletResponse sresponse, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) srequest; HttpServletResponse response = (HttpServletResponse) sresponse; ServletContext sc = request.getServletContext(); ServletContextManager scm = new ServletContextManager(sc); SettingsManager sm = scm.getSettingsManager(); DispatchRequest dr = processRequest(request, sm); switch(dr.dispatchType) { case VIEW: View view = scm.getViewManager().getObject(dr.dispatchObject); if(view == null) { System.out.println("No such view " + dr.dispatchObject); } else view.generateView(request, response); break; case CONTROLLER: Controller controller = scm.getControllerManager().getObject(dr.dispatchObject); if(controller == null) { System.out.println("No such controller: " + dr.dispatchObject); break; } View returnedView = null; try { Method method = controller.getClass().getMethod(dr.dispatchMethod, ServletRequest.class, ServletResponse.class); returnedView = (View) method.invoke(controller, request, response); } catch(Exception e) { returnedView = controller.handleRequest(request, response); } if(returnedView != null) returnedView.generateView(request, response); break; default: chain.doFilter(srequest, sresponse); break; } } @Override public void init(FilterConfig config) throws ServletException { //Do nothing } public DispatchRequest processRequest(HttpServletRequest request, SettingsManager settings) { DispatchType dispatchType = DispatchType.NONE; String dispatchObject = null; String dispatchMethod = null; String[] servletPath = request.getServletPath().split("/"); if(servletPath.length > 1) { String viewPath = settings.getSetting("bean.request.mapping.view.dir").replace("/", ""); String controllerPath = settings.getSetting("bean.request.mapping.controller.dir").replace("/", ""); dispatchType = (servletPath[1].equals(viewPath))? DispatchType.VIEW : (servletPath[1].equals(controllerPath))? DispatchType.CONTROLLER : dispatchType; if(servletPath.length > 2) { dispatchObject = servletPath[2]; if(servletPath.length > 3) { dispatchMethod = servletPath[3]; } } } return new DispatchRequest(dispatchType, dispatchObject, dispatchMethod); /*DispatchType dispatchType = (request.getServletPath().equals(settings.getSetting("bean.request.mapping.view.dir")))? DispatchType.VIEW : (request.getServletPath().equals(settings.getSetting("bean.request.mapping.controller.dir")))? DispatchType.CONTROLLER : DispatchType.NONE; if(dispatchType == DispatchType.NONE) return new DispatchRequest(dispatchType, null, null); String[] params = request.getPathInfo().split("/"); String dispatchObject = null; String dispatchMethod = null; for(int i = 0; i < params.length; i++) { if(params[i].trim().length() == 0) continue; if(dispatchObject == null) { dispatchObject = params[i]; //TODO: Replace with the view action url if(dispatchType.equals(DispatchType.VIEW)) { break; } } else if(dispatchMethod == null) { dispatchMethod = params[i]; } } DispatchRequest dispatchRequest = new DispatchRequest(dispatchType, dispatchObject, dispatchMethod); return dispatchRequest;*/ } }
4,203
0.728527
0.726386
107
37.280373
32.575661
142
false
false
0
0
0
0
0
0
2.71028
false
false
13
2481fbc95b75e551a3637e7b0ab3847cba77413d
1,520,418,471,995
13235a4adb508e9f47a2f9ddaf7c57367c312166
/ProgrammingByDoingForLoop/src/XsAndYs.java
2c349ba1fefb6e963305789f81592df5b512dc0c
[]
no_license
zarabash/ProgrammingByDoing
https://github.com/zarabash/ProgrammingByDoing
8dee772595fd1fadb3ad395071fcb408bc7a34a1
8819d38cb6dd594771df0b2a11a82d92c061008e
refs/heads/master
2021-10-09T10:36:37.647000
2018-12-26T12:15:26
2018-12-26T12:15:26
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/*Write another program that uses a for loop. With the loop, make the variable x go from * -10 to 10, counting by 0.5. (This means that x can't be an int.) Inside the body of the loop, make another variable y become the current value of x squared. Then display the current values of both x and y. To get your output to line up like mine, use a tab.*/ public class XsAndYs { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("x \t y \n ------------------"); double x , y; for (x = -10; x <= 10; x += 0.5) { y = Math.pow(x, 2); System.out.println(x + "\t" + y); } } }
UTF-8
Java
656
java
XsAndYs.java
Java
[]
null
[]
/*Write another program that uses a for loop. With the loop, make the variable x go from * -10 to 10, counting by 0.5. (This means that x can't be an int.) Inside the body of the loop, make another variable y become the current value of x squared. Then display the current values of both x and y. To get your output to line up like mine, use a tab.*/ public class XsAndYs { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("x \t y \n ------------------"); double x , y; for (x = -10; x <= 10; x += 0.5) { y = Math.pow(x, 2); System.out.println(x + "\t" + y); } } }
656
0.615854
0.596037
24
25.25
28.040522
89
false
false
0
0
0
0
0
0
0.833333
false
false
13
aa7dcbc78cc2b7aba52749765a31ae5a12621fc7
31,181,462,633,502
670e9abca2d4272d02daee595282d1bebb4c4bfa
/Data Structures/src/data/structures/MyQueue.java
96959c18e21bcb7142741ff6fe7c38034d5bd41e
[]
no_license
vathsanvk/Data-Structures
https://github.com/vathsanvk/Data-Structures
2c9a52a95bffec992e135c5bcdfd064b3ed66425
d29c4bcc2b0a5b987a2b50df89caf1abddd4d0f6
refs/heads/master
2021-01-19T03:01:42.628000
2016-07-26T19:14:19
2016-07-26T19:14:19
48,474,069
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package data.structures; /** * * @author Srivathsan */ public class MyQueue { public static void main(String[] args){ QueueClass<Integer> q = new QueueClass<Integer>(); q.add(5); q.add(2); q.add(9); q.add(4); q.display(q); System.out.println("First: " + q.peek()); q.remove(); System.out.println("After removing first element"); q.display(q); System.out.println("First: " + q.peek()); } } class QueueClass<T> { private class Node<T>{ private T data; private Node<T> next; public Node(T data){ this.data = data; } } private Node<T> first; private Node<T> last; public T remove(){ if(first == null){ System.out.println("Queue is empty"); }else{ T data = first.data; first = first.next; if(first == null){ last = null; } return data; } return null; } public void add(T item){ Node<T> t = new Node<T>(item); if(last != null){ last.next = t; } last = t; if(first == null){ first = last; } } public T peek(){ if(first == null){ System.out.println("Queue is empty"); }else{ return first.data; } return null; } public boolean isEmpty(){ return first==null; } public void display(QueueClass s){ Node temp = first; while(temp.next != null){ System.out.print(temp.data); temp = temp.next; } System.out.println(temp.data); } }
UTF-8
Java
2,013
java
MyQueue.java
Java
[ { "context": "r.\n */\npackage data.structures;\n\n/**\n *\n * @author Srivathsan\n */\npublic class MyQueue {\n public static void", "end": 239, "score": 0.9989383220672607, "start": 229, "tag": "NAME", "value": "Srivathsan" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package data.structures; /** * * @author Srivathsan */ public class MyQueue { public static void main(String[] args){ QueueClass<Integer> q = new QueueClass<Integer>(); q.add(5); q.add(2); q.add(9); q.add(4); q.display(q); System.out.println("First: " + q.peek()); q.remove(); System.out.println("After removing first element"); q.display(q); System.out.println("First: " + q.peek()); } } class QueueClass<T> { private class Node<T>{ private T data; private Node<T> next; public Node(T data){ this.data = data; } } private Node<T> first; private Node<T> last; public T remove(){ if(first == null){ System.out.println("Queue is empty"); }else{ T data = first.data; first = first.next; if(first == null){ last = null; } return data; } return null; } public void add(T item){ Node<T> t = new Node<T>(item); if(last != null){ last.next = t; } last = t; if(first == null){ first = last; } } public T peek(){ if(first == null){ System.out.println("Queue is empty"); }else{ return first.data; } return null; } public boolean isEmpty(){ return first==null; } public void display(QueueClass s){ Node temp = first; while(temp.next != null){ System.out.print(temp.data); temp = temp.next; } System.out.println(temp.data); } }
2,013
0.472926
0.470939
97
19.742268
15.534649
79
false
false
0
0
0
0
0
0
0.391753
false
false
13
7d6b46bf3a3824eeb038bfa0ee4b13c156305bae
6,201,932,842,479
369e9ecc8c79edf631d2675c064bf2a0823d6699
/src/main/java/com/inflearn/jpabootshop/repository/OrderRepository.java
5c42b8c1f8a9376daeebc58a175c0bcbd9642b54
[]
no_license
HyunjunJeon/spboot_jpa_toy_shop
https://github.com/HyunjunJeon/spboot_jpa_toy_shop
084c88b0d4c4eb7edc897f85380d2996be5c3cf1
d1d29b4b6d7dbe1f914b83c88f795047962fba0a
refs/heads/master
2020-08-08T16:50:27.074000
2020-05-30T07:30:51
2020-05-30T07:30:51
213,872,332
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.inflearn.jpabootshop.repository; import com.inflearn.jpabootshop.domain.Order; import com.inflearn.jpabootshop.domain.*; import com.inflearn.jpabootshop.repository.order.simplequery.SimpleOrderQueryDto; import com.querydsl.core.types.dsl.BooleanExpression; import com.querydsl.jpa.impl.JPAQueryFactory; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Repository; import org.springframework.util.StringUtils; import javax.persistence.EntityManager; import javax.persistence.TypedQuery; import javax.persistence.criteria.*; import java.util.ArrayList; import java.util.List; @Repository @RequiredArgsConstructor public class OrderRepository { private final EntityManager entityManager; public void save(Order order) { entityManager.persist(order); } public Order findOne(Long id) { return entityManager.find(Order.class, id); } // 동적 쿼리 중 String은 SQL Injection의 위험도 있고 해서... 쓰지 않음(+ 너무 복잡함) public List<Order> findAll(OrderSearch orderSearch) { // 추후 QueryDSL을 활용하여 동적 쿼리로 만들어볼 것 return entityManager.createQuery( "select o from Order o join o.member m" + " where o.status = :status" + " and m.name like :name", Order.class) .setParameter("status", orderSearch.getOrderStatus()) .setParameter("name", orderSearch.getMemberName()) //.setFirstResult() // maxResult랑 사용해서 Paging도 가능~ .setMaxResults(1000) .getResultList() ; } /** * JPA 표준 동적 쿼리 생성 스펙인 Criteria 를 사용한 동적 쿼리 생성 * * @param orderSearch OrderSearch * @return List<Order> */ public List<Order> findAllByCriteria(OrderSearch orderSearch) { CriteriaBuilder cb = entityManager.getCriteriaBuilder(); CriteriaQuery<Order> cq = cb.createQuery(Order.class); Root<Order> o = cq.from(Order.class); Join<Object, Object> m = o.join("member", JoinType.INNER); List<Predicate> criteria = new ArrayList<>(); // 주문 상태 검색 if (orderSearch.getOrderStatus() != null) { Predicate status = cb.equal(o.get("status"), orderSearch.getOrderStatus()); criteria.add(status); } // 회원 이름 검색 if (StringUtils.hasText(orderSearch.getMemberName())) { Predicate name = cb.like(m.get("name"), "%" + orderSearch.getMemberName() + "%"); criteria.add(name); } cq.where(cb.and(criteria.toArray(new Predicate[criteria.size()]))); TypedQuery<Order> query = entityManager.createQuery(cq).setMaxResults(1000); return query.getResultList(); } // Ver.3 public List<Order> findAllWithMemberDelivery() { // Fetch Join을 이용한 해결 return entityManager.createQuery( "select o from Order o " + "join fetch o.member m " + "join fetch o.delivery d", Order.class).getResultList(); } // Ver.4 public List<SimpleOrderQueryDto> findOrderDtos() { // Entity 나 Embedded 타입만 JPA에서 반환 가능 /* JPQL을 직접 짜놨기 때문에... 재사용성 없음(딱 Fit하게 맞춰놨기도 하고, 코드도 지저분하고.. 그대신 Network을 덜 사용하긴 함) -> 근데.. 요즘 network이 너무 좋아서 엄청나게 데이터양이 큰 컬럼이 선택되지 않는 한 크게 성능 최적화가 있지는 않음 new 명령어를 사용해서 JPQL의 결과를 DTO로 즉시 변환 그리고 API 스펙이 여기에 들어와 있는 것(Repository 계층에..) 자체도 맞지 않음!! 따로 계층을 더 빼서 사용하는게 관리 포인트적인 측면으로 좋음 예를 들면,,, OrderQueryRepository 뭐 이렇게 만들어서 조회 전용 DTO 포인트는 따로 주는게 좋음 OrderRepository는 Order 엔티티를 조회하는 레포지토리임..! */ return entityManager.createQuery( "select new com.inflearn.jpabootshop.repository.SimpleOrderQueryDto(" + "o.id, m.name, o.orderDate, o.status, d.address) " + "from Order o" + " join o.member m" + " join o.delivery d", SimpleOrderQueryDto.class) .getResultList(); } public List<Order> findAllWithItem() { /* JPQL distinct 키워드 1) DB에 SQL 날릴 때, distinct 를 포함해서 날림 2) 가져온 데이터에 중복이 있을 경우, Collection에 담을때 제거하고 담아줌 */ // Collection fetch join을 사용하기 때문에 paging이 불가능함! // 여러개의 Collection에 fetch join을 사용해서도 안된다. return entityManager.createQuery( "select distinct o from Order o" + " join fetch o.member m" + " join fetch o.delivery d" + " join fetch o.orderItems oi" + " join fetch oi.item i", Order.class) .getResultList(); } public List<Order> findAllWithMemberDelivery2(int offset, int limit) { // yaml 파일에 default_batch_fetch_size 옵션을 적용했음(Global) /* @페이징 한계돌파 1) xToOne 관계를 모두 Fetch Join으로 처리한다(xToOne 관계는 row의 수를 증가시키지 않으므로 페이징 쿼리에 영향 X) 2) 컬렉션은 지연로딩으로 조회(-> 처음 Entity 구성할 때 했던 그대로..) 3) 지연 로딩의 '성능 최적화' 를 위해 Batch 로 쿼리가 나갈 수 있게끔 Global(YAML), Local(@BatchSize) 한 전략을 적용 -> SQL IN절을 사용함 */ return entityManager.createQuery( "select o from Order o " + "join fetch o.member m " + "join fetch o.delivery d", Order.class) .setFirstResult(offset) .setMaxResults(limit) .getResultList(); } public List<Order> findAllByQueryDsl(OrderSearch orderSearch) { QOrder order = QOrder.order; QMember member = QMember.member; JPAQueryFactory query = new JPAQueryFactory(entityManager); return query .select(order) .from(order) .join(order.member, member) .where(statusEq(orderSearch.getOrderStatus()), nameLike(orderSearch.getMemberName())) .limit(1000) .fetch(); } private BooleanExpression statusEq(OrderStatus status) { if (status == null) return null; return QOrder.order.status.eq(status); } private BooleanExpression nameLike(String name) { if (!StringUtils.hasText(name)) return null; return QMember.member.name.like(name); } }
UTF-8
Java
7,275
java
OrderRepository.java
Java
[ { "context": "화' 를 위해 Batch 로 쿼리가 나갈 수 있게끔 Global(YAML), Local(@BatchSize) 한 전략을 적용\n -> SQL IN절을 사용함\n ", "end": 5143, "score": 0.9122719168663025, "start": 5134, "tag": "USERNAME", "value": "BatchSize" } ]
null
[]
package com.inflearn.jpabootshop.repository; import com.inflearn.jpabootshop.domain.Order; import com.inflearn.jpabootshop.domain.*; import com.inflearn.jpabootshop.repository.order.simplequery.SimpleOrderQueryDto; import com.querydsl.core.types.dsl.BooleanExpression; import com.querydsl.jpa.impl.JPAQueryFactory; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Repository; import org.springframework.util.StringUtils; import javax.persistence.EntityManager; import javax.persistence.TypedQuery; import javax.persistence.criteria.*; import java.util.ArrayList; import java.util.List; @Repository @RequiredArgsConstructor public class OrderRepository { private final EntityManager entityManager; public void save(Order order) { entityManager.persist(order); } public Order findOne(Long id) { return entityManager.find(Order.class, id); } // 동적 쿼리 중 String은 SQL Injection의 위험도 있고 해서... 쓰지 않음(+ 너무 복잡함) public List<Order> findAll(OrderSearch orderSearch) { // 추후 QueryDSL을 활용하여 동적 쿼리로 만들어볼 것 return entityManager.createQuery( "select o from Order o join o.member m" + " where o.status = :status" + " and m.name like :name", Order.class) .setParameter("status", orderSearch.getOrderStatus()) .setParameter("name", orderSearch.getMemberName()) //.setFirstResult() // maxResult랑 사용해서 Paging도 가능~ .setMaxResults(1000) .getResultList() ; } /** * JPA 표준 동적 쿼리 생성 스펙인 Criteria 를 사용한 동적 쿼리 생성 * * @param orderSearch OrderSearch * @return List<Order> */ public List<Order> findAllByCriteria(OrderSearch orderSearch) { CriteriaBuilder cb = entityManager.getCriteriaBuilder(); CriteriaQuery<Order> cq = cb.createQuery(Order.class); Root<Order> o = cq.from(Order.class); Join<Object, Object> m = o.join("member", JoinType.INNER); List<Predicate> criteria = new ArrayList<>(); // 주문 상태 검색 if (orderSearch.getOrderStatus() != null) { Predicate status = cb.equal(o.get("status"), orderSearch.getOrderStatus()); criteria.add(status); } // 회원 이름 검색 if (StringUtils.hasText(orderSearch.getMemberName())) { Predicate name = cb.like(m.get("name"), "%" + orderSearch.getMemberName() + "%"); criteria.add(name); } cq.where(cb.and(criteria.toArray(new Predicate[criteria.size()]))); TypedQuery<Order> query = entityManager.createQuery(cq).setMaxResults(1000); return query.getResultList(); } // Ver.3 public List<Order> findAllWithMemberDelivery() { // Fetch Join을 이용한 해결 return entityManager.createQuery( "select o from Order o " + "join fetch o.member m " + "join fetch o.delivery d", Order.class).getResultList(); } // Ver.4 public List<SimpleOrderQueryDto> findOrderDtos() { // Entity 나 Embedded 타입만 JPA에서 반환 가능 /* JPQL을 직접 짜놨기 때문에... 재사용성 없음(딱 Fit하게 맞춰놨기도 하고, 코드도 지저분하고.. 그대신 Network을 덜 사용하긴 함) -> 근데.. 요즘 network이 너무 좋아서 엄청나게 데이터양이 큰 컬럼이 선택되지 않는 한 크게 성능 최적화가 있지는 않음 new 명령어를 사용해서 JPQL의 결과를 DTO로 즉시 변환 그리고 API 스펙이 여기에 들어와 있는 것(Repository 계층에..) 자체도 맞지 않음!! 따로 계층을 더 빼서 사용하는게 관리 포인트적인 측면으로 좋음 예를 들면,,, OrderQueryRepository 뭐 이렇게 만들어서 조회 전용 DTO 포인트는 따로 주는게 좋음 OrderRepository는 Order 엔티티를 조회하는 레포지토리임..! */ return entityManager.createQuery( "select new com.inflearn.jpabootshop.repository.SimpleOrderQueryDto(" + "o.id, m.name, o.orderDate, o.status, d.address) " + "from Order o" + " join o.member m" + " join o.delivery d", SimpleOrderQueryDto.class) .getResultList(); } public List<Order> findAllWithItem() { /* JPQL distinct 키워드 1) DB에 SQL 날릴 때, distinct 를 포함해서 날림 2) 가져온 데이터에 중복이 있을 경우, Collection에 담을때 제거하고 담아줌 */ // Collection fetch join을 사용하기 때문에 paging이 불가능함! // 여러개의 Collection에 fetch join을 사용해서도 안된다. return entityManager.createQuery( "select distinct o from Order o" + " join fetch o.member m" + " join fetch o.delivery d" + " join fetch o.orderItems oi" + " join fetch oi.item i", Order.class) .getResultList(); } public List<Order> findAllWithMemberDelivery2(int offset, int limit) { // yaml 파일에 default_batch_fetch_size 옵션을 적용했음(Global) /* @페이징 한계돌파 1) xToOne 관계를 모두 Fetch Join으로 처리한다(xToOne 관계는 row의 수를 증가시키지 않으므로 페이징 쿼리에 영향 X) 2) 컬렉션은 지연로딩으로 조회(-> 처음 Entity 구성할 때 했던 그대로..) 3) 지연 로딩의 '성능 최적화' 를 위해 Batch 로 쿼리가 나갈 수 있게끔 Global(YAML), Local(@BatchSize) 한 전략을 적용 -> SQL IN절을 사용함 */ return entityManager.createQuery( "select o from Order o " + "join fetch o.member m " + "join fetch o.delivery d", Order.class) .setFirstResult(offset) .setMaxResults(limit) .getResultList(); } public List<Order> findAllByQueryDsl(OrderSearch orderSearch) { QOrder order = QOrder.order; QMember member = QMember.member; JPAQueryFactory query = new JPAQueryFactory(entityManager); return query .select(order) .from(order) .join(order.member, member) .where(statusEq(orderSearch.getOrderStatus()), nameLike(orderSearch.getMemberName())) .limit(1000) .fetch(); } private BooleanExpression statusEq(OrderStatus status) { if (status == null) return null; return QOrder.order.status.eq(status); } private BooleanExpression nameLike(String name) { if (!StringUtils.hasText(name)) return null; return QMember.member.name.like(name); } }
7,275
0.588393
0.585239
173
35.653179
26.323816
101
false
false
0
0
0
0
0
0
0.393064
false
false
13
828996ac689f7a3e55317a2b89e3f1eee8d108ad
2,980,707,318,171
b59168e0ae4ca8d269fa58031abceddd8e079f7a
/mysql/src/main/java/com/mydbpattern/db/mysql/AppProperties.java
bac62b324b4084293f138f73e21a252d7f614eea
[ "MIT" ]
permissive
AydogduEmree/DesignPattern
https://github.com/AydogduEmree/DesignPattern
bcfe633293985cf0764141c319c8696b6ccaa9cd
170fb6df2b56076624e35cfb91aea07772a4ede2
refs/heads/master
2023-03-28T03:45:05.691000
2021-04-05T13:20:41
2021-04-05T13:20:41
354,558,878
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mydbpattern.db.mysql; import java.io.IOException; import java.sql.SQLException; import java.util.List; import java.util.Properties; public class AppProperties { public static void main(String[] args) { // TODO Auto-generated method stub var prop = Profile.getProperties("db"); var db = DbProperties.instance(); try { db.connect(prop); } catch(SQLException e) { e.printStackTrace(); } System.out.println("System connected!"); UserDao userDao = new UserDaoImpl(); List<Users> users= userDao.getAllProperties(); for(Users u: users) { System.out.println(u.toString()); } } }
UTF-8
Java
695
java
AppProperties.java
Java
[]
null
[]
package com.mydbpattern.db.mysql; import java.io.IOException; import java.sql.SQLException; import java.util.List; import java.util.Properties; public class AppProperties { public static void main(String[] args) { // TODO Auto-generated method stub var prop = Profile.getProperties("db"); var db = DbProperties.instance(); try { db.connect(prop); } catch(SQLException e) { e.printStackTrace(); } System.out.println("System connected!"); UserDao userDao = new UserDaoImpl(); List<Users> users= userDao.getAllProperties(); for(Users u: users) { System.out.println(u.toString()); } } }
695
0.630216
0.630216
32
19.71875
16.064779
50
false
false
0
0
0
0
0
0
1.75
false
false
13
38e141ace197cb9a5c5b76441ed20cc45ef2932d
34,342,558,547,987
f352f39597367dc339f988fea8122420d9a6dc67
/src/setbst/MKTest.java
2a254e95b280aa47baa20310237d8d154a9a76e1
[ "MIT" ]
permissive
anshkuckreja-mac/BSTset
https://github.com/anshkuckreja-mac/BSTset
dfc90561d3f494cea3e01efcb2641844d1638fe9
e1403f1db4c11e9c29fec4f334094ee6dca44755
refs/heads/main
2023-03-20T05:57:02.428000
2021-03-11T23:54:39
2021-03-11T23:54:39
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package setbst; public class MKTest { public static void testLevel(BSTSet input) { input.printLevelOrder(); } public static void main(String[] args) { // // //test level order because its test is confusing.... // // int[] arrBST = {37, 22, 55, 7, 5, 6}; // // Level 1 -> 7; level 2-> 5, 37; level 3 -> 6, 22, 55. // // BSTSet funBST = new BSTSet(arrBST); // // testLevel(funBST); // // //test intersection for balance..... int[] inter1 = {1,2,3,4,5,6,7,8}; int[] inter2 = {1,3,4,5,6,7,8}; BSTSet fun1 = new BSTSet(inter1); BSTSet fun2 = new BSTSet(inter2); BSTSet fun3 = fun1.intersection(fun2); //level order should be 5..... 3,7 .... 1,4,6,8 //print should be 1,3,4,5,6,7,8 fun3.printLevelOrder(); System.out.println(""); fun3.printNonRec(); //bruh im stumped. } }
UTF-8
Java
844
java
MKTest.java
Java
[]
null
[]
package setbst; public class MKTest { public static void testLevel(BSTSet input) { input.printLevelOrder(); } public static void main(String[] args) { // // //test level order because its test is confusing.... // // int[] arrBST = {37, 22, 55, 7, 5, 6}; // // Level 1 -> 7; level 2-> 5, 37; level 3 -> 6, 22, 55. // // BSTSet funBST = new BSTSet(arrBST); // // testLevel(funBST); // // //test intersection for balance..... int[] inter1 = {1,2,3,4,5,6,7,8}; int[] inter2 = {1,3,4,5,6,7,8}; BSTSet fun1 = new BSTSet(inter1); BSTSet fun2 = new BSTSet(inter2); BSTSet fun3 = fun1.intersection(fun2); //level order should be 5..... 3,7 .... 1,4,6,8 //print should be 1,3,4,5,6,7,8 fun3.printLevelOrder(); System.out.println(""); fun3.printNonRec(); //bruh im stumped. } }
844
0.579384
0.507109
44
18.181818
18.047001
59
false
false
0
0
0
0
0
0
2.613636
false
false
13
f1ba6948e585cda6b6ba0d5c9d23086237b634b7
38,869,454,043,377
20d94f462c28911941c085816aee7428a0c1c834
/java/src/main/java/lin/louis/game/Game.java
59bcc15063095dc70fcfe21bb08a73c9ab54239c
[]
no_license
figc/dev-cheat-sheet
https://github.com/figc/dev-cheat-sheet
d1e86376db21136bd964d0ec508053b1121fba62
651639aa6c93a593d5430a98b53bf58c499bbc94
refs/heads/master
2020-05-29T22:59:38.860000
2016-02-12T10:39:48
2016-02-12T10:39:48
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package lin.louis.game; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; public abstract class Game { private ByteArrayOutputStream os; public Game() { os = new ByteArrayOutputStream(); System.setOut(new PrintStream(os)); } protected void setInput(String... input) { String finalInput = ""; for (String line : input) { finalInput += line + "\n"; } System.setIn(new ByteArrayInputStream(finalInput.getBytes(StandardCharsets.UTF_8))); } protected String readOutput() throws UnsupportedEncodingException { String output = os.toString(StandardCharsets.UTF_8.name()); // Reset so we do not have the previous line os.reset(); return output; } }
UTF-8
Java
905
java
Game.java
Java
[]
null
[]
package lin.louis.game; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; public abstract class Game { private ByteArrayOutputStream os; public Game() { os = new ByteArrayOutputStream(); System.setOut(new PrintStream(os)); } protected void setInput(String... input) { String finalInput = ""; for (String line : input) { finalInput += line + "\n"; } System.setIn(new ByteArrayInputStream(finalInput.getBytes(StandardCharsets.UTF_8))); } protected String readOutput() throws UnsupportedEncodingException { String output = os.toString(StandardCharsets.UTF_8.name()); // Reset so we do not have the previous line os.reset(); return output; } }
905
0.674033
0.671823
31
28.193548
22.992872
92
false
false
0
0
0
0
0
0
0.483871
false
false
13
57fa9d9fc2afb4160fe756863c4dcf7d37de174a
33,552,284,580,531
d53a46985e7136edf2f191a79e3a1d75bd337a25
/app/src/main/java/com/scurab/android/nativeimageapp/Image200MPixFragment.java
7692440519696e3fc7cd642b2ac7eff9f951a6ce
[ "Apache-2.0" ]
permissive
jbruchanov/NativeImageAndroid
https://github.com/jbruchanov/NativeImageAndroid
b4d2e6d0f5fdae4beb6d368cca3f420d8106a272
3b97309565b5f756f5fdfd76dc271bb956a35d3a
refs/heads/master
2021-01-19T09:18:43.848000
2017-04-26T12:58:25
2017-04-26T12:58:25
87,746,544
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.scurab.android.nativeimageapp; /** * Created by JBruchanov on 15/04/2017. */ public class Image200MPixFragment extends Image100MPixFragment { @Override protected String getImageFile() { return MainActivity.LARGE_IMAGE_200MPIX; } }
UTF-8
Java
268
java
Image200MPixFragment.java
Java
[ { "context": ".scurab.android.nativeimageapp;\n\n/**\n * Created by JBruchanov on 15/04/2017.\n */\n\npublic class Image200MPix", "end": 68, "score": 0.8511597514152527, "start": 62, "tag": "USERNAME", "value": "JBruch" }, { "context": ".android.nativeimageapp;\n\n/**\n * Created by ...
null
[]
package com.scurab.android.nativeimageapp; /** * Created by JBruchanov on 15/04/2017. */ public class Image200MPixFragment extends Image100MPixFragment { @Override protected String getImageFile() { return MainActivity.LARGE_IMAGE_200MPIX; } }
268
0.723881
0.660448
13
19.615385
21.952881
64
false
false
0
0
0
0
0
0
0.153846
false
false
13
71c20ce011224bbbce4f2e55e8dab3406722a826
39,444,979,650,224
91f05a21bf536340facaa2b6265901c586fb072b
/src/com/itheima/redbaby/config/Constant.java
dc84ac27aa4b45c5b7edf647520abc85fe0d9e0e
[]
no_license
Georgekaren/ECServer_D_SVN_20151230
https://github.com/Georgekaren/ECServer_D_SVN_20151230
4b43ab47358aa6154a86f45ba539da6e8d0732a6
50f880ba8d986dd8bff66c0e99928d254994be8f
refs/heads/master
2021-01-10T17:32:00.448000
2015-12-20T06:20:10
2015-12-20T06:20:10
48,309,633
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.itheima.redbaby.config; public interface Constant { String pic_url = "http://192.168.1.16:8080/ECServer_D/images/"; String RESPONSE = "response"; String APK_URL = "http://192.168.1.16:8080/ECServer_D/redbaby.apk"; }
UTF-8
Java
232
java
Constant.java
Java
[ { "context": "ic interface Constant {\n\tString pic_url = \"http://192.168.1.16:8080/ECServer_D/images/\";\n\tString RESPONSE = \"res", "end": 103, "score": 0.9996824264526367, "start": 91, "tag": "IP_ADDRESS", "value": "192.168.1.16" }, { "context": " RESPONSE = \"response\";\n\tStr...
null
[]
package com.itheima.redbaby.config; public interface Constant { String pic_url = "http://192.168.1.16:8080/ECServer_D/images/"; String RESPONSE = "response"; String APK_URL = "http://192.168.1.16:8080/ECServer_D/redbaby.apk"; }
232
0.719828
0.607759
7
32.142857
24.907993
68
false
false
0
0
0
0
0
0
1
false
false
13
6ff1046eb78a0c5bf2b13d6b8a04c84ef56818cc
39,273,180,979,414
5a562ddbed1cc839d81d4c637569540260d88f96
/OFFICE PROJECTS/COPP/cop-domain/src/main/java/com/inetpsa/poc00/domain/generictechdatamandatory/GenericTechDataMandatory.java
7038e358efa6c094e18899f6c6c0b9f3d92938de
[]
no_license
gajanan-kharat/MindMap-all-documents
https://github.com/gajanan-kharat/MindMap-all-documents
7f93a54b7932c498202422dbf7ea7d5dec4a6d85
673c4c8d32f0b4e49d7d754dd6b898741fbff6bb
refs/heads/master
2020-12-05T20:34:54.346000
2020-01-08T01:41:20
2020-01-08T01:41:20
232,234,981
0
0
null
false
2021-01-14T20:31:29
2020-01-07T03:29:17
2020-01-08T02:12:30
2021-01-14T20:31:28
485,289
0
0
14
Java
false
false
/** * Copyright (c) 2013-2015, The SeedStack authors <http://seedstack.org> * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not * distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package com.inetpsa.poc00.domain.generictechdatamandatory; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import org.seedstack.business.domain.BaseAggregateRoot; import com.inetpsa.poc00.domain.generictd.GenericTechnicalData; /** * The customer aggregate root. */ @Entity @Table(name = "COPQTTDM") public class GenericTechDataMandatory extends BaseAggregateRoot<Long> { /** The entity id. */ @Id @Column(name = "ID") @GeneratedValue(strategy = GenerationType.AUTO) protected long entityId; /** The value. */ @Column(name = "VALUE") private Boolean value = false; /** The generic technical data. */ @ManyToOne @JoinColumn(name = "DATA_ID") private GenericTechnicalData genericTechnicalData; /** * Constructor are in visibility package because only Factories can create aggregates and entities. * <p/> * Factories are in the same package so he can access package visibility. */ public GenericTechDataMandatory() { super(); } /* * (non-Javadoc) * * @see org.seedstack.business.domain.BaseEntity#getEntityId() */ @Override public Long getEntityId() { return entityId; } /** * Sets the entity id. * * @param entityId the new entity id */ public void setEntityId(long entityId) { this.entityId = entityId; } /** * Gets the value. * * @return the value */ public Boolean getValue() { return value; } /** * Sets the value. * * @param value the new value */ public void setValue(Boolean value) { this.value = value; } /** * Gets the generic technical data. * * @return the generic technical data */ public GenericTechnicalData getGenericTechnicalData() { return genericTechnicalData; } /** * Sets the generic technical data. * * @param genericTechnicalData the new generic technical data */ public void setGenericTechnicalData(GenericTechnicalData genericTechnicalData) { this.genericTechnicalData = genericTechnicalData; } }
UTF-8
Java
2,689
java
GenericTechDataMandatory.java
Java
[]
null
[]
/** * Copyright (c) 2013-2015, The SeedStack authors <http://seedstack.org> * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not * distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package com.inetpsa.poc00.domain.generictechdatamandatory; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import org.seedstack.business.domain.BaseAggregateRoot; import com.inetpsa.poc00.domain.generictd.GenericTechnicalData; /** * The customer aggregate root. */ @Entity @Table(name = "COPQTTDM") public class GenericTechDataMandatory extends BaseAggregateRoot<Long> { /** The entity id. */ @Id @Column(name = "ID") @GeneratedValue(strategy = GenerationType.AUTO) protected long entityId; /** The value. */ @Column(name = "VALUE") private Boolean value = false; /** The generic technical data. */ @ManyToOne @JoinColumn(name = "DATA_ID") private GenericTechnicalData genericTechnicalData; /** * Constructor are in visibility package because only Factories can create aggregates and entities. * <p/> * Factories are in the same package so he can access package visibility. */ public GenericTechDataMandatory() { super(); } /* * (non-Javadoc) * * @see org.seedstack.business.domain.BaseEntity#getEntityId() */ @Override public Long getEntityId() { return entityId; } /** * Sets the entity id. * * @param entityId the new entity id */ public void setEntityId(long entityId) { this.entityId = entityId; } /** * Gets the value. * * @return the value */ public Boolean getValue() { return value; } /** * Sets the value. * * @param value the new value */ public void setValue(Boolean value) { this.value = value; } /** * Gets the generic technical data. * * @return the generic technical data */ public GenericTechnicalData getGenericTechnicalData() { return genericTechnicalData; } /** * Sets the generic technical data. * * @param genericTechnicalData the new generic technical data */ public void setGenericTechnicalData(GenericTechnicalData genericTechnicalData) { this.genericTechnicalData = genericTechnicalData; } }
2,689
0.660097
0.654147
109
23.669725
24.43154
116
false
false
0
0
0
0
0
0
0.229358
false
false
13
0badd2e15b4eefd291377056b33af158787c5314
34,419,867,967,470
b214f96566446763ce5679dd2121ea3d277a9406
/modules/desktop-awt/desktop-awt-ide-impl/src/main/java/consulo/desktop/awt/ui/impl/image/DesktopImage.java
af273100b77c83bd1a4237cbbdbc288c8e31a267
[ "Apache-2.0", "LicenseRef-scancode-jgraph" ]
permissive
consulo/consulo
https://github.com/consulo/consulo
aa340d719d05ac6cbadd3f7d1226cdb678e6c84f
d784f1ef5824b944c1ee3a24a8714edfc5e2b400
refs/heads/master
2023-09-06T06:55:04.987000
2023-09-01T06:42:16
2023-09-01T06:42:16
10,116,915
680
54
Apache-2.0
false
2023-06-05T18:28:51
2013-05-17T05:48:18
2023-05-27T20:14:55
2023-06-05T18:28:50
978,666
673
48
69
Java
false
false
package consulo.desktop.awt.ui.impl.image; import consulo.ui.image.Image; import jakarta.annotation.Nonnull; import java.util.function.Function; /** * @author VISTALL * @since 2020-10-05 */ public interface DesktopImage<I extends DesktopImage<I>> extends Image { @Nonnull @SuppressWarnings("unchecked") default I copyWithTargetIconLibrary(@Nonnull String iconLibraryId, @Nonnull Function<Image, Image> converter) { return (I)this; } @Nonnull @SuppressWarnings("unchecked") default I copyWithScale(float scale) { return (I)this; } }
UTF-8
Java
563
java
DesktopImage.java
Java
[ { "context": "mport java.util.function.Function;\n\n/**\n * @author VISTALL\n * @since 2020-10-05\n */\npublic interface Desktop", "end": 170, "score": 0.9861757755279541, "start": 163, "tag": "NAME", "value": "VISTALL" } ]
null
[]
package consulo.desktop.awt.ui.impl.image; import consulo.ui.image.Image; import jakarta.annotation.Nonnull; import java.util.function.Function; /** * @author VISTALL * @since 2020-10-05 */ public interface DesktopImage<I extends DesktopImage<I>> extends Image { @Nonnull @SuppressWarnings("unchecked") default I copyWithTargetIconLibrary(@Nonnull String iconLibraryId, @Nonnull Function<Image, Image> converter) { return (I)this; } @Nonnull @SuppressWarnings("unchecked") default I copyWithScale(float scale) { return (I)this; } }
563
0.738899
0.724689
24
22.458334
25.999966
113
false
false
0
0
0
0
0
0
0.333333
false
false
13
1c2828911004b7b98632d244681c48fc2720fe6d
34,419,867,967,753
0ff08ac94bd190bd488144f4e67bd65bc8299341
/Crawler2.java
2e9b1a02db6322d822778dd652a1feefc84d0d3d
[]
no_license
BBK-PiJ-2012-03/spambot
https://github.com/BBK-PiJ-2012-03/spambot
17d44bed31d99765e244919e10ba530a9ac8ef02
e3dcac3b130557c7184d3088157d1413d9211415
refs/heads/master
2020-12-24T16:31:54.115000
2012-12-13T16:16:50
2012-12-13T16:16:50
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.*; import java.net.*; import java.io.*; import javax.swing.text.BadLocationException; public class Crawler implements Runnable { public SpamBotImpl sp = null; public Set<String> emailSet = null; public Set<String> linksToVisitSet = null; public Set<String> linksVisitedSet = null; private String seed; public Crawler(SpamBotImpl spambot) { this.sp = spambot; this.emailSet = spambot.emailSet; this.linksVisitedSet = spambot.linksVisitedSet; this.linksToVisitSet = spambot.linksToVisitSet; } public Set<String> getEmailSet() { return emailSet; } public void run() { run2(); } public void run2() { synchronized(sp){ Iterator<String> ite = linksToVisitSet.iterator(); WebAnalyzer myAnalyzer; while(ite.hasNext() && emailSet.size() < 100){ String link = ite.next(); try{ myAnalyzer = new WebAnalyzer(link); linksVisitedSet.add(link); linksToVisitSet.remove(link); //System.out.println(link); //debug //System.out.println(myAnalyzer.getEmails()); //debug //Set<String> str = myAnalyzer.getEmails(); //System.out.println(str); emailSet.addAll(myAnalyzer.getEmails()); linksToVisitSet.addAll(myAnalyzer.getLinks()); } catch(Exception e){ e.printStackTrace(); } } } } }
UTF-8
Java
1,317
java
Crawler2.java
Java
[]
null
[]
import java.util.*; import java.net.*; import java.io.*; import javax.swing.text.BadLocationException; public class Crawler implements Runnable { public SpamBotImpl sp = null; public Set<String> emailSet = null; public Set<String> linksToVisitSet = null; public Set<String> linksVisitedSet = null; private String seed; public Crawler(SpamBotImpl spambot) { this.sp = spambot; this.emailSet = spambot.emailSet; this.linksVisitedSet = spambot.linksVisitedSet; this.linksToVisitSet = spambot.linksToVisitSet; } public Set<String> getEmailSet() { return emailSet; } public void run() { run2(); } public void run2() { synchronized(sp){ Iterator<String> ite = linksToVisitSet.iterator(); WebAnalyzer myAnalyzer; while(ite.hasNext() && emailSet.size() < 100){ String link = ite.next(); try{ myAnalyzer = new WebAnalyzer(link); linksVisitedSet.add(link); linksToVisitSet.remove(link); //System.out.println(link); //debug //System.out.println(myAnalyzer.getEmails()); //debug //Set<String> str = myAnalyzer.getEmails(); //System.out.println(str); emailSet.addAll(myAnalyzer.getEmails()); linksToVisitSet.addAll(myAnalyzer.getLinks()); } catch(Exception e){ e.printStackTrace(); } } } } }
1,317
0.677297
0.6735
61
20.52459
18.183586
57
false
false
0
0
0
0
0
0
2.377049
false
false
13
4f1c8c41e4b5b8d89e712a9f1eb7fbf736c3b976
38,388,417,714,887
8675bfffbc45b6b081d5d077d82b49e474dbf4d5
/cpf-pentaho-base/src/pt/webdetails/cpf/PentahoBasePluginEnvironment.java
3cd1743cc4b41297ef7fc8bea86f06f07698bbbd
[]
no_license
jornak/cpf
https://github.com/jornak/cpf
b8fbc690f9d4a7a2d94e8e52ccae32156d3bed02
60d50cc6a582b6f796a0150cebc5de4fffa33d6b
refs/heads/master
2017-01-03T20:04:34.763000
2014-12-09T16:08:58
2014-12-09T16:08:58
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pt.webdetails.cpf; import java.io.IOException; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dom4j.Node; import pt.webdetails.cpf.repository.api.IContentAccessFactory; import pt.webdetails.cpf.repository.api.IReadAccess; import pt.webdetails.cpf.repository.api.IRWAccess; import pt.webdetails.cpf.repository.pentaho.SystemPluginResourceAccess; import pt.webdetails.cpf.utils.XmlDom4JUtils; //TODO: doesn't make much sense right now public abstract class PentahoBasePluginEnvironment extends PluginEnvironment implements IContentAccessFactory { private static String pluginId = null; private static Log logger = LogFactory.getLog(PentahoPluginEnvironment.class); public IContentAccessFactory getContentAccessFactory() { return this; } @Override public IReadAccess getPluginSystemReader(String basePath) { return new SystemPluginResourceAccess(this.getClass().getClassLoader(), basePath); } @Override public IRWAccess getPluginSystemWriter(String basePath) { return new SystemPluginResourceAccess(this.getClass().getClassLoader(), basePath); } //TODO: this is temporary public PluginSettings getPluginSettings() { return new PluginSettings(new SystemPluginResourceAccess(this.getClass().getClassLoader(), null)); } @Override public IReadAccess getOtherPluginSystemReader(String pluginId, String basePath) { return new SystemPluginResourceAccess(pluginId, basePath); } @Override public IRWAccess getOtherPluginSystemWriter(String pluginId, String basePath) { return new SystemPluginResourceAccess(pluginId, basePath); } /** * @return Plugin's directory in repository, relative to root; defaults to plugin id if not overridden */ protected String getPluginRepositoryDir() { return Util.joinPath( "/public", getPluginId()); } /** * @return The plugin's ID. This isn't efficient and should be overridden by plugin. */ public String getPluginId() { if (pluginId == null) { try { // this depends on cpf being loaded by the plugin classloader IReadAccess reader = new SystemPluginResourceAccess(PentahoBasePluginEnvironment.class.getClassLoader(), null); Node documentNode = XmlDom4JUtils.getDocumentFromFile(reader, "plugin.xml").getRootElement(); pluginId = documentNode.valueOf("/plugin/@name"); if ( StringUtils.isEmpty( pluginId ) ) { pluginId = documentNode.valueOf( "/plugin/@title" ); } } catch (IOException e) { logger.fatal("Problem reading plugin.xml", e); return "cpf"; } } return pluginId; } }
UTF-8
Java
2,709
java
PentahoBasePluginEnvironment.java
Java
[]
null
[]
package pt.webdetails.cpf; import java.io.IOException; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dom4j.Node; import pt.webdetails.cpf.repository.api.IContentAccessFactory; import pt.webdetails.cpf.repository.api.IReadAccess; import pt.webdetails.cpf.repository.api.IRWAccess; import pt.webdetails.cpf.repository.pentaho.SystemPluginResourceAccess; import pt.webdetails.cpf.utils.XmlDom4JUtils; //TODO: doesn't make much sense right now public abstract class PentahoBasePluginEnvironment extends PluginEnvironment implements IContentAccessFactory { private static String pluginId = null; private static Log logger = LogFactory.getLog(PentahoPluginEnvironment.class); public IContentAccessFactory getContentAccessFactory() { return this; } @Override public IReadAccess getPluginSystemReader(String basePath) { return new SystemPluginResourceAccess(this.getClass().getClassLoader(), basePath); } @Override public IRWAccess getPluginSystemWriter(String basePath) { return new SystemPluginResourceAccess(this.getClass().getClassLoader(), basePath); } //TODO: this is temporary public PluginSettings getPluginSettings() { return new PluginSettings(new SystemPluginResourceAccess(this.getClass().getClassLoader(), null)); } @Override public IReadAccess getOtherPluginSystemReader(String pluginId, String basePath) { return new SystemPluginResourceAccess(pluginId, basePath); } @Override public IRWAccess getOtherPluginSystemWriter(String pluginId, String basePath) { return new SystemPluginResourceAccess(pluginId, basePath); } /** * @return Plugin's directory in repository, relative to root; defaults to plugin id if not overridden */ protected String getPluginRepositoryDir() { return Util.joinPath( "/public", getPluginId()); } /** * @return The plugin's ID. This isn't efficient and should be overridden by plugin. */ public String getPluginId() { if (pluginId == null) { try { // this depends on cpf being loaded by the plugin classloader IReadAccess reader = new SystemPluginResourceAccess(PentahoBasePluginEnvironment.class.getClassLoader(), null); Node documentNode = XmlDom4JUtils.getDocumentFromFile(reader, "plugin.xml").getRootElement(); pluginId = documentNode.valueOf("/plugin/@name"); if ( StringUtils.isEmpty( pluginId ) ) { pluginId = documentNode.valueOf( "/plugin/@title" ); } } catch (IOException e) { logger.fatal("Problem reading plugin.xml", e); return "cpf"; } } return pluginId; } }
2,709
0.744924
0.743817
80
32.862499
33.09824
119
false
false
0
0
0
0
0
0
0.5
false
false
13
0e606c69c60cbef24dbb54569b1d04d29bf63245
38,903,813,790,929
21d748e3318633635b78e0365726171e23b5562c
/sql-dsl/src/main/java/com/neaterbits/query/sql/dsl/api/TypeMapSource.java
ee238dc1a3843908943b6a0b159ff6992a5682ea
[]
no_license
neaterbits/query
https://github.com/neaterbits/query
ee9419737e39c53261c01fd31d0679561a303f15
eaec0deaa91e90ec44402af6fbba41ed9c2bf1a9
refs/heads/master
2022-05-04T02:21:42.605000
2017-09-10T14:49:35
2017-09-10T14:49:35
70,929,750
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.neaterbits.query.sql.dsl.api; interface TypeMapSource { Class<?> getType(); String getName(); int getIdx(); }
UTF-8
Java
131
java
TypeMapSource.java
Java
[]
null
[]
package com.neaterbits.query.sql.dsl.api; interface TypeMapSource { Class<?> getType(); String getName(); int getIdx(); }
131
0.687023
0.687023
10
12.1
13.284954
41
false
false
0
0
0
0
0
0
0.9
false
false
13
650b4a858a20c6e4988b5a29ae8901c54114c8c9
35,381,940,633,975
9acfc6cb93ad5d6f0ec3dd8ddfdfbb04cce56bad
/WaterHackApp/src/ca/dalezak/Models/Sensor.java
d8f277eabe2f92138742493e424d72a7dcf204d0
[]
no_license
dalezak/WaterHack
https://github.com/dalezak/WaterHack
1006b50f08444c6b7cc73a51152d4a26d75b0812
12d40602d9d896928b545df03158ce2b12dd18b1
refs/heads/master
2019-04-29T11:52:03.537000
2012-03-25T17:54:39
2012-03-25T17:54:39
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ca.dalezak.Models; public class Sensor { float oxygen; float temperature; Exception exception; public float getOxygen() { return oxygen; } public void setOxygen(float oxygen) { this.oxygen = oxygen; } public float getTemperature() { return temperature; } public boolean hasException() { return exception != null; } public void setTemperature(float temperature) { this.temperature = temperature; } public Exception getException() { return exception; } public void setException(Exception exception) { this.exception = exception; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Temperature: "); sb.append(temperature); sb.append("\n"); sb.append("Oxygen: "); sb.append(oxygen); return sb.toString(); } }
UTF-8
Java
962
java
Sensor.java
Java
[]
null
[]
package ca.dalezak.Models; public class Sensor { float oxygen; float temperature; Exception exception; public float getOxygen() { return oxygen; } public void setOxygen(float oxygen) { this.oxygen = oxygen; } public float getTemperature() { return temperature; } public boolean hasException() { return exception != null; } public void setTemperature(float temperature) { this.temperature = temperature; } public Exception getException() { return exception; } public void setException(Exception exception) { this.exception = exception; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Temperature: "); sb.append(temperature); sb.append("\n"); sb.append("Oxygen: "); sb.append(oxygen); return sb.toString(); } }
962
0.590437
0.590437
48
19.041666
15.745315
51
false
false
0
0
0
0
0
0
0.375
false
false
13
c49a5190ba2fa0a0fc047fffe1e7f0c602f790fe
30,571,577,250,332
88150fc00428a75d9e094c58794a4a0d77214ee7
/src/selenium/Observation.java
9369df942eedff3f3b82dadbf9005db8f81c6b9e
[]
no_license
lovelybatch247/program248
https://github.com/lovelybatch247/program248
c1ee044d3a92ad0bd6fb05b651f7a4f3fe903ff2
483317a2e749b3cce3be9cfb0dde3fd6ff0278ea
refs/heads/master
2022-09-30T19:47:55.936000
2020-06-04T16:46:35
2020-06-04T16:46:35
269,398,522
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package selenium; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class Observation { public static void main(String[] args) { // TODO Auto-generated method stub System.setProperty("webdriver.chrome.driver", "C:\\LOVELY\\selenium20\\chromedriver_win32 (1)\\chromedriver.exe"); System.setProperty("webdriver.chrome.silentOutput", "true"); ChromeDriver driver=new ChromeDriver(); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(5000, TimeUnit.MILLISECONDS); driver.get("https://www.gmail.com"); WebElement e1=driver.findElement(By.name("identifier")); String tag_userid=e1.getTagName(); WebElement e2=driver.findElement(By.name("hiddenPassword")); String tag_password=e2.getTagName(); System.out.println(tag_userid); System.out.println(tag_password); if(e1.isDisplayed()) { if(e1.isEnabled()) { System.out.println("Userid is displaying in page and enabled"); } else { System.out.println("Userid is displaying in page but disabled"); } } else { System.out.println("Userid is not displaying in page"); } if(e2.isDisplayed()) { if(e2.isEnabled()) { System.out.println("Password is displaying in page and enabled"); } else { System.out.println("Password is displaying in page but disabled"); } } else { System.out.println("Password is not displaying in page"); } driver.close(); } }
UTF-8
Java
1,570
java
Observation.java
Java
[]
null
[]
package selenium; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class Observation { public static void main(String[] args) { // TODO Auto-generated method stub System.setProperty("webdriver.chrome.driver", "C:\\LOVELY\\selenium20\\chromedriver_win32 (1)\\chromedriver.exe"); System.setProperty("webdriver.chrome.silentOutput", "true"); ChromeDriver driver=new ChromeDriver(); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(5000, TimeUnit.MILLISECONDS); driver.get("https://www.gmail.com"); WebElement e1=driver.findElement(By.name("identifier")); String tag_userid=e1.getTagName(); WebElement e2=driver.findElement(By.name("hiddenPassword")); String tag_password=e2.getTagName(); System.out.println(tag_userid); System.out.println(tag_password); if(e1.isDisplayed()) { if(e1.isEnabled()) { System.out.println("Userid is displaying in page and enabled"); } else { System.out.println("Userid is displaying in page but disabled"); } } else { System.out.println("Userid is not displaying in page"); } if(e2.isDisplayed()) { if(e2.isEnabled()) { System.out.println("Password is displaying in page and enabled"); } else { System.out.println("Password is displaying in page but disabled"); } } else { System.out.println("Password is not displaying in page"); } driver.close(); } }
1,570
0.689172
0.678344
50
29.4
26.358301
116
false
false
0
0
0
0
0
0
2.38
false
false
13
59c138e738a3c869894376a93d0781d78d8fa8ff
21,105,469,322,623
283272106bbd13e13a7c485649603608a2435bb6
/app/src/main/java/com/example/yrj/gaoxiaobang1/Adapter2.java
3c5e1eda74e558f2dab9a80595a4ab1be56b019a
[]
no_license
cumtdeyurenjie/GaoXiaoBang1
https://github.com/cumtdeyurenjie/GaoXiaoBang1
b66561bf92cdb9a1a63cd3a7825a76acc7f1491f
645933dc0d66ba6f0a046675f581378cf1469516
refs/heads/master
2021-04-06T13:20:40.056000
2018-03-16T14:57:13
2018-03-16T14:57:13
125,229,235
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.yrj.gaoxiaobang1; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.squareup.picasso.Picasso; import java.util.List; /** * Created by YRJ on 2018/3/7. */ public class Adapter2 extends RecyclerView.Adapter<Adapter2.ViewHolder> { private List<News> newsList; public Adapter2(List<News>newsList){ this.newsList =newsList; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.item_layout,parent,false); final ViewHolder holder=new ViewHolder(view); holder.view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { int position=holder.getAdapterPosition(); News news= newsList.get(position); Intent intent=new Intent(view.getContext(),Main2Activity.class); String Url=news.getUrl(); intent.putExtra("url",Url); view.getContext().startActivity(intent); } }); return holder; } @Override public void onBindViewHolder(ViewHolder holder, int position) { News news = newsList.get(position); String url=news.getUrl(); Context context=holder.newsImage.getContext(); Glide.with(context).load(url).into(holder.newsImage); holder.newsTitle.setText(news.getname()); holder.newsData.setText(news.getData()); } @Override public int getItemCount() { return newsList.size(); } public class ViewHolder extends RecyclerView.ViewHolder { View view; TextView newsTitle; TextView newsData; ImageView newsImage; public ViewHolder(View itemView) { super(itemView); view=itemView; newsTitle=itemView.findViewById(R.id.name); newsData=itemView.findViewById(R.id.data); newsImage=itemView.findViewById(R.id.pic); } } }
UTF-8
Java
2,393
java
Adapter2.java
Java
[ { "context": "package com.example.yrj.gaoxiaobang1;\n\nimport android.content.Context;\nim", "end": 23, "score": 0.7225844860076904, "start": 22, "tag": "USERNAME", "value": "j" }, { "context": "icasso;\n\nimport java.util.List;\n\n/**\n * Created by YRJ on 2018/3/7.\n */\n\npublic c...
null
[]
package com.example.yrj.gaoxiaobang1; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.squareup.picasso.Picasso; import java.util.List; /** * Created by YRJ on 2018/3/7. */ public class Adapter2 extends RecyclerView.Adapter<Adapter2.ViewHolder> { private List<News> newsList; public Adapter2(List<News>newsList){ this.newsList =newsList; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.item_layout,parent,false); final ViewHolder holder=new ViewHolder(view); holder.view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { int position=holder.getAdapterPosition(); News news= newsList.get(position); Intent intent=new Intent(view.getContext(),Main2Activity.class); String Url=news.getUrl(); intent.putExtra("url",Url); view.getContext().startActivity(intent); } }); return holder; } @Override public void onBindViewHolder(ViewHolder holder, int position) { News news = newsList.get(position); String url=news.getUrl(); Context context=holder.newsImage.getContext(); Glide.with(context).load(url).into(holder.newsImage); holder.newsTitle.setText(news.getname()); holder.newsData.setText(news.getData()); } @Override public int getItemCount() { return newsList.size(); } public class ViewHolder extends RecyclerView.ViewHolder { View view; TextView newsTitle; TextView newsData; ImageView newsImage; public ViewHolder(View itemView) { super(itemView); view=itemView; newsTitle=itemView.findViewById(R.id.name); newsData=itemView.findViewById(R.id.data); newsImage=itemView.findViewById(R.id.pic); } } }
2,393
0.644379
0.639365
70
33.185715
22.906202
103
false
false
0
0
0
0
0
0
0.671429
false
false
13
2c1ef21cf02cdf4ffb5bb61ad73af795533e1558
21,105,469,321,716
254841db398300c4e22c09701a773297300fa6b6
/src/com/javarush/test/level08/lesson11/home05/Solution.java
d84b5ab75d18a8108aa56564976edef70fd2cb09
[]
no_license
quazrchk/JR_homework
https://github.com/quazrchk/JR_homework
2b947fee664ec606f3d5fdfd2b4fd834ee79d85a
a6ab9f9e6b9c49cebefff0a5dcfcd5df72de4b2c
refs/heads/master
2015-08-24T14:25:07.764000
2015-08-24T09:31:51
2015-08-24T09:31:51
35,763,206
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.javarush.test.level08.lesson11.home05; import com.sun.org.apache.xpath.internal.SourceTree; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; /* Мама Мыла Раму. Теперь с большой буквы Написать программу, которая вводит с клавиатуры строку текста. Программа заменяет в тексте первые буквы всех слов на заглавные. Вывести результат на экран. Пример ввода: мама мыла раму. Пример вывода: Мама Мыла Раму. */ public class Solution { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String s = reader.readLine(); char[] chars=s.toCharArray(); chars[0]= Character.toUpperCase(chars[0]); for (int i=0;i<chars.length;i++) { Character c = chars[i]; if (c.equals(' ') && (i+1)<chars.length) { Character cnext=chars[i+1]; chars[i+1]=Character.toUpperCase(cnext); } } String s2= Arrays.toString(chars); //Напишите тут ваш код for (Character c:chars) { System.out.print(c); } } }
UTF-8
Java
1,493
java
Solution.java
Java
[ { "context": " java.util.ArrayList;\nimport java.util.Arrays;\n\n/* Мама Мыла Раму. Теперь с большой буквы\nНаписать програ", "end": 260, "score": 0.9997218251228333, "start": 256, "tag": "NAME", "value": "Мама" }, { "context": ".util.ArrayList;\nimport java.util.Arrays;\n\n/* Мама М...
null
[]
package com.javarush.test.level08.lesson11.home05; import com.sun.org.apache.xpath.internal.SourceTree; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; /* Мама <NAME>. Теперь с большой буквы Написать программу, которая вводит с клавиатуры строку текста. Программа заменяет в тексте первые буквы всех слов на заглавные. Вывести результат на экран. Пример ввода: мама мыла раму. Пример вывода: Мама <NAME>. */ public class Solution { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String s = reader.readLine(); char[] chars=s.toCharArray(); chars[0]= Character.toUpperCase(chars[0]); for (int i=0;i<chars.length;i++) { Character c = chars[i]; if (c.equals(' ') && (i+1)<chars.length) { Character cnext=chars[i+1]; chars[i+1]=Character.toUpperCase(cnext); } } String s2= Arrays.toString(chars); //Напишите тут ваш код for (Character c:chars) { System.out.print(c); } } }
1,471
0.638801
0.628549
49
24.87755
21.183004
85
false
false
0
0
0
0
0
0
0.387755
false
false
13
1e7ef4bd5d1ecbfcf747c9e8d3cc8f3fc5e94d46
14,697,378,110,573
99d0c85a10ad952f0a23f1a447d93dd0a541d378
/src/main/java/liqp/TemplateParser.java
b2222460f24db3799f4a531a205ced17e1aed432
[ "MIT" ]
permissive
bkiers/Liqp
https://github.com/bkiers/Liqp
4e72b20d533a79690a61c4e7710a4b617238d347
af65618808cf686770ec2ddd7bfbed55dabf537e
refs/heads/master
2023-08-24T12:39:29.763000
2023-08-02T02:04:35
2023-08-02T02:04:35
3,564,692
135
99
MIT
false
2023-08-04T00:41:14
2012-02-27T20:57:32
2023-08-01T03:46:37
2023-08-04T00:41:14
10,630
151
86
9
Java
false
false
package liqp; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.time.ZoneId; import java.util.*; import java.util.function.Consumer; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import liqp.filters.Filter; import liqp.filters.Filters; import liqp.parser.LiquidSupport; import org.antlr.v4.runtime.CharStreams; import liqp.parser.Flavor; /** * The new main entrance point of this library. */ public class TemplateParser { public static final Locale DEFAULT_LOCALE = Locale.ENGLISH; public static final Flavor DEFAULT_FLAVOR = Flavor.LIQP; /** * Returns a {@link TemplateParser} configured with all default settings for "Liqp" flavor. */ public static final TemplateParser DEFAULT = DEFAULT_FLAVOR.defaultParser(); public static final TemplateParser DEFAULT_JEKYLL = Flavor.JEKYLL.defaultParser(); /** * Equivalent of * <code> * Liquid::Template.error_mode = :strict # Raises a SyntaxError when invalid syntax is used * Liquid::Template.error_mode = :warn # Adds strict errors to template.errors but continues as normal * Liquid::Template.error_mode = :lax # The default mode, accepts almost anything. * </code> * where usage is like: * <code> * template = Liquid::Template.parse('', error_mode: :warn ) * </code> */ public enum ErrorMode { STRICT, WARN, LAX } public final Flavor flavor; public final boolean stripSpacesAroundTags; public final boolean stripSingleLine; public final ObjectMapper mapper; public final Insertions insertions; public final Filters filters; public final boolean evaluateInOutputTag; public final TemplateParser.ErrorMode errorMode; public final boolean liquidStyleInclude; public final boolean liquidStyleWhere; /** * The same as <code>template.render!({}, strict_variables: true)</code> in ruby */ public final boolean strictVariables; /** * This field doesn't have equivalent in ruby. */ public final boolean showExceptionsFromInclude; public final TemplateParser.EvaluateMode evaluateMode; public final Locale locale; public final ZoneId defaultTimeZone; private final RenderTransformer renderTransformer; private final Consumer<Map<String, Object>> environmentMapConfigurator; private final String snippetsFolderName; private final int limitMaxIterations; private final int limitMaxSizeRenderedString; private final long limitMaxRenderTimeMillis; private final long limitMaxTemplateSizeBytes; public enum EvaluateMode { LAZY, EAGER } /** * If template context is not available yet - it's ok to create new. * This function don't need access to local context variables, * as it operates with parameters. */ public Map<String, Object> evaluate(final ObjectMapper mapper, Map<String, Object> variables) { if (evaluateMode == TemplateParser.EvaluateMode.EAGER) { return LiquidSupport.LiquidSupportFromInspectable.objectToMap(mapper, variables); } return variables; } /** * If template context is not available yet - it's ok to create new. * This function don't need access to local context variables, * as it operates with parameters. */ public LiquidSupport evaluate(final Object variable) { return evaluate(mapper, variable); } static LiquidSupport evaluate(ObjectMapper mapper, final Object variable) { if (variable instanceof LiquidSupport) { return ((LiquidSupport) variable); } return new LiquidSupport.LiquidSupportFromInspectable(mapper, variable); } public static class Builder { private Flavor flavor; private boolean stripSpacesAroundTags = false; private boolean stripSingleLine; private ObjectMapper mapper; private List<Insertion> insertions = new ArrayList<>(); private List<Filter> filters = new ArrayList<>(); private Boolean evaluateInOutputTag; private TemplateParser.ErrorMode errorMode; private Boolean liquidStyleInclude; private Boolean liquidStyleWhere; private boolean strictVariables = false; private boolean showExceptionsFromInclude; private EvaluateMode evaluateMode = EvaluateMode.LAZY; private Locale locale = DEFAULT_LOCALE; private ZoneId defaultTimeZone; private RenderTransformer renderTransformer; private Consumer<Map<String, Object>> environmentMapConfigurator; private String snippetsFolderName; private Integer limitMaxIterations = Integer.MAX_VALUE; private Integer limitMaxSizeRenderedString = Integer.MAX_VALUE; private Long limitMaxRenderTimeMillis = Long.MAX_VALUE; private Long limitMaxTemplateSizeBytes = Long.MAX_VALUE; public Builder() { } public Builder(TemplateParser parser) { this.flavor = parser.flavor; this.stripSpacesAroundTags = parser.stripSpacesAroundTags; this.stripSingleLine = parser.stripSingleLine; this.mapper = parser.mapper; this.insertions = new ArrayList<>(parser.insertions.values()); this.filters = new ArrayList<>(parser.filters.values()); this.strictVariables = parser.strictVariables; this.evaluateMode = parser.evaluateMode; this.locale = parser.locale; this.renderTransformer = parser.renderTransformer; this.environmentMapConfigurator = parser.environmentMapConfigurator; this.showExceptionsFromInclude = parser.showExceptionsFromInclude; this.limitMaxIterations = parser.limitMaxIterations; this.limitMaxSizeRenderedString = parser.limitMaxSizeRenderedString; this.limitMaxRenderTimeMillis = parser.limitMaxRenderTimeMillis; this.limitMaxTemplateSizeBytes = parser.limitMaxTemplateSizeBytes; this.evaluateInOutputTag = parser.evaluateInOutputTag; this.liquidStyleInclude = parser.liquidStyleInclude; this.liquidStyleWhere = parser.liquidStyleWhere; this.errorMode = parser.errorMode; } public Builder withFlavor(Flavor flavor) { this.flavor = flavor; return this; } public Builder withStripSpaceAroundTags(boolean stripSpacesAroundTags, boolean stripSingleLine) { if (stripSingleLine && !stripSpacesAroundTags) { throw new IllegalStateException( "stripSpacesAroundTags must be true if stripSingleLine is true"); } this.stripSpacesAroundTags = stripSpacesAroundTags; this.stripSingleLine = stripSingleLine; return this; } public Builder withStripSpaceAroundTags(boolean stripSpacesAroundTags) { return this.withStripSpaceAroundTags(stripSpacesAroundTags, false); } public Builder withStripSingleLine(boolean stripSingleLine) { this.stripSingleLine = stripSingleLine; return this; } public Builder withObjectMapper(ObjectMapper mapper) { this.mapper = mapper; return this; } public Builder withInsertion(Insertion insertion) { this.insertions.add(insertion); return this; } public Builder withFilter(Filter filter) { this.filters.add(filter); return this; } public Builder withEvaluateInOutputTag(boolean evaluateInOutputTag) { this.evaluateInOutputTag = evaluateInOutputTag; return this; } public Builder withLiquidStyleInclude(boolean liquidStyleInclude) { this.liquidStyleInclude = liquidStyleInclude; return this; } public Builder withStrictVariables(boolean strictVariables) { this.strictVariables = strictVariables; return this; } public Builder withShowExceptionsFromInclude(boolean showExceptionsFromInclude) { this.showExceptionsFromInclude = showExceptionsFromInclude; return this; } public Builder withEvaluateMode(TemplateParser.EvaluateMode evaluateMode) { this.evaluateMode = evaluateMode; return this; } /** * Sets the {@link RenderTransformer}. * * @param renderTransformer The transformer, or {@code null} to use the default. * @return This builder. */ public Builder withRenderTransformer(RenderTransformer renderTransformer) { this.renderTransformer = renderTransformer; return this; } public Builder withLocale(Locale locale){ Objects.requireNonNull(locale); this.locale = locale; return this; } /** * Set default timezone for showing timezone of date/time types * that does not have own timezone information. * May be null, so the timezone pattern will be omitted in formatted strings. * @param defaultTimeZone - value or <code>null<code/> * @return this builder */ public Builder withDefaultTimeZone(ZoneId defaultTimeZone) { this.defaultTimeZone = defaultTimeZone; return this; } /** * Sets the configurator of the {@link TemplateContext}'s environment map * ({@link TemplateContext#getEnvironmentMap()}) instance. * * The configurator is called upon the creation of a new root context. Typically, this allows the * addition of certain parameters to the context environment. * * @param configurator The configurator, or {@code null}. * @return This builder. */ public Builder withEnvironmentMapConfigurator(Consumer<Map<String, Object>> configurator) { this.environmentMapConfigurator = configurator; return this; } public Builder withSnippetsFolderName(String snippetsFolderName) { this.snippetsFolderName = snippetsFolderName; return this; } public Builder withMaxIterations(int maxIterations) { this.limitMaxIterations = maxIterations; return this; } public Builder withMaxSizeRenderedString(int maxSizeRenderedString) { this.limitMaxSizeRenderedString = maxSizeRenderedString; return this; } public Builder withMaxRenderTimeMillis(long maxRenderTimeMillis) { this.limitMaxRenderTimeMillis = maxRenderTimeMillis; return this; } public Builder withMaxTemplateSizeBytes(long maxTemplateSizeBytes) { this.limitMaxTemplateSizeBytes = maxTemplateSizeBytes; return this; } @SuppressWarnings("hiding") public Builder withErrorMode(ErrorMode errorMode) { this.errorMode = errorMode; return this; } public TemplateParser build() { Flavor fl = this.flavor; if (fl == null) { fl = DEFAULT_FLAVOR; } Boolean evaluateInOutputTag = this.evaluateInOutputTag; if (evaluateInOutputTag == null) { evaluateInOutputTag = fl.isEvaluateInOutputTag(); } Boolean liquidStyleInclude = this.liquidStyleInclude; if (liquidStyleInclude == null) { liquidStyleInclude = fl.isLiquidStyleInclude(); } Boolean liquidStyleWhere = this.liquidStyleWhere; if (liquidStyleWhere == null) { liquidStyleWhere = fl.isLiquidStyleWhere(); } ErrorMode errorMode = this.errorMode; if (errorMode == null) { errorMode = fl.getErrorMode(); } if (mapper == null) { mapper = new ObjectMapper(); mapper.registerModule(new JavaTimeModule()); mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); } if (this.defaultTimeZone == null) { this.defaultTimeZone = ZoneId.systemDefault(); } Insertions allInsertions = fl.getInsertions().mergeWith(Insertions.of(this.insertions)); Filters finalFilters = fl.getFilters().mergeWith(filters); if (snippetsFolderName == null) { snippetsFolderName = fl.snippetsFolderName; } return new TemplateParser(strictVariables, showExceptionsFromInclude, evaluateMode, renderTransformer, locale, defaultTimeZone, environmentMapConfigurator, errorMode, fl, stripSpacesAroundTags, stripSingleLine, mapper, allInsertions, finalFilters, snippetsFolderName, evaluateInOutputTag, liquidStyleInclude, liquidStyleWhere, limitMaxIterations, limitMaxSizeRenderedString, limitMaxRenderTimeMillis, limitMaxTemplateSizeBytes); } } TemplateParser(boolean strictVariables, boolean showExceptionsFromInclude, EvaluateMode evaluateMode, RenderTransformer renderTransformer, Locale locale, ZoneId defaultTimeZone, Consumer<Map<String, Object>> environmentMapConfigurator, ErrorMode errorMode, Flavor flavor, boolean stripSpacesAroundTags, boolean stripSingleLine, ObjectMapper mapper, Insertions insertions, Filters filters, String snippetsFolderName, boolean evaluateInOutputTag, boolean liquidStyleInclude, Boolean liquidStyleWhere, int maxIterations, int maxSizeRenderedString, long maxRenderTimeMillis, long maxTemplateSizeBytes) { this.flavor = flavor; this.stripSpacesAroundTags = stripSpacesAroundTags; this.stripSingleLine = stripSingleLine; this.mapper = mapper; this.insertions = insertions; this.filters = filters; this.evaluateInOutputTag = evaluateInOutputTag; this.errorMode = errorMode; this.liquidStyleInclude = liquidStyleInclude; this.liquidStyleWhere = liquidStyleWhere; this.strictVariables = strictVariables; this.showExceptionsFromInclude = showExceptionsFromInclude; this.evaluateMode = evaluateMode; this.renderTransformer = renderTransformer == null ? RenderTransformerDefaultImpl.INSTANCE : renderTransformer; this.locale = locale; this.defaultTimeZone = defaultTimeZone; this.environmentMapConfigurator = environmentMapConfigurator; this.snippetsFolderName = snippetsFolderName; this.limitMaxIterations = maxIterations; this.limitMaxSizeRenderedString = maxSizeRenderedString; this.limitMaxRenderTimeMillis = maxRenderTimeMillis; this.limitMaxTemplateSizeBytes = maxTemplateSizeBytes; } public Template parse(File file) throws IOException { return new Template(this, CharStreams.fromPath(file.toPath())); } public Template parse(String input) { return new Template(this, CharStreams.fromString(input)); } public Template parse(InputStream input) throws IOException { return new Template(this, CharStreams.fromStream(input)); } public Template parse(Reader reader) throws IOException { return new Template(this, CharStreams.fromReader(reader)); } public int getLimitMaxIterations() { return limitMaxIterations; } public int getLimitMaxSizeRenderedString() { return limitMaxSizeRenderedString; } public long getLimitMaxRenderTimeMillis() { return limitMaxRenderTimeMillis; } public long getLimitMaxTemplateSizeBytes() { return limitMaxTemplateSizeBytes; } public Boolean isRenderTimeLimited() { return limitMaxRenderTimeMillis != Long.MAX_VALUE; } public ErrorMode getErrorMode() { return errorMode; } public boolean isStripSingleLine() { return stripSingleLine; } public boolean isStripSpacesAroundTags() { return stripSpacesAroundTags; } public ObjectMapper getMapper() { return mapper; } public RenderTransformer getRenderTransformer() { return renderTransformer; } public Consumer<Map<String, Object>> getEnvironmentMapConfigurator() { return environmentMapConfigurator; } public String getSnippetsFolderName() { return snippetsFolderName; } }
UTF-8
Java
16,891
java
TemplateParser.java
Java
[]
null
[]
package liqp; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.time.ZoneId; import java.util.*; import java.util.function.Consumer; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import liqp.filters.Filter; import liqp.filters.Filters; import liqp.parser.LiquidSupport; import org.antlr.v4.runtime.CharStreams; import liqp.parser.Flavor; /** * The new main entrance point of this library. */ public class TemplateParser { public static final Locale DEFAULT_LOCALE = Locale.ENGLISH; public static final Flavor DEFAULT_FLAVOR = Flavor.LIQP; /** * Returns a {@link TemplateParser} configured with all default settings for "Liqp" flavor. */ public static final TemplateParser DEFAULT = DEFAULT_FLAVOR.defaultParser(); public static final TemplateParser DEFAULT_JEKYLL = Flavor.JEKYLL.defaultParser(); /** * Equivalent of * <code> * Liquid::Template.error_mode = :strict # Raises a SyntaxError when invalid syntax is used * Liquid::Template.error_mode = :warn # Adds strict errors to template.errors but continues as normal * Liquid::Template.error_mode = :lax # The default mode, accepts almost anything. * </code> * where usage is like: * <code> * template = Liquid::Template.parse('', error_mode: :warn ) * </code> */ public enum ErrorMode { STRICT, WARN, LAX } public final Flavor flavor; public final boolean stripSpacesAroundTags; public final boolean stripSingleLine; public final ObjectMapper mapper; public final Insertions insertions; public final Filters filters; public final boolean evaluateInOutputTag; public final TemplateParser.ErrorMode errorMode; public final boolean liquidStyleInclude; public final boolean liquidStyleWhere; /** * The same as <code>template.render!({}, strict_variables: true)</code> in ruby */ public final boolean strictVariables; /** * This field doesn't have equivalent in ruby. */ public final boolean showExceptionsFromInclude; public final TemplateParser.EvaluateMode evaluateMode; public final Locale locale; public final ZoneId defaultTimeZone; private final RenderTransformer renderTransformer; private final Consumer<Map<String, Object>> environmentMapConfigurator; private final String snippetsFolderName; private final int limitMaxIterations; private final int limitMaxSizeRenderedString; private final long limitMaxRenderTimeMillis; private final long limitMaxTemplateSizeBytes; public enum EvaluateMode { LAZY, EAGER } /** * If template context is not available yet - it's ok to create new. * This function don't need access to local context variables, * as it operates with parameters. */ public Map<String, Object> evaluate(final ObjectMapper mapper, Map<String, Object> variables) { if (evaluateMode == TemplateParser.EvaluateMode.EAGER) { return LiquidSupport.LiquidSupportFromInspectable.objectToMap(mapper, variables); } return variables; } /** * If template context is not available yet - it's ok to create new. * This function don't need access to local context variables, * as it operates with parameters. */ public LiquidSupport evaluate(final Object variable) { return evaluate(mapper, variable); } static LiquidSupport evaluate(ObjectMapper mapper, final Object variable) { if (variable instanceof LiquidSupport) { return ((LiquidSupport) variable); } return new LiquidSupport.LiquidSupportFromInspectable(mapper, variable); } public static class Builder { private Flavor flavor; private boolean stripSpacesAroundTags = false; private boolean stripSingleLine; private ObjectMapper mapper; private List<Insertion> insertions = new ArrayList<>(); private List<Filter> filters = new ArrayList<>(); private Boolean evaluateInOutputTag; private TemplateParser.ErrorMode errorMode; private Boolean liquidStyleInclude; private Boolean liquidStyleWhere; private boolean strictVariables = false; private boolean showExceptionsFromInclude; private EvaluateMode evaluateMode = EvaluateMode.LAZY; private Locale locale = DEFAULT_LOCALE; private ZoneId defaultTimeZone; private RenderTransformer renderTransformer; private Consumer<Map<String, Object>> environmentMapConfigurator; private String snippetsFolderName; private Integer limitMaxIterations = Integer.MAX_VALUE; private Integer limitMaxSizeRenderedString = Integer.MAX_VALUE; private Long limitMaxRenderTimeMillis = Long.MAX_VALUE; private Long limitMaxTemplateSizeBytes = Long.MAX_VALUE; public Builder() { } public Builder(TemplateParser parser) { this.flavor = parser.flavor; this.stripSpacesAroundTags = parser.stripSpacesAroundTags; this.stripSingleLine = parser.stripSingleLine; this.mapper = parser.mapper; this.insertions = new ArrayList<>(parser.insertions.values()); this.filters = new ArrayList<>(parser.filters.values()); this.strictVariables = parser.strictVariables; this.evaluateMode = parser.evaluateMode; this.locale = parser.locale; this.renderTransformer = parser.renderTransformer; this.environmentMapConfigurator = parser.environmentMapConfigurator; this.showExceptionsFromInclude = parser.showExceptionsFromInclude; this.limitMaxIterations = parser.limitMaxIterations; this.limitMaxSizeRenderedString = parser.limitMaxSizeRenderedString; this.limitMaxRenderTimeMillis = parser.limitMaxRenderTimeMillis; this.limitMaxTemplateSizeBytes = parser.limitMaxTemplateSizeBytes; this.evaluateInOutputTag = parser.evaluateInOutputTag; this.liquidStyleInclude = parser.liquidStyleInclude; this.liquidStyleWhere = parser.liquidStyleWhere; this.errorMode = parser.errorMode; } public Builder withFlavor(Flavor flavor) { this.flavor = flavor; return this; } public Builder withStripSpaceAroundTags(boolean stripSpacesAroundTags, boolean stripSingleLine) { if (stripSingleLine && !stripSpacesAroundTags) { throw new IllegalStateException( "stripSpacesAroundTags must be true if stripSingleLine is true"); } this.stripSpacesAroundTags = stripSpacesAroundTags; this.stripSingleLine = stripSingleLine; return this; } public Builder withStripSpaceAroundTags(boolean stripSpacesAroundTags) { return this.withStripSpaceAroundTags(stripSpacesAroundTags, false); } public Builder withStripSingleLine(boolean stripSingleLine) { this.stripSingleLine = stripSingleLine; return this; } public Builder withObjectMapper(ObjectMapper mapper) { this.mapper = mapper; return this; } public Builder withInsertion(Insertion insertion) { this.insertions.add(insertion); return this; } public Builder withFilter(Filter filter) { this.filters.add(filter); return this; } public Builder withEvaluateInOutputTag(boolean evaluateInOutputTag) { this.evaluateInOutputTag = evaluateInOutputTag; return this; } public Builder withLiquidStyleInclude(boolean liquidStyleInclude) { this.liquidStyleInclude = liquidStyleInclude; return this; } public Builder withStrictVariables(boolean strictVariables) { this.strictVariables = strictVariables; return this; } public Builder withShowExceptionsFromInclude(boolean showExceptionsFromInclude) { this.showExceptionsFromInclude = showExceptionsFromInclude; return this; } public Builder withEvaluateMode(TemplateParser.EvaluateMode evaluateMode) { this.evaluateMode = evaluateMode; return this; } /** * Sets the {@link RenderTransformer}. * * @param renderTransformer The transformer, or {@code null} to use the default. * @return This builder. */ public Builder withRenderTransformer(RenderTransformer renderTransformer) { this.renderTransformer = renderTransformer; return this; } public Builder withLocale(Locale locale){ Objects.requireNonNull(locale); this.locale = locale; return this; } /** * Set default timezone for showing timezone of date/time types * that does not have own timezone information. * May be null, so the timezone pattern will be omitted in formatted strings. * @param defaultTimeZone - value or <code>null<code/> * @return this builder */ public Builder withDefaultTimeZone(ZoneId defaultTimeZone) { this.defaultTimeZone = defaultTimeZone; return this; } /** * Sets the configurator of the {@link TemplateContext}'s environment map * ({@link TemplateContext#getEnvironmentMap()}) instance. * * The configurator is called upon the creation of a new root context. Typically, this allows the * addition of certain parameters to the context environment. * * @param configurator The configurator, or {@code null}. * @return This builder. */ public Builder withEnvironmentMapConfigurator(Consumer<Map<String, Object>> configurator) { this.environmentMapConfigurator = configurator; return this; } public Builder withSnippetsFolderName(String snippetsFolderName) { this.snippetsFolderName = snippetsFolderName; return this; } public Builder withMaxIterations(int maxIterations) { this.limitMaxIterations = maxIterations; return this; } public Builder withMaxSizeRenderedString(int maxSizeRenderedString) { this.limitMaxSizeRenderedString = maxSizeRenderedString; return this; } public Builder withMaxRenderTimeMillis(long maxRenderTimeMillis) { this.limitMaxRenderTimeMillis = maxRenderTimeMillis; return this; } public Builder withMaxTemplateSizeBytes(long maxTemplateSizeBytes) { this.limitMaxTemplateSizeBytes = maxTemplateSizeBytes; return this; } @SuppressWarnings("hiding") public Builder withErrorMode(ErrorMode errorMode) { this.errorMode = errorMode; return this; } public TemplateParser build() { Flavor fl = this.flavor; if (fl == null) { fl = DEFAULT_FLAVOR; } Boolean evaluateInOutputTag = this.evaluateInOutputTag; if (evaluateInOutputTag == null) { evaluateInOutputTag = fl.isEvaluateInOutputTag(); } Boolean liquidStyleInclude = this.liquidStyleInclude; if (liquidStyleInclude == null) { liquidStyleInclude = fl.isLiquidStyleInclude(); } Boolean liquidStyleWhere = this.liquidStyleWhere; if (liquidStyleWhere == null) { liquidStyleWhere = fl.isLiquidStyleWhere(); } ErrorMode errorMode = this.errorMode; if (errorMode == null) { errorMode = fl.getErrorMode(); } if (mapper == null) { mapper = new ObjectMapper(); mapper.registerModule(new JavaTimeModule()); mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); } if (this.defaultTimeZone == null) { this.defaultTimeZone = ZoneId.systemDefault(); } Insertions allInsertions = fl.getInsertions().mergeWith(Insertions.of(this.insertions)); Filters finalFilters = fl.getFilters().mergeWith(filters); if (snippetsFolderName == null) { snippetsFolderName = fl.snippetsFolderName; } return new TemplateParser(strictVariables, showExceptionsFromInclude, evaluateMode, renderTransformer, locale, defaultTimeZone, environmentMapConfigurator, errorMode, fl, stripSpacesAroundTags, stripSingleLine, mapper, allInsertions, finalFilters, snippetsFolderName, evaluateInOutputTag, liquidStyleInclude, liquidStyleWhere, limitMaxIterations, limitMaxSizeRenderedString, limitMaxRenderTimeMillis, limitMaxTemplateSizeBytes); } } TemplateParser(boolean strictVariables, boolean showExceptionsFromInclude, EvaluateMode evaluateMode, RenderTransformer renderTransformer, Locale locale, ZoneId defaultTimeZone, Consumer<Map<String, Object>> environmentMapConfigurator, ErrorMode errorMode, Flavor flavor, boolean stripSpacesAroundTags, boolean stripSingleLine, ObjectMapper mapper, Insertions insertions, Filters filters, String snippetsFolderName, boolean evaluateInOutputTag, boolean liquidStyleInclude, Boolean liquidStyleWhere, int maxIterations, int maxSizeRenderedString, long maxRenderTimeMillis, long maxTemplateSizeBytes) { this.flavor = flavor; this.stripSpacesAroundTags = stripSpacesAroundTags; this.stripSingleLine = stripSingleLine; this.mapper = mapper; this.insertions = insertions; this.filters = filters; this.evaluateInOutputTag = evaluateInOutputTag; this.errorMode = errorMode; this.liquidStyleInclude = liquidStyleInclude; this.liquidStyleWhere = liquidStyleWhere; this.strictVariables = strictVariables; this.showExceptionsFromInclude = showExceptionsFromInclude; this.evaluateMode = evaluateMode; this.renderTransformer = renderTransformer == null ? RenderTransformerDefaultImpl.INSTANCE : renderTransformer; this.locale = locale; this.defaultTimeZone = defaultTimeZone; this.environmentMapConfigurator = environmentMapConfigurator; this.snippetsFolderName = snippetsFolderName; this.limitMaxIterations = maxIterations; this.limitMaxSizeRenderedString = maxSizeRenderedString; this.limitMaxRenderTimeMillis = maxRenderTimeMillis; this.limitMaxTemplateSizeBytes = maxTemplateSizeBytes; } public Template parse(File file) throws IOException { return new Template(this, CharStreams.fromPath(file.toPath())); } public Template parse(String input) { return new Template(this, CharStreams.fromString(input)); } public Template parse(InputStream input) throws IOException { return new Template(this, CharStreams.fromStream(input)); } public Template parse(Reader reader) throws IOException { return new Template(this, CharStreams.fromReader(reader)); } public int getLimitMaxIterations() { return limitMaxIterations; } public int getLimitMaxSizeRenderedString() { return limitMaxSizeRenderedString; } public long getLimitMaxRenderTimeMillis() { return limitMaxRenderTimeMillis; } public long getLimitMaxTemplateSizeBytes() { return limitMaxTemplateSizeBytes; } public Boolean isRenderTimeLimited() { return limitMaxRenderTimeMillis != Long.MAX_VALUE; } public ErrorMode getErrorMode() { return errorMode; } public boolean isStripSingleLine() { return stripSingleLine; } public boolean isStripSpacesAroundTags() { return stripSpacesAroundTags; } public ObjectMapper getMapper() { return mapper; } public RenderTransformer getRenderTransformer() { return renderTransformer; } public Consumer<Map<String, Object>> getEnvironmentMapConfigurator() { return environmentMapConfigurator; } public String getSnippetsFolderName() { return snippetsFolderName; } }
16,891
0.668107
0.66787
467
35.169167
33.484814
290
false
false
0
0
0
0
0
0
0.56531
false
false
13
c2bbbf33468bef16d1231e43214f7e5df7f77276
18,537,078,877,011
f488cb8b27a5a94262df3a9a83a0be90daea1146
/projJava/src/View/IView.java
193f39ab42dac1b8e39b76d295f1d7f1871316f9
[ "MIT" ]
permissive
sw33zy/LI3-SGV
https://github.com/sw33zy/LI3-SGV
d95230082b0c10ef9fbac26d94e9ab83b48e46e2
5c94186b7a7afbc0fb93594df85f781c7c9f2f1e
refs/heads/main
2023-02-26T09:47:40.816000
2021-02-01T14:04:40
2021-02-01T14:04:40
334,964,992
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package View; import java.util.List; import java.util.Map; public interface IView { void menu (); void promptEnterKey(); int getInt(String message); String getInputString(String message); boolean mesValido(int mes); boolean filialValido(int filial); boolean opcaoValido(int op); boolean limiteValido(int op); void show_q0(int x, String time); void show_q1(List<String> l, String time); void show_q2(Map.Entry<Integer, Integer> sales, int mes, int filial, String time); void show_q3(List<Map.Entry<Integer, Map.Entry<Integer, Double>>> res, String client, String time); void show_q4(List<Map.Entry<Integer, Map.Entry<Integer, Double>>> res, String product, String time); void show_q5(List<Map.Entry<String,Integer>> ft, String time); void show_q6(List<Map.Entry<Map.Entry<String,Integer>,Integer>> ft, String time); void show_q7(List<Map.Entry<String,Double>> values, String time); void show_q8(List<Map.Entry<String, Integer>> l, String time); void show_q9(List<Map.Entry<String, Map.Entry<Integer, Double>>> l, String time); void show_q10(List<Map.Entry<String, List<Double>>> l, String time); void show_q11(Map.Entry<String,Map.Entry<List<Integer>,Double>> l , String time); void show_q12(Map.Entry<Map<Integer, Integer>, Map.Entry<List<Map<Integer,Double>>,List<Map<Integer,Integer>>>> l, String time); void show_save(String file); void show_load(String file); void show_q15(); void navegador (List<String> l, int nrEntries, String message); void showInvalidClientException(); void showInvalidProductException(); void showNoFileException(); }
UTF-8
Java
1,661
java
IView.java
Java
[]
null
[]
package View; import java.util.List; import java.util.Map; public interface IView { void menu (); void promptEnterKey(); int getInt(String message); String getInputString(String message); boolean mesValido(int mes); boolean filialValido(int filial); boolean opcaoValido(int op); boolean limiteValido(int op); void show_q0(int x, String time); void show_q1(List<String> l, String time); void show_q2(Map.Entry<Integer, Integer> sales, int mes, int filial, String time); void show_q3(List<Map.Entry<Integer, Map.Entry<Integer, Double>>> res, String client, String time); void show_q4(List<Map.Entry<Integer, Map.Entry<Integer, Double>>> res, String product, String time); void show_q5(List<Map.Entry<String,Integer>> ft, String time); void show_q6(List<Map.Entry<Map.Entry<String,Integer>,Integer>> ft, String time); void show_q7(List<Map.Entry<String,Double>> values, String time); void show_q8(List<Map.Entry<String, Integer>> l, String time); void show_q9(List<Map.Entry<String, Map.Entry<Integer, Double>>> l, String time); void show_q10(List<Map.Entry<String, List<Double>>> l, String time); void show_q11(Map.Entry<String,Map.Entry<List<Integer>,Double>> l , String time); void show_q12(Map.Entry<Map<Integer, Integer>, Map.Entry<List<Map<Integer,Double>>,List<Map<Integer,Integer>>>> l, String time); void show_save(String file); void show_load(String file); void show_q15(); void navegador (List<String> l, int nrEntries, String message); void showInvalidClientException(); void showInvalidProductException(); void showNoFileException(); }
1,661
0.705599
0.694762
35
46.457142
31.724117
132
false
false
0
0
0
0
0
0
2
false
false
13
4b1113574c61ad5ba7adaad2e31ebebf984b03a6
11,467,562,738,040
99a6ed94e1ce9faf5bdee52ba7a28a9df5bb77be
/fruit-core/src/main/java/com/fruit/dao/management/PackagebatchDao.java
4e98a414d636b290b2c83f48dcc64e27e1abefcb
[ "Apache-2.0" ]
permissive
tanliu/fruit
https://github.com/tanliu/fruit
3c889210bc518974c14e7cf96773b3527b023a58
3a9ee76699435061fe603781bec041b7de455347
refs/heads/master
2021-05-24T01:49:31.825000
2017-04-11T18:08:56
2017-04-11T18:08:56
82,919,484
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fruit.dao.management; import com.fruit.base.DaoSupport; import com.fruit.entity.management.Packagebatch; /** * * @author CSH * */ public interface PackagebatchDao extends DaoSupport<Packagebatch>{ String DAO_NAME="com.fruit.dao.impl.PackagebatchDaoImpl"; }
UTF-8
Java
280
java
PackagebatchDao.java
Java
[ { "context": "ntity.management.Packagebatch;\n\n/**\n * \n * @author CSH\n *\n */\npublic interface PackagebatchDao extends D", "end": 141, "score": 0.9996061325073242, "start": 138, "tag": "USERNAME", "value": "CSH" } ]
null
[]
package com.fruit.dao.management; import com.fruit.base.DaoSupport; import com.fruit.entity.management.Packagebatch; /** * * @author CSH * */ public interface PackagebatchDao extends DaoSupport<Packagebatch>{ String DAO_NAME="com.fruit.dao.impl.PackagebatchDaoImpl"; }
280
0.760714
0.760714
13
20.538462
23.702045
66
false
false
0
0
0
0
0
0
0.307692
false
false
13
a5861d2a13067b33e12ca40db85f669ab829d3aa
21,775,484,227,083
e1eda686ad8c3c1ad850d35ffaf3bc666873cab3
/app/src/main/java/com/yopaisa/Service/PhoneVerificationService.java
b35ee90955f8d3eb4c53452cefde27d130f93c66
[]
no_license
Rakeshc448/yopaisa
https://github.com/Rakeshc448/yopaisa
b96268d09365e04f6e66354ec8745e680aaae2d1
4df70d314bafb87f6158493ae33072c74936ea69
refs/heads/master
2018-10-25T14:16:36.549000
2018-08-28T08:44:30
2018-08-28T08:44:30
143,720,833
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yopaisa.Service; import com.yopaisa.Model.RestResponse; import retrofit2.Call; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; import retrofit2.http.Field; import retrofit2.http.FormUrlEncoded; import retrofit2.http.POST; /** * Created by rakesh on 8/13/2018. * Project K. */ public class PhoneVerificationService { private static String BASE_URL = "http://oneadd.kabhadi.com/apis/index.php/users/"; public interface OtpVerifyAPI { @POST("varifyOtp") @FormUrlEncoded Call<RestResponse> getResults( @Field("otp") String otpCode, @Field("email") String email ); } public PhoneVerificationService.OtpVerifyAPI getAPI() { Retrofit retrofit = new Retrofit .Builder() .baseUrl(BASE_URL) .addConverterFactory(GsonConverterFactory.create()) .build(); return retrofit.create(PhoneVerificationService.OtpVerifyAPI.class); } }
UTF-8
Java
1,080
java
PhoneVerificationService.java
Java
[ { "context": "ed;\nimport retrofit2.http.POST;\n\n/**\n * Created by rakesh on 8/13/2018.\n * Project K.\n */\n\npublic class Pho", "end": 294, "score": 0.9945802688598633, "start": 288, "tag": "USERNAME", "value": "rakesh" } ]
null
[]
package com.yopaisa.Service; import com.yopaisa.Model.RestResponse; import retrofit2.Call; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; import retrofit2.http.Field; import retrofit2.http.FormUrlEncoded; import retrofit2.http.POST; /** * Created by rakesh on 8/13/2018. * Project K. */ public class PhoneVerificationService { private static String BASE_URL = "http://oneadd.kabhadi.com/apis/index.php/users/"; public interface OtpVerifyAPI { @POST("varifyOtp") @FormUrlEncoded Call<RestResponse> getResults( @Field("otp") String otpCode, @Field("email") String email ); } public PhoneVerificationService.OtpVerifyAPI getAPI() { Retrofit retrofit = new Retrofit .Builder() .baseUrl(BASE_URL) .addConverterFactory(GsonConverterFactory.create()) .build(); return retrofit.create(PhoneVerificationService.OtpVerifyAPI.class); } }
1,080
0.635185
0.623148
37
28.18919
23.85297
87
false
false
0
0
0
0
0
0
0.351351
false
false
13
edfb1118b45bccf574e2962c839ba016e3c087de
27,333,171,894,860
7ea3f0a00c5c0378a6d7eb176e1570c77cc78adc
/src/main/java/com/njits/iot/advert/test/AnalysicDataSource.java
0c400cbe294372e9bd7a6709a5025f4cf9deac5a
[]
no_license
crystallyj/advert
https://github.com/crystallyj/advert
c19c9505a1f623909f3f741f5527df5b98642b63
d6dc868d085c7902196cf662a9d4599c65fd358f
refs/heads/master
2022-07-12T23:28:44.993000
2019-10-15T10:43:13
2019-10-15T10:43:13
215,273,179
0
0
null
false
2022-07-01T21:25:00
2019-10-15T10:40:46
2019-10-15T10:43:26
2022-07-01T21:24:58
69
0
0
6
Java
false
false
package com.njits.iot.advert.test; public interface AnalysicDataSource { void analysicData(String... args); }
UTF-8
Java
120
java
AnalysicDataSource.java
Java
[]
null
[]
package com.njits.iot.advert.test; public interface AnalysicDataSource { void analysicData(String... args); }
120
0.725
0.725
7
16.142857
16.982584
38
false
false
0
0
0
0
0
0
0.285714
false
false
13
77e1872d58a410df8f0498c18764510c78256049
8,589,934,623,409
eca8e3d9d4dd02372bc0926485053d3630cba472
/app/src/main/java/com/groupo/dublinfloristassociation/floristsAZ.java
d00a8c23d902397cd1fbbc4031c5ee9ee32a5458
[]
no_license
LeonMulvaney/DublinFloristAssociation1
https://github.com/LeonMulvaney/DublinFloristAssociation1
444bdafd9c03896dced14680e57e38b11b2eb8ae
d564835bb7fdce4edfc88c0b8a23d5c8fbb4ff5b
refs/heads/master
2020-12-24T11:52:40.185000
2016-11-19T18:20:55
2016-11-19T18:20:55
73,109,985
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.groupo.dublinfloristassociation; import android.content.ContentValues; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import com.groupo.dublinfloristassociation.webViews.tulipWebView; import static android.R.attr.button; public class floristsAZ extends AppCompatActivity { TextView floristDetails; DBhandler myDBHandler; String buttonClick; Button button; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_florists_az); floristDetails = (TextView) findViewById(R.id.floristTV); myDBHandler = new DBhandler(this,null,null,1); // myDBHandler.addFlorist(); //printDatabase(); button = (Button)findViewById(R.id.floristBtn1); button.setOnClickListener(new View.OnClickListener(){ public void onClick(View v){ printFlorist1(); ImageView image = (ImageView)findViewById(R.id.floristIV); image.setImageResource(R.drawable.florist1image); } }); button = (Button)findViewById(R.id.floristBtn2); button.setOnClickListener(new View.OnClickListener(){ public void onClick(View v){ printFlorist2(); ImageView image = (ImageView)findViewById(R.id.floristIV); image.setImageResource(R.drawable.florist2image); } }); button = (Button)findViewById(R.id.floristBtn3); button.setOnClickListener(new View.OnClickListener(){ public void onClick(View v){ printFlorist3(); ImageView image = (ImageView)findViewById(R.id.floristIV); image.setImageResource(R.drawable.florist3image); } }); } //Create the icons in the Action Bar - i.e. Home button for easy navigation public boolean onCreateOptionsMenu(Menu menu){ getMenuInflater().inflate(R.menu.main,menu); return super.onCreateOptionsMenu(menu); } public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()) { case R.id.actionbarhomebtn: Intent intent = new Intent(this, Home.class); this.startActivity(intent); } return true; } public void printFlorist1(){ floristDetails.setText(""); String dbString = myDBHandler.floristToString1(); floristDetails.setText(dbString); } public void printFlorist2(){ floristDetails.setText(""); String dbString = myDBHandler.floristToString2(); floristDetails.setText(dbString); } public void printFlorist3(){ floristDetails.setText(""); String dbString = myDBHandler.floristToString3(); floristDetails.setText(dbString); } //Check to see which button is clicked - the string will be used to select which query should be executed in DBHandler class /* public String button1Clicked(){ buttonClick = "SELECT * FROM " + myDBHandler.AZ_TABLE + " WHERE " + myDBHandler.AZ_ID + "=" + 1; return buttonClick; } public String button2Clicked(){ buttonClick = "SELECT * FROM " + myDBHandler.AZ_TABLE + " WHERE " + myDBHandler.AZ_ID + "=" + 2;; return buttonClick; } */ }
UTF-8
Java
3,736
java
floristsAZ.java
Java
[]
null
[]
package com.groupo.dublinfloristassociation; import android.content.ContentValues; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import com.groupo.dublinfloristassociation.webViews.tulipWebView; import static android.R.attr.button; public class floristsAZ extends AppCompatActivity { TextView floristDetails; DBhandler myDBHandler; String buttonClick; Button button; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_florists_az); floristDetails = (TextView) findViewById(R.id.floristTV); myDBHandler = new DBhandler(this,null,null,1); // myDBHandler.addFlorist(); //printDatabase(); button = (Button)findViewById(R.id.floristBtn1); button.setOnClickListener(new View.OnClickListener(){ public void onClick(View v){ printFlorist1(); ImageView image = (ImageView)findViewById(R.id.floristIV); image.setImageResource(R.drawable.florist1image); } }); button = (Button)findViewById(R.id.floristBtn2); button.setOnClickListener(new View.OnClickListener(){ public void onClick(View v){ printFlorist2(); ImageView image = (ImageView)findViewById(R.id.floristIV); image.setImageResource(R.drawable.florist2image); } }); button = (Button)findViewById(R.id.floristBtn3); button.setOnClickListener(new View.OnClickListener(){ public void onClick(View v){ printFlorist3(); ImageView image = (ImageView)findViewById(R.id.floristIV); image.setImageResource(R.drawable.florist3image); } }); } //Create the icons in the Action Bar - i.e. Home button for easy navigation public boolean onCreateOptionsMenu(Menu menu){ getMenuInflater().inflate(R.menu.main,menu); return super.onCreateOptionsMenu(menu); } public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()) { case R.id.actionbarhomebtn: Intent intent = new Intent(this, Home.class); this.startActivity(intent); } return true; } public void printFlorist1(){ floristDetails.setText(""); String dbString = myDBHandler.floristToString1(); floristDetails.setText(dbString); } public void printFlorist2(){ floristDetails.setText(""); String dbString = myDBHandler.floristToString2(); floristDetails.setText(dbString); } public void printFlorist3(){ floristDetails.setText(""); String dbString = myDBHandler.floristToString3(); floristDetails.setText(dbString); } //Check to see which button is clicked - the string will be used to select which query should be executed in DBHandler class /* public String button1Clicked(){ buttonClick = "SELECT * FROM " + myDBHandler.AZ_TABLE + " WHERE " + myDBHandler.AZ_ID + "=" + 1; return buttonClick; } public String button2Clicked(){ buttonClick = "SELECT * FROM " + myDBHandler.AZ_TABLE + " WHERE " + myDBHandler.AZ_ID + "=" + 2;; return buttonClick; } */ }
3,736
0.653908
0.648287
128
28.1875
26.524973
128
false
false
0
0
0
0
0
0
0.507813
false
false
13
01e85c83552efd144d80302d9afcd4cf5953b42a
13,657,996,057,722
d3ef805ef7ecafafa43d3b62cc0adfe577b41a4f
/src/edu/ca/ualberta/ssrg/chaintracker/vis/Toast.java
86bdc56e57a9dd967564b3de2ad9246594620057
[]
no_license
virckof/chaintracker-15
https://github.com/virckof/chaintracker-15
162b5f5c80ec46797b47b3ace4de54f5d89e3210
9e56633d5c5edae6a77b1d39c145e7339c03a64b
refs/heads/master
2021-05-06T11:51:26.890000
2017-12-14T22:26:25
2017-12-14T22:26:25
114,301,491
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.ca.ualberta.ssrg.chaintracker.vis; import java.awt.Color; import java.awt.Label; import java.awt.Point; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JComponent; import javax.swing.Popup; import javax.swing.PopupFactory; /** * This code was adapted from code at the following link: * http://stackoverflow.com/questions/10161149/android-like-toast-in-swing */ public class Toast { private final JComponent component; private Point location; private final String message; private long duration; //in millisecond public Toast(JComponent comp, Point toastLocation, String msg, long forDuration) { this.component = comp; this.location = toastLocation; this.message = msg; this.duration = forDuration; if(this.component != null) { Point loc = component.getLocationOnScreen(); location.x = location.x + loc.x; location.y = location.y + loc.y; new Thread(new Runnable() { @Override public void run() { Popup view = null; try { Label tip = new Label(message); tip.setForeground(Color.BLACK); tip.setBackground(Colors.LIGHT_RED); view = PopupFactory.getSharedInstance().getPopup(component, tip , location.x, location.y); view.show(); Thread.sleep(duration); } catch (InterruptedException ex) { Logger.getLogger(Toast.class.getName()).log(Level.SEVERE, null, ex); } finally { view.hide(); } } }).start(); } } public static void showToast(JComponent component, String message, Point location, long forDuration) { new Toast(component, location, message, forDuration); } }
UTF-8
Java
2,134
java
Toast.java
Java
[]
null
[]
package edu.ca.ualberta.ssrg.chaintracker.vis; import java.awt.Color; import java.awt.Label; import java.awt.Point; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JComponent; import javax.swing.Popup; import javax.swing.PopupFactory; /** * This code was adapted from code at the following link: * http://stackoverflow.com/questions/10161149/android-like-toast-in-swing */ public class Toast { private final JComponent component; private Point location; private final String message; private long duration; //in millisecond public Toast(JComponent comp, Point toastLocation, String msg, long forDuration) { this.component = comp; this.location = toastLocation; this.message = msg; this.duration = forDuration; if(this.component != null) { Point loc = component.getLocationOnScreen(); location.x = location.x + loc.x; location.y = location.y + loc.y; new Thread(new Runnable() { @Override public void run() { Popup view = null; try { Label tip = new Label(message); tip.setForeground(Color.BLACK); tip.setBackground(Colors.LIGHT_RED); view = PopupFactory.getSharedInstance().getPopup(component, tip , location.x, location.y); view.show(); Thread.sleep(duration); } catch (InterruptedException ex) { Logger.getLogger(Toast.class.getName()).log(Level.SEVERE, null, ex); } finally { view.hide(); } } }).start(); } } public static void showToast(JComponent component, String message, Point location, long forDuration) { new Toast(component, location, message, forDuration); } }
2,134
0.541237
0.537488
67
30.850746
24.964006
114
false
false
0
0
0
0
0
0
0.671642
false
false
13
c583dd594cab26b81259c1c34ee3e37d2f50c4c5
19,834,159,033,377
e88d4f54405b49a2e03a1725eaf9e91e3d776c90
/cm-rest-service/src/main/java/com/cm/filter/SecurityAuthenticationEntryPoint.java
8e5443a9e3aec2b996d84060dcfa269a347b04d0
[]
no_license
vyasashok/courier-management
https://github.com/vyasashok/courier-management
651b2025d1c6d47a90de5c7bf8082dcbeb34a8a2
49ee7bc783a34442a2859f090fa8ceb96a961825
refs/heads/master
2023-01-08T02:44:17.535000
2020-07-07T08:55:45
2020-07-07T08:55:45
249,698,948
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cm.filter; import static java.util.Collections.singletonMap; import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.AuthenticationEntryPoint; import com.cm.core.model.entity.ErrorMessage; import com.cm.core.model.entity.ResponseWrapper; import com.cm.core.model.entity.RestErrorList; import com.fasterxml.jackson.databind.ObjectMapper; /** * SecurityAuthenticationEntryPoint is called by ExceptionTranslationFilter to * handle all AuthenticationException. These exceptions are thrown when * authentication failed : wrong login/password, authentication unavailable, * invalid token authentication expired, etc. * * For problems related to access (roles), see RestAccessDeniedHandler. */ public class SecurityAuthenticationEntryPoint implements AuthenticationEntryPoint { @Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { RestErrorList errorList = new RestErrorList(SC_UNAUTHORIZED, new ErrorMessage(authException.getMessage())); ResponseWrapper responseWrapper = new ResponseWrapper(null, singletonMap("status", SC_UNAUTHORIZED), errorList); ObjectMapper objMapper = new ObjectMapper(); HttpServletResponseWrapper wrapper = new HttpServletResponseWrapper(response); wrapper.setStatus(SC_UNAUTHORIZED); wrapper.setContentType(APPLICATION_JSON_VALUE); wrapper.getWriter().println(objMapper.writeValueAsString(responseWrapper)); wrapper.getWriter().flush(); } }
UTF-8
Java
1,936
java
SecurityAuthenticationEntryPoint.java
Java
[]
null
[]
package com.cm.filter; import static java.util.Collections.singletonMap; import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.AuthenticationEntryPoint; import com.cm.core.model.entity.ErrorMessage; import com.cm.core.model.entity.ResponseWrapper; import com.cm.core.model.entity.RestErrorList; import com.fasterxml.jackson.databind.ObjectMapper; /** * SecurityAuthenticationEntryPoint is called by ExceptionTranslationFilter to * handle all AuthenticationException. These exceptions are thrown when * authentication failed : wrong login/password, authentication unavailable, * invalid token authentication expired, etc. * * For problems related to access (roles), see RestAccessDeniedHandler. */ public class SecurityAuthenticationEntryPoint implements AuthenticationEntryPoint { @Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { RestErrorList errorList = new RestErrorList(SC_UNAUTHORIZED, new ErrorMessage(authException.getMessage())); ResponseWrapper responseWrapper = new ResponseWrapper(null, singletonMap("status", SC_UNAUTHORIZED), errorList); ObjectMapper objMapper = new ObjectMapper(); HttpServletResponseWrapper wrapper = new HttpServletResponseWrapper(response); wrapper.setStatus(SC_UNAUTHORIZED); wrapper.setContentType(APPLICATION_JSON_VALUE); wrapper.getWriter().println(objMapper.writeValueAsString(responseWrapper)); wrapper.getWriter().flush(); } }
1,936
0.830579
0.830579
48
39.3125
33.192089
114
false
false
0
0
0
0
0
0
1.166667
false
false
13
998593c06cc18ea8525743555f7c5c2810e81595
20,882,131,052,209
54f8a30a9284c740a1b0a05075348e273fb78d78
/Utils/SHDL2VHDL/src/org/jcb/shdl/CnxPointInter.java
275ca0975ecbb8a8431d79eb4837145807ae7c2f
[]
no_license
Kiddinglife/CRAPS-Kernel
https://github.com/Kiddinglife/CRAPS-Kernel
deca4033dc4fcc420a50cb0c432cd2085bf693f9
92b4d348f4b0eca1f7ebb4c57b42c49475c8d0b0
refs/heads/master
2021-05-05T18:17:44.215000
2015-03-13T01:44:37
2015-03-13T01:44:37
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.jcb.shdl; import java.util.*; import java.awt.*; import java.awt.geom.*; import org.jcb.shdl.*; // intermediate connection point public class CnxPointInter extends CnxPoint { private int id; private Point2D loc; private Equipotential equi; public CnxPointInter(int id, Point2D loc) { this.id = id; this.loc = loc; setLocation(loc); } public String toString() { String seq = ""; if (getEquipotential() != null) seq = "" + getEquipotential().getId(); return "cp" + getId() + "(eq" + seq + ")"; } public int getId() { return id; } public Point2D getLocation() { return loc; } public void setLocation(Point2D newloc) { double x = 0.; double y = 0.; if (Module.GRID) { x = ((int) Math.round(newloc.getX() / Module.GRIDSTEP)) * Module.GRIDSTEP; y = ((int) Math.round(newloc.getY() / Module.GRIDSTEP)) * Module.GRIDSTEP; } else { x = newloc.getX(); y = newloc.getY(); } loc.setLocation(x, y); } public Equipotential getEquipotential() { return equi; } public void setEquipotential(Equipotential equi) { this.equi = equi; } public Color getColor() { return Module.interCnxPtRectColor; } }
UTF-8
Java
1,176
java
CnxPointInter.java
Java
[]
null
[]
package org.jcb.shdl; import java.util.*; import java.awt.*; import java.awt.geom.*; import org.jcb.shdl.*; // intermediate connection point public class CnxPointInter extends CnxPoint { private int id; private Point2D loc; private Equipotential equi; public CnxPointInter(int id, Point2D loc) { this.id = id; this.loc = loc; setLocation(loc); } public String toString() { String seq = ""; if (getEquipotential() != null) seq = "" + getEquipotential().getId(); return "cp" + getId() + "(eq" + seq + ")"; } public int getId() { return id; } public Point2D getLocation() { return loc; } public void setLocation(Point2D newloc) { double x = 0.; double y = 0.; if (Module.GRID) { x = ((int) Math.round(newloc.getX() / Module.GRIDSTEP)) * Module.GRIDSTEP; y = ((int) Math.round(newloc.getY() / Module.GRIDSTEP)) * Module.GRIDSTEP; } else { x = newloc.getX(); y = newloc.getY(); } loc.setLocation(x, y); } public Equipotential getEquipotential() { return equi; } public void setEquipotential(Equipotential equi) { this.equi = equi; } public Color getColor() { return Module.interCnxPtRectColor; } }
1,176
0.651361
0.646259
64
17.34375
19.016621
77
false
false
0
0
0
0
0
0
1.453125
false
false
13
70214b6c8672de84e322b3f8ea975d88b454d5bc
18,021,682,837,352
f4d76899ca524eb33c043f06b001255157868083
/Main.java
f19eba856dc271dc8ca3476aefcad879171c1eec
[]
no_license
monalimirel/Rat-In-A-Maze
https://github.com/monalimirel/Rat-In-A-Maze
7b5800220b815648b26e9c26c8459420dc1a0966
6e7598b4e003cc833b2adf25816dee99bfbedda4
refs/heads/master
2021-07-18T10:54:13.499000
2017-10-26T20:25:59
2017-10-26T20:25:59
108,458,594
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* Monali Mirel Chuatico & Darren Jian * CIS 256 * Term Project: Rat-in-a-Maze * Generate a random two-dimensional square maze whose size is specified by the user * Read in a maze from a given text file * Solve maze using BFS & DFS * Main.java */ import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws InterruptedException { //Prompt user if want to read in a maze from a given text file or generate a new maze System.out.println("What would you like to do? \n1 - Open a maze file \n2 - Create a new maze"); Scanner action = new Scanner(System.in); int act = action.nextInt(); Maze maze = null; //Open a maze file if (act == 1) { String fname = getFileName(); maze = new Maze(fname); } //Create a new maze else if (act == 2) { System.out.println("Enter size of maze:"); Scanner size = new Scanner(System.in); int s = size.nextInt(); maze = new Maze(s * s); } maze.printMaze(); solveMaze(maze); } /** * Prints the solution to the maze using BFS and DFS * @param maze */ private static void solveMaze(Maze maze) { maze.solve(); } /** * Retrieves file * @return maze.txt */ private static String getFileName() { return "maze.txt"; } }
UTF-8
Java
1,517
java
Main.java
Java
[ { "context": "/* Monali Mirel Chuatico & Darren Jian\n * CIS 256\n * Term Project: Rat-in-", "end": 24, "score": 0.9998745322227478, "start": 3, "tag": "NAME", "value": "Monali Mirel Chuatico" }, { "context": "/* Monali Mirel Chuatico & Darren Jian\n * CIS 256\n * Term Project: Rat-i...
null
[]
/* <NAME> & <NAME> * CIS 256 * Term Project: Rat-in-a-Maze * Generate a random two-dimensional square maze whose size is specified by the user * Read in a maze from a given text file * Solve maze using BFS & DFS * Main.java */ import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws InterruptedException { //Prompt user if want to read in a maze from a given text file or generate a new maze System.out.println("What would you like to do? \n1 - Open a maze file \n2 - Create a new maze"); Scanner action = new Scanner(System.in); int act = action.nextInt(); Maze maze = null; //Open a maze file if (act == 1) { String fname = getFileName(); maze = new Maze(fname); } //Create a new maze else if (act == 2) { System.out.println("Enter size of maze:"); Scanner size = new Scanner(System.in); int s = size.nextInt(); maze = new Maze(s * s); } maze.printMaze(); solveMaze(maze); } /** * Prints the solution to the maze using BFS and DFS * @param maze */ private static void solveMaze(Maze maze) { maze.solve(); } /** * Retrieves file * @return maze.txt */ private static String getFileName() { return "maze.txt"; } }
1,497
0.545814
0.5412
64
22.71875
22.986048
102
false
false
0
0
0
0
0
0
0.3125
false
false
13
f5ed7ae1bf8ceb4ba11c486017560f2a40293d19
28,217,935,195,770
d11bb071ffcedb4023b9c01c26ec08d303765741
/src/main/java/com/padoling/portfolio/august/web/dto/book/BookResponseDto.java
07f758c7271edd8f95fe46c9195a1d2db0abae0b
[]
no_license
padoling/august-reading
https://github.com/padoling/august-reading
f0abfa14af6ccd2d9fb66f2d4b85970e73b6267e
9ee5addd4fb24061c9ff244554e2206165dc4bc5
refs/heads/master
2020-12-20T04:23:20.263000
2020-10-26T09:38:31
2020-10-26T09:38:31
235,960,183
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.padoling.portfolio.august.web.dto.book; import com.padoling.portfolio.august.domain.book.Book; import lombok.Getter; @Getter public class BookResponseDto { private Long id; private String title; private String link; private String image; private String author; private String publisher; private String isbn; private String description; private String pubdate; public BookResponseDto(Book entity) { this.id = entity.getId(); this.title = entity.getTitle(); this.link = entity.getLink(); this.image = entity.getImage(); this.author = entity.getAuthor(); this.publisher = entity.getPublisher(); this.isbn = entity.getIsbn(); this.description = entity.getDescription(); this.pubdate = entity.getPubdate(); } }
UTF-8
Java
838
java
BookResponseDto.java
Java
[]
null
[]
package com.padoling.portfolio.august.web.dto.book; import com.padoling.portfolio.august.domain.book.Book; import lombok.Getter; @Getter public class BookResponseDto { private Long id; private String title; private String link; private String image; private String author; private String publisher; private String isbn; private String description; private String pubdate; public BookResponseDto(Book entity) { this.id = entity.getId(); this.title = entity.getTitle(); this.link = entity.getLink(); this.image = entity.getImage(); this.author = entity.getAuthor(); this.publisher = entity.getPublisher(); this.isbn = entity.getIsbn(); this.description = entity.getDescription(); this.pubdate = entity.getPubdate(); } }
838
0.669451
0.669451
30
26.933332
16.401085
54
false
false
0
0
0
0
0
0
0.7
false
false
13
63ad513c3f2635f52ebf3fbe228f5c7933b007ae
28,217,935,193,038
71ad53649d6113c8d5d27db3f87c6ce5e6d1f529
/src/main/java/com/rechargeautomation/screen/RechargeHome.java
d16b6031d156ed0682ac97f93411b4b36ca30ce5
[]
no_license
aravindanath/Retail
https://github.com/aravindanath/Retail
577ddd9edea7be1e4b46e6961f9346d957341bbe
f8c303175526f96bce1c1ef6cf57134f1f889303
refs/heads/master
2022-08-22T16:12:01.646000
2020-05-22T09:16:51
2020-05-22T09:16:51
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rechargeautomation.screen; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; public class RechargeHome{ @FindBy(id="com.enstage.wibmo.staging.hdfc:id/image_mobile") protected static WebElement mobile; public void ClickOnMobileIcon() { mobile.click(); } @FindBy(id="com.enstage.wibmo.staging.hdfc:id/image_dth") protected WebElement DTHIcon; public void DTHIcon(WebDriver driver) { DTHIcon.click(); } @FindBy(id="com.enstage.wibmo.staging.hdfc:id/image_datacard") protected static WebElement DataCardIcon; public static void DataCardIcon(WebDriver driver) { DataCardIcon.click(); } }
UTF-8
Java
708
java
RechargeHome.java
Java
[]
null
[]
package com.rechargeautomation.screen; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; public class RechargeHome{ @FindBy(id="com.enstage.wibmo.staging.hdfc:id/image_mobile") protected static WebElement mobile; public void ClickOnMobileIcon() { mobile.click(); } @FindBy(id="com.enstage.wibmo.staging.hdfc:id/image_dth") protected WebElement DTHIcon; public void DTHIcon(WebDriver driver) { DTHIcon.click(); } @FindBy(id="com.enstage.wibmo.staging.hdfc:id/image_datacard") protected static WebElement DataCardIcon; public static void DataCardIcon(WebDriver driver) { DataCardIcon.click(); } }
708
0.754237
0.754237
30
22.6
21.051682
63
false
false
0
0
0
0
0
0
1.166667
false
false
13
890e650aae59b3228a938af20d57f8f9a747cd8e
11,905,649,356,893
4193a227149800268b7f577030bf983554c958e0
/src/main/java/com/ffwb/utils/JsonType.java
b508ae620b712d4012bc803622bcb742bf914c6e
[]
no_license
zizijun/ffwb
https://github.com/zizijun/ffwb
7f8a3618df21919dcf657a1d950f5fab1508bac4
f81f69e4587c67e7153d50137bc619f7a98071e9
refs/heads/master
2020-04-05T14:13:31.384000
2017-08-03T07:33:01
2017-08-03T07:33:01
94,843,308
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ffwb.utils; import java.util.HashMap; import java.util.Map; import java.util.Set; /** * Created by jinchuyang on 2017/6/23. */ public class JsonType { public static String simpleMapToJsonStr(Map map) { if (map == null || map.isEmpty()) { return "null"; } String jsonStr = "{"; Set keySet = map.keySet(); for (Object key : keySet) { jsonStr += "\"" + key + "\":\"" + map.get(key) + "\","; } jsonStr = jsonStr.substring(1, jsonStr.length() - 2); //jsonStr = jsonStr.substring(0, jsonStr.length() - 2); jsonStr += "}"; return jsonStr; } //{"pass":"4355","name":"12342","wang":"fsf"} public static Map getData(String str) { String sb = str.substring(1, str.length() - 1); String[] name = sb.split("\\\",\\\""); String[] nn = null; Map<String,String> map = new HashMap<>(); for (String aName : name) { nn = aName.split("\\\":\\\""); map.put(nn[0], nn[1]); } return map; } }
UTF-8
Java
1,146
java
JsonType.java
Java
[ { "context": ".Map;\r\nimport java.util.Set;\r\n\r\n/**\r\n * Created by jinchuyang on 2017/6/23.\r\n */\r\npublic class JsonType {\r\n\r\n ", "end": 131, "score": 0.9996574521064758, "start": 121, "tag": "USERNAME", "value": "jinchuyang" }, { "context": " return jsonStr;\r\n\...
null
[]
package com.ffwb.utils; import java.util.HashMap; import java.util.Map; import java.util.Set; /** * Created by jinchuyang on 2017/6/23. */ public class JsonType { public static String simpleMapToJsonStr(Map map) { if (map == null || map.isEmpty()) { return "null"; } String jsonStr = "{"; Set keySet = map.keySet(); for (Object key : keySet) { jsonStr += "\"" + key + "\":\"" + map.get(key) + "\","; } jsonStr = jsonStr.substring(1, jsonStr.length() - 2); //jsonStr = jsonStr.substring(0, jsonStr.length() - 2); jsonStr += "}"; return jsonStr; } //{"pass":"<PASSWORD>","name":"12342","wang":"fsf"} public static Map getData(String str) { String sb = str.substring(1, str.length() - 1); String[] name = sb.split("\\\",\\\""); String[] nn = null; Map<String,String> map = new HashMap<>(); for (String aName : name) { nn = aName.split("\\\":\\\""); map.put(nn[0], nn[1]); } return map; } }
1,152
0.47993
0.458988
48
21.916666
20.509991
67
false
false
0
0
0
0
0
0
0.625
false
false
13
4795e63849c6b06702a2b306d166d67d12ce830d
11,905,649,355,685
0082fed8a0574d7b894c38e48d902da679973324
/src/main/java/HelloWord.java
882ea62853b753f100d42e7cb9d5f5d0cad663a1
[]
no_license
AlexandraDamaschin/Practica
https://github.com/AlexandraDamaschin/Practica
c8b73fa3b738af436ab8fb67854e82888889ebe5
5628f3fab9332758f6db47bfd126c2ea2f7491d0
refs/heads/master
2020-12-02T21:19:55.830000
2017-07-05T20:45:35
2017-07-05T20:45:35
96,295,943
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Created by Asus on 7/5/2017. */ public class HelloWord { public static void main(String[] args) { System.out.println("Hello Jiji! "); } }
UTF-8
Java
163
java
HelloWord.java
Java
[ { "context": "/**\n * Created by Asus on 7/5/2017.\n */\npublic class HelloWord {\n\n pu", "end": 22, "score": 0.9989592432975769, "start": 18, "tag": "NAME", "value": "Asus" } ]
null
[]
/** * Created by Asus on 7/5/2017. */ public class HelloWord { public static void main(String[] args) { System.out.println("Hello Jiji! "); } }
163
0.588957
0.552147
9
17.111111
17.419302
44
false
false
0
0
0
0
0
0
0.111111
false
false
13
db923d9f050cf1993c302149fb076f63a096f9f7
7,078,106,132,279
4357bf59409c9d09374393d208745a27f34bd345
/src/com/xsis/quiz06/soal02/jumlahHuruf.java
1942e7c5789580fffa0fb8f3b86c2121d6fab876
[]
no_license
jooprima/batch210-jooprima
https://github.com/jooprima/batch210-jooprima
b3343d7094285f30d48616f34be392c9aa04b54b
bb8bd44d541ca11bb8a68efeb26e6606c51ad6f2
refs/heads/master
2020-07-13T12:09:42.484000
2019-10-16T04:10:44
2019-10-16T04:10:44
204,870,621
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.xsis.quiz06.soal02; import java.util.Scanner; import java.util.StringTokenizer; public class jumlahHuruf { public static void main(String[] args) { Scanner sc = new Scanner(System.in); boolean loop = true; String cobaLagi; while (loop){ System.out.print("Enter a String : "); String kalimat = sc.nextLine(); System.out.print("Enter a character : "); String huruf = sc.nextLine(); System.out.println("\nThe character "+huruf+" appear in "+kalimat+" "+countChar(huruf,kalimat)+" times"); System.out.print("\nTry again ? (y/n) : "); cobaLagi = sc.nextLine(); if (cobaLagi.equalsIgnoreCase("n")){ loop = false; } } } private static int countChar(String hurufs, String kalimats) { int found = 0; for (int i = 0; i < kalimats.length(); i++) { //string check if (hurufs.equalsIgnoreCase(String.valueOf(kalimats.charAt(i)))){ found++; } } return found; } }
UTF-8
Java
1,142
java
jumlahHuruf.java
Java
[]
null
[]
package com.xsis.quiz06.soal02; import java.util.Scanner; import java.util.StringTokenizer; public class jumlahHuruf { public static void main(String[] args) { Scanner sc = new Scanner(System.in); boolean loop = true; String cobaLagi; while (loop){ System.out.print("Enter a String : "); String kalimat = sc.nextLine(); System.out.print("Enter a character : "); String huruf = sc.nextLine(); System.out.println("\nThe character "+huruf+" appear in "+kalimat+" "+countChar(huruf,kalimat)+" times"); System.out.print("\nTry again ? (y/n) : "); cobaLagi = sc.nextLine(); if (cobaLagi.equalsIgnoreCase("n")){ loop = false; } } } private static int countChar(String hurufs, String kalimats) { int found = 0; for (int i = 0; i < kalimats.length(); i++) { //string check if (hurufs.equalsIgnoreCase(String.valueOf(kalimats.charAt(i)))){ found++; } } return found; } }
1,142
0.533275
0.528021
49
22.306122
24.962179
117
false
false
0
0
0
0
0
0
0.428571
false
false
13
77a7b2d77bb693ac6b0fa0c835e7e02c9c0e09d5
7,499,012,935,314
aaee8837eaabaaad68a28ac9b4df8a4953630d11
/c2-sys-test/src/test/java/com/chinacreator/sysmgr/log/log_config/testcase/checkLog.java
587d3f5b5d9275502b949693e79c5aa9aa07ae6a
[]
no_license
encool/en-sys
https://github.com/encool/en-sys
7974e04917b5990ee5be1f49dc27b199f952c2e4
a3b8c36f79f9cd804b3862497d03cad0ef35f83b
refs/heads/master
2018-05-13T12:19:42.722000
2018-01-23T14:57:10
2018-01-23T14:57:10
92,655,628
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.chinacreator.sysmgr.log.log_config.testcase; import junit.framework.TestCase; import org.openqa.selenium.By; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.chinacreator.sysmgr.TestAll; import com.chinacreator.sysmgr.utils.Common; public class checkLog extends TestCase{ Logger logger = LoggerFactory.getLogger(checkLog.class); public void testcheckLog() throws Exception { try { assertTrue(TestAll.driver.findElement(By.xpath("//tbody/tr[2]/td[3]")).getText().matches("^[\\s\\S]*备份日志[\\s\\S]*$")); logger.info("日志配置修改生效!"); } catch (Error e) { TestAll.verificationErrors.append(e.toString()); } } }
UTF-8
Java
716
java
checkLog.java
Java
[]
null
[]
package com.chinacreator.sysmgr.log.log_config.testcase; import junit.framework.TestCase; import org.openqa.selenium.By; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.chinacreator.sysmgr.TestAll; import com.chinacreator.sysmgr.utils.Common; public class checkLog extends TestCase{ Logger logger = LoggerFactory.getLogger(checkLog.class); public void testcheckLog() throws Exception { try { assertTrue(TestAll.driver.findElement(By.xpath("//tbody/tr[2]/td[3]")).getText().matches("^[\\s\\S]*备份日志[\\s\\S]*$")); logger.info("日志配置修改生效!"); } catch (Error e) { TestAll.verificationErrors.append(e.toString()); } } }
716
0.701449
0.695652
24
27.75
28.536892
126
false
false
0
0
0
0
0
0
1.208333
false
false
13
43f510029b0693c881d1e5a3ce1b1ee2600d41ef
3,100,966,417,201
a7d2d5b26b7914691257052c77d2cd3e1cbb5e1d
/src/main/java/com/ejemplo/nestor/ejemplo_crud_con_sesiones/entity/Vehiculo.java
86b239a2d2e10c6c69e8b4e3795efa1946c0dc22
[]
no_license
lightmy-fire/Estacionamiento
https://github.com/lightmy-fire/Estacionamiento
8a1a3b52062d91497800a0e10de8789dc074cacf
513dd60ea2ccfd391825aba7c9124d1068a863c3
refs/heads/master
2022-04-26T06:19:15.855000
2020-04-29T14:42:43
2020-04-29T14:42:43
259,952,504
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ejemplo.nestor.ejemplo_crud_con_sesiones.entity; public class Vehiculo { }
UTF-8
Java
90
java
Vehiculo.java
Java
[]
null
[]
package com.ejemplo.nestor.ejemplo_crud_con_sesiones.entity; public class Vehiculo { }
90
0.777778
0.777778
6
14
22.188585
60
false
false
0
0
0
0
0
0
0.166667
false
false
13
b892a13e15f5f3f09c7965260e8946db9a4a9e52
13,941,463,879,000
cccae761831ae5dcb2009af722264a4c6d2ce4cb
/src/main/java/com/stream_processor_core/Processor.java
4f18f130d9414d65fd36e23811d95171d5f4dc6c
[]
no_license
rafaferrari/stream-leitura-core
https://github.com/rafaferrari/stream-leitura-core
f19778b29ff76009bb55bb4ffd277885c9a65a70
21899fcc13bc137885b77bbe45995b8a28ebf827
refs/heads/master
2021-01-23T21:02:32.392000
2017-05-09T14:36:05
2017-05-09T14:36:05
90,671,996
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.stream_processor_core; import java.util.Arrays; import java.util.List; import java.util.function.Predicate; import java.util.stream.Collectors; /** * Class responsible to process an Stream verifying a result looking for a * matcher. * * @author rafael.ferrari */ public class Processor implements Stream { private static final String VOWEL_MATCHER = "^A|E|I|O|U$"; private final String input; private int vowelIndex; private int index = 0; public Processor(final String input) { this.input = input; } public void process() { final List<String> chars = getCharsOfInput(); final Integer consonantIndex = getFirstConsonantIndex(chars); this.vowelIndex = getFirstVowelIndex(chars, consonantIndex); System.out.println(String.format("Valor encontrado: %s - Índice: %s", input.charAt(vowelIndex), vowelIndex)); } private List<String> getCharsOfInput() { return Arrays.asList(input.split("")) .stream() .map(String::toUpperCase) .collect(Collectors.toList()); } private Integer getFirstConsonantIndex(final List<String> chars) { final String consoante = chars.stream() .filter(s -> !s.matches(VOWEL_MATCHER)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Favor informar um valor válido.")); return chars.indexOf(consoante); } private Integer getFirstVowelIndex(final List<String> chars, final Integer consonantIndex) { final String vowel = chars.subList(consonantIndex, chars.size()) .stream() .filter(filtraVogalUnica(chars)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Favor informar um valor válido.")); return chars.indexOf(vowel); } private Predicate<? super String> filtraVogalUnica(final List<String> chars) { return s -> s.matches(VOWEL_MATCHER) && chars.stream().filter(v -> v.equals(s)).count() == 1; } @Override public char getNext() { return input.charAt(index++); } @Override public boolean hasNext() { return index <= input.length() && vowelIndex == -1 || index <= vowelIndex; } }
UTF-8
Java
2,313
java
Processor.java
Java
[ { "context": "g a result looking for a\n * matcher.\n *\n * @author rafael.ferrari\n */\npublic class Processor implements Stream {\n\n ", "end": 277, "score": 0.9988207221031189, "start": 263, "tag": "NAME", "value": "rafael.ferrari" } ]
null
[]
package com.stream_processor_core; import java.util.Arrays; import java.util.List; import java.util.function.Predicate; import java.util.stream.Collectors; /** * Class responsible to process an Stream verifying a result looking for a * matcher. * * @author rafael.ferrari */ public class Processor implements Stream { private static final String VOWEL_MATCHER = "^A|E|I|O|U$"; private final String input; private int vowelIndex; private int index = 0; public Processor(final String input) { this.input = input; } public void process() { final List<String> chars = getCharsOfInput(); final Integer consonantIndex = getFirstConsonantIndex(chars); this.vowelIndex = getFirstVowelIndex(chars, consonantIndex); System.out.println(String.format("Valor encontrado: %s - Índice: %s", input.charAt(vowelIndex), vowelIndex)); } private List<String> getCharsOfInput() { return Arrays.asList(input.split("")) .stream() .map(String::toUpperCase) .collect(Collectors.toList()); } private Integer getFirstConsonantIndex(final List<String> chars) { final String consoante = chars.stream() .filter(s -> !s.matches(VOWEL_MATCHER)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Favor informar um valor válido.")); return chars.indexOf(consoante); } private Integer getFirstVowelIndex(final List<String> chars, final Integer consonantIndex) { final String vowel = chars.subList(consonantIndex, chars.size()) .stream() .filter(filtraVogalUnica(chars)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Favor informar um valor válido.")); return chars.indexOf(vowel); } private Predicate<? super String> filtraVogalUnica(final List<String> chars) { return s -> s.matches(VOWEL_MATCHER) && chars.stream().filter(v -> v.equals(s)).count() == 1; } @Override public char getNext() { return input.charAt(index++); } @Override public boolean hasNext() { return index <= input.length() && vowelIndex == -1 || index <= vowelIndex; } }
2,313
0.631602
0.630303
70
32
30.479033
117
false
false
0
0
0
0
0
0
0.471429
false
false
13
ab17c94708f7abd78dc221ea591410e9a1890d88
15,436,112,494,289
b2db514c53aa8c02006e3d59e6572d8cae77bf6f
/src/ioedata/service/sensor/factory/FlameSensor.java
5d06d06d9349a9745cbe316c322759d33da210f3
[]
no_license
RachelSkyler/SensorDataProcessing-API
https://github.com/RachelSkyler/SensorDataProcessing-API
9887756ccefd4ba6606b09d0b4f13a70165ada1a
ce5f2395b6d47381adc2c2575f72777fa7098185
refs/heads/master
2021-01-17T08:19:42.127000
2014-05-28T09:01:04
2014-05-28T09:01:04
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ioedata.service.sensor.factory; public abstract class FlameSensor implements Sensor { @Override public int getSensorType() { // TODO Auto-generated method stub return Sensor.TYPE_FLAME; } }
UTF-8
Java
217
java
FlameSensor.java
Java
[]
null
[]
package ioedata.service.sensor.factory; public abstract class FlameSensor implements Sensor { @Override public int getSensorType() { // TODO Auto-generated method stub return Sensor.TYPE_FLAME; } }
217
0.728111
0.728111
10
19.700001
18.493513
53
false
false
0
0
0
0
0
0
0.9
false
false
13
74d635ddff4a35f37f10a478014d0e63bf1f4b2e
3,762,391,390,709
83f2558fde987c0e46b5e1ee088b727989ad088f
/src/Utils/ColorUtils.java
a5906e390895831ce019445609ce6e0f1c80f21c
[]
no_license
MathiasSchoettle/linetracer
https://github.com/MathiasSchoettle/linetracer
1006cbd1204a6bc8f433269a9e54576cc0865afc
d8e9d15aa248909c1da782f38e9ddbfb19c26558
refs/heads/master
2022-12-29T01:44:45.405000
2020-10-15T16:10:09
2020-10-15T16:10:09
304,377,902
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Utils; import java.awt.*; import java.util.concurrent.ThreadLocalRandom; public final class ColorUtils { private ColorUtils() { throw new UnsupportedOperationException("can not instantiate Class ColorUtils"); } public static Color getRandomColor(){ ThreadLocalRandom rand = ThreadLocalRandom.current(); return new Color(rand.nextInt(0, 255 + 1), rand.nextInt(0, 255 + 1), rand.nextInt(0, 255 + 1)); } }
UTF-8
Java
455
java
ColorUtils.java
Java
[]
null
[]
package Utils; import java.awt.*; import java.util.concurrent.ThreadLocalRandom; public final class ColorUtils { private ColorUtils() { throw new UnsupportedOperationException("can not instantiate Class ColorUtils"); } public static Color getRandomColor(){ ThreadLocalRandom rand = ThreadLocalRandom.current(); return new Color(rand.nextInt(0, 255 + 1), rand.nextInt(0, 255 + 1), rand.nextInt(0, 255 + 1)); } }
455
0.694506
0.661538
16
27.4375
31.656296
103
false
false
0
0
0
0
0
0
0.6875
false
false
13
249a4ee8a1851c5f5ac2d98d105ee8bbab36a958
22,351,009,834,930
4b57486b0d9fe5886ac83d97f249239d46f71928
/2-MongoDB/mongo/src/main/java/Mongo.java
c2403aa59ffc20e5f9a02f508d3a90fb564df5c8
[]
no_license
Ckobar/StudentDataHW-Vasiljev_A.V
https://github.com/Ckobar/StudentDataHW-Vasiljev_A.V
b301929680780307d5aa7cc9337fee0bc847e5a9
15e2c5f137e87aa3aabca1e78ca20683149b8958
refs/heads/master
2021-01-12T08:09:09.282000
2016-12-14T18:35:56
2016-12-14T18:35:56
76,486,455
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import com.mongodb.BasicDBObject; import com.mongodb.MongoClient; import com.mongodb.client.FindIterable; import com.mongodb.client.MongoCollection; import com.mongodb.client.MongoCursor; import com.mongodb.client.MongoDatabase; import org.bson.Document; import java.util.*; import java.util.stream.Collectors; import static com.mongodb.client.model.Filters.exists; import static com.mongodb.client.model.Filters.gt; /** * Created by ������� on 26.10.2016. * Class producing operations to create a collection, in accordance with the tasks. * Working with the students and to employees collections. */ public class Mongo { private static final String STUDENTS_COLL = "Students"; private static final String EMPLOYEES_COLL = "Employees"; private static final String DB = "test"; private static final String AGE_EMPLOYEER = "age"; private static final String YEAR_STUDENTS = "year"; private static final String COURSE_STUDENTS = "course"; private static final String BUG_EMPLOYEER = "bug"; private static final String JOB_STUDENTS_FIELD = "job"; private static final String JOB_STUDENTS_STATUS_EYA = "yea"; private static final String JOB_STUDENTS_STATUS_NOPE = "nope"; private static final String STATUS_BIG_DATA = "status"; private static final String STATUS_BIG_DATA_STUDENTS = "recruited"; private static final String STATUS_BIG_DATA_EMPLOYEER = "mentor"; private static final String STUDENTS_HOBBY_FIELD = "hobby"; private static final String STUDENTS_HOBBY_PROGRAMMING = "programming"; private static final String PROFILE_EMPLOYEER_FIELD = "profile"; private static final String PROFILE_EMPLOYEER_MANAGER = "manager"; private int year = 2016; MongoClient mongoClient = new MongoClient(); MongoDatabase mongoDatabase = mongoClient.getDatabase(DB); MongoCollection<Document> docCollEmpl = mongoDatabase.getCollection(EMPLOYEES_COLL); MongoCollection<Document> docCollStud = mongoDatabase.getCollection(STUDENTS_COLL); /** * Task 4 - Search age the employees and year the students * Finds a non-zero field and transmits processing * Uses global collection */ private void task4CompareAge(){ FindIterable<Document> iterableEmpl = docCollEmpl.find(gt(AGE_EMPLOYEER, 0)); FindIterable<Document> iterableStud = docCollStud.find(gt(YEAR_STUDENTS, 0)); findAgeEmpl(iterableEmpl); findAgeStud(iterableStud); } /** * Finds max age the employees * @param iterableEmpl all non-zero in the collection employees of documents */ private void findAgeEmpl(FindIterable<Document> iterableEmpl){ MongoCursor<Document> cursorEmpl = iterableEmpl.iterator(); Map<Integer, Document> mapDocEmpl = new TreeMap<>(); while (cursorEmpl.hasNext()) { Document documentAgeEmpl = cursorEmpl.next(); mapDocEmpl.put(documentAgeEmpl.getInteger(AGE_EMPLOYEER), documentAgeEmpl); } System.out.println(mapDocEmpl.values().toArray()[mapDocEmpl.size()-1]); } /** * Finds min age the students * @param iterableStud all non-zero in the collection students of documents */ private void findAgeStud(FindIterable<Document> iterableStud){ MongoCursor<Document> cursorStud = iterableStud.iterator(); Map<Integer, Document> mapDocStud = new TreeMap<>(); while (cursorStud.hasNext()) { Document documentAgeStud = cursorStud.next(); mapDocStud.put(documentAgeStud.getInteger(YEAR_STUDENTS), documentAgeStud); } System.out.println(mapDocStud.values().toArray()[mapDocStud.size()-1]); } /** * Task 5 - update age of all employees and the training course for all students * @param newYear year which want to change */ private void task5UpdateNewYear(int newYear){ if(year!=newYear){ updateAgeEmpl(newYear-year); updateCourseStud(newYear-year); } year = newYear; } /** * Updates the age of employees * @param difference how many years have passed (the difference) */ private void updateAgeEmpl(int difference){ FindIterable<Document> iterable = docCollEmpl.find(gt(AGE_EMPLOYEER, 0)); MongoCursor<Document> cursor = iterable.iterator(); while (cursor.hasNext()) { Document documentNewAgeEmpl = cursor.next(); Document documentOldAgeEmpl = new Document(documentNewAgeEmpl); documentNewAgeEmpl.replace(AGE_EMPLOYEER,documentNewAgeEmpl.getInteger(AGE_EMPLOYEER)+difference); docCollEmpl.updateOne(documentOldAgeEmpl, new Document("$set", new Document(documentNewAgeEmpl))); } } /** * Updates the course of students * @param difference how many years have passed (the difference) */ private void updateCourseStud(int difference){ FindIterable<Document> iterable = docCollEmpl.find(gt(COURSE_STUDENTS, 0)); MongoCursor<Document> cursor = iterable.iterator(); while (cursor.hasNext()) { Document documentNewCourseStud = cursor.next(); Document documentOldCourseStud = new Document(documentNewCourseStud); documentNewCourseStud.replace(COURSE_STUDENTS,documentNewCourseStud.getInteger(COURSE_STUDENTS)+difference); docCollEmpl.updateOne(documentOldCourseStud, new Document("$set", new Document(documentNewCourseStud))); } } /** * Task 8 - removes bugs in the tester */ private void task8DelBugs(){ FindIterable<Document> iterable = docCollEmpl.find(exists(BUG_EMPLOYEER)); MongoCursor<Document> cursor = iterable.iterator(); Document documentNewBugs = cursor.next(); Document documentOldBugs = new Document(documentNewBugs); List lisNewtBugs = (List) Arrays.asList(documentOldBugs.get(BUG_EMPLOYEER)).get(0); List listOldBugs = new LinkedList<>(lisNewtBugs); listOldBugs.remove(lisNewtBugs.size()-1); documentNewBugs.replace(BUG_EMPLOYEER, listOldBugs); docCollEmpl.updateOne(documentOldBugs, new Document("$set", new Document(documentNewBugs))); } /** * Task 9 - hires 2 students as developers of Big Data, for one as a manager over them */ private void task9SelectStudAndMenedgerForBigData(){ List<Document> listStud = selectStudThroughJob(); List<Document> listEmpl = selectEmplForBigData(); if(listStud.size()>=2 && !listEmpl.isEmpty()) { Document documentStud0 = new Document(listStud.get(0)); Document documentStud1 = new Document(listStud.get(1)); Document documentEmpl0 = new Document(listEmpl.get(0)); listStud.get(0).replace(JOB_STUDENTS_FIELD, JOB_STUDENTS_STATUS_EYA); listStud.get(0).append(STATUS_BIG_DATA, STATUS_BIG_DATA_STUDENTS); listStud.get(1).replace(JOB_STUDENTS_FIELD, JOB_STUDENTS_STATUS_EYA); listStud.get(1).append(STATUS_BIG_DATA, STATUS_BIG_DATA_STUDENTS); listEmpl.get(0).append(STATUS_BIG_DATA, STATUS_BIG_DATA_EMPLOYEER); docCollEmpl.updateOne(documentEmpl0, new Document("$set", new Document(listEmpl.get(0)))); docCollStud.updateOne(documentStud0, new Document("$set", new Document(listStud.get(0)))); docCollStud.updateOne(documentStud1, new Document("$set", new Document(listStud.get(1)))); } } /** * Finds unemployed students * @return selectStudThroughHobbyAndJob a list of all unemployed students */ private List<Document> selectStudThroughJob(){ List<Document> listStudThroughJob = new ArrayList<>(); FindIterable<Document> iterable = docCollStud.find(exists(JOB_STUDENTS_FIELD)); MongoCursor<Document> cursor = iterable.iterator(); while (cursor.hasNext()) { Document documentJobStud = cursor.next(); if (documentJobStud.get(JOB_STUDENTS_FIELD).equals(JOB_STUDENTS_STATUS_NOPE)) listStudThroughJob.add(documentJobStud); } return selectStudThroughHobbyAndJob(listStudThroughJob); } /** * Looking for students with a hobby programming * @param listStudThroughJob a list of all unemployed students * @return listStudThroughJob a list of all unemployed students */ private List<Document> selectStudThroughHobbyAndJob(List<Document> listStudThroughJob){ return listStudThroughJob.stream().filter((documentJobAndHobbyStud) -> (documentJobAndHobbyStud.get(STUDENTS_HOBBY_FIELD)).equals(STUDENTS_HOBBY_PROGRAMMING)).collect(Collectors.toList()); } /** * Looking for all the managers of the developers * @return listEmplForBD a list of all managers */ private List<Document> selectEmplForBigData(){ List<Document> listEmplForBD = new ArrayList<>(); FindIterable<Document> iterable = docCollEmpl.find(exists(PROFILE_EMPLOYEER_FIELD)); MongoCursor<Document> cursor = iterable.iterator(); while (cursor.hasNext()) { Document documentJobStud = cursor.next(); if (documentJobStud.get(PROFILE_EMPLOYEER_FIELD).equals(PROFILE_EMPLOYEER_MANAGER)) listEmplForBD.add(documentJobStud); } return listEmplForBD; } private void task10CreateIndex(){ docCollEmpl.createIndex(new BasicDBObject("name", 1)); docCollStud.createIndex(new BasicDBObject("name", 1)); } public static void main(String [] argc){ Mongo mongo = new Mongo(); //mongo.task4CompareAge(); //mongo.task5UpdateNewYear(2016); //mongo.task8DelBugs(); //mongo.task9SelectStudAndMenedgerForBigData(); //mongo.task10CreateIndex(); } }
UTF-8
Java
9,872
java
Mongo.java
Java
[ { "context": "ngodb.client.model.Filters.gt;\n\n/**\n * Created by ������� on 26.10.2016.\n * Class producing operations to c", "end": 438, "score": 0.7253462672233582, "start": 438, "tag": "NAME", "value": "" } ]
null
[]
import com.mongodb.BasicDBObject; import com.mongodb.MongoClient; import com.mongodb.client.FindIterable; import com.mongodb.client.MongoCollection; import com.mongodb.client.MongoCursor; import com.mongodb.client.MongoDatabase; import org.bson.Document; import java.util.*; import java.util.stream.Collectors; import static com.mongodb.client.model.Filters.exists; import static com.mongodb.client.model.Filters.gt; /** * Created by ������� on 26.10.2016. * Class producing operations to create a collection, in accordance with the tasks. * Working with the students and to employees collections. */ public class Mongo { private static final String STUDENTS_COLL = "Students"; private static final String EMPLOYEES_COLL = "Employees"; private static final String DB = "test"; private static final String AGE_EMPLOYEER = "age"; private static final String YEAR_STUDENTS = "year"; private static final String COURSE_STUDENTS = "course"; private static final String BUG_EMPLOYEER = "bug"; private static final String JOB_STUDENTS_FIELD = "job"; private static final String JOB_STUDENTS_STATUS_EYA = "yea"; private static final String JOB_STUDENTS_STATUS_NOPE = "nope"; private static final String STATUS_BIG_DATA = "status"; private static final String STATUS_BIG_DATA_STUDENTS = "recruited"; private static final String STATUS_BIG_DATA_EMPLOYEER = "mentor"; private static final String STUDENTS_HOBBY_FIELD = "hobby"; private static final String STUDENTS_HOBBY_PROGRAMMING = "programming"; private static final String PROFILE_EMPLOYEER_FIELD = "profile"; private static final String PROFILE_EMPLOYEER_MANAGER = "manager"; private int year = 2016; MongoClient mongoClient = new MongoClient(); MongoDatabase mongoDatabase = mongoClient.getDatabase(DB); MongoCollection<Document> docCollEmpl = mongoDatabase.getCollection(EMPLOYEES_COLL); MongoCollection<Document> docCollStud = mongoDatabase.getCollection(STUDENTS_COLL); /** * Task 4 - Search age the employees and year the students * Finds a non-zero field and transmits processing * Uses global collection */ private void task4CompareAge(){ FindIterable<Document> iterableEmpl = docCollEmpl.find(gt(AGE_EMPLOYEER, 0)); FindIterable<Document> iterableStud = docCollStud.find(gt(YEAR_STUDENTS, 0)); findAgeEmpl(iterableEmpl); findAgeStud(iterableStud); } /** * Finds max age the employees * @param iterableEmpl all non-zero in the collection employees of documents */ private void findAgeEmpl(FindIterable<Document> iterableEmpl){ MongoCursor<Document> cursorEmpl = iterableEmpl.iterator(); Map<Integer, Document> mapDocEmpl = new TreeMap<>(); while (cursorEmpl.hasNext()) { Document documentAgeEmpl = cursorEmpl.next(); mapDocEmpl.put(documentAgeEmpl.getInteger(AGE_EMPLOYEER), documentAgeEmpl); } System.out.println(mapDocEmpl.values().toArray()[mapDocEmpl.size()-1]); } /** * Finds min age the students * @param iterableStud all non-zero in the collection students of documents */ private void findAgeStud(FindIterable<Document> iterableStud){ MongoCursor<Document> cursorStud = iterableStud.iterator(); Map<Integer, Document> mapDocStud = new TreeMap<>(); while (cursorStud.hasNext()) { Document documentAgeStud = cursorStud.next(); mapDocStud.put(documentAgeStud.getInteger(YEAR_STUDENTS), documentAgeStud); } System.out.println(mapDocStud.values().toArray()[mapDocStud.size()-1]); } /** * Task 5 - update age of all employees and the training course for all students * @param newYear year which want to change */ private void task5UpdateNewYear(int newYear){ if(year!=newYear){ updateAgeEmpl(newYear-year); updateCourseStud(newYear-year); } year = newYear; } /** * Updates the age of employees * @param difference how many years have passed (the difference) */ private void updateAgeEmpl(int difference){ FindIterable<Document> iterable = docCollEmpl.find(gt(AGE_EMPLOYEER, 0)); MongoCursor<Document> cursor = iterable.iterator(); while (cursor.hasNext()) { Document documentNewAgeEmpl = cursor.next(); Document documentOldAgeEmpl = new Document(documentNewAgeEmpl); documentNewAgeEmpl.replace(AGE_EMPLOYEER,documentNewAgeEmpl.getInteger(AGE_EMPLOYEER)+difference); docCollEmpl.updateOne(documentOldAgeEmpl, new Document("$set", new Document(documentNewAgeEmpl))); } } /** * Updates the course of students * @param difference how many years have passed (the difference) */ private void updateCourseStud(int difference){ FindIterable<Document> iterable = docCollEmpl.find(gt(COURSE_STUDENTS, 0)); MongoCursor<Document> cursor = iterable.iterator(); while (cursor.hasNext()) { Document documentNewCourseStud = cursor.next(); Document documentOldCourseStud = new Document(documentNewCourseStud); documentNewCourseStud.replace(COURSE_STUDENTS,documentNewCourseStud.getInteger(COURSE_STUDENTS)+difference); docCollEmpl.updateOne(documentOldCourseStud, new Document("$set", new Document(documentNewCourseStud))); } } /** * Task 8 - removes bugs in the tester */ private void task8DelBugs(){ FindIterable<Document> iterable = docCollEmpl.find(exists(BUG_EMPLOYEER)); MongoCursor<Document> cursor = iterable.iterator(); Document documentNewBugs = cursor.next(); Document documentOldBugs = new Document(documentNewBugs); List lisNewtBugs = (List) Arrays.asList(documentOldBugs.get(BUG_EMPLOYEER)).get(0); List listOldBugs = new LinkedList<>(lisNewtBugs); listOldBugs.remove(lisNewtBugs.size()-1); documentNewBugs.replace(BUG_EMPLOYEER, listOldBugs); docCollEmpl.updateOne(documentOldBugs, new Document("$set", new Document(documentNewBugs))); } /** * Task 9 - hires 2 students as developers of Big Data, for one as a manager over them */ private void task9SelectStudAndMenedgerForBigData(){ List<Document> listStud = selectStudThroughJob(); List<Document> listEmpl = selectEmplForBigData(); if(listStud.size()>=2 && !listEmpl.isEmpty()) { Document documentStud0 = new Document(listStud.get(0)); Document documentStud1 = new Document(listStud.get(1)); Document documentEmpl0 = new Document(listEmpl.get(0)); listStud.get(0).replace(JOB_STUDENTS_FIELD, JOB_STUDENTS_STATUS_EYA); listStud.get(0).append(STATUS_BIG_DATA, STATUS_BIG_DATA_STUDENTS); listStud.get(1).replace(JOB_STUDENTS_FIELD, JOB_STUDENTS_STATUS_EYA); listStud.get(1).append(STATUS_BIG_DATA, STATUS_BIG_DATA_STUDENTS); listEmpl.get(0).append(STATUS_BIG_DATA, STATUS_BIG_DATA_EMPLOYEER); docCollEmpl.updateOne(documentEmpl0, new Document("$set", new Document(listEmpl.get(0)))); docCollStud.updateOne(documentStud0, new Document("$set", new Document(listStud.get(0)))); docCollStud.updateOne(documentStud1, new Document("$set", new Document(listStud.get(1)))); } } /** * Finds unemployed students * @return selectStudThroughHobbyAndJob a list of all unemployed students */ private List<Document> selectStudThroughJob(){ List<Document> listStudThroughJob = new ArrayList<>(); FindIterable<Document> iterable = docCollStud.find(exists(JOB_STUDENTS_FIELD)); MongoCursor<Document> cursor = iterable.iterator(); while (cursor.hasNext()) { Document documentJobStud = cursor.next(); if (documentJobStud.get(JOB_STUDENTS_FIELD).equals(JOB_STUDENTS_STATUS_NOPE)) listStudThroughJob.add(documentJobStud); } return selectStudThroughHobbyAndJob(listStudThroughJob); } /** * Looking for students with a hobby programming * @param listStudThroughJob a list of all unemployed students * @return listStudThroughJob a list of all unemployed students */ private List<Document> selectStudThroughHobbyAndJob(List<Document> listStudThroughJob){ return listStudThroughJob.stream().filter((documentJobAndHobbyStud) -> (documentJobAndHobbyStud.get(STUDENTS_HOBBY_FIELD)).equals(STUDENTS_HOBBY_PROGRAMMING)).collect(Collectors.toList()); } /** * Looking for all the managers of the developers * @return listEmplForBD a list of all managers */ private List<Document> selectEmplForBigData(){ List<Document> listEmplForBD = new ArrayList<>(); FindIterable<Document> iterable = docCollEmpl.find(exists(PROFILE_EMPLOYEER_FIELD)); MongoCursor<Document> cursor = iterable.iterator(); while (cursor.hasNext()) { Document documentJobStud = cursor.next(); if (documentJobStud.get(PROFILE_EMPLOYEER_FIELD).equals(PROFILE_EMPLOYEER_MANAGER)) listEmplForBD.add(documentJobStud); } return listEmplForBD; } private void task10CreateIndex(){ docCollEmpl.createIndex(new BasicDBObject("name", 1)); docCollStud.createIndex(new BasicDBObject("name", 1)); } public static void main(String [] argc){ Mongo mongo = new Mongo(); //mongo.task4CompareAge(); //mongo.task5UpdateNewYear(2016); //mongo.task8DelBugs(); //mongo.task9SelectStudAndMenedgerForBigData(); //mongo.task10CreateIndex(); } }
9,872
0.683912
0.677724
232
41.491379
32.07494
133
false
false
0
0
0
0
0
0
0.590517
false
false
13
e680fc65a42a39c581421ef8ae412e7adcc9e853
33,045,478,399,061
b95a53be385bbda9466b4967cade568eab9e867d
/src/logic/index/Indexer.java
96db234168917037d0cb56e5a40e3ce169b55a09
[]
no_license
claterza/ClinicalDecisionSupport
https://github.com/claterza/ClinicalDecisionSupport
ac29d0aaba31cd17be8e0c07326a6b3d569de74e
abba2ad1125f64cebb89787448e4f630be02bd9c
refs/heads/master
2020-04-12T09:33:02.422000
2017-05-23T23:25:54
2017-05-23T23:25:54
61,324,706
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package logic.index; import java.io.IOException; /** * Created by claterza on 6/16/16. */ public interface Indexer { void indexDirectory (String fileName) throws IOException; }
UTF-8
Java
185
java
Indexer.java
Java
[ { "context": "x;\n\nimport java.io.IOException;\n\n/**\n * Created by claterza on 6/16/16.\n */\npublic interface Indexer {\n vo", "end": 77, "score": 0.999592125415802, "start": 69, "tag": "USERNAME", "value": "claterza" } ]
null
[]
package logic.index; import java.io.IOException; /** * Created by claterza on 6/16/16. */ public interface Indexer { void indexDirectory (String fileName) throws IOException; }
185
0.72973
0.702703
10
17.5
19.074852
61
false
false
0
0
0
0
0
0
0.3
false
false
13
c108bd0fec43b113daf13fc6e108a00fec39c0a0
8,538,395,027,829
b91b86cac5a369a7ed1d79a6052a9005e19dc295
/04-Linked-List/src/cn/mtianyan/linked/LinkedList.java
65fb0a92fd39fcdee9c7ad6e1867af0730451c5a
[ "Apache-2.0" ]
permissive
mtianyan/Play-with-Data-Structures-mtianyan
https://github.com/mtianyan/Play-with-Data-Structures-mtianyan
2e4f3a976813d1d94b57263c77208a029ca979d4
e727f0f26c0758609b501020499bfd7895c8e0ae
refs/heads/master
2018-11-29T14:23:17.966000
2018-09-05T14:38:15
2018-09-05T14:38:15
144,076,733
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.mtianyan.linked; public class LinkedList<E> { /** * Node 节点类(private 不被用户感知) */ private class Node { public E e; public Node next; // c++实现时是指针 /** * 传入元素e以及next节点的构造函数 * * @param e * @param next */ public Node(E e, Node next) { this.e = e; this.next = next; } /** * 只传入元素e,next置空。构造函数 * * @param e */ public Node(E e) { this.e = e; this.next = null; } /** * 默认构造函数,节点元素,next均为空。 */ public Node() { this(null, null); } /** * 打印节点元素信息。 * * @return */ @Override public String toString() { return e.toString(); } } private Node dummyHead; // 虚拟头结点 private int size; // 链表元素个数 /** * 链表默认构造函数,空链表是包含一个虚拟头结点的。 */ public LinkedList() { dummyHead = new Node(null, null); size = 0; } /** * 从数组创建链表的方法。 * * @param arr */ public LinkedList(E[] arr) { this(); // 创建出虚拟头结点 if (arr == null || arr.length == 0) throw new IllegalArgumentException("arr can not be empty"); Node cur = new Node(arr[0]); // 当前节点是真实头结点 dummyHead.next = cur; // 将虚拟头结点与真实头结点连接 size++; for (int i = 1; i < arr.length; i++) { cur.next = new Node(arr[i]); cur = cur.next; size++; } } /** * 获取链表中元素个数 * * @return */ public int getSize() { return size; } /** * 返回链表是否为空 * * @return */ public boolean isEmpty() { return size == 0; } /** * 在链表的index(0-based)位置添加新的元素e * 在链表中不是一个常用的操作,练习题用,面试用。 * * @param index * @param e */ public void add(int index, E e) { // index可以取到size,在链表末尾空位置添加元素。 if (index < 0 || index > size) { throw new IllegalArgumentException("Add failed. Illegal index"); } Node prevNode = dummyHead; // 因为有了dummyHead,多遍历一次,遍历index次 for (int i = 0; i < index; i++) { // 验证。 12 index 1添加,index-1=0一次也不执行,正好是head。符合 // 验证。 1234 index 2添加,index-1=1 运行一次pre指向head下一个也就是2,符合。 prevNode = prevNode.next; } // Node insertNode = new Node(e); // insertNode.next = prevNode.next; // prevNode.next = insertNode; prevNode.next = new Node(e, prevNode.next); // 后半截是前两句完成任务 size++; } /** * 在链表头添加新元素e */ public void addFirst(E e) { add(0, e); } /** * 在链表末尾添加新的元素e */ public void addLast(E e) { add(size, e); } /** * 获得链表的第index(0-based)位置元素 * 链表中不是常用操作,练习用 * * @param index * @return */ public E get(int index) { // index不可以取到size,索引从0开始,最多取到size-1 if (index < 0 || index >= size) { throw new IllegalArgumentException("Add failed. Illegal index"); } Node cur = dummyHead.next; // 从索引为0元素开始 // 下面与找index-1个节点保持一致。上面执行了一次。所以从index-1个元素变成了找index个元素。 for (int i = 0; i < index; i++) { cur = cur.next; } return cur.e; } /** * 获取链表中第一个元素(index 0) * * @return */ public E getFirst() { return get(0); } /** * 获取链表中最后一个元素(index size-1) * * @return */ public E getLast() { return get(size - 1); } /** * 修改链表的第index(0-based)个位置的元素为e * 在链表中不是一个常用的操作,练习用 */ public void set(int index, E e) { // index不可以取到size,索引从0开始,最多取到size-1 if (index < 0 || index >= size) { throw new IllegalArgumentException("Set failed. Illegal index"); } Node cur = dummyHead.next; // 从索引为0元素开始 // 下面与找index-1个节点保持一致。上面执行了一次。所以从index-1个元素变成了找index个元素。 for (int i = 0; i < index; i++) { cur = cur.next; } cur.e = e; } /** * 查找链表中是否有元素e */ public boolean contains(E e) { Node cur = dummyHead.next; while (cur != null) { if (cur.e.equals(e)) { return true; } cur = cur.next; } return false; } /** * 删除链表中指定index位置的元素 * * @param index * @return */ public E remove(int index) { if (index < 0 || index >= size) { throw new IllegalArgumentException("Set failed. Illegal index"); } Node prev = dummyHead; for (int i = 0; i < index; i++) { prev = prev.next; } Node retNode = prev.next; prev.next = retNode.next; retNode.next = null; size--; return retNode.e; } /** * 删除第一个元素(index 0) * * @return */ public E removeFirst() { return remove(0); } /** * 删除最后一个元素(index 1) * * @return */ public E removeLast() { return remove(size - 1); } /** * 从链表中删除元素e * * @param e */ public void removeElement(E e) { Node prev = dummyHead; while (prev.next != null) { if (prev.next.e.equals(e)) break; prev = prev.next; } if (prev.next != null) { Node delNode = prev.next; prev.next = delNode.next; delNode.next = null; size--; } } /** * 打印链表元素信息 * * @return */ @Override public String toString() { StringBuilder res = new StringBuilder(); // Node cur = dummyHead.next; // while (cur != null){ // res.append(cur.e +"->"); // cur = cur.next; // } // res.append("NULL"); res.append("head: "); for (Node cur = dummyHead.next; cur != null; cur = cur.next) { res.append(cur.e + "->"); } res.append("NULL"); return res.toString(); } }
UTF-8
Java
7,281
java
LinkedList.java
Java
[]
null
[]
package cn.mtianyan.linked; public class LinkedList<E> { /** * Node 节点类(private 不被用户感知) */ private class Node { public E e; public Node next; // c++实现时是指针 /** * 传入元素e以及next节点的构造函数 * * @param e * @param next */ public Node(E e, Node next) { this.e = e; this.next = next; } /** * 只传入元素e,next置空。构造函数 * * @param e */ public Node(E e) { this.e = e; this.next = null; } /** * 默认构造函数,节点元素,next均为空。 */ public Node() { this(null, null); } /** * 打印节点元素信息。 * * @return */ @Override public String toString() { return e.toString(); } } private Node dummyHead; // 虚拟头结点 private int size; // 链表元素个数 /** * 链表默认构造函数,空链表是包含一个虚拟头结点的。 */ public LinkedList() { dummyHead = new Node(null, null); size = 0; } /** * 从数组创建链表的方法。 * * @param arr */ public LinkedList(E[] arr) { this(); // 创建出虚拟头结点 if (arr == null || arr.length == 0) throw new IllegalArgumentException("arr can not be empty"); Node cur = new Node(arr[0]); // 当前节点是真实头结点 dummyHead.next = cur; // 将虚拟头结点与真实头结点连接 size++; for (int i = 1; i < arr.length; i++) { cur.next = new Node(arr[i]); cur = cur.next; size++; } } /** * 获取链表中元素个数 * * @return */ public int getSize() { return size; } /** * 返回链表是否为空 * * @return */ public boolean isEmpty() { return size == 0; } /** * 在链表的index(0-based)位置添加新的元素e * 在链表中不是一个常用的操作,练习题用,面试用。 * * @param index * @param e */ public void add(int index, E e) { // index可以取到size,在链表末尾空位置添加元素。 if (index < 0 || index > size) { throw new IllegalArgumentException("Add failed. Illegal index"); } Node prevNode = dummyHead; // 因为有了dummyHead,多遍历一次,遍历index次 for (int i = 0; i < index; i++) { // 验证。 12 index 1添加,index-1=0一次也不执行,正好是head。符合 // 验证。 1234 index 2添加,index-1=1 运行一次pre指向head下一个也就是2,符合。 prevNode = prevNode.next; } // Node insertNode = new Node(e); // insertNode.next = prevNode.next; // prevNode.next = insertNode; prevNode.next = new Node(e, prevNode.next); // 后半截是前两句完成任务 size++; } /** * 在链表头添加新元素e */ public void addFirst(E e) { add(0, e); } /** * 在链表末尾添加新的元素e */ public void addLast(E e) { add(size, e); } /** * 获得链表的第index(0-based)位置元素 * 链表中不是常用操作,练习用 * * @param index * @return */ public E get(int index) { // index不可以取到size,索引从0开始,最多取到size-1 if (index < 0 || index >= size) { throw new IllegalArgumentException("Add failed. Illegal index"); } Node cur = dummyHead.next; // 从索引为0元素开始 // 下面与找index-1个节点保持一致。上面执行了一次。所以从index-1个元素变成了找index个元素。 for (int i = 0; i < index; i++) { cur = cur.next; } return cur.e; } /** * 获取链表中第一个元素(index 0) * * @return */ public E getFirst() { return get(0); } /** * 获取链表中最后一个元素(index size-1) * * @return */ public E getLast() { return get(size - 1); } /** * 修改链表的第index(0-based)个位置的元素为e * 在链表中不是一个常用的操作,练习用 */ public void set(int index, E e) { // index不可以取到size,索引从0开始,最多取到size-1 if (index < 0 || index >= size) { throw new IllegalArgumentException("Set failed. Illegal index"); } Node cur = dummyHead.next; // 从索引为0元素开始 // 下面与找index-1个节点保持一致。上面执行了一次。所以从index-1个元素变成了找index个元素。 for (int i = 0; i < index; i++) { cur = cur.next; } cur.e = e; } /** * 查找链表中是否有元素e */ public boolean contains(E e) { Node cur = dummyHead.next; while (cur != null) { if (cur.e.equals(e)) { return true; } cur = cur.next; } return false; } /** * 删除链表中指定index位置的元素 * * @param index * @return */ public E remove(int index) { if (index < 0 || index >= size) { throw new IllegalArgumentException("Set failed. Illegal index"); } Node prev = dummyHead; for (int i = 0; i < index; i++) { prev = prev.next; } Node retNode = prev.next; prev.next = retNode.next; retNode.next = null; size--; return retNode.e; } /** * 删除第一个元素(index 0) * * @return */ public E removeFirst() { return remove(0); } /** * 删除最后一个元素(index 1) * * @return */ public E removeLast() { return remove(size - 1); } /** * 从链表中删除元素e * * @param e */ public void removeElement(E e) { Node prev = dummyHead; while (prev.next != null) { if (prev.next.e.equals(e)) break; prev = prev.next; } if (prev.next != null) { Node delNode = prev.next; prev.next = delNode.next; delNode.next = null; size--; } } /** * 打印链表元素信息 * * @return */ @Override public String toString() { StringBuilder res = new StringBuilder(); // Node cur = dummyHead.next; // while (cur != null){ // res.append(cur.e +"->"); // cur = cur.next; // } // res.append("NULL"); res.append("head: "); for (Node cur = dummyHead.next; cur != null; cur = cur.next) { res.append(cur.e + "->"); } res.append("NULL"); return res.toString(); } }
7,281
0.452654
0.44491
297
19.872053
16.512941
76
false
false
0
0
0
0
0
0
0.353535
false
false
13
0e8c1575c86225d50a830cdd2e462807838752a3
31,490,700,240,778
45ecd6ecdbc5ede076dec8bbab422ed6b1871e79
/NMBS/src/main/java/com/nmbs/activities/PDFViewActivity.java
9f02c6b93556321c1fbcf7626c96da1f579c3f01
[]
no_license
DavidShi1017/AndroidR9
https://github.com/DavidShi1017/AndroidR9
ddc69fa2bbfb2dbe85b999362e7b931a9e69a389
7bd925354afe11666d174550bedd57471d72c7d4
refs/heads/master
2020-03-26T13:38:26.887000
2019-12-27T08:05:13
2019-12-27T08:05:13
144,949,333
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Copyright 2016 Bartosz Schiller * <p/> * 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 * <p/> * http://www.apache.org/licenses/LICENSE-2.0 * <p/> * 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.nmbs.activities; import android.app.Activity; import android.app.ProgressDialog; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.provider.OpenableColumns; import android.support.annotation.NonNull; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.Window; import android.widget.Toast; import com.github.barteksc.pdfviewer.PDFView; import com.github.barteksc.pdfviewer.listener.OnErrorListener; import com.github.barteksc.pdfviewer.listener.OnLoadCompleteListener; import com.github.barteksc.pdfviewer.listener.OnPageChangeListener; import com.github.barteksc.pdfviewer.scroll.DefaultScrollHandle; import com.nmbs.R; import com.nmbs.log.LogUtils; import com.nmbs.util.ActivityConstant; import com.nmbs.util.Utils; import java.io.File; import java.io.InputStream; import java.util.List; public class PDFViewActivity extends Activity implements OnPageChangeListener, OnLoadCompleteListener, OnErrorListener { private static final String TAG = PDFViewActivity.class.getSimpleName(); private final static int REQUEST_CODE = 42; public static final int PERMISSION_CODE = 200; //public static final String SAMPLE_FILE = "sample.pdf"; private static final String SAMPLE_FILE = "BEBMI_DE.pdf"; public static final String READ_EXTERNAL_STORAGE = "android.permission.READ_EXTERNAL_STORAGE"; public static final String WRITE_EXTERNAL_STORAGE = "android.permission.WRITE_EXTERNAL_STORAGE"; public static final String MOUNT_UNMOUNT_FILESYSTEMS = "android.permission.MOUNT_UNMOUNT_FILESYSTEMS"; PDFView pdfView; String assetFileName; Uri uri; Integer pageNumber = 0; String pdfFileName; File file; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); Utils.setToolBarStyle(this); final int SCREEN_ORIENTATION = getIntent().getIntExtra(ActivityConstant.SCREEN_ORIENTATION, 0); setRequestedOrientation(SCREEN_ORIENTATION); setContentView(R.layout.activity_pdf_view); ActivityCompat.requestPermissions( this, new String[]{READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE, MOUNT_UNMOUNT_FILESYSTEMS}, PERMISSION_CODE ); pdfView = (PDFView) findViewById(R.id.pdfView); file = (File)getIntent().getSerializableExtra(ActivityConstant.LOCAL_PDF_URL); assetFileName = getIntent().getStringExtra(ActivityConstant.ASSET_FILENAME); } @Override protected void onPostResume() { super.onPostResume(); if(file == null){ displayFromAsset(assetFileName); }else { displayFromFile(file); } } void launchPicker() { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("application/pdf"); try { startActivityForResult(intent, REQUEST_CODE); } catch (ActivityNotFoundException e) { //alert user that file manager not working //Toast.makeText(this, R.string.toast_pick_file_error, Toast.LENGTH_SHORT).show(); } } /* @AfterViews void afterViews() { *//*int permissionCheck = ContextCompat.checkSelfPermission(this, READ_EXTERNAL_STORAGE);*//* //if (permissionCheck != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions( this, new String[]{READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE, MOUNT_UNMOUNT_FILESYSTEMS}, PERMISSION_CODE ); //} requestWindowFeature(Window.FEATURE_NO_TITLE); *//*if (uri != null) { displayFromUri(uri); } else { File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + SAMPLE_FILE); displayFromFile(file); //displayFromAsset(SAMPLE_FILE); }*//* setTitle(pdfFileName); }*/ private void displayFromAsset(String assetFileName) { pdfFileName = assetFileName; pdfView.fromAsset(pdfFileName) .defaultPage(pageNumber) .onPageChange(this) .enableAnnotationRendering(true) .onLoad(this) .scrollHandle(new DefaultScrollHandle(this)) .load(); LogUtils.e("PDFViewActivity", "Open pdf by assetFileName---->" + assetFileName); } private void displayFromStream(InputStream inputStream) { //pdfFileName = getFileName(uri); pdfView.fromStream(inputStream) .defaultPage(pageNumber) .onPageChange(this) .enableAnnotationRendering(true) .onLoad(this) .scrollHandle(new DefaultScrollHandle(this)) .load(); } private void displayFromFile(File file) { pdfFileName = file.getName(); LogUtils.d("openPDF", "openPDF===" + pdfFileName); pdfView.fromFile(file) .defaultPage(pageNumber) .onPageChange(this) .enableAnnotationRendering(true) .onLoad(this) .onError(this) .scrollHandle(new DefaultScrollHandle(this)) .load(); } /* @OnActivityResult(REQUEST_CODE) public void onResult(int resultCode, Intent intent) { if (resultCode == RESULT_OK) { uri = intent.getData(); displayFromUri(uri); } }*/ @Override public void onPageChanged(int page, int pageCount) { pageNumber = page; setTitle(String.format("%s %s / %s", pdfFileName, page + 1, pageCount)); } public String getFileName(Uri uri) { String result = null; if (uri.getScheme().equals("content")) { Cursor cursor = getContentResolver().query(uri, null, null, null, null); try { if (cursor != null && cursor.moveToFirst()) { result = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)); } } finally { if (cursor != null) { cursor.close(); } } } if (result == null) { result = uri.getLastPathSegment(); } return result; } @Override public void loadComplete(int nbPages) { /* PdfDocument.Meta meta = pdfView.getDocumentMeta(); Log.e(TAG, "title = " + meta.getTitle()); Log.e(TAG, "author = " + meta.getAuthor()); Log.e(TAG, "subject = " + meta.getSubject()); Log.e(TAG, "keywords = " + meta.getKeywords()); Log.e(TAG, "creator = " + meta.getCreator()); Log.e(TAG, "producer = " + meta.getProducer()); Log.e(TAG, "creationDate = " + meta.getCreationDate()); Log.e(TAG, "modDate = " + meta.getModDate()); printBookmarksTree(pdfView.getTableOfContents(), "-");*/ } /* public void printBookmarksTree(List<PdfDocument.Bookmark> tree, String sep) { for (PdfDocument.Bookmark b : tree) { Log.e(TAG, String.format("%s %s, p %d", sep, b.getTitle(), b.getPageIdx())); if (b.hasChildren()) { printBookmarksTree(b.getChildren(), sep + "-"); } } }*/ /** * Listener for response to user permission request * * @param requestCode Check that permission request code matches * @param permissions Permissions that requested * @param grantResults Whether permissions granted */ @Override public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) { if (requestCode == PERMISSION_CODE) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { //launchPicker(); //File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + SAMPLE_FILE); if(file == null){ displayFromAsset(assetFileName); }else { displayFromFile(file); } } } } public static Intent createIntent(Context context, File file, String assetFileName, int screenOrientation){ Intent intent = new Intent(context, PDFViewActivity.class); //intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(ActivityConstant.LOCAL_PDF_URL, file); intent.putExtra(ActivityConstant.SCREEN_ORIENTATION, screenOrientation); intent.putExtra(ActivityConstant.ASSET_FILENAME, assetFileName); return intent; } @Override public void onError(Throwable t) { if(assetFileName != null && !assetFileName.isEmpty()){ displayFromAsset(assetFileName); } } }
UTF-8
Java
10,048
java
PDFViewActivity.java
Java
[ { "context": "/**\n * Copyright 2016 Bartosz Schiller\n * <p/>\n * Licensed under the Apache License, Ver", "end": 38, "score": 0.9998682141304016, "start": 22, "tag": "NAME", "value": "Bartosz Schiller" } ]
null
[]
/** * Copyright 2016 <NAME> * <p/> * 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 * <p/> * http://www.apache.org/licenses/LICENSE-2.0 * <p/> * 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.nmbs.activities; import android.app.Activity; import android.app.ProgressDialog; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.provider.OpenableColumns; import android.support.annotation.NonNull; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.Window; import android.widget.Toast; import com.github.barteksc.pdfviewer.PDFView; import com.github.barteksc.pdfviewer.listener.OnErrorListener; import com.github.barteksc.pdfviewer.listener.OnLoadCompleteListener; import com.github.barteksc.pdfviewer.listener.OnPageChangeListener; import com.github.barteksc.pdfviewer.scroll.DefaultScrollHandle; import com.nmbs.R; import com.nmbs.log.LogUtils; import com.nmbs.util.ActivityConstant; import com.nmbs.util.Utils; import java.io.File; import java.io.InputStream; import java.util.List; public class PDFViewActivity extends Activity implements OnPageChangeListener, OnLoadCompleteListener, OnErrorListener { private static final String TAG = PDFViewActivity.class.getSimpleName(); private final static int REQUEST_CODE = 42; public static final int PERMISSION_CODE = 200; //public static final String SAMPLE_FILE = "sample.pdf"; private static final String SAMPLE_FILE = "BEBMI_DE.pdf"; public static final String READ_EXTERNAL_STORAGE = "android.permission.READ_EXTERNAL_STORAGE"; public static final String WRITE_EXTERNAL_STORAGE = "android.permission.WRITE_EXTERNAL_STORAGE"; public static final String MOUNT_UNMOUNT_FILESYSTEMS = "android.permission.MOUNT_UNMOUNT_FILESYSTEMS"; PDFView pdfView; String assetFileName; Uri uri; Integer pageNumber = 0; String pdfFileName; File file; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); Utils.setToolBarStyle(this); final int SCREEN_ORIENTATION = getIntent().getIntExtra(ActivityConstant.SCREEN_ORIENTATION, 0); setRequestedOrientation(SCREEN_ORIENTATION); setContentView(R.layout.activity_pdf_view); ActivityCompat.requestPermissions( this, new String[]{READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE, MOUNT_UNMOUNT_FILESYSTEMS}, PERMISSION_CODE ); pdfView = (PDFView) findViewById(R.id.pdfView); file = (File)getIntent().getSerializableExtra(ActivityConstant.LOCAL_PDF_URL); assetFileName = getIntent().getStringExtra(ActivityConstant.ASSET_FILENAME); } @Override protected void onPostResume() { super.onPostResume(); if(file == null){ displayFromAsset(assetFileName); }else { displayFromFile(file); } } void launchPicker() { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("application/pdf"); try { startActivityForResult(intent, REQUEST_CODE); } catch (ActivityNotFoundException e) { //alert user that file manager not working //Toast.makeText(this, R.string.toast_pick_file_error, Toast.LENGTH_SHORT).show(); } } /* @AfterViews void afterViews() { *//*int permissionCheck = ContextCompat.checkSelfPermission(this, READ_EXTERNAL_STORAGE);*//* //if (permissionCheck != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions( this, new String[]{READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE, MOUNT_UNMOUNT_FILESYSTEMS}, PERMISSION_CODE ); //} requestWindowFeature(Window.FEATURE_NO_TITLE); *//*if (uri != null) { displayFromUri(uri); } else { File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + SAMPLE_FILE); displayFromFile(file); //displayFromAsset(SAMPLE_FILE); }*//* setTitle(pdfFileName); }*/ private void displayFromAsset(String assetFileName) { pdfFileName = assetFileName; pdfView.fromAsset(pdfFileName) .defaultPage(pageNumber) .onPageChange(this) .enableAnnotationRendering(true) .onLoad(this) .scrollHandle(new DefaultScrollHandle(this)) .load(); LogUtils.e("PDFViewActivity", "Open pdf by assetFileName---->" + assetFileName); } private void displayFromStream(InputStream inputStream) { //pdfFileName = getFileName(uri); pdfView.fromStream(inputStream) .defaultPage(pageNumber) .onPageChange(this) .enableAnnotationRendering(true) .onLoad(this) .scrollHandle(new DefaultScrollHandle(this)) .load(); } private void displayFromFile(File file) { pdfFileName = file.getName(); LogUtils.d("openPDF", "openPDF===" + pdfFileName); pdfView.fromFile(file) .defaultPage(pageNumber) .onPageChange(this) .enableAnnotationRendering(true) .onLoad(this) .onError(this) .scrollHandle(new DefaultScrollHandle(this)) .load(); } /* @OnActivityResult(REQUEST_CODE) public void onResult(int resultCode, Intent intent) { if (resultCode == RESULT_OK) { uri = intent.getData(); displayFromUri(uri); } }*/ @Override public void onPageChanged(int page, int pageCount) { pageNumber = page; setTitle(String.format("%s %s / %s", pdfFileName, page + 1, pageCount)); } public String getFileName(Uri uri) { String result = null; if (uri.getScheme().equals("content")) { Cursor cursor = getContentResolver().query(uri, null, null, null, null); try { if (cursor != null && cursor.moveToFirst()) { result = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)); } } finally { if (cursor != null) { cursor.close(); } } } if (result == null) { result = uri.getLastPathSegment(); } return result; } @Override public void loadComplete(int nbPages) { /* PdfDocument.Meta meta = pdfView.getDocumentMeta(); Log.e(TAG, "title = " + meta.getTitle()); Log.e(TAG, "author = " + meta.getAuthor()); Log.e(TAG, "subject = " + meta.getSubject()); Log.e(TAG, "keywords = " + meta.getKeywords()); Log.e(TAG, "creator = " + meta.getCreator()); Log.e(TAG, "producer = " + meta.getProducer()); Log.e(TAG, "creationDate = " + meta.getCreationDate()); Log.e(TAG, "modDate = " + meta.getModDate()); printBookmarksTree(pdfView.getTableOfContents(), "-");*/ } /* public void printBookmarksTree(List<PdfDocument.Bookmark> tree, String sep) { for (PdfDocument.Bookmark b : tree) { Log.e(TAG, String.format("%s %s, p %d", sep, b.getTitle(), b.getPageIdx())); if (b.hasChildren()) { printBookmarksTree(b.getChildren(), sep + "-"); } } }*/ /** * Listener for response to user permission request * * @param requestCode Check that permission request code matches * @param permissions Permissions that requested * @param grantResults Whether permissions granted */ @Override public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) { if (requestCode == PERMISSION_CODE) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { //launchPicker(); //File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + SAMPLE_FILE); if(file == null){ displayFromAsset(assetFileName); }else { displayFromFile(file); } } } } public static Intent createIntent(Context context, File file, String assetFileName, int screenOrientation){ Intent intent = new Intent(context, PDFViewActivity.class); //intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(ActivityConstant.LOCAL_PDF_URL, file); intent.putExtra(ActivityConstant.SCREEN_ORIENTATION, screenOrientation); intent.putExtra(ActivityConstant.ASSET_FILENAME, assetFileName); return intent; } @Override public void onError(Throwable t) { if(assetFileName != null && !assetFileName.isEmpty()){ displayFromAsset(assetFileName); } } }
10,038
0.631668
0.629678
274
35.671532
27.944708
131
false
false
0
0
0
0
0
0
0.609489
false
false
13
b518714504ae73350fa90a7806ab7c4f81ed0bd8
34,943,853,921,277
07ac8d22501b6656b54ecf099162a4b8ee2899f4
/Leetcode/55-Jump-Game.java
e7c62fefca11ebf29490ad9bdbc2d84de6ad0c5d
[]
no_license
EunHyeJung/AlgorithmStudy
https://github.com/EunHyeJung/AlgorithmStudy
41e28ee4bbb7348ee0eec43b3ef7e02426a76b21
159383c18392aee0512ec909c23fcd2a604326e1
refs/heads/master
2022-06-30T09:49:38.192000
2022-06-28T12:44:21
2022-06-28T12:44:21
138,526,152
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * @source https://leetcode.com/problems/jump-game/ * @author EunHyeJung * @email ehye826@gmail.com * @date 2021.01.17 */ class Solution { public boolean canJump(int[] nums) { int n = nums.length; if (n == 1) return true; int maxI = nums[0]; for(int i = 1 ; i < n; i++) { if (i > maxI) return false; maxI = Math.max(maxI, i + nums[i]); } return true; } }
UTF-8
Java
448
java
55-Jump-Game.java
Java
[ { "context": "https://leetcode.com/problems/jump-game/\n* @author EunHyeJung\n* @email ehye826@gmail.com\n* @date 2021.01.17\n*/\n", "end": 74, "score": 0.9998869895935059, "start": 64, "tag": "NAME", "value": "EunHyeJung" }, { "context": "/problems/jump-game/\n* @author EunHyeJung\n...
null
[]
/* * @source https://leetcode.com/problems/jump-game/ * @author EunHyeJung * @email <EMAIL> * @date 2021.01.17 */ class Solution { public boolean canJump(int[] nums) { int n = nums.length; if (n == 1) return true; int maxI = nums[0]; for(int i = 1 ; i < n; i++) { if (i > maxI) return false; maxI = Math.max(maxI, i + nums[i]); } return true; } }
438
0.504464
0.473214
19
22.578947
15.294704
50
false
false
0
0
0
0
0
0
0.473684
false
false
13
e49e45bff0654665bf580db9a6e589728d979a08
34,248,069,235,260
0fbd285ba378b8f5c39648d52f39e7a1b1cf2b4c
/equipmentmonitor-admin/src/main/java/com/xywg/equipmentmonitor/modular/lift/vo/ProjectLiftAlarmInfoVO.java
85ea94df007b5fa596832aba41331af8b2973f06
[]
no_license
bellmit/crane
https://github.com/bellmit/crane
04b5008ca46f04bf4eeb1cb9559d12f16872c83b
a9ed1e45279346b9f2aedd5d31e10bf052194fca
refs/heads/master
2023-08-26T17:57:18.564000
2019-10-22T13:38:43
2019-10-22T13:38:43
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.xywg.equipmentmonitor.modular.lift.vo; import java.util.List; import com.xywg.equipmentmonitor.modular.lift.model.ProjectLiftAlarmInfo; import lombok.Data; /** * <p> * * </p> * * @author changmengyu * @since 2018-08-26 */ @Data public class ProjectLiftAlarmInfoVO { private static final long serialVersionUID = 1L; private List<ProjectLiftAlarmInfo> alarmList; private Integer total; }
UTF-8
Java
429
java
ProjectLiftAlarmInfoVO.java
Java
[ { "context": "lombok.Data;\n\n/**\n * <p>\n * \n * </p>\n *\n * @author changmengyu\n * @since 2018-08-26\n */\n@Data\npublic class Proje", "end": 220, "score": 0.9774414896965027, "start": 209, "tag": "USERNAME", "value": "changmengyu" } ]
null
[]
package com.xywg.equipmentmonitor.modular.lift.vo; import java.util.List; import com.xywg.equipmentmonitor.modular.lift.model.ProjectLiftAlarmInfo; import lombok.Data; /** * <p> * * </p> * * @author changmengyu * @since 2018-08-26 */ @Data public class ProjectLiftAlarmInfoVO { private static final long serialVersionUID = 1L; private List<ProjectLiftAlarmInfo> alarmList; private Integer total; }
429
0.722611
0.701632
25
16.16
20.334562
73
false
false
0
0
0
0
0
0
0.28
false
false
13
7d2a895eea07a5e2c0fb54717277ddb1588ad657
10,806,137,760,077
162957f873141004f25db19c72a6626af9edc412
/src/dbUtil/DBUtil.java
952e05e3850f5a121fae285a704c0833d2a4e1c7
[]
no_license
EBignardi/GestionalePizzeria
https://github.com/EBignardi/GestionalePizzeria
4879639546865edd07e43624f1c038df31df9e91
4b816eb909cfbdca3fdd83007eb679326a516292
refs/heads/master
2021-11-10T19:23:04.482000
2021-11-04T15:21:35
2021-11-04T15:21:35
248,183,697
2
1
null
false
2020-07-29T19:52:21
2020-03-18T09:05:46
2020-07-28T14:49:49
2020-07-28T21:00:06
24,118
0
0
2
Java
false
false
package dbUtil; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.sql.rowset.CachedRowSet; import javax.sql.rowset.*; public class DBUtil { private static final String JDBC_DRIVER = "org.sqlite.JDBC"; private static Connection conn = null; private static final String connStr = "jdbc:sqlite:Prova01"; public static void dbConnect() throws SQLException,ClassNotFoundException{ try { Class.forName(JDBC_DRIVER); } catch(ClassNotFoundException e) { System.out.println("Where is your mysql jdbc driver?"); e.printStackTrace(); throw e; } System.out.println("JDBC Driver has been registered"); try { conn = DriverManager.getConnection(connStr); System.out.println(conn); } catch(SQLException e) { System.out.println("Connection failed Check output console: "+e); throw e; } } public static void dbDisconnect() throws SQLException{ try { if(conn != null && !conn.isClosed()) { conn.close(); } } catch(Exception e) { throw e; } } public static void dbExcecuteQuery(String sqlStmt) throws SQLException, ClassNotFoundException{ Statement stmt = null; try { dbConnect(); stmt = conn.createStatement(); stmt.executeUpdate(sqlStmt); } catch(SQLException e) { System.out.println("Problem occurred at dbExecuteQuery op "+e); throw e; } finally { if(stmt != null) { stmt.close(); } dbDisconnect(); } } public static ResultSet dbExecute(String sqlQuery) throws ClassNotFoundException, SQLException{ Statement stmt = null; ResultSet rs = null; CachedRowSet crs = null; try { dbConnect(); stmt = conn.createStatement(); rs = stmt.executeQuery(sqlQuery); crs = RowSetProvider.newFactory().createCachedRowSet(); crs.populate(rs); } catch(SQLException e) { System.out.println("Error occure in dbExecute Op. "+e); throw e; } finally { if(rs != null) { rs.close(); } if(stmt != null) { stmt.close(); } dbDisconnect(); } return crs; } }
UTF-8
Java
2,216
java
DBUtil.java
Java
[]
null
[]
package dbUtil; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.sql.rowset.CachedRowSet; import javax.sql.rowset.*; public class DBUtil { private static final String JDBC_DRIVER = "org.sqlite.JDBC"; private static Connection conn = null; private static final String connStr = "jdbc:sqlite:Prova01"; public static void dbConnect() throws SQLException,ClassNotFoundException{ try { Class.forName(JDBC_DRIVER); } catch(ClassNotFoundException e) { System.out.println("Where is your mysql jdbc driver?"); e.printStackTrace(); throw e; } System.out.println("JDBC Driver has been registered"); try { conn = DriverManager.getConnection(connStr); System.out.println(conn); } catch(SQLException e) { System.out.println("Connection failed Check output console: "+e); throw e; } } public static void dbDisconnect() throws SQLException{ try { if(conn != null && !conn.isClosed()) { conn.close(); } } catch(Exception e) { throw e; } } public static void dbExcecuteQuery(String sqlStmt) throws SQLException, ClassNotFoundException{ Statement stmt = null; try { dbConnect(); stmt = conn.createStatement(); stmt.executeUpdate(sqlStmt); } catch(SQLException e) { System.out.println("Problem occurred at dbExecuteQuery op "+e); throw e; } finally { if(stmt != null) { stmt.close(); } dbDisconnect(); } } public static ResultSet dbExecute(String sqlQuery) throws ClassNotFoundException, SQLException{ Statement stmt = null; ResultSet rs = null; CachedRowSet crs = null; try { dbConnect(); stmt = conn.createStatement(); rs = stmt.executeQuery(sqlQuery); crs = RowSetProvider.newFactory().createCachedRowSet(); crs.populate(rs); } catch(SQLException e) { System.out.println("Error occure in dbExecute Op. "+e); throw e; } finally { if(rs != null) { rs.close(); } if(stmt != null) { stmt.close(); } dbDisconnect(); } return crs; } }
2,216
0.649819
0.648917
95
21.326315
21.448318
96
false
false
0
0
0
0
0
0
2.494737
false
false
13
8fde1bdf5edbc348537a8f0aef69520e008779ef
17,703,855,230,668
97e3a14a462581353ddcd5220d38b4be7dee36f2
/src/fr/codneutro/darkrpmanager/view/label/StdLabel.java
983836d1e39191a135c6f0e9cad7856693dbfd58
[]
no_license
boissierflorian/DarkRP-Manager
https://github.com/boissierflorian/DarkRP-Manager
cdd1ad56c10d2154d71ecc37d476bb9e1ae624f2
4f7af352704b197c97806c605d7b21fe3bad39ae
refs/heads/master
2017-12-04T11:57:59.488000
2017-02-26T14:10:45
2017-02-26T14:10:45
83,210,228
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package fr.codneutro.darkrpmanager.view.label; import javax.swing.JLabel; import fr.codneutro.darkrpmanager.view.Fonts; public class StdLabel extends JLabel { public StdLabel() { this(""); } public StdLabel(String content) { super(content); setFont(Fonts.STD_LABEL); } /** Serial UID */ private static final long serialVersionUID = 1L; }
UTF-8
Java
383
java
StdLabel.java
Java
[]
null
[]
package fr.codneutro.darkrpmanager.view.label; import javax.swing.JLabel; import fr.codneutro.darkrpmanager.view.Fonts; public class StdLabel extends JLabel { public StdLabel() { this(""); } public StdLabel(String content) { super(content); setFont(Fonts.STD_LABEL); } /** Serial UID */ private static final long serialVersionUID = 1L; }
383
0.67624
0.673629
20
18.15
17.097588
52
false
false
0
0
0
0
0
0
0.5
false
false
13
21875a82b82b652e41ca4be571ae90b48fd3f9ff
13,924,284,004,075
5c9475fa5216882fc39630a9af5ea81175449b7d
/src/test/java/no/saua/remock/DisableLazyInitTest_AllLazy.java
fde768d90515eaa6e501448657af62cdd17d04c9
[ "MIT" ]
permissive
ksaua/remock
https://github.com/ksaua/remock
7009f32b8c9b9e11d407169f283ab794cf83774a
096f6910da735b6a48263ae0b66bd10a06f485ec
refs/heads/master
2022-05-09T02:38:58.790000
2022-04-05T16:08:42
2022-04-05T16:08:42
31,224,874
24
5
null
null
null
null
null
null
null
null
null
null
null
null
null
package no.saua.remock; import org.junit.Test; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.stereotype.Service; import org.springframework.test.context.ContextConfiguration; import javax.annotation.PostConstruct; import static org.junit.Assert.assertEquals; /** * All beans are by default lazy - except anything in the {@link ContextConfiguration} which for this class is the * default {@link TestConfig}. */ @ContextConfiguration public class DisableLazyInitTest_AllLazy extends CommonTest { @Test public void test() { assertEquals(true, TestConfig.postConstructCalled.get()); } @Configuration @Import(LazyService.class) public static class TestConfig { static ThreadLocal<Boolean> postConstructCalled = ThreadLocal.withInitial(() -> Boolean.FALSE); @PostConstruct public void post() { postConstructCalled.set(Boolean.TRUE); } } @Service public static class LazyService { @PostConstruct public void post() { throw new AssertionError("Should not be called"); } } }
UTF-8
Java
1,201
java
DisableLazyInitTest_AllLazy.java
Java
[]
null
[]
package no.saua.remock; import org.junit.Test; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.stereotype.Service; import org.springframework.test.context.ContextConfiguration; import javax.annotation.PostConstruct; import static org.junit.Assert.assertEquals; /** * All beans are by default lazy - except anything in the {@link ContextConfiguration} which for this class is the * default {@link TestConfig}. */ @ContextConfiguration public class DisableLazyInitTest_AllLazy extends CommonTest { @Test public void test() { assertEquals(true, TestConfig.postConstructCalled.get()); } @Configuration @Import(LazyService.class) public static class TestConfig { static ThreadLocal<Boolean> postConstructCalled = ThreadLocal.withInitial(() -> Boolean.FALSE); @PostConstruct public void post() { postConstructCalled.set(Boolean.TRUE); } } @Service public static class LazyService { @PostConstruct public void post() { throw new AssertionError("Should not be called"); } } }
1,201
0.712739
0.712739
43
26.930233
27.300562
114
false
false
0
0
0
0
0
0
0.302326
false
false
13
050a3242bd725bf5d6ce9312a71f94e2a9c29b68
2,740,189,158,742
1b41291031cd7177a9313483004eb4e0b3b3d818
/src/mid2019/music/Duration.java
445addaf0d7e9f94cb1b363cb033a7a651976493
[]
no_license
yejeelee/Music-Notation-System
https://github.com/yejeelee/Music-Notation-System
9259671e5d49f305ac241e2dce29f0242bb571ef
3773d70a663a49c9d5d2718a4cf45780e43113be
refs/heads/master
2020-08-18T01:24:57.907000
2020-03-02T11:19:46
2020-03-02T11:19:46
214,577,247
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package mid2019.music; import java.awt.Graphics; import mid2019.reaction.Mass; public abstract class Duration extends Mass { public int nDot = 0, nFlag = 0; public Duration() { super("NOTE"); } public abstract void show(Graphics g); public void incFlag() { if (nFlag < 4) { nFlag++; } } public void decFlag() { if (nFlag > -2) { nFlag--; } } // nFlag == 0: quarter note // nFlag == -1: half note // nFlag == -2: whole stem public void cycleDot() { nDot++; if (nDot > 3) { nDot = 0; } } }
UTF-8
Java
531
java
Duration.java
Java
[]
null
[]
package mid2019.music; import java.awt.Graphics; import mid2019.reaction.Mass; public abstract class Duration extends Mass { public int nDot = 0, nFlag = 0; public Duration() { super("NOTE"); } public abstract void show(Graphics g); public void incFlag() { if (nFlag < 4) { nFlag++; } } public void decFlag() { if (nFlag > -2) { nFlag--; } } // nFlag == 0: quarter note // nFlag == -1: half note // nFlag == -2: whole stem public void cycleDot() { nDot++; if (nDot > 3) { nDot = 0; } } }
531
0.596987
0.564972
28
17.964285
17.611851
56
false
false
0
0
0
0
0
0
0.392857
false
false
13
23d1b02a66519665f712b7961d25a7db00a74f51
970,662,629,218
4b6ccf23ecf6e4d2f1e9f62944acf518d4347000
/src/main/com/data/entries/FieldMeta.java
7742767c2a9656ab00d6f6d6fade6d89a30865d6
[]
no_license
bstoilov/AI-webscrapper
https://github.com/bstoilov/AI-webscrapper
7d08e37fcf51bf2b9a8510aad599ed4d39d0592e
09ce1bf7c2f9ff8a4317be57c9e1caf7277b5196
refs/heads/master
2017-12-01T11:23:08.011000
2017-11-01T15:46:17
2017-11-01T15:46:17
61,148,109
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.data.entries; import java.util.HashMap; import java.util.Map; public class FieldMeta { public static final String RAW_CSS_KEY = "rawCss"; private Map<String, String> css; private Integer count; private Map<String, String> custom = new HashMap<>(); public Integer getCount() { return count; } public void setCount(Integer count) { this.count = count; } public void addCount(Integer n) { this.count += n; } public Map<String, String> getCss() { return css; } public void setCss(Map<String, String> css) { this.css = css; } public Map<String, String> getCustom() { return custom; } public void setCustom(Map<String, String> custom) { this.custom = custom; } }
UTF-8
Java
711
java
FieldMeta.java
Java
[]
null
[]
package com.data.entries; import java.util.HashMap; import java.util.Map; public class FieldMeta { public static final String RAW_CSS_KEY = "rawCss"; private Map<String, String> css; private Integer count; private Map<String, String> custom = new HashMap<>(); public Integer getCount() { return count; } public void setCount(Integer count) { this.count = count; } public void addCount(Integer n) { this.count += n; } public Map<String, String> getCss() { return css; } public void setCss(Map<String, String> css) { this.css = css; } public Map<String, String> getCustom() { return custom; } public void setCustom(Map<String, String> custom) { this.custom = custom; } }
711
0.687764
0.687764
40
16.775
17.129635
54
false
false
0
0
0
0
0
0
1.3
false
false
13
6df30de5670a7ad2fce9496e6758e2677481b822
33,784,212,752,412
5b325db5b5fc471281e930aa6ca9756807af1b2f
/back-end/src/main/java/com/example/searchHashtag/models/Hashtag.java
d9e87add9eae531bd9e64ce344a73beead3b316e
[]
no_license
phbelucci/hashtag-search
https://github.com/phbelucci/hashtag-search
285e64337afd5cc896055a5f4c08cfafeace1e9f
398b35ad5f2634d139eeb78d627854d41d2b8f2f
refs/heads/master
2023-08-24T17:24:55.920000
2021-09-22T07:54:49
2021-09-22T07:54:49
407,761,219
0
0
null
false
2021-09-20T00:45:35
2021-09-18T05:03:41
2021-09-18T06:21:13
2021-09-20T00:45:34
1,073
0
0
0
JavaScript
false
false
package com.example.searchHashtag.models; import javax.persistence.*; import java.io.Serializable; import java.util.List; @Entity @Table(name = "TB_HASHTAGS") public class Hashtag implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; public Hashtag(String hashtag) { this.hashtag = hashtag; } @Column( name = "hashtag", nullable = false, columnDefinition = "TEXT", unique = true ) private String hashtag; @ManyToMany(mappedBy = "hashtags") private List<User> users; public Hashtag() { } public List<User> getUsers() { return users; } public void setUsers(List<User> users) { this.users = users; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getHashtag() { return hashtag; } public void setHashtag(String hashtag) { this.hashtag = hashtag; } }
UTF-8
Java
1,050
java
Hashtag.java
Java
[]
null
[]
package com.example.searchHashtag.models; import javax.persistence.*; import java.io.Serializable; import java.util.List; @Entity @Table(name = "TB_HASHTAGS") public class Hashtag implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; public Hashtag(String hashtag) { this.hashtag = hashtag; } @Column( name = "hashtag", nullable = false, columnDefinition = "TEXT", unique = true ) private String hashtag; @ManyToMany(mappedBy = "hashtags") private List<User> users; public Hashtag() { } public List<User> getUsers() { return users; } public void setUsers(List<User> users) { this.users = users; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getHashtag() { return hashtag; } public void setHashtag(String hashtag) { this.hashtag = hashtag; } }
1,050
0.589524
0.589524
59
16.79661
15.422611
51
false
false
0
0
0
0
0
0
0.288136
false
false
13
6dad1c4464af443ef95d017fb225212fedde9199
1,073,741,872,048
e71a67c748f2bbee2a4dcc296b70c6763c64e9e8
/user_Manage3/src/com/szy/view/Login.java
a3602b59b2c9bb212c2ef06de95ce316cf466322
[]
no_license
Dreamer-szy/work
https://github.com/Dreamer-szy/work
5519b98ae93fc9230ecd20814833a4e57cd30fce
fd673e24ca47d4f70279729f273eac86a6bd8de0
refs/heads/master
2023-03-19T03:40:37.182000
2021-03-11T00:55:34
2021-03-11T00:55:34
346,531,218
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.szy.view; import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import com.szy.dao.UserDao; import com.szy.model.Info; import com.szy.model.User; import com.szy.util.DBUtil; import com.szy.util.StringUtil; import com.mysql.jdbc.Connection; import javax.swing.GroupLayout; import javax.swing.GroupLayout.Alignment; import javax.swing.JLabel; import javax.swing.JOptionPane; import java.awt.Font; import javax.swing.JPasswordField; import javax.swing.JTextArea; import javax.swing.LayoutStyle.ComponentPlacement; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JTextField; import javax.swing.ImageIcon; public class Login extends JFrame { private JPanel contentPane; private JPasswordField passwdTxt; private JTextField usernameTxt; private DBUtil dbutil = new DBUtil(); private UserDao userDao = new UserDao(); /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Login frame = new Login(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public Login() { setTitle("\u7528\u6237\u767B\u5F55"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 655, 471); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); JLabel lblNewLabel = new JLabel("\u7528\u6237\u7BA1\u7406\u7CFB\u7EDF"); lblNewLabel.setBounds(247, 64, 192, 40); lblNewLabel.setFont(new Font("华文楷体", Font.BOLD, 30)); JLabel lblNewLabel_1 = new JLabel("\u8D26\u53F7\uFF1A"); lblNewLabel_1.setIcon(new ImageIcon(Login.class.getResource("/image/\u7528\u62371.png"))); lblNewLabel_1.setBounds(74, 136, 134, 74); lblNewLabel_1.setFont(new Font("宋体", Font.PLAIN, 27)); JLabel lblNewLabel_2 = new JLabel("\u5BC6\u7801\uFF1A"); lblNewLabel_2.setIcon(new ImageIcon(Login.class.getResource("/image/\u5BC6\u78011.png"))); lblNewLabel_2.setBounds(84, 234, 150, 56); lblNewLabel_2.setFont(new Font("宋体", Font.PLAIN, 27)); passwdTxt = new JPasswordField(); passwdTxt.setBounds(223, 240, 246, 48); passwdTxt.setFont(new Font("宋体", Font.PLAIN, 23)); JButton btnNewButton = new JButton("\u767B\u5F55"); btnNewButton.setBounds(164, 327, 79, 35); btnNewButton.setFont(new Font("宋体", Font.PLAIN, 22)); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { loginActionPerformed(e); } }); JButton btnNewButton_1 = new JButton("\u91CD\u7F6E"); btnNewButton_1.setBounds(534, 375, 79, 35); btnNewButton_1.setFont(new Font("宋体", Font.PLAIN, 22)); btnNewButton_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { resetValueActionPerformed(arg0); } }); usernameTxt = new JTextField(); usernameTxt.setBounds(223, 153, 246, 44); usernameTxt.setFont(new Font("宋体", Font.PLAIN, 23)); usernameTxt.setColumns(10); JButton btnNewButton_2 = new JButton("\u6CE8\u518C"); btnNewButton_2.setBounds(360, 328, 79, 35); btnNewButton_2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { //注册 user_add infoadd = new user_add(); infoadd.setVisible(true); } }); btnNewButton_2.setFont(new Font("宋体", Font.PLAIN, 22)); contentPane.setLayout(null); contentPane.add(lblNewLabel); contentPane.add(lblNewLabel_2); contentPane.add(lblNewLabel_1); contentPane.add(usernameTxt); contentPane.add(passwdTxt); contentPane.add(btnNewButton); contentPane.add(btnNewButton_2); contentPane.add(btnNewButton_1); //居中设置 this.setLocationRelativeTo(null); } //登录 private void loginActionPerformed(ActionEvent evt) { // TODO Auto-generated method stub String username = this.usernameTxt.getText(); String passwd = new String(this.passwdTxt.getPassword()); if(StringUtil.isEmpty(username)) { JOptionPane.showMessageDialog(null, "用户名不能为空!"); return; } if(StringUtil.isEmpty(passwd)) { JOptionPane.showMessageDialog(null, "密码不能为空!"); return; } User user = new User(username,passwd); Connection con = null; try { con=(Connection) dbutil.getCon(); User currentUser = userDao.login(con, user); if(currentUser!=null) { new userFram2(currentUser).setVisible(true); }else { JOptionPane.showMessageDialog(null, "用户名密码错误!"); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } //重置事件处理 private void resetValueActionPerformed(ActionEvent evt) { // TODO Auto-generated method stub this.usernameTxt.setText(""); this.passwdTxt.setText(""); } }
GB18030
Java
5,006
java
Login.java
Java
[]
null
[]
package com.szy.view; import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import com.szy.dao.UserDao; import com.szy.model.Info; import com.szy.model.User; import com.szy.util.DBUtil; import com.szy.util.StringUtil; import com.mysql.jdbc.Connection; import javax.swing.GroupLayout; import javax.swing.GroupLayout.Alignment; import javax.swing.JLabel; import javax.swing.JOptionPane; import java.awt.Font; import javax.swing.JPasswordField; import javax.swing.JTextArea; import javax.swing.LayoutStyle.ComponentPlacement; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JTextField; import javax.swing.ImageIcon; public class Login extends JFrame { private JPanel contentPane; private JPasswordField passwdTxt; private JTextField usernameTxt; private DBUtil dbutil = new DBUtil(); private UserDao userDao = new UserDao(); /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Login frame = new Login(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public Login() { setTitle("\u7528\u6237\u767B\u5F55"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 655, 471); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); JLabel lblNewLabel = new JLabel("\u7528\u6237\u7BA1\u7406\u7CFB\u7EDF"); lblNewLabel.setBounds(247, 64, 192, 40); lblNewLabel.setFont(new Font("华文楷体", Font.BOLD, 30)); JLabel lblNewLabel_1 = new JLabel("\u8D26\u53F7\uFF1A"); lblNewLabel_1.setIcon(new ImageIcon(Login.class.getResource("/image/\u7528\u62371.png"))); lblNewLabel_1.setBounds(74, 136, 134, 74); lblNewLabel_1.setFont(new Font("宋体", Font.PLAIN, 27)); JLabel lblNewLabel_2 = new JLabel("\u5BC6\u7801\uFF1A"); lblNewLabel_2.setIcon(new ImageIcon(Login.class.getResource("/image/\u5BC6\u78011.png"))); lblNewLabel_2.setBounds(84, 234, 150, 56); lblNewLabel_2.setFont(new Font("宋体", Font.PLAIN, 27)); passwdTxt = new JPasswordField(); passwdTxt.setBounds(223, 240, 246, 48); passwdTxt.setFont(new Font("宋体", Font.PLAIN, 23)); JButton btnNewButton = new JButton("\u767B\u5F55"); btnNewButton.setBounds(164, 327, 79, 35); btnNewButton.setFont(new Font("宋体", Font.PLAIN, 22)); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { loginActionPerformed(e); } }); JButton btnNewButton_1 = new JButton("\u91CD\u7F6E"); btnNewButton_1.setBounds(534, 375, 79, 35); btnNewButton_1.setFont(new Font("宋体", Font.PLAIN, 22)); btnNewButton_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { resetValueActionPerformed(arg0); } }); usernameTxt = new JTextField(); usernameTxt.setBounds(223, 153, 246, 44); usernameTxt.setFont(new Font("宋体", Font.PLAIN, 23)); usernameTxt.setColumns(10); JButton btnNewButton_2 = new JButton("\u6CE8\u518C"); btnNewButton_2.setBounds(360, 328, 79, 35); btnNewButton_2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { //注册 user_add infoadd = new user_add(); infoadd.setVisible(true); } }); btnNewButton_2.setFont(new Font("宋体", Font.PLAIN, 22)); contentPane.setLayout(null); contentPane.add(lblNewLabel); contentPane.add(lblNewLabel_2); contentPane.add(lblNewLabel_1); contentPane.add(usernameTxt); contentPane.add(passwdTxt); contentPane.add(btnNewButton); contentPane.add(btnNewButton_2); contentPane.add(btnNewButton_1); //居中设置 this.setLocationRelativeTo(null); } //登录 private void loginActionPerformed(ActionEvent evt) { // TODO Auto-generated method stub String username = this.usernameTxt.getText(); String passwd = new String(this.passwdTxt.getPassword()); if(StringUtil.isEmpty(username)) { JOptionPane.showMessageDialog(null, "用户名不能为空!"); return; } if(StringUtil.isEmpty(passwd)) { JOptionPane.showMessageDialog(null, "密码不能为空!"); return; } User user = new User(username,passwd); Connection con = null; try { con=(Connection) dbutil.getCon(); User currentUser = userDao.login(con, user); if(currentUser!=null) { new userFram2(currentUser).setVisible(true); }else { JOptionPane.showMessageDialog(null, "用户名密码错误!"); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } //重置事件处理 private void resetValueActionPerformed(ActionEvent evt) { // TODO Auto-generated method stub this.usernameTxt.setText(""); this.passwdTxt.setText(""); } }
5,006
0.717116
0.673203
170
27.799999
20.03632
92
false
false
0
0
36
0.012255
0
0
2.611765
false
false
13
27308a0734f22acee0050757cd6ac457781bcb5d
28,965,259,504,280
5d6bbaf50372bd5bb37777bec7d3722845bc5e0b
/src/ec/edu/ups/controladores/ControladorHelicopteroMilitar.java
b6151e83b3b283a347685e0035bcb3fbb6f0a63b
[]
no_license
DennisRivadeneira07/-Practica-03-Arquitectura-MVC
https://github.com/DennisRivadeneira07/-Practica-03-Arquitectura-MVC
ea75d8ced9585500c3bb184815c6aff32be77f97
8e6f224be144ba051392183a059b3cd9485b571f
refs/heads/master
2020-05-16T14:06:20.770000
2019-04-25T15:59:03
2019-04-25T15:59:03
183,093,013
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package ec.edu.ups.controladores; import ec.edu.ups.clases.HelicopteroMilitar; import java.util.ArrayList; import java.util.List; public class ControladorHelicopteroMilitar { private List<HelicopteroMilitar> lista; private int codigo; public ControladorHelicopteroMilitar() { lista = new ArrayList<>(); codigo = 1; } public void create(HelicopteroMilitar objeto) { objeto.setCodigo(codigo); codigo++; lista.add(objeto); } public HelicopteroMilitar read(int codigo) { for (HelicopteroMilitar helicopteroMilitar : lista) { if (helicopteroMilitar.getCodigo() == codigo) { return helicopteroMilitar; } } return null; } public void update(HelicopteroMilitar objeto) { for (int i = 0; i < lista.size(); i++) { HelicopteroMilitar elemento = lista.get(i); if (elemento.getCodigo() == objeto.getCodigo()) { lista.set(i, objeto); break; } } } public void delete(int codigo) { for (int i = 0; i < lista.size(); i++) { HelicopteroMilitar elemento = lista.get(i); if (elemento.getCodigo() == codigo) { lista.remove(i); break; } } } public void imprimir() { for (int i = 0; i < lista.size(); i++) { System.out.println(lista.get(i).getAlturaDeVuelo()); } } }
UTF-8
Java
1,744
java
ControladorHelicopteroMilitar.java
Java
[]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package ec.edu.ups.controladores; import ec.edu.ups.clases.HelicopteroMilitar; import java.util.ArrayList; import java.util.List; public class ControladorHelicopteroMilitar { private List<HelicopteroMilitar> lista; private int codigo; public ControladorHelicopteroMilitar() { lista = new ArrayList<>(); codigo = 1; } public void create(HelicopteroMilitar objeto) { objeto.setCodigo(codigo); codigo++; lista.add(objeto); } public HelicopteroMilitar read(int codigo) { for (HelicopteroMilitar helicopteroMilitar : lista) { if (helicopteroMilitar.getCodigo() == codigo) { return helicopteroMilitar; } } return null; } public void update(HelicopteroMilitar objeto) { for (int i = 0; i < lista.size(); i++) { HelicopteroMilitar elemento = lista.get(i); if (elemento.getCodigo() == objeto.getCodigo()) { lista.set(i, objeto); break; } } } public void delete(int codigo) { for (int i = 0; i < lista.size(); i++) { HelicopteroMilitar elemento = lista.get(i); if (elemento.getCodigo() == codigo) { lista.remove(i); break; } } } public void imprimir() { for (int i = 0; i < lista.size(); i++) { System.out.println(lista.get(i).getAlturaDeVuelo()); } } }
1,744
0.556766
0.554473
56
29.142857
20.700611
79
false
false
0
0
0
0
0
0
0.535714
false
false
13
ef935d68ef458c9f6ee0b068332c8960e1170fe6
5,325,759,507,840
0e4550fc74942452570398df8549ef58de3e18c6
/adtech-facilitate-plus/src/main/java/cn/com/adtech/domain/medicalinformation/response/InspectionRecordShowData.java
ed0cd064903cd9573212ae4e6f80080c2bb6df5c
[]
no_license
yfy111/adtech-facilitate-plus
https://github.com/yfy111/adtech-facilitate-plus
8315461468409c4dedad2e995b0aae568a323b28
0dbb8680ab2fc077b5d9013404bcca41a684a460
refs/heads/master
2022-06-29T23:19:20.951000
2019-08-19T09:10:37
2019-08-19T09:10:37
157,667,409
0
0
null
false
2022-06-17T02:02:34
2018-11-15T07:05:55
2019-08-19T09:17:23
2022-06-17T02:02:31
1,021
0
0
1
Java
false
false
package cn.com.adtech.domain.medicalinformation.response; import lombok.Data; import java.util.List; /** * 检验记录 */ @Data public class InspectionRecordShowData { //基本信息 private InspectionRecordBaseShowData inspectionRecordBaseShowData; //检查项目参考 private List<InspectionRecordItemListShowData> inspectionRecordItemListShowData; }
UTF-8
Java
379
java
InspectionRecordShowData.java
Java
[]
null
[]
package cn.com.adtech.domain.medicalinformation.response; import lombok.Data; import java.util.List; /** * 检验记录 */ @Data public class InspectionRecordShowData { //基本信息 private InspectionRecordBaseShowData inspectionRecordBaseShowData; //检查项目参考 private List<InspectionRecordItemListShowData> inspectionRecordItemListShowData; }
379
0.783476
0.783476
19
17.473684
25.242754
84
false
false
0
0
0
0
0
0
0.263158
false
false
13