blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
395caef0c92d97e5e9a776706ce58e44ca346c62
b4bb98b88e12590340bc6b717f67b13bc547e068
/HW1 Genetic Algorithm/src/Population.java
8baa36fdee32791bf58690b9be5da230bd1984c9
[]
no_license
JrOtaku/Remix
4e17af1f06d140718f967cc9784f0c57252455ba
7f280f3297f196c986db5695f35271e3a897ce6d
refs/heads/master
2023-07-28T06:39:49.310380
2021-09-19T18:37:17
2021-09-19T18:37:17
262,246,918
0
0
null
null
null
null
UTF-8
Java
false
false
3,406
java
import java.util.ArrayList; import java.util.Arrays; import java.util.Random; public class Population { Individual[] population = new Individual[100]; Random rand = new Random(3); public Population() { for (int i=0; i<100; i++) { population[i] = new Individual(rand); } } public void getNextGen() { Individual[] oldGen = truncate(); ArrayList<Individual> nextGen = new ArrayList<Individual>(); for(int i=0; i<50; i++) { nextGen.add(new Individual(oldGen[i], rand)); nextGen.add(new Individual(oldGen[i], rand)); } for(int i=0; i<100; i++) { population[i] = nextGen.get(i); } } public void getNextGenElite() { Individual[] oldGen = truncate(); ArrayList<Individual> nextGen = new ArrayList<Individual>(); nextGen.add(oldGen[0]); nextGen.add(new Individual(oldGen[0], rand)); for(int i=1; i<50; i++) { nextGen.add(new Individual(oldGen[i], rand)); nextGen.add(new Individual(oldGen[i], rand)); } for(int i=0; i<100; i++) { population[i] = nextGen.get(i); } } public void getNextGenRankedSelection() { Individual[] oldGen = rankedSelection(); ArrayList<Individual> nextGen = new ArrayList<Individual>(); for(int i=0; i<50; i++) { nextGen.add(new Individual(oldGen[i], rand)); nextGen.add(new Individual(oldGen[i], rand)); } for(int i=0; i<100; i++) { population[i] = nextGen.get(i); } } public void getNextGenCrossover() { Individual[] oldGen = truncate(); Individual[] nextGen = crossover(oldGen); //the following code has a chance of doing a point mutation // for(int i= 0; i<100; i++) // { // nextGen[i] = new Individual(nextGen[i], rand); // } for(int i=0; i<100; i++) { population[i] = nextGen[i]; } } public Individual[] rankedSelection() { Arrays.sort(population); Individual[] ranked = new Individual[50]; for(int j=0; j<50; j++) { int index = rand.nextInt(5050); for(int i=0; i<100; i++) { if(index > (100 - i)) { index = index - (100 - i); } else { ranked[j] = population[i]; } } } return ranked; } public Individual[] crossover(Individual[] oldGen) { Individual chromosome1; Individual chromosome2; Individual[] nextGen = new Individual[100]; for(int i=0; i<100; i++) { //select two random chromosomes int index1 = rand.nextInt(50); int index2 = rand.nextInt(50); chromosome1 = oldGen[index1]; chromosome2 = oldGen[index2]; //use two selected chromosomes and cross over nextGen[i] = new Individual(chromosome1, chromosome2, rand); } return nextGen; } public Individual[] truncate() { Arrays.sort(population); Individual[] truncatedGen = new Individual[50]; for(int i=0; i<50; i++) { truncatedGen[i] = population[i]; } return truncatedGen; } public int getMax() { int max = population[1].getFitness(); for(int i=0; i<100; i++) { if (population[i].getFitness() > max) { max = population[i].getFitness(); } } return max; } public int getMin() { int min = population[1].getFitness(); for(int i=0; i<100; i++) { if(population[i].getFitness() < min) { min = population[i].getFitness(); } } return min; } public int getAverage() { int total = 0; for(int i=0; i<100; i++) { total += population[i].getFitness(); } return total/population.length; } }
[ "emilya200.ea@gmail.com" ]
emilya200.ea@gmail.com
e0a4ba7d2987628c1dd798a44755be016805fe65
689a3a9363bfd706395a9b043b2389794eb24cb2
/lib-syou/src/com/syou/chatroom/frames/SendEntityFrame.java
b7b5e6d32cb77ff871a12d16ac24ed3bbb585716
[]
no_license
SyouEthernet/ChatRoom
162a61ae00cade38e177f9ec8c118e32db763bb0
07b866d5337a4ae2263b51f01b1be73d6844b107
refs/heads/main
2023-03-13T05:05:36.092504
2021-03-02T12:23:35
2021-03-02T12:23:35
340,618,506
0
0
null
null
null
null
UTF-8
Java
false
false
1,194
java
package com.syou.chatroom.frames; import com.syou.chatroom.core.Frame; import com.syou.chatroom.core.IoArgs; import com.syou.chatroom.core.SendPacket; import java.io.IOException; import java.nio.channels.ReadableByteChannel; public class SendEntityFrame extends AbsSendPacketFrame{ private final long unConsumeEntityLength; private final ReadableByteChannel channel; SendEntityFrame(short identifier, long entityLength, ReadableByteChannel channel, SendPacket packet) { super((int)Math.min(entityLength, Frame.MAX_CAPACITY), Frame.TYPE_PACKET_ENTITY, Frame.FLAG_NONE, identifier, packet); this.unConsumeEntityLength = entityLength - bodyRemaining; this.channel = channel; } @Override protected int consumeBody(IoArgs args) throws IOException { if (packet == null) { // user canceled return args.fillEmpty(bodyRemaining); } return args.readFrom(channel); } @Override public Frame buildNextFrame() { if (unConsumeEntityLength == 0) { return null; } return new SendEntityFrame(getBodyIdentifier(), unConsumeEntityLength, channel, packet); } }
[ "syouethernet@gmail.com" ]
syouethernet@gmail.com
11b436f90c46b0d0c8a4d64db5f06647b4db8aee
eab70ad5de126ea1550552b2e9c2628c2e04b097
/src/main/java/com.questionsandanswers.java/flow/ForLoopExample.java
ba0c357c8ab5c39c9a2bdbba9dee8f8729894896
[]
no_license
mbouzas/javaquestionsandanswer
623ce1979f7dc487fdba429afa515c4eabeefb63
1926965c007c4219726eaf0ca0fd293dc3b70aca
refs/heads/main
2023-08-12T09:19:09.349851
2021-10-16T17:54:48
2021-10-16T17:54:48
417,859,675
0
0
null
null
null
null
UTF-8
Java
false
false
873
java
package com.questionsandanswers.java.flow; public class ForLoopExample { public static void main(String[] args) { // Example of a For Loop for (int i = 0; i < 10; i++) { System.out.print(i); } // Output is 0123456789 // For loop statement has 3 parts // Initialization => int i=0 // Condition => i<10 // Operation (Increment or Decrement usually) => i++ // There can be multiple statements in Initialization // or Operation seperated by commas for (int i = 0, j = 0; i < 10; i++, j--) { System.out.print(j); } // Output is 0-1-2-3-4-5-6-7-8-9 // Enhanced For Loop int[] numbers = { 1, 2, 3, 4, 5 }; for (int number : numbers) { System.out.print(number); } // Output is 12345 // Any of 3 parts in a for can be empty for (;;) { System.out.print("I will be looping for ever.."); } // Result : Infinite loop } }
[ "manuel.bouzas@toposware.com" ]
manuel.bouzas@toposware.com
6ea417e04f4b1790f6264191bf925042b86ea4e0
85fd3c9102c14e9ad974f4cf67efeb3e6695522f
/src/main/java/model/BeanComparator.java
3182976ae8af3666c0c7ff34c982aa7ff69efc8d
[]
no_license
hafizjef/RxMushaf
dcb5727db36042cd49f8b8d0fc62edcb87b04d03
1a3f92ac71540b573e877e6e23a10595ac521fe9
refs/heads/master
2021-09-15T19:19:45.690523
2018-06-09T04:35:01
2018-06-09T04:35:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,285
java
package model; import java.lang.reflect.Method; import java.util.Comparator; /** * A comparator to sort on the specified field of a given class. * <p> * Reflection is used to retrieve the data to be sorted, therefore * you must provide the Class and the method name within the class * that will be used to retrieve the data. * <p> * Several sort properties can be set: * <p> * a) ascending (default true) * b) ignore case (default true) * c) nulls last (default true) */ public class BeanComparator implements Comparator { private static final Class[] EMPTY_CLASS_ARRAY = new Class[]{}; private static final Object[] EMPTY_OBJECT_ARRAY = new Object[]{}; private Method method; private boolean isAscending; private boolean isIgnoreCase; private boolean isNullsLast = true; /* * Sort using default sort properties */ public BeanComparator(Class<?> beanClass, String methodName) { this(beanClass, methodName, true); } /* * Sort in the specified order with the remaining default properties */ BeanComparator(Class<?> beanClass, String methodName, boolean isAscending) { this(beanClass, methodName, isAscending, true); } /* * Sort in the specified order and case sensitivity with the * remaining default properties */ BeanComparator(Class<?> beanClass, String methodName, boolean isAscending, boolean isIgnoreCase) { setAscending(isAscending); setIgnoreCase(isIgnoreCase); // Make sure the method exists in the given bean class try { method = beanClass.getMethod(methodName, EMPTY_CLASS_ARRAY); } catch (NoSuchMethodException nsme) { String message = methodName + "() method does not exist"; throw new IllegalArgumentException(message); } // Make sure the method returns a value Class returnClass = method.getReturnType(); if (returnClass.getName().equals("void")) { String message = methodName + " has a void return type"; throw new IllegalArgumentException(message); } } /* * Set the sort order */ public void setAscending(boolean isAscending) { this.isAscending = isAscending; } /* * Set whether case should be ignored when sorting Strings */ public void setIgnoreCase(boolean isIgnoreCase) { this.isIgnoreCase = isIgnoreCase; } /* * Set nulls position in the sort order */ public void setNullsLast(boolean isNullsLast) { this.isNullsLast = isNullsLast; } /* * Implement the Comparable interface */ @SuppressWarnings("unchecked") public int compare(Object object1, Object object2) { Object field1 = null; Object field2 = null; try { field1 = method.invoke(object1, EMPTY_OBJECT_ARRAY); field2 = method.invoke(object2, EMPTY_OBJECT_ARRAY); } catch (Exception e) { throw new RuntimeException(e); } // Treat empty strings like nulls if (field1 instanceof String && ((String) field1).length() == 0) { field1 = null; } if (field2 instanceof String && ((String) field2).length() == 0) { field2 = null; } // Handle sorting of null values if (field1 == null && field2 == null) return 0; if (field1 == null) return isNullsLast ? 1 : -1; if (field2 == null) return isNullsLast ? -1 : 1; // Compare objects Object c1; Object c2; if (isAscending) { c1 = field1; c2 = field2; } else { c1 = field2; c2 = field1; } if (c1 instanceof Comparable) { if (c1 instanceof String && isIgnoreCase) return ((String) c1).compareToIgnoreCase((String) c2); else return ((Comparable) c1).compareTo(c2); } else // Compare as a String { if (isIgnoreCase) return c1.toString().compareToIgnoreCase(c2.toString()); else return c1.toString().compareTo(c2.toString()); } } }
[ "hafiz.jefri@gmail.com" ]
hafiz.jefri@gmail.com
21a476f14f3e91cc3e67f219d5d2bb5b6c55e494
ec7a3d41dd536f857b5777be09bc5123e4a181f0
/library/src/main/java/com/ls/library/util/KLogUtil.java
a53afc6871d032ceedf53975deef3a622897a148
[]
no_license
ls-china/android-utils
584f2cf057167c482d42c3ad6cf3a5e6fe70307f
467c0c86f70bcd4623be14c4d6d04f481f0e3b12
refs/heads/master
2021-01-13T03:42:15.431015
2016-12-24T09:06:04
2016-12-24T09:06:04
77,274,129
0
0
null
null
null
null
UTF-8
Java
false
false
1,034
java
package com.ls.library.util; import android.text.TextUtils; import android.util.Log; /** * Created by zhaokaiqiang on 15/12/11. */ public class KLogUtil { public static boolean isEmpty(String line) { return TextUtils.isEmpty(line) || line.equals("\n") || line.equals("\t") || TextUtils.isEmpty(line.trim()); } public static void printLine(String tag, boolean isTop) { if (isTop) { Log.d(tag, "╔═══════════════════════════════════════════════════════════════════════════════════════"); } else { Log.d(tag, "╚═══════════════════════════════════════════════════════════════════════════════════════"); } } }
[ "414057419@qq.com" ]
414057419@qq.com
5b4f2a05e5693152307d5c55c09c950c09bec78f
9e64aaab545e6fe858cd547633904769517e026b
/src/com/fnst/officeapply/action/CommonAction.java
8e0ca551be55b3948ddd5ff1c63307261f5910f2
[]
no_license
xunengsqlite/officeApply
d0dd1d4b6441038992bc7935a762c9defb9e1ce6
bc5fb81e0e0ee4e29bfc770fc53c308e33fa6e87
refs/heads/master
2016-09-06T11:29:44.443993
2012-04-01T08:28:16
2012-04-01T08:28:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,526
java
package com.fnst.officeapply.action; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.io.IOException; import java.util.Random; import java.util.Set; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.fnst.officeapply.common.OnlineCounter; import com.fnst.officeapply.common.ServletUtil; import com.fnst.officeapply.entity.UserInfo; import com.fnst.officeapply.exception.OfficeException; import com.fnst.officeapply.framework.ActionSupport; import com.fnst.officeapply.framework.annotation.AuthorizerRequest; import com.sun.image.codec.jpeg.JPEGCodec; import com.sun.image.codec.jpeg.JPEGImageEncoder; public class CommonAction extends ActionSupport { private String errMsg; private String adminMailAddr; public String errorPage(HttpServletRequest request) { request.setAttribute("errMsg", errMsg); request.setAttribute("adminMailAddr", adminMailAddr); return "/WEB-INF/error.jsp"; } @AuthorizerRequest public String authFailPage(HttpServletRequest request){ request.setAttribute("adminMailAddr", adminMailAddr); return "WEB-INF/authFailPage.jsp"; } @AuthorizerRequest public String showOnliner(HttpServletRequest request){ OnlineCounter onlinerCounter = OnlineCounter.getInstance(request.getSession(true).getServletContext()); Set<UserInfo> users = onlinerCounter.showOnliner(); request.setAttribute("users", users); return "WEB-INF/jsp/common/onliner.jsp"; } public String validateCode(HttpServletRequest request) throws OfficeException{ Font mFont = new Font("宋体 ", Font.PLAIN, 20); Random random = new Random(); String[] codeArray = new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" }; HttpServletResponse response = ServletUtil.getHttpServletResponse(); HttpSession session = request.getSession(true); int num1 = random.nextInt(36); int num2 = random.nextInt(36); int num3 = random.nextInt(36); int num4 = random.nextInt(36); String code = codeArray[num1] + codeArray[num2] + codeArray[num3] + codeArray[num4]; // 保存入session,用于与用户的输入进行比较. // 注意比较完之后清除session. Object[] obj = new Object[]{code, System.currentTimeMillis()}; session.setAttribute("validateCode", obj); response.setContentType("image/jpeg;charset=utf-8"); ServletOutputStream out; try { out = response.getOutputStream(); BufferedImage image = new BufferedImage(60, 20, BufferedImage.TYPE_INT_RGB); Graphics gra = image.getGraphics(); gra.setColor(Color.yellow); gra.fillRect(1, 1, 60, 20); gra.setColor(Color.black); gra.setFont(mFont); // 输出数字 char c; for (int i = 0; i < 4; i++) { c = code.charAt(i); gra.drawString(c + " ", i * 13 + 2, 18); } JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); encoder.encode(image); out.close(); } catch (IOException e) { throw new OfficeException(e); } return null; } public String getErrMsg() { return errMsg; } public void setErrMsg(String errMsg) { this.errMsg = errMsg; } public String getAdminMailAddr() { return adminMailAddr; } public void setAdminMailAddr(String adminMailAddr) { this.adminMailAddr = adminMailAddr; } }
[ "837062099@qq.com" ]
837062099@qq.com
28fd496aca12f14051c93f0fd4485b229924f4d6
3016374f9ee1929276a412eb9359c0420d165d77
/InstrumentAPK/sootOutput/com.waze_source_from_JADX/android/support/v4/graphics/drawable/DrawableWrapper.java
2d77dc58c2141445c2c997bf49cc7ba908de8f87
[]
no_license
DulingLai/Soot_Instrumenter
190cd31e066a57c0ddeaf2736a8d82aec49dadbf
9b13097cb426b27df7ba925276a7e944b469dffb
refs/heads/master
2021-01-02T08:37:50.086354
2018-04-16T09:21:31
2018-04-16T09:21:31
99,032,882
4
3
null
null
null
null
UTF-8
Java
false
false
228
java
package android.support.v4.graphics.drawable; import android.graphics.drawable.Drawable; public interface DrawableWrapper { Drawable getWrappedDrawable() throws ; void setWrappedDrawable(Drawable drawable) throws ; }
[ "laiduling@alumni.ubc.ca" ]
laiduling@alumni.ubc.ca
2c2a05f3c807d9852a03f8ec1ee8c93d47e2f7cb
b93b01b3c67d712ccb5e87149d87b3b7ab5db8ec
/src/main/java/im/juejin/alipay/sign/RSA.java
abe0ceea7d13dd39a2ba14ee4b542ffdd285bccd
[]
no_license
Wangxiaoman/juejin
2d67a7dd2ff749709d837569361bc9970ef2153e
a809e6939293cbb3aa0dd9aaf7a97a4b37661947
refs/heads/master
2020-04-03T19:07:44.095187
2018-12-25T02:20:24
2018-12-25T02:20:24
155,511,311
1
0
null
null
null
null
UTF-8
Java
false
false
4,029
java
package im.juejin.alipay.sign; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.security.KeyFactory; import java.security.PrivateKey; import java.security.PublicKey; import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.X509EncodedKeySpec; import javax.crypto.Cipher; public class RSA{ public static final String SIGN_ALGORITHMS = "SHA1WithRSA"; /** * RSA签名 * @param content 待签名数据 * @param privateKey 商户私钥 * @param input_charset 编码格式 * @return 签名值 */ public static String sign(String content, String privateKey, String input_charset) { try { PKCS8EncodedKeySpec priPKCS8 = new PKCS8EncodedKeySpec( Base64.decode(privateKey) ); KeyFactory keyf = KeyFactory.getInstance("RSA"); PrivateKey priKey = keyf.generatePrivate(priPKCS8); java.security.Signature signature = java.security.Signature .getInstance(SIGN_ALGORITHMS); signature.initSign(priKey); signature.update( content.getBytes(input_charset) ); byte[] signed = signature.sign(); return Base64.encode(signed); } catch (Exception e) { e.printStackTrace(); } return null; } /** * RSA验签名检查 * @param content 待签名数据 * @param sign 签名值 * @param ali_public_key 支付宝公钥 * @param input_charset 编码格式 * @return 布尔值 */ public static boolean verify(String content, String sign, String ali_public_key, String input_charset) { try { KeyFactory keyFactory = KeyFactory.getInstance("RSA"); byte[] encodedKey = Base64.decode(ali_public_key); PublicKey pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey)); java.security.Signature signature = java.security.Signature .getInstance(SIGN_ALGORITHMS); signature.initVerify(pubKey); signature.update( content.getBytes(input_charset) ); boolean bverify = signature.verify( Base64.decode(sign) ); return bverify; } catch (Exception e) { e.printStackTrace(); } return false; } /** * 解密 * @param content 密文 * @param private_key 商户私钥 * @param input_charset 编码格式 * @return 解密后的字符串 */ public static String decrypt(String content, String private_key, String input_charset) throws Exception { PrivateKey prikey = getPrivateKey(private_key); Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.DECRYPT_MODE, prikey); InputStream ins = new ByteArrayInputStream(Base64.decode(content)); ByteArrayOutputStream writer = new ByteArrayOutputStream(); //rsa解密的字节大小最多是128,将需要解密的内容,按128位拆开解密 byte[] buf = new byte[128]; int bufl; while ((bufl = ins.read(buf)) != -1) { byte[] block = null; if (buf.length == bufl) { block = buf; } else { block = new byte[bufl]; for (int i = 0; i < bufl; i++) { block[i] = buf[i]; } } writer.write(cipher.doFinal(block)); } return new String(writer.toByteArray(), input_charset); } /** * 得到私钥 * @param key 密钥字符串(经过base64编码) * @throws Exception */ public static PrivateKey getPrivateKey(String key) throws Exception { byte[] keyBytes; keyBytes = Base64.decode(key); PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); PrivateKey privateKey = keyFactory.generatePrivate(keySpec); return privateKey; } }
[ "wangxiaoman@ehomepay.com.cn" ]
wangxiaoman@ehomepay.com.cn
d48181d85c6a971227bf41a1292ffffd2b465ce8
5a27b5b60efa90ef0979f345adfad51300969726
/app/src/main/java/com/example/thunde91/samplesdk/TabActivity/TabActivity.java
756a4d661a0114a8d974116a2a51bc1d180bfa31
[]
no_license
imalpasha/v_androidsdk
306f3a4a50b966d9f9c6a72b4875cad3bcb6d456
9a8fd44f1199a06bd5c784d23d6eabdc644366d3
refs/heads/master
2021-05-11T01:44:38.742410
2018-01-21T13:50:24
2018-01-21T13:50:24
118,338,714
0
0
null
null
null
null
UTF-8
Java
false
false
6,652
java
package com.example.thunde91.samplesdk.TabActivity; import android.annotation.TargetApi; import android.app.Fragment; import android.content.Intent; import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.Toast; import com.example.thunde91.samplesdk.R; import com.vav.cn.listener.OnCloseFragmentListener; import butterknife.Bind; import butterknife.ButterKnife; public class TabActivity extends AppCompatActivity implements OnCloseFragmentListener { @Bind(R.id.btnVaving) Button btnVaving; @Bind(R.id.btnCoupon) Button btnCoupon; @Bind(R.id.btnLogout) Button btnLogout; private Fragment fragment; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.vav_page); ButterKnife.bind(this); btnVaving.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //frame_home_member_content.setVisibility(View.VISIBLE); Intent intent = new Intent(TabActivity.this, VavingFragment.class); startActivity(intent); //FragmentManager fragmentManager = getFragmentManager(); //FragmentTransaction ft2 = fragmentManager.beginTransaction(); //fragment = VavDirectGenerator.getInstance().goToVavingFragment(ft2, R.id.frame_home_member_content, TabActivity.this); //Intent intent = new Intent(TabActivity.this, VavingFragment.class); //startActivity(intent); } }); btnCoupon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //FragmentTransaction ft = TabActivity.this.getFragmentManager().beginTransaction(); //VavFragment vavFragment = new VavFragment(); //TabActivity.this.fragment = vavFragment; //ft.replace(R.id.frame_home_member_content, vavFragment, "VAV_Frag"); //ft.commit(); //here- //FragmentManager fragmentManager = getFragmentManager(); //FragmentTransaction ft2 = fragmentManager.beginTransaction(); //fragment = VavDirectGenerator.getInstance().goToVoucherBook(ft2, R.id.frame_home_member_content, TabActivity.this); //FragmentTransaction ft2 = TabActivity.beginTransaction(); Intent intent = new Intent(TabActivity.this, CouponFragment.class); startActivity(intent); //} //FragmentManager fragmentManager = getFragmentManager(); //FragmentTransaction ft = getFragmentManager().beginTransaction(); //Fragment prev = getFragmentManager().findFragmentByTag("dialog"); //if (prev != null) { // ft.remove(prev); //} //ft.addToBackStack(null); //CouponFragment routeListDialogFragment = CouponFragment.newInstance(); //routeListDialogFragment.show(ft, "countryListDialogFragment"); // Create and show the dialog. //DialogFragment newFragment = VavingFragment.newInstance(); //newFragment.show(getFragmentManager().beginTransaction(), "dialog"); //v routeListDialogFragment = CustomPassengerPicker.newInstance(totalAdult, totalChild, totalInfant); //routeListDialogFragment.setTargetFragment(SearchFlightFragment.this, 0); //routeListDialogFragment.show(getFragmentManager(), "passenger_qty"); } }); btnLogout.setVisibility(View.GONE); btnLogout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //doLogout(); } }); } /*public void doLogout() { VavDirectGenerator.getInstance().logout(new LogoutCallback() { @Override public void onLogoutSuccess() { SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean("just_login", false); editor.apply(); new SweetAlertDialog(TabActivity.this, SweetAlertDialog.SUCCESS_TYPE) .setTitleText("Success.") .setContentText("Successfully Logout") .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { Intent intent = new Intent(TabActivity.this, HomeActivity.class); TabActivity.this.startActivity(intent); TabActivity.this.finish(); sDialog.dismiss(); } }) .show(); } @Override public void onLogoutFailure(ErrorInfo errorInfo) { new SweetAlertDialog(TabActivity.this, SweetAlertDialog.ERROR_TYPE) .setTitleText("Error.") .setContentText("Failed To Logout") .show(); } }); }*/ @TargetApi(Build.VERSION_CODES.M) @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (fragment != null) { fragment.onRequestPermissionsResult(requestCode, permissions, grantResults); } } @Override public void onResume() { super.onResume(); final String sender; try { sender= getIntent().getExtras().getString("TEST"); //this.receiveData(); Toast.makeText(this, sender, Toast.LENGTH_SHORT).show(); }catch (Exception e){ } } @Override public void onPause() { super.onPause(); } @Override public void onCloseFragment() { Log.e("FragmentClose", "Y"); finish(); } public void onSelected(String text) { Log.e("Passed", text); } }
[ "imalpasha@gmail.com" ]
imalpasha@gmail.com
41ea1792c3825cb33279d8a3ea7297770d1e2d21
becb676f15a4a428070428f0115766af429d0627
/SimpleHttpServer.java
912a54beb244fa6c8081837ce96e048014ae8d77
[]
no_license
randomprogram/SimpleHttpServer
6451740a1245f55b38d067b10aaf4c7e511289ee
c77c9feb5c1327a5695b3b846496de0a5b5e0963
refs/heads/master
2020-05-30T14:29:35.098202
2014-04-20T23:25:53
2014-04-20T23:25:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,116
java
package mySimpleHttpServer; import java.io.*; import java.net.*; import java.util.*; /**Application class of the server, singleton pattern is used here; * This defines some global variables for the application, and is responsible for start the server * @author Deqiang Qiu * */ public class SimpleHttpServer { private String rootPath = "/Users/dqiu3/Library/Tomcat/Home/webapps"; private static String mineTypeFileName = "/Users/dqiu3/Library/Tomcat/Home/webapps/mineType.txt"; ServerSocket serverSocket; ArrayList<Socket> socketList; private int portNumber =5002; private static MimeType mineTypeMap; private static SimpleHttpServer theSingleServer; /** Constructor * */ private SimpleHttpServer() { socketList = new ArrayList<Socket>(); mineTypeMap = new MimeType(mineTypeFileName); } /**Return singleton instance */ public static SimpleHttpServer getServerInstance() { if(theSingleServer ==null) { theSingleServer = new SimpleHttpServer(); } return theSingleServer; } /** Set root path of the web server * @param rootPath */ public void setRootPath(String rootPath) { this.rootPath = rootPath; } /**Set port number of the server * @param pNumber */ public void setPortNumber(int pNumber) { portNumber = pNumber; } /**Start the server * */ public void startServer() { try{ serverSocket = new ServerSocket(portNumber); while(true) { Socket sc = serverSocket.accept(); synchronized(socketList) { socketList.add(sc); } ServletRunnable trd = new ServletRunnable(); //set properties for runnable trd.setMineType(mineTypeMap); trd.setRootPath(rootPath); trd.sc = sc; new Thread(trd).start(); } }catch (Exception e) { e.printStackTrace(); } } /** Entry point of the program * @param args */ public static void main(String[] args) { SimpleHttpServer srv = SimpleHttpServer.getServerInstance(); if(args.length>0) { srv.setRootPath(args[0]); } if(args.length>1) { srv.setPortNumber(Integer.parseInt(args[1])); } srv.startServer(); } }
[ "qiudeqiang@gmail.com" ]
qiudeqiang@gmail.com
bec3866bd280b7d71cc00c6c96b9d1c796344975
42aec0327b552495568f035829fca4e916039cb8
/src/math/fisica/Tempo.java
1036acc5c691a9b4feb02fc039f48a806613f91b
[]
no_license
rafaela2689/AppDroidMath
ba68253855f8b44457ef7c1e24a11dad4ee68492
56bf55381624bd5b3e6ebc0c788d83db72d9ef8f
refs/heads/master
2020-06-04T19:10:58.447904
2013-09-21T19:42:44
2013-09-21T19:42:44
null
0
0
null
null
null
null
IBM852
Java
false
false
171
java
package math.fisica; //polimorfismo e heranša public class Tempo extends Velocidade { public double calculavel(double s, double v){ return s/v; } }
[ "cavalcante_rafa@hotmail.com" ]
cavalcante_rafa@hotmail.com
9810e2cb3c984d31c7303f28b156cb198eb62c26
129dba2217b9e665c45820ac4999e9d06344c6f4
/app/src/main/java/com/devthion/myapplication/ingreso/VerificarEmail.java
6db6a09f98b97a05a82b9beb2f2a97aef0b08bdf
[]
no_license
devthion/Aplicacion_showroom
7e4ba4853a5af51513fadd6815701b3336769fde
63e8d145d44ea9103cb18e41fff67559796617b2
refs/heads/master
2021-03-24T20:28:49.478902
2020-05-24T01:40:51
2020-05-24T01:40:51
247,562,755
0
0
null
null
null
null
UTF-8
Java
false
false
3,088
java
package com.devthion.myapplication.ingreso; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import com.devthion.myapplication.MenuPrincipal; import com.devthion.myapplication.R; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.firestore.FirebaseFirestore; public class VerificarEmail extends AppCompatActivity { Button btnEnviarLink,btnYaVerifique; TextView etVerificarMail; FirebaseFirestore fStore; FirebaseAuth fAuth; String userID; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_verificar_email); btnEnviarLink = (Button) findViewById(R.id.btnVerificarMail); etVerificarMail =(TextView) findViewById(R.id.etVerificarMail); btnYaVerifique = (Button) findViewById(R.id.btnYaVerifique); fAuth = FirebaseAuth.getInstance(); fStore = FirebaseFirestore.getInstance(); userID = fAuth.getCurrentUser().getUid(); final FirebaseUser user = fAuth.getCurrentUser(); //PREGUNTA SI EL EMAIL HA SIDO VERIFICADO if(!user.isEmailVerified()){ btnEnviarLink.setVisibility(View.VISIBLE); etVerificarMail.setVisibility(View.VISIBLE); btnEnviarLink.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //MANDA EL MAIL NUEVAMENTE PARA QUE SE VERIFIQUE user.sendEmailVerification().addOnSuccessListener(new OnSuccessListener<Void>() { @Override public void onSuccess(Void aVoid) { Toast.makeText(VerificarEmail.this, "Se ha enviado un mail de verificacion", Toast.LENGTH_SHORT).show(); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { Log.d("tag","Email no enviado : "+e.getMessage()); } }); } }); }else { startActivity(new Intent(getApplicationContext(), MenuPrincipal.class)); } //TE MANDA AL INICIO DE SESION PARA QUE VERIFIQUES btnYaVerifique.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { FirebaseAuth.getInstance().signOut(); startActivity(new Intent(getApplicationContext(), InicioSesion.class)); finish(); } }); } }
[ "andycaabrera@users.noreply.github.com" ]
andycaabrera@users.noreply.github.com
2d4f7e5c6c3df2a395159681975ea7f8fbc351ea
e75be673baeeddee986ece49ef6e1c718a8e7a5d
/submissions/blizzard/Corpus/eclipse.jdt.ui/4881.java
46fca32bf07cb3baf473ed493be01dc164f1783e
[ "MIT" ]
permissive
zhendong2050/fse18
edbea132be9122b57e272a20c20fae2bb949e63e
f0f016140489961c9e3c2e837577f698c2d4cf44
refs/heads/master
2020-12-21T11:31:53.800358
2018-07-23T10:10:57
2018-07-23T10:10:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
207
java
package p; class A { void m() { } } class Sub extends A { @Override void m() { } } class Sub2 extends A { @Override @Deprecated void m() { } }
[ "tim.menzies@gmail.com" ]
tim.menzies@gmail.com
d277c61a566db1975f63ec3ccebd71024ce7e99e
3d3bb5649edaaaedc489bccfc4bddf479be85f94
/src/java/com/sift/votes/service/VotVotetypesServiceImpl.java
2439c7ed0e8407c433669d90c52050488b8000d4
[]
no_license
folaringbolahan/Easycoop
5d632adae2dd0c5ac80e03a73943ceb26953a6f2
41fa3506374153522bc2a75e4dd9344f37912313
refs/heads/master
2020-09-22T21:17:08.586559
2019-05-15T08:24:41
2019-05-15T08:24:41
225,322,165
0
0
null
null
null
null
UTF-8
Java
false
false
1,008
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.sift.votes.service; import com.sift.votes.dao.VotVotetypesDao; import com.sift.votes.model.VotVotetypes; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; /** * * @author Nelson Akpos */ @Service("votVotetypesService") @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) public class VotVotetypesServiceImpl implements VotVotetypesService { @Autowired private VotVotetypesDao votVotetypesDao; public List<VotVotetypes> listallvotetypes(){ return votVotetypesDao.listallvotetypes(); } public VotVotetypes getVoteTypeByid(int votetypeid){ return votVotetypesDao.getVoteTypeByid(votetypeid); } }
[ "Gbolahan.Folarin@GBOLAHAN-IT.africaprudentialregistrars.com" ]
Gbolahan.Folarin@GBOLAHAN-IT.africaprudentialregistrars.com
9b91b12b9f29fe45e4f50483ab4a3f11fdf667fe
70ddcde65ef13aa35cff6326cb5ddb8f0fc8eb8b
/src/main/java/com/bruno/minhasfinancas/model/entity/Usuario.java
8a60ea6572647d6de8fd9da82a7ab8340ad03eee
[]
no_license
brunoavs91/minhasfinancas-api
1afbe4adead1a852bdc4a338573631c2196b8ce2
75989e1bd88d009f6a6a55fb27cf9839a0b9cf37
refs/heads/main
2023-02-27T22:34:13.960886
2021-02-08T00:53:48
2021-02-08T00:53:48
332,837,828
0
0
null
null
null
null
UTF-8
Java
false
false
819
java
package com.bruno.minhasfinancas.model.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Entity @Table(name ="usuario" , schema = "financas") @Data @Builder @NoArgsConstructor @AllArgsConstructor public class Usuario { @Id @Column(name = "id") @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "nome") private String nome; @Column(name = "email") private String email; @Column(name = "senha") @JsonIgnore private String senha; }
[ "brunoav91@gmail.com" ]
brunoav91@gmail.com
73a2702358323d7287069b15cf3a3dfc6b7e8456
bee715ece40811e76509fce2889c4e1395e24a5f
/ZenSoftTask2/src/com/company/Main.java
00db4acae22ea0a37c24713857c009b71e27745b
[]
no_license
imarazapov/Task01
1eddc13e0f99630e893f1cd7e890b3c1a3766b58
7f496555dd3bb7ce2dc3e9b97664b0905dcabc30
refs/heads/master
2020-12-24T11:07:23.716750
2016-11-09T07:55:14
2016-11-09T07:55:14
73,192,036
0
0
null
null
null
null
UTF-8
Java
false
false
3,656
java
package com.company; import java.io.BufferedReader; import java.io.FileReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static void main(String[] args) throws Exception{ String file1 = "/media/hanaria/A0C43646C4361F4A1/Java Rush/fileReadWrite/pattern.txt"; String file2 = "/media/hanaria/A0C43646C4361F4A1/Java Rush/fileReadWrite/input.txt"; List<String> patternList = new ArrayList<String>(); List<String> inputList = new ArrayList<String>(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); BufferedReader patternReader = new BufferedReader(new FileReader(file1)); BufferedReader inputReader = new BufferedReader(new FileReader(file2)); bufferedReader.close(); while (patternReader.ready()) patternList.addAll(Arrays.asList(patternReader.readLine().split("\n"))); while (inputReader.ready()) inputList.addAll(Arrays.asList(inputReader.readLine().split("\n"))); System.out.println("---Pattern---"); for(String str: patternList) System.out.println(str); System.out.println("---Input---"); for(String str: inputList) System.out.println(str); System.out.println("---match exactly any pattern---"); matchExactly(patternList, inputList); System.out.println("---match optional 1---"); optional1(patternList, inputList); System.out.println("---match optional 2---"); List<String> patternVariants = new ArrayList<String>(); patternVariants=pattenExceptOne(patternList); // for(String str: patternVariants) System.out.println(str); matchExactly(patternVariants, inputList); } public static void matchExactly(List<String> pattern, List<String> input){ for (int i = 0; i < pattern.size(); i++) { for (int j = 0; j < input.size(); j++) { if(pattern.get(i).equals(input.get(j))) System.out.println(input.get(j)); } } } public static void optional1(List<String> pattern, List<String> input){ for (int i = 0; i < pattern.size(); i++) { for (int j = 0; j < input.size(); j++) { if(input.get(j).matches("(.*)" + pattern.get(i) + "(.*)")) System.out.println(input.get(j)); } } } public static List<String> pattenExceptOne(List<String> pattern){ String pat=""; List<String> list= new ArrayList<String>(); for (int i = 0; i < pattern.size(); i++) { list.add(pattern.get(i)); char[] patternArray = pattern.get(i).toCharArray(); // for(char c: patternArray) System.out.print(c); for (int k = 0; k < patternArray.length; k++) { for (int j = 0; j < patternArray.length; j++) { if(k==j) continue; else pat = pat + patternArray[j]; } list.add(pat); // System.out.println(pat); pat=""; } } /*if string has double char symbol*/ int count = 0; for (int i = 0; i < list.size(); i++) { for (int j = 0; j < list.size(); j++) { if(list.get(i).equals(list.get(j))) { count = count + 1; if (count==2) list.remove(i); } }count = 0; } return list; } }
[ "hkarilov@gmail.com" ]
hkarilov@gmail.com
dc11af92b98fe63b260a738df608d7b2a986d6bb
d6daa765a5b8a2cf13cd530cf574cc464b99116c
/shaohuashuwu/src/main/java/com/shaohuashuwu/service/impl/WorksInfoServiceImpl.java
205002626f771b3451855163db883e5d1e7ca297
[]
no_license
gengjainqiang/shaohuashuwu
be63dede1c46cb8aae2f15ca5359e24d511f411e
0c8ade6aac88fd37a0c2a0dc978f3c4a21579eb8
refs/heads/master
2022-12-22T22:30:51.154534
2020-09-23T08:59:48
2020-09-23T08:59:48
297,905,676
0
0
null
null
null
null
UTF-8
Java
false
false
2,332
java
package com.shaohuashuwu.service.impl; import com.shaohuashuwu.dao.WorksInfoDao; import com.shaohuashuwu.domain.WorksInfo; import com.shaohuashuwu.service.WorksInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * 作品信息实现类 */ //Service作用:将事务交给spring处理 @Service("worksInfoService") public class WorksInfoServiceImpl implements WorksInfoService { @Autowired private WorksInfoDao worksinfoDao; /** * 新建作品 */ public int insertworks_info(WorksInfo worksinfo){ System.out.println("业务层,添加新作品"); int sureorno = worksinfoDao.insertworks_info(worksinfo); System.out.println("是否受到影响:"+sureorno); return sureorno; } /** * 判断用户输入作品作品表是否已经存在 * @param work_name * @return */ @Override public Boolean isWorksinfo(String work_name) { int work_id = worksinfoDao.selectWorksinfobywork_name(work_name); System.out.println("输出内容:--"+work_id); if(work_id != 0){ return true; }else { return false; } } /** * 下架作品 * @param work_id * @return */ @Override public Boolean deleteworksbyId(int work_id) { int result = worksinfoDao.deleteworksbyId(work_id); System.out.println("输出内容:--"+result); if(result != 0){ return true; }else { return false; } } /** * 修改作品信息 */ @Override public Boolean updateWorksbyId(WorksInfo worksinfo) { System.out.println("修改了--"); int result = worksinfoDao.updateWorksbyId(worksinfo); System.out.println("修改了--"+result); if (result!=0){ return true; }else { return false; } } @Override public void test2(WorksInfo worksinfo) { System.out.println("业务层,test"); worksinfoDao.test2(worksinfo); } @Override public void test3(WorksInfo worksinfo) { System.out.println("业务层,test"); worksinfoDao.test3(worksinfo); } }
[ "2586957286@qq.com" ]
2586957286@qq.com
aeae0969edf7ded3853accb07b8213176907cb67
d60bd7144cb4428a6f7039387c3aaf7b295ecc77
/ScootAppSource/com/parse/OfflineStore$48$1.java
c13cf22148d055391a3eaf8b84893b54f66438eb
[]
no_license
vaquarkhan/Scoot-mobile-app
4f58f628e7e2de0480f7c41998cdc38100dfef12
befcfb58c1dccb047548f544dea2b2ee187da728
refs/heads/master
2020-06-10T19:14:25.985858
2016-12-08T04:39:10
2016-12-08T04:39:10
75,902,491
1
0
null
null
null
null
UTF-8
Java
false
false
548
java
package com.parse; import a.m; import a.o; class OfflineStore$48$1 implements m<Void, o<Void>> { OfflineStore$48$1(OfflineStore.48 param48, ParseSQLiteDatabase paramParseSQLiteDatabase) {} public o<Void> then(o<Void> paramo) { return ((o)this.this$1.val$callable.call(this.val$db)).d(new OfflineStore.48.1.2(this)).b(new OfflineStore.48.1.1(this)); } } /* Location: D:\Android\dex2jar-2.0\classes-dex2jar.jar!\com\parse\OfflineStore$48$1.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "vaquar.khan@gmail.com" ]
vaquar.khan@gmail.com
871fd1cb981a1f3d27fde062a22e3b2dc5e3d9fa
13847fb28b1b192aae7ef75da7e0287704d52dc1
/src/ApplicationGSB/controlleurs/exceptions/NonexistentEntityException.java
f6a8a2568ce1a46fbddab921ecfdba4611d2e264
[]
no_license
PlanesZwalker/GSB_PPE
d1c2c4447840d517ac37ee4317a2e98c098afdfa
5308214887a1482556869315983986efa38b5917
refs/heads/master
2021-01-11T21:20:13.655264
2017-03-09T14:44:05
2017-03-09T14:44:05
78,767,481
0
1
null
null
null
null
UTF-8
Java
false
false
317
java
package ApplicationGSB.controlleurs.exceptions; public class NonexistentEntityException extends Exception { public NonexistentEntityException(String message, Throwable cause) { super(message, cause); } public NonexistentEntityException(String message) { super(message); } }
[ "anne@jadeau.fr" ]
anne@jadeau.fr
82d4a7d18d84afc32b06a963caa1897da084fcbe
92e04c49b2927483ac4bf1619e42ca80e2dac9b4
/app/build/generated/source/r/debug/io/karim/materialtabs/R.java
f8b259090c778605ed6ac679452b0e643b758405
[]
no_license
pawarlalit29/AndroidSampleApp
1745b7ff818d52a6b05705468bdcf65917de1833
ddfd0ffde995b50bc95031946c5ee87bcfcb2a10
refs/heads/master
2021-01-01T04:33:52.948304
2016-05-26T06:11:21
2016-05-26T06:11:47
59,720,963
0
0
null
null
null
null
UTF-8
Java
false
false
4,878
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package io.karim.materialtabs; public final class R { public static final class attr { public static final int mrlRippleAlpha = 0x7f0100cf; public static final int mrlRippleColor = 0x7f0100cb; public static final int mrlRippleDelayClick = 0x7f0100d2; public static final int mrlRippleDiameter = 0x7f0100cd; public static final int mrlRippleDuration = 0x7f0100d0; public static final int mrlRippleFadeDuration = 0x7f0100d1; public static final int mrlRippleHighlightColor = 0x7f0100cc; public static final int mrlRippleInAdapter = 0x7f0100d4; public static final int mrlRippleOverlay = 0x7f0100ce; public static final int mrlRipplePersistent = 0x7f0100d3; public static final int mrlRippleRoundedCorners = 0x7f0100d5; public static final int mtIndicatorColor = 0x7f0100d6; public static final int mtIndicatorHeight = 0x7f0100d8; public static final int mtMrlRippleAlpha = 0x7f0100e3; public static final int mtMrlRippleColor = 0x7f0100df; public static final int mtMrlRippleDelayClick = 0x7f0100e6; public static final int mtMrlRippleDiameter = 0x7f0100e1; public static final int mtMrlRippleDuration = 0x7f0100e4; public static final int mtMrlRippleFadeDuration = 0x7f0100e5; public static final int mtMrlRippleHighlightColor = 0x7f0100e0; public static final int mtMrlRippleInAdapter = 0x7f0100e8; public static final int mtMrlRippleOverlay = 0x7f0100e2; public static final int mtMrlRipplePersistent = 0x7f0100e7; public static final int mtMrlRippleRoundedCorners = 0x7f0100e9; public static final int mtPaddingMiddle = 0x7f0100dd; public static final int mtSameWeightTabs = 0x7f0100db; public static final int mtTabPaddingLeftRight = 0x7f0100da; public static final int mtTextAllCaps = 0x7f0100dc; public static final int mtTextColorSelected = 0x7f0100de; public static final int mtUnderlineColor = 0x7f0100d7; public static final int mtUnderlineHeight = 0x7f0100d9; } public static final class id { public static final int mt_tab_title = 0x7f0d008b; } public static final class layout { public static final int mt_tab = 0x7f04002e; } public static final class styleable { public static final int[] MaterialRippleLayout = { 0x7f0100cb, 0x7f0100cc, 0x7f0100cd, 0x7f0100ce, 0x7f0100cf, 0x7f0100d0, 0x7f0100d1, 0x7f0100d2, 0x7f0100d3, 0x7f0100d4, 0x7f0100d5 }; public static final int MaterialRippleLayout_mrlRippleAlpha = 4; public static final int MaterialRippleLayout_mrlRippleColor = 0; public static final int MaterialRippleLayout_mrlRippleDelayClick = 7; public static final int MaterialRippleLayout_mrlRippleDiameter = 2; public static final int MaterialRippleLayout_mrlRippleDuration = 5; public static final int MaterialRippleLayout_mrlRippleFadeDuration = 6; public static final int MaterialRippleLayout_mrlRippleHighlightColor = 1; public static final int MaterialRippleLayout_mrlRippleInAdapter = 9; public static final int MaterialRippleLayout_mrlRippleOverlay = 3; public static final int MaterialRippleLayout_mrlRipplePersistent = 8; public static final int MaterialRippleLayout_mrlRippleRoundedCorners = 10; public static final int[] MaterialTabs = { 0x7f0100d6, 0x7f0100d7, 0x7f0100d8, 0x7f0100d9, 0x7f0100da, 0x7f0100db, 0x7f0100dc, 0x7f0100dd, 0x7f0100de, 0x7f0100df, 0x7f0100e0, 0x7f0100e1, 0x7f0100e2, 0x7f0100e3, 0x7f0100e4, 0x7f0100e5, 0x7f0100e6, 0x7f0100e7, 0x7f0100e8, 0x7f0100e9 }; public static final int MaterialTabs_mtIndicatorColor = 0; public static final int MaterialTabs_mtIndicatorHeight = 2; public static final int MaterialTabs_mtMrlRippleAlpha = 13; public static final int MaterialTabs_mtMrlRippleColor = 9; public static final int MaterialTabs_mtMrlRippleDelayClick = 16; public static final int MaterialTabs_mtMrlRippleDiameter = 11; public static final int MaterialTabs_mtMrlRippleDuration = 14; public static final int MaterialTabs_mtMrlRippleFadeDuration = 15; public static final int MaterialTabs_mtMrlRippleHighlightColor = 10; public static final int MaterialTabs_mtMrlRippleInAdapter = 18; public static final int MaterialTabs_mtMrlRippleOverlay = 12; public static final int MaterialTabs_mtMrlRipplePersistent = 17; public static final int MaterialTabs_mtMrlRippleRoundedCorners = 19; public static final int MaterialTabs_mtPaddingMiddle = 7; public static final int MaterialTabs_mtSameWeightTabs = 5; public static final int MaterialTabs_mtTabPaddingLeftRight = 4; public static final int MaterialTabs_mtTextAllCaps = 6; public static final int MaterialTabs_mtTextColorSelected = 8; public static final int MaterialTabs_mtUnderlineColor = 1; public static final int MaterialTabs_mtUnderlineHeight = 3; } }
[ "pawarlalit29@gmail.com" ]
pawarlalit29@gmail.com
a4752c225bd77daecdf3adc31ce9293a87645f8c
677b0dab0b8b546d4e2904a8e16600d57f5b011a
/src/main/java/spi/movieorganizer/repository/MovieOrganizerConstant.java
bd5ffe00a893b2b3982188c245260ed5bc268362
[]
no_license
devspi/movieorganizer
fec713d9a80e4b8b15f73c3bb768cb7812fae783
b49ef453923fdb71ec5ad3c8f5268b4f104a3c35
refs/heads/master
2020-05-17T23:45:06.460767
2013-12-03T08:12:20
2013-12-03T08:12:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
712
java
package spi.movieorganizer.repository; public class MovieOrganizerConstant { static { final String os = System.getProperty("os.name").toLowerCase(); if (os.indexOf("win") >= 0) MovieOrganizerConstant.MOVIEORGANIZER_ROOT_PATH = "C:/"; else if (os.indexOf("mac") >= 0) MovieOrganizerConstant.MOVIEORGANIZER_ROOT_PATH = "/Users/spi/desktop/"; MovieOrganizerConstant.MOVIE_COLLECTION_PATH = MovieOrganizerConstant.MOVIEORGANIZER_ROOT_PATH + "moviecollection.txt"; } public static String MOVIEORGANIZER_ROOT_PATH; public static String MOVIE_COLLECTION_PATH; public static String HARD_DRIVE_MACOSX = "/Volumes/WD2TO"; }
[ "cyril.mata@gmail.com" ]
cyril.mata@gmail.com
d00b2ca863ee7f4a4aa329f297bd23db5771983e
8a0e63656327e3c325a56ce339054b396c298a0b
/06 - FirstAndLast.java
a7ab7f2de3f1480b5e27eeb81d53ffe09eef3adc
[]
no_license
NicolasJavierJan/MOOCFI-JAVA-Part3
0bf5f8c5d1c861e16dede78c328cf68eb6dc8bda
8c93e7357c9fca627b0c15c0477141c1f4978c7b
refs/heads/master
2022-11-10T17:20:37.829998
2020-06-27T18:17:11
2020-06-27T18:17:11
274,684,031
0
0
null
null
null
null
UTF-8
Java
false
false
545
java
import java.util.ArrayList; import java.util.Scanner; public class FirstAndLast { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); ArrayList<String> list = new ArrayList<>(); while (true) { String input = scanner.nextLine(); if (input.equals("")) { break; } list.add(input); } int size = list.size(); System.out.println(list.get(0)); System.out.println(list.get(size - 1)); } }
[ "nicolasjavierjan@gmail.com" ]
nicolasjavierjan@gmail.com
c0f848e56616724ca763f00c5cc1ffc6f878acc3
b3d68fab4c112df5511b1a7efdf9f7afac64f340
/src/main/java/com/minsub/althorism/QuestionByGoogle1.java
47732051856c98629c5e9f87505156aa54fb96fe
[]
no_license
Minsub/JavaStudyWithMaven
a1d5735f7ef0bd0d0cacb4ac381235faa8e0000d
8273ab638cffbcaace00779edd21bb26e277235c
refs/heads/master
2016-09-13T19:49:04.857433
2016-05-25T11:25:09
2016-05-25T11:25:09
59,412,467
0
0
null
null
null
null
UHC
Java
false
false
1,151
java
package com.minsub.althorism; /** * 1부터 10,000까지 8이라는 숫자가 총 몇번 나오는가? 8이 포함되어 있는 숫자의 갯수를 카운팅 하는 것이 아니라 8이라는 숫자를 모두 카운팅 해야 한다. (※ 예를들어 8808은 3, 8888은 4로 카운팅 해야 함) * @author minsub Ji */ public class QuestionByGoogle1 { public static void main(String[] args) { System.out.println(getCountOfNumber(10000, 8)); } /** * * @param max 1부터 n까지의 숫자 중 n값 * @param targetNumber 0-9까지의 숫자중 카운트 할 타겟 숫자 * @return 카운트 결과 값 */ public static int getCountOfNumber(int max, int targetNumber) { int cnt = 0; int tmp = 0; for (int i = 1; i <= max; i++) { tmp = i; do { if (tmp % 10 == 8) { cnt++; } } while ((tmp /= 10) > 0); } return cnt; } /* * [다른 해결법] * 0000부터 9999라고 생각하고 4자리숫자가 10000개이므로 들어가는 * 숫자의개수는 4만개 0부터 9까지 10개의 숫자가 같은 * 비율로 들어가니 4만을 10으로 나누면 4천! */ }
[ "jiminsub@gmail.com" ]
jiminsub@gmail.com
dd6c373c528731124bad46c7fe486c530082eeb0
c920d55be9e9ca070239498a9ee689b817b4b800
/JobController.java
9cdaf1f2d67b799f1b7ca960486c0c990cc77b03
[]
no_license
pcomitz/cmsc335JobExample
364c23e1b2f61bd87144d3583f1739ba1fa65a56
64a7b07a307ed9a9d1a2efede0b1a58e221a9644
refs/heads/master
2016-09-12T10:45:45.691843
2016-04-15T16:55:48
2016-04-15T16:55:48
56,336,044
0
0
null
null
null
null
UTF-8
Java
false
false
493
java
/* * A controller/driver for creature jobs */ public class JobController { public static void main(String[] args) { JobStatus jobStatus = new JobStatus(); CreatureJob creatureJob; //start the job if(args.length >= 2) creatureJob = new CreatureJob(args[0], Double.parseDouble(args[1]), jobStatus); else creatureJob = new CreatureJob("Topple Mordor", 4, jobStatus); //start the UI MyUI ui = new MyUI(jobStatus); } } ///~
[ "pcomitz@users.noreply.github.com" ]
pcomitz@users.noreply.github.com
577ba8ffae268e2d4618c3540589f2f44c649c7c
882a1a28c4ec993c1752c5d3c36642fdda3d8fad
/proxies/com/microsoft/bingads/v12/customermanagement/SearchUserInvitationsRequest.java
8cdeda2cb5589b11c33b8f95243ef41b0182da66
[ "MIT" ]
permissive
BazaRoi/BingAds-Java-SDK
640545e3595ed4e80f5a1cd69bf23520754c4697
e30e5b73c01113d1c523304860180f24b37405c7
refs/heads/master
2020-07-26T08:11:14.446350
2019-09-10T03:25:30
2019-09-10T03:25:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,655
java
package com.microsoft.bingads.v12.customermanagement; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="Predicates" type="{https://bingads.microsoft.com/Customer/v12/Entities}ArrayOfPredicate" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "predicates" }) @XmlRootElement(name = "SearchUserInvitationsRequest") public class SearchUserInvitationsRequest { @XmlElement(name = "Predicates", nillable = true) protected ArrayOfPredicate predicates; /** * Gets the value of the predicates property. * * @return * possible object is * {@link ArrayOfPredicate } * */ public ArrayOfPredicate getPredicates() { return predicates; } /** * Sets the value of the predicates property. * * @param value * allowed object is * {@link ArrayOfPredicate } * */ public void setPredicates(ArrayOfPredicate value) { this.predicates = value; } }
[ "qitia@microsoft.com" ]
qitia@microsoft.com
173a6e5da91b7634afc1ff9ebfc03c47bf705cb9
4e7ff9c7f564520ae7d167731887b6ab0d786e71
/DBSystem/src/com/linyun/data/mapper/TaurusLogMapper.java
f362ea7bf4324f341a58db95e92e145bb3f5fab5
[]
no_license
windland-coder/chess-and-card
f6196e86b3924683f8f9b5421c9fa364467a8bf8
d9b8fdf172175d114b5581f88677f9528c2ec472
refs/heads/master
2021-09-15T23:58:43.151867
2018-06-13T10:29:59
2018-06-13T10:29:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
792
java
package com.linyun.data.mapper; import java.util.List; import org.apache.ibatis.annotations.Param; import com.linyun.common.entity.TaurusLog; public interface TaurusLogMapper { //新增一局的游戏记录 void addGameRecord(TaurusLog u); //获取最新一条记录 TaurusLog getOneRecord(int roomNum); //更新游戏记录 void updateRecord(TaurusLog log); //玩家拉取最近三天的战绩 List<TaurusLog> getUserGameRecard(@Param(value = "condition")TaurusLog u); //检查表里面t_game_log三天内是否有生成重复的房间号,确保房间号唯一 List<TaurusLog> getUserOnlyRoomNumInFourDays(int roomNum); //通过房间号找到TaurusLog对象,3天内任意一条 TaurusLog getUserGameLogByRoomNum(int roomNum); }
[ "noreply@github.com" ]
noreply@github.com
d1cadca80225571ed8e73ef3790dd4d8ccc5b846
6d59418fda917b374e73d8fcdd1a325724300ad1
/jslack-lightning-micronaut/src/test/java/example/app/Application.java
3362dcc03f6d3bf2482d4cce552b028eeb7c7dd6
[ "MIT" ]
permissive
seratch/jslack-maintenance-releases
6625f87c604ddbfa78f26fee1c685f2a53f5aeb3
02032fb24ac4737ec52e5daffef861eb8f5d9b41
refs/heads/master
2023-09-06T08:09:55.926223
2023-04-19T13:42:27
2023-04-19T13:42:27
236,092,259
8
6
MIT
2023-08-23T21:40:17
2020-01-24T22:11:55
Java
UTF-8
Java
false
false
186
java
package example.app; import io.micronaut.runtime.Micronaut; public class Application { public static void main(String[] args) { Micronaut.run(Application.class); } }
[ "noreply@github.com" ]
noreply@github.com
35641c9072645835ecb7b8f8a785102cf050d7b3
c09333139f033d771eea6246834388a75eada9f7
/testing/src/main/java/com/learning/testing/calculator/Calculator.java
c710308d23f42f139c881224218b3112514763a6
[]
no_license
obsydiandev/LearningProjects
9f0932438ccff8e8336af4164a564d4f09fcd9b2
d4f0aed47bf6724ae2b58eb436db237363f5874d
refs/heads/master
2023-04-15T04:32:01.535073
2019-02-22T23:35:26
2019-02-22T23:35:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
327
java
package com.learning.testing.calculator; public class Calculator { private int a; private int b; /* public Calculator(int a, int b) { this.a = a; this.b = b; }*/ public int add(int a, int b) { return a+b; } public int subtract(int a, int b){ return a-b; } }
[ "poczta@mazgaj.pl" ]
poczta@mazgaj.pl
078541be9f322a7be22777788b75c61221043e08
8c6783056a0cf9c5db4c8eb1cdc1daa97aac2967
/github/java/cam1.java
e52e9ec053acc68d69bff4a0d2d0597c4d94fcb2
[]
no_license
franklinnie/niegit
35e1a79949d909bfe8909fb154077394f49b96b8
3ed779703a031683f2324c9456be2e1277ff3f91
refs/heads/master
2021-05-06T07:32:02.933065
2018-02-27T02:29:03
2018-02-27T02:29:03
113,984,081
0
0
null
null
null
null
UTF-8
Java
false
false
1,371
java
import java.awt.*; import java.util.*; public class cam1 extends java.applet.Applet { String s; int inits=0,starts=0,stops=0; public void init() { inits++; showStatus("now init"); System.out.println("now init"); pause(); showStatus("leave init"); System.out.println("leave init"); pause(); } public void start() { starts++; showStatus("now start"); System.out.println("now start"); pause(); showStatus("leave start"); System.out.println("leave start"); pause(); } public void stop() { stops++; showStatus("now stop"); System.out.println("now stop"); pause(); showStatus("leave stop"); System.out.println("leave stop"); pause(); } public void paint(Graphics g) { s="inits: "+inits+"starts: "+starts+"stops: "+stops; g.drawString(s, 10, 10); System.out.println("now paint: "+s); pause(); } public void pause() { Date d=new Date(); long t=d.getTime(); while(t+1000>d.getTime()) { d=new Date(); } } }
[ "m18642695686_1@163.com" ]
m18642695686_1@163.com
40260acb81588c37d8cfdbdc56f5d64884e92783
57b675473b492a5353b32303e03d6cd7317cf063
/04-java-spring/03-spring-data-ii/00-relationships/00-relationships/src/test/java/com/lex/relationships/ApplicationTests.java
d53d4718d131d929b87793d6e3dc547182d85cb2
[]
no_license
java-april-2021/LexL-Assignments
e156f34c270452c241c5eb2d3e4f9479a83a0a32
2ff9a66dd321125014651aae8c970ccacee3897d
refs/heads/master
2023-04-26T04:47:10.670366
2021-05-26T20:11:13
2021-05-26T20:11:13
356,026,615
0
0
null
null
null
null
UTF-8
Java
false
false
207
java
package com.lex.relationships; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class ApplicationTests { @Test void contextLoads() { } }
[ "aslong85@gmail.com" ]
aslong85@gmail.com
b927740ee92025259b6a63ef63c98b62aabbe282
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/shardingjdbc--sharding-jdbc/d0d64013c04bf6f2c5c3f2adbccac60bee81a868/before/DeleteStatementParserTest.java
5d981641b72fdfa794c112ca4225a34a49c42040
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
9,784
java
package com.alibaba.druid.sql.parser; import com.alibaba.druid.sql.context.DeleteSQLContext; import com.alibaba.druid.sql.dialect.mysql.parser.MySql1ExprParser; import com.dangdang.ddframe.rdb.sharding.api.rule.ShardingRule; import com.dangdang.ddframe.rdb.sharding.constants.DatabaseType; import com.dangdang.ddframe.rdb.sharding.parser.result.router.Condition; import org.junit.Test; import java.sql.SQLException; import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.List; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; public final class DeleteStatementParserTest extends AbstractStatementParserTest { @Test public void parseWithoutCondition() throws SQLException { ShardingRule shardingRule = createShardingRule(); List<Object> parameters = Collections.emptyList(); SQLStatementParser statementParser = new SQLStatementParser(DatabaseType.MySQL, shardingRule, parameters, new MySql1ExprParser(shardingRule, parameters, "DELETE FROM TABLE_XXX")); DeleteSQLContext sqlContext = (DeleteSQLContext) statementParser.parseStatement(); assertThat(sqlContext.getTables().get(0).getName(), is("TABLE_XXX")); assertTrue(sqlContext.getConditionContexts().isEmpty()); assertThat(sqlContext.toSqlBuilder().toString(), is("DELETE FROM [Token(TABLE_XXX)]")); } @Test public void parseWithoutParameter() throws SQLException { ShardingRule shardingRule = createShardingRule(); List<Object> parameters = Collections.emptyList(); SQLStatementParser statementParser = new SQLStatementParser(DatabaseType.MySQL, shardingRule, parameters, new MySql1ExprParser(shardingRule, parameters, "DELETE FROM TABLE_XXX xxx WHERE field4<10 AND TABLE_XXX.field1=1 AND field5>10 AND xxx.field2 IN (1,3) AND field6<=10 AND field3 BETWEEN 5 AND 20 AND field7>=10")); DeleteSQLContext sqlContext = (DeleteSQLContext) statementParser.parseStatement(); assertDeleteStatement(sqlContext); assertThat(sqlContext.toSqlBuilder().toString(), is( "DELETE FROM [Token(TABLE_XXX)] xxx WHERE field4<10 AND [Token(TABLE_XXX)].field1=1 AND field5>10 AND xxx.field2 IN (1,3) AND field6<=10 AND field3 BETWEEN 5 AND 20 AND field7>=10")); } @Test public void parseWithParameter() throws SQLException { ShardingRule shardingRule = createShardingRule(); List<Object> parameters = Arrays.<Object>asList(10, 1, 10, 1, 3, 10, 5, 20, 10); SQLStatementParser statementParser = new SQLStatementParser(DatabaseType.MySQL, shardingRule, parameters, new MySql1ExprParser(shardingRule, parameters, "DELETE FROM TABLE_XXX xxx WHERE field4<? AND field1=? AND field5>? AND field2 IN (?,?) AND field6<=? AND field3 BETWEEN ? AND ? AND field7>=?")); DeleteSQLContext sqlContext = (DeleteSQLContext) statementParser.parseStatement(); assertDeleteStatement(sqlContext); assertThat(sqlContext.toSqlBuilder().toString(), is( "DELETE FROM [Token(TABLE_XXX)] xxx WHERE field4<? AND field1=? AND field5>? AND field2 IN (?,?) AND field6<=? AND field3 BETWEEN ? AND ? AND field7>=?")); } private void assertDeleteStatement(final DeleteSQLContext sqlContext) { assertThat(sqlContext.getTables().get(0).getName(), is("TABLE_XXX")); assertThat(sqlContext.getTables().get(0).getAlias().get(), is("xxx")); Iterator<Condition> conditions = sqlContext.getConditionContexts().iterator().next().getAllConditions().iterator(); Condition condition = conditions.next(); assertThat(condition.getColumn().getTableName(), is("TABLE_XXX")); assertThat(condition.getColumn().getColumnName(), is("field1")); assertThat(condition.getOperator(), is(Condition.BinaryOperator.EQUAL)); assertThat(condition.getValues().size(), is(1)); assertThat(condition.getValues().get(0), is((Comparable) 1)); condition = conditions.next(); assertThat(condition.getColumn().getTableName(), is("TABLE_XXX")); assertThat(condition.getColumn().getColumnName(), is("field2")); assertThat(condition.getOperator(), is(Condition.BinaryOperator.IN)); assertThat(condition.getValues().size(), is(2)); assertThat(condition.getValues().get(0), is((Comparable) 1)); assertThat(condition.getValues().get(1), is((Comparable) 3)); condition = conditions.next(); assertThat(condition.getColumn().getTableName(), is("TABLE_XXX")); assertThat(condition.getColumn().getColumnName(), is("field3")); assertThat(condition.getOperator(), is(Condition.BinaryOperator.BETWEEN)); assertThat(condition.getValues().size(), is(2)); assertThat(condition.getValues().get(0), is((Comparable) 5)); assertThat(condition.getValues().get(1), is((Comparable) 20)); assertFalse(conditions.hasNext()); } @Test(expected = UnsupportedOperationException.class) public void parseStatementWithDeleteMultipleTable() { ShardingRule shardingRule = createShardingRule(); List<Object> parameters = Collections.emptyList(); new SQLStatementParser(DatabaseType.MySQL, shardingRule, parameters, new MySql1ExprParser(shardingRule, parameters, "DELETE TABLE_XXX1, TABLE_xxx2 FROM TABLE_XXX1 JOIN TABLE_XXX2")) .parseStatement(); } @Test(expected = UnsupportedOperationException.class) public void parseStatementWithDeleteMultipleTableWithUsing() { ShardingRule shardingRule = createShardingRule(); List<Object> parameters = Collections.emptyList(); new SQLStatementParser(DatabaseType.MySQL, shardingRule, parameters, new MySql1ExprParser(shardingRule, parameters, "DELETE FROM TABLE_XXX1, TABLE_xxx2 USING TABLE_XXX1 JOIN TABLE_XXX2")) .parseStatement(); } @Test public void parseWithSpecialSyntax() throws SQLException { parseWithSpecialSyntax(DatabaseType.MySQL, "DELETE `TABLE_XXX` WHERE `field1`=1", "DELETE [Token(TABLE_XXX)] WHERE `field1`=1"); parseWithSpecialSyntax(DatabaseType.MySQL, "DELETE LOW_PRIORITY QUICK IGNORE TABLE_XXX PARTITION (partition_1) WHERE field1=1 ORDER BY field1 LIMIT 10", "DELETE LOW_PRIORITY QUICK IGNORE [Token(TABLE_XXX)] PARTITION (partition_1) WHERE field1=1 ORDER BY field1 LIMIT 10"); parseWithSpecialSyntax(DatabaseType.MySQL, "DELETE FROM TABLE_XXX PARTITION (partition_1, partition_2,partition_3) WHERE field1=1", "DELETE FROM [Token(TABLE_XXX)] PARTITION (partition_1, partition_2,partition_3) WHERE field1=1"); parseWithSpecialSyntax(DatabaseType.Oracle, "DELETE /*+ index(field1) */ ONLY (TABLE_XXX) WHERE field1=1 RETURN * LOG ERRORS INTO TABLE_LOG", "DELETE /*+ index(field1) */ ONLY ([Token(TABLE_XXX)]) WHERE field1=1 RETURN * LOG ERRORS INTO TABLE_LOG"); parseWithSpecialSyntax(DatabaseType.Oracle, "DELETE /*+ index(field1) */ ONLY (TABLE_XXX) WHERE field1=1 RETURNING *", "DELETE /*+ index(field1) */ ONLY ([Token(TABLE_XXX)]) WHERE field1=1 RETURNING *"); /* // TODO 不支持 parseWithSpecialSyntax(DatabaseType.SQLServer, "WITH field_query (field1, field2) AS (SELECT field1, field2 FROM TABLE_XXX AS xxx GROUP BY field1) DELETE TOP(10) OUTPUT (inserted.field1) FROM TABLE_XXX WHERE field1=1", "WITH field_query (field1, field2) AS (SELECT field1, field2 FROM TABLE_XXX AS xxx GROUP BY field1) DELETE TOP(10) OUTPUT (inserted.field1) FROM [Token(TABLE_XXX)] WHERE field1=1"); */ parseWithSpecialSyntax(DatabaseType.PostgreSQL, "WITH RECURSIVE field_query (field1) AS (SELECT field1 FROM TABLE_XXX AS xxx ORDER BY field1 DESC) DELETE FROM ONLY TABLE_XXX USING producers WHERE field1=1 RETURNING *", "WITH RECURSIVE field_query (field1) AS (SELECT field1 FROM TABLE_XXX AS xxx ORDER BY field1 DESC) DELETE FROM ONLY [Token(TABLE_XXX)] USING producers WHERE field1=1 RETURNING *"); parseWithSpecialSyntax(DatabaseType.PostgreSQL, "WITH field1_query AS (SELECT field1 FROM TABLE_XXX), field2_query AS (SELECT field2 FROM TABLE_XXX) DELETE FROM ONLY TABLE_XXX USING producers WHERE field1=1 OUTPUT *", "WITH field1_query AS (SELECT field1 FROM TABLE_XXX), field2_query AS (SELECT field2 FROM TABLE_XXX) DELETE FROM ONLY [Token(TABLE_XXX)] USING producers WHERE field1=1 OUTPUT *"); } private void parseWithSpecialSyntax(final DatabaseType dbType, final String actualSQL, final String expectedSQL) throws SQLException { DeleteSQLContext sqlContext = (DeleteSQLContext) getSqlStatementParser(dbType, actualSQL).parseStatement(); assertThat(sqlContext.getTables().get(0).getName(), is("TABLE_XXX")); assertFalse(sqlContext.getTables().get(0).getAlias().isPresent()); Iterator<Condition> conditions = sqlContext.getConditionContexts().iterator().next().getAllConditions().iterator(); Condition condition = conditions.next(); assertThat(condition.getColumn().getTableName(), is("TABLE_XXX")); assertThat(condition.getColumn().getColumnName(), is("field1")); assertThat(condition.getOperator(), is(Condition.BinaryOperator.EQUAL)); assertThat(condition.getValues().size(), is(1)); assertThat(condition.getValues().get(0), is((Comparable) 1)); assertFalse(conditions.hasNext()); assertThat(sqlContext.toSqlBuilder().toString().replace("([Token(TABLE_XXX)] )", "([Token(TABLE_XXX)])"), is(expectedSQL)); } }
[ "fraczwojciech@gmail.com" ]
fraczwojciech@gmail.com
b1886e0c2c48012bd580589089d2eb4a56680a29
3ab6e8f5fa25425a9e9e953bd944b1b7bac352a0
/src/main/java/com/caogen/blog/BlogApplication.java
83869786bafdb4cae793ff574ace1e6d02da3d54
[]
no_license
dowa2013/blog
0cd41f872fa62fd07623da0f91f62666d83d1b99
a6be325c9dedc28e77aa0c218789d656e0d7d7a0
refs/heads/master
2020-03-28T16:55:21.780444
2019-08-23T14:50:06
2019-08-23T14:50:06
148,740,745
0
0
null
2018-09-14T05:39:40
2018-09-14T05:39:40
null
UTF-8
Java
false
false
560
java
package com.caogen.blog; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.scheduling.annotation.EnableScheduling; @SpringBootApplication @ServletComponentScan @EnableScheduling @MapperScan("com.caogen.blog.dao") public class BlogApplication { public static void main(String[] args) { SpringApplication.run(BlogApplication.class, args); } }
[ "774750747@qq.com" ]
774750747@qq.com
21e299a27743daf7c880a94aa9e5f3866afcdc2d
96368cf958ca33679efee17f486b1a3ba98c4ff2
/Lab/Week 12/PGraph/src/pgraph/GraphFrame.java
73236e10f694262a651a330d62bbdfd7af406a18
[]
no_license
Carthur-P/Programming-3
57df97a8b65eb943704639bdd00a649d785dbc69
59ed53936ef086dac4e75febbb3cb3876b9843ee
refs/heads/master
2022-05-27T00:49:33.789793
2020-04-29T10:53:28
2020-04-29T10:53:28
259,894,155
0
0
null
null
null
null
UTF-8
Java
false
false
1,747
java
package pgraph; import java.awt.BorderLayout; import java.awt.EventQueue; import java.util.Locale; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.data.general.DefaultPieDataset; import javax.swing.JTabbedPane; public class GraphFrame extends JFrame { private JPanel contentPane; private JTabbedPane tabbedPane; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { GraphFrame frame = new GraphFrame(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public GraphFrame() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 628, 416); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.setBounds(10, 11, 592, 355); tabbedPane.setVisible(true); contentPane.add(tabbedPane); CreateAPie(); } public void CreateAPie() { DefaultPieDataset data = new DefaultPieDataset(); //setting up the values data.setValue("Priciple", 5); data.setValue("Lecturer", 10); data.setValue("Administrator", 2); //creating the chart JFreeChart chart = ChartFactory.createPieChart("Pie Graph", data, true, true, Locale.ENGLISH); //setting up the panel for the chart ChartPanel myPanel = new ChartPanel(chart); myPanel.setVisible(true); tabbedPane.add("Pie Graph", myPanel); } }
[ "pongp1@student.op.ac.nz" ]
pongp1@student.op.ac.nz
1af970b1e5823e55381602b085ce109aa314aa2b
1d10df9027c6a6b84879dfe175e4ac367a0bfedf
/DatePicker.java
9d3c9e39053ce273d0e571f5d9961f8793d90972
[]
no_license
muchagecko/termtraker
5bf7674ab112fae3e4e6b069b8c5789e0bd4231f
eed665cd86036b510f870a8662cc4a0b8417ad18
refs/heads/master
2021-01-20T03:23:18.067305
2017-08-25T03:22:27
2017-08-25T03:22:27
101,359,574
0
0
null
null
null
null
UTF-8
Java
false
false
2,594
java
package com.example.termtraker; import android.app.DatePickerDialog; import android.text.InputType; import android.view.MotionEvent; import android.view.View; import android.widget.EditText; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; import static android.view.MotionEvent.ACTION_DOWN; public class DatePicker { private static Calendar calendar = Calendar.getInstance(); private static SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy", Locale.US); public static void startDatePicker(final EditText editText) { editText.setOnTouchListener( new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { if (motionEvent.getAction() == ACTION_DOWN) { editText.setInputType(InputType.TYPE_NULL); editText.onTouchEvent(motionEvent); if (editText.getText().length() != 0) { try { calendar.setTime(dateFormat.parse(editText.getText().toString())); } catch (ParseException e) { calendar = Calendar.getInstance(); } } else { calendar = Calendar.getInstance(); } new DatePickerDialog( editText.getContext(), new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(android.widget.DatePicker view, int year, int monthOfYear, int dayOfMonth) { calendar.set(year, monthOfYear, dayOfMonth); editText.setText(dateFormat.format(calendar.getTime())); } }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH) ).show(); } return true; } } ); } }
[ "noreply@github.com" ]
noreply@github.com
4ef1843df14d6a458ba90fe1c046413b50f1d7c7
30c88eee698cec991bc38d27174b5ca2f36cf52f
/LBS(final)/app/src/androidTest/java/com/example/a15104163d/mapbox/ExampleInstrumentedTest.java
f71506bc9a591008040798c4dc5240f8a610d4c4
[]
no_license
SherryJYC/LBS-App
906477a41867ae5c16661b50f938643fd3e9c084
786ec4946ced358143400bee5d8f5518978c0458
refs/heads/master
2020-04-05T02:35:38.896831
2018-12-06T05:05:40
2018-12-06T05:05:40
156,482,652
3
1
null
null
null
null
UTF-8
Java
false
false
742
java
package com.example.a15104163d.mapbox; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.a15104163d.mapbox", appContext.getPackageName()); } }
[ "13045821346@163.com" ]
13045821346@163.com
22ea3af08b9ae7f947b20079d03207f40d54dcec
f916764563093b0ca79effa74d9810505b5b6ae8
/app/src/main/java/com/demo/gong/mydemoapplication/DemoSQliteDatabase/TestDatabaseActivity.java
77db7a83506be28f42eeec8eec8ddca5eb42a901
[]
no_license
gongxy2016/demo_list
1f157dce31f0595eb6bf8be55a58c3cb470057ec
b999167771fb9a2c702ac9c8443470accacf29e3
refs/heads/master
2020-04-08T16:26:49.186861
2019-11-22T09:31:02
2019-11-22T09:31:02
159,518,803
2
1
null
null
null
null
UTF-8
Java
false
false
1,242
java
package com.demo.gong.mydemoapplication.DemoSQliteDatabase; import android.content.Intent; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import com.demo.gong.mydemoapplication.BaseActivity; import com.demo.gong.mydemoapplication.DemoSQliteDatabase.DemoGreenDAO.GreenDaoActivity; import com.demo.gong.mydemoapplication.R; import butterknife.BindView; import butterknife.OnClick; public class TestDatabaseActivity extends BaseActivity { @BindView(R.id.btn_go_greendaodemo) Button btnGoGreenDao; private SQLiteDatabase sqLiteDatabase; @OnClick(R.id.btn_go_greendaodemo) public void onViewClick(View view) { startActivity(new Intent(TestDatabaseActivity.this, GreenDaoActivity.class)); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_test_database); sqLiteDatabase = TestSqliteDatabaseOpenHelper.getInstance(this).getWritableDatabase(); if (sqLiteDatabase.isOpen()) { TestSQliteDatabaseUtil.update(sqLiteDatabase); } } }
[ "gong_xyu@163.com" ]
gong_xyu@163.com
6d212e5bed8194b4656186a2a1238742f66a9bab
67d4f2d9af8342e0bc43c143e113ced1726bae9d
/YCSB/core/src/main/java/com/yahoo/ycsb/workloads/CoreWorkload.java
27b35182884b52042694dbcb7f4347c245eb2afc
[ "Apache-2.0" ]
permissive
tinyAdapter/ShieldStore
6bbfb5152e4e17721bbfa517b154896f0eb5d0b2
5de0122c1281730271649c7bd0980d496903698b
refs/heads/master
2023-07-09T16:11:17.927939
2020-10-03T15:47:59
2020-10-03T15:47:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
31,144
java
/** * Copyright (c) 2010 Yahoo! Inc., Copyright (c) 2016 YCSB contributors. All rights reserved. * <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. See accompanying * LICENSE file. */ package com.yahoo.ycsb.workloads; import com.yahoo.ycsb.*; import com.yahoo.ycsb.generator.*; import com.yahoo.ycsb.measurements.Measurements; import java.io.IOException; import java.util.*; /** * The core benchmark scenario. Represents a set of clients doing simple CRUD operations. The * relative proportion of different kinds of operations, and other properties of the workload, * are controlled by parameters specified at runtime. * <p> * Properties to control the client: * <UL> * <LI><b>fieldcount</b>: the number of fields in a record (default: 10) * <LI><b>fieldlength</b>: the size of each field (default: 100) * <LI><b>readallfields</b>: should reads read all fields (true) or just one (false) (default: true) * <LI><b>writeallfields</b>: should updates and read/modify/writes update all fields (true) or just * one (false) (default: false) * <LI><b>readproportion</b>: what proportion of operations should be reads (default: 0.95) * <LI><b>updateproportion</b>: what proportion of operations should be updates (default: 0.05) * <LI><b>insertproportion</b>: what proportion of operations should be inserts (default: 0) * <LI><b>scanproportion</b>: what proportion of operations should be scans (default: 0) * <LI><b>readmodifywriteproportion</b>: what proportion of operations should be read a record, * modify it, write it back (default: 0) * <LI><b>requestdistribution</b>: what distribution should be used to select the records to operate * on - uniform, zipfian, hotspot, sequential, exponential or latest (default: uniform) * <LI><b>maxscanlength</b>: for scans, what is the maximum number of records to scan (default: 1000) * <LI><b>scanlengthdistribution</b>: for scans, what distribution should be used to choose the * number of records to scan, for each scan, between 1 and maxscanlength (default: uniform) * <LI><b>insertstart</b>: for parallel loads and runs, defines the starting record for this * YCSB instance (default: 0) * <LI><b>insertcount</b>: for parallel loads and runs, defines the number of records for this * YCSB instance (default: recordcount) * <LI><b>zeropadding</b>: for generating a record sequence compatible with string sort order by * 0 padding the record number. Controls the number of 0s to use for padding. (default: 1) * For example for row 5, with zeropadding=1 you get 'user5' key and with zeropading=8 you get * 'user00000005' key. In order to see its impact, zeropadding needs to be bigger than number of * digits in the record number. * <LI><b>insertorder</b>: should records be inserted in order by key ("ordered"), or in hashed * order ("hashed") (default: hashed) * </ul> */ public class CoreWorkload extends Workload { /** * The name of the database table to run queries against. */ public static final String TABLENAME_PROPERTY = "table"; /** * The default name of the database table to run queries against. */ public static final String TABLENAME_PROPERTY_DEFAULT = "usertable"; protected String table; /** * The name of the property for the number of fields in a record. */ public static final String FIELD_COUNT_PROPERTY = "fieldcount"; /** * Default number of fields in a record. */ public static final String FIELD_COUNT_PROPERTY_DEFAULT = "10"; protected int fieldcount; private List<String> fieldnames; /** * The name of the property for the field length distribution. Options are "uniform", "zipfian" * (favouring short records), "constant", and "histogram". * <p> * If "uniform", "zipfian" or "constant", the maximum field length will be that specified by the * fieldlength property. If "histogram", then the histogram will be read from the filename * specified in the "fieldlengthhistogram" property. */ public static final String FIELD_LENGTH_DISTRIBUTION_PROPERTY = "fieldlengthdistribution"; /** * The default field length distribution. */ public static final String FIELD_LENGTH_DISTRIBUTION_PROPERTY_DEFAULT = "constant"; /** * The name of the property for the length of a field in bytes. */ public static final String FIELD_LENGTH_PROPERTY = "fieldlength"; /** * The default maximum length of a field in bytes. */ public static final String FIELD_LENGTH_PROPERTY_DEFAULT = "100"; /** * The name of a property that specifies the filename containing the field length histogram (only * used if fieldlengthdistribution is "histogram"). */ public static final String FIELD_LENGTH_HISTOGRAM_FILE_PROPERTY = "fieldlengthhistogram"; /** * The default filename containing a field length histogram. */ public static final String FIELD_LENGTH_HISTOGRAM_FILE_PROPERTY_DEFAULT = "hist.txt"; /** * Generator object that produces field lengths. The value of this depends on the properties that * start with "FIELD_LENGTH_". */ protected NumberGenerator fieldlengthgenerator; /** * The name of the property for deciding whether to read one field (false) or all fields (true) of * a record. */ public static final String READ_ALL_FIELDS_PROPERTY = "readallfields"; /** * The default value for the readallfields property. */ public static final String READ_ALL_FIELDS_PROPERTY_DEFAULT = "true"; protected boolean readallfields; /** * The name of the property for deciding whether to write one field (false) or all fields (true) * of a record. */ public static final String WRITE_ALL_FIELDS_PROPERTY = "writeallfields"; /** * The default value for the writeallfields property. */ public static final String WRITE_ALL_FIELDS_PROPERTY_DEFAULT = "false"; protected boolean writeallfields; /** * The name of the property for deciding whether to check all returned * data against the formation template to ensure data integrity. */ public static final String DATA_INTEGRITY_PROPERTY = "dataintegrity"; /** * The default value for the dataintegrity property. */ public static final String DATA_INTEGRITY_PROPERTY_DEFAULT = "false"; /** * Set to true if want to check correctness of reads. Must also * be set to true during loading phase to function. */ private boolean dataintegrity; /** * The name of the property for the proportion of transactions that are reads. */ public static final String READ_PROPORTION_PROPERTY = "readproportion"; /** * The default proportion of transactions that are reads. */ public static final String READ_PROPORTION_PROPERTY_DEFAULT = "0.95"; /** * The name of the property for the proportion of transactions that are updates. */ public static final String UPDATE_PROPORTION_PROPERTY = "updateproportion"; /** * The default proportion of transactions that are updates. */ public static final String UPDATE_PROPORTION_PROPERTY_DEFAULT = "0.05"; /** * The name of the property for the proportion of transactions that are inserts. */ public static final String INSERT_PROPORTION_PROPERTY = "insertproportion"; /** * The default proportion of transactions that are inserts. */ public static final String INSERT_PROPORTION_PROPERTY_DEFAULT = "0.0"; /** * The name of the property for the proportion of transactions that are scans. */ public static final String SCAN_PROPORTION_PROPERTY = "scanproportion"; /** * The default proportion of transactions that are scans. */ public static final String SCAN_PROPORTION_PROPERTY_DEFAULT = "0.0"; /** * The name of the property for the proportion of transactions that are read-modify-write. */ public static final String READMODIFYWRITE_PROPORTION_PROPERTY = "readmodifywriteproportion"; /** * The default proportion of transactions that are scans. */ public static final String READMODIFYWRITE_PROPORTION_PROPERTY_DEFAULT = "0.0"; /** * The name of the property for the the distribution of requests across the keyspace. Options are * "uniform", "zipfian" and "latest" */ public static final String REQUEST_DISTRIBUTION_PROPERTY = "requestdistribution"; /** * The default distribution of requests across the keyspace. */ public static final String REQUEST_DISTRIBUTION_PROPERTY_DEFAULT = "uniform"; /** * The name of the property for adding zero padding to record numbers in order to match * string sort order. Controls the number of 0s to left pad with. */ public static final String ZERO_PADDING_PROPERTY = "zeropadding"; /** * The default zero padding value. Matches integer sort order */ public static final String ZERO_PADDING_PROPERTY_DEFAULT = "1"; /** * The name of the property for the max scan length (number of records). */ public static final String MAX_SCAN_LENGTH_PROPERTY = "maxscanlength"; /** * The default max scan length. */ public static final String MAX_SCAN_LENGTH_PROPERTY_DEFAULT = "1000"; /** * The name of the property for the scan length distribution. Options are "uniform" and "zipfian" * (favoring short scans) */ public static final String SCAN_LENGTH_DISTRIBUTION_PROPERTY = "scanlengthdistribution"; /** * The default max scan length. */ public static final String SCAN_LENGTH_DISTRIBUTION_PROPERTY_DEFAULT = "uniform"; /** * The name of the property for the order to insert records. Options are "ordered" or "hashed" */ public static final String INSERT_ORDER_PROPERTY = "insertorder"; /** * Default insert order. */ public static final String INSERT_ORDER_PROPERTY_DEFAULT = "hashed"; /** * Percentage data items that constitute the hot set. */ public static final String HOTSPOT_DATA_FRACTION = "hotspotdatafraction"; /** * Default value of the size of the hot set. */ public static final String HOTSPOT_DATA_FRACTION_DEFAULT = "0.2"; /** * Percentage operations that access the hot set. */ public static final String HOTSPOT_OPN_FRACTION = "hotspotopnfraction"; /** * Default value of the percentage operations accessing the hot set. */ public static final String HOTSPOT_OPN_FRACTION_DEFAULT = "0.8"; /** * How many times to retry when insertion of a single item to a DB fails. */ public static final String INSERTION_RETRY_LIMIT = "core_workload_insertion_retry_limit"; public static final String INSERTION_RETRY_LIMIT_DEFAULT = "0"; /** * On average, how long to wait between the retries, in seconds. */ public static final String INSERTION_RETRY_INTERVAL = "core_workload_insertion_retry_interval"; public static final String INSERTION_RETRY_INTERVAL_DEFAULT = "3"; protected NumberGenerator keysequence; protected DiscreteGenerator operationchooser; protected NumberGenerator keychooser; protected NumberGenerator fieldchooser; protected AcknowledgedCounterGenerator transactioninsertkeysequence; protected NumberGenerator scanlength; protected boolean orderedinserts; protected int recordcount; protected int zeropadding; protected int insertionRetryLimit; protected int insertionRetryInterval; private Measurements measurements = Measurements.getMeasurements(); protected static NumberGenerator getFieldLengthGenerator(Properties p) throws WorkloadException { NumberGenerator fieldlengthgenerator; String fieldlengthdistribution = p.getProperty( FIELD_LENGTH_DISTRIBUTION_PROPERTY, FIELD_LENGTH_DISTRIBUTION_PROPERTY_DEFAULT); int fieldlength = Integer.parseInt(p.getProperty(FIELD_LENGTH_PROPERTY, FIELD_LENGTH_PROPERTY_DEFAULT)); String fieldlengthhistogram = p.getProperty( FIELD_LENGTH_HISTOGRAM_FILE_PROPERTY, FIELD_LENGTH_HISTOGRAM_FILE_PROPERTY_DEFAULT); if (fieldlengthdistribution.compareTo("constant") == 0) { fieldlengthgenerator = new ConstantIntegerGenerator(fieldlength); } else if (fieldlengthdistribution.compareTo("uniform") == 0) { fieldlengthgenerator = new UniformIntegerGenerator(1, fieldlength); } else if (fieldlengthdistribution.compareTo("zipfian") == 0) { fieldlengthgenerator = new ZipfianGenerator(1, fieldlength); } else if (fieldlengthdistribution.compareTo("histogram") == 0) { try { fieldlengthgenerator = new HistogramGenerator(fieldlengthhistogram); } catch (IOException e) { throw new WorkloadException( "Couldn't read field length histogram file: " + fieldlengthhistogram, e); } } else { throw new WorkloadException( "Unknown field length distribution \"" + fieldlengthdistribution + "\""); } return fieldlengthgenerator; } /** * Initialize the scenario. * Called once, in the main client thread, before any operations are started. */ @Override public void init(Properties p) throws WorkloadException { table = p.getProperty(TABLENAME_PROPERTY, TABLENAME_PROPERTY_DEFAULT); fieldcount = Integer.parseInt(p.getProperty(FIELD_COUNT_PROPERTY, FIELD_COUNT_PROPERTY_DEFAULT)); fieldnames = new ArrayList<>(); for (int i = 0; i < fieldcount; i++) { fieldnames.add("field" + i); } fieldlengthgenerator = CoreWorkload.getFieldLengthGenerator(p); recordcount = Integer.parseInt(p.getProperty(Client.RECORD_COUNT_PROPERTY, Client.DEFAULT_RECORD_COUNT)); if (recordcount == 0) { recordcount = Integer.MAX_VALUE; } String requestdistrib = p.getProperty(REQUEST_DISTRIBUTION_PROPERTY, REQUEST_DISTRIBUTION_PROPERTY_DEFAULT); int maxscanlength = Integer.parseInt(p.getProperty(MAX_SCAN_LENGTH_PROPERTY, MAX_SCAN_LENGTH_PROPERTY_DEFAULT)); String scanlengthdistrib = p.getProperty(SCAN_LENGTH_DISTRIBUTION_PROPERTY, SCAN_LENGTH_DISTRIBUTION_PROPERTY_DEFAULT); int insertstart = Integer.parseInt(p.getProperty(INSERT_START_PROPERTY, INSERT_START_PROPERTY_DEFAULT)); int insertcount = Integer.parseInt(p.getProperty(INSERT_COUNT_PROPERTY, String.valueOf(recordcount - insertstart))); // Confirm valid values for insertstart and insertcount in relation to recordcount if (recordcount < (insertstart + insertcount)) { System.err.println("Invalid combination of insertstart, insertcount and recordcount."); System.err.println("recordcount must be bigger than insertstart + insertcount."); System.exit(-1); } zeropadding = Integer.parseInt(p.getProperty(ZERO_PADDING_PROPERTY, ZERO_PADDING_PROPERTY_DEFAULT)); readallfields = Boolean.parseBoolean( p.getProperty(READ_ALL_FIELDS_PROPERTY, READ_ALL_FIELDS_PROPERTY_DEFAULT)); writeallfields = Boolean.parseBoolean( p.getProperty(WRITE_ALL_FIELDS_PROPERTY, WRITE_ALL_FIELDS_PROPERTY_DEFAULT)); dataintegrity = Boolean.parseBoolean( p.getProperty(DATA_INTEGRITY_PROPERTY, DATA_INTEGRITY_PROPERTY_DEFAULT)); // Confirm that fieldlengthgenerator returns a constant if data // integrity check requested. if (dataintegrity && !(p.getProperty( FIELD_LENGTH_DISTRIBUTION_PROPERTY, FIELD_LENGTH_DISTRIBUTION_PROPERTY_DEFAULT)).equals("constant")) { System.err.println("Must have constant field size to check data integrity."); System.exit(-1); } if (p.getProperty(INSERT_ORDER_PROPERTY, INSERT_ORDER_PROPERTY_DEFAULT).compareTo("hashed") == 0) { orderedinserts = false; } else if (requestdistrib.compareTo("exponential") == 0) { double percentile = Double.parseDouble(p.getProperty( ExponentialGenerator.EXPONENTIAL_PERCENTILE_PROPERTY, ExponentialGenerator.EXPONENTIAL_PERCENTILE_DEFAULT)); double frac = Double.parseDouble(p.getProperty( ExponentialGenerator.EXPONENTIAL_FRAC_PROPERTY, ExponentialGenerator.EXPONENTIAL_FRAC_DEFAULT)); keychooser = new ExponentialGenerator(percentile, recordcount * frac); } else { orderedinserts = true; } keysequence = new CounterGenerator(insertstart); operationchooser = createOperationGenerator(p); transactioninsertkeysequence = new AcknowledgedCounterGenerator(recordcount); if (requestdistrib.compareTo("uniform") == 0) { keychooser = new UniformIntegerGenerator(insertstart, insertstart + insertcount - 1); } else if (requestdistrib.compareTo("sequential") == 0) { keychooser = new SequentialGenerator(insertstart, insertstart + insertcount - 1); } else if (requestdistrib.compareTo("zipfian") == 0) { // it does this by generating a random "next key" in part by taking the modulus over the // number of keys. // If the number of keys changes, this would shift the modulus, and we don't want that to // change which keys are popular so we'll actually construct the scrambled zipfian generator // with a keyspace that is larger than exists at the beginning of the test. that is, we'll predict // the number of inserts, and tell the scrambled zipfian generator the number of existing keys // plus the number of predicted keys as the total keyspace. then, if the generator picks a key // that hasn't been inserted yet, will just ignore it and pick another key. this way, the size of // the keyspace doesn't change from the perspective of the scrambled zipfian generator final double insertproportion = Double.parseDouble( p.getProperty(INSERT_PROPORTION_PROPERTY, INSERT_PROPORTION_PROPERTY_DEFAULT)); int opcount = Integer.parseInt(p.getProperty(Client.OPERATION_COUNT_PROPERTY)); int expectednewkeys = (int) ((opcount) * insertproportion * 2.0); // 2 is fudge factor keychooser = new ScrambledZipfianGenerator(insertstart, insertstart + insertcount + expectednewkeys); } else if (requestdistrib.compareTo("latest") == 0) { keychooser = new SkewedLatestGenerator(transactioninsertkeysequence); } else if (requestdistrib.equals("hotspot")) { double hotsetfraction = Double.parseDouble(p.getProperty(HOTSPOT_DATA_FRACTION, HOTSPOT_DATA_FRACTION_DEFAULT)); double hotopnfraction = Double.parseDouble(p.getProperty(HOTSPOT_OPN_FRACTION, HOTSPOT_OPN_FRACTION_DEFAULT)); keychooser = new HotspotIntegerGenerator(insertstart, insertstart + insertcount - 1, hotsetfraction, hotopnfraction); } else { throw new WorkloadException("Unknown request distribution \"" + requestdistrib + "\""); } fieldchooser = new UniformIntegerGenerator(0, fieldcount - 1); if (scanlengthdistrib.compareTo("uniform") == 0) { scanlength = new UniformIntegerGenerator(1, maxscanlength); } else if (scanlengthdistrib.compareTo("zipfian") == 0) { scanlength = new ZipfianGenerator(1, maxscanlength); } else { throw new WorkloadException( "Distribution \"" + scanlengthdistrib + "\" not allowed for scan length"); } insertionRetryLimit = Integer.parseInt(p.getProperty( INSERTION_RETRY_LIMIT, INSERTION_RETRY_LIMIT_DEFAULT)); insertionRetryInterval = Integer.parseInt(p.getProperty( INSERTION_RETRY_INTERVAL, INSERTION_RETRY_INTERVAL_DEFAULT)); } protected String buildKeyName(long keynum) { if (!orderedinserts) { keynum = Utils.hash(keynum); } String value = Long.toString(keynum); if (value.length() > 16) { String tmp = value.substring(0, 16); value = tmp; } int fill = zeropadding - value.length(); String prekey = "user"; for (int i = 0; i < fill; i++) { prekey += '0'; } return value; } /** * Builds a value for a randomly chosen field. */ private HashMap<String, ByteIterator> buildSingleValue(String key) { HashMap<String, ByteIterator> value = new HashMap<>(); String fieldkey = fieldnames.get(fieldchooser.nextValue().intValue()); ByteIterator data; if (dataintegrity) { data = new StringByteIterator(buildDeterministicValue(key, fieldkey)); } else { // fill with random data data = new RandomByteIterator(fieldlengthgenerator.nextValue().longValue()); } value.put(fieldkey, data); return value; } /** * Builds values for all fields. */ private HashMap<String, ByteIterator> buildValues(String key) { HashMap<String, ByteIterator> values = new HashMap<>(); for (String fieldkey : fieldnames) { ByteIterator data; if (dataintegrity) { data = new StringByteIterator(buildDeterministicValue(key, fieldkey)); } else { // fill with random data data = new RandomByteIterator(fieldlengthgenerator.nextValue().longValue()); } values.put(fieldkey, data); } return values; } /** * Build a deterministic value given the key information. */ private String buildDeterministicValue(String key, String fieldkey) { int size = fieldlengthgenerator.nextValue().intValue(); StringBuilder sb = new StringBuilder(size); sb.append(key); sb.append(':'); sb.append(fieldkey); while (sb.length() < size) { sb.append(':'); sb.append(sb.toString().hashCode()); } sb.setLength(size); return sb.toString(); } /** * Do one insert operation. Because it will be called concurrently from multiple client threads, * this function must be thread safe. However, avoid synchronized, or the threads will block waiting * for each other, and it will be difficult to reach the target throughput. Ideally, this function would * have no side effects other than DB operations. */ @Override public boolean doInsert(DB db, Object threadstate) { int keynum = keysequence.nextValue().intValue(); String dbkey = buildKeyName(keynum); HashMap<String, ByteIterator> values = buildValues(dbkey); Status status; int numOfRetries = 0; do { status = db.insert(table, dbkey, values); if (null != status && status.isOk()) { break; } // Retry if configured. Without retrying, the load process will fail // even if one single insertion fails. User can optionally configure // an insertion retry limit (default is 0) to enable retry. if (++numOfRetries <= insertionRetryLimit) { System.err.println("Retrying insertion, retry count: " + numOfRetries); try { // Sleep for a random number between [0.8, 1.2)*insertionRetryInterval. int sleepTime = (int) (1000 * insertionRetryInterval * (0.8 + 0.4 * Math.random())); Thread.sleep(sleepTime); } catch (InterruptedException e) { break; } } else { System.err.println("Error inserting, not retrying any more. number of attempts: " + numOfRetries + "Insertion Retry Limit: " + insertionRetryLimit); break; } } while (true); return null != status && status.isOk(); } /** * Do one transaction operation. Because it will be called concurrently from multiple client * threads, this function must be thread safe. However, avoid synchronized, or the threads will block waiting * for each other, and it will be difficult to reach the target throughput. Ideally, this function would * have no side effects other than DB operations. */ @Override public boolean doTransaction(DB db, Object threadstate) { String operation = operationchooser.nextString(); if(operation == null) { return false; } switch (operation) { case "READ": doTransactionRead(db); break; case "UPDATE": doTransactionUpdate(db); break; case "INSERT": doTransactionInsert(db); break; case "SCAN": doTransactionScan(db); break; default: doTransactionReadModifyWrite(db); } return true; } /** * Results are reported in the first three buckets of the histogram under * the label "VERIFY". * Bucket 0 means the expected data was returned. * Bucket 1 means incorrect data was returned. * Bucket 2 means null data was returned when some data was expected. */ protected void verifyRow(String key, HashMap<String, ByteIterator> cells) { Status verifyStatus = Status.OK; long startTime = System.nanoTime(); if (!cells.isEmpty()) { for (Map.Entry<String, ByteIterator> entry : cells.entrySet()) { if (!entry.getValue().toString().equals(buildDeterministicValue(key, entry.getKey()))) { verifyStatus = Status.UNEXPECTED_STATE; break; } } } else { // This assumes that null data is never valid verifyStatus = Status.ERROR; } long endTime = System.nanoTime(); measurements.measure("VERIFY", (int) (endTime - startTime) / 1000); measurements.reportStatus("VERIFY", verifyStatus); } protected int nextKeynum() { int keynum; if (keychooser instanceof ExponentialGenerator) { do { keynum = transactioninsertkeysequence.lastValue() - keychooser.nextValue().intValue(); } while (keynum < 0); } else { do { keynum = keychooser.nextValue().intValue(); } while (keynum > transactioninsertkeysequence.lastValue()); } return keynum; } public void doTransactionRead(DB db) { // choose a random key int keynum = nextKeynum(); String keyname = buildKeyName(keynum); HashSet<String> fields = null; if (!readallfields) { // read a random field String fieldname = fieldnames.get(fieldchooser.nextValue().intValue()); fields = new HashSet<String>(); fields.add(fieldname); } else if (dataintegrity) { // pass the full field list if dataintegrity is on for verification fields = new HashSet<String>(fieldnames); } HashMap<String, ByteIterator> cells = new HashMap<String, ByteIterator>(); db.read(table, keyname, fields, cells); if (dataintegrity) { verifyRow(keyname, cells); } } public void doTransactionReadModifyWrite(DB db) { // choose a random key int keynum = nextKeynum(); String keyname = buildKeyName(keynum); HashSet<String> fields = null; if (!readallfields) { // read a random field String fieldname = fieldnames.get(fieldchooser.nextValue().intValue()); fields = new HashSet<String>(); fields.add(fieldname); } HashMap<String, ByteIterator> values; if (writeallfields) { // new data for all the fields values = buildValues(keyname); } else { // update a random field values = buildSingleValue(keyname); } // do the transaction HashMap<String, ByteIterator> cells = new HashMap<String, ByteIterator>(); long ist = measurements.getIntendedtartTimeNs(); long st = System.nanoTime(); db.read(table, keyname, fields, cells); db.update(table, keyname, values); long en = System.nanoTime(); if (dataintegrity) { verifyRow(keyname, cells); } measurements.measure("READ-MODIFY-WRITE", (int) ((en - st) / 1000)); measurements.measureIntended("READ-MODIFY-WRITE", (int) ((en - ist) / 1000)); } public void doTransactionScan(DB db) { // choose a random key int keynum = nextKeynum(); String startkeyname = buildKeyName(keynum); // choose a random scan length int len = scanlength.nextValue().intValue(); HashSet<String> fields = null; if (!readallfields) { // read a random field String fieldname = fieldnames.get(fieldchooser.nextValue().intValue()); fields = new HashSet<String>(); fields.add(fieldname); } db.scan(table, startkeyname, len, fields, new Vector<HashMap<String, ByteIterator>>()); } public void doTransactionUpdate(DB db) { // choose a random key int keynum = nextKeynum(); String keyname = buildKeyName(keynum); HashMap<String, ByteIterator> values; if (writeallfields) { // new data for all the fields values = buildValues(keyname); } else { // update a random field values = buildSingleValue(keyname); } db.update(table, keyname, values); } public void doTransactionInsert(DB db) { // choose the next key int keynum = transactioninsertkeysequence.nextValue(); try { String dbkey = buildKeyName(keynum); HashMap<String, ByteIterator> values = buildValues(dbkey); db.insert(table, dbkey, values); } finally { transactioninsertkeysequence.acknowledge(keynum); } } /** * Creates a weighted discrete values with database operations for a workload to perform. * Weights/proportions are read from the properties list and defaults are used * when values are not configured. * Current operations are "READ", "UPDATE", "INSERT", "SCAN" and "READMODIFYWRITE". * * @param p The properties list to pull weights from. * @return A generator that can be used to determine the next operation to perform. * @throws IllegalArgumentException if the properties object was null. */ protected static DiscreteGenerator createOperationGenerator(final Properties p) { if (p == null) { throw new IllegalArgumentException("Properties object cannot be null"); } final double readproportion = Double.parseDouble( p.getProperty(READ_PROPORTION_PROPERTY, READ_PROPORTION_PROPERTY_DEFAULT)); final double updateproportion = Double.parseDouble( p.getProperty(UPDATE_PROPORTION_PROPERTY, UPDATE_PROPORTION_PROPERTY_DEFAULT)); final double insertproportion = Double.parseDouble( p.getProperty(INSERT_PROPORTION_PROPERTY, INSERT_PROPORTION_PROPERTY_DEFAULT)); final double scanproportion = Double.parseDouble( p.getProperty(SCAN_PROPORTION_PROPERTY, SCAN_PROPORTION_PROPERTY_DEFAULT)); final double readmodifywriteproportion = Double.parseDouble(p.getProperty( READMODIFYWRITE_PROPORTION_PROPERTY, READMODIFYWRITE_PROPORTION_PROPERTY_DEFAULT)); final DiscreteGenerator operationchooser = new DiscreteGenerator(); if (readproportion > 0) { operationchooser.addValue(readproportion, "READ"); } if (updateproportion > 0) { operationchooser.addValue(updateproportion, "UPDATE"); } if (insertproportion > 0) { operationchooser.addValue(insertproportion, "INSERT"); } if (scanproportion > 0) { operationchooser.addValue(scanproportion, "SCAN"); } if (readmodifywriteproportion > 0) { operationchooser.addValue(readmodifywriteproportion, "READMODIFYWRITE"); } return operationchooser; } }
[ "cearial09@gmail.com" ]
cearial09@gmail.com
72ea455d522e984e82e290e56efa03da93366dfa
70bb08bd7796d7d660bd2c70fca6fc87b12e6959
/Printing hollow pattern/Main.java
ac8bcdbc3263181785ef359a839c43705bd26db8
[]
no_license
JnanaSrinivas/Playground
c22acd61f562287fe5bddee776b157c07f392771
8c1b9f1f0a59857e29f987d9919db3b1a541d41f
refs/heads/master
2020-04-26T18:35:31.936818
2019-06-08T06:28:19
2019-06-08T06:28:19
173,748,761
0
0
null
null
null
null
UTF-8
Java
false
false
619
java
import java.util.Scanner; class Main{ public static void main (String[] args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); for(int row = 1;row <= n;row++) { // Handle stars for each row for(int col = 1;col <= n;col++) { // Condition to print stars if((row == 1) || (col == 1) || (row == n) || (col == n)) { System.out.print("*"); } else{ System.out.print(" "); } } System.out.println(); } } }
[ "48211338+JnanaSrinivas@users.noreply.github.com" ]
48211338+JnanaSrinivas@users.noreply.github.com
95c6742087cb07da4b4769c2f3265f409e2fbf84
5047935fbb83b18155757913eac1615dea0a6530
/company-structure-spring-security-oauth2-authorities-master/src/main/java/com/adamzareba/spring/security/oauth2/controller/CompanyController.java
36ec5ab8b95188387817822ce57ed315e9ef1b3e
[]
no_license
devsimplyfy/oauth
74c26f7eda51b5d9e32853e73869831031607af6
2eb78e68b553aec435f03dd2ccf52f9856c843c2
refs/heads/master
2020-04-13T05:21:03.965580
2018-12-24T12:37:16
2018-12-24T12:37:16
162,989,189
0
0
null
null
null
null
UTF-8
Java
false
false
2,696
java
package com.adamzareba.spring.security.oauth2.controller; import com.adamzareba.spring.security.oauth2.model.Company; import com.adamzareba.spring.security.oauth2.service.CompanyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.hateoas.mvc.ControllerLinkBuilder; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import java.util.List; import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; @RestController @RequestMapping("/secured/company") public class CompanyController { @Autowired private CompanyService companyService; @RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(value = HttpStatus.OK) public @ResponseBody List<Company> getAll() { return companyService.getAll(); } @RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(value = HttpStatus.OK) public @ResponseBody Company get(@PathVariable Long id) { return companyService.get(id); } @RequestMapping(method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(value = HttpStatus.OK) public ResponseEntity<?> create(@RequestBody Company company) { companyService.create(company); HttpHeaders headers = new HttpHeaders(); ControllerLinkBuilder linkBuilder = linkTo(methodOn(CompanyController.class).get(company.getId())); headers.setLocation(linkBuilder.toUri()); return new ResponseEntity<>(headers, HttpStatus.CREATED); } @RequestMapping(method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(value = HttpStatus.OK) public void update(@RequestBody Company company) { companyService.update(company); } @RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(value = HttpStatus.OK) public void delete(@PathVariable Long id) { companyService.delete(id); } }
[ "umang.instantwebworld@gmail.com" ]
umang.instantwebworld@gmail.com
5f0c81cace89b152ad343185409906158a14a81d
ba0095a08b075692cb58d096ea00654e88fb539a
/pg-common/src/main/java/guava/OptionalTest.java
b2d355c1fd9fa4b29546c1054ae6f4323ac92cb7
[]
no_license
virgilcode/monster-pg
cd90af387c8022131943dbea307ae5463e3db04d
c4710bfe491cda02a5c822a916e1a7134fae40ea
refs/heads/master
2020-05-04T10:40:01.100870
2019-04-02T14:32:08
2019-04-02T14:32:08
179,092,623
0
0
null
null
null
null
UTF-8
Java
false
false
1,368
java
package guava; import com.google.common.base.Optional; import java.util.Set; /** * @author Starstar Sun * @date 2019/2/20 * @Description: **/ public class OptionalTest { public static void main(String[] args){ OptionalTest optionalTest=new OptionalTest(); optionalTest.test(); System.out.println(OptionalTest.class.getName()); } public void test(){ Optional<Long> value = method(); if(value.isPresent()){ System.out.println("获得返回值: " + value.get()); }else{ System.out.println("获得给定值: " + value.or(-1L)); } System.out.println("获得返回值 orNull: " + value.orNull()); Optional<Long> valueNoNull = methodNoNull(); if(valueNoNull.isPresent()==true){ Set<Long> set=valueNoNull.asSet(); System.out.println("获得返回值 set 的 size : " + set.size()); System.out.println("获得返回值: " + valueNoNull.get()); }else{ System.out.println("获得返回值: " + valueNoNull.or(-12L)); } System.out.println("获得返回值 orNull: " + valueNoNull.orNull()); } private Optional<Long> method() { return Optional.fromNullable(null); } private Optional<Long> methodNoNull() { return Optional.fromNullable(15L); } }
[ "sunvirgil@sundeMacBook-Pro.local" ]
sunvirgil@sundeMacBook-Pro.local
e3d017aa4eacb9aac5e80132cbe38b90304dc1c2
eb330cdbb8f7e10fa900529e5079080447a73461
/cascading-hadoop3-io/src/main/java/cascading/tuple/hadoop/TupleSerializationProps.java
c13a87b4d4c7d53794d9b870ccbe997f5283e6f9
[ "Apache-2.0" ]
permissive
cwensel/cascading
20cdf1259db5b3cd8d7f7cb524ba0eba29cad5fb
f2785118ce7be0abd4fe102e94a0f20fb97aa4f0
refs/heads/4.5
2023-08-23T23:51:22.326915
2023-07-31T02:47:07
2023-07-31T02:47:07
121,672
165
71
NOASSERTION
2023-07-20T22:43:13
2009-02-04T17:52:06
Java
UTF-8
Java
false
false
9,862
java
/* * Copyright (c) 2007-2022 The Cascading Authors. All Rights Reserved. * * Project and contact information: https://cascading.wensel.net/ * * This file is part of the Cascading project. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package cascading.tuple.hadoop; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Properties; import cascading.property.Props; import cascading.tuple.Tuple; import cascading.util.Util; /** * Class TupleSerializationProps is a fluent interface for building properties to be passed to a * {@link cascading.flow.FlowConnector} before creating new {@link cascading.flow.Flow} instances. * <p> * See {@link TupleSerialization} for details on these properties. * * @see TupleSerialization */ public class TupleSerializationProps extends Props { public static final String SERIALIZATION_TOKENS = "cascading.serialization.tokens"; public static final String SERIALIZATION_COMPARISON_BITWISE_PREVENT = "cascading.serialization.comparison.bitwise.prevent"; public static final String IGNORE_TYPES = "cascading.serialization.types.ignored"; public static final String REQUIRE_TYPES = "cascading.serialization.types.required"; public static final String HADOOP_IO_SERIALIZATIONS = "io.serializations"; Map<Integer, String> serializationTokens = new LinkedHashMap<Integer, String>(); List<String> hadoopSerializations = new ArrayList<String>(); Boolean ignoreTypes; Boolean requireTypes; Boolean preventBitWiseComparisons; /** * Adds the given token and className pair as a serialization token property. During object serialization and deserialization, * the given token will be used instead of the className when an instance of the className is encountered. * * @param properties of type Map * @param token of type int * @param className of type String */ public static void addSerializationToken( Map<Object, Object> properties, int token, String className ) { String tokens = getSerializationTokens( properties ); properties.put( SERIALIZATION_TOKENS, Util.join( ",", Util.removeNulls( tokens, token + "=" + className ) ) ); } /** * Returns the serialization tokens property. * * @param properties of type Map * @return returns a String */ public static String getSerializationTokens( Map<Object, Object> properties ) { return (String) properties.get( SERIALIZATION_TOKENS ); } /** * Adds the given className as a Hadoop IO serialization class. * * @param properties of type Map * @param className of type String */ public static void addSerialization( Map<Object, Object> properties, String className ) { String serializations = (String) properties.get( HADOOP_IO_SERIALIZATIONS ); properties.put( HADOOP_IO_SERIALIZATIONS, Util.join( ",", Util.removeNulls( serializations, className ) ) ); } /** * Creates a new TupleSerializationProps instance. * * @return TupleSerializationProps instance */ public static TupleSerializationProps tupleSerializationProps() { return new TupleSerializationProps(); } public TupleSerializationProps() { } public Map<Integer, String> getSerializationTokens() { return serializationTokens; } /** * Method setSerializationTokens sets the given integer tokens and classNames Map as a serialization properties. * <p> * During object serialization and deserialization, the given tokens will be used instead of the className when an * instance of the className is encountered. * * @param serializationTokens Map of Integer tokens and String classnames * @return this */ public TupleSerializationProps setSerializationTokens( Map<Integer, String> serializationTokens ) { this.serializationTokens = serializationTokens; return this; } /** * Method addSerializationTokens adds the given integer tokens and classNames Map as a serialization properties. * <p> * During object serialization and deserialization, the given tokens will be used instead of the className when an * instance of the className is encountered. * * @param serializationTokens Map of Integer tokens and String classnames * @return this */ public TupleSerializationProps addSerializationTokens( Map<Integer, String> serializationTokens ) { this.serializationTokens.putAll( serializationTokens ); return this; } /** * Method addSerializationToken adds the given integer token and classNames as a serialization properties. * <p> * During object serialization and deserialization, the given tokens will be used instead of the className when an * instance of the className is encountered. * * @param token type int * @param serializationClassName type String * @return this */ public TupleSerializationProps addSerializationToken( int token, String serializationClassName ) { this.serializationTokens.put( token, serializationClassName ); return this; } public List<String> getHadoopSerializations() { return hadoopSerializations; } /** * Method setHadoopSerializations sets the Hadoop serialization classNames to be used as properties. * * @param hadoopSerializationClassNames List of classNames * @return this */ public TupleSerializationProps setHadoopSerializations( List<String> hadoopSerializationClassNames ) { this.hadoopSerializations = hadoopSerializationClassNames; return this; } /** * Method addHadoopSerializations adds the Hadoop serialization classNames to be used as properties. * * @param hadoopSerializationClassNames List of classNames * @return this */ public TupleSerializationProps addHadoopSerializations( List<String> hadoopSerializationClassNames ) { this.hadoopSerializations.addAll( hadoopSerializationClassNames ); return this; } /** * Method addHadoopSerialization adds a Hadoop serialization className to be used as properties. * * @param hadoopSerializationClassName List of classNames * @return this */ public TupleSerializationProps addHadoopSerialization( String hadoopSerializationClassName ) { this.hadoopSerializations.add( hadoopSerializationClassName ); return this; } public Boolean getIgnoreTypes() { return ignoreTypes; } /** * Method setIgnoreTypes forces the {@link TupleSerialization} class to ignore any and all * declared types causing the serialization to write each type or {@link SerializationToken} * per {@link Tuple} element. * <p> * This disables the declared type optimizations. * <p> * See {@link #setRequireTypes(Boolean)} to force a failure if field type information is missing. * * @param ignoreTypes * @return */ public TupleSerializationProps setIgnoreTypes( Boolean ignoreTypes ) { this.ignoreTypes = ignoreTypes; return this; } public Boolean getRequireTypes() { return requireTypes; } /** * Method setRequireTypes forces {@link TupleSerialization} to fail if field types are not declared. * <p> * This ensures the field type optimizations are leveraged. * <p> * See {@link #setIgnoreTypes(Boolean)} to force field type information to be discarded. * * @param requireTypes * @return */ public TupleSerializationProps setRequireTypes( Boolean requireTypes ) { this.requireTypes = requireTypes; return this; } /** * Method preventBitWiseComparison will enable/disable bitwise comparisons of grouping keys * during ordered partitioning ({@link cascading.pipe.GroupBy} and {@link cascading.pipe.CoGroup}). * <p> * If natural ordering of grouping/join keys is required, disable bit wise comparisons. They are enabled * by default (subject to the below conditions). * <p> * Bit wise comparisons will only apply if the {@link cascading.tuple.Fields} used in the grouping/join are * declared and no custom {@link java.util.Comparator} instances are provided on the grouping/key Fields, or * no secondary sorting is being performed on a GroupBy. * * @param preventBitWiseComparisons set to true to disable bit wise comparisons * @return this */ public TupleSerializationProps preventBitWiseComparison( boolean preventBitWiseComparisons ) { this.preventBitWiseComparisons = preventBitWiseComparisons; return this; } public boolean getPreventBitWiseComparisons() { return preventBitWiseComparisons; } @Override protected void addPropertiesTo( Properties properties ) { for( Map.Entry<Integer, String> entry : serializationTokens.entrySet() ) addSerializationToken( properties, entry.getKey(), entry.getValue() ); for( String hadoopSerialization : hadoopSerializations ) addSerialization( properties, hadoopSerialization ); if( ignoreTypes != null ) properties.put( IGNORE_TYPES, ignoreTypes.toString() ); if( requireTypes != null ) properties.put( REQUIRE_TYPES, requireTypes.toString() ); if( preventBitWiseComparisons != null ) properties.put( SERIALIZATION_COMPARISON_BITWISE_PREVENT, preventBitWiseComparisons.toString() ); } }
[ "chris@wensel.net" ]
chris@wensel.net
e28a92760d47f0da39cc07f404189bfe7a06fae6
522a45cca00f505bbe6d447d504e831b8d5a4b99
/magna_tron/src/main/java/magna_tron/ejb/PiattoServiceEnum.java
2baec461c2b20a90259e227dd0b28682688a8928
[]
no_license
DanieleCampagnoli/tesina_awd_magnatron
791a2eacd6ed6adaaa019d4817db0d687a74f1f3
378e5e6634bb563e88f8bf051cb92f2396ffbd92
refs/heads/master
2021-01-11T23:42:41.651266
2017-01-11T10:30:46
2017-01-11T10:30:46
78,623,641
0
0
null
null
null
null
UTF-8
Java
false
false
317
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package magna_tron.ejb; /** * modella la gerarchia Piatto */ public enum PiattoServiceEnum { PRIMO,SECONDO,CONTORNO,DESSERT }
[ "it.daniele.campagnoli@gmail.com" ]
it.daniele.campagnoli@gmail.com
9abe6c54728fd8264a7a6789002335388d76075c
ff47e72cab345b55570f8e012bf2b0d940c2db50
/Bureau/controle continue java/gitmaven/Fraction/src/main/java/uvsq21404240/Fraction.java
7d995021aa64f1b89612fec36a922f69074617a5
[]
no_license
uvsq21404240/Goblet
66f65dba9f0b5f615adabf45b59d3e5b8801305d
a5698b01c1351426af47bf64f2d9275a0247fa5c
refs/heads/master
2020-03-20T12:01:07.743351
2018-04-22T23:50:15
2018-04-22T23:50:15
137,418,623
0
0
null
null
null
null
UTF-8
Java
false
false
2,461
java
package uvsq21404240; public final class Fraction { //Classe immuable : on peut pas changer la valeur des attributs (pas la peine de mettre final dans la declaration de la classe car les attributs le sont deja) private final int num; private final int den; public static Fraction ZERO = new Fraction(); public static Fraction UN = new Fraction(1,1); public Fraction(int n, int d){ num = n; if (d == 0) throw new ArithmeticException(); else den = d; } public Fraction(int n){ num = n; den = 1; } public Fraction(){ num = 0; den = 1; } public int getNum(){return num;} public int getDen(){return den;} public double getVal(){ return ( (double) num ) / ( (double) den ); } private int pgcd(int a, int b) { if (a == b) return a; if (a > b ) return pgcd(a-b, b); return pgcd (a, b-a); } public Fraction reduc() { int d = pgcd(this.num,this.den); return new Fraction(this.num / d, this.den / d); } public static Fraction add(Fraction F1, Fraction F2) { if (F1.den == F2.den){ Fraction Res = new Fraction(F1.num + F2.num, F1.den); return Res.reduc(); } else { return new Fraction(F1.num*F2.den + F2.num*F1.den, F1.den * F2.den); //return Res.reduc(); } } public static Fraction div(Fraction F1, Fraction F2) { if (F2.getVal() == 0) throw new ArithmeticException(); return new Fraction(F1.num * F2.den, F1.den * F2.num); } public static boolean egale(Fraction F1, Fraction F2) { Fraction F11 = F1.reduc(); Fraction F22 = F2.reduc(); if ( F11.num == F22.num && F11.den == F22.den ) return true; return false; } public String toString() { if (this.den == 1) return ( this.num + "" ); if (this.den == -1) return ("-"+this.num); return ( this.num + "/" + this.den ) ; } public static String compare(Fraction F1, Fraction F2) { if (F1.num*F2.den == F2.num*F1.den) return (F1.toString() + " = " + F2.toString()); if (F1.num*F2.den < F2.num*F1.den) return (F1.toString() + " < " + F2.toString() ); return (F1.toString() + " > " + F2.toString() ); } }
[ "pust@hotmail.fr" ]
pust@hotmail.fr
4adaced847c4b97bfc130df75c4ff83555a46bd2
3bc783744a5b5265b0c86657314471391b3098ec
/app/src/main/java/com/example/appmobil/Adapter/PositionService.java
cae3057f7abb61c4097d078f646fb54dd79aed08
[]
no_license
jortori/AppMobil
9c809727d8caf02fdb6ab08fbe0ec987fe25840d
a51df0c347886e3c70a7265027951f712acb721b
refs/heads/master
2023-08-29T12:08:33.501868
2021-10-05T03:05:07
2021-10-05T03:05:07
413,655,190
0
0
null
null
null
null
UTF-8
Java
false
false
2,676
java
package com.example.appmobil.Adapter; import android.app.Service; import android.content.Context; import android.content.Intent; import android.os.Handler; import android.os.IBinder; import android.widget.Toast; import androidx.annotation.Nullable; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.JsonObjectRequest; import com.android.volley.toolbox.JsonRequest; import org.json.JSONObject; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class PositionService extends Service implements Response.ErrorListener, Response.Listener<JSONObject>{ String direccion, latitud, longitud, fecha, user, latitude, longitude, address, date; private Context thisContext=this; SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault()); final Handler handler= new Handler(); Runnable runnable; JsonRequest jrq; public static final String usuario = "names"; public static final String lat = "lat"; public static final String lon = "lon"; public static final String dir = "dir"; @Nullable @Override public IBinder onBind(Intent intent) { return null; } @Override public void onCreate(){ } public void onDestroy(){ Toast.makeText(thisContext,"Finalizando el seguimiento ....... " ,Toast.LENGTH_SHORT).show(); handler.removeCallbacks(runnable); } public int onStartCommand(Intent intent, int Flag, int idProcess ){ user = intent.getStringExtra("names"); latitude = intent.getStringExtra("lat"); longitude = intent.getStringExtra("lon"); address = intent.getStringExtra("dir"); Toast.makeText(thisContext,"Iniciando el seguimiento ......" ,Toast.LENGTH_SHORT).show(); insertarcontacto(); return START_STICKY; } private void insertarcontacto(){ Date date = new Date(); fecha = dateFormat.format(date); String ip = "http://23.253.109.115/prueba"; String URL = ip+"/insertar_tracking.php?latitud="+ latitude + "&longitud=" + longitude + "&direccion=" + address + "&usuario=" + user + "&fecha=" + fecha; URL = URL.replace(" ","%20"); URL = URL.replace("#","No "); jrq = new JsonObjectRequest(Request.Method.GET, URL, null,this,this); VolleySingleton.getInstanciaVolley(thisContext).addToRequestQueue(jrq); } @Override public void onErrorResponse(VolleyError error) { } @Override public void onResponse(JSONObject response) { } }
[ "jtorresr@cogesa.com" ]
jtorresr@cogesa.com
ff74ad288034c72f0d05687311fb5a39907c6150
0eead762595e1a8b9552bee3be477a40cb54b791
/src/main/java/me/xhawk87/Coinage/commands/GiveCurrency.java
2178b63f783ed9099c7aae467799acf22be22f45
[]
no_license
XHawk87/Coinage
7b7f5c652d3e23b3c2378f3bc28189ec3c7233a8
f1f8daac1c697dc261fcdd379a7d4daa2eeae2b4
refs/heads/master
2020-05-19T08:50:20.832026
2016-12-23T16:31:29
2016-12-23T16:31:29
12,929,048
1
4
null
null
null
null
UTF-8
Java
false
false
4,457
java
/* * Copyright (C) 2013-2016 XHawk87 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package me.xhawk87.Coinage.commands; import me.xhawk87.Coinage.Coinage; import me.xhawk87.Coinage.Currency; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; /** * * @author XHawk87 */ public class GiveCurrency extends CoinCommand { private Coinage plugin; public GiveCurrency(Coinage plugin) { this.plugin = plugin; } @Override public String getHelpMessage(CommandSender sender) { return "/GiveCurrency [value] - Gives the specified value in the default currency to the player issuing the command\n" + "/GiveCurrency [currency] [value] - Gives the specified value in the given currency to the player issuing the command\n" + "/GiveCurrency [player] [amount] - Gives the specified value in the default currency to the given player\n" + "/GiveCurrency [player] [currency] [value] - Gives the specified value in the given currency to the given player"; } @Override public String getPermission() { return "coinage.commands.givecoins"; } @Override public boolean execute(CommandSender sender, String[] args) { if (args.length < 1 || args.length > 3) { return false; } int index = 0; Player player = null; Currency currency; if (args.length >= 2) { String firstArg = args[index++]; if (args.length == 3) { player = plugin.getServer().getPlayer(firstArg); if (player == null) { sender.sendMessage("There is no player matching " + firstArg); return true; } String currencyName = args[index++]; currency = plugin.getCurrency(currencyName); if (currency == null) { sender.sendMessage("There is no currency with name " + currencyName); return true; } } else { currency = plugin.getCurrency(firstArg); if (currency == null) { player = plugin.getServer().getPlayer(firstArg); if (player == null) { sender.sendMessage("There is no matching player or currency with name " + firstArg); return true; } currency = plugin.getDefaultCurrency(); } } } else { currency = plugin.getDefaultCurrency(); } if (player == null) { if (sender instanceof Player) { player = (Player) sender; } else { sender.sendMessage("The console must specify a player"); return true; } } int totalValue; String valueString = args[index++]; try { totalValue = Integer.parseInt(valueString); if (totalValue < 1) { sender.sendMessage("The value must be a positive number: " + valueString); return true; } } catch (NumberFormatException ex) { sender.sendMessage("The value must be a valid number: " + valueString); return true; } if (currency.give(player, totalValue)) { sender.sendMessage(totalValue + " in " + currency.toString() + " was given to " + player.getDisplayName()); } else { sender.sendMessage("Failed to give " + totalValue + " in " + currency.toString() + " to " + player.getDisplayName() + " as the correct amount could not be made out. Perhaps there should be a single-unit denomination so this type of thing cannot happen?"); } return true; } }
[ "hawk87@hotmail.co.uk" ]
hawk87@hotmail.co.uk
cd05da9922a76887ee98f436e2486a73e6a7c5a9
aa34b5c6c1c33db0019df65c861a403873a31c39
/com.stone.core/com.stone.tools/src/main/java/com/stone/tools/http/handler/RemoteRequestHandler.java
e83309343eead95893eaa5dafeab01337b236048
[ "Apache-2.0" ]
permissive
g-stone/com.stone
c3cef7b6f5fe6971bf9a53abc806401ea8d492f6
b47c99694eb9bfd9e62b01e1045d9a8caea05801
refs/heads/master
2021-09-10T15:13:43.042012
2018-03-28T09:36:34
2018-03-28T09:36:34
112,596,356
0
0
null
null
null
null
UTF-8
Java
false
false
3,001
java
/** * HisRequestHandler.java * @author lixinpeng * @DATE: 2017年8月3日 @TIME: 下午3:54:03 * Copyright (C) 2017 西安上达信息科技有限公司 */ package com.stone.tools.http.handler; import java.io.IOException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger; import com.stone.tools.ConverteUtils; import com.stone.tools.http.Handler; import com.stone.tools.http.model.RemoteResponseModel; /** * 功能说明:HTTP请求结果解析API * * @author lixinpeng * @param <C> * @DATE: 2017年8月3日 @TIME: 下午3:54:03 */ public class RemoteRequestHandler<C> extends Handler<RemoteResponseModel<C>>{ private static Logger logger = Logger.getLogger(RemoteRequestHandler.class); /** * @param realType */ public RemoteRequestHandler(Class<C> realType, boolean level) { super(realType, level); } @SuppressWarnings("unchecked") @Override public RemoteResponseModel<C> handleResponse(HttpResponse response) throws ClientProtocolException, IOException { String result = ""; RemoteResponseModel<C> model = null; HttpEntity entity = response.getEntity(); result = EntityUtils.toString(entity, "UTF-8"); if(StringUtils.isBlank(result)){ return model; } Map<String, Object> responseMap = ConverteUtils.toMap(result); model = new RemoteResponseModel<C>(); Object tmpValue = responseMap.get("resultStatus"); if(StringUtils.isBlank(String.valueOf(tmpValue))){ model.setResultCode(-1); model.setMessage("HIS服务超时或异常,请稍后重试"); }else{ model.setResultCode(Integer.parseInt(tmpValue.toString())); tmpValue = responseMap.get("info"); if(tmpValue != null){ model.setMessage(tmpValue.toString()); } } if(model.getResultCode() == 1){ Object data = responseMap.get("data"); if(data != null){ Method build; try { build = realType.getDeclaredMethod("build", new Class[]{Map.class}); if(level){//list List<Map<String, Object>> dataMap = (List<Map<String, Object>>)data; List<C> list = new ArrayList<C>(); for(Map<String, Object> map:dataMap){ C c = (C) realType.newInstance(); build.invoke(data, new Object[]{map}); list.add(c); } model.setDatas(list); }else{//object C c = (C) realType.newInstance(); build.invoke(data, new Object[]{(Map<String, Object>)data}); model.setData(c); } } catch (Exception e) { logger.error("请求返回内容解析异常--->" + e.getMessage(), e); } } } logger.debug("dected type: " + realType.getName() + ",level:" + level); return model; } }
[ "noreply@github.com" ]
noreply@github.com
a2b164ccbc8c8ad3237150167b47be15e5d815e5
341db605a4b8543da9cf30fce4c134e0efa39ab0
/src/main/java/com/collegedemo/student/StudentRepository.java
e45c69f459f8b3e555e5684a1cdb937e2a615874
[]
no_license
kumaran-is/springboot-springdatajdbc-demo
18598c80e63371a4e1f3185784fb095b46c1cb5b
089f5325b09bf1bb1408ffc2a99dd7b30d6c9d14
refs/heads/main
2023-07-26T19:42:19.322830
2021-09-08T04:56:36
2021-09-08T04:56:36
404,172,555
0
0
null
null
null
null
UTF-8
Java
false
false
800
java
package com.collegedemo.student; import java.util.Optional; import org.springframework.stereotype.Repository; import org.springframework.data.jdbc.repository.query.Modifying; import org.springframework.data.jdbc.repository.query.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; @Repository public interface StudentRepository extends CrudRepository<Student, Long> { Optional<Student> findStudentByEmail(String email); @Modifying @Query("UPDATE student SET name = :name WHERE id = :id") boolean updateByName(@Param("id") Long id, @Param("name") String name); @Modifying @Query("UPDATE student SET email = :email WHERE id = :id") boolean updateByEmail(@Param("id") Long id, @Param("email") String email); }
[ "noreply@github.com" ]
noreply@github.com
808975c8a85cc25ef9785f140e9eee139c807779
d96b4af1e6753d5d84b618924bc821f596fed0c1
/src/Aufgabe3_4_5/Boook.java
652425620b644a606fb59a1ab466d54339bd9701
[]
no_license
Blackhole91/1710653518_UE4
f78bc58b3caa0e2e81c9ab8dd8c6a6f3ec1141da
47667dcab5129271453a1cf39d028502ad719c50
refs/heads/master
2020-04-10T23:18:36.986981
2018-12-11T14:43:35
2018-12-11T14:43:35
161,348,268
0
0
null
null
null
null
UTF-8
Java
false
false
1,087
java
package Aufgabe3_4_5; import java.util.Date; public class Boook { private int pages; private String title; private String isbn; private Date released; public Boook(int pages, String title, String isbn, Date released) { this.pages = pages; this.title = title; this.isbn = isbn; this.setReleased(released); } @Override public String toString(){ return String.format(this.getTitle()+" hat "+this.getPages()+" Seiten und folgende ISBN: "+this.getIsbn()); } public int getPages() { return pages; } public void setPages(int pages) { this.pages = pages; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getIsbn() { return isbn; } public void setIsbn(String isbn) { this.isbn = isbn; } public Date getReleased() { return released; } public void setReleased(Date released) { this.released = released; } }
[ "37113864+Blackhole91@users.noreply.github.com" ]
37113864+Blackhole91@users.noreply.github.com
ea963b6c9eb61f4b5680693c58c961c05211f31b
225dc82ed2c76aa2b839edc870bc256ef1abc819
/src/rpc/RpcHelper.java
b49bad289f55cc077af2e84d3ba40922ee4d7285
[]
no_license
l0ganc/TiTan
703f6bd10d9ad224ead4725562fd3e90ca0adb09
6ab9e84f44b5a0c7fb7053260567dedf10f093dc
refs/heads/master
2020-04-01T17:13:38.277530
2018-10-17T08:10:57
2018-10-17T08:10:57
153,419,129
1
0
null
null
null
null
UTF-8
Java
false
false
2,008
java
package rpc; import java.io.BufferedReader; import java.io.PrintWriter; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.json.JSONArray; import org.json.JSONObject; import entity.Item; public class RpcHelper { // Parses a JSONObject from http request. public static JSONObject readJsonObject(HttpServletRequest request) { StringBuffer jb = new StringBuffer(); String line = null; try { BufferedReader reader = request.getReader();//Body while ((line = reader.readLine()) != null) { jb.append(line); } reader.close(); return new JSONObject(jb.toString()); } catch (Exception e) { e.printStackTrace(); } return null; } // Writes a JSONObject to http response. public static void writeJsonObject(HttpServletResponse response, JSONObject obj) { try { response.setContentType("application/json"); response.addHeader("Access-Control-Allow-Origin", "*"); PrintWriter out = response.getWriter(); out.print(obj); out.flush(); out.close(); } catch (Exception e) { e.printStackTrace(); } } // Writes a JSONArray to http response. public static void writeJsonArray(HttpServletResponse response, JSONArray array) { try { response.setContentType("application/json"); response.addHeader("Access-Control-Allow-Origin", "*"); PrintWriter out = response.getWriter(); out.print(array); out.flush(); out.close(); } catch (Exception e) { e.printStackTrace(); } } // Converts a list of Item objects to JSONArray. public static JSONArray getJSONArray(List<Item> items) { JSONArray result = new JSONArray(); try { for (Item item : items) { result.put(item.toJSONObject()); } } catch (Exception e) { e.printStackTrace(); } return result; } }
[ "jingyige@usc.edu" ]
jingyige@usc.edu
855d825b95f68bbb29f0c817313ec5e80a96b3e0
e0455e62ab2fb9c68220521e0948f979071226cf
/src/test/java/ai/solvers/IterativeDeepeningDepthFirstSolverTest.java
5ba872bad77db7e9d06f42a275c4a12b11d4b6c3
[]
no_license
rasmusbergpalm/AI
46b17e6eae319e5582ec10c6a8f1adf507767a4f
0e0f03fe91dfcd6011a6a18bc58cc03c9df2502c
refs/heads/master
2021-01-18T21:12:21.395255
2016-05-23T14:43:29
2016-05-23T14:43:29
16,454,932
1
0
null
2016-05-23T14:43:42
2014-02-02T13:23:21
Java
UTF-8
Java
false
false
614
java
package ai.solvers; import ai.problems.QueensProblem; import com.google.common.base.Optional; import org.junit.Test; import java.util.Random; import static org.junit.Assert.assertTrue; public class IterativeDeepeningDepthFirstSolverTest { @Test public void can_solve_queens_problems() { final QueensProblem problem = new QueensProblem(new Random(), 4); final Solver solver = new IterativeDeepeningDepthFirstSolver(); final Optional<QueensProblem> solution = solver.solve(problem); assertTrue(solution.isPresent()); assertTrue(solution.get().isSolved()); } }
[ "rasmusbergpalm@gmail.com" ]
rasmusbergpalm@gmail.com
904b94dfefa30a4ec16ffd6571f17d4d3f57e0be
be83108a25317dd29e51ed0541d5696814cee0a7
/src/com/his/dao/PacienteRegDao.java
a3a3da213ae1da3aa3c6b4562ffa15966fcb1577
[]
no_license
redthreadser/publicHis
ab3ee04acdf144693ca942fe7a0622f03f874013
facd2f1d857186fb094967c6c930a4ad916ce2ae
refs/heads/master
2020-03-17T21:39:28.569517
2018-05-18T15:05:41
2018-05-18T15:05:41
133,968,291
0
0
null
null
null
null
UTF-8
Java
false
false
716
java
package com.his.dao; import java.util.List; import com.his.entity.Doctor; import com.his.entity.Paciente; public interface PacienteRegDao { public int doPacienteReg(Paciente paciente); //挂号插入患者数据 public List<Doctor> doShowDoctor(); //显示医生信息 public List<Doctor> doShowDepDoctor(int departament_id); //显示科室医生信息 public int doShowDocCount(String doctor_id); //医生挂号人数 public int doDocCount(String doctor_id,int count); //更新医生挂号人数 public int doPayment(double money ,String p_number); //缴费 public double doShowExtraMoney(String p_number,double pr_price); //查询余额 public int clearDocCount(); //清除医生挂号人数 }
[ "1614896464@qq.com" ]
1614896464@qq.com
50c6b87a51b7713ac4514db913982d5a2b09470a
b930ebe45bc320a7fea121ccbf53ec7d0c8707a0
/world/src/world/cn/sinobest/mapreducepicture/ReadImageToHBase.java
2634fb24226f7ee3c7b30ae13fd09946ea152bd4
[]
no_license
kemuchen/chat
edd2f541fec2972a29dac46995cc795d67f6bdf4
201897bbdff8c98286f7ea935aa1fc5ea6d60056
refs/heads/master
2020-04-11T02:43:59.576464
2019-01-08T03:52:55
2019-01-08T03:52:55
161,453,838
0
1
null
null
null
null
GB18030
Java
false
false
3,277
java
package world.cn.sinobest.mapreducepicture; import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil; import org.apache.hadoop.hbase.mapreduce.TableReducer; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.ToolRunner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * * @author 柯雷 * * @time 2018年12月26日 下午1:57:55 * * @description 读取图片保存在HBase中 */ public class ReadImageToHBase extends Configured implements Tool { private static Logger logger = LoggerFactory.getLogger(ReadImageToHBase.class); /** * * @author 柯雷 * * @time 2018年12月26日 下午1:59:09 * * @description 读取图片配置信息 */ public static class ImageToHbaseMapper extends Mapper<LongWritable, Text, Text, NullWritable> { @Override protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { context.write(value, NullWritable.get()); } } /** * * @author 柯雷 * * @time 2018年12月26日 下午1:59:37 * * @description 处理图片保存 */ public static class ImageToHbaseReducer extends TableReducer<Text, NullWritable, NullWritable> { @Override protected void reduce(Text key, Iterable<NullWritable> value, Context context) throws IOException, InterruptedException { logger.info("学生图片信息为:" + key.toString()); String[] images = key.toString().split(","); Put put = new Put(images[0].getBytes()); put.addColumn("info".getBytes(), "image".getBytes(), ImageUtil.imageToBase64(images[1]).getBytes()); context.write(NullWritable.get(), put); } } @Override public int run(String[] arg0) throws Exception { Configuration configuration = HBaseConfiguration.create(); configuration.set("hbase.master", "192.168.24.62:60000"); configuration.set("hbase.zookeeper.quorum", "master:2181"); configuration.set("HADOOP_USER_NAME", "root"); Job job = Job.getInstance(configuration); job.setJarByClass(ReadImageToHBase.class); job.setMapperClass(ImageToHbaseMapper.class); job.setMapOutputKeyClass(Text.class); job.setMapOutputValueClass(NullWritable.class); TableMapReduceUtil.initTableReducerJob("student", ImageToHbaseReducer.class, job, null, null, null, null, false); job.setOutputKeyClass(NullWritable.class); job.setOutputValueClass(Put.class); Path inputPath = new Path(arg0[0]); FileInputFormat.setInputPaths(job, inputPath); boolean success = job.waitForCompletion(true); return success ? 0 : 1; } public static void main(String[] args) throws Exception { int run = ToolRunner.run(new ReadImageToHBase(), args); System.exit(run); } }
[ "Administrator@192.168.24.3" ]
Administrator@192.168.24.3
b6a2c9532de128915a4440f78cbc92e709d0c433
0e38715d5147ea6fa8ce8b32791982d5134f4623
/yundd/src/main/java/com/vomont/yundudao/ui/patrol/PatrolLoadVedioActivity.java
11c8197ee488b8136eda114c8e049a4f3dcd43a7
[]
no_license
xieyunfeng123sao/yundd-zip
5d945541b3e9943fc158cb8e1eb782d0811ebec7
e6a74df4fbd6ef777d7809a18c3bdb180f0e1f41
refs/heads/master
2021-08-31T17:31:25.892083
2017-12-22T07:49:24
2017-12-22T07:49:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
14,731
java
package com.vomont.yundudao.ui.patrol; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.os.Handler; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.util.DisplayMetrics; import android.view.Display; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; import android.widget.TextView; import com.vomont.yundudao.R; import com.vomont.yundudao.ui.factory.adapter.MyFragmentPagerAdapter; import com.vomont.yundudao.ui.patrol.fragment.AllLoadFragment; import com.vomont.yundudao.ui.patrol.fragment.NoLoadFragment; import com.vomont.yundudao.upload.UpLoadReceiver; import com.vomont.yundudao.upload.UpLoadReceiver.OnLoadListener; import com.vomont.yundudao.upload.VideoBean; import com.vomont.yundudao.upload.VideoHelpter; import com.vomont.yundudao.utils.NetWorkSpeedUtils; import com.vomont.yundudao.utils.ShareUtil; @SuppressLint("HandlerLeak") public class PatrolLoadVedioActivity extends FragmentActivity implements OnClickListener { private ImageView load_vedio_back; private TextView tv_unload_vedio; private TextView tv_all_vedio; private TextView vedio_cursor; private ViewPager load_vedio_viewpager; private Context context; private int currIndex;// 当前页卡编号 private ArrayList<Fragment> fragmentList; private VideoHelpter helpter; private List<VideoBean> unUpmlist; private List<VideoBean> upmlist; private ImageView action_delete; private LinearLayout to_loadingactivity; private TextView updata_ks; private TextView now_updata_size; private TextView updata_size; private NoLoadFragment noLoadFragment; private AllLoadFragment allLoadFragment; private UpLoadReceiver mReceiver; private IntentFilter mIntentFilter; private ShareUtil shareUtil; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_patrol_requeset_vedio); shareUtil = new ShareUtil(this); initView(); InitTextBar(); InitViewPager(); initListener(); } private void upProgress() { if (helpter != null) { List<VideoBean> noBeans = helpter.selectNoPack(); if (noBeans != null && noBeans.size() != 0) { List<VideoBean> beans = new ArrayList<VideoBean>(); for (VideoBean videoBean : noBeans) { if ((videoBean.getIsSave() == 1||videoBean.getIsSave() == 3) && (videoBean.getLoadstate() != 2)) { beans.add(videoBean); } } if (beans.size() == 0) { updata_size.setText(0 + "%"); now_updata_size.setText("(" + 0 + ")"); to_loadingactivity.setVisibility(View.GONE); return; } int max = beans.size(); int allNum = 0; for (VideoBean bean : beans) { allNum = allNum + bean.getPos(); } updata_size.setText(allNum / max + "%"); now_updata_size.setText("(" + max + ")"); to_loadingactivity.setVisibility(View.VISIBLE); } else { updata_size.setText(0 + "%"); now_updata_size.setText("(" + 0 + ")"); to_loadingactivity.setVisibility(View.GONE); } } } @Override protected void onResume() { super.onResume(); mIntentFilter = new IntentFilter(); mIntentFilter.addAction("com.vomont.load.info"); mReceiver = new UpLoadReceiver(); registerReceiver(mReceiver, mIntentFilter); mReceiver.setOnLoadListener(new OnLoadListener() { @Override public void onSuccess(int fileId, String url) { handler.sendEmptyMessage(200); } @Override public void onProgress(int fileId, int progress) { runOnUiThread(new Runnable() { public void run() { upProgress(); } }); } @Override public void onFail(int type, int fileId, int errorId) { } }); updata_ks.postDelayed(new Runnable() { public void run() { initData(); upProgress(); } }, 300); } private void initData() { showView(); } @Override protected void onPause() { super.onPause(); unregisterReceiver(mReceiver); } @Override protected void onStop() { super.onStop(); } @Override protected void onDestroy() { super.onDestroy(); } private Handler handler = new Handler() { public void handleMessage(android.os.Message msg) { switch (msg.what) { case 100: updata_ks.setText(msg.obj.toString()); break; case 200: upProgress(); showView(); noLoadFragment.showView(); allLoadFragment.showView(); break; default: break; } }; }; /** * 获取网络的时时网速,使用方法是: * 每隔一段时间读取一次总流量,然后用本次和前一次的差除以间隔时间来获取平均速度,再换算为 K/s M/s * 等单位,显示即可。 * * @return 实时的网速(单位byte) */ public static int getNetSpeedBytes() { String line; String[] segs; int received = 0; int i; int tmp = 0; boolean isNum; try { FileReader fr = new FileReader("/proc/net/dev"); BufferedReader in = new BufferedReader(fr, 500); while ((line = in.readLine()) != null) { line = line.trim(); if (line.startsWith("rmnet") || line.startsWith("eth") || line.startsWith("wlan")) { segs = line.split(":")[1].split(" "); for (i = 0; i < segs.length; i++) { isNum = true; try { tmp = Integer.parseInt(segs[i]); } catch (Exception e) { isNum = false; } if (isNum == true) { received = received + tmp; break; } } } } in.close(); } catch (IOException e) { return -1; } return received; } public void showView() { helpter = new VideoHelpter(this); helpter.getWritableDatabase(); unUpmlist = new ArrayList<VideoBean>(); upmlist = new ArrayList<VideoBean>(); List<VideoBean> allMlist = new ArrayList<VideoBean>(); if (helpter.selectAll() != null) allMlist.addAll(helpter.selectAll()); for (int i = 0; i < allMlist.size(); i++) { if (shareUtil.getShare().getAccountid() == allMlist.get(i).getCreateId()) { if ((allMlist.get(i).getVideoid() == 0) && (allMlist.get(i).getPos() == 0) && (allMlist.get(i).getLoadstate() != 1)&&(allMlist.get(i).getLoadstate() != 3)) { unUpmlist.add(allMlist.get(i)); } if (allMlist.get(i).getLoadstate() == 2) { upmlist.add(allMlist.get(i)); } } } int unUP = 0; int up = 0; if (unUpmlist != null && unUpmlist.size() != 0) { unUP = unUpmlist.size(); List<VideoBean> beans = new ArrayList<VideoBean>(); for (VideoBean videoBean : unUpmlist) { if ((videoBean.getIsSave() == 1||videoBean.getIsSave() == 3) && (videoBean.getLoadstate() != 2)) { beans.add(videoBean); } } if (beans.size() != 0) { to_loadingactivity.setVisibility(View.VISIBLE); } else { to_loadingactivity.setVisibility(View.GONE); } } if (upmlist != null && upmlist.size() != 0) { up = upmlist.size(); } tv_unload_vedio.setText("未上传(" + unUP + ")"); tv_all_vedio.setText("全部(" + (unUP + up) + ")"); } private void initListener() { load_vedio_back.setOnClickListener(this); tv_unload_vedio.setOnClickListener(this); tv_all_vedio.setOnClickListener(this); action_delete.setOnClickListener(this); to_loadingactivity.setOnClickListener(this); } private void initView() { updata_size = (TextView)findViewById(R.id.updata_size); now_updata_size = (TextView)findViewById(R.id.now_updata_size); updata_ks = (TextView)findViewById(R.id.updata_ks); load_vedio_back = (ImageView)findViewById(R.id.load_vedio_back); tv_unload_vedio = (TextView)findViewById(R.id.tv_unload_vedio); tv_all_vedio = (TextView)findViewById(R.id.tv_all_vedio); vedio_cursor = (TextView)findViewById(R.id.vedio_cursor); load_vedio_viewpager = (ViewPager)findViewById(R.id.load_vedio_viewpager); action_delete = (ImageView)findViewById(R.id.action_delete); to_loadingactivity = (LinearLayout)findViewById(R.id.to_loadingactivity); context = this; to_loadingactivity.setVisibility(View.GONE); new NetWorkSpeedUtils(this, handler).startShowNetSpeed(); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.load_vedio_back: finish(); break; case R.id.tv_unload_vedio: load_vedio_viewpager.setCurrentItem(0); break; case R.id.tv_all_vedio: load_vedio_viewpager.setCurrentItem(1); break; case R.id.action_delete: Intent deIntent = new Intent(context, DeleteVideoActivity.class); startActivity(deIntent); break; case R.id.to_loadingactivity: Intent loadIntent = new Intent(context, LoadActivity.class); startActivity(loadIntent); break; default: break; } } /* * 初始化ViewPager */ @SuppressWarnings("deprecation") public void InitViewPager() { fragmentList = new ArrayList<Fragment>(); noLoadFragment = new NoLoadFragment(); allLoadFragment = new AllLoadFragment(); fragmentList.add(noLoadFragment); fragmentList.add(allLoadFragment); // 给ViewPager设置适配器 load_vedio_viewpager.setAdapter(new MyFragmentPagerAdapter(getSupportFragmentManager(), fragmentList)); load_vedio_viewpager.setCurrentItem(0);// 设置当前显示标签页为第一页 load_vedio_viewpager.setOnPageChangeListener(new LoadOnPageChangeListener());// 页面变化时的监听器 } /* * 初始化图片的位移像素 */ public void InitTextBar() { Display display = getWindow().getWindowManager().getDefaultDisplay(); // 得到显示屏宽度 DisplayMetrics metrics = new DisplayMetrics(); display.getMetrics(metrics); // 1/2屏幕宽度 int tabLineLength = metrics.widthPixels / 2; LayoutParams lp = (LayoutParams)vedio_cursor.getLayoutParams(); lp.width = tabLineLength; vedio_cursor.setLayoutParams(lp); } public class LoadOnPageChangeListener implements OnPageChangeListener { @Override public void onPageScrolled(int arg0, float arg1, int arg2) { // 取得该控件的实例 LinearLayout.LayoutParams ll = (android.widget.LinearLayout.LayoutParams)vedio_cursor.getLayoutParams(); if (currIndex == arg0) { ll.leftMargin = (int)(currIndex * vedio_cursor.getWidth() + arg1 * vedio_cursor.getWidth()); } else if (currIndex > arg0) { ll.leftMargin = (int)(currIndex * vedio_cursor.getWidth() - (1 - arg1) * vedio_cursor.getWidth()); } vedio_cursor.setLayoutParams(ll); } @Override public void onPageScrollStateChanged(int arg0) { } @Override public void onPageSelected(int arg0) { currIndex = arg0; if (currIndex == 0) { tv_unload_vedio.setTextColor(getResources().getColor(R.color.main_color)); tv_all_vedio.setTextColor(getResources().getColor(R.color.text_color)); } else { tv_unload_vedio.setTextColor(getResources().getColor(R.color.text_color)); tv_all_vedio.setTextColor(getResources().getColor(R.color.main_color)); } } } }
[ "773675907@qq.com" ]
773675907@qq.com
1b05bb74ff7321001ed092c2c83cc88ca14d881c
0a1a182b017ea7863c4ceda690aba3a02d662269
/TE_mcvpersonas/src/java/com/emergentes/modelo/Persona.java
3df583c91fb056200c8b7e58c32cc87b1c4ef05d
[]
no_license
marizole/participacionMVC
52bea7a4d99de117e2a3fb929d5697515ac5724c
cd2442c5e4fb63836d601936d0c89dc531c80e14
refs/heads/master
2023-04-05T00:12:48.457677
2021-03-29T00:08:35
2021-03-29T00:08:35
352,468,283
0
0
null
null
null
null
UTF-8
Java
false
false
803
java
package com.emergentes.modelo; public class Persona { private int id; private String nombres; private String apellidos; private int edad; //Constructor public Persona() { id = 0; nombres = ""; apellidos = ""; edad = 0; } public int getId() { return id; } public String getNombres() { return nombres; } public String getApellidos() { return apellidos; } public int getEdad() { return edad; } public void setId(int id) { this.id = id; } public void setNombres(String nombres) { this.nombres = nombres; } public void setApellidos(String apellidos) { this.apellidos = apellidos; } public void setEdad(int edad) { this.edad = edad; } }
[ "zoledadsinani@gmail.com" ]
zoledadsinani@gmail.com
f463eea6c2faa5fa0ef1258c4e3e4bdc66a29b33
19183087a9ceea0b7b3ee632ba0452c836242c47
/InglesAventurero/app/src/androidTest/java/com/olfybsppa/inglesaventurero/tests/linesCPtests/ResolverWrapperTest.java
589e1f08f9f1f8a195341b6015e13210dd533e6d
[]
no_license
flocela/IngAve-Android
ce28feb7e0ffbe08d28389978197916b0437d7f0
6111159f27f2eeefce4bf0d1391ff6c5d28f2d42
refs/heads/master
2023-08-21T17:10:22.010072
2021-09-27T21:32:17
2021-09-27T21:32:17
212,629,837
0
0
null
null
null
null
UTF-8
Java
false
false
1,123
java
package com.olfybsppa.inglesaventurero.tests.linesCPtests; import android.database.sqlite.SQLiteDatabase; import android.test.ProviderTestCase2; import android.test.mock.MockContentResolver; import com.olfybsppa.inglesaventurero.start.LinesCP; import com.olfybsppa.inglesaventurero.webscenelistactivity.ResolverWrapper; import com.olfybsppa.inglesaventurero.webscenelistactivity.collectors.CPScene; public class ResolverWrapperTest extends ProviderTestCase2<LinesCP> { private MockContentResolver mMockResolver; private SQLiteDatabase mDb; public ResolverWrapperTest() { super(LinesCP.class, LinesCP.AUTHORITY); } @Override protected void setUp() throws Exception { super.setUp(); mMockResolver = getMockContentResolver(); } public void testContainSceneReturnsTrue () { CPScene scene = new CPScene ("firstScene", "primerTitulo", "firstTitle", "0", "0"); mMockResolver.insert(LinesCP.sceneTableUri, scene.getTitleTableContentValues()); ResolverWrapper resolverWrapper = new ResolverWrapper(mMockResolver); assertTrue(resolverWrapper.containsScene(scene.sceneName)); } }
[ "flocela@gmail.com" ]
flocela@gmail.com
ef5b6e1755c19591bd2b96f04db25bba53f1a3c3
9635d9e96a502c0bb54964a4b5f844965818fb33
/SpringBootJwtOAuth2ClientServerTutorial/src/main/java/com/warumono/client/SpringBootJwtOAuth2ClientServerTutorialApplication.java
23235c701293e9e66502f5b056d97812ea0fc7f6
[ "Apache-2.0" ]
permissive
warumono-for-develop/spring-boot-jwt-oauth2-client-server-tutorial
ec075ad2d58a32f75e7fea67082923ca86c143b1
4b6b660e93e85b1394a4b81da8c7b22022ca85bd
refs/heads/master
2021-04-05T23:38:52.889254
2018-03-12T16:16:35
2018-03-12T16:16:35
124,916,823
1
0
null
null
null
null
UTF-8
Java
false
false
377
java
package com.warumono.client; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class SpringBootJwtOAuth2ClientServerTutorialApplication { public static void main(String[] args) { SpringApplication.run(SpringBootJwtOAuth2ClientServerTutorialApplication.class, args); } }
[ "nakamura@218.38.137.28" ]
nakamura@218.38.137.28
8db52ba4321eca5beb0a3700ca66f9b9239f7a0d
6cd0176c87ddad964aa4b8eb3fedc65be88a092a
/Factory/Test.java
1109d3eeccfdec6db3821f163f1c5a3f254d0daa
[]
no_license
adilbeq/Programming-abstractions
cb7284919d9c2f55ff4129f7b1fb894e0b4c3368
f1784034a633a59b0b6b92ec2b48213b6e5497c3
refs/heads/master
2020-04-11T09:37:22.522741
2018-12-13T19:27:58
2018-12-13T19:27:58
161,685,035
2
0
null
null
null
null
UTF-8
Java
false
false
695
java
public class Test{ public static void main(String[] args) { String myOS = System.getProperty("os.name").toLowerCase(); //System.out.println(myOS); Creator create = getOS(myOS); // Creator create = getOS("mac"); // Creator create = getOS("linux"); OS os = create.createOS(); os.createButton(); os.createCommandLine(); os.createDesktop(); os.createControlPanel(); os.createFolder(); } public static Creator getOS(String os){ if(os.indexOf("win") >= 0){ return new WindowsCreator(); } if(os.indexOf("mac") >= 0){ return new MacCreator(); } if(os.indexOf("lin") >= 0){ return new LinuxCreator(); } throw new RuntimeException("No such OS: " + os); } }
[ "38554034+adilbeq@users.noreply.github.com" ]
38554034+adilbeq@users.noreply.github.com
4afd4629a09ff8176238dfd75f8403e05476cd2d
ef0c039e27f173a3aa4e82ab4e26edc93f9e28e0
/instant-run/instant-run-client/src/main/java/com/android/tools/ir/client/UpdateMode.java
9e30b52dda1d4c910444d70d935b87d4f801336c
[]
no_license
ggaier/android_platform_tools_base
1091a25aa220665d7eb02481426f4941d0fedd18
85c6b73c22cd23c069d94eb19c824d4fb74a5ec9
refs/heads/master
2020-09-17T11:33:48.674204
2019-11-26T02:43:12
2019-11-26T02:43:12
224,085,780
1
3
null
null
null
null
UTF-8
Java
false
false
2,041
java
/* * Copyright (C) 2015 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.tools.ir.client; import static com.android.tools.ir.common.ProtocolConstants.UPDATE_MODE_COLD_SWAP; import static com.android.tools.ir.common.ProtocolConstants.UPDATE_MODE_HOT_SWAP; import static com.android.tools.ir.common.ProtocolConstants.UPDATE_MODE_NONE; import static com.android.tools.ir.common.ProtocolConstants.UPDATE_MODE_WARM_SWAP; import com.android.annotations.NonNull; /** * Mode which describes what kind of patch update we'll apply in the app: a hot swap (apply code and * just continue running), a warm swap (restart activity), or a cold swap: a full app restart. */ public enum UpdateMode { /** * No updates */ NO_CHANGES(UPDATE_MODE_NONE), /** * Patch changes directly, keep app running without any restarting */ HOT_SWAP(UPDATE_MODE_HOT_SWAP), /** * Patch changes, restart activity to reflect changes */ WARM_SWAP(UPDATE_MODE_WARM_SWAP), /** * Store change in app directory, restart app */ COLD_SWAP(UPDATE_MODE_COLD_SWAP); private final int myId; UpdateMode(int id) { myId = id; } /** * The ID for this mode, which is the actual value sent across the wire to the app */ public int getId() { return myId; } @NonNull public UpdateMode combine(@NonNull UpdateMode with) { return values()[Math.max(ordinal(), with.ordinal())]; } }
[ "jwenbo52@gmail.com" ]
jwenbo52@gmail.com
fbe8a5decca07c566a021676a12f111345bafb57
9114b7770b7be7538ab20e736a2e3bea630565a9
/src/main/java/com/zhbit/car/controller/GpsController.java
8178831ea0a7fa498bf46721f231090bf79e9985
[]
no_license
YumSong/zhbit_car
5716f2af88289425c5863179e2ec6e1c0b0da533
09f27651d3ed4b3d28b166341a5c46c9a2968162
refs/heads/master
2021-01-01T17:50:09.652690
2017-08-09T03:08:53
2017-08-09T03:08:53
98,170,027
1
0
null
null
null
null
UTF-8
Java
false
false
3,598
java
package com.zhbit.car.controller; import com.alibaba.fastjson.JSONObject; import com.zhbit.car.util.OperateTemplete; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; import javax.servlet.http.HttpServletRequest; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * Created by admin on 2017/7/26. */ @Controller public class GpsController { @Autowired private JedisPool jedisPool; /** * 显示车辆gps * * @param lng * @param lat * @param request * @return */ @RequestMapping("/showCarByGPS") @ResponseBody public Map showDriverByGPS(@RequestParam("lng") String lng, @RequestParam("lat") String lat, final HttpServletRequest request) { final Double callat = Double.valueOf(lat); final Double callng = Double.valueOf(lng); OperateTemplete templete = new OperateTemplete(request) { protected void doSomething() throws Exception { if (doValidate()) { map.put("driverList", getLastListTest(callat,callng)); } } }; return templete.operate(); } /** * 根据经纬度计算 * @param userlat * @param userlng * @return */ public List<Map> getLastListTest (double userlat, double userlng){ Jedis jedis = jedisPool.getResource(); List<Map> getGps= new ArrayList<Map>(); String str = jedis.get("getGps"); List<Map> list = JSONObject.parseObject(str,ArrayList.class); String s = jedis.get("gpsArea"); double apartLength = (s!=null)?Double.valueOf(s):800; for (Map map : list){ if(getShortDistance(userlng,userlat,Double.valueOf(map.get("longitude").toString()),Double.valueOf(map.get("latitude").toString())) < apartLength){ getGps.add(map); } } jedis.close(); return getGps; } /** * 计算距离 * @param lon1 * @param lat1 * @param lon2 * @param lat2 * @return */ public static double getShortDistance(double lon1, double lat1, double lon2, double lat2) { double DEF_PI = 3.14159265359; // PI double DEF_2PI= 6.28318530712; // 2*PI double DEF_PI180= 0.01745329252; // PI/180.0 double DEF_R =6370693.5; // radius of earth double ew1, ns1, ew2, ns2; double dx, dy, dew; double distance; // 角度转换为弧度 ew1 = lon1 * DEF_PI180; ns1 = lat1 * DEF_PI180; ew2 = lon2 * DEF_PI180; ns2 = lat2 * DEF_PI180; // 经度差 dew = ew1 - ew2; // 若跨东经和西经180 度,进行调整 if (dew > DEF_PI) dew = DEF_2PI - dew; else if (dew < -DEF_PI) dew = DEF_2PI + dew; dx = DEF_R * Math.cos(ns1) * dew; // 东西方向长度(在纬度圈上的投影长度) dy = DEF_R * (ns1 - ns2); // 南北方向长度(在经度圈上的投影长度) // 勾股定理求斜边长 distance = Math.sqrt(dx * dx + dy * dy); return distance; } }
[ "hongrs@zhthinkjoy.com" ]
hongrs@zhthinkjoy.com
fe2b4af6efc990d64d17d070972c7cf2642e062e
cc3a1f7132b023f02f22a9d4136a83090a4ae43b
/library/src/jp/co/cyberagent/android/gpuimage/GPUImageView.java
6519d0188ce484e7db8878dec9dc794b81e3a6ac
[]
no_license
ufo22940268/Android-Blur
12be8b2ec730a6b4ae176895722cec7c0d68e275
beb3689e818be28158e6cd9e363a2853016258b8
refs/heads/master
2021-01-10T20:00:20.416769
2015-09-15T06:18:58
2015-09-15T06:18:58
42,492,954
12
2
null
null
null
null
UTF-8
Java
false
false
14,943
java
/* * Copyright (C) 2012 CyberAgent * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package jp.co.cyberagent.android.gpuimage; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Color; import android.media.MediaScannerConnection; import android.net.Uri; import android.opengl.GLES20; import android.opengl.GLSurfaceView; import android.os.*; import android.util.AttributeSet; import android.view.Gravity; import android.view.ViewTreeObserver; import android.widget.FrameLayout; import android.widget.ProgressBar; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.nio.IntBuffer; import java.util.concurrent.Semaphore; public class GPUImageView extends FrameLayout { private GLSurfaceView mGLSurfaceView; private GPUImage mGPUImage; private GPUImageFilter mFilter; public Size mForceSize = null; private float mRatio = 0.0f; public GPUImageView(Context context) { super(context); init(context, null); } public GPUImageView(Context context, AttributeSet attrs) { super(context, attrs); init(context, attrs); } private void init(Context context, AttributeSet attrs) { mGLSurfaceView = new GPUImageGLSurfaceView(context, attrs); mGLSurfaceView.setDebugFlags(GLSurfaceView.DEBUG_LOG_GL_CALLS); addView(mGLSurfaceView); mGPUImage = new GPUImage(getContext()); mGPUImage.setGLSurfaceView(mGLSurfaceView); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (mRatio != 0.0f) { int width = MeasureSpec.getSize(widthMeasureSpec); int height = MeasureSpec.getSize(heightMeasureSpec); int newHeight; int newWidth; if (width / mRatio < height) { newWidth = width; newHeight = Math.round(width / mRatio); } else { newHeight = height; newWidth = Math.round(height * mRatio); } int newWidthSpec = MeasureSpec.makeMeasureSpec(newWidth, MeasureSpec.EXACTLY); int newHeightSpec = MeasureSpec.makeMeasureSpec(newHeight, MeasureSpec.EXACTLY); super.onMeasure(newWidthSpec, newHeightSpec); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } /** * Retrieve the GPUImage instance used by this view. * * @return used GPUImage instance */ public GPUImage getGPUImage() { return mGPUImage; } // TODO Should be an xml attribute. But then GPUImage can not be distributed as .jar anymore. public void setRatio(float ratio) { mRatio = ratio; mGLSurfaceView.requestLayout(); mGPUImage.deleteImage(); } /** * Set the scale type of GPUImage. * * @param scaleType the new ScaleType */ public void setScaleType(GPUImage.ScaleType scaleType) { mGPUImage.setScaleType(scaleType); } /** * Sets the rotation of the displayed image. * * @param rotation new rotation */ public void setRotation(Rotation rotation) { mGPUImage.setRotation(rotation); requestRender(); } /** * Set the filter to be applied on the image. * * @param filter Filter that should be applied on the image. */ public void setFilter(GPUImageFilter filter) { mFilter = filter; mGPUImage.setFilter(filter); requestRender(); } /** * Get the current applied filter. * * @return the current filter */ public GPUImageFilter getFilter() { return mFilter; } /** * Sets the image on which the filter should be applied. * * @param bitmap the new image */ public void setImage(final Bitmap bitmap) { mGPUImage.setImage(bitmap); } /** * Sets the image on which the filter should be applied from a Uri. * * @param uri the uri of the new image */ public void setImage(final Uri uri) { mGPUImage.setImage(uri); } /** * Sets the image on which the filter should be applied from a File. * * @param file the file of the new image */ public void setImage(final File file) { mGPUImage.setImage(file); } public void requestRender() { mGLSurfaceView.requestRender(); } /** * Save current image with applied filter to Pictures. It will be stored on * the default Picture folder on the phone below the given folderName and * fileName. <br> * This method is async and will notify when the image was saved through the * listener. * * @param folderName the folder name * @param fileName the file name * @param listener the listener */ public void saveToPictures(final String folderName, final String fileName, final OnPictureSavedListener listener) { new SaveTask(folderName, fileName, listener).execute(); } /** * Save current image with applied filter to Pictures. It will be stored on * the default Picture folder on the phone below the given folderName and * fileName. <br> * This method is async and will notify when the image was saved through the * listener. * * @param folderName the folder name * @param fileName the file name * @param width requested output width * @param height requested output height * @param listener the listener */ public void saveToPictures(final String folderName, final String fileName, int width, int height, final OnPictureSavedListener listener) { new SaveTask(folderName, fileName, width, height, listener).execute(); } /** * Retrieve current image with filter applied and given size as Bitmap. * * @param width requested Bitmap width * @param height requested Bitmap height * @return Bitmap of picture with given size * @throws InterruptedException */ public Bitmap capture(final int width, final int height) throws InterruptedException { // This method needs to run on a background thread because it will take a longer time if (Looper.myLooper() == Looper.getMainLooper()) { throw new IllegalStateException("Do not call this method from the UI thread!"); } mForceSize = new Size(width, height); final Semaphore waiter = new Semaphore(0); // Layout with new size getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { getViewTreeObserver().removeGlobalOnLayoutListener(this); } else { getViewTreeObserver().removeOnGlobalLayoutListener(this); } waiter.release(); } }); post(new Runnable() { @Override public void run() { // Show loading addView(new LoadingView(getContext())); mGLSurfaceView.requestLayout(); } }); waiter.acquire(); // Run one render pass mGPUImage.runOnGLThread(new Runnable() { @Override public void run() { waiter.release(); } }); requestRender(); waiter.acquire(); Bitmap bitmap = capture(); mForceSize = null; post(new Runnable() { @Override public void run() { mGLSurfaceView.requestLayout(); } }); requestRender(); postDelayed(new Runnable() { @Override public void run() { // Remove loading view removeViewAt(1); } }, 300); return bitmap; } /** * Capture the current image with the size as it is displayed and retrieve it as Bitmap. * @return current output as Bitmap * @throws InterruptedException */ public Bitmap capture() throws InterruptedException { final Semaphore waiter = new Semaphore(0); final int width = mGLSurfaceView.getMeasuredWidth(); final int height = mGLSurfaceView.getMeasuredHeight(); // Take picture on OpenGL thread final int[] pixelMirroredArray = new int[width * height]; mGPUImage.runOnGLThread(new Runnable() { @Override public void run() { final IntBuffer pixelBuffer = IntBuffer.allocate(width * height); GLES20.glReadPixels(0, 0, width, height, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, pixelBuffer); int[] pixelArray = pixelBuffer.array(); // Convert upside down mirror-reversed image to right-side up normal image. for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { pixelMirroredArray[(height - i - 1) * width + j] = pixelArray[i * width + j]; } } waiter.release(); } }); requestRender(); waiter.acquire(); Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); bitmap.copyPixelsFromBuffer(IntBuffer.wrap(pixelMirroredArray)); return bitmap; } /** * Pauses the GLSurfaceView. */ public void onPause() { mGLSurfaceView.onPause(); } /** * Resumes the GLSurfaceView. */ public void onResume() { mGLSurfaceView.onResume(); } public static class Size { int width; int height; public Size(int width, int height) { this.width = width; this.height = height; } } private class GPUImageGLSurfaceView extends GLSurfaceView { public GPUImageGLSurfaceView(Context context) { super(context); } public GPUImageGLSurfaceView(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (mForceSize != null) { super.onMeasure(MeasureSpec.makeMeasureSpec(mForceSize.width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(mForceSize.height, MeasureSpec.EXACTLY)); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } } private class LoadingView extends FrameLayout { public LoadingView(Context context) { super(context); init(); } public LoadingView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public LoadingView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } private void init() { ProgressBar view = new ProgressBar(getContext()); view.setLayoutParams( new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.CENTER)); addView(view); setBackgroundColor(Color.BLACK); } } private class SaveTask extends AsyncTask<Void, Void, Void> { private final String mFolderName; private final String mFileName; private final int mWidth; private final int mHeight; private final OnPictureSavedListener mListener; private final Handler mHandler; public SaveTask(final String folderName, final String fileName, final OnPictureSavedListener listener) { this(folderName, fileName, 0, 0, listener); } public SaveTask(final String folderName, final String fileName, int width, int height, final OnPictureSavedListener listener) { mFolderName = folderName; mFileName = fileName; mWidth = width; mHeight = height; mListener = listener; mHandler = new Handler(); } @Override protected Void doInBackground(final Void... params) { try { Bitmap result = mWidth != 0 ? capture(mWidth, mHeight) : capture(); saveImage(mFolderName, mFileName, result); } catch (InterruptedException e) { e.printStackTrace(); } return null; } private void saveImage(final String folderName, final String fileName, final Bitmap image) { File path = Environment .getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); File file = new File(path, folderName + "/" + fileName); try { file.getParentFile().mkdirs(); image.compress(Bitmap.CompressFormat.JPEG, 80, new FileOutputStream(file)); MediaScannerConnection.scanFile(getContext(), new String[]{ file.toString() }, null, new MediaScannerConnection.OnScanCompletedListener() { @Override public void onScanCompleted(final String path, final Uri uri) { if (mListener != null) { mHandler.post(new Runnable() { @Override public void run() { mListener.onPictureSaved(uri); } }); } } }); } catch (FileNotFoundException e) { e.printStackTrace(); } } } public interface OnPictureSavedListener { void onPictureSaved(Uri uri); } }
[ "ufo22940268@gmail.com" ]
ufo22940268@gmail.com
ef0c8cbae1318b69ceb8cb0a13c5fee545186f3f
df7fca738e1d89ba86b9aab5f02cb53fb62b7706
/src/dingchuang/page/PagerBean.java
b674aaa9f44bf44e860d0db1c0f64539e2931c9b
[]
no_license
chenbuer/DC
16a52df7554b79c5399ab48dd885d018b6d4c44b
ebf9ae7fd321ad101913b1f8f35bb71be5c7378b
refs/heads/master
2021-01-11T22:21:59.476978
2017-02-12T17:09:14
2017-02-12T17:09:14
78,762,433
0
0
null
null
null
null
UTF-8
Java
false
false
1,804
java
package dingchuang.page; import java.util.List; public class PagerBean { public int countSize =0;// 总条数 public int pageSize = 10;// 每页显示条数 public int totalPage = 0;// 总页数 public int curPage = 1;// 当前所在页 private String hql = null;//hql语句 public List<?> list = null;// 每页中数据 public int firstPage = 1;// 第一页 public int lastPage = 1;// 最后一页 private String href; public List<?> getList() { return list; } public void setList(List<?> list) { this.list = list; } public int getCurPage() { return curPage; } public void setCurPage(int curPage) { this.curPage = curPage; } public int getCountSize() { return countSize; } public void setCountSize(int countSize) { this.countSize = countSize; this.totalPage = this.countSize%this.pageSize==0?this.countSize/this.pageSize:this.countSize/this.pageSize+1; this.firstPage = this.totalPage>=1?1:0; this.lastPage = this.totalPage; } public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; this.totalPage = this.countSize%this.pageSize==0?this.countSize/this.pageSize:this.countSize/this.pageSize+1; } public int getFirstPage() { return firstPage; } public void setFirstPage(int firstPage) { this.firstPage = firstPage; } public int getLastPage() { return lastPage; } public void setLastPage(int lastPage) { this.lastPage = lastPage; } public int getTotalPage() { return totalPage; } public void setTotalPage(int totalPage) { this.totalPage = totalPage; } public String getHql() { return hql; } public void setHql(String hql) { this.hql = hql; } public String getHref() { return href; } public void setHref(String href) { this.href = href; } }
[ "chenzy08@126.com" ]
chenzy08@126.com
ba5fc340943a33c8cd28440ec27cb711734d96d8
5bd4bcbcc78188254c111b1d8e18b61d3787f096
/scw-user/src/main/java/com/atguigu/scw/ScwUserApplication.java
6053178f348b39bbb93046d6e89a0d1ec66f7c70
[]
no_license
ccyj1024/Books
4b123370615d0fc94a4c756514ee53eec3936f1e
cdb46de25ff9cc8f99a81c28f7158400f7baf1a0
refs/heads/master
2022-06-21T18:32:19.269471
2019-09-11T09:17:11
2019-09-11T09:17:11
207,772,112
0
0
null
2022-06-21T01:51:17
2019-09-11T09:17:33
JavaScript
UTF-8
Java
false
false
817
java
package com.atguigu.scw; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.netflix.hystrix.EnableHystrix; import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard; import org.springframework.cloud.openfeign.EnableFeignClients; @EnableHystrixDashboard @EnableHystrix @EnableFeignClients @EnableDiscoveryClient @SpringBootApplication @MapperScan("com.atguigu.scw.user.mapper") //指定需要扫描的mapper接口所在的包名 public class ScwUserApplication { public static void main(String[] args) { SpringApplication.run(ScwUserApplication.class, args); } }
[ "ccyj1024@126.com" ]
ccyj1024@126.com
151edb878eb0f8ff5594175f0dd33b396a90770d
dcf1ea6065803d86084376a9bf5da116b9491e66
/projects/maxDankow/src/main/java/ru/mipt/diht/students/maxdankow/threads/RollCaller.java
c816a3a35ee225312b879a6e779705f170016727
[]
no_license
max-dankow/fizteh-java-2015
0df114853a61546c7e71073ea6af084912776353
9df582c3a3effc60ba8c2c5c910217853ea8855d
refs/heads/master
2021-01-18T07:58:23.274197
2015-12-18T21:26:55
2015-12-18T21:26:55
42,645,116
0
0
null
2015-09-17T08:42:00
2015-09-17T08:41:59
null
UTF-8
Java
false
false
2,617
java
package ru.mipt.diht.students.maxdankow.threads; import java.util.Random; import java.util.concurrent.*; public class RollCaller { private static volatile Integer count = 0; public static Integer getCount() { return count; } public static void iAmReady() { synchronized (count) { ++count; } } // Ожидает завершения всех потоков в исполнителе. public final void waitForAll(ExecutorService exec) { exec.shutdown(); try { while (!exec.isTerminated()) { exec.awaitTermination(Integer.MAX_VALUE, TimeUnit.SECONDS); } } catch (InterruptedException e) { e.printStackTrace(); } } public final void rollCall(int unitNumber) { ExecutorService exec = Executors.newCachedThreadPool(); CyclicBarrier barrier = new CyclicBarrier(unitNumber, () -> { synchronized (count) { if (count == unitNumber) { System.out.println("NICE =)"); exec.shutdownNow(); } else { synchronized (count) { count = 0; System.out.println("AGAIN!"); } } } }); for (int id = 1; id <= unitNumber; ++id) { exec.execute(new RollCallUnit(id, barrier)); } waitForAll(exec); } private class RollCallUnit implements Runnable { private int id; private CyclicBarrier barrier; private final Random random = new Random(); private final int randomUpperBound = 99; private final int successBound = 10; RollCallUnit(int newId, CyclicBarrier newBarrier) { id = newId; barrier = newBarrier; } @Override public String toString() { return "Thread-" + id; } @Override public void run() { try { while (!Thread.interrupted()) { if (random.nextInt(randomUpperBound) < successBound) { System.out.println(this + ": No"); } else { System.out.println(this + ": Yes"); RollCaller.iAmReady(); } barrier.await(); } } catch (InterruptedException ignored) { } catch (BrokenBarrierException e) { e.printStackTrace(); } } } }
[ "max.dankow@gmail.com" ]
max.dankow@gmail.com
baa9fbe554a58fba793024ea26b6223f609146a0
46f488b813620be848da14fa6a5fafe1b0f11271
/svgreal/tags/0.1.99/src/main/java/org/vectomatic/svg/edit/client/command/GenericAddCommand.java
cee2462fbbb0cdbf6f45203e10ecb35ec34300c9
[]
no_license
Sopheaks60/svgreal
37f9da1ea043884c40182f8c66af76ea896a638c
635187f7b2dbbc76a95cd740c3431f3a9a479d0b
refs/heads/master
2016-09-06T01:30:09.361652
2012-02-13T20:45:47
2012-02-13T20:45:47
42,294,399
0
0
null
null
null
null
UTF-8
Java
false
false
2,168
java
/********************************************** * Copyright (C) 2011 Lukas Laag * This file is part of vectomatic2. * * vectomatic2 is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * vectomatic2 is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with vectomatic2. If not, see http://www.gnu.org/licenses/ **********************************************/ package org.vectomatic.svg.edit.client.command; import org.vectomatic.dom.svg.utils.SVGConstants; import org.vectomatic.svg.edit.client.engine.SVGModel; import org.vectomatic.svg.edit.client.model.ModelConstants; import org.vectomatic.svg.edit.client.model.svg.SVGElementModel; import com.extjs.gxt.ui.client.data.BeanModel; import com.extjs.gxt.ui.client.data.BeanModelLookup; import com.extjs.gxt.ui.client.util.Format; /** * Generic command class to record addition of new SVG elements * to the model. * @author laaglu */ public class GenericAddCommand extends CommandBase { protected SVGElementModel model; protected SVGElementModel parentModel; protected String name; protected SVGModel owner; public GenericAddCommand(CommandFactoryBase factory, SVGElementModel model) { super(factory); this.model = model; owner = model.getOwner(); parentModel = (SVGElementModel)model.getParent(); name = model.<String>get(SVGConstants.SVG_TITLE_TAG); } @Override public String getDescription() { return Format.substitute(ModelConstants.INSTANCE.addCmd(), name); } @Override public void commit() { owner.add(parentModel, model); } @Override public void rollback() { owner.remove(model); } @Override public BeanModel asModel() { return BeanModelLookup.get().getFactory(GenericAddCommand.class).createModel(this); } }
[ "laaglu@dc60c957-5e21-f194-42f0-467fbbd2505f" ]
laaglu@dc60c957-5e21-f194-42f0-467fbbd2505f
666e9f7893154958e634fd13827131d03a9b1a46
563f22c8e5bd26e9fe0fdb7010d55723bbbbd942
/platypusEJB/ejbModule/platypusEJB/model/inventarioproductos/managers/ManagerInvDescripcionProducto.java
d7b0a08f71dbc1014936475762ec753597d1a396
[]
no_license
marodriguezr/platypus
5bf9fa378f9cd8439c3225770d97c12f2e2f9e40
d9cdcb2c4cb9f64a4fca793012517fe48ae3f48f
refs/heads/main
2023-03-26T16:57:43.036721
2021-03-25T16:07:18
2021-03-25T16:07:18
345,852,025
0
0
null
2021-03-25T16:07:19
2021-03-09T01:58:15
Java
UTF-8
Java
false
false
2,609
java
package platypusEJB.model.inventarioproductos.managers; import java.util.List; import javax.ejb.EJB; import javax.ejb.LocalBean; import javax.ejb.Stateless; import javax.persistence.Column; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import platypusEJB.model.core.entities.InvDescripcionProducto; import platypusEJB.model.core.entities.InvProducto; import platypusEJB.model.core.entities.InvTipoProducto; import platypusEJB.model.core.managers.ManagerDAO; /** * Session Bean implementation class ManagerInvDescripcionProducto */ @Stateless @LocalBean public class ManagerInvDescripcionProducto { @EJB private ManagerDAO mDAO; /** * Default constructor. */ public ManagerInvDescripcionProducto() { // TODO Auto-generated constructor stub } public void insertarInvDescripcionProducto(InvDescripcionProducto nuevoInvDescripcionProducto , int idTipoProducto) throws Exception { InvTipoProducto invTipoProducto= (InvTipoProducto) mDAO.findById(InvTipoProducto.class, idTipoProducto); nuevoInvDescripcionProducto.setInvTiposProducto(invTipoProducto); mDAO.insertar(nuevoInvDescripcionProducto); } public void actualizarInvDescripcionProducto(InvDescripcionProducto edicionInvDescripcionProducto,int IdInvTipoProductos) throws Exception { InvDescripcionProducto invDescripcionProducto=(InvDescripcionProducto) mDAO.findById(InvDescripcionProducto.class, edicionInvDescripcionProducto.getId()); InvTipoProducto invTipoProducto= (InvTipoProducto) mDAO.findById(InvTipoProducto.class, IdInvTipoProductos); invDescripcionProducto.setId(edicionInvDescripcionProducto.getId()); invDescripcionProducto.setDescripcion(edicionInvDescripcionProducto.getDescripcion()); invDescripcionProducto.setExpirable(edicionInvDescripcionProducto.getExpirable()); invDescripcionProducto.setNombre(edicionInvDescripcionProducto.getNombre()); invDescripcionProducto.setInvTiposProducto(invTipoProducto); mDAO.actualizar(invDescripcionProducto); } public void eliminarInvDescripcionProducto(int idInvDescripcionProducto) throws Exception { InvDescripcionProducto invDescripcionProducto=(InvDescripcionProducto) mDAO.findById(InvDescripcionProducto.class, idInvDescripcionProducto); mDAO.eliminar(InvDescripcionProducto.class, invDescripcionProducto.getId()); } public List<InvDescripcionProducto> findAllInvDescripcionProductos(){ return mDAO.findAll(InvDescripcionProducto.class, "id"); } }
[ "noreply@github.com" ]
noreply@github.com
3ec2e155f458a54be38a93bc10e92b4131017248
6e0226f9ace8640a1248c58151b0b5d480f5ce6b
/src/main/java/duke/command/AddCommand.java
082afbcdbab3ea6c5a65db42c3000a436bb256ff
[]
no_license
HubertHalim/duke
dc5c15f29d6a53bc557ce7f60dc35e5820ed6d93
2b3420cfd4b07a95f990f1e795dc22af62f6abc9
refs/heads/master
2020-12-20T03:52:53.566858
2020-03-02T15:32:36
2020-03-02T15:32:36
235,953,558
0
0
null
2020-02-13T13:25:16
2020-01-24T06:48:05
Java
UTF-8
Java
false
false
1,942
java
package duke.command; import duke.main.UiHandler; import duke.utils.Parser; import duke.utils.Storage; import duke.utils.TaskList; import java.io.IOException; import java.text.ParseException; /** * Add command implementing command interface. */ public class AddCommand implements Command { /** * Executes the command by attempting to add task to list and set ui response to * the appropriate one. * @param task task for this execution * @param uiHandler ui handler to capture response * @param storage storage to be updated * @param taskList list of tasks */ @Override public void execute(String task, UiHandler uiHandler, Storage storage, TaskList taskList) { String[] token = task.split(" ", 2); if (token.length < 2) { uiHandler.setResponse("Adding task failed, task body cannot be empty"); return; } assert token[0].equals("todo") || token[0].equals("event") || token[0].equals("deadline"); try { if (taskList.addToList(token[1], token[0])) { try { storage.storeData(Parser.tasksToStorage(taskList.getList())); } catch (IOException e) { System.out.println("Error in storing data"); } uiHandler.setResponse("I've added this task to the list:\n " + taskList.getList().get(taskList.size() - 1) + "\n" + "Now you have " + taskList.size() + " task(s) in the list"); return; } else { uiHandler.setResponse("Adding task failed, either task body is empty " + "or required time is not specified"); return; } } catch (ParseException e) { uiHandler.setResponse("There is an internal error when parsing command"); return; } } }
[ "huberthalim7@gmail.com" ]
huberthalim7@gmail.com
683df7a2637091427eac3a8951b2ee13e5a71b05
eebabe3c030c42cce01c9e87770e64c1ed656e13
/TestQuoteApp/src/main/java/com/quote/exception/ExceptionHandler.java
7cf40078d9139592b9df38fa88d8f6bf4c8ec69b
[]
no_license
Nikolaevnik13/QuoteSoftDeleteLoggingSecutity
f2e1f7480a6e40251fb862f09727de8a2da0f317
64870a96f9d43255aa076833cc63b11ffb4e9d80
refs/heads/master
2023-01-19T06:18:42.460265
2020-11-17T14:59:32
2020-11-17T14:59:32
312,805,013
0
0
null
null
null
null
UTF-8
Java
false
false
2,425
java
package com.quote.exception; import javax.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; import com.quote.configuration.ILogger; import com.quote.dao.Quote_Log_Repository; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; @ControllerAdvice public class ExceptionHandler extends ResponseEntityExceptionHandler{ @Autowired Quote_Log_Repository quote_Log_Repository; @Autowired ILogger loggerException; private static final Logger LOGGER =LoggerFactory.getLogger(ExceptionHandler.class); @org.springframework.web.bind.annotation.ExceptionHandler(QuoteNotFoundException.class) protected ResponseEntity<QuoteException> handlerQuoteNotFoundExcep(QuoteNotFoundException quoteNotFoundException) { QuoteException ex = new QuoteException(1,"quote is not found","error"); LOGGER.error(ex.getDescription(),quoteNotFoundException); loggerException.logException(ex); return new ResponseEntity<QuoteException>(ex,HttpStatus.NOT_FOUND); } @org.springframework.web.bind.annotation.ExceptionHandler(QuoteExistException.class) protected ResponseEntity<QuoteException> handlerQuoteExistExcep(QuoteExistException quoteExistException) { QuoteException ex = new QuoteException(1,"quote is existx already","error"); LOGGER.error(ex.getDescription(),quoteExistException); loggerException.logException(ex); return new ResponseEntity<QuoteException>(ex,HttpStatus.CONFLICT); } @org.springframework.web.bind.annotation.ExceptionHandler(NegativeArgumentException.class) protected ResponseEntity<QuoteException> handlerNegativeArgumentExcep(NegativeArgumentException negativeException,HttpServletRequest request) { QuoteException ex = new QuoteException(1,"negativ","error"); LOGGER.error(ex.getDescription(),negativeException); loggerException.logException(ex); return new ResponseEntity<QuoteException>(ex,HttpStatus.I_AM_A_TEAPOT); } @Getter @Setter @AllArgsConstructor public static class QuoteException { Integer errorCode; String description; String level; } }
[ "nikolaevnik13@gmail.com" ]
nikolaevnik13@gmail.com
54e68563fb3522fb5bc036eda00815ea07532c60
5431f49ba6fa96a62b807af765d576597ad7e932
/src/main/java/com/diyiliu/util/Constant.java
0e79a4b70d4e12e0ff79620f5d83a1315d25d60d
[]
no_license
diyiliu/TankGame
09ba9c5c02a78254b4c979b51fc98bcf668007b1
c754d8f33a7f594c1d0c04530ca6674278c8b86d
refs/heads/master
2020-12-02T19:41:18.186966
2017-07-20T02:07:40
2017-07-20T02:07:40
96,376,307
0
0
null
null
null
null
UTF-8
Java
false
false
2,321
java
package com.diyiliu.util; import java.io.IOException; import java.io.InputStream; import java.util.Properties; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.atomic.AtomicBoolean; /** * Description: Constant * Author: DIYILIU * Update: 2017-07-04 14:08 */ public final class Constant { public static Boolean GAME_PAUSE = false; // 等级信息 public final static ConcurrentLinkedQueue LEVEL_QUEUE = new ConcurrentLinkedQueue(); static { initData(); } /** * 装载配置 */ public static void initData(){ Properties config = new Properties(); InputStream in = null; try { in = ClassLoader.getSystemResourceAsStream("config.properties"); config.load(in); String stage1 = config.getProperty("stage1"); String stage2 = config.getProperty("stage2"); String stage3 = config.getProperty("stage3"); LEVEL_QUEUE.add(stage1.split(",")); LEVEL_QUEUE.add(stage2.split(",")); LEVEL_QUEUE.add(stage3.split(",")); } catch (Exception e) { e.printStackTrace(); } finally { if (in != null){ try { in.close(); } catch (IOException e) { e.printStackTrace(); } } } } public enum Config { ; public final static int FRAME_WIDTH = 800; public final static int FRAME_HEIGHT = 600; public final static int PANEL_WIDTH = 600; public final static int PANEL_HEIGHT = 600; public final static int DOWN_OFFSET = 90; public final static int RIGHT_OFFSET = 35; } public enum Command { ; public final static String START = "S"; public final static String PAUSE = "P"; public final static String EXIT = "E"; } public enum Direct { ; public final static int DIRECT_UP = 0; public final static int DIRECT_LEFT = 1; public final static int DIRECT_DOWN = 2; public final static int DIRECT_RIGHT = 3; } public enum Army { ; public final static int ARMY_HERO = 1; public final static int ARMY_ENEMY = 0; } }
[ "572772828@qq.com" ]
572772828@qq.com
86ee020cc84a11911e5cfbad946cf4bef378eea8
1f8789dd4ad7d1d8063398c3e546d3065700343e
/src/com/company/Interface.java
72c0b2ca4d166252f36ed59741085123ff24e7a8
[]
no_license
UlyanaShabunina/task4.4
84735cd2462469227c50d77e94bee02f12f5fc3c
1cc46ed05524c9538d240b2b5bf35159411f9ef1
refs/heads/master
2022-11-11T03:38:53.712005
2020-07-06T14:09:35
2020-07-06T14:09:35
277,559,054
0
0
null
null
null
null
UTF-8
Java
false
false
18,337
java
package com.company; import javax.swing.*; import javax.swing.border.EmptyBorder; import javax.swing.table.DefaultTableModel; import javax.swing.table.AbstractTableModel; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.FileNotFoundException; import java.io.PrintStream; import java.sql.SQLOutput; import java.util.ArrayList; import java.util.Scanner; public class Interface extends JFrame { // Модель данных таблицы private DefaultTableModel tableModel; private JTable table1; private int number = 1; private Timer timer1; private int health=0; private JPanel lol; private ArrayList <SortState> ListSort; private JLabel kek1; private JLabel kek2; private JProgressBar dada; private Boolean stop=false; private Boolean flag=true; private Boolean flag2=false; private Boolean flag3=true; private Boolean flag5=false; private int tmp; // Данные для таблиц // Заголовки столбцов private void removeColumn(int index, JTable myTable) { System.out.println(index); int nRow = myTable.getRowCount(); int nCol = myTable.getColumnCount() - 1; Object[][] cells = new Object[nRow][nCol]; String[] names = new String[nCol]; for (int j = 0; j < nCol; j++) { if (j < index) { names[j] = myTable.getColumnName(j); for (int i = 0; i < nRow; i++) { cells[i][j] = myTable.getValueAt(i, j); } } else { names[j] = myTable.getColumnName(j); for (int i = 0; i < nRow; i++) { cells[i][j] = myTable.getValueAt(i, j + 1); } } } tableModel = new DefaultTableModel(cells, names); myTable.setModel(tableModel); number--; } public Interface(String[] args) { super("Пример использования TableModel"); setDefaultCloseOperation(EXIT_ON_CLOSE); // Создание стандартной модели tableModel = new DefaultTableModel(); // Определение столбцов // Наполнение модели данными // Создание таблицы на основании модели данных table1 = new JTable(tableModel); table1.setRowHeight(210); table1.getTableHeader().setReorderingAllowed(false); table1.setColumnSelectionAllowed(true); // Создание кнопки добавления строки таблицы JButton TakeFromFile = new JButton("Из txt"); TakeFromFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { Integer[][] dv; JFileChooser jfc = new JFileChooser("."); jfc.setDialogType(JFileChooser.OPEN_DIALOG); if (jfc.showOpenDialog(Interface.this) != JFileChooser.APPROVE_OPTION) return; String path = jfc.getSelectedFile().getAbsolutePath(); File file = new File(path); Scanner scanner = null; scanner = new Scanner(file); String s; ArrayList<Integer[]> kek = new ArrayList<>(); ArrayList<Integer> ama1 = new ArrayList<>(); while (scanner.hasNextLine()) { s = scanner.nextLine(); String lol[] = s.split(" "); for (int i = 0; i < lol.length; i++) { ama1.add(Integer.parseInt(lol[i])); } Integer[] array1 = new Integer[ama1.size()]; ama1.toArray(array1); kek.add(array1); ama1.clear(); } dv = new Integer[kek.size()][kek.get(0).length]; for (int i = 0; i < kek.size(); i++) { for (int j = 0; j < kek.get(0).length; j++) { dv[i][j] = kek.get(i)[j]; } } for (int g = 0; g < dv.length; g++) { if (table1.getRowCount() == 0) { Integer lol2[] = new Integer[table1.getRowCount()]; for (int i = 0; i < lol2.length; i++) { lol2[i] = 0; } tableModel.addColumn("#" + number, lol2); number++; } // Вставка новой строки после выделенной String[] lol = new String[table1.getRowCount() + 1]; for (int i = 0; i < lol.length; i++) { lol[i] = "0"; } tableModel.addRow(lol); } for (int k = 0; k < dv[0].length - 1; k++) { Integer lol2[] = new Integer[table1.getRowCount()]; for (int i = 0; i < lol2.length; i++) { lol2[i] = 0; } tableModel.addColumn("#" + number, lol2); number++; } for (int g = 0; g < dv.length; g++) { for (int f = 0; f < dv[0].length; f++) { tableModel.setValueAt(dv[g][f], g, f); } } } catch (Exception v) { System.out.println("Введите нормальное имя"); } } }); JButton AddColumn = new JButton("Добавить ячейку"); AddColumn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Номер выделенной строки if (table1.getRowCount() == 0) { Integer lol3[] = new Integer[table1.getRowCount()]; for (int i = 0; i < lol3.length; i++) { lol3[i] = 0; } tableModel.addRow(lol3); } int idx = table1.getSelectedRow(); Integer lol2[] = new Integer[table1.getRowCount()]; for (int i = 0; i < lol2.length; i++) { lol2[i] = 0; } tableModel.addColumn("#" + Integer.toString(number)); number++; } }); JButton Stop = new JButton("Остановка"); Stop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { stop=true; flag3=true; tmp=health; flag5=true; } }); JButton Backward = new JButton("Назад"); Backward.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Номер выделенной строки health=tmp; if (health == 0) { JOptionPane.showMessageDialog(null, "Массив в начальном положении"); } if (health > 0) { if (flag) { health -= 2; } else { health--; } int[] dv3 = new int[ListSort.get(health).getStage().length]; for (int i = 0; i < dv3.length; i++) { dv3[i] = ListSort.get(health).getStage()[i]; } for (int g = 0; g < 1; g++) { for (int f = 0; f < dv3.length; f++) { tableModel.setValueAt(dv3[f], g, f); } } kek1.setText("Переменная i = " + ListSort.get(health).getI()); kek2.setText("Переменная k =" + ListSort.get(health).getK()); dada.setValue((int) (((double) health / (ListSort.size())) * 100)); } else { kek1.setText("Переменная i = " + 0); kek2.setText("Переменная k = " + 0); dada.setValue(0); } flag=false; flag2=true; tmp=health; } }); JButton Forward = new JButton("Вперед"); Forward.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Номер выделенной строки health=tmp; if (!flag){ health++; } flag=true; if (health < ListSort.size()) { int[] dv3 = new int[ListSort.get(health).getStage().length]; for (int i = 0; i < dv3.length; i++) { dv3[i] = ListSort.get(health).getStage()[i]; } for (int g = 0; g < 1; g++) { for (int f = 0; f < dv3.length; f++) { tableModel.setValueAt(dv3[f], g, f); } } kek1.setText("Переменная i = " + ListSort.get(health).getI()); kek2.setText("Переменная k =" + ListSort.get(health).getK()); dada.setValue((int) (((double) health / (ListSort.size())) * 100)); } else { kek1.setText("Переменная i = " + 0); kek2.setText("Переменная k = " + 0); dada.setValue(100); } if (health!=ListSort.size()) { health++; } else { JOptionPane.showMessageDialog(null,"Массив отсортирован"); } flag2=true; flag5=true; tmp=health; } }); JButton Calculate = new JButton("Сортировка"); Calculate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (flag3) { flag3=false; try { int[][] dv2 = new int[table1.getRowCount()][table1.getColumnCount()]; for (int i = 0; i <= table1.getRowCount() - 1; i++) { for (int j = 0; j <= table1.getColumnCount() - 1; j++) { dv2[i][j] = Integer.parseInt(String.valueOf(table1.getValueAt(i, j))); } } int[] dv1 = new int[dv2[0].length]; for (int i = 0; i < dv2[0].length; i++) { dv1[i] = dv2[0][i]; } ListSort = Sort.sort(dv1); timer1 = new Timer(1000, new ActionListener() { public void actionPerformed(ActionEvent e) { if (flag5){ tmp=health; health=0; flag5=false; } if (flag2) { health = 0; flag2 = false; } if (!stop) { //код который нужно выполнить каждую секунду if (health < ListSort.size()) { int[] dv3 = new int[ListSort.get(health).getStage().length]; for (int i = 0; i < dv3.length; i++) { dv3[i] = ListSort.get(health).getStage()[i]; } for (int g = 0; g < 1; g++) { for (int f = 0; f < dv2[0].length; f++) { tableModel.setValueAt(dv3[f], g, f); } } } else { timer1.stop(); } if (health < ListSort.size()) { kek1.setText("Переменная i = " + ListSort.get(health).getI()); kek2.setText("Переменная k =" + ListSort.get(health).getK()); dada.setValue((int) (((double) health / (ListSort.size())) * 100)); } else { kek1.setText("Переменная i = " + 0); kek2.setText("Переменная k = " + 0); dada.setValue(100); } health++; } else { timer1.stop(); } if (dada.getValue()==100){ stop=true; flag3=true; tmp=health; flag5=true; } } }); timer1.start(); //запуск таймера if (!stop) { health = 0; } stop = false; } catch (Exception error) { JOptionPane.showMessageDialog(null, "Для сортировки введите массив из чисел!"); } } } }); // Создание кнопки удаления строки таблицы JButton Remove = new JButton("Удалить"); Remove.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Номер выделенной строки // Удаление выделенной строки try { removeColumn(table1.getSelectedColumn(), table1); }catch (Exception exp){ JOptionPane.showMessageDialog(null, "Добавьте ячейку!"); } } }); JButton Record = new JButton("Запись в txt"); Record.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser jfc = new JFileChooser("."); jfc.setDialogType(JFileChooser.OPEN_DIALOG); if (jfc.showOpenDialog(Interface.this) != JFileChooser.APPROVE_OPTION) return; String path = jfc.getSelectedFile().getAbsolutePath(); path=path+".txt"; File file2 = new File(path); try { PrintStream pw = new PrintStream(file2); int[][] dv2 = new int[table1.getRowCount()][table1.getColumnCount()]; for (int i = 0; i <= table1.getRowCount() - 1; i++) { for (int j = 0; j <= table1.getColumnCount() - 1; j++) { dv2[i][j] = Integer.parseInt(String.valueOf(table1.getValueAt(i, j))); } } for (int g = 0; g < dv2.length; g++) { for (int f = 0; f < dv2[0].length; f++) { pw.print(dv2[g][f] + " "); } pw.println(); } } catch (FileNotFoundException ex) { ex.printStackTrace(); } } }); // Создание таблицы на основе модели данных // Определение высоты строки // Формирование интерфейса Box contents = new Box(BoxLayout.Y_AXIS); contents.add(new JScrollPane(table1)); getContentPane().add(contents); lol = new JPanel(new GridBagLayout()); kek1 = new JLabel("Переменная i = "+0); lol.add(kek1, new GridBagConstraints(0,0,1,1,1,1,GridBagConstraints.NORTH,GridBagConstraints.HORIZONTAL, new Insets(90,2,2,2),0,0)); kek2 = new JLabel("Переменная k ="+0); lol.add(kek2, new GridBagConstraints(0,0,1,1,1,1, GridBagConstraints.NORTH,GridBagConstraints.HORIZONTAL, new Insets(110,2,0,2),0,0)); JPanel buttons = new JPanel(); buttons.add(AddColumn); buttons.add(TakeFromFile); buttons.add(Calculate); buttons.add(Remove); buttons.add(Record); buttons.add(Stop); buttons.add(Forward); buttons.add(Backward); dada = new JProgressBar(); dada.setMinimum(0); dada.setMaximum(100); dada.setPreferredSize(new Dimension(100,15)); buttons.add(dada); getContentPane().add(buttons, "South"); getContentPane().add(lol, "East"); // Вывод окна на экран setSize(900, 300); setLocationRelativeTo(null); setVisible(true); } }
[ "gold.802@bk.ru" ]
gold.802@bk.ru
90de778057d91c8bb88942fb6df6d37aa56899ea
9bc1fc6cd7960c5e9654955f9f68a3df62347c63
/src/test/java/com/blockchyp/client/examples/UpdateBrandingAssetExample.java
8ace3940487723d9db6f5ba12ae5b858faba7a34
[ "MIT" ]
permissive
blockchyp/blockchyp-java
b679a2fc585656320958a16afbf041c25f0ea81d
461a833047ea7ad3ea45630a9d4e41a85ca4c6fc
refs/heads/master
2023-08-31T07:15:00.971027
2023-08-30T18:34:15
2023-08-30T18:34:15
142,058,688
1
2
MIT
2022-11-16T09:28:45
2018-07-23T19:17:51
Java
UTF-8
Java
false
false
1,828
java
package com.blockchyp.client.examples; import java.util.ArrayList; import java.util.Collection; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; import com.blockchyp.client.APICredentials; import com.blockchyp.client.BlockChypClient; import com.blockchyp.client.dto.BrandingAsset; import com.blockchyp.client.dto.BrandingAsset; public class UpdateBrandingAssetExample { @SuppressWarnings({ "rawtypes", "unchecked" }) public static void main(String[] args) throws Exception { APICredentials creds = new APICredentials(); creds.setApiKey(System.getenv("BC_API_KEY")); creds.setBearerToken(System.getenv("BC_BEARER_TOKEN")); creds.setSigningKey(System.getenv("BC_SIGNING_KEY")); BlockChypClient client = new BlockChypClient(creds); // Set request parameters BrandingAsset request = new BrandingAsset(); request.setMediaId("<MEDIA ID>"); request.setPadded(true); request.setOrdinal(10); request.setStartDate("01/06/2021"); request.setStartTime("14:00"); request.setEndDate("11/05/2024"); request.setEndTime("16:00"); request.setNotes("Test Branding Asset"); request.setPreview(false); request.setEnabled(true); // Send the request BrandingAsset response = client.updateBrandingAsset(request); // View the result System.out.println("Response: " + prettyPrint(response)); } public static String prettyPrint(Object object) throws Exception { ObjectWriter writer = new ObjectMapper() .writer() .withDefaultPrettyPrinter(); return object.getClass().getSimpleName() + ": " + writer.writeValueAsString(object); } }
[ "devops@blockchyp.com" ]
devops@blockchyp.com
39e2257fef81f2c94096e83034d1bdc04ee90341
deab26f2f5b766b8d8a338509d2d3b37fee9897a
/src/deliverable1/deli1.java
558f62d8f030a250615220de726f47aa1b847d81
[]
no_license
julhasur/deliverable1
29fd8a45df7815ef93a5a4f1999312edd245d1bc
d4ecc0468ad43736971d175935aedd97f3f61fc2
refs/heads/master
2020-04-07T08:45:17.304056
2018-03-07T07:18:15
2018-03-07T07:18:15
124,196,890
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
1,010
java
package deliverable1; import java.util.Scanner; public class deli1 { /* Write a Java Console program to perform the following task: Input: Your program should read two integer numbers from the user with the same number of digits (example: number1= 234, number2 = 564). Task: Check if each corresponding place in the two numbers (ones, tens, hundreds, …) sums to the same total. Output: Your program should print out: True or False based on the result. */ public static void main(String[]args) { Scanner s1 = new Scanner (System.in); System.out.println("Enter the first number:"); int f=s1.nextInt(); System.out.println("enter the scond number"); int s=s1.nextInt(); System.out.println(getresult(f,s)); } public static boolean getresult(int f,int s) { int res1=(f%10)+(s%10); int res2=((f%100-(f%10))/10)+((s%100-(s%10))/10); int res3=(f/100)+(s/100); if (res1==res2&&res2==res3) { return true; } else { return false; } } }
[ "shuvochowdhury14@fmail.com" ]
shuvochowdhury14@fmail.com
ffe82742649131a9a318b1bec4cff15d415f3c72
3097da76ee42b37f43998b860fc2ee1af7106f62
/src/main/java/com/google/model/DistanceMatrixRow.java
d020f71851580bc7a5ee18f822ef044f3d3cb726
[]
no_license
CarlosOlles/mapsmatrixbb
394091bb4e8ca69bccfaa1c1ff7b2ad2c80a265c
dc9779f8298ddb211c893e16ff94aeddd22c4db7
refs/heads/master
2021-01-23T10:55:38.691861
2018-10-19T06:57:17
2018-10-19T06:57:17
93,105,698
0
0
null
2018-10-19T06:57:18
2017-06-01T22:46:56
Java
UTF-8
Java
false
false
1,132
java
/* * Copyright 2014 Google Inc. All rights reserved. * * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this * file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF * ANY KIND, either express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.google.model; /** * Represents a single row in a Distance Matrix API response. A row represents the results for a * single origin. */ public class DistanceMatrixRow { /** * {@code elements} contains the results for this row, or individual origin. */ private DistanceMatrixElement[] elements; public DistanceMatrixElement[] getElements() { return elements; } public void setElements(DistanceMatrixElement[] elements) { this.elements = elements; } }
[ "carlosolles31@gmail.com" ]
carlosolles31@gmail.com
af960c4cb7a69dbbbb1cbfbfd7cce7afd59cb9d7
5a09fff11b8ffd824c548778fd39936d9a016d71
/micro-blogging-backend/src/main/java/com/ahasan/rest/service/UserService.java
d5ed7e4971206ced096078bc67fb1bfb6a09f7d0
[]
no_license
Jafrul/microblogging-assessment
84323f55306fbe0584dba111d0eaa46eead770b0
2d1981e4131cf4978008d96d92bdb8df03210ffc
refs/heads/master
2023-02-04T12:36:18.696541
2020-12-26T11:26:22
2020-12-26T11:26:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
448
java
package com.ahasan.rest.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ahasan.rest.common.messages.BaseResponse; import com.ahasan.rest.dao.UserDao; import com.ahasan.rest.dto.UserDTO; @Service public class UserService { @Autowired private UserDao userDao; public BaseResponse bloggerSignUp(UserDTO userDTO) { return userDao.bloggerSignUp(userDTO); } }
[ "habibsumoncse@gmail.com" ]
habibsumoncse@gmail.com
0d3aeab74dbdc681b6653f468314c1322c43d6c5
5031bfdf1e4fc2ae87fe715aa320cc75c778b1a7
/webapp/src/main/java/org/learningredis/chapter/six/web/util/Argument.java
07a354e64c605b8bf1338c8c3a6eafefd60073c3
[]
no_license
lj1218/learning-redis
c413ceee0cee081cfce3de904ab570d92f1e2829
0f80fbc79cb27adfb52abcb81418cfb2263be9b7
refs/heads/master
2022-06-26T09:13:11.817686
2019-12-09T14:23:00
2019-12-09T14:23:00
224,228,773
0
0
null
2022-06-17T02:45:56
2019-11-26T15:47:39
Java
UTF-8
Java
false
false
857
java
package org.learningredis.chapter.six.web.util; import java.util.HashMap; import java.util.Map; /** * Created by lj1218. * Date: 2019/12/3 * The primary goal of this class is to wrap all the name value * attributes coming in the request and to put it in a map which * can be used in the program later on. */ public class Argument { private Map<String, String> argumentMap = new HashMap<>(); public Argument(String args) { String[] arguments = args.split(":"); for (String argument : arguments) { String key = argument.split("=")[0]; String value = argument.split("=")[1]; argumentMap.put(key, value); } } public String getValue(String key) { return argumentMap.get(key); } public Map<String, String> getAttributes() { return argumentMap; } }
[ "lj_ebox@163.com" ]
lj_ebox@163.com
b16dd970e611b5ad4e4fcc9b3a0f839ae4edc2e8
c8ab63c413e46ccfa88c435aad2c05102b3d5388
/KNN Classifier/src/knn/bean/KNNSortedData.java
43ca31947ffc136cdab969e3a23ededf13618085
[]
no_license
ashishraj09/AI-Programs
b56e519cfd1a5c6dcfed00eb13604dedb24c5aaa
14c26e924e2bb44cb430faa7653a79e1fd7d6400
refs/heads/master
2022-10-20T15:10:25.407157
2020-07-06T06:42:35
2020-07-06T06:42:35
277,460,037
0
0
null
null
null
null
UTF-8
Java
false
false
773
java
package knn.bean; public class KNNSortedData { private double[] testFeatures; private double distance; private String resultLabel; public double[] getTestFeatures() { return testFeatures; } public void setTestFeatures(double[] testFeatures) { this.testFeatures = testFeatures; } public double getDistance() { return distance; } public void setDistance(double distance) { this.distance = distance; } public String getResultLabel() { return resultLabel; } public void setResultLabel(String resultLabel) { this.resultLabel = resultLabel; } public KNNSortedData(double[] testFeatures, double distance, String resultLabel) { super(); this.testFeatures = testFeatures; this.distance = distance; this.resultLabel = resultLabel; } }
[ "rajashi@myvuw.ac.nz" ]
rajashi@myvuw.ac.nz
78b0c4cb7ae6ef3b7b18777558545973a99239c5
9f578c8b310989149a6c9a7e018c3be160e3c9d5
/src/test/java/com/codewaves/zedge/demo/CachedITunesServiceTests.java
0b5b8fc00fc20c67ee2378720387ff9111b8d8f6
[]
no_license
Codewaves/zedge
7db4023dc90b719fbb296dc07d676db5ad365e9d
8992d9ad532497417e761a849525c1ee20193321
refs/heads/master
2021-01-09T15:44:17.311046
2020-02-23T12:02:23
2020-02-23T12:02:23
242,360,446
0
0
null
null
null
null
UTF-8
Java
false
false
3,585
java
package com.codewaves.zedge.demo; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import com.codewaves.zedge.demo.itunes.CachedITunesServiceImpl; import com.codewaves.zedge.demo.itunes.ITunesServiceImpl; import com.codewaves.zedge.demo.itunes.model.Album; import com.codewaves.zedge.demo.itunes.model.Artist; import com.codewaves.zedge.demo.itunes.model.TopResult; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.cache.CacheManager; import org.springframework.core.io.Resource; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; import org.springframework.test.util.ReflectionTestUtils; @SpringBootTest @DirtiesContext(classMode = ClassMode.AFTER_CLASS) public class CachedITunesServiceTests { @Value("classpath:itunes_top_2.json") private Resource topJsonResource; @Autowired private CachedITunesServiceImpl iTunesService; @Mock private ITunesServiceImpl iTunesServiceMock; @Autowired private CacheManager cacheManager; @BeforeEach public void initMocks(){ MockitoAnnotations.initMocks(this); ReflectionTestUtils.setField(iTunesService, "iTunesService", iTunesServiceMock); } private void evictAllCaches() { for (String name : cacheManager.getCacheNames()) { cacheManager.getCache(name).clear(); } } @Test void searchCacheTest() throws Exception { Artist artist = new Artist(372976, "ABBA"); // Clear all caches evictAllCaches(); // First call should return from network Mockito.when(iTunesServiceMock.searchRequest("abba")).thenReturn(List.of(artist)); List<Artist> result = iTunesService.search("abba"); assertEquals(1, result.size()); // Must be from cache Mockito.when(iTunesServiceMock.searchRequest("abba")).thenThrow(new RuntimeException()); result = iTunesService.search("abba"); assertEquals(1, result.size()); assertEquals(artist, result.get(0)); // Clear cache and check again evictAllCaches(); assertThrows(RuntimeException.class, () -> { iTunesService.search("abba"); }); } @Test void topCacheTest() throws Exception { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); TopResult albums = objectMapper.readValue(topJsonResource.getInputStream(), TopResult.class); // Clear all caches evictAllCaches(); // First call should return from network Mockito.when(iTunesServiceMock.topRequest(372976)).thenReturn(albums.getResults()); List<Album> result = iTunesService.top(372976); assertEquals(2, result.size()); // Must be from cache Mockito.when(iTunesServiceMock.topRequest(372976)).thenThrow(new RuntimeException()); result = iTunesService.top(372976); assertEquals(2, result.size()); assertEquals(albums.getResults(), result); // Clear cache and check again evictAllCaches(); assertThrows(RuntimeException.class, () -> { iTunesService.top(372976); }); } }
[ "skravcenko@codewaves.com" ]
skravcenko@codewaves.com
60a7334d5db5d4614865d822e116da7e49b286d2
fdee9b590a684b2f8b9c06d9cd0fd89051686424
/examples/src/main/java/com/mapred/practice/examples/WordCountReducer.java
1fa642adad976599239124e446034f10e2a56211
[]
no_license
PradeepKumarReddy/HadoopPractice
f7f39375e5cfd9fa471353b0ad18d64404657b52
42f866e2884c23586db48591bb4cf8a28d558fb5
refs/heads/master
2020-05-07T13:44:40.154178
2015-08-01T03:57:37
2015-08-01T03:57:37
38,671,872
0
0
null
null
null
null
UTF-8
Java
false
false
768
java
package com.mapred.practice.examples; import java.io.IOException; import java.util.Iterator; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapred.MapReduceBase; import org.apache.hadoop.mapred.OutputCollector; import org.apache.hadoop.mapred.Reducer; import org.apache.hadoop.mapred.Reporter; public class WordCountReducer extends MapReduceBase implements Reducer<Text, IntWritable, Text, IntWritable> { public void reduce(Text inputKey, Iterator<IntWritable> inputValues, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException { int sum = 0; while(inputValues.hasNext()) { sum += inputValues.next().get(); } output.collect(inputKey, new IntWritable(sum)); } }
[ "narreddyp@gmail.com" ]
narreddyp@gmail.com
830218550af0167166512aa561587db340d9e441
2dbb98664d6e9b9225618586d801c09e978bcaf8
/src/test/java/org/openplanrep/config/WebConfigurerTestController.java
0d5550c14b50525fe6317300a873e014f4c02106
[]
no_license
chrismelky/openPlanB-server
cadec7a2d25f1b3ed6b928288f8d67dec0c823f5
510a564d272331b6f5b54770f0dd2c68d77ef7ad
refs/heads/master
2020-04-16T03:43:23.883539
2019-01-10T12:10:20
2019-01-10T12:10:20
165,242,638
0
0
null
null
null
null
UTF-8
Java
false
false
378
java
package org.openplanrep.config; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class WebConfigurerTestController { @GetMapping("/api/test-cors") public void testCorsOnApiPath() { } @GetMapping("/test/test-cors") public void testCorsOnOtherPath() { } }
[ "chrismelky05@gmail.com" ]
chrismelky05@gmail.com
2b444edcf9b9efc65704ed8cb49e7b64a597942f
b72d27a04b7a8c9d913b3e649e4be86aa60a4ab1
/src/main/java/com/nuce/group3/config/HibernateConf.java
3dcce5b2081df1983d9c0609b4d62c3a79551c6e
[]
no_license
hieupv2404/ProjectFull
4b62f100197b8fc7dd66e69f942d198d5d31c9bb
824ae84dda45bcaa07fd7659beff200536de5a11
refs/heads/master
2023-07-14T02:20:18.652135
2021-03-14T05:05:06
2021-03-14T05:05:06
347,530,809
0
0
null
null
null
null
UTF-8
Java
false
false
2,241
java
//package com.nuce.group3.config; // //import org.apache.commons.dbcp2.BasicDataSource; //import org.springframework.boot.autoconfigure.EnableAutoConfiguration; //import org.springframework.context.annotation.Bean; //import org.springframework.context.annotation.Configuration; //import org.springframework.orm.hibernate5.HibernateTransactionManager; //import org.springframework.orm.hibernate5.LocalSessionFactoryBean; //import org.springframework.transaction.PlatformTransactionManager; //import org.springframework.transaction.annotation.EnableTransactionManagement; // //import javax.sql.DataSource; //import java.util.Properties; // //@Configuration //@EnableTransactionManagement //public class HibernateConf { // // @Bean // public LocalSessionFactoryBean sessionFactory() { // LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); // sessionFactory.setDataSource(dataSource()); // sessionFactory.setPackagesToScan("com.nuce.group3.data.model" ); // sessionFactory.setHibernateProperties(hibernateProperties()); // // return sessionFactory; // } // // @Bean // public DataSource dataSource() { // BasicDataSource dataSource = new BasicDataSource(); // dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); // dataSource.setUrl("jdbc:mysql://localhost:3306/inventory_management?serverTimezone=UTC"); // dataSource.setUsername("root"); // dataSource.setPassword("ult.zda1"); // // return dataSource; // } // // @Bean // public PlatformTransactionManager hibernateTransactionManager() { // HibernateTransactionManager transactionManager // = new HibernateTransactionManager(); // transactionManager.setSessionFactory(sessionFactory().getObject()); // return transactionManager; // } // // private final Properties hibernateProperties() { // Properties hibernateProperties = new Properties(); // hibernateProperties.setProperty( // "hibernate.hbm2ddl.auto", "update"); // hibernateProperties.setProperty( // "hibernate.dialect", "org.hibernate.dialect.MySQL8Dialect"); // // return hibernateProperties; // } //}
[ "hieupv" ]
hieupv
bf22652002145a1608653a40e5237143a9bfc245
702dafeae7762b25a4fee52f72c03e19cb1d0cf0
/src/main/java/com/rsicms/rsuite/containerWizard/jaxb/Acls.java
b1f11d9842197021891a2c3920b09fdd48ac7646
[]
no_license
brent-hartwig/rsuite-container-wizard-plugin
2dc04a01f077eefd96f9469fb47f19907b7846bc
d06b46cd8c9ae93173afaf2d43a018c842fbd1cb
refs/heads/master
2021-01-21T17:06:52.544114
2018-07-19T14:43:09
2018-07-19T14:43:09
55,255,571
0
0
null
null
null
null
UTF-8
Java
false
false
2,740
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference // Implementation, v2.2.11 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2016.06.26 at 08:39:15 AM EDT // package com.rsicms.rsuite.containerWizard.jaxb; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p> * Java class for anonymous complex type. * * <p> * The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element ref="{http://www.rsicms.com/rsuite/ns/conf/container-wizard}acl" maxOccurs="unbounded"/&gt; * &lt;/sequence&gt; * &lt;attribute ref="{http://www.rsuitecms.com/rsuite/ns/metadata}rsuiteId"/&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = {"acl"}) @XmlRootElement(name = "acls") public class Acls { @XmlElement(required = true) protected List<Acl> acl; @XmlAttribute(name = "rsuiteId", namespace = "http://www.rsuitecms.com/rsuite/ns/metadata") protected String rsuiteId; /** * Gets the value of the acl property. * * <p> * This accessor method returns a reference to the live list, not a snapshot. Therefore any * modification you make to the returned list will be present inside the JAXB object. This is why * there is not a <CODE>set</CODE> method for the acl property. * * <p> * For example, to add a new item, do as follows: * * <pre> * getAcl().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list {@link Acl } * * */ public List<Acl> getAcl() { if (acl == null) { acl = new ArrayList<Acl>(); } return this.acl; } /** * Gets the value of the rsuiteId property. * * @return possible object is {@link String } * */ public String getRsuiteId() { return rsuiteId; } /** * Sets the value of the rsuiteId property. * * @param value allowed object is {@link String } * */ public void setRsuiteId(String value) { this.rsuiteId = value; } }
[ "brent_d_hartwig@hotmail.com" ]
brent_d_hartwig@hotmail.com
af28ac69085700f19eafcbdf0e3c372300663a1e
44233f665a5f81bce0c5bcc9669729a735b65f12
/app/src/main/java/com/linhdx/footballfeed/AppObjectNetWork/FootBallDataNetWork/LeagueTableTeamNetWorkStatus.java
ba636a07a648b2bff3d57e4c792903eb4bf48e9a
[]
no_license
linhDx/DoAn2017
8b5ddaba7020de735099a1f5a894f527c6e36038
3b01b1648ed634e094c79b9eda960ea9c094ad69
refs/heads/master
2021-01-19T09:05:26.736433
2017-05-25T05:51:16
2017-05-25T05:51:16
87,720,678
0
0
null
null
null
null
UTF-8
Java
false
false
2,894
java
package com.linhdx.footballfeed.AppObjectNetWork.FootBallDataNetWork; /** * Created by shine on 09/04/2017. */ import java.io.Serializable; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class LeagueTableTeamNetWorkStatus implements Serializable{ @SerializedName("position") @Expose private Integer position; @SerializedName("teamName") @Expose private String teamName; @SerializedName("crestURI") @Expose private String crestURI; @SerializedName("playedGames") @Expose private Integer playedGames; @SerializedName("points") @Expose private Integer points; @SerializedName("goals") @Expose private Integer goals; @SerializedName("goalsAgainst") @Expose private Integer goalsAgainst; @SerializedName("goalDifference") @Expose private Integer goalDifference; @SerializedName("wins") @Expose private Integer wins; @SerializedName("draws") @Expose private Integer draws; @SerializedName("losses") @Expose private Integer losses; private final static long serialVersionUID = 5260925962268521980L; public Integer getPosition() { return position; } public void setPosition(Integer position) { this.position = position; } public String getTeamName() { return teamName; } public void setTeamName(String teamName) { this.teamName = teamName; } public String getCrestURI() { return crestURI; } public void setCrestURI(String crestURI) { this.crestURI = crestURI; } public Integer getPlayedGames() { return playedGames; } public void setPlayedGames(Integer playedGames) { this.playedGames = playedGames; } public Integer getPoints() { return points; } public void setPoints(Integer points) { this.points = points; } public Integer getGoals() { return goals; } public void setGoals(Integer goals) { this.goals = goals; } public Integer getGoalsAgainst() { return goalsAgainst; } public void setGoalsAgainst(Integer goalsAgainst) { this.goalsAgainst = goalsAgainst; } public Integer getGoalDifference() { return goalDifference; } public void setGoalDifference(Integer goalDifference) { this.goalDifference = goalDifference; } public Integer getWins() { return wins; } public void setWins(Integer wins) { this.wins = wins; } public Integer getDraws() { return draws; } public void setDraws(Integer draws) { this.draws = draws; } public Integer getLosses() { return losses; } public void setLosses(Integer losses) { this.losses = losses; } }
[ "doxuanlinhit2.3@gmail.com" ]
doxuanlinhit2.3@gmail.com
db2ffdbc911cdb5ba3b80665be65b0d5c4975c1c
e88474444ecaff387d22e5503b3ad5c0566ee796
/qc/src/org/supersymmetry/simple/sum/Utility.java
55fa3d1204ef427e341cf1872b404394e2b866ba
[]
no_license
9rajeesh/optimization
36901c68bf9cc51aa736de60dc5b9abae3ddb761
eeadcc0f0032ebd9d7460d317b31bbd5ff044acb
refs/heads/master
2023-04-27T03:24:51.023192
2021-05-23T09:34:03
2021-05-23T09:34:03
265,543,685
0
0
null
null
null
null
UTF-8
Java
false
false
3,692
java
package org.supersymmetry.simple.sum; import java.math.BigDecimal; import java.math.MathContext; import java.math.RoundingMode; import java.util.HashMap; import java.util.Map; public class Utility { private static Map<Integer,BigDecimal> factorialCache = new HashMap<Integer,BigDecimal>(); private static Map<Integer,Double> factorialDoubleCache = new HashMap<Integer,Double>(); private static Map<String,BigDecimal> combCache = new HashMap<String,BigDecimal>(); private static Map<String,BigDecimal> powIntCache = new HashMap<String,BigDecimal>(); private static Map<String,BigDecimal> powDoubleCache = new HashMap<String,BigDecimal>(); public static Integer factorial1(Integer factorial) { Integer value = 1; if(factorial.equals(0) || factorial.equals(1)){ return 1; } while(factorial>=1){ value=value*factorial; factorial=factorial-1; } return value; } public static BigDecimal factorial(Integer factorial) { Integer factorialOriginal = new Integer(factorial); BigDecimal value = new BigDecimal(1.0); if(factorialCache.containsKey(factorial)){ return factorialCache.get(factorial); } else if(factorialCache.containsKey(factorial-1)){ value = factorialCache.get(factorial-1).multiply(new BigDecimal(factorialOriginal)); factorialCache.put(factorialOriginal, value); return value; } if(factorial.equals(0) || factorial.equals(1)){ return value; } while(factorial>=1){ value=value.multiply(new BigDecimal(factorial)); factorial=factorial-1; } factorialCache.put(factorialOriginal, value); return value; } public static Double factorial_double(Integer factorial) { Double value = new Double(1.0); if(factorialDoubleCache.containsKey(factorial)){ return factorialDoubleCache.get(factorial); } if(factorial.equals(0) || factorial.equals(1)){ return value; } while(factorial>=1){ value=value*factorial; factorial=factorial-1; } factorialDoubleCache.put(factorial, value); return value; } /* public static Double comb(Integer n, Integer r) { if(r.equals(0)){ return 1.0; } return (factorial(n)+0.0)/(factorial(r)*factorial(n-r)); } */ public static BigDecimal comb(Integer n, Integer r) { if(r.equals(0)){ return new BigDecimal(1.0); } if(combCache.containsKey(n+",C," +r)){ return combCache.get(n+",C," +r); } BigDecimal value = factorial(n) .divide( (factorial(r) .multiply (factorial(n-r))) ); combCache.put(n+",C," +r, value); return value; } public static BigDecimal pow(int i, int j) { Integer i1 = new Integer(i); Integer j1 = new Integer(j); if(powIntCache.containsKey(i1+"P"+j1)){ return powIntCache.get(i1+"P"+j1); } if(j==0){ return new BigDecimal(1.0); } BigDecimal value = new BigDecimal(i); BigDecimal pow = new BigDecimal(i); while(j>1){ pow=pow.multiply(value); j=j-1; } powIntCache.put(i1+"P"+j1,pow); return pow; } public static BigDecimal pow(double i, int j) { Double i1 = new Double(i); Integer j1 = new Integer(j); if(powDoubleCache.containsKey(i1+"P"+j1)){ return powDoubleCache.get(i1+"P"+j1); } if(j==0){ return new BigDecimal(1.0); } BigDecimal value = new BigDecimal(i); BigDecimal pow = new BigDecimal(i); while(j>1){ pow=pow.multiply(value,Conditional.getMathContext()); j=j-1; } powDoubleCache.put(i1+"P"+j1,pow); return pow; } }
[ "RAJEESH CM@DESKTOP-8G30OQA" ]
RAJEESH CM@DESKTOP-8G30OQA
63b373295a8134470c193345ef8fc98c047686a4
2b53178f29629a38a7d4740a9c95f77085439797
/src/main/java/ro/coderdojo/kitpvp/Shop.java
51809f94f5bfa6fba72bcce98ba48459c2fd545f
[]
no_license
Caaarlowsz/KitPvP-46
6b1fc1f090f36750e04db70ee93d0befef14a3e8
2ded221349fddc8de8faa6c82bb79afb9074a9c9
refs/heads/master
2022-01-05T06:15:33.633314
2018-05-24T10:53:12
2018-05-24T10:53:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,254
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package ro.coderdojo.kitpvp; import java.util.HashMap; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; /** * * @author MathZone */ public class Shop implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player p = (Player) sender; Inventory shop = Bukkit.getServer().createInventory(p, 36, "Shop") ; Inventory potions = Bukkit.getServer().createInventory(p, 36, "Potions") ; ItemStack GApple = new ItemStack(Material.GOLDEN_APPLE) ; ItemStack Potion = new ItemStack(Material.POTION) ; shop.setItem(1, GApple); shop. setItem(3 , Potion); p.openInventory(shop); return false; } }
[ "mathzone1@outlook.com" ]
mathzone1@outlook.com
1fcf91b6e8ffda5a4851212c14aca468c1f6f780
79595075622ded0bf43023f716389f61d8e96e94
/app/src/main/java/org/apache/http/conn/ssl/X509HostnameVerifier.java
d0187613204ea92506f1f9b964c2e2ffcadd895e
[]
no_license
dstmath/OppoR15
96f1f7bb4d9cfad47609316debc55095edcd6b56
b9a4da845af251213d7b4c1b35db3e2415290c96
refs/heads/master
2020-03-24T16:52:14.198588
2019-05-27T02:24:53
2019-05-27T02:24:53
142,840,716
7
4
null
null
null
null
UTF-8
Java
false
false
618
java
package org.apache.http.conn.ssl; import java.io.IOException; import java.security.cert.X509Certificate; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.SSLException; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocket; @Deprecated public interface X509HostnameVerifier extends HostnameVerifier { void verify(String str, X509Certificate x509Certificate) throws SSLException; void verify(String str, SSLSocket sSLSocket) throws IOException; void verify(String str, String[] strArr, String[] strArr2) throws SSLException; boolean verify(String str, SSLSession sSLSession); }
[ "toor@debian.toor" ]
toor@debian.toor
842690b818859708029396af9eaddca5cec5d93d
9800fffa43060a906f83bcb7533176295c4d2112
/src/main/java/com/algaworks/repository/EstilosRepository.java
ccbb7f5089a8c7dce3564a714aafce8edd305c13
[]
no_license
DanyVieira/cervejaBrewer
0b2da9a9aee8f86a7bcb5e3c64e865f969103ca7
5b5fe8bcbded7a472d657f5d9b785818b8f1c19e
refs/heads/master
2021-07-13T02:52:06.363166
2018-12-27T18:52:20
2018-12-27T18:52:20
130,261,294
0
0
null
null
null
null
UTF-8
Java
false
false
535
java
package com.algaworks.repository; import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.algaworks.model.Cerveja; import com.algaworks.model.Estilo; @Repository public interface EstilosRepository extends JpaRepository <Estilo,Long>{ //Long é o tipo da chave primaria da tabela em questão public Optional<Estilo> findByNomeIgnoreCase(String Nome);//encontra cerveja pelo Sku desconsiderando se letra maiuscula ou minuscula }
[ "danielevf@gmail.com" ]
danielevf@gmail.com
26e4ee3c9f0c35836172c08cf31f93d3dccaef98
f82cfcb4b7a6a646604d07685885567bbbebc05c
/src/test/java/Dummy/Maven/AppiumTest.java
5ea3646ddc22b9ee8e8fbcc14f0783e940323c8b
[]
no_license
op999588/GitDemo
b1849d2efbf17b91c52edab83fffd47e45d3eff0
99fa23d22f388f08d1ed8d815aa863c3c049409a
refs/heads/master
2023-05-14T18:04:01.946714
2021-06-13T12:32:31
2021-06-13T12:32:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
247
java
package Dummy.Maven; import org.testng.Assert; import org.testng.annotations.Test; public class AppiumTest { @Test public void appiumTest() { System.out.println("It's appium test"); Assert.assertEquals(true, true); } }
[ "op999588@gmail.com" ]
op999588@gmail.com
02b265b7ed37cabf43e137dbf9af70f9b775de8c
e13860ecc8ff1d295bc61a6d119a3a83da2e022d
/Lobby/AFLobby/src/aflobby/Misc.java
c6c5d41bfdff06a4af389c75ab954bf8ab64fd9e
[]
no_license
spring/svn-spring-archive
9c45714c6ea8c3166b5678209aea4b7a126028ea
538e90585ed767ee713955221bfdd89410321447
refs/heads/master
2020-12-30T09:58:08.400276
2014-10-15T00:46:52
2014-10-15T00:46:52
25,232,864
2
3
null
null
null
null
UTF-8
Java
false
false
20,061
java
package aflobby; /* * Misc.java * * Created on 27 May 2006, 21:09 * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ /** * * @author AF */ import aflobby.helpers.CBase64Coder; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.net.InetAddress; import java.net.MalformedURLException; import java.net.NetworkInterface; import java.net.URISyntaxException; import java.net.URL; import java.net.UnknownHostException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Enumeration; import java.util.logging.Level; import java.util.logging.Logger; public class Misc { public static final byte EOL = 13; private static String hex = "0123456789ABCDEF"; public static String getOrdinalFor(int value) { int hundredRemainder = value % 100; int tenRemainder = value % 10; if(hundredRemainder - tenRemainder == 10) { return "th"; } switch (tenRemainder) { case 1: return "st"; case 2: return "nd"; case 3: return "rd"; default: return "th"; } } public static String chat_string_create_urls(String input) { //"(http:|ftp:|teamspeak:|https:|ftps:|file|www\\.|ftp\\.|://)[a-z0-9/~_:#?&=\\.-]*[a-z0-9/]" jjjjjjjjjj //return input.replaceAll ("[^\"]((http:|ftp:|teamspeak:|https:|ftps:|file|www\\.|ftp\\.|://)[a-z0-9/~_:#?&=\\.-]*[a-z0-9/])[^\"]","<a href=\"$1\">$1</a>").replaceAll ("href=\"www.","href=\"http://www."); String t = input; // t.replaceAll("((http:|ftp:|teamspeak:|https:|ftps:|file:|www|ftp\\.|://)[a-zA-Z0-9%/~_:;#?&=\\.-]*[a-zA-Z0-9%/])", ">$0"); t = t.replaceAll("(>[^<]*?)((http:|ftp:|teamspeak:|https:|ftps:|file|www|ftp\\.|://)[a-zA-Z0-9%/~_:#;?&=\\.-]*[a-zA-Z0-9%/])", "$1<a href=\"$2\">$2</a>"); //replaceAll ("href=\"www.","href=\"http://www."); t = t.replaceAll("=\">", "=\""); t = t.replaceAll("=\"www.", "=\"http://www."); //t = t.substring (1); //t = t.replaceAll ("([^<;])((ftp|http|https|gopher|mailto|news|nntp|telnet|wais|file|prospero|aim|webcal):[A-Za-z0-9/](([A-Za-z0-9$_.+!*(),;/?:@&~=-])|%[A-Fa-f0-9]{2})+(#([a-zA-Z0-9][a-zA-Z0-9$_.+!*(),;/?:@&~=%-]*))?)[^>]","<a href=\"$0\">$0</a>"); return t; } // public static String easyDateFormat(String format) { Date today = new Date(); SimpleDateFormat formatter = new SimpleDateFormat(format); return formatter.format(today); } public static String easyDateFormat(long date, String format) { Date d = new Date(date); SimpleDateFormat formatter = new SimpleDateFormat(format); return formatter.format(d); } /** * puts together strings from sl, starting at sl[startIndex] * @param sl * @param startIndex * @return */ public static String makeSentence(String[] sl, int startIndex) { if (startIndex > sl.length - 1) { return ""; } String res = new String(sl[startIndex]); for (int i = startIndex + 1; i < sl.length; i++) { res = res.concat(" " + sl[i]); } return res; } /** * Strips html of all tags allowing it to be shown without any formatting * * Specifically, it will take out all instances of < > and & replacing them with their html characters * @param s * @return */ public static String toHTML(String s) { String s1 = ""; char c; for (int i = 0; i < s.length(); i++) { c = s.charAt(i); if (c == '<' || c == '>' || c == '&') { s1 += "&#" + (byte) c + ";"; } else { s1 += "" + c; } } return s1; } /* returns false if char is not an allowed character in the name of a channel, nickname, username, ... */ public static boolean isValidChar(char c) { if (((c >= 48) && (c <= 57)) || ((c >= 65) && (c <= 90)) || ((c >= 97) && (c <= 122)) || (c == 95) || (c == 91) || (c == 93)) { return true; } else { return false; } } /* returns false if name (of a channel, nickname, username, ...) is invalid */ public static boolean isValidName(String name) { for (int i = 0; i < name.length(); i++) { if (!isValidChar(name.charAt(i))) { return false; } } return true; } public static boolean isValidPass(String pass) { if (pass.length() < 2) { return false; } if (pass.length() > 30) { return false; // md5-base64 encoded passwords require 24 chars } // we have to allow a bit wider range of possible chars as base64 can produce chars such as +, = and / for (int i = 0; i < pass.length(); i++) { if ((pass.charAt(i) < 43) || (pass.charAt(i) > 122)) { return false; } } return true; } public static String boolToStr(boolean b) { if (b) { return "1"; } else { return "0"; } } public static boolean strToBool(String s) { if (s.equals("1")) { return true; } else { return false; } } public static char[] byteToHex(byte b) { char[] res = new char[2]; res[0] = hex.charAt((b & 0xF0) >> 4); res[1] = hex.charAt(b & 0x0F); return res; } /* this method will return local IP address such as "192.168.1.100" instead of "127.0.0.1". * Found it here: http://forum.java.sun.com/thread.jspa?threadID=619056&messageID=3477258 * */ public static String getLocalIPAddress() { try { Enumeration e = NetworkInterface.getNetworkInterfaces(); while (e.hasMoreElements()) { NetworkInterface netface = (NetworkInterface) e.nextElement (); Enumeration e2 = netface.getInetAddresses(); while (e2.hasMoreElements()) { InetAddress ip = (InetAddress) e2.nextElement (); if (!ip.isLoopbackAddress() && ip.getHostAddress().indexOf(":") == -1) { return ip.getHostAddress(); } } } } catch (Exception e) { return null; } return null; } public static long IP2Long(String IP) { long f1; long f2; long f3; long f4; String[] tokens = IP.split("\\."); if (tokens.length != 4) { return -1; } try { f1 = Long.parseLong(tokens[0]) << 24; f2 = Long.parseLong(tokens[1]) << 16; f3 = Long.parseLong(tokens[2]) << 8; f4 = Long.parseLong(tokens[3]); return f1 + f2 + f3 + f4; } catch (Exception e) { return -1; } } /* converts time (in milliseconds) to "<x> days, <y> hours and <z> minutes" string */ public static String timeToDHM(long duration) { long temp = duration / (1000 * 60 * 60 * 24); String res = temp + " days, "; duration -= temp * (1000 * 60 * 60 * 24); temp = duration / (1000 * 60 * 60); res += temp + " hours and "; duration -= temp * (1000 * 60 * 60); temp = duration / (1000 * 60); res += temp + " minutes"; return res; } /* * copied from: http://www.source-code.biz/snippets/java/3.htm * * Reallocates an array with a new size, and copies the contents * of the old array to the new array. * @param oldArray the old array, to be reallocated. * @param newSize the new array size. * @return A new array with the same contents. */ public static Object resizeArray(Object oldArray, int newSize) { int oldSize = java.lang.reflect.Array.getLength(oldArray); Class elementType = oldArray.getClass().getComponentType(); Object newArray = java.lang.reflect.Array.newInstance(elementType, newSize); int preserveLength = Math.min(oldSize, newSize); if (preserveLength > 0) { System.arraycopy(oldArray, 0, newArray, 0, preserveLength); } return newArray; } public static String getHashText(String plainText, String algorithm) throws NoSuchAlgorithmException { MessageDigest mdAlgorithm = MessageDigest.getInstance(algorithm); mdAlgorithm.update(plainText.getBytes()); byte[] digest = mdAlgorithm.digest(); StringBuffer hexString = new StringBuffer(); for (int i = 0; i < digest.length; i++) { plainText = Integer.toHexString(0xFF & digest[i]); if (plainText.length() < 2) { plainText = "0" + plainText; } hexString.append(plainText); } return hexString.toString(); } public static byte[] getMD5(String plainText) throws NoSuchAlgorithmException { MessageDigest mdAlgorithm = MessageDigest.getInstance("md5"); mdAlgorithm.update(plainText.getBytes()); byte[] digest = mdAlgorithm.digest(); return digest; } public static String getURLContent(String url, String defvalue) { try { String q = ""; URL yahoo = new URL(url); BufferedReader in; in = new BufferedReader(new InputStreamReader(yahoo.openStream())); String inputLine; while ((inputLine = in.readLine()) != null) { q += inputLine+"\n"; } in.close(); return q; } catch (MalformedURLException ex) { ex.printStackTrace(); return defvalue; } catch(UnknownHostException e){ return defvalue; }catch (IOException ex) { ex.printStackTrace(); return defvalue; } } // this method encodes plain-text password to md5 hashed one in base-64 form: public static String encodePassword(String plainPassword) { //return getURLContent("http://michielvdb.byethost7.com/lobbypass.php?pass="+plainPassword,plainPassword); try { return new String(CBase64Coder.encode(getMD5(plainPassword))); //new sun.misc.BASE64Encoder().encode } catch (Exception e) { // this should not happen! System.out.println("WARNING: Serious error occured: " + e.getMessage()); //TASServer.closeServerAndExit(); return plainPassword; } } /* this method is thread-safe (or at least it is if not called from multiple threads with same Exception object) * and must remain such since multiple threads may call it. */ public static String exceptionToFullString(Exception e) { String res = e.toString(); StackTraceElement[] trace = e.getStackTrace(); for (int i = 0; i < trace.length; i++) { res += "\r\n\tat " + trace[i]; } return res; } /* various methods dealing with battleStatus: */ public static int getReadyStatusFromBattleStatus(int battleStatus) { return (battleStatus & 0x2) >> 1; } /*public static int getSpectatorFromBattleStatus(int battleStatus) { //return (battleStatus & 0x2) >> 1; return battleStatus & (1 << 5) }*/ // public static int getTeamNoFromBattleStatus(int battleStatus) { return (battleStatus & 0x3C) >> 2; } public static int getAllyNoFromBattleStatus(int battleStatus) { return (battleStatus & 0x3C0) >> 6; } public static int getModeFromBattleStatus(int battleStatus) { return (battleStatus & 0x400) >> 10; } public static int getHandicapFromBattleStatus(int battleStatus) { return (battleStatus & 0x3F800) >> 11; } public static int getTeamColorFromBattleStatus(int battleStatus) { return (battleStatus & 0x3C0000) >> 18; } public static int getSyncFromBattleStatus(int battleStatus) { return (battleStatus & 0xC00000) >> 22; } public static int getSideFromBattleStatus(int battleStatus) { return (battleStatus & 0xF000000) >> 24; } public static int setReadyStatusOfBattleStatus(int battleStatus, int ready) { return (battleStatus & 0xFFFFFFFD) | (ready << 1); } public static int setTeamNoOfBattleStatus(int battleStatus, int team) { return (battleStatus & 0xFFFFFFC3) | (team << 2); } public static int setAllyNoOfBattleStatus(int battleStatus, int ally) { return (battleStatus & 0xFFFFFC3F) | (ally << 6); } public static int setModeOfBattleStatus(int battleStatus, int mode) { return (battleStatus & 0xFFFFFBFF) | (mode << 10); } public static int setHandicapOfBattleStatus(int battleStatus, int handicap) { return (battleStatus & 0xFFFC07FF) | (handicap << 11); } public static int setTeamColorOfBattleStatus(int battleStatus, int color) { return (battleStatus & 0xFFC3FFFF) | (color << 18); } public static int setSyncOfBattleStatus(int battleStatus, int sync) { return (battleStatus & 0xFF3FFFFF) | (sync << 22); } public static int setSideOfBattleStatus(int battleStatus, int side) { return (battleStatus & 0xF0FFFFFF) | (side << 24); } /* various methods dealing with status: */ public static int getInGameFromStatus(int status) { return status & 0x1; } public static int getAwayBitFromStatus(int status) { return (status & 0x2) >> 1; } public static int getRankFromStatus(int status) { return (status & 0x1C) >> 2; } public static int getAccessFromStatus(int status) { return (status & 0x20) >> 5; } public static boolean getBotModeFromStatus(int status) { return ((status & 0x40) >> 6) == 1; } public static int setInGameToStatus(int status, int inGame) { return (status & 0xFFFFFFFE) | inGame; } public static int setAwayBitToStatus(int status, int away) { return (status & 0xFFFFFFFD) | (away << 1); } public static int setRankToStatus(int status, int rank) { return (status & 0xFFFFFFE3) | (rank << 2); } public static int setAccessToStatus(int status, int access) { if ((access < 0) || (access > 1)) { //System.out.println("Critical error: Invalid use of setAccessToStatus()! Shuting down the server ..."); //TASServer.closeServerAndExit(); } return (status & 0xFFFFFFDF) | (access << 5); } public static boolean isWindows() { String osName = System.getProperty("os.name"); return osName.startsWith("Windows"); } // "Linux public static boolean isMacOSX() { // http://developer.apple.com/technotes/tn2002/tn2110.html String lcOSName = System.getProperty("os.name").toLowerCase(); return lcOSName.startsWith("mac os x"); } public static boolean isMacOS() { // http://developer.apple.com/technotes/tn2002/tn2110.html return System.getProperty("os.name").toLowerCase().startsWith("mac os"); } public static boolean isLinux() { // http://developer.apple.com/technotes/tn2002/tn2110.html String lcOSName = System.getProperty("os.name").toLowerCase(); return lcOSName.startsWith("linux"); } public static boolean isSolaris() { // http://developer.apple.com/technotes/tn2002/tn2110.html String lcOSName = System.getProperty("os.name").toLowerCase(); return lcOSName.startsWith("SunOS"); } public static boolean isJava6() { // http://developer.apple.com/technotes/tn2002/tn2110.html String javaVersion = System.getProperty("java.version"); return javaVersion.startsWith("1.6"); } public static boolean isJava5() { // http://developer.apple.com/technotes/tn2002/tn2110.html String javaVersion = System.getProperty("java.version"); return javaVersion.startsWith("1.5"); } /*public static String GetLobbyFolderPath() { return "lobby/aflobby/"; }*/ public static String GetAbsoluteLobbyFolderPath() { if (!Main.dev_environment) { try { // Get current classloader Misc m = new Misc(); URL u = m.getClass().getProtectionDomain().getCodeSource().getLocation(); File f = new File(u.toURI()); String s = f.getParent().replaceAll("\\\\", "/") + "/lobby/aflobby/"; if (!isWindows()) { s = "/" + s; } s = s.replaceAll("%20", " "); //System.out.println(f.getParent()); return s; } catch (URISyntaxException ex) { Logger.getLogger(Misc.class.getName()).log(Level.SEVERE, null, ex); } return null; } else { File f2 = new File("lobby/aflobby/"); try { //pathSeparator = "/"; // try { String s = f2.toURI().toURL().toString().substring(6); if (isWindows() == false) { s = "/" + s; } s = s.replaceAll("%20", " "); s = s.replaceAll("\\\\", "/"); if (!isWindows()) { s = "/"+s; } //System.out.println("\"" + s + "\""); return s; } catch (MalformedURLException ex) { ex.printStackTrace(); } return ""; } /* File f = new File("lobby/aflobby/"); try { //pathSeparator = "/"; // try { String s = f.toURI().toURL().toString().substring(6).replaceAll("%20", " "); if(isWindows()==false){ s = "/"+s; } if((s.endsWith("/")==false)&&(s.endsWith("\\")==false)){ s +="/"; } return s; } catch (MalformedURLException ex) { ex.printStackTrace(); } return "";*/ } public static String GetMinimapPath() { // return GetAbsoluteLobbyFolderPath() + "minimaps/"; //return ""; } public static int bitStringToInt(String bitString) { int intValue = 0; for (int i = 1; i <= bitString.length(); i++) { int currBit = Integer.parseInt(bitString.substring(i - 1, i)); intValue += currBit * Math.pow(2d, (double) (i-1)); } return intValue; } public static String formatDoubleStrToLength(String toFormat, int length) { if (toFormat.length() > length) { toFormat = toFormat.substring(0, length); } if (toFormat.length() < length) { String zeros = ""; for (int i = 0; i < length - toFormat.length(); i++) { zeros += "0"; } toFormat += zeros; } return toFormat; } }
[ "spring@abma.de" ]
spring@abma.de
11177e423897ef2ede870090fc0cff21e28f05bc
5b0c182eddb2ba25515d6457085bcbe1111d2568
/src/main/java/com/ptteng/gwj/util/DesUtil.java
e5a5abbdf4d70b9b110507763714f996bf81d1f8
[]
no_license
idiotweiwei/task5
9be012896a192083eefe02f19aa470bb60ac1b36
ec2b14f4c5280f40f69d6bf5a915773f0f6bdc8c
refs/heads/master
2021-08-26T08:16:04.003646
2017-11-22T13:38:17
2017-11-22T13:38:17
110,346,312
1
0
null
null
null
null
UTF-8
Java
false
false
2,854
java
package com.ptteng.gwj.util; import javax.crypto.Cipher; import java.security.Key; import java.security.Security; public class DesUtil { private static final String ENCRYPT_TYPE = "DES"; //字符串默认键值 private static String defaultKey = ""; //加密工具 private Cipher encryptCipher = null; //解密工具 private Cipher decryptCipher = null; public DesUtil() throws Exception{ this(defaultKey); } /** * 指定密钥构造方法 * * @param strKey * 指定的密钥 * @throws Exception */ public DesUtil(String strKey) throws Exception{ Security.addProvider(new com.sun.crypto.provider.SunJCE()); Key key = getKey(strKey.getBytes()); encryptCipher = Cipher.getInstance(ENCRYPT_TYPE); encryptCipher.init(Cipher.ENCRYPT_MODE,key); decryptCipher = Cipher.getInstance(ENCRYPT_TYPE); decryptCipher.init(Cipher.DECRYPT_MODE,key); } /** * 加密字节数组 * * @param arr * 需加密的字节数组 * @return 加密后的字节数组 * @throws Exception */ private byte[] encryptStr(byte[] arr) throws Exception{ return encryptCipher.doFinal(arr); } /** * 加密字符串 * * @param strIn * 需加密的字符串 * @return 加密后的字符串 * @throws Exception */ public String encrypt(String strIn) throws Exception{ return StrConvertUtil.byteArrToHexStr(encryptStr(strIn.getBytes())); } /** * 解密字节数组 * * @param arr * 需解密的字节数组 * @return 解密后的字节数组 * @throws Exception */ private byte[] decryptstr(byte[] arr) throws Exception{ return decryptCipher.doFinal(arr); } /** * 解密字符串 * * @param strIn * 需解密的字符串 * @return 解密后的字符串 * @throws Exception */ public String decrypt(String strIn) throws Exception{ return new String(decryptstr(StrConvertUtil.hexStrToByteArr(strIn))); } /** * 从指定字符串生成密钥,密钥所需的字节数组长度为8位。不足8位时后面补0,超出8位只取前8位 * * @param arrBTmp * 构成该字符串的字节数组 * @return 生成的密钥 */ private Key getKey(byte[] arrBTmp){ // 创建一个空的8位字节数组(默认值为0) byte[] arrB = new byte[8]; // 将原始字节数组转换为8位 for(int i = 0;i < arrBTmp.length && i < arrB.length;i++){ arrB[i] = arrBTmp[i]; } //生成密钥 Key key = new javax.crypto.spec.SecretKeySpec(arrB,ENCRYPT_TYPE); return key; } }
[ "614047483@qq.com" ]
614047483@qq.com
58f58ba507bbfdd6146416232fc7a3053b9e7ac8
e226789162eaa1b25ebf57523e06fcc686642236
/src/rcas/controller/PropertiesViewController.java
fd24cc9c04cb99be9ea12b9afec358752212fc86
[]
no_license
zmeieb/RCAS
1891c1ec48fc21a8bd2a8b005a831e9b03427115
38c5fc0cc7a0d1aeca6e5f7700d8e949c01311d9
refs/heads/master
2020-06-12T06:20:47.725713
2019-06-21T11:05:11
2019-06-21T11:05:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,507
java
package rcas.controller; import java.io.IOException; import java.util.Iterator; import java.util.ResourceBundle; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.event.Event; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.scene.chart.LineChart; import javafx.scene.chart.XYChart.Series; import javafx.scene.layout.GridPane; import javafx.scene.layout.Pane; import javafx.stage.Stage; import rcas.model.MagicFormulaTireModel; import rcas.model.RaceCar; import rcas.model.TireModel; import rcas.util.CorneringAnalyserUtil; import rcas.util.Variables; public class PropertiesViewController { public void setPrimaryStage(Stage primaryStage) { this.primaryStage = primaryStage; } private Stage primaryStage; @FXML private GridPane mainPane; @FXML private LineChart<Number, Number> mainChart; @FXML private ResourceBundle resources; @FXML public void initialize() { // create race cars and calculate a chart. RaceCar myRaceCar_1 = new RaceCar(420, 420, 370, 370); TireModel myTireModel_1 = new MagicFormulaTireModel(); myRaceCar_1.setFrontRollDist(0.55); myRaceCar_1.setFrontAxleTireModel(myTireModel_1); myRaceCar_1.setRearAxleTireModel(myTireModel_1); myRaceCar_1.setName("Car STD (blue)"); RaceCar myRaceCar_2 = new RaceCar(420, 420, 370, 370); TireModel myTireModel_2_Fr = new MagicFormulaTireModel(1.3, 15.2, -1.6, 1.6, 0.000075); TireModel myTireModel_2_Rr = new MagicFormulaTireModel(1.3, 15.2, -1.6, 1.8, 0.000075); myRaceCar_2.setFrontRollDist(0.55); myRaceCar_2.setFrontAxleTireModel(myTireModel_2_Fr); myRaceCar_2.setRearAxleTireModel(myTireModel_2_Rr); myRaceCar_2.setName("Car MOD (red)"); CorneringAnalyserUtil corneringUtil = new CorneringAnalyserUtil(); // show what the toString() methods print out. System.out.println(myRaceCar_1.toString()); System.out.println(myRaceCar_2.toString()); // show balance, grip, control and stability values of the cars. this.printRaceCarCorneringValues(myRaceCar_1, corneringUtil); this.printRaceCarCorneringValues(myRaceCar_2, corneringUtil); ObservableList<Series<Number, Number>> dataList_1 = corneringUtil.generateMMMChartData(myRaceCar_1); mainChart.getData().addAll(dataList_1); // Set the style of the series after adding the data to the chart. // Otherwise no there is no reference "Node" which leads to a // NullPointerException. this.setSeriesStyle(dataList_1, ".chart-series-line", "-fx-stroke: blue; -fx-stroke-width: 1px;"); ObservableList<Series<Number, Number>> dataList_2 = corneringUtil.generateMMMChartData(myRaceCar_2); mainChart.getData().addAll(dataList_2); this.setSeriesStyle(dataList_2, ".chart-series-line", "-fx-stroke: red; -fx-stroke-width: 1px;"); } private void setSeriesStyle(ObservableList<Series<Number, Number>> dataList_1, String styleSelector, String lineStyle) { for (Iterator<Series<Number, Number>> iterator = dataList_1.iterator(); iterator.hasNext();) { Series<Number, Number> curve = (Series<Number, Number>) iterator.next(); curve.getNode().lookup(styleSelector).setStyle(lineStyle); } } private void printRaceCarCorneringValues(RaceCar raceCar, CorneringAnalyserUtil util) { System.out.println(String.format( "%s: Grip = %.2f G\tBalance = %.2f Nm\tControl(entry) = %.2f Nm/deg\t" + "Control(middle) = %.2f Nm/deg\tStability(entry) = %.2f Nm/deg\t" + "Stability(middle) = %.2f Nm/deg", raceCar.getName(), util.getMMMGripValue(raceCar) / 9.81, util.getMMMBalanceValue(raceCar), util.getMMMControlValue(raceCar, 0.0, 0.0, 10.0), util.getMMMControlValue(raceCar, -5.0, 20.0, 30.0), util.getMMMStabilityValue(raceCar, 0.0, 0.0, 1.0), util.getMMMStabilityValue(raceCar, 20.0, -5.0, -4.0))); } @FXML private void changeToCarView(ActionEvent event) throws IOException { FXMLLoader fxml = FXMLLoader.load(getClass().getResource("Car.fxml")); Pane mainPane = fxml.load(); Scene mainScene = new Scene(mainPane, 1500, 800); Variables.scene = mainScene; } @FXML void changeToTopView(ActionEvent event) throws IOException { System.out.println("gay"); /** FXMLLoader fxml = FXMLLoader.load(getClass().getResource("Car.fxml")); Pane mainPane = fxml.load(); Scene mainScene = new Scene(mainPane, 1500, 800); primaryStage.setScene(mainScene); primaryStage.show(); Variables.scene = mainScene; **/ } @FXML private void changeToPropertiesView(ActionEvent event){ } }
[ "joelarauber@hotmail.com" ]
joelarauber@hotmail.com
bd4fe0fe4487d5bfb0d2f5efd16d3f9247468892
4bda633ff450e2a53129d93c0c43385c369e5f20
/src/com/JayPi4c/util/Vector.java
7bf088d7439ef1e5decfc6d991cc15bec105bae6
[]
no_license
JayPi4c/Neural-Network-Game
9e29e4382a7c6baa7ce353de234adb1eb7189d37
77441d5f02f6f6f45d04e184326f95d32a0082b3
refs/heads/master
2020-04-13T20:22:20.287104
2018-12-28T16:11:34
2018-12-28T16:11:34
162,196,068
0
0
null
null
null
null
UTF-8
Java
false
false
4,081
java
package com.JayPi4c.util; public class Vector { public double x; public double y; public double z; public Vector() { } public Vector(double x, double y, double z) { this.x = x; this.y = y; this.z = z; } public Vector(double x, double y) { this.x = x; this.y = y; } public Vector set(double x, double y, double z) { this.x = x; this.y = y; this.z = z; return this; } public Vector set(double x, double y) { this.x = x; this.y = y; this.z = 0; return this; } public Vector set(Vector v) { x = v.x; y = v.y; z = v.z; return this; } static public Vector random2D() { return fromAngle((Math.random() * Math.PI * 2)); } static public Vector fromAngle(double angle) { return new Vector(Math.cos(angle), Math.sin(angle), 0); } public Vector copy() { return new Vector(x, y, z); } @Deprecated public Vector get() { return copy(); } public double mag() { return Math.sqrt(x * x + y * y + z * z); } public double magSq() { return (x * x + y * y + z * z); } public Vector add(Vector v) { x += v.x; y += v.y; z += v.z; return this; } public Vector add(double x, double y) { this.x += x; this.y += y; return this; } public Vector add(double x, double y, double z) { this.x += x; this.y += y; this.z += z; return this; } static public Vector add(Vector v1, Vector v2) { return new Vector(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z); } public Vector sub(Vector v) { x -= v.x; y -= v.y; z -= v.z; return this; } public Vector sub(double x, double y) { this.x -= x; this.y -= y; return this; } public Vector sub(double x, double y, double z) { this.x -= x; this.y -= y; this.z -= z; return this; } static public Vector sub(Vector v1, Vector v2) { return new Vector(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z); } public Vector mult(double n) { x *= n; y *= n; z *= n; return this; } static public Vector mult(Vector v, float n) { return new Vector(v.x * n, v.y * n, v.z * n); } public Vector div(double n) { x /= n; y /= n; z /= n; return this; } static public Vector div(Vector v, float n) { return new Vector(v.x / n, v.y / n, v.z / n); } public double dist(Vector v) { double dx = x - v.x; double dy = y - v.y; double dz = z - v.z; return Math.sqrt(dx * dx + dy * dy + dz * dz); } static public double dist(Vector v1, Vector v2) { double dx = v1.x - v2.x; double dy = v1.y - v2.y; double dz = v1.z - v2.z; return Math.sqrt(dx * dx + dy * dy + dz * dz); } public double dot(Vector v) { return x * v.x + y * v.y + z * v.z; } public double dot(double x, double y, double z) { return this.x * x + this.y * y + this.z * z; } static public double dot(Vector v1, Vector v2) { return v1.x * v2.x + v1.y * v2.y + v1.z * v2.z; } public Vector cross(Vector v) { double crossX = y * v.z - v.y * z; double crossY = z * v.x - v.z * x; double crossZ = x * v.y - v.x * y; return new Vector(crossX, crossY, crossZ); } public Vector normalize() { double m = mag(); if (m != 0 && m != 1) { div(m); } return this; } public Vector normalize(Vector target) { if (target == null) { target = new Vector(); } double m = mag(); if (m > 0) { target.set(x / m, y / m, z / m); } else { target.set(x, y, z); } return target; } public Vector limit(double max) { if (magSq() > max * max) { normalize(); mult(max); } return this; } public Vector setMag(double len) { normalize(); mult(len); return this; } public Vector setMag(Vector target, double len) { target = normalize(target); target.mult(len); return target; } public double heading() { double angle = Math.atan2(y, x); return angle; } @Deprecated public double heading2D() { return heading(); } public Vector rotate(double theta) { double temp = x; // Might need to check for rounding errors like with angleBetween function? x = x * Math.cos(theta) - y * Math.sin(theta); y = temp * Math.sin(theta) + y * Math.cos(theta); return this; } }
[ "jonas.jp4c@gmail.com" ]
jonas.jp4c@gmail.com
78f117f4e4a7ac83bf1d85d99ba6118bab508e95
76c3319c5447d94fcb1e64d503e915da5c3344bd
/src/main/java/com/tp/tanks/websocket/RemotePointService.java
f8c83950d1db2bc74677bde6b5d3865eb7f1f8e5
[]
no_license
MaxSamokhin/Something2.5D-09-2017
d1ff02aae7c8a9fe4a0d3ed5ce5fe9fdf2f45ee4
d47d55d81583fc83b0c682ea656d8dd9e2379383
refs/heads/master
2021-05-09T08:03:35.490255
2017-12-06T09:40:06
2017-12-06T09:40:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,189
java
package com.tp.tanks.websocket; import com.fasterxml.jackson.databind.ObjectMapper; import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import org.springframework.web.socket.CloseStatus; import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.WebSocketSession; import java.io.IOException; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentSkipListSet; @Service public class RemotePointService { private static final Logger LOGGER = LoggerFactory.getLogger(RemotePointService.class); private Map<Long, WebSocketSession> sessions = new ConcurrentHashMap<>(); private Set<Long> players = new ConcurrentSkipListSet<>(); private final ObjectMapper objectMapper; public RemotePointService(ObjectMapper objectMapper) { this.objectMapper = objectMapper; } public void registerUser(@NotNull Long userId, @NotNull WebSocketSession webSocketSession) { LOGGER.info("[RemotePointService.registerUser] register userID = " + userId.toString()); sessions.put(userId, webSocketSession); players.add(userId); } public boolean isConnected(@NotNull Long userId) { return sessions.containsKey(userId) && sessions.get(userId).isOpen() && players.contains(userId); } public Set<Long> getPlayers() { return players; } public void removeUser(@NotNull Long userId) { sessions.remove(userId); players.remove(userId); LOGGER.info("[RemotePointService.removeUser] unregister userID = " + userId.toString()); } public void removeAlluses() { sessions.clear(); players.clear(); } public void cutDownConnection(@NotNull Long userId, @NotNull CloseStatus closeStatus) { final WebSocketSession webSocketSession = sessions.get(userId); if (webSocketSession != null && webSocketSession.isOpen()) { try { webSocketSession.close(closeStatus); } catch (IOException ignore) { LOGGER.error("Can't close session"); } } } public void sendMessageToUser(@NotNull Long userId, @NotNull Message message) throws IOException { final WebSocketSession webSocketSession = sessions.get(userId); if (webSocketSession == null) { LOGGER.error("[RemotePointService.sendMessageToUser] webSocketSession is null"); throw new IOException("no game websocket for user " + userId); } if (!webSocketSession.isOpen()) { LOGGER.error("[RemotePointService.sendMessageToUser] session is closed or not exsists"); throw new IOException("session is closed or not exsists"); } //noinspection OverlyBroadCatchBlock try { //noinspection ConstantConditions webSocketSession.sendMessage(new TextMessage(objectMapper.writeValueAsString(message))); } catch (IOException e) { throw new IOException("Unnable to send message", e); } } }
[ "moradan228@gmail.com" ]
moradan228@gmail.com
d34c1602a94fa6cbf11c56f71f22a7624d49bd15
fbaf1fe2e54e9070cabb3c006472799ae254b65f
/SampleService/app/src/main/java/com/example/sampleservice/MyService.java
f608a7170e5575869d57ea4b6e4a65e980d6cb47
[]
no_license
testkkj/Android-L
15326224bf2a89162ac26358d3cd8a38e1284f1c
b6c3a35517b211774f4c4c0cefafb70b0c4dd085
refs/heads/master
2020-07-18T11:47:52.818728
2019-10-15T00:37:27
2019-10-15T00:37:27
171,922,561
0
0
null
null
null
null
UTF-8
Java
false
false
1,846
java
package com.example.sampleservice; import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.util.Log; public class MyService extends Service { private static final String TAG = "MyService"; public MyService() { } @Override public IBinder onBind(Intent intent) { // TODO: Return the communication channel to the service. throw new UnsupportedOperationException("Not yet implemented"); } @Override public void onCreate() { super.onCreate(); Log.d(TAG, "onCreate() called"); } @Override public int onStartCommand(Intent intent, int flags, int startId) { Log.d(TAG, "onStartCommand() called"); if (intent == null) { return Service.START_STICKY; } else { processCommand(intent); } return super.onStartCommand(intent, flags, startId); } private void processCommand(Intent intent) { String command = intent.getStringExtra("command"); String name = intent.getStringExtra("name"); Log.d(TAG, "command : " + command + ", name : " + name); for (int i = 0; i < 5; i++) { try { Thread.sleep(1000); } catch (Exception e) { e.printStackTrace(); } Log.d(TAG, "waiting " + i + " seconds."); } Intent showIntent = new Intent(getApplicationContext(), MainActivity.class); showIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); showIntent.putExtra("command", "show"); showIntent.putExtra("name", name + " from service."); startActivity(showIntent); } @Override public void onDestroy() { super.onDestroy(); } }
[ "kimkj1212@naver.com" ]
kimkj1212@naver.com
9faa0c610e0aa625d35ab52e285a0ae2dc1a8557
d624bde79e8a4f8868218046bb5c37a060dc324d
/app/services/SecureService.java
3cc39e11a6908a2319cc4acee919dba719c0eb9e
[]
no_license
beingsagir/play-jwt-scaffolding
2fa8f237fe10dc6843c8dc3be5e145e0dee004d1
601d7682ccbfa043bc4f11ec99da8a5d5ddc8197
refs/heads/master
2021-06-26T03:35:44.058336
2017-09-14T19:15:03
2017-09-14T19:15:03
103,188,958
1
1
null
2017-09-14T19:15:03
2017-09-11T21:15:30
XSLT
UTF-8
Java
false
false
1,046
java
package services; import com.google.inject.Inject; import models.User; import play.mvc.Http; import play.mvc.Result; import play.mvc.Security; public class SecureService extends Security.Authenticator { @Inject AuthService authService; @Override public String getUsername(Http.Context ctx) { String token = getTokenFromHeader(ctx); if (token != null) { User user = authService.getUserByToken(token); if (user != null) { return user.username; } } return null; } @Override public Result onUnauthorized(Http.Context context) { return super.onUnauthorized(context); } private String getTokenFromHeader(Http.Context ctx) { String[] authTokenHeaderValues = ctx.request().headers().get("X-AUTH-TOKEN"); if ((authTokenHeaderValues != null) && (authTokenHeaderValues.length == 1) && (authTokenHeaderValues[0] != null)) { return authTokenHeaderValues[0]; } return null; } }
[ "sagir.sagir@gmail.com" ]
sagir.sagir@gmail.com
abf61b5ec8628191a8ed59b36c6c6dc4dd73d509
c6411963bbd2769460b2a6f0450baef93d39e7a6
/src/dSankovsky/SecondControl/A2.java
9209b609ac25189438a6eb8d46aef7c62e71c025
[]
no_license
Shumski-Sergey/M-JC1-25-19
06b919e91058666bf000a5d9866937e249d552a3
1133dad04ec9bec4bdb8343841657a488365a1ec
refs/heads/master
2022-04-27T14:48:25.457486
2020-04-17T16:24:00
2020-04-17T16:24:00
228,884,905
1
18
null
2020-04-06T12:13:05
2019-12-18T16:57:48
Java
UTF-8
Java
false
false
1,113
java
package dSankovsky.SecondControl; import java.util.*; import java.util.stream.Stream; public class A2 { public static void main(String[] args) { List<Integer> list = new ArrayList<>(Arrays.asList(10, 20, 30, 40, 50, 100, 60, 1, 10, 20, 20, 70, 54,70,70,70,70,70)); Map<Integer, Integer> intMap = new HashMap<>(); CountNumbersRepeat(list, intMap); FindMaxNumbersRepeat(list, intMap); } private static void FindMaxNumbersRepeat(List<Integer> list, Map<Integer, Integer> intMap) { for (int x : list) { if (intMap.get(x).equals(intMap.values().stream().max(Integer::compareTo).get())) { System.out.println("Number: " + x + " Repeat: " + intMap.get(x)); break; } } } private static void CountNumbersRepeat(List<Integer> list, Map<Integer, Integer> intMap) { for (Integer numb : list) { if (intMap.containsKey(numb)) { intMap.replace(numb, intMap.get(numb) + 1); } else { intMap.put(numb, 1); } } } }
[ "megaantario@mail.ru" ]
megaantario@mail.ru
27c8958a8d26c45e344082f554e9c3b8fabca421
fdfe9c6b5cce9cf132ad362b8a5379a7f70cd777
/Method/QN14.java
b2e208ee46240592ab13caed6aa045f014bec124
[]
no_license
Pradeep-Dhakal/COMPLETE_JAVA
1a72a360068a30fa95ff9da3069496818dcc917e
2eb63232c3e164a0d5b7e61bda621fe5a30515e5
refs/heads/main
2023-02-26T23:38:46.946327
2021-02-11T05:13:29
2021-02-11T05:13:29
337,743,691
0
0
null
null
null
null
UTF-8
Java
false
false
454
java
class Primee { public static void main(String[] args) { for (int i = 2; i < 100; i++) { if (is_Prime(i) && is_Prime(i + 2)) { System.out.printf("%d, %d\n", i, i + 2); } } } public static boolean is_Prime(long n) { if (n < 2) return false; for (int i = 2; i <= n / 2; i++) { if (n % i == 0) return false; } return true; } }
[ "noreply@github.com" ]
noreply@github.com
852e7efef022de90aa98cff57c8917c6da7c127f
47a3a8d5a33b8a26e74492961fb6f413782ad27f
/src/main/java/com/bhusk/black/Application.java
5005368fa259582e36cf31d3a4e9905d5cca18a9
[]
no_license
dengshenkk/Black
b51fe08aa8311320e43c3090425fe9e26c6c3ac6
7daaefd8a755bcdfaadcc41961d51e80c2557fdf
refs/heads/master
2021-06-27T03:17:47.481034
2017-09-16T00:59:27
2017-09-16T00:59:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,432
java
package com.bhusk.black; import com.bhusk.black.util.CheckMobile; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * springboot启动类 */ @Controller @EnableWebMvc @SpringBootApplication @ServletComponentScan @MapperScan(basePackages = "com.bhusk.black.mapper") public class Application extends WebMvcConfigurerAdapter { public static void main(String[] args) { SpringApplication.run(Application.class, args); } @RequestMapping("/") String home(HttpServletRequest request, HttpServletResponse response) { CheckMobile checkMobile = new CheckMobile(); if ("mobile".equals(checkMobile.check(request, response))) { return "redirect:/map/index"; } else if ("pc".equals(checkMobile.check(request, response))) { return "redirect:index"; } else { return "redirect:index"; } } }
[ "yuankz888@gmail.com" ]
yuankz888@gmail.com
a73435103a2396ab3095f8c5e4f5a041ba5ebeaf
32b72e1dc8b6ee1be2e80bb70a03a021c83db550
/ast_results/scoute-dich_K9-MailClient/k9mail/src/main/java/com/fsck/k9/Identity.java
e6ce0f91db1313c28846654fe7ca2e6d338b4851
[]
no_license
cmFodWx5YWRhdjEyMTA5/smell-and-machine-learning
d90c41a17e88fcd99d543124eeb6e93f9133cb4a
0564143d92f8024ff5fa6b659c2baebf827582b1
refs/heads/master
2020-07-13T13:53:40.297493
2019-01-11T11:51:18
2019-01-11T11:51:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,714
java
// isComment package com.fsck.k9; import java.io.Serializable; public class isClassOrIsInterface implements Serializable { private static final long isVariable = -isStringConstant; private String isVariable; private String isVariable; private String isVariable; private String isVariable; private boolean isVariable; private String isVariable; public synchronized String isMethod() { return isNameExpr; } public synchronized void isMethod(String isParameter) { isNameExpr = isNameExpr; } public synchronized String isMethod() { return isNameExpr; } public synchronized void isMethod(String isParameter) { isNameExpr = isNameExpr; } public synchronized boolean isMethod() { return isNameExpr; } public synchronized void isMethod(boolean isParameter) { isNameExpr = isNameExpr; } public synchronized String isMethod() { return isNameExpr; } public synchronized void isMethod(String isParameter) { isNameExpr = isNameExpr; } public synchronized String isMethod() { return isNameExpr; } public synchronized void isMethod(String isParameter) { isNameExpr = isNameExpr; } public synchronized String isMethod() { return isNameExpr; } public synchronized void isMethod(String isParameter) { this.isFieldAccessExpr = isNameExpr; } @Override public synchronized String isMethod() { return "isStringConstant" + isNameExpr + "isStringConstant" + isNameExpr + "isStringConstant" + isNameExpr + "isStringConstant" + isNameExpr + "isStringConstant" + isNameExpr; } }
[ "matheus@melsolucoes.net" ]
matheus@melsolucoes.net
9dd7e7a25750aee81942a71ed41d50efdf8e645d
9342e0e40cbf2b3ed4878e7180b5b4ced08225ca
/src/org/thaidev/crossstitch/ui/CrossStitchUI.java
a231fd17beb18ee54aa6a26960b8d2f64270bb1e
[]
no_license
wee/CrossStitch
f4366202862a4a72bccabe3f22421fec8e2a22a8
3b30ec41f635bf8cf3cbe9d1570d876de1efae57
refs/heads/master
2020-05-30T19:19:25.444282
2011-03-05T18:01:21
2011-03-05T18:01:21
1,443,877
1
1
null
null
null
null
UTF-8
Java
false
false
20,140
java
/* * Created on Dec 13, 2003 * */ package org.thaidev.crossstitch.ui; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.UIManager; import org.thaidev.crossstitch.DMC; import org.thaidev.crossstitch.event.CancelEvent; import org.thaidev.crossstitch.event.DoStitchEvent; import org.thaidev.crossstitch.event.ErrorStatusMessageEvent; import org.thaidev.crossstitch.event.FileExportHTMLEvent; import org.thaidev.crossstitch.event.FileOpenEvent; import org.thaidev.crossstitch.event.FileSaveEvent; import org.thaidev.crossstitch.event.ProgressEvent; import org.thaidev.crossstitch.event.StatusMessageEvent; import org.thaidev.util.Observable; import org.thaidev.util.Observer; /** * Cross Stitch matching user interface LGPL Open source copyright * * @author Zombibi * @version 0.9 20031012 * @author Mr Sweetcorn mcgyver@writeme.com * @version 1.0 20031013 * @version 2.0 20031214 * @version 2.0.1 20040428 Fix toolbar bug * */ public class CrossStitchUI extends JFrame implements Observable, Observer { public final static String STITCH_ONE_FIFTH = "STITCH_ONE_FIFTH"; public final static String STITCH_ONE_FOURTH = "STITCH_ONE_FOURTH"; public final static String STITCH_ONE_THIRD = "STITCH_ONE_THIRD"; public final static String STITCH_HALF = "STITCH_HALF"; public final static String STITCH_FULL = "STITCH_FULL"; public final Icon ICON_OPEN = new ImageIcon(getClass().getResource("/images/open.gif")); public final Icon ICON_SAVE = new ImageIcon(getClass().getResource("/images/save_active.gif")); public final Icon ICON_STOP = new ImageIcon(getClass().getResource("/images/stop_active.gif")); public final Icon ICON_EXIT = new ImageIcon(getClass().getResource("/images/exit.gif")); public final Icon ICON_EXPORT = new ImageIcon(getClass().getResource("/images/export_active.gif")); public final Icon ICON_SHOW = new ImageIcon(getClass().getResource("/images/show.gif")); private String lastFolder = ""; private List observers = new ArrayList(); private LocalActionListener localListener = new LocalActionListener(); private javax.swing.JPanel jContentPane = null; private javax.swing.JMenuBar jJMenuBar = null; private javax.swing.JMenu jMenu = null; private javax.swing.JMenuItem jMenuItem = null; private javax.swing.JMenuItem jMenuItem1 = null; private javax.swing.JMenu jMenu2 = null; private javax.swing.JMenuItem jMenuItem2 = null; private javax.swing.JMenuItem jMenuItem3 = null; private javax.swing.JMenuItem jMenuItem4 = null; private javax.swing.JMenuItem jMenuItem5 = null; private javax.swing.JMenuItem jMenuItem6 = null; private javax.swing.JPanel jPanel = null; private javax.swing.JLabel statusLabel = null; private javax.swing.JProgressBar statusProgressBar = null; private javax.swing.JSplitPane jSplitPane = null; private org.thaidev.crossstitch.ui.ImageDecoratorPanel inputImagePanel = null; private org.thaidev.crossstitch.ui.ImageDecoratorPanel outputImagePanel = null; private javax.swing.JMenuItem jMenuItem7 = null; private javax.swing.JMenuItem jMenuItem8 = null; private javax.swing.JButton jButton = null; private javax.swing.JToolBar jToolBar = null; private javax.swing.JButton jButton1 = null; private javax.swing.JButton jButton2 = null; private javax.swing.JButton jButton3 = null; private javax.swing.JButton jButton4 = null; private javax.swing.JButton jButton5 = null; /** * This is the default constructor */ public CrossStitchUI() { super(); initialize(); /* this.getGlassPane().addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); String keyString = KeyEvent.getKeyText(key); if ("Escape".equals(keyString)) { System.out.println("esc hit"); notifyObservers(new CancelEvent()); getStatusLabel().setText("Cancelled."); } else { System.out.println("key pressed = " + key); } } }); */ } /** * This method initializes this * * @return void */ private void initialize() { this.setSize(780, 580); this.setContentPane(getJContentPane()); this.setJMenuBar(getJJMenuBar()); this.setTitle("CrossStitch 2.0 by ThaiDev.org"); this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setLookAndFeel(); } private void setLookAndFeel() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); // "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); SwingUtilities.updateComponentTreeUI(this); } catch (Exception ex) { ex.printStackTrace(); } } /** * This method initializes jContentPane * * @return javax.swing.JPanel */ private javax.swing.JPanel getJContentPane() { if (jContentPane == null) { jContentPane = new javax.swing.JPanel(); jContentPane.setLayout(new java.awt.BorderLayout()); jContentPane.add(getJPanel(), java.awt.BorderLayout.SOUTH); javax.swing.JPanel internalPanel = new javax.swing.JPanel(new java.awt.BorderLayout()); internalPanel.add(getJSplitPane(), java.awt.BorderLayout.CENTER); internalPanel.add(getJToolBar(), java.awt.BorderLayout.NORTH); jContentPane.add(internalPanel, java.awt.BorderLayout.CENTER); } return jContentPane; } /** * This method initializes jJMenuBar * * @return javax.swing.JMenuBar */ private javax.swing.JMenuBar getJJMenuBar() { if(jJMenuBar == null) { jJMenuBar = new javax.swing.JMenuBar(); jJMenuBar.add(getJMenu()); jJMenuBar.add(getJMenu2()); } return jJMenuBar; } /** * This method initializes jMenu * * @return javax.swing.JMenu */ private javax.swing.JMenu getJMenu() { if(jMenu == null) { jMenu = new javax.swing.JMenu(); jMenu.add(getJMenuItem()); jMenu.add(getJMenuItem7()); jMenu.add(getJMenuItem8()); jMenu.addSeparator(); jMenu.add(getJMenuItem1()); jMenu.setText("File"); } return jMenu; } /** * This method initializes jMenuItem * * @return javax.swing.JMenuItem */ private javax.swing.JMenuItem getJMenuItem() { if(jMenuItem == null) { jMenuItem = new javax.swing.JMenuItem(); jMenuItem.setText("Open image file..."); jMenuItem.setIcon(ICON_OPEN); jMenuItem.setActionCommand("OPEN"); jMenuItem.addActionListener(new LocalOpenListener()); } return jMenuItem; } /** * This method initializes jMenuItem1 * * @return javax.swing.JMenuItem */ private javax.swing.JMenuItem getJMenuItem1() { if(jMenuItem1 == null) { jMenuItem1 = new javax.swing.JMenuItem(); jMenuItem1.setText("Exit"); jMenuItem1.setIcon(ICON_EXIT); jMenuItem1.setActionCommand("EXIT"); jMenuItem1.addActionListener(new LocalExitListener()); } return jMenuItem1; } /** * This method initializes jMenu2 * * @return javax.swing.JMenu */ private javax.swing.JMenu getJMenu2() { if(jMenu2 == null) { jMenu2 = new javax.swing.JMenu(); jMenu2.add(getJMenuItem2()); jMenu2.add(getJMenuItem3()); jMenu2.add(getJMenuItem4()); jMenu2.add(getJMenuItem5()); jMenu2.add(getJMenuItem6()); jMenu2.setText("Stitch"); } return jMenu2; } /** * This method initializes jMenuItem2 * * @return javax.swing.JMenuItem */ private javax.swing.JMenuItem getJMenuItem2() { if(jMenuItem2 == null) { jMenuItem2 = new javax.swing.JMenuItem(); jMenuItem2.setText("1/5-sized Image"); jMenuItem2.setActionCommand(STITCH_ONE_FIFTH); jMenuItem2.addActionListener(localListener); } return jMenuItem2; } /** * This method initializes jMenuItem3 * * @return javax.swing.JMenuItem */ private javax.swing.JMenuItem getJMenuItem3() { if(jMenuItem3 == null) { jMenuItem3 = new javax.swing.JMenuItem(); jMenuItem3.setText("1/4-sized Image"); jMenuItem3.setActionCommand(STITCH_ONE_FOURTH); jMenuItem3.addActionListener(localListener); } return jMenuItem3; } /** * This method initializes jMenuItem4 * * @return javax.swing.JMenuItem */ private javax.swing.JMenuItem getJMenuItem4() { if(jMenuItem4 == null) { jMenuItem4 = new javax.swing.JMenuItem(); jMenuItem4.setText("1/3-sized Image"); jMenuItem4.setActionCommand(STITCH_ONE_THIRD); jMenuItem4.addActionListener(localListener); } return jMenuItem4; } /** * This method initializes jMenuItem5 * * @return javax.swing.JMenuItem */ private javax.swing.JMenuItem getJMenuItem5() { if(jMenuItem5 == null) { jMenuItem5 = new javax.swing.JMenuItem(); jMenuItem5.setText("Half-sized Image"); jMenuItem5.setActionCommand(STITCH_HALF); jMenuItem5.addActionListener(localListener); } return jMenuItem5; } /** * This method initializes jMenuItem6 * * @return javax.swing.JMenuItem */ private javax.swing.JMenuItem getJMenuItem6() { if(jMenuItem6 == null) { jMenuItem6 = new javax.swing.JMenuItem(); jMenuItem6.setText("Full-sized Image"); jMenuItem6.setActionCommand(STITCH_FULL); jMenuItem6.addActionListener(localListener); } return jMenuItem6; } /** * This method initializes jPanel * * @return javax.swing.JPanel */ private javax.swing.JPanel getJPanel() { if(jPanel == null) { jPanel = new javax.swing.JPanel(); jPanel.setLayout(new java.awt.BorderLayout()); jPanel.add(getStatusLabel(), java.awt.BorderLayout.WEST); JPanel panel = new JPanel(); panel.add(getStatusProgressBar()); panel.add(getJButton()); jPanel.add(panel, java.awt.BorderLayout.EAST); } return jPanel; } /** * This method initializes jLabel * * @return javax.swing.JLabel */ private javax.swing.JLabel getStatusLabel() { if(statusLabel == null) { statusLabel = new javax.swing.JLabel(); statusLabel.setText("Welcome to ThaiDev.org CrossStitch, Open an Image File to begin."); } return statusLabel; } /** * This method initializes statusProgressBar * * @return javax.swing.JProgressBar */ private javax.swing.JProgressBar getStatusProgressBar() { if(statusProgressBar == null) { statusProgressBar = new javax.swing.JProgressBar(); statusProgressBar.setStringPainted(true); } return statusProgressBar; } /** * This method initializes jSplitPane * * @return javax.swing.JSplitPane */ private javax.swing.JSplitPane getJSplitPane() { if(jSplitPane == null) { jSplitPane = new javax.swing.JSplitPane(); jSplitPane.setLeftComponent(getInputImagePanel()); jSplitPane.setRightComponent(getOutputImagePanel()); jSplitPane.setOneTouchExpandable(true); jSplitPane.setContinuousLayout(true); jSplitPane.setDividerLocation(400); } return jSplitPane; } /* (non-Javadoc) * @see org.thaidev.util.Observable#addObserver(org.thaidev.util.Observer) */ public void addObserver(Observer o) { observers.add(o); } /* (non-Javadoc) * @see org.thaidev.util.Observable#removeObserver(org.thaidev.util.Observer) */ public void removeObserver(Observer o) { observers.remove(o); } /* (non-Javadoc) * @see org.thaidev.util.Observable#notifyObservers(java.lang.Object) */ public void notifyObservers(Object arg) { for (Iterator iter = observers.iterator(); iter.hasNext(); ) { Observer o = (Observer)iter.next(); o.update(this, arg); } } /* (non-Javadoc) * @see org.thaidev.util.Observer#update(org.thaidev.util.Observable, java.lang.Object) */ public void update(Observable o, Object arg) { if (arg instanceof StatusMessageEvent) { if (arg instanceof ErrorStatusMessageEvent) getStatusLabel().setForeground(Color.RED); getStatusLabel().setText(((StatusMessageEvent)arg).getMessage()); } if (arg instanceof ProgressEvent) { int percentValue = ((ProgressEvent)arg).getPercentValue(); if (percentValue == 0) { getStatusLabel().setText("Stitching...press 'Stop' button to stop"); getJButton().setEnabled(true); } else if (percentValue == 100) { getStatusLabel().setText("Done."); getJButton().setEnabled(false); } statusProgressBar.setValue(percentValue); } } /** * This method initializes inputImagePanel * * @return org.thaidev.crossstich.ImageDecoratorPanel */ public org.thaidev.crossstitch.ui.ImageDecoratorPanel getInputImagePanel() { if(inputImagePanel == null) { inputImagePanel = new org.thaidev.crossstitch.ui.ImageDecoratorPanel(); inputImagePanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Input Image", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); } return inputImagePanel; } /** * This method initializes outputImagePanel * * @return org.thaidev.crossstich.ImageDecoratorPanel */ public org.thaidev.crossstitch.ui.ImageDecoratorPanel getOutputImagePanel() { if(outputImagePanel == null) { outputImagePanel = new org.thaidev.crossstitch.ui.ImageDecoratorPanel(); outputImagePanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Output Image", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); } return outputImagePanel; } private final class LocalExitListener implements java.awt.event.ActionListener { public void actionPerformed(java.awt.event.ActionEvent e) { System.exit(0); } } private final class LocalExportListener implements java.awt.event.ActionListener { public void actionPerformed(java.awt.event.ActionEvent e) { JFileChooser fc = new JFileChooser(); int retVal = fc.showSaveDialog(CrossStitchUI.this); if (retVal == JFileChooser.APPROVE_OPTION) { File fileSelected = fc.getSelectedFile(); notifyObservers(new FileExportHTMLEvent(fileSelected)); } } } private final class LocalSaveListener implements java.awt.event.ActionListener { public void actionPerformed(java.awt.event.ActionEvent e) { JFileChooser fc = new JFileChooser(lastFolder); int retVal = fc.showSaveDialog(CrossStitchUI.this); if (retVal == JFileChooser.APPROVE_OPTION) { File fileSelected = fc.getSelectedFile(); lastFolder = fileSelected.getAbsolutePath(); notifyObservers(new FileSaveEvent(fileSelected)); } } } private final class LocalOpenListener implements java.awt.event.ActionListener { public void actionPerformed(java.awt.event.ActionEvent e) { JFileChooser fc = new JFileChooser(lastFolder); int retVal = fc.showOpenDialog(CrossStitchUI.this); if (retVal == JFileChooser.APPROVE_OPTION) { File fileSelected = fc.getSelectedFile(); lastFolder = fileSelected.getAbsolutePath(); notifyObservers(new FileOpenEvent(fileSelected)); } } } private class LocalActionListener implements ActionListener { /* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); int step = 0; if (STITCH_FULL.equals(cmd)) step = 1; else if (STITCH_HALF.equals(cmd)) step = 2; else if (STITCH_ONE_THIRD.equals(cmd)) step = 3; else if (STITCH_ONE_FOURTH.equals(cmd)) step = 4; else if (STITCH_ONE_FIFTH.equals(cmd)) step = 5; if (step != 0) notifyObservers(new DoStitchEvent(step)); } } /** * This method initializes jMenuItem7 * * @return javax.swing.JMenuItem */ private javax.swing.JMenuItem getJMenuItem7() { if(jMenuItem7 == null) { jMenuItem7 = new javax.swing.JMenuItem(); jMenuItem7.setText("Save image as..."); jMenuItem7.setIcon(ICON_SAVE); jMenuItem7.setActionCommand("SAVE"); jMenuItem7.addActionListener(new LocalSaveListener()); } return jMenuItem7; } /** * This method initializes jMenuItem8 * * @return javax.swing.JMenuItem */ private javax.swing.JMenuItem getJMenuItem8() { if(jMenuItem8 == null) { jMenuItem8 = new javax.swing.JMenuItem(); jMenuItem8.setText("Export to HTML..."); jMenuItem8.setIcon(ICON_EXPORT); jMenuItem8.setActionCommand("HTML"); jMenuItem8.addActionListener(new LocalExportListener()); } return jMenuItem8; } /** * This method initializes jButton * * @return javax.swing.JButton */ private javax.swing.JButton getJButton() { if(jButton == null) { jButton = new javax.swing.JButton(); jButton.setText("Stop"); jButton.setIcon(ICON_STOP); jButton.setPreferredSize(new java.awt.Dimension(100,25)); jButton.setEnabled(false); jButton.addActionListener(new ActionListener() { /* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent e) { notifyObservers(new CancelEvent()); getStatusLabel().setText("Cancelled."); jButton.setEnabled(false); } }); } return jButton; } /** * This method initializes jToolBar * * @return javax.swing.JToolBar */ private javax.swing.JToolBar getJToolBar() { if(jToolBar == null) { jToolBar = new javax.swing.JToolBar(); jToolBar.setMargin(new java.awt.Insets(5,5,5,5)); jToolBar.add(getOpenButton()); jToolBar.add(getSaveButton()); jToolBar.add(getExportButton()); jToolBar.add(getShowColorsButton()); jToolBar.add(getExitButton()); } return jToolBar; } /** * This method initializes jButton1 * * @return javax.swing.JButton */ private javax.swing.JButton getOpenButton() { if(jButton1 == null) { jButton1 = new javax.swing.JButton(); jButton1.setText("Open"); jButton1.setIcon(ICON_OPEN); jButton1.addActionListener(new LocalOpenListener()); } return jButton1; } /** * This method initializes jButton2 * * @return javax.swing.JButton */ private javax.swing.JButton getSaveButton() { if(jButton2 == null) { jButton2 = new javax.swing.JButton(); jButton2.setText("Save"); jButton2.setIcon(ICON_SAVE); jButton2.addActionListener(new LocalSaveListener()); } return jButton2; } /** * This method initializes jButton3 * * @return javax.swing.JButton */ private javax.swing.JButton getExportButton() { if(jButton3 == null) { jButton3 = new javax.swing.JButton(); jButton3.setText("Export HTML"); jButton3.addActionListener(new LocalExportListener()); jButton3.setIcon(ICON_EXPORT); } return jButton3; } /** * This method initializes jButton4 * * @return javax.swing.JButton */ private javax.swing.JButton getExitButton() { if(jButton4 == null) { jButton4 = new javax.swing.JButton(); jButton4.setText("Exit"); jButton4.setIcon(ICON_EXIT); jButton4.addActionListener(new LocalExitListener()); } return jButton4; } /** * This method initializes jButton5 * * @return javax.swing.JButton */ private javax.swing.JButton getShowColorsButton() { if(jButton5 == null) { jButton5 = new javax.swing.JButton(); jButton5.setText("Show Colors"); jButton5.setIcon(ICON_SHOW); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { JFrame colorFrame = new JFrame(); colorFrame.setContentPane(new ColorPanel(colorFrame, new DMC())); colorFrame.setTitle("Color Table"); colorFrame.pack(); colorFrame.setVisible(true); } }); } return jButton5; } }
[ "weerasak@gmail.com" ]
weerasak@gmail.com
83156a58988900bebe5431a06f5327dc9587122f
0b8b3b7ecba36384ba32b893a4405357af7d7112
/src/main/java/co/com/choucair/certificacion/proyectobase/userinterface/ChoucairLoginPage.java
ca97de386b79f798aa8572bb2574f9102f88e694
[]
no_license
Jhonatan1993/proyectoBaseChoucair
80ac017152b1fe946585f834971b27f41af9f458
9aa7ea4a0db2a472f16f99d17fc029b93d1dcad3
refs/heads/master
2023-08-14T14:06:10.988600
2021-09-22T17:03:42
2021-09-22T17:03:42
409,273,192
0
0
null
null
null
null
UTF-8
Java
false
false
945
java
package co.com.choucair.certificacion.proyectobase.userinterface; import net.serenitybdd.core.pages.PageObject; import net.serenitybdd.screenplay.targets.Target; import org.openqa.selenium.By; public class ChoucairLoginPage extends PageObject{ public static final Target LOGIN_BUTTON = Target.the("Dar click para mostrar el formulario de login") .located(By.xpath("//*[@id=\"nav-menu\"]/ul[2]/li/a")); public static final Target INPUT_USER = Target.the("Ingresar el nombre de usuario") .located(By.xpath("//input[@id=\"username\"]")); public static final Target INPUT_PASSWORD = Target.the("Ingresar la contraseña") .located(By.xpath("//input[@id=\"password\"]")); public static final Target ACCESS_BUTTON = Target.the("Dar click para ingresar a la pagina") .located(By.xpath("/html/body/div[1]/div[2]/div/section/div[2]/div[1]/div/div/div[2]/div[2]/form/div[3]/button")); }
[ "Administrado@PO-5457-X5G63.heinsohn.com.co" ]
Administrado@PO-5457-X5G63.heinsohn.com.co
af64baf775d54d0c6c9c5f83ebc37ca6dac05233
da364ef8694bcb00f867c3edbe3986f908ad06d8
/ibxm/LogTable.java
3024b6aaba156e7ba005469a3720fa76aaa2a202
[]
no_license
WesleyRen/minecraft-youthdigital
5928ca94f8eb2b3ec32cd792c081c889a0567188
6a5b064344c545de58fc7774002568d60c5f2c3c
refs/heads/master
2021-01-10T14:33:44.860609
2015-11-29T23:09:11
2015-11-29T23:09:11
47,078,845
2
0
null
null
null
null
UTF-8
Java
false
false
3,354
java
package ibxm; /* Base-2 Log and Exp functions, using linear-interpolated tables. */ public class LogTable { private static final int TABLE_SHIFT = 7; // 128 points (+1 for interp) private static final int INTERP_SHIFT = IBXM.FP_SHIFT - TABLE_SHIFT; private static final int INTERP_MASK = ( 1 << INTERP_SHIFT ) - 1; private static final int[] exp_2_table = { 32768, 32945, 33124, 33304, 33485, 33667, 33850, 34033, 34218, 34404, 34591, 34779, 34968, 35157, 35348, 35540, 35733, 35927, 36122, 36319, 36516, 36714, 36913, 37114, 37315, 37518, 37722, 37926, 38132, 38339, 38548, 38757, 38967, 39179, 39392, 39606, 39821, 40037, 40254, 40473, 40693, 40914, 41136, 41359, 41584, 41810, 42037, 42265, 42494, 42725, 42957, 43190, 43425, 43661, 43898, 44136, 44376, 44617, 44859, 45103, 45347, 45594, 45841, 46090, 46340, 46592, 46845, 47099, 47355, 47612, 47871, 48131, 48392, 48655, 48919, 49185, 49452, 49720, 49990, 50262, 50535, 50809, 51085, 51362, 51641, 51922, 52204, 52487, 52772, 53059, 53347, 53636, 53928, 54220, 54515, 54811, 55108, 55408, 55709, 56011, 56315, 56621, 56928, 57238, 57548, 57861, 58175, 58491, 58809, 59128, 59449, 59772, 60096, 60423, 60751, 61081, 61412, 61746, 62081, 62418, 62757, 63098, 63440, 63785, 64131, 64479, 64830, 65182, 65536 }; private static final int[] log_2_table = { 0, 367, 732, 1095, 1454, 1811, 2165, 2517, 2865, 3212, 3556, 3897, 4236, 4572, 4906, 5238, 5568, 5895, 6220, 6542, 6863, 7181, 7497, 7812, 8124, 8434, 8742, 9048, 9352, 9654, 9954, 10252, 10548, 10843, 11136, 11427, 11716, 12003, 12289, 12573, 12855, 13136, 13414, 13692, 13967, 14241, 14514, 14785, 15054, 15322, 15588, 15853, 16117, 16378, 16639, 16898, 17156, 17412, 17667, 17920, 18172, 18423, 18673, 18921, 19168, 19413, 19657, 19900, 20142, 20383, 20622, 20860, 21097, 21333, 21568, 21801, 22034, 22265, 22495, 22724, 22952, 23178, 23404, 23628, 23852, 24074, 24296, 24516, 24736, 24954, 25171, 25388, 25603, 25817, 26031, 26243, 26455, 26665, 26875, 27084, 27292, 27499, 27705, 27910, 28114, 28317, 28520, 28721, 28922, 29122, 29321, 29519, 29716, 29913, 30109, 30304, 30498, 30691, 30884, 31076, 31267, 31457, 31646, 31835, 32023, 32210, 32397, 32582, 32768 }; /* Calculate log-base-2 of x (non-fixed-point). A fixed point value is returned. */ public static int log_2( int x ) { int shift; /* Scale x to range 1.0 <= x < 2.0 */ shift = IBXM.FP_SHIFT; while( x < IBXM.FP_ONE ) { x <<= 1; shift--; } while( x >= ( IBXM.FP_ONE << 1 ) ) { x >>= 1; shift++; } return ( IBXM.FP_ONE * shift ) + eval_table( log_2_table, x - IBXM.FP_ONE ); } /* Raise 2 to the power x (fixed point). A fixed point value is returned. */ public static int raise_2( int x ) { int y; y = eval_table( exp_2_table, x & IBXM.FP_MASK ) << IBXM.FP_SHIFT; return y >> IBXM.FP_SHIFT - ( x >> IBXM.FP_SHIFT ); } private static int eval_table( int[] table, int x ) { int table_idx, table_frac, c, m, y; table_idx = x >> INTERP_SHIFT; table_frac = x & INTERP_MASK; c = table[ table_idx ]; m = table[ table_idx + 1 ] - c; y = ( m * table_frac >> INTERP_SHIFT ) + c; return y >> 15 - IBXM.FP_SHIFT; } }
[ "wesleyren@yahoo.com" ]
wesleyren@yahoo.com